« lib/WebService/Braintree/SettlementBatchSummaryGateway.pm
↑ Summary
lib/WebService/Braintree/_/Customer.pm »
| 1 | # vim: sw=4 ts=4 ft=perl | ||||||||||
| 2 | |||||||||||
| 3 | package WebService::Braintree::_::Disbursement; | ||||||||||
| 4 | 22 | $WebService::Braintree::_::Disbursement::VERSION = '1.7'; | |||||||||
| 5 | 22 | ▶ | use 5.010_001; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 22 | ▶ | use strictures 1; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | =head1 NAME | ||||||||||
| 9 | |||||||||||
| 10 | WebService::Braintree::_::Disbursement | ||||||||||
| 11 | |||||||||||
| 12 | =head1 PURPOSE | ||||||||||
| 13 | |||||||||||
| 14 | This class represents a disbursement. | ||||||||||
| 15 | |||||||||||
| 16 | This class will only be created as part of a L<response|WebService::Braintree::Result> or L<error response|WebService::Braintree::ErrorResult>. | ||||||||||
| 17 | |||||||||||
| 18 | =cut | ||||||||||
| 19 | |||||||||||
| 20 | 22 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 22 | ▶ | use MooX::Aliases; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | |||||||||||
| 23 | 22 | extends 'WebService::Braintree::_'; | |||||||||
| 24 | |||||||||||
| 25 | 22 | ▶ | use WebService::Braintree::Types qw( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | MerchantAccount | ||||||||||
| 27 | 22 | ); | |||||||||
| 28 | |||||||||||
| 29 | =head1 ATTRIBUTES | ||||||||||
| 30 | |||||||||||
| 31 | =cut | ||||||||||
| 32 | |||||||||||
| 33 | =head2 amount() | ||||||||||
| 34 | |||||||||||
| 35 | This is the amount for this disbursement. | ||||||||||
| 36 | |||||||||||
| 37 | =cut | ||||||||||
| 38 | |||||||||||
| 39 | # Coerce to "big_decimal" | ||||||||||
| 40 | 22 | has amount => ( | |||||||||
| 41 | is => 'ro', | ||||||||||
| 42 | ); | ||||||||||
| 43 | |||||||||||
| 44 | =head2 disbursement_date() | ||||||||||
| 45 | |||||||||||
| 46 | This is the date of disbursement. | ||||||||||
| 47 | |||||||||||
| 48 | =cut | ||||||||||
| 49 | |||||||||||
| 50 | # Coerce to DateTime | ||||||||||
| 51 | 22 | has disbursement_date => ( | |||||||||
| 52 | is => 'ro', | ||||||||||
| 53 | ); | ||||||||||
| 54 | |||||||||||
| 55 | =head2 exception_message() | ||||||||||
| 56 | |||||||||||
| 57 | This is the exception message for this disbursement. | ||||||||||
| 58 | |||||||||||
| 59 | =cut | ||||||||||
| 60 | |||||||||||
| 61 | 22 | has exception_message => ( | |||||||||
| 62 | is => 'ro', | ||||||||||
| 63 | ); | ||||||||||
| 64 | |||||||||||
| 65 | =head2 follow_up_action() | ||||||||||
| 66 | |||||||||||
| 67 | This is the follow-up action for this disbursement. | ||||||||||
| 68 | |||||||||||
| 69 | =cut | ||||||||||
| 70 | |||||||||||
| 71 | 22 | has follow_up_action => ( | |||||||||
| 72 | is => 'ro', | ||||||||||
| 73 | ); | ||||||||||
| 74 | |||||||||||
| 75 | =head2 id() | ||||||||||
| 76 | |||||||||||
| 77 | This is the id for this disbursement. | ||||||||||
| 78 | |||||||||||
| 79 | =cut | ||||||||||
| 80 | |||||||||||
| 81 | 22 | has id => ( | |||||||||
| 82 | is => 'ro', | ||||||||||
| 83 | ); | ||||||||||
| 84 | |||||||||||
| 85 | =head2 merchant_account() | ||||||||||
| 86 | |||||||||||
| 87 | This is the merchant_account for this disbursement. This will be an | ||||||||||
| 88 | object of type L<WebService::Braintree::_::MerchantAccount/>. | ||||||||||
| 89 | |||||||||||
| 90 | =cut | ||||||||||
| 91 | |||||||||||
| 92 | 22 | has merchant_account => ( | |||||||||
| 93 | is => 'ro', | ||||||||||
| 94 | isa => MerchantAccount, | ||||||||||
| 95 | coerce => 1, | ||||||||||
| 96 | ); | ||||||||||
| 97 | |||||||||||
| 98 | =head2 retry() | ||||||||||
| 99 | |||||||||||
| 100 | This is the retry for this disbursement. | ||||||||||
| 101 | |||||||||||
| 102 | =cut | ||||||||||
| 103 | |||||||||||
| 104 | 22 | has retry => ( | |||||||||
| 105 | is => 'ro', | ||||||||||
| 106 | ); | ||||||||||
| 107 | |||||||||||
| 108 | =head2 success() | ||||||||||
| 109 | |||||||||||
| 110 | This is the success for this disbursement. | ||||||||||
| 111 | |||||||||||
| 112 | =cut | ||||||||||
| 113 | |||||||||||
| 114 | 22 | has success => ( | |||||||||
| 115 | is => 'ro', | ||||||||||
| 116 | ); | ||||||||||
| 117 | |||||||||||
| 118 | =head2 transaction_ids() | ||||||||||
| 119 | |||||||||||
| 120 | This is the transaction ids for this disbursement. | ||||||||||
| 121 | |||||||||||
| 122 | =cut | ||||||||||
| 123 | |||||||||||
| 124 | 22 | has transaction_ids => ( | |||||||||
| 125 | is => 'ro', | ||||||||||
| 126 | ); | ||||||||||
| 127 | |||||||||||
| 128 | =head1 METHODS | ||||||||||
| 129 | |||||||||||
| 130 | =head2 is_valid() | ||||||||||
| 131 | |||||||||||
| 132 | This returns true if there is a L</disbursement_date>. | ||||||||||
| 133 | |||||||||||
| 134 | =cut | ||||||||||
| 135 | |||||||||||
| 136 | 0 | ▶ | sub is_valid { | ||||||||
|
Subroutine
is_valid: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 137 | 0 | ▶ | shift->disbursement_date ? 1 : 0 | ||||||||
|
Branch: 1 branch
| |||||||||||
| 138 | } | ||||||||||
| 139 | |||||||||||
| 140 | =head2 transactions() | ||||||||||
| 141 | |||||||||||
| 142 | This returns all the L<transactions|WebService::Braintree::_::Transaction> | ||||||||||
| 143 | referenced in this disbursement's L</transaction_ids>. | ||||||||||
| 144 | |||||||||||
| 145 | =cut | ||||||||||
| 146 | |||||||||||
| 147 | 0 | ▶ | sub transactions { | ||||||||
|
Subroutine
transactions: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 148 | 0 | my $self = shift; | |||||||||
| 149 | 0 | ▶ | WebService::Braintree::Transaction->search(sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 150 | 0 | my $search = shift; | |||||||||
| 151 | 0 | $search->ids->in($self->transaction_ids); | |||||||||
| 152 | 0 | }); | |||||||||
| 153 | } | ||||||||||
| 154 | |||||||||||
| 155 | 22 | __PACKAGE__->meta->make_immutable; | |||||||||
| 156 | |||||||||||
| 157 | 22 | 1; | |||||||||
| 158 | __END__ | ||||||||||