| 1 | package Business::Monzo::Merchant; | ||||||||||
| 2 | |||||||||||
| 3 | =head1 NAME | ||||||||||
| 4 | |||||||||||
| 5 | Business::Monzo::Merchant | ||||||||||
| 6 | |||||||||||
| 7 | =head1 DESCRIPTION | ||||||||||
| 8 | |||||||||||
| 9 | A class for a Monzo merchant, extends L<Business::Monzo::Resource> | ||||||||||
| 10 | |||||||||||
| 11 | =cut | ||||||||||
| 12 | |||||||||||
| 13 | 11 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 11 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | 11 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 11 | extends 'Business::Monzo::Resource'; | |||||||||
| 18 | 11 | with 'Business::Monzo::Utils'; | |||||||||
| 19 | |||||||||||
| 20 | 11 | ▶ | use Types::Standard qw/ :all /; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 11 | ▶ | use Business::Monzo::Address; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 11 | ▶ | use Business::Monzo::Exception; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | |||||||||||
| 24 | =head1 ATTRIBUTES | ||||||||||
| 25 | |||||||||||
| 26 | The Merchant class has the following attributes (with their type). | ||||||||||
| 27 | |||||||||||
| 28 | id (Str) | ||||||||||
| 29 | group_id (Str) | ||||||||||
| 30 | logo (Str) | ||||||||||
| 31 | emoji (Str) | ||||||||||
| 32 | name (Str) | ||||||||||
| 33 | category (Str) | ||||||||||
| 34 | online (Bool) | ||||||||||
| 35 | atm (Bool) | ||||||||||
| 36 | disable_feedback (Bool) | ||||||||||
| 37 | address (Business::Monzo::Address) | ||||||||||
| 38 | created (DateTime) | ||||||||||
| 39 | updated (DateTime) | ||||||||||
| 40 | metadata (HashRef) | ||||||||||
| 41 | |||||||||||
| 42 | Note that if a HashRef or Str is passed to ->address it will be coerced | ||||||||||
| 43 | into a Business::Monzo::Address object. When a Str is passed to ->created | ||||||||||
| 44 | or ->updated these will be coerced to a DateTime object. | ||||||||||
| 45 | |||||||||||
| 46 | =cut | ||||||||||
| 47 | |||||||||||
| 48 | 11 | has [ qw/ id group_id logo emoji name category / ] => ( | |||||||||
| 49 | is => 'ro', | ||||||||||
| 50 | isa => Str, | ||||||||||
| 51 | ); | ||||||||||
| 52 | |||||||||||
| 53 | 11 | has [ qw/ metadata / ] => ( | |||||||||
| 54 | is => 'ro', | ||||||||||
| 55 | isa => HashRef, | ||||||||||
| 56 | ); | ||||||||||
| 57 | |||||||||||
| 58 | 11 | has [ qw/ online atm disable_feedback / ] => ( | |||||||||
| 59 | is => 'ro', | ||||||||||
| 60 | isa => Any, | ||||||||||
| 61 | ); | ||||||||||
| 62 | |||||||||||
| 63 | has address => ( | ||||||||||
| 64 | is => 'ro', | ||||||||||
| 65 | isa => Maybe[InstanceOf['Business::Monzo::Address']], | ||||||||||
| 66 | 4 | ▶ | coerce => sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||
| 67 | |||||||||||
| 68 | 4 | my ( $args ) = @_; | |||||||||
| 69 | |||||||||||
| 70 | 4 | ▶ | if ( ref ( $args ) eq 'HASH' ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 71 | $args = Business::Monzo::Address->new( | ||||||||||
| 72 | client => $Business::Monzo::Resource::client, | ||||||||||
| 73 | 4 | %{ $args }, | |||||||||
| 74 | ); | ||||||||||
| 75 | } | ||||||||||
| 76 | |||||||||||
| 77 | 4 | return $args; | |||||||||
| 78 | }, | ||||||||||
| 79 | 11 | ); | |||||||||
| 80 | |||||||||||
| 81 | has [ qw/ created updated / ] => ( | ||||||||||
| 82 | is => 'ro', | ||||||||||
| 83 | isa => Maybe[InstanceOf['DateTime']], | ||||||||||
| 84 | 5 | ▶ | coerce => sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||
| 85 | 5 | my ( $args ) = @_; | |||||||||
| 86 | |||||||||||
| 87 | 5 | ▶ | if ( ! ref( $args ) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 88 | 5 | $args = DateTime::Format::DateParse->parse_datetime( $args ); | |||||||||
| 89 | } | ||||||||||
| 90 | |||||||||||
| 91 | 5 | return $args; | |||||||||
| 92 | }, | ||||||||||
| 93 | 11 | ); | |||||||||
| 94 | |||||||||||
| 95 | =head1 Operations on an merchant | ||||||||||
| 96 | |||||||||||
| 97 | None at present | ||||||||||
| 98 | |||||||||||
| 99 | =cut | ||||||||||
| 100 | |||||||||||
| 101 | 1 | ▶ | sub get { | ||||||||
|
Subroutine
get: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 102 | 1 | Business::Monzo::Exception->throw({ | |||||||||
| 103 | message => "Monzo API does not currently support getting merchant data", | ||||||||||
| 104 | }); | ||||||||||
| 105 | } | ||||||||||
| 106 | |||||||||||
| 107 | =head1 SEE ALSO | ||||||||||
| 108 | |||||||||||
| 109 | L<Business::Monzo> | ||||||||||
| 110 | |||||||||||
| 111 | L<Business::Monzo::Resource> | ||||||||||
| 112 | |||||||||||
| 113 | =head1 AUTHOR | ||||||||||
| 114 | |||||||||||
| 115 | Lee Johnson - C<leejo@cpan.org> | ||||||||||
| 116 | |||||||||||
| 117 | =head1 LICENSE | ||||||||||
| 118 | |||||||||||
| 119 | This library is free software; you can redistribute it and/or modify it under | ||||||||||
| 120 | the same terms as Perl itself. If you would like to contribute documentation, | ||||||||||
| 121 | features, bug fixes, or anything else then please raise an issue / pull request: | ||||||||||
| 122 | |||||||||||
| 123 | https://github.com/leejo/business-monzo | ||||||||||
| 124 | |||||||||||
| 125 | =cut | ||||||||||
| 126 | |||||||||||
| 127 | 11 | 1; | |||||||||
| 128 | |||||||||||
| 129 | # vim: ts=4:sw=4:et | ||||||||||