braintree 4.25.0 → 4.27.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.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/lib/braintree/apple_pay_card.rb +1 -0
  3. data/lib/braintree/bin_data.rb +2 -1
  4. data/lib/braintree/configuration.rb +1 -1
  5. data/lib/braintree/credit_card.rb +6 -5
  6. data/lib/braintree/error_codes.rb +46 -104
  7. data/lib/braintree/gateway.rb +4 -0
  8. data/lib/braintree/google_pay_card.rb +1 -0
  9. data/lib/braintree/merchant_account.rb +1 -25
  10. data/lib/braintree/merchant_account_gateway.rb +0 -81
  11. data/lib/braintree/meta_checkout_card.rb +6 -5
  12. data/lib/braintree/meta_checkout_token.rb +6 -5
  13. data/lib/braintree/paypal_payment_resource.rb +22 -0
  14. data/lib/braintree/paypal_payment_resource_gateway.rb +36 -0
  15. data/lib/braintree/test/credit_card.rb +1 -0
  16. data/lib/braintree/transaction/apple_pay_details.rb +1 -0
  17. data/lib/braintree/transaction/credit_card_details.rb +12 -10
  18. data/lib/braintree/transaction/google_pay_details.rb +11 -10
  19. data/lib/braintree/transaction/meta_checkout_card_details.rb +5 -2
  20. data/lib/braintree/transaction/meta_checkout_token_details.rb +6 -2
  21. data/lib/braintree/transaction/visa_checkout_card_details.rb +5 -2
  22. data/lib/braintree/transaction.rb +0 -26
  23. data/lib/braintree/transaction_gateway.rb +9 -20
  24. data/lib/braintree/version.rb +1 -1
  25. data/lib/braintree/visa_checkout_card.rb +5 -5
  26. data/lib/braintree/webhook_notification.rb +0 -4
  27. data/lib/braintree/webhook_testing_gateway.rb +0 -33
  28. data/lib/braintree.rb +2 -3
  29. data/spec/integration/braintree/credit_card_spec.rb +12 -0
  30. data/spec/integration/braintree/credit_card_verification_spec.rb +24 -0
  31. data/spec/integration/braintree/customer_spec.rb +22 -6
  32. data/spec/integration/braintree/disbursement_spec.rb +1 -1
  33. data/spec/integration/braintree/merchant_account_spec.rb +0 -342
  34. data/spec/integration/braintree/payment_method_nonce_spec.rb +11 -0
  35. data/spec/integration/braintree/payment_method_spec.rb +3 -3
  36. data/spec/integration/braintree/paypal_payment_resource_spec.rb +141 -0
  37. data/spec/integration/braintree/transaction_payment_facilitator_spec.rb +119 -0
  38. data/spec/integration/braintree/transaction_spec.rb +16 -305
  39. data/spec/spec_helper.rb +1 -1
  40. data/spec/unit/braintree/apple_pay_card_spec.rb +1 -0
  41. data/spec/unit/braintree/configuration_spec.rb +1 -1
  42. data/spec/unit/braintree/credit_card_spec.rb +5 -0
  43. data/spec/unit/braintree/google_pay_card_spec.rb +8 -0
  44. data/spec/unit/braintree/meta_checkout_card_spec.rb +53 -51
  45. data/spec/unit/braintree/meta_checkout_token_spec.rb +3 -1
  46. data/spec/unit/braintree/payment_method_nonce_spec.rb +4 -1
  47. data/spec/unit/braintree/paypal_payment_resource_spec.rb +125 -0
  48. data/spec/unit/braintree/transaction/apple_pay_details_spec.rb +8 -0
  49. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +2 -1
  50. data/spec/unit/braintree/transaction/google_pay_details_spec.rb +8 -0
  51. data/spec/unit/braintree/transaction/meta_checkout_card_details_spec.rb +8 -0
  52. data/spec/unit/braintree/transaction/meta_checkout_token_details_spec.rb +8 -0
  53. data/spec/unit/braintree/transaction/visa_checkout_card_details_spec.rb +8 -0
  54. data/spec/unit/braintree/transaction_gateway_spec.rb +19 -0
  55. data/spec/unit/braintree/transaction_spec.rb +2 -0
  56. data/spec/unit/braintree/visa_checkout_card_spec.rb +8 -0
  57. data/spec/unit/braintree/webhook_notification_spec.rb +0 -53
  58. data/spec/unit/credit_card_details_spec.rb +8 -0
  59. metadata +15 -7
  60. data/lib/braintree/merchant_account/business_details.rb +0 -17
  61. data/lib/braintree/merchant_account/funding_details.rb +0 -18
  62. data/lib/braintree/merchant_account/individual_details.rb +0 -20
  63. data/spec/unit/braintree/disbursement_spec.rb +0 -131
  64. data/spec/unit/braintree/merchant_account_spec.rb +0 -33
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a53b0f33066dc60083b87ba8eb176eecef8e765c87d4b0073f09d74ce584aeaf
4
- data.tar.gz: '09b4b509edaa9c5a8d20a52ee735eca5067a28c05fd01401a1a08034b84d6d49'
3
+ metadata.gz: 4cf859b9e9cd1dc488cbebf8b754be0a5657e76202688385526c3e83aae6510a
4
+ data.tar.gz: 71cfdbfa882a2e5e6bbb21cdd09bbf2c60b64b73956dd54a641c97cc8f3c2bee
5
5
  SHA512:
6
- metadata.gz: ae0bc77b138805d06321f200d61376328173630dc730f0fecd91483b70fd35f7817632323923a8bcf95c76c99b095825f472101f2bc3a657ad7d6c8d278ec5a2
7
- data.tar.gz: 8d28568a72404894d70b00546f2dd391520253cbe1729d852bbea67ebfbf8d65857389a42783b8f9923dee8add8677e38879421c5a9262f5d7a50076f04e2887
6
+ metadata.gz: 7df6373d9bfa7fcb80d6d828cdfe36e044e194ff5a7e63bfb561cd52e946e61d564ddbc63f4194680a69642ef4a8e8a681b88eb90e03d43348660ca10a9b41cb
7
+ data.tar.gz: bd194236bbf640da0e0765819468e12b0358b292a66a042482c7869abe3ee786c5f2e92b59dc3a00f22c6ccd85a94f94cecae1b99008e9923712a848f4aaec1e
@@ -32,6 +32,7 @@ module Braintree
32
32
  attr_reader :payment_instrument_name
33
33
  attr_reader :payroll
34
34
  attr_reader :prepaid
35
+ attr_reader :prepaid_reloadable
35
36
  attr_reader :product_id
36
37
  attr_reader :source_card_last4
37
38
  attr_reader :source_description
@@ -10,6 +10,7 @@ module Braintree
10
10
  attr_reader :issuing_bank
11
11
  attr_reader :payroll
12
12
  attr_reader :prepaid
13
+ attr_reader :prepaid_reloadable
13
14
  attr_reader :product_id
14
15
 
15
16
  def initialize(attributes)
@@ -26,7 +27,7 @@ module Braintree
26
27
  def self._attributes
27
28
  [
28
29
  :commercial, :country_of_issuance, :debit, :durbin_regulated, :healthcare,
29
- :issuing_bank, :payroll, :prepaid, :product_id
30
+ :issuing_bank, :payroll, :prepaid, :prepaid_reloadable, :product_id
30
31
  ]
31
32
  end
32
33
  end
@@ -239,7 +239,7 @@ module Braintree
239
239
  when :production
240
240
  "#{endpoint}.braintreegateway.com"
241
241
  when :qa
242
- "gateway.qa2.braintreepayments.com"
242
+ "gateway.qa.braintreepayments.com"
243
243
  when :sandbox
244
244
  "api.sandbox.braintreegateway.com"
245
245
  end
@@ -45,8 +45,8 @@ module Braintree
45
45
  Unknown = "Unknown"
46
46
  end
47
47
 
48
- Commercial = Debit = DurbinRegulated = Healthcare = Payroll = Prepaid = ProductId =
49
- IssuingBank = CountryOfIssuance = CardTypeIndicator
48
+ Commercial = CountryOfIssuance = Debit = DurbinRegulated = Healthcare =
49
+ IssuingBank = Payroll = Prepaid = PrepaidReloadable = ProductId = CardTypeIndicator
50
50
 
51
51
  attr_reader :billing_address
52
52
  attr_reader :bin
@@ -66,6 +66,7 @@ module Braintree
66
66
  attr_reader :last_4
67
67
  attr_reader :payroll
68
68
  attr_reader :prepaid
69
+ attr_reader :prepaid_reloadable
69
70
  attr_reader :product_id
70
71
  attr_reader :subscriptions
71
72
  attr_reader :token
@@ -199,9 +200,9 @@ module Braintree
199
200
 
200
201
  def self._attributes
201
202
  [
202
- :billing_address, :bin, :card_type, :cardholder_name, :created_at, :customer_id, :expiration_month,
203
- :expiration_year, :last_4, :token, :updated_at, :prepaid, :payroll, :product_id, :commercial, :debit, :durbin_regulated,
204
- :healthcare, :country_of_issuance, :issuing_bank, :image_url, :is_network_tokenized?
203
+ :billing_address, :bin, :card_type, :cardholder_name, :commercial, :country_of_issuance, :created_at, :customer_id,
204
+ :debit, :durbin_regulated, :expiration_month, :expiration_year, :healthcare, :image_url, :is_network_tokenized?,
205
+ :issuing_bank, :last_4, :payroll, :prepaid, :prepaid_reloadable, :product_id, :token, :updated_at
205
206
  ]
206
207
  end
207
208
 
@@ -116,7 +116,6 @@ module Braintree
116
116
  VerificationAmountFormatIsInvalid = "91740"
117
117
  VerificationAmountIsTooLarge = "91752"
118
118
  VerificationAmountNotSupportedByProcessor = "91741"
119
- VerificationMerchantAccountCannotBeSubMerchantAccount = "91755"
120
119
  VerificationMerchantAccountIdIsInvalid = "91728"
121
120
  VerificationMerchantAccountIsForbidden = "91743"
122
121
  VerificationMerchantAccountIsSuspended = "91742"
@@ -191,6 +190,10 @@ module Braintree
191
190
  AndroidPayCardsAreNotAccepted = "83708"
192
191
  end
193
192
 
193
+ module PaymentFacilitator
194
+ PaymentFacilitatorNotApplicable = "97405"
195
+ end
196
+
194
197
  module PayPalAccount
195
198
  AuthExpired = "92911"
196
199
  CannotHaveBothAccessTokenAndConsentCode = "82903"
@@ -210,6 +213,47 @@ module Braintree
210
213
  TokenIsInUse = "92906"
211
214
  end
212
215
 
216
+ module PayPalPaymentResource
217
+ NonceExpired = "97301"
218
+ IdNotSupported = "97302"
219
+ NonceRequired = "97303"
220
+ InvalidEmail = "97304"
221
+ EmailTooLong = "97305"
222
+ ExpectedLineItemCollection = "97306"
223
+ ExpectedLineItemHash = "97307"
224
+ ExpectedLineItemDebit = "97308"
225
+ InvalidUnitAmount = "97309"
226
+ InvalidUnitTaxAmount = "97310"
227
+ IsoCodeRequired = "97311"
228
+ IsoCodeUnsupported = "97312"
229
+ ShippingFieldsMissing = "97313"
230
+ InvalidAmountBreakdown = "97314"
231
+ ExpectedShippingOptionCollection = "97315"
232
+ ShippingOptionsRequired = "97316"
233
+ ShippingOptionFieldsMissing = "97317"
234
+ InvalidShippingOptionType = "97318"
235
+ ShippingOptionIdReused = "97319"
236
+ TooManyShippingOptionsSelected = "97320"
237
+ ShippingOptionMustMatchBreakdown = "97321"
238
+ LineItemsShouldMatchTotal = "97322"
239
+ LineItemsTaxShouldMatchTotal = "97323"
240
+ PatchCallFailed = "97324"
241
+ InvalidAmount = "97325"
242
+ ShippingIdTooLong = "97326"
243
+ ShippingLabelTooLong = "97327"
244
+ ShippingFullNameTooLong = "97328"
245
+ ShippingAddressTooLong = "97329"
246
+ ShippingExtendedAddressTooLong = "97330"
247
+ ShippingLocalityTooLong = "97331"
248
+ ShippingRegionTooLong = "97332"
249
+ CountryCodeTooLong = "97333"
250
+ NationalNumberTooLong = "97334"
251
+ PostalCodeTooLong = "97335"
252
+ DescriptionTooLong = "97336"
253
+ CustomFieldTooLong = "97337"
254
+ OrderIdTooLong = "97338"
255
+ end
256
+
213
257
  module SepaDirectDebitAccount
214
258
  SepaDebitAccountPaymentMethodMandateTypeIsNotSupported = "87115"
215
259
  SepaDebitAccountPaymentMethodCustomerIdIsInvalid = "87116"
@@ -296,21 +340,16 @@ module Braintree
296
340
  BillingAddressConflict = "91530"
297
341
  BillingPhoneNumberIsInvalid = "915206"
298
342
  CannotBeVoided = "91504"
299
- CannotCancelRelease = "91562"
300
343
  CannotCloneCredit = "91543"
301
- CannotCloneMarketplaceTransaction = "915137"
302
344
  CannotCloneTransactionWithPayPalAccount = "91573"
303
345
  CannotCloneTransactionWithVaultCreditCard = "91540"
304
346
  CannotCloneUnsuccessfulTransaction = "91542"
305
347
  CannotCloneVoiceAuthorizations = "91541"
306
- CannotHoldInEscrow = "91560"
307
- CannotPartiallyRefundEscrowedTransaction = "91563"
308
348
  CannotRefundCredit = "91505"
309
349
  CannotRefundSettlingTransaction = "91574"
310
350
  CannotRefundUnlessSettled = "91506"
311
351
  CannotRefundWithPendingMerchantAccount = "91559"
312
352
  CannotRefundWithSuspendedMerchantAccount = "91538"
313
- CannotReleaseFromEscrow = "91561"
314
353
  CannotSimulateTransactionSettlement = "91575"
315
354
  CannotSubmitForSettlement = "91507"
316
355
  CannotUpdateTransactionDetailsNotSubmittedForSettlement = "915129"
@@ -393,7 +432,6 @@ module Braintree
393
432
  ShipsFromPostalCodeInvalidCharacters = "915167"
394
433
  ShipsFromPostalCodeIsInvalid = "915166"
395
434
  ShipsFromPostalCodeIsTooLong = "915165"
396
- SubMerchantAccountRequiresServiceFeeAmount = "91553"
397
435
  SubscriptionDoesNotBelongToCustomer = "91529"
398
436
  SubscriptionIdIsInvalid = "91528"
399
437
  SubscriptionStatusMustBePastDue = "91531"
@@ -427,6 +465,7 @@ module Braintree
427
465
  UsBankAccountNonceMustBePlaidVerified = "915171"
428
466
  UsBankAccountNotVerified = "915172"
429
467
 
468
+
430
469
  module Options
431
470
  SubmitForSettlementIsRequiredForCloning = "91544"
432
471
  SubmitForSettlementIsRequiredForPayPalUnilateral = "91582"
@@ -598,110 +637,14 @@ module Braintree
598
637
  end
599
638
 
600
639
  module MerchantAccount
601
- CannotBeUpdated = "82674"
602
- Declined = "82626"
603
- DeclinedFailedKYC = "82623"
604
- DeclinedMasterCardMatch = "82622"
605
- DeclinedOFAC = "82621"
606
- DeclinedSsnInvalid = "82624"
607
- DeclinedSsnMatchesDeceased = "82625"
608
- IdCannotBeUpdated = "82675"
609
- IdFormatIsInvalid = "82603"
610
- IdIsInUse = "82604"
611
- IdIsNotAllowed = "82605"
612
- IdIsTooLong = "82602"
613
- MasterMerchantAccountIdCannotBeUpdated = "82676"
614
- MasterMerchantAccountIdIsInvalid = "82607"
615
- MasterMerchantAccountIdIsRequired = "82606"
616
- MasterMerchantAccountMustBeActive = "82608"
617
- TosAcceptedIsRequired = "82610"
618
640
 
619
641
  module ApplicantDetails
620
- AccountNumberIsInvalid = "82670"
621
- AccountNumberIsRequired = "82614"
622
- CompanyNameIsInvalid = "82631"
623
- CompanyNameIsRequiredWithTaxId = "82633"
624
- DateOfBirthIsInvalid = "82663"
625
- DateOfBirthIsRequired = "82612"
626
642
  Declined = "82626" # Keep for backwards compatibility
627
643
  DeclinedFailedKYC = "82623" # Keep for backwards compatibility
628
644
  DeclinedMasterCardMatch = "82622" # Keep for backwards compatibility
629
645
  DeclinedOFAC = "82621" # Keep for backwards compatibility
630
646
  DeclinedSsnInvalid = "82624" # Keep for backwards compatibility
631
647
  DeclinedSsnMatchesDeceased = "82625" # Keep for backwards compatibility
632
- EmailAddressIsInvalid = "82616"
633
- EmailAddressIsRequired = "82665"
634
- FirstNameIsInvalid = "82627"
635
- FirstNameIsRequired = "82609"
636
- LastNameIsInvalid = "82628"
637
- LastNameIsRequired = "82611"
638
- PhoneIsInvalid = "82636"
639
- RoutingNumberIsInvalid = "82635"
640
- RoutingNumberIsRequired = "82613"
641
- SsnIsInvalid = "82615"
642
- TaxIdIsInvalid = "82632"
643
- TaxIdIsRequiredWithCompanyName = "82634"
644
- TaxIdMustBeBlank = "82673"
645
-
646
- module Address
647
- LocalityIsRequired = "82618"
648
- PostalCodeIsInvalid = "82630"
649
- PostalCodeIsRequired = "82619"
650
- RegionIsInvalid = "82664"
651
- RegionIsRequired = "82620"
652
- StreetAddressIsInvalid = "82629"
653
- StreetAddressIsRequired = "82617"
654
- end
655
- end
656
-
657
- module Individual
658
- DateOfBirthIsInvalid = "82666"
659
- DateOfBirthIsRequired = "82639"
660
- EmailIsInvalid = "82643"
661
- EmailIsRequired = "82667"
662
- FirstNameIsInvalid = "82644"
663
- FirstNameIsRequired = "82637"
664
- LastNameIsInvalid = "82645"
665
- LastNameIsRequired = "82638"
666
- PhoneIsInvalid = "82656"
667
- SsnIsInvalid = "82642"
668
-
669
- module Address
670
- LocalityIsRequired = "82658"
671
- PostalCodeIsInvalid = "82662"
672
- PostalCodeIsRequired = "82659"
673
- RegionIsInvalid = "82668"
674
- RegionIsRequired = "82660"
675
- StreetAddressIsInvalid = "82661"
676
- StreetAddressIsRequired = "82657"
677
- end
678
- end
679
-
680
- module Business
681
- DbaNameIsInvalid = "82646"
682
- LegalNameIsInvalid = "82677"
683
- LegalNameIsRequiredWithTaxId = "82669"
684
- TaxIdIsInvalid = "82647"
685
- TaxIdIsRequiredWithLegalName = "82648"
686
- TaxIdMustBeBlank = "82672"
687
- module Address
688
- PostalCodeIsInvalid = "82686"
689
- RegionIsInvalid = "82684"
690
- StreetAddressIsInvalid = "82685"
691
- end
692
- end
693
-
694
- module Funding
695
- AccountNumberIsInvalid = "82671"
696
- AccountNumberIsRequired = "82641"
697
- DestinationIsInvalid = "82679"
698
- DestinationIsRequired = "82678"
699
- EmailIsInvalid = "82681"
700
- EmailIsRequired = "82680"
701
- MobilePhoneIsInvalid = "82683"
702
- MobilePhoneIsRequired = "82682"
703
- RoutingNumberIsInvalid = "82649"
704
- RoutingNumberIsRequired = "82640"
705
648
  end
706
649
  end
707
650
 
@@ -767,7 +710,6 @@ module Braintree
767
710
  AmountFormatIsInvalid = "94202"
768
711
  AmountIsTooLarge = "94207"
769
712
  AmountNotSupportedByProcessor = "94203"
770
- MerchantAccountCannotBeSubMerchantAccount = "94208"
771
713
  MerchantAccountIdIsInvalid = "94204"
772
714
  MerchantAccountIsForbidden = "94206"
773
715
  MerchantAccountIsSuspended = "94205"
@@ -78,6 +78,10 @@ module Braintree
78
78
  PayPalAccountGateway.new(self)
79
79
  end
80
80
 
81
+ def paypal_payment_resource
82
+ PayPalPaymentResourceGateway.new(self)
83
+ end
84
+
81
85
  def us_bank_account
82
86
  UsBankAccountGateway.new(self)
83
87
  end
@@ -18,6 +18,7 @@ module Braintree
18
18
  attr_reader :issuing_bank
19
19
  attr_reader :payroll
20
20
  attr_reader :prepaid
21
+ attr_reader :prepaid_reloadable
21
22
  attr_reader :product_id
22
23
  attr_reader :source_card_last_4
23
24
  attr_reader :source_card_type
@@ -18,44 +18,20 @@ module Braintree
18
18
  include Braintree::MerchantAccount::FundingDestination
19
19
  end
20
20
 
21
- attr_reader :business_details
22
21
  attr_reader :currency_iso_code
23
22
  attr_reader :default
24
- attr_reader :funding_details
25
23
  attr_reader :id
26
- attr_reader :individual_details
27
- attr_reader :master_merchant_account
28
24
  attr_reader :status
29
25
 
30
26
  alias_method :default?, :default
31
27
 
32
- def self.create(*args)
33
- Configuration.gateway.merchant_account.create(*args)
34
- end
35
-
36
- def self.create!(*args)
37
- Configuration.gateway.merchant_account.create!(*args)
38
- end
39
-
40
28
  def self.find(*args)
41
29
  Configuration.gateway.merchant_account.find(*args)
42
30
  end
43
31
 
44
- def self.update(*args)
45
- Configuration.gateway.merchant_account.update(*args)
46
- end
47
-
48
- def self.update!(*args)
49
- Configuration.gateway.merchant_account.update!(*args)
50
- end
51
-
52
32
  def initialize(gateway, attributes)
53
33
  @gateway = gateway
54
34
  set_instance_variables_from_hash(attributes)
55
- @individual_details = IndividualDetails.new(@individual)
56
- @business_details = BusinessDetails.new(@business)
57
- @funding_details = FundingDetails.new(@funding)
58
- @master_merchant_account = MerchantAccount._new(@gateway, attributes.delete(:master_merchant_account)) if attributes[:master_merchant_account]
59
35
  end
60
36
 
61
37
  class << self
@@ -66,7 +42,7 @@ module Braintree
66
42
  end
67
43
 
68
44
  def inspect
69
- order = [:id, :status, :master_merchant_account]
45
+ order = [:id, :status]
70
46
  nice_attributes = order.map do |attr|
71
47
  "#{attr}: #{send(attr).inspect}"
72
48
  end
@@ -20,16 +20,6 @@ module Braintree
20
20
  PaginatedResult.new(body[:total_items], body[:page_size], merchant_accounts)
21
21
  end
22
22
 
23
- def create(attributes)
24
- signature = MerchantAccountGateway._detect_signature(attributes)
25
- Util.verify_keys(signature, attributes)
26
- _do_create "/merchant_accounts/create_via_api", :merchant_account => attributes
27
- end
28
-
29
- def create!(*args)
30
- return_object_or_raise(:merchant_account) { create(*args) }
31
- end
32
-
33
23
  def find(merchant_account_id)
34
24
  raise ArgumentError if merchant_account_id.nil? || merchant_account_id.to_s.strip == ""
35
25
  response = @config.http.get("#{@config.base_merchant_path}/merchant_accounts/#{merchant_account_id}")
@@ -38,37 +28,10 @@ module Braintree
38
28
  raise NotFoundError, "Merchant account with id #{merchant_account_id} not found"
39
29
  end
40
30
 
41
- def update(merchant_account_id, attributes)
42
- Util.verify_keys(MerchantAccountGateway._update_signature, attributes)
43
- _do_update "/merchant_accounts/#{merchant_account_id}/update_via_api", :merchant_account => attributes
44
- end
45
-
46
- def update!(*args)
47
- return_object_or_raise(:merchant_account) { update(*args) }
48
- end
49
-
50
31
  def create_for_currency(params)
51
32
  _create_for_currency(params)
52
33
  end
53
34
 
54
- def _do_create(path, params=nil)
55
- response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
56
- if response[:api_error_response]
57
- ErrorResult.new(@gateway, response[:api_error_response])
58
- else
59
- SuccessfulResult.new(:merchant_account => MerchantAccount._new(@gateway, response[:merchant_account]))
60
- end
61
- end
62
-
63
- def _do_update(path, params=nil)
64
- response = @config.http.put("#{@config.base_merchant_path}#{path}", params)
65
- if response[:api_error_response]
66
- ErrorResult.new(@gateway, response[:api_error_response])
67
- else
68
- SuccessfulResult.new(:merchant_account => MerchantAccount._new(@gateway, response[:merchant_account]))
69
- end
70
- end
71
-
72
35
  def _create_for_currency(params)
73
36
  response = @config.http.post("#{@config.base_merchant_path}/merchant_accounts/create_for_currency", :merchant_account => params)
74
37
 
@@ -82,49 +45,5 @@ module Braintree
82
45
  raise UnexpectedError, "expected :merchant or :api_error_response"
83
46
  end
84
47
  end
85
-
86
- # NEXT_MAJOR_VERSION this is part of Marketplace and shouldn't be removed unless we're removing all Marketplace code
87
- def self._detect_signature(attributes)
88
- if attributes.has_key?(:applicant_details)
89
- warn "[DEPRECATED] Passing :applicant_details to create is deprecated. Please use :individual, :business, and :funding."
90
- MerchantAccountGateway._deprecated_create_signature
91
- else
92
- MerchantAccountGateway._create_signature
93
- end
94
- end
95
-
96
- # NEXT_MAJOR_VERSION this is part of Marketplace and shouldn't be removed unless we're removing all Marketplace code
97
- def self._deprecated_create_signature
98
- [
99
- {:applicant_details => [
100
- :first_name, :last_name, :email, :date_of_birth, :ssn, :routing_number,
101
- :account_number, :tax_id, :company_name, :phone,
102
- {:address => [:street_address, :postal_code, :locality, :region]}]
103
- },
104
- :tos_accepted, :master_merchant_account_id, :id
105
- ]
106
- end
107
-
108
- def self._signature
109
- [
110
- {:individual => [
111
- :first_name, :last_name, :email, :date_of_birth, :ssn, :phone,
112
- {:address => [:street_address, :locality, :region, :postal_code]}]
113
- },
114
- {:business => [
115
- :dba_name, :legal_name, :tax_id,
116
- {:address => [:street_address, :locality, :region, :postal_code]}]
117
- },
118
- {:funding => [:destination, :email, :mobile_phone, :routing_number, :account_number, :descriptor]}
119
- ]
120
- end
121
-
122
- def self._create_signature
123
- _signature + [:tos_accepted, :master_merchant_account_id, :id]
124
- end
125
-
126
- def self._update_signature
127
- _signature
128
- end
129
48
  end
130
49
  end
@@ -22,6 +22,7 @@ module Braintree
22
22
  attr_reader :last_4
23
23
  attr_reader :payroll
24
24
  attr_reader :prepaid
25
+ attr_reader :prepaid_reloadable
25
26
  attr_reader :product_id
26
27
  attr_reader :subscriptions
27
28
  attr_reader :token
@@ -74,11 +75,11 @@ module Braintree
74
75
 
75
76
  def self._attributes # :nodoc:
76
77
  [
77
- :bin, :card_type, :cardholder_name, :created_at,
78
- :customer_id, :customer_location, :expiration_month, :expiration_year,
79
- :last_4, :token, :updated_at, :prepaid, :payroll, :product_id,
80
- :commercial, :debit, :durbin_regulated, :healthcare,
81
- :country_of_issuance, :issuing_bank, :image_url, :container_id
78
+ :bin, :card_type, :cardholder_name, :commercial,
79
+ :container_id, :country_of_issuance, :created_at, :customer_id,
80
+ :customer_location, :debit, :durbin_regulated, :expiration_month,
81
+ :expiration_year, :healthcare, :image_url, :issuing_bank, :last_4, :payroll, :prepaid,
82
+ :prepaid_reloadable, :product_id, :token, :updated_at
82
83
  ]
83
84
  end
84
85
 
@@ -24,6 +24,7 @@ module Braintree
24
24
  attr_reader :last_4
25
25
  attr_reader :payroll
26
26
  attr_reader :prepaid
27
+ attr_reader :prepaid_reloadable
27
28
  attr_reader :product_id
28
29
  attr_reader :token
29
30
  attr_reader :unique_number_identifier
@@ -73,11 +74,11 @@ module Braintree
73
74
 
74
75
  def self._attributes # :nodoc:
75
76
  [
76
- :bin, :card_type, :cardholder_name, :created_at,
77
- :customer_id, :customer_location, :expiration_month, :expiration_year,
78
- :last_4, :token, :updated_at, :prepaid, :payroll, :product_id,
79
- :commercial, :debit, :durbin_regulated, :healthcare, :ecommerce_indicator,
80
- :country_of_issuance, :issuing_bank, :image_url, :container_id, :cryptogram
77
+ :bin, :card_type, :cardholder_name, :commercial, :container_id, :country_of_issuance,
78
+ :created_at, :cryptogram, :customer_id, :customer_location, :debit, :durbin_regulated,
79
+ :ecommerce_indicator, :expiration_month, :expiration_year, :healthcare, :image_url,
80
+ :issuing_bank, :last_4, :payroll, :prepaid, :prepaid_reloadable, :product_id, :token,
81
+ :updated_at
81
82
  ]
82
83
  end
83
84
 
@@ -0,0 +1,22 @@
1
+ module Braintree
2
+ class PayPalPaymentResource
3
+ include BaseModule
4
+
5
+ def self.update(*args)
6
+ Configuration.gateway.paypal_payment_resource.update(*args)
7
+ end
8
+
9
+ class << self
10
+ protected :new
11
+ def _new(*args)
12
+ self.new(*args)
13
+ end
14
+ end
15
+
16
+ def initialize(gateway, attributes)
17
+ @gateway = gateway
18
+ set_instance_variables_from_hash(attributes)
19
+ end
20
+ end
21
+ end
22
+
@@ -0,0 +1,36 @@
1
+ module Braintree
2
+ class PayPalPaymentResourceGateway
3
+ include BaseModule
4
+
5
+ def initialize(gateway)
6
+ @gateway = gateway
7
+ @config = gateway.config
8
+ @config.assert_has_access_token_or_keys
9
+ end
10
+
11
+ def update(attributes)
12
+ Util.verify_keys(PayPalPaymentResourceGateway._update_signature, attributes)
13
+ response = @config.http.put("#{@config.base_merchant_path}/paypal/payment_resource", :paypal_payment_resource => attributes)
14
+ if response[:payment_method_nonce]
15
+ SuccessfulResult.new(:payment_method_nonce => PaymentMethodNonce._new(@gateway, response[:payment_method_nonce]))
16
+ elsif response[:api_error_response]
17
+ ErrorResult.new(@gateway, response[:api_error_response])
18
+ else
19
+ raise UnexpectedError, "expected :paypal_payment_resource or :api_error_response"
20
+ end
21
+ end
22
+
23
+ def self._update_signature
24
+ [
25
+ :amount,
26
+ {:amount_breakdown => [:discount, :handling, :insurance, :item_total, :shipping, :shipping_discount, :tax_total]},
27
+ :currency_iso_code, :custom_field, :description,
28
+ {:line_items => [:description, :image_url, :kind, :name, :product_code, :quantity, :total_amount, :unit_amount, :unit_tax_amount, :url]},
29
+ :order_id, :payee_email, :payment_method_nonce,
30
+ {:shipping => [:country_name, :country_code_alpha2, :country_code_alpha3, :country_code_numeric, :extended_address, :first_name, {:international_phone => [:country_code, :national_number]},
31
+ :last_name, :locality, :postal_code, :region, :street_address]},
32
+ {:shipping_options => [:amount, :id, :label, :selected, :type]}
33
+ ]
34
+ end
35
+ end
36
+ end
@@ -3,6 +3,7 @@ module Braintree
3
3
  module CreditCardNumbers
4
4
  module CardTypeIndicators
5
5
  Prepaid = "4111111111111210"
6
+ PrepaidReloadable = "4229989900000002"
6
7
  Commercial = "4111111111131010"
7
8
  Payroll = "4111111114101010"
8
9
  Healthcare = "4111111510101010"
@@ -21,6 +21,7 @@ module Braintree
21
21
  attr_reader :payment_instrument_name
22
22
  attr_reader :payroll
23
23
  attr_reader :prepaid
24
+ attr_reader :prepaid_reloadable
24
25
  attr_reader :product_id
25
26
  attr_reader :source_card_last4
26
27
  attr_reader :source_description
@@ -20,6 +20,7 @@ module Braintree
20
20
  attr_reader :last_4
21
21
  attr_reader :payroll
22
22
  attr_reader :prepaid
23
+ attr_reader :prepaid_reloadable
23
24
  attr_reader :product_id
24
25
  attr_reader :token
25
26
  attr_reader :unique_number_identifier
@@ -34,23 +35,24 @@ module Braintree
34
35
 
35
36
  def inspect
36
37
  attr_order = [
37
- :token,
38
38
  :bin,
39
- :last_4,
40
39
  :card_type,
41
- :expiration_date,
42
40
  :cardholder_name,
41
+ :commercial,
42
+ :country_of_issuance,
43
43
  :customer_location,
44
- :prepaid,
45
- :healthcare,
46
- :durbin_regulated,
47
44
  :debit,
48
- :commercial,
45
+ :durbin_regulated,
46
+ :expiration_date,
47
+ :healthcare,
48
+ :image_url,
49
+ :issuing_bank,
50
+ :last_4,
49
51
  :payroll,
52
+ :prepaid,
53
+ :prepaid_reloadable,
50
54
  :product_id,
51
- :country_of_issuance,
52
- :issuing_bank,
53
- :image_url,
55
+ :token,
54
56
  :unique_number_identifier,
55
57
  ]
56
58