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