| 1 | package Business::TrueLayer::MerchantAccount; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | Business::TrueLayer::MerchantAccount - class representing a merchant account | ||
| 6 | as used in the TrueLayer v3 API. | ||
| 7 | |||
| 8 | https://docs.truelayer.com/docs/merchant-accounts-1 | ||
| 9 | |||
| 10 | =head1 SYNOPSIS | ||
| 11 | |||
| 12 | my $MerchantAccount = Business::TrueLayer::MerchantAccount->new( | ||
| 13 | id => ... | ||
| 14 | ); | ||
| 15 | |||
| 16 | =cut | ||
| 17 | |||
| 18 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 19 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 20 | 2 | ▶ | use feature qw/ signatures postderef /; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 21 | |||
| 22 | 2 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 23 | 2 | ▶ | use Moose::Util::TypeConstraints; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 24 | 2 | ▶ | no warnings qw/ experimental::signatures experimental::postderef /; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 25 | |||
| 26 | 2 | ▶ | use Business::TrueLayer::MerchantAccount::Identifier; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 27 | |||
| 28 | =head1 ATTRIBUTES | ||
| 29 | |||
| 30 | =over | ||
| 31 | |||
| 32 | =item id (Str) | ||
| 33 | |||
| 34 | =item currency (Str) | ||
| 35 | |||
| 36 | =item account_holder_name (Str) | ||
| 37 | |||
| 38 | =item available_balance_in_minor (Num) | ||
| 39 | |||
| 40 | =item current_balance_in_minor (Num) | ||
| 41 | |||
| 42 | =item account_identifiers | ||
| 43 | |||
| 44 | An array ref of L<Business::TrueLayer::MerchantAccount::Identifier> objects | ||
| 45 | |||
| 46 | =back | ||
| 47 | |||
| 48 | =cut | ||
| 49 | |||
| 50 | 2 | has [ qw/ id currency account_holder_name / ] => ( | |
| 51 | is => 'ro', | ||
| 52 | isa => 'Str', | ||
| 53 | required => 1, | ||
| 54 | ); | ||
| 55 | |||
| 56 | 2 | has [ qw/ | |
| 57 | available_balance_in_minor | ||
| 58 | current_balance_in_minor | ||
| 59 | / ] => ( | ||
| 60 | is => 'ro', | ||
| 61 | isa => 'Num', | ||
| 62 | required => 1, | ||
| 63 | ); | ||
| 64 | |||
| 65 | subtype 'AccountIdentifier' | ||
| 66 | => as 'Object' | ||
| 67 | 5 | ▶ | => where { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 68 | 5 | $_->isa( 'Business::TrueLayer::MerchantAccount::Identifier' ) | |
| 69 | } | ||
| 70 | 2 | ; | |
| 71 | |||
| 72 | coerce 'AccountIdentifier' | ||
| 73 | => from 'HashRef' | ||
| 74 | 0 | ▶ | => via { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 75 | 0 | Business::TrueLayer::MerchantAccount::Identifier->new( %{ $_ } ); | |
| 76 | } | ||
| 77 | 2 | ; | |
| 78 | |||
| 79 | 2 | subtype 'AccountIdentifiers' | |
| 80 | => as 'ArrayRef[AccountIdentifier]' | ||
| 81 | ; | ||
| 82 | |||
| 83 | coerce 'AccountIdentifiers' | ||
| 84 | => from 'ArrayRef' | ||
| 85 | 2 | ▶ | => via { |
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||
| 86 | 2 | my @AccountIdentifiers; | |
| 87 | 2 | foreach my $item ( $_->@* ) { | |
| 88 | push( | ||
| 89 | @AccountIdentifiers, | ||
| 90 | 4 | Business::TrueLayer::MerchantAccount::Identifier->new( %{ $item } ) | |
| 91 | ); | ||
| 92 | } | ||
| 93 | |||
| 94 | 2 | return \@AccountIdentifiers; | |
| 95 | } | ||
| 96 | 2 | ; | |
| 97 | |||
| 98 | 2 | has 'account_identifiers' => ( | |
| 99 | is => 'ro', | ||
| 100 | isa => 'AccountIdentifiers', | ||
| 101 | coerce => 1, | ||
| 102 | required => 1, | ||
| 103 | ); | ||
| 104 | |||
| 105 | =head1 METHODS | ||
| 106 | |||
| 107 | None yet. TODO: | ||
| 108 | |||
| 109 | transactions | ||
| 110 | payment_sources | ||
| 111 | |||
| 112 | =head1 SEE ALSO | ||
| 113 | |||
| 114 | L<Business::TrueLayer::MerchantAccount::Identifier> | ||
| 115 | |||
| 116 | =cut | ||
| 117 | |||
| 118 | 2 | 1; | |