lib/WebService/Braintree/Gateway.pm

filter: Statementstmt 94.1% 32 / 34 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 0.0% 0 / 1 totaltotal 87.7% 43 / 49 CC 2 SCAR 3.0
CC
2
Cov
90%
__ANON__
2.1
http
2.0
BEGIN
1.0
CRAP 1.3
« lib/WebService/Braintree/_/Transaction/VisaCheckoutCardDetail.pm ↑ Summary lib/WebService/Braintree/ClientToken.pm »
1 # vim: sw=4 ts=4 ft=perl
2  
3 package WebService::Braintree::Gateway;
4 22 $WebService::Braintree::Gateway::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::Gateway
11  
12 =head1 PURPOSE
13  
14 In the class interface, you will not use this class.
15  
16 In the object interface, this class provides the interface into the API.
17  
18 =cut
19  
20 22 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 22 ▶use Class::Load qw(try_load_class);
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 22 ▶use WebService::Braintree::HTTP;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 22 has 'config' => (is => 'ro');
26  
27 =head1 CONSTRUCTION
28  
29 You can construct this class by passing in either a
30 L<config/WebService::Braintree::Configuration> object or the parameters
31 necessary to build a L<config/WebService::Braintree::Configuration> object.
32  
33 =cut
34  
35 # Allow this class to be built with either a $config object or parameters to be
36 # passed into a $config object.
37 8 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=2 SCAR=7.2
38 8 my $orig = shift;
39 8 my $class = shift;
40  
41 # Allow the original BUILDARGS to coerce the arguments for us.
42 8 my $args = $class->$orig(@_);
43  
44 8 ▶ if ( !exists $args->{config} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $args->{"config"}) 0 8 8
45 0 $args = {
46 config => WebService::Braintree::Configuration->new( $args ),
47 };
48 }
49  
50 8 return $args;
51 22 };
52  
53 =head1 METHODS
54  
55 This ojbect provides the following methods. These methods are used to retrieve
56 the object that will give access to different elements of the Braintree API.
57  
58 For additional documentation of how to use these objects, please refer to the
59 object's documentation. For general documentation, please refer to the main
60 documentation of L<WebService::Braintree>.
61  
62 =head3 L<add_on/WebService::Braintree::AddOnGateway>
63  
64 List all plan add-ons.
65  
66 =head3 L<address/WebService::Braintree::AddressGateway>
67  
68 Create, update, delete, and find addresses.
69  
70 =head3 L<apply_pay/WebService::Braintree::ApplePayGateway>
71  
72 List, register, and unregister ApplePay domains.
73  
74 =head3 L<client_token/WebService::Braintree::ClientTokenGateway>
75  
76 Generate client tokens. These are used for client-side SDKs to take actions.
77  
78 =head3 L<credit_card/WebService::Braintree::CreditCardGateway>
79  
80 Create, update, delete, and find credit cards.
81  
82 =head3 L<credit_card_verification/WebService::Braintree::CreditCardVerificationGateway>
83  
84 Find and list credit card verifications.
85  
86 =head3 L<customer/WebService::Braintree::CustomerGateway>
87  
88 Create, update, delete, and find customers.
89  
90 =head3 L<discount/WebService::Braintree::DiscountGateway>
91  
92 List all plan discounts.
93  
94 =head3 L<dispute/WebService::Braintree::DisputeGateway>
95  
96 Accept, and find disputes.
97  
98 =head3 L<document_upload/WebService::Braintree::DocumentUploadGateway>
99  
100 Manage document uploads.
101  
102 =head3 L<europe_bank_account/WebService::Braintree::EuropeBankAccountGateway>
103  
104 Find Europe Bank Accounts.
105  
106 =head3 L<ideal_payment/WebService::Braintree::IdealPaymentGateway>
107  
108 Find IdealPayment payment methods.
109  
110 =head3 L<merchant/WebService::Braintree::MerchantGateway>
111  
112 Provision merchants from "raw ApplePay".
113  
114 =head3 L<merchant_account/WebService::Braintree::MerchantAccountGateway>
115  
116 Create, update, and find merchant accounts.
117  
118 =head3 L<payment_method/WebService::Braintree::PaymentMethodGateway>
119  
120 Create, update, delete, and find payment methods.
121  
122 =head3 L<payment_method_nonce/WebService::Braintree::PaymentMethodNonceGateway>
123  
124 Create, update, delete, and find payment method nonces.
125  
126 =head3 L<paypal_account/WebService::Braintree::PayPalAccountGateway>
127  
128 Find and update PayPal accounts.
129  
130 =head3 L<plan/WebService::Braintree::PlanGateway>
131  
132 List all subscription plans.
133  
134 =head3 L<settlement_batch_summary/WebService::Braintree::SettlementBatchSummaryGateway>
135  
136 Generate settlement batch summaries.
137  
138 =head3 L<subscription/WebService::Braintree::SubscriptionGateway>
139  
140 Create, update, cancel, find, and handle charges for subscriptions.
141  
142 =head3 L<transaction/WebService::Braintree::TransactionGateway>
143  
144 Create, manage, and search for transactions. This is the workhorse class and it
145 has many methods.
146  
147 =head3 L<transaction_line_item/WebService::Braintree::TransactionLineItemGateway>
148  
149 Find all the transaction line-items.
150  
151 =head3 L<transparent_redirect/WebService::Braintree::TransparentRedirectGateway>
152  
153 Manage the transparent redirection of ????.
154  
155 B<NOTE>: This class needs significant help in documentation.
156  
157 =head3 L<us_bank_account/WebService::Braintree::UsBankAccountGateway>
158  
159 Find US Bank Accounts.
160  
161 =head3 L<webhook_notification/WebService::Braintree::WebhookNotificationGateway>
162  
163 Manage the webhook notiifcations.
164  
165 B<NOTE>: This class needs significant help in documentation.
166  
167 =head3 L<webhook_testing/WebService::Braintree::WebhookTestingGateway>
168  
169 Manage the webhook testing.
170  
171 B<NOTE>: This class needs significant help in documentation.
172  
173 =cut
174  
175 22 my %gateways = (
176 add_on => 'AddOn',
177 address => 'Address',
178 apple_pay => 'ApplePay',
179 client_token => 'ClientToken',
180 credit_card => 'CreditCard',
181 verification => 'CreditCardVerification',
182 customer => 'Customer',
183 discount => 'Discount',
184 dispute => 'Dispute',
185 document_upload => 'DocumentUpload',
186 europe_bank_account => 'EuropeBankAccount',
187 ideal_payment => 'IdealPayment',
188 merchant => 'Merchant',
189 merchant_account => 'MerchantAccount',
190 payment_method => 'PaymentMethod',
191 payment_method_nonce => 'PaymentMethodNonce',
192 paypal_account => 'PayPalAccount',
193 plan => 'Plan',
194 settlement_batch_summary => 'SettlementBatchSummary',
195 subscription => 'Subscription',
196 transaction => 'Transaction',
197 transaction_line_item => 'TransactionLineItem',
198 transparent_redirect => 'TransparentRedirect',
199 us_bank_account => 'UsBankAccount',
200 webhook_notification => 'WebhookNotification',
201 webhook_testing => 'WebhookTesting',
202 );
203  
204 22 ▶while (my ($method, $gateway) = each %gateways) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %gateways) 572 22 594
205 572 my $package = "WebService::Braintree::${gateway}Gateway";
206  
207 572 my ($ok, $error) = try_load_class($package);
208 572 ▶ $ok ? $package->import : die $error;
Branch: 1 branch
BranchTrueFalseTotal
$ok ? : 572 0 572
209  
210 9 ▶ has $method => (is => 'ro', lazy => 1, default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
211 9 my $self = shift;
212 9 $package->new(gateway => $self);
213 572 });
214 }
215  
216 0 ▶sub http {
Subroutine http: not called CC=1 SCAR=6.9
Pod undocumented
217 0 WebService::Braintree::HTTP->new(config => shift->config);
218 }
219  
220 22 __PACKAGE__->meta->make_immutable;
221  
222 22 1;
223 __END__
« lib/WebService/Braintree/_/Transaction/VisaCheckoutCardDetail.pm ↑ Summary lib/WebService/Braintree/ClientToken.pm »