« lib/WebService/Braintree/_/Customer.pm
↑ Summary
lib/WebService/Braintree/_/WebhookNotification.pm »
| 1 | # vim: sw=4 ts=4 ft=perl | ||||||||||
| 2 | |||||||||||
| 3 | package WebService::Braintree::_::Transaction::DisbursementDetail; | ||||||||||
| 4 | 22 | $WebService::Braintree::_::Transaction::DisbursementDetail::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::_::Transaction::DisbursementDetail | ||||||||||
| 11 | |||||||||||
| 12 | =head1 PURPOSE | ||||||||||
| 13 | |||||||||||
| 14 | This class represents a transaction disbursement detail. | ||||||||||
| 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 detail. | ||||||||||
| 36 | |||||||||||
| 37 | =cut | ||||||||||
| 38 | |||||||||||
| 39 | # Coerce this to "big_decimal" | ||||||||||
| 40 | 22 | has amount => ( | |||||||||
| 41 | is => 'ro', | ||||||||||
| 42 | ); | ||||||||||
| 43 | |||||||||||
| 44 | =head2 disbursement_date() | ||||||||||
| 45 | |||||||||||
| 46 | This is the disbursement date for this disbursement detail. | ||||||||||
| 47 | |||||||||||
| 48 | =cut | ||||||||||
| 49 | |||||||||||
| 50 | # Coerce this 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 detail. | ||||||||||
| 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 detail. | ||||||||||
| 68 | |||||||||||
| 69 | =cut | ||||||||||
| 70 | |||||||||||
| 71 | 22 | has follow_up_action => ( | |||||||||
| 72 | is => 'ro', | ||||||||||
| 73 | ); | ||||||||||
| 74 | |||||||||||
| 75 | =head2 funds_held() | ||||||||||
| 76 | |||||||||||
| 77 | This is the funds held for this disbursement detail. | ||||||||||
| 78 | |||||||||||
| 79 | =cut | ||||||||||
| 80 | |||||||||||
| 81 | 22 | has funds_held => ( | |||||||||
| 82 | is => 'ro', | ||||||||||
| 83 | ); | ||||||||||
| 84 | |||||||||||
| 85 | =head2 id() | ||||||||||
| 86 | |||||||||||
| 87 | This is the ID for this disbursement detail. | ||||||||||
| 88 | |||||||||||
| 89 | =cut | ||||||||||
| 90 | |||||||||||
| 91 | 22 | has id => ( | |||||||||
| 92 | is => 'ro', | ||||||||||
| 93 | ); | ||||||||||
| 94 | |||||||||||
| 95 | =head2 merchant_account() | ||||||||||
| 96 | |||||||||||
| 97 | This is the merchant_account for this disbursement detail. This will be an | ||||||||||
| 98 | object of type L<WebService::Braintree::_::MerchantAccount/>. | ||||||||||
| 99 | |||||||||||
| 100 | =cut | ||||||||||
| 101 | |||||||||||
| 102 | 22 | has merchant_account => ( | |||||||||
| 103 | is => 'ro', | ||||||||||
| 104 | isa => MerchantAccount, | ||||||||||
| 105 | coerce => 1, | ||||||||||
| 106 | ); | ||||||||||
| 107 | |||||||||||
| 108 | =head2 retry() | ||||||||||
| 109 | |||||||||||
| 110 | This is the retry for this disbursement detail. | ||||||||||
| 111 | |||||||||||
| 112 | =cut | ||||||||||
| 113 | |||||||||||
| 114 | 22 | has retry => ( | |||||||||
| 115 | is => 'ro', | ||||||||||
| 116 | ); | ||||||||||
| 117 | |||||||||||
| 118 | =head2 settlement_amount() | ||||||||||
| 119 | |||||||||||
| 120 | This is the settlement amount for this disbursement detail. | ||||||||||
| 121 | |||||||||||
| 122 | =cut | ||||||||||
| 123 | |||||||||||
| 124 | 22 | has settlement_amount => ( | |||||||||
| 125 | is => 'ro', | ||||||||||
| 126 | ); | ||||||||||
| 127 | |||||||||||
| 128 | =head2 settlement_currency_exchance_rate() | ||||||||||
| 129 | |||||||||||
| 130 | This is the settlement currency exchange rate for this disbursement detail. | ||||||||||
| 131 | |||||||||||
| 132 | =cut | ||||||||||
| 133 | |||||||||||
| 134 | 22 | has settlement_currency_exchange_rate => ( | |||||||||
| 135 | is => 'ro', | ||||||||||
| 136 | ); | ||||||||||
| 137 | |||||||||||
| 138 | =head2 settlement_currency_iso_code() | ||||||||||
| 139 | |||||||||||
| 140 | This is the settlement currency's ISO code for this disbursement detail. | ||||||||||
| 141 | |||||||||||
| 142 | =cut | ||||||||||
| 143 | |||||||||||
| 144 | 22 | has settlement_currency_iso_code => ( | |||||||||
| 145 | is => 'ro', | ||||||||||
| 146 | ); | ||||||||||
| 147 | |||||||||||
| 148 | =head2 success() | ||||||||||
| 149 | |||||||||||
| 150 | This is the success for this disbursement detail. | ||||||||||
| 151 | |||||||||||
| 152 | C<< is_success() >> is an alias for this attribute. | ||||||||||
| 153 | |||||||||||
| 154 | =cut | ||||||||||
| 155 | |||||||||||
| 156 | 22 | has success => ( | |||||||||
| 157 | is => 'ro', | ||||||||||
| 158 | alias => 'is_success', | ||||||||||
| 159 | ); | ||||||||||
| 160 | |||||||||||
| 161 | =head2 transaction_ids() | ||||||||||
| 162 | |||||||||||
| 163 | This is the transaction ids for this disbursement detail. | ||||||||||
| 164 | |||||||||||
| 165 | =cut | ||||||||||
| 166 | |||||||||||
| 167 | 22 | has transaction_ids => ( | |||||||||
| 168 | is => 'ro', | ||||||||||
| 169 | ); | ||||||||||
| 170 | |||||||||||
| 171 | =head1 METHODS | ||||||||||
| 172 | |||||||||||
| 173 | =head2 is_valid() | ||||||||||
| 174 | |||||||||||
| 175 | This returns true if there is a L</disbursement_date>. | ||||||||||
| 176 | |||||||||||
| 177 | =cut | ||||||||||
| 178 | |||||||||||
| 179 | 0 | ▶ | sub is_valid { | ||||||||
|
Subroutine
is_valid: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 180 | 0 | ▶ | shift->disbursement_date ? 1 : 0 | ||||||||
|
Branch: 1 branch
| |||||||||||
| 181 | } | ||||||||||
| 182 | |||||||||||
| 183 | =head2 transactions() | ||||||||||
| 184 | |||||||||||
| 185 | This returns all the L<transactions|WebService::Braintree::_::Transaction> | ||||||||||
| 186 | referenced in this disbursement detail's L</transaction_ids>. | ||||||||||
| 187 | |||||||||||
| 188 | =cut | ||||||||||
| 189 | |||||||||||
| 190 | 0 | ▶ | sub transactions { | ||||||||
|
Subroutine
transactions: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 191 | 0 | my $self = shift; | |||||||||
| 192 | 0 | ▶ | return WebService::Braintree::Transaction->search(sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 193 | 0 | my $search = shift; | |||||||||
| 194 | 0 | $search->ids->in($self->transaction_ids); | |||||||||
| 195 | 0 | }); | |||||||||
| 196 | } | ||||||||||
| 197 | |||||||||||
| 198 | 22 | __PACKAGE__->meta->make_immutable; | |||||||||
| 199 | |||||||||||
| 200 | 22 | 1; | |||||||||
| 201 | __END__ | ||||||||||