braintree 4.12.0 → 4.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bfe8849002c4dbacd2476b61311adc19f0939a2c42bb61ccf2ca797d59248054
4
- data.tar.gz: 7f97e328fdd729365a0117bc8297edac4e12e8e383e8c7b10b06f74862bd8e34
3
+ metadata.gz: 44371fa440317aa474b358a279682d0e79ad05565d4b1f583dabb77c237a5d34
4
+ data.tar.gz: 8487685b45da286097e7f366ca1b26820f89da15008a1f6555409e1c2605f61a
5
5
  SHA512:
6
- metadata.gz: 20e3ed69efa6b094974b3461165a3197958df6e62be5f9952d676d14c7411bdae5c2169b2f0e86eab743a94475f436baf3b907ff1dab4a45e984eafa741e3356
7
- data.tar.gz: b7e5bcbe3a4c57e6aa2a60016e93b0adff02b9dd51601370d94f08d56307e319b19381274e032eb8bd80fffa4ecf5a8c601c3da9e17e38526a8860d981a7d471
6
+ metadata.gz: '0584f71fb953b0b73071bb368481873e3948fb55a3de2cc91b8d2c443aaf2544b739534d4283e6d50ad85d532eb3cfe2126338eebb92359c74f19185f55ceaf9'
7
+ data.tar.gz: 2d98c343dd94fdb128fdc09bd1e1688e12b82f0055b9666869c9f88c5fe74d9accf736f8ec3876e8d6ef6965874a3a8618a8bbe63df0e5146e30d2c7d723956e
@@ -28,10 +28,12 @@ module Braintree
28
28
  attr_reader :image_url
29
29
  attr_reader :issuing_bank
30
30
  attr_reader :last_4
31
+ attr_reader :merchant_token_identifier
31
32
  attr_reader :payment_instrument_name
32
33
  attr_reader :payroll
33
34
  attr_reader :prepaid
34
35
  attr_reader :product_id
36
+ attr_reader :source_card_last4
35
37
  attr_reader :source_description
36
38
  attr_reader :subscriptions
37
39
  attr_reader :token
@@ -11,6 +11,7 @@ module Braintree
11
11
  ApplePayVisa = "fake-apple-pay-visa-nonce"
12
12
  ApplePayMasterCard = "fake-apple-pay-mastercard-nonce"
13
13
  ApplePayAmEx = "fake-apple-pay-amex-nonce"
14
+ ApplePayMpan = "fake-apple-pay-mpan-nonce"
14
15
  AbstractTransactable = "fake-abstract-transactable-nonce"
15
16
  Europe = "fake-europe-bank-account-nonce"
16
17
  GooglePayDiscover = "fake-android-pay-discover-nonce"
@@ -6,23 +6,25 @@ module Braintree
6
6
  attr_reader :bin
7
7
  attr_reader :card_type
8
8
  attr_reader :cardholder_name
9
+ attr_reader :commercial
10
+ attr_reader :country_of_issuance
11
+ attr_reader :debit
12
+ attr_reader :durbin_regulated
9
13
  attr_reader :expiration_month
10
14
  attr_reader :expiration_year
15
+ attr_reader :global_id
16
+ attr_reader :healthcare
11
17
  attr_reader :image_url
18
+ attr_reader :issuing_bank
12
19
  attr_reader :last_4
20
+ attr_reader :merchant_token_identifier
13
21
  attr_reader :payment_instrument_name
14
- attr_reader :source_description
15
- attr_reader :token
16
- attr_reader :prepaid
17
- attr_reader :healthcare
18
- attr_reader :debit
19
- attr_reader :durbin_regulated
20
- attr_reader :commercial
21
22
  attr_reader :payroll
22
- attr_reader :issuing_bank
23
- attr_reader :country_of_issuance
23
+ attr_reader :prepaid
24
24
  attr_reader :product_id
25
- attr_reader :global_id
25
+ attr_reader :source_card_last4
26
+ attr_reader :source_description
27
+ attr_reader :token
26
28
 
27
29
  def initialize(attributes)
28
30
  set_instance_variables_from_hash attributes unless attributes.nil?
@@ -152,7 +152,9 @@ module Braintree
152
152
  attr_reader :refunded_transaction_id
153
153
  attr_reader :refunded_installments
154
154
  attr_reader :retried
155
+ attr_reader :retried_transaction_id # the primary/parent transaction id of any retried transaction
155
156
  attr_reader :retrieval_reference_number
157
+ attr_reader :retry_ids # all retried transactions ids for a primary transaction
156
158
  attr_reader :risk_data
157
159
  attr_reader :samsung_pay_card_details
158
160
  attr_reader :sca_exemption_requested
@@ -229,6 +229,7 @@ module Braintree
229
229
  :skip_avs,
230
230
  :skip_cvv,
231
231
  {:paypal => [:custom_field, :payee_id, :payee_email, :description, {:supplementary_data => :_any_key_}]},
232
+ {:processing_overrides => [:customer_email, :customer_first_name, :customer_last_name, :customer_tax_identifier]},
232
233
  {:three_d_secure => [:required]},
233
234
  {:amex_rewards => [:request_id, :points, :currency_amount, :currency_iso_code]},
234
235
  {:venmo => [:profile_id]},
@@ -247,7 +248,7 @@ module Braintree
247
248
  {:data => [
248
249
  :folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
249
250
  :passenger_first_name, :passenger_last_name, :passenger_middle_initial, :passenger_title, :issued_date, :travel_agency_name, :travel_agency_code, :ticket_number,
250
- :issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket, :no_show, :advanced_deposit, :fire_safe, :property_phone,
251
+ :issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket, :no_show, :advanced_deposit, :fire_safe, :property_phone, :ticket_issuer_address, :arrival_date,
251
252
  {:legs => [
252
253
  :conjunction_ticket, :exchange_ticket, :coupon_number, :service_class, :carrier_code, :fare_basis_code, :flight_number, :departure_date, :departure_airport_code, :departure_time,
253
254
  :arrival_airport_code, :arrival_time, :stopover_permitted, :fare_amount, :fee_amount, :tax_amount, :endorsement_or_restrictions,
@@ -267,6 +268,21 @@ module Braintree
267
268
  [
268
269
  :order_id,
269
270
  {:descriptor => [:name, :phone, :url]},
271
+ {:industry => [
272
+ :industry_type,
273
+ {:data => [
274
+ :folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
275
+ :passenger_first_name, :passenger_last_name, :passenger_middle_initial, :passenger_title, :issued_date, :travel_agency_name, :travel_agency_code, :ticket_number,
276
+ :issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket, :no_show, :advanced_deposit, :fire_safe, :property_phone, :ticket_issuer_address, :arrival_date,
277
+ {:legs => [
278
+ :conjunction_ticket, :exchange_ticket, :coupon_number, :service_class, :carrier_code, :fare_basis_code, :flight_number, :departure_date, :departure_airport_code, :departure_time,
279
+ :arrival_airport_code, :arrival_time, :stopover_permitted, :fare_amount, :fee_amount, :tax_amount, :endorsement_or_restrictions,
280
+ ]},
281
+ {:additional_charges => [
282
+ :kind, :amount,
283
+ ]},
284
+ ]},
285
+ ]},
270
286
  :purchase_order_number,
271
287
  :tax_amount,
272
288
  :tax_exempt,
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 4
4
- Minor = 12
4
+ Minor = 13
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
@@ -110,6 +110,42 @@ describe Braintree::PaymentMethod do
110
110
  apple_pay_card.product_id.should_not be_nil
111
111
  end
112
112
 
113
+ it "creates a payment method from a fake apple pay mpan nonce" do
114
+ customer = Braintree::Customer.create.customer
115
+ token = SecureRandom.hex(16)
116
+ result = Braintree::PaymentMethod.create(
117
+ :payment_method_nonce => Braintree::Test::Nonce::ApplePayMpan,
118
+ :customer_id => customer.id,
119
+ :token => token,
120
+ )
121
+
122
+ result.should be_success
123
+ apple_pay_card = result.payment_method
124
+ apple_pay_card.should be_a(Braintree::ApplePayCard)
125
+ apple_pay_card.should_not be_nil
126
+ apple_pay_card.bin.should_not be_nil
127
+ apple_pay_card.token.should == token
128
+ apple_pay_card.card_type.should == Braintree::ApplePayCard::CardType::Visa
129
+ apple_pay_card.payment_instrument_name.should == "Visa 8886"
130
+ apple_pay_card.source_description.should == "Visa 8886"
131
+ apple_pay_card.default.should == true
132
+ apple_pay_card.image_url.should =~ /apple_pay/
133
+ apple_pay_card.expiration_month.to_i.should > 0
134
+ apple_pay_card.expiration_year.to_i.should > 0
135
+ apple_pay_card.customer_id.should == customer.id
136
+ apple_pay_card.commercial.should_not be_nil
137
+ apple_pay_card.country_of_issuance.should_not be_nil
138
+ apple_pay_card.debit.should_not be_nil
139
+ apple_pay_card.durbin_regulated.should_not be_nil
140
+ apple_pay_card.healthcare.should_not be_nil
141
+ apple_pay_card.issuing_bank.should_not be_nil
142
+ apple_pay_card.payroll.should_not be_nil
143
+ apple_pay_card.prepaid.should_not be_nil
144
+ apple_pay_card.product_id.should_not be_nil
145
+ apple_pay_card.merchant_token_identifier.should_not be_nil
146
+ apple_pay_card.source_card_last4.should_not be_nil
147
+ end
148
+
113
149
  it "creates a payment method from a fake google pay proxy card nonce" do
114
150
  customer = Braintree::Customer.create.customer
115
151
  token = SecureRandom.hex(16)
@@ -1143,6 +1179,31 @@ describe Braintree::PaymentMethod do
1143
1179
  apple_pay_card.source_description.should == "AmEx 41002"
1144
1180
  apple_pay_card.customer_id.should == customer.id
1145
1181
  end
1182
+
1183
+ it "finds the payment method with the given mpan token" do
1184
+ customer = Braintree::Customer.create!
1185
+ payment_method_token = make_token
1186
+ result = Braintree::PaymentMethod.create(
1187
+ :payment_method_nonce => Braintree::Test::Nonce::ApplePayMpan,
1188
+ :customer_id => customer.id,
1189
+ :token => payment_method_token,
1190
+ )
1191
+ result.should be_success
1192
+
1193
+ apple_pay_card = Braintree::PaymentMethod.find(payment_method_token)
1194
+ apple_pay_card.should be_a(Braintree::ApplePayCard)
1195
+ apple_pay_card.should_not be_nil
1196
+ apple_pay_card.token.should == payment_method_token
1197
+ apple_pay_card.card_type.should == Braintree::ApplePayCard::CardType::Visa
1198
+ apple_pay_card.default.should == true
1199
+ apple_pay_card.image_url.should =~ /apple_pay/
1200
+ apple_pay_card.expiration_month.to_i.should > 0
1201
+ apple_pay_card.expiration_year.to_i.should > 0
1202
+ apple_pay_card.source_description.should == "Visa 8886"
1203
+ apple_pay_card.customer_id.should == customer.id
1204
+ apple_pay_card.merchant_token_identifier == "DNITHE302308980427388297"
1205
+ apple_pay_card.source_card_last4 == "2006"
1206
+ end
1146
1207
  end
1147
1208
 
1148
1209
  context "venmo accounts" do
@@ -10,89 +10,6 @@ describe Braintree::PaymentMethod do
10
10
  Braintree::Configuration.private_key = "integration2_private_key"
11
11
  end
12
12
 
13
- context "plaid verified nonce" do
14
- let(:nonce) { generate_valid_plaid_us_bank_account_nonce }
15
-
16
- # we are temporarily skipping this test until we have a more stable CI env
17
- xit "succeeds" do
18
- customer = Braintree::Customer.create.customer
19
- result = Braintree::PaymentMethod.create(
20
- :payment_method_nonce => nonce,
21
- :customer_id => customer.id,
22
- :options => {
23
- :verification_merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
24
- },
25
- )
26
-
27
- result.should be_success
28
- us_bank_account = result.payment_method
29
- us_bank_account.should be_a(Braintree::UsBankAccount)
30
- us_bank_account.routing_number.should == "011000015"
31
- us_bank_account.last_4.should == "0000"
32
- us_bank_account.account_type.should == "checking"
33
- us_bank_account.account_holder_name.should == "PayPal, Inc."
34
- us_bank_account.bank_name.should == "FEDERAL RESERVE BANK"
35
- us_bank_account.default.should == true
36
- us_bank_account.ach_mandate.text.should == "cl mandate text"
37
- us_bank_account.ach_mandate.accepted_at.should be_a Time
38
-
39
- us_bank_account.verifications.count.should == 1
40
- us_bank_account.verifications.first.status.should == Braintree::UsBankAccountVerification::Status::Verified
41
- us_bank_account.verifications.first.verification_method.should == Braintree::UsBankAccountVerification::VerificationMethod::TokenizedCheck
42
- us_bank_account.verifications.first.id.should_not be_empty
43
- us_bank_account.verifications.first.verification_determined_at.should be_a Time
44
- us_bank_account.verified.should == true
45
-
46
- Braintree::PaymentMethod.find(us_bank_account.token).should be_a(Braintree::UsBankAccount)
47
- end
48
-
49
- [
50
- Braintree::UsBankAccountVerification::VerificationMethod::IndependentCheck,
51
- Braintree::UsBankAccountVerification::VerificationMethod::NetworkCheck,
52
- ].each do |method|
53
- # we are temporarily skipping this test until we have a more stable CI env
54
- xit "succeeds and verifies via #{method}" do
55
- customer = Braintree::Customer.create.customer
56
- result = Braintree::PaymentMethod.create(
57
- :payment_method_nonce => nonce,
58
- :customer_id => customer.id,
59
- :options => {
60
- :us_bank_account_verification_method => method,
61
- :verification_merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
62
- },
63
- )
64
-
65
- result.should be_success
66
- us_bank_account = result.payment_method
67
- us_bank_account.should be_a(Braintree::UsBankAccount)
68
- us_bank_account.routing_number.should == "011000015"
69
- us_bank_account.last_4.should == "0000"
70
- us_bank_account.account_type.should == "checking"
71
- us_bank_account.account_holder_name.should == "PayPal, Inc."
72
- us_bank_account.bank_name.should == "FEDERAL RESERVE BANK"
73
- us_bank_account.default.should == true
74
- us_bank_account.ach_mandate.text.should == "cl mandate text"
75
- us_bank_account.ach_mandate.accepted_at.should be_a Time
76
- us_bank_account.verified.should == true
77
-
78
- us_bank_account.verifications.count.should == 2
79
-
80
- us_bank_account.verifications.map(&:verification_method).should contain_exactly(
81
- Braintree::UsBankAccountVerification::VerificationMethod::TokenizedCheck,
82
- method,
83
- )
84
-
85
- us_bank_account.verifications.each do |verification|
86
- verification.status.should == Braintree::UsBankAccountVerification::Status::Verified
87
- verification.id.should_not be_empty
88
- verification.verification_determined_at.should be_a Time
89
- end
90
-
91
- Braintree::PaymentMethod.find(us_bank_account.token).should be_a(Braintree::UsBankAccount)
92
- end
93
- end
94
- end
95
-
96
13
  context "non plaid verified nonce" do
97
14
  let(:nonce) { generate_non_plaid_us_bank_account_nonce }
98
15
 
@@ -176,86 +93,6 @@ describe Braintree::PaymentMethod do
176
93
  end
177
94
 
178
95
  context "exempt merchant" do
179
- context "plaid verified nonce" do
180
- before do
181
- Braintree::Configuration.merchant_id = "integration_merchant_id"
182
- Braintree::Configuration.public_key = "integration_public_key"
183
- Braintree::Configuration.private_key = "integration_private_key"
184
- end
185
-
186
- let(:nonce) { generate_valid_plaid_us_bank_account_nonce }
187
-
188
- # we are temporarily skipping this test until we have a more stable CI env
189
- xit "succeeds and verifies via independent check" do
190
- customer = Braintree::Customer.create.customer
191
- result = Braintree::PaymentMethod.create(
192
- :payment_method_nonce => nonce,
193
- :customer_id => customer.id,
194
- :options => {
195
- :verification_merchant_account_id => SpecHelper::UsBankMerchantAccountId,
196
- },
197
- )
198
-
199
- result.should be_success
200
- us_bank_account = result.payment_method
201
- us_bank_account.should be_a(Braintree::UsBankAccount)
202
- us_bank_account.routing_number.should == "011000015"
203
- us_bank_account.last_4.should == "0000"
204
- us_bank_account.account_type.should == "checking"
205
- us_bank_account.account_holder_name.should == "PayPal, Inc."
206
- us_bank_account.bank_name.should == "FEDERAL RESERVE BANK"
207
- us_bank_account.default.should == true
208
- us_bank_account.ach_mandate.text.should == "cl mandate text"
209
- us_bank_account.ach_mandate.accepted_at.should be_a Time
210
-
211
- us_bank_account.verifications.count.should == 1
212
- us_bank_account.verifications.first.status.should == Braintree::UsBankAccountVerification::Status::Verified
213
- us_bank_account.verifications.first.verification_method.should == Braintree::UsBankAccountVerification::VerificationMethod::TokenizedCheck
214
- us_bank_account.verifications.first.id.should_not be_empty
215
- us_bank_account.verifications.first.verification_determined_at.should be_a Time
216
- us_bank_account.verified.should == true
217
-
218
- Braintree::PaymentMethod.find(us_bank_account.token).should be_a(Braintree::UsBankAccount)
219
- end
220
- end
221
-
222
- context "non plaid verified nonce" do
223
- let(:nonce) { generate_non_plaid_us_bank_account_nonce }
224
-
225
- # we are temporarily skipping this test until we have a more stable CI env
226
- xit "succeeds and verifies via independent check" do
227
- customer = Braintree::Customer.create.customer
228
- result = Braintree::PaymentMethod.create(
229
- :payment_method_nonce => nonce,
230
- :customer_id => customer.id,
231
- :options => {
232
- :verification_merchant_account_id => SpecHelper::UsBankMerchantAccountId,
233
- },
234
- )
235
-
236
- result.should be_success
237
- us_bank_account = result.payment_method
238
- us_bank_account.should be_a(Braintree::UsBankAccount)
239
- us_bank_account.routing_number.should == "021000021"
240
- us_bank_account.last_4.should == "0000"
241
- us_bank_account.account_type.should == "checking"
242
- us_bank_account.account_holder_name.should == "John Doe"
243
- us_bank_account.bank_name.should =~ /CHASE/
244
- us_bank_account.default.should == true
245
- us_bank_account.ach_mandate.text.should == "cl mandate text"
246
- us_bank_account.ach_mandate.accepted_at.should be_a Time
247
-
248
- us_bank_account.verifications.count.should == 1
249
- us_bank_account.verifications.first.status.should == Braintree::UsBankAccountVerification::Status::Verified
250
- us_bank_account.verifications.first.verification_method.should == Braintree::UsBankAccountVerification::VerificationMethod::IndependentCheck
251
- us_bank_account.verifications.first.id.should_not be_empty
252
- us_bank_account.verifications.first.verification_determined_at.should be_a Time
253
- us_bank_account.verified.should == true
254
-
255
- Braintree::PaymentMethod.find(us_bank_account.token).should be_a(Braintree::UsBankAccount)
256
- end
257
- end
258
-
259
96
  it "fails with invalid nonce" do
260
97
  customer = Braintree::Customer.create.customer
261
98
  result = Braintree::PaymentMethod.create(