braintree 4.23.0 → 4.34.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 (130) hide show
  1. checksums.yaml +4 -4
  2. data/lib/braintree/address_gateway.rb +5 -0
  3. data/lib/braintree/apple_pay_card.rb +6 -0
  4. data/lib/braintree/bank_account_instant_verification_gateway.rb +38 -0
  5. data/lib/braintree/bank_account_instant_verification_jwt.rb +23 -0
  6. data/lib/braintree/bank_account_instant_verification_jwt_request.rb +21 -0
  7. data/lib/braintree/bin_data.rb +8 -2
  8. data/lib/braintree/configuration.rb +1 -1
  9. data/lib/braintree/credit_card.rb +12 -5
  10. data/lib/braintree/credit_card_gateway.rb +1 -0
  11. data/lib/braintree/credit_card_verification_gateway.rb +5 -2
  12. data/lib/braintree/customer_session_gateway.rb +195 -0
  13. data/lib/braintree/dispute.rb +1 -0
  14. data/lib/braintree/error_codes.rb +58 -104
  15. data/lib/braintree/error_result.rb +1 -1
  16. data/lib/braintree/errors.rb +2 -1
  17. data/lib/braintree/gateway.rb +12 -0
  18. data/lib/braintree/google_pay_card.rb +5 -0
  19. data/lib/braintree/graphql/enums/recommendations.rb +9 -0
  20. data/lib/braintree/graphql/enums/recommended_payment_option.rb +10 -0
  21. data/lib/braintree/graphql/inputs/create_customer_session_input.rb +44 -0
  22. data/lib/braintree/graphql/inputs/customer_recommendations_input.rb +40 -0
  23. data/lib/braintree/graphql/inputs/customer_session_input.rb +45 -0
  24. data/lib/braintree/graphql/inputs/monetary_amount_input.rb +28 -0
  25. data/lib/braintree/graphql/inputs/paypal_payee_input.rb +28 -0
  26. data/lib/braintree/graphql/inputs/paypal_purchase_unit_input.rb +31 -0
  27. data/lib/braintree/graphql/inputs/phone_input.rb +34 -0
  28. data/lib/braintree/graphql/inputs/update_customer_session_input.rb +42 -0
  29. data/lib/braintree/graphql/types/customer_recommendations_payload.rb +129 -0
  30. data/lib/braintree/graphql/types/payment_options.rb +35 -0
  31. data/lib/braintree/graphql/types/payment_recommendations.rb +35 -0
  32. data/lib/braintree/graphql/unions/customer_recommendations.rb +47 -0
  33. data/lib/braintree/graphql_client.rb +16 -0
  34. data/lib/braintree/merchant_account.rb +1 -25
  35. data/lib/braintree/merchant_account_gateway.rb +0 -81
  36. data/lib/braintree/meta_checkout_card.rb +11 -6
  37. data/lib/braintree/meta_checkout_token.rb +11 -6
  38. data/lib/braintree/payment_method_gateway.rb +9 -0
  39. data/lib/braintree/paypal_payment_resource.rb +22 -0
  40. data/lib/braintree/paypal_payment_resource_gateway.rb +36 -0
  41. data/lib/braintree/successful_result.rb +3 -0
  42. data/lib/braintree/test/credit_card.rb +5 -0
  43. data/lib/braintree/transaction/apple_pay_details.rb +7 -0
  44. data/lib/braintree/transaction/credit_card_details.rb +22 -10
  45. data/lib/braintree/transaction/google_pay_details.rb +16 -10
  46. data/lib/braintree/transaction/meta_checkout_card_details.rb +11 -2
  47. data/lib/braintree/transaction/meta_checkout_token_details.rb +13 -3
  48. data/lib/braintree/transaction/paypal_details.rb +2 -0
  49. data/lib/braintree/transaction/visa_checkout_card_details.rb +10 -2
  50. data/lib/braintree/transaction.rb +3 -26
  51. data/lib/braintree/transaction_gateway.rb +52 -31
  52. data/lib/braintree/us_bank_account_verification.rb +3 -1
  53. data/lib/braintree/version.rb +1 -1
  54. data/lib/braintree/visa_checkout_card.rb +10 -5
  55. data/lib/braintree/webhook_notification.rb +1 -4
  56. data/lib/braintree/webhook_testing_gateway.rb +16 -33
  57. data/lib/braintree/xml/{libxml.rb → nokogiri.rb} +18 -16
  58. data/lib/braintree/xml/parser.rb +4 -4
  59. data/lib/braintree.rb +21 -4
  60. data/spec/integration/braintree/advanced_search_spec.rb +7 -4
  61. data/spec/integration/braintree/apple_pay_spec.rb +6 -7
  62. data/spec/integration/braintree/bank_account_instant_verification_spec.rb +191 -0
  63. data/spec/integration/braintree/client_api/spec_helper.rb +81 -0
  64. data/spec/integration/braintree/credit_card_spec.rb +115 -1
  65. data/spec/integration/braintree/credit_card_verification_spec.rb +149 -0
  66. data/spec/integration/braintree/customer_session_spec.rb +154 -0
  67. data/spec/integration/braintree/customer_spec.rb +94 -10
  68. data/spec/integration/braintree/disbursement_spec.rb +1 -1
  69. data/spec/integration/braintree/dispute_spec.rb +13 -2
  70. data/spec/integration/braintree/merchant_account_spec.rb +19 -359
  71. data/spec/integration/braintree/merchant_spec.rb +4 -4
  72. data/spec/integration/braintree/payment_method_nonce_spec.rb +55 -0
  73. data/spec/integration/braintree/payment_method_spec.rb +57 -7
  74. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +0 -3
  75. data/spec/integration/braintree/paypal_payment_resource_spec.rb +141 -0
  76. data/spec/integration/braintree/transaction_payment_facilitator_spec.rb +119 -0
  77. data/spec/integration/braintree/transaction_search_spec.rb +38 -33
  78. data/spec/integration/braintree/transaction_spec.rb +266 -350
  79. data/spec/integration/braintree/transaction_transfer_type_spec.rb +325 -0
  80. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +0 -1
  81. data/spec/integration/braintree/us_bank_account_spec.rb +0 -3
  82. data/spec/integration/braintree/us_bank_account_verification_spec.rb +1 -1
  83. data/spec/spec_helper.rb +46 -12
  84. data/spec/unit/braintree/apple_pay_card_spec.rb +7 -0
  85. data/spec/unit/braintree/bank_account_instant_verification_gateway_spec.rb +98 -0
  86. data/spec/unit/braintree/bank_account_instant_verification_jwt_request_spec.rb +71 -0
  87. data/spec/unit/braintree/client_token_spec.rb +11 -0
  88. data/spec/unit/braintree/configuration_spec.rb +1 -1
  89. data/spec/unit/braintree/credit_card_spec.rb +27 -2
  90. data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +1 -0
  91. data/spec/unit/braintree/credit_card_verification_spec.rb +17 -0
  92. data/spec/unit/braintree/customer_session_gateway_spec.rb +122 -0
  93. data/spec/unit/braintree/customer_spec.rb +2 -1
  94. data/spec/unit/braintree/dispute_spec.rb +6 -0
  95. data/spec/unit/braintree/error_result_spec.rb +28 -0
  96. data/spec/unit/braintree/google_pay_card_spec.rb +28 -0
  97. data/spec/unit/braintree/graphql/create_customer_session_input_spec.rb +102 -0
  98. data/spec/unit/braintree/graphql/customer_recommendations_input_spec.rb +80 -0
  99. data/spec/unit/braintree/graphql/customer_recommendations_spec.rb +40 -0
  100. data/spec/unit/braintree/graphql/customer_session_input_spec.rb +81 -0
  101. data/spec/unit/braintree/graphql/phone_input_spec.rb +51 -0
  102. data/spec/unit/braintree/graphql/update_customer_session_input_spec.rb +107 -0
  103. data/spec/unit/braintree/graphql_client_spec.rb +37 -0
  104. data/spec/unit/braintree/meta_checkout_card_spec.rb +61 -51
  105. data/spec/unit/braintree/meta_checkout_token_spec.rb +7 -1
  106. data/spec/unit/braintree/payment_method_nonce_spec.rb +11 -1
  107. data/spec/unit/braintree/payment_method_spec.rb +12 -0
  108. data/spec/unit/braintree/paypal_payment_resource_spec.rb +125 -0
  109. data/spec/unit/braintree/transaction/apple_pay_details_spec.rb +37 -0
  110. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +15 -1
  111. data/spec/unit/braintree/transaction/google_pay_details_spec.rb +37 -0
  112. data/spec/unit/braintree/transaction/meta_checkout_card_details_spec.rb +28 -0
  113. data/spec/unit/braintree/transaction/meta_checkout_token_details_spec.rb +28 -0
  114. data/spec/unit/braintree/transaction/paypal_details_spec.rb +5 -0
  115. data/spec/unit/braintree/transaction/visa_checkout_card_details_spec.rb +28 -0
  116. data/spec/unit/braintree/transaction_ach_mandate_spec.rb +82 -0
  117. data/spec/unit/braintree/transaction_gateway_spec.rb +58 -11
  118. data/spec/unit/braintree/transaction_spec.rb +66 -0
  119. data/spec/unit/braintree/visa_checkout_card_spec.rb +28 -0
  120. data/spec/unit/braintree/webhook_notification_spec.rb +15 -51
  121. data/spec/unit/braintree/xml/{libxml_spec.rb → nokogiri_spec.rb} +7 -7
  122. data/spec/unit/braintree/xml/parser_spec.rb +57 -0
  123. data/spec/unit/credit_card_details_spec.rb +28 -0
  124. metadata +49 -10
  125. data/lib/braintree/merchant_account/business_details.rb +0 -17
  126. data/lib/braintree/merchant_account/funding_details.rb +0 -18
  127. data/lib/braintree/merchant_account/individual_details.rb +0 -20
  128. data/lib/ssl/securetrust_ca.crt +0 -44
  129. data/spec/unit/braintree/disbursement_spec.rb +0 -131
  130. data/spec/unit/braintree/merchant_account_spec.rb +0 -33
@@ -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"
@@ -356,6 +395,7 @@ module Braintree
356
395
  PaymentMethodNonceUnknown = "91565"
357
396
  PaymentMethodTokenCardTypeIsNotAccepted = "91517"
358
397
  PaymentMethodTokenIsInvalid = "91518"
398
+ ProcessingMerchantCategoryCodeIsInvalid = "915265"
359
399
  ProcessorAuthorizationCodeCannotBeSet = "91519"
360
400
  ProcessorAuthorizationCodeIsInvalid = "81520"
361
401
  ProcessorDoesNotSupportAuths = "915104"
@@ -393,7 +433,6 @@ module Braintree
393
433
  ShipsFromPostalCodeInvalidCharacters = "915167"
394
434
  ShipsFromPostalCodeIsInvalid = "915166"
395
435
  ShipsFromPostalCodeIsTooLong = "915165"
396
- SubMerchantAccountRequiresServiceFeeAmount = "91553"
397
436
  SubscriptionDoesNotBelongToCustomer = "91529"
398
437
  SubscriptionIdIsInvalid = "91528"
399
438
  SubscriptionStatusMustBePastDue = "91531"
@@ -421,12 +460,24 @@ module Braintree
421
460
  TransactionIsNotEligibleForAdjustment = "915219"
422
461
  TransactionMustBeInStateAuthorized = "915218"
423
462
  TransactionSourceIsInvalid = "915133"
463
+ TransactionTransferDetailsAreMandatory = "97510"
464
+ TransactionTransferDetailsAreNotApplicable = "97511"
465
+ TransactionTransferReceiverAccountReferenceNumberIsNotValid = "97509"
466
+ TransactionTransferReceiverFirstNameIsNotValid = "97507"
467
+ TransactionTransferReceiverLastNameIsNotValid = "97508"
468
+ TransactionTransferReceiverTaxIdIsNotValid = "97506"
469
+ TransactionTransferSenderAccountReferenceNumberIsNotValid = "97505"
470
+ TransactionTransferSenderFirstNameIsNotValid = "97503"
471
+ TransactionTransferSenderLastNameIsNotValid = "97504"
472
+ TransactionTransferSenderTaxIdIsNotValid = "97502"
473
+ TransactionTransferTypeIsInvalid = "97501"
424
474
  TypeIsInvalid = "91523"
425
475
  TypeIsRequired = "91524"
426
476
  UnsupportedVoiceAuthorization = "91539"
427
477
  UsBankAccountNonceMustBePlaidVerified = "915171"
428
478
  UsBankAccountNotVerified = "915172"
429
479
 
480
+
430
481
  module Options
431
482
  SubmitForSettlementIsRequiredForCloning = "91544"
432
483
  SubmitForSettlementIsRequiredForPayPalUnilateral = "91582"
@@ -598,110 +649,14 @@ module Braintree
598
649
  end
599
650
 
600
651
  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
652
 
619
653
  module ApplicantDetails
620
- AccountNumberIsInvalid = "82670"
621
- AccountNumberIsRequired = "82614"
622
- CompanyNameIsInvalid = "82631"
623
- CompanyNameIsRequiredWithTaxId = "82633"
624
- DateOfBirthIsInvalid = "82663"
625
- DateOfBirthIsRequired = "82612"
626
654
  Declined = "82626" # Keep for backwards compatibility
627
655
  DeclinedFailedKYC = "82623" # Keep for backwards compatibility
628
656
  DeclinedMasterCardMatch = "82622" # Keep for backwards compatibility
629
657
  DeclinedOFAC = "82621" # Keep for backwards compatibility
630
658
  DeclinedSsnInvalid = "82624" # Keep for backwards compatibility
631
659
  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
660
  end
706
661
  end
707
662
 
@@ -767,7 +722,6 @@ module Braintree
767
722
  AmountFormatIsInvalid = "94202"
768
723
  AmountIsTooLarge = "94207"
769
724
  AmountNotSupportedByProcessor = "94203"
770
- MerchantAccountCannotBeSubMerchantAccount = "94208"
771
725
  MerchantAccountIdIsInvalid = "94204"
772
726
  MerchantAccountIsForbidden = "94206"
773
727
  MerchantAccountIsSuspended = "94205"
@@ -12,7 +12,7 @@ module Braintree
12
12
 
13
13
  def initialize(gateway, data)
14
14
  @gateway = gateway
15
- @params = data[:params]
15
+ @params = data[:params] if data[:params]
16
16
  @credit_card_verification = CreditCardVerification._new(data[:verification]) if data[:verification]
17
17
  @merchant_account = MerchantAccount._new(gateway, data[:merchant_account]) if data[:merchant_account]
18
18
  @message = data[:message]
@@ -3,7 +3,8 @@ module Braintree
3
3
  include Enumerable
4
4
 
5
5
  def initialize(data = {})
6
- @errors = ValidationErrorCollection.new(data.merge(:errors => []))
6
+ data = data.merge(:errors => []) unless data
7
+ @errors = ValidationErrorCollection.new(data)
7
8
  end
8
9
 
9
10
  def each(&block)
@@ -26,6 +26,10 @@ module Braintree
26
26
  ApplePayGateway.new(self)
27
27
  end
28
28
 
29
+ def bank_account_instant_verification
30
+ BankAccountInstantVerificationGateway.new(self)
31
+ end
32
+
29
33
  def client_token
30
34
  ClientTokenGateway.new(self)
31
35
  end
@@ -38,6 +42,10 @@ module Braintree
38
42
  CustomerGateway.new(self)
39
43
  end
40
44
 
45
+ def customer_session
46
+ CustomerSessionGateway.new(self, graphql_client)
47
+ end
48
+
41
49
  def discount
42
50
  DiscountGateway.new(self)
43
51
  end
@@ -74,6 +82,10 @@ module Braintree
74
82
  PayPalAccountGateway.new(self)
75
83
  end
76
84
 
85
+ def paypal_payment_resource
86
+ PayPalPaymentResourceGateway.new(self)
87
+ end
88
+
77
89
  def us_bank_account
78
90
  UsBankAccountGateway.new(self)
79
91
  end
@@ -3,7 +3,10 @@ module Braintree
3
3
  include BaseModule
4
4
 
5
5
  attr_reader :bin
6
+ attr_reader :business
6
7
  attr_reader :commercial
8
+ attr_reader :consumer
9
+ attr_reader :corporate
7
10
  attr_reader :country_of_issuance
8
11
  attr_reader :created_at
9
12
  attr_reader :customer_id
@@ -18,7 +21,9 @@ module Braintree
18
21
  attr_reader :issuing_bank
19
22
  attr_reader :payroll
20
23
  attr_reader :prepaid
24
+ attr_reader :prepaid_reloadable
21
25
  attr_reader :product_id
26
+ attr_reader :purchase
22
27
  attr_reader :source_card_last_4
23
28
  attr_reader :source_card_type
24
29
  attr_reader :source_description
@@ -0,0 +1,9 @@
1
+ # Represents available types of customer recommendations that can be retrieved using a PayPal customer session.
2
+
3
+ #Experimental
4
+ # This enum is experimental and may change in future releases.
5
+ module Braintree
6
+ module Recommendations
7
+ PAYMENT_RECOMMENDATIONS = "PAYMENT_RECOMMENDATIONS"
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ # Represents available payment options related to PayPal customer session recommendations.
2
+
3
+ #Experimental
4
+ # This enum is experimental and may change in future releases.
5
+ module Braintree
6
+ module RecommendedPaymentOption
7
+ PAYPAL = "PAYPAL"
8
+ VENMO = "VENMO"
9
+ end
10
+ end
@@ -0,0 +1,44 @@
1
+ # Represents the input to request the creation of a PayPal customer session.
2
+
3
+ #Experimental
4
+ # This class is experimental and may change in future releases.
5
+ module Braintree
6
+ class CreateCustomerSessionInput
7
+ include BaseModule
8
+
9
+ attr_reader :attrs
10
+ attr_reader :merchant_account_id
11
+ attr_reader :session_id
12
+ attr_reader :customer
13
+ attr_reader :domain
14
+ attr_reader :purchase_units
15
+
16
+ def initialize(attributes)
17
+ @attrs = attributes.keys
18
+ set_instance_variables_from_hash(attributes)
19
+ @customer = attributes[:customer] ? CustomerSessionInput.new(attributes[:customer]) : nil
20
+ if attributes[:purchase_units]
21
+ @purchase_units = attributes[:purchase_units].map do |unit|
22
+ PayPalPurchaseUnitInput.new(unit)
23
+ end
24
+ end
25
+ end
26
+
27
+ def inspect
28
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
29
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
30
+ end
31
+
32
+ def to_graphql_variables
33
+ variables = {}
34
+ variables["merchantAccountId"] = merchant_account_id if merchant_account_id
35
+ variables["sessionId"] = session_id if session_id
36
+ variables["domain"] = domain if domain
37
+ variables["customer"] = customer.to_graphql_variables if customer
38
+ variables["purchaseUnits"] = purchase_units.map(&:to_graphql_variables) if purchase_units
39
+ variables
40
+ end
41
+ end
42
+ end
43
+
44
+
@@ -0,0 +1,40 @@
1
+ # Represents the input to request PayPal customer session recommendations.
2
+
3
+ #Experimental
4
+ # This class is experimental and may change in future releases.
5
+ module Braintree
6
+ class CustomerRecommendationsInput
7
+ include BaseModule
8
+
9
+ attr_reader :attrs
10
+ attr_reader :merchant_account_id
11
+ attr_reader :session_id
12
+ attr_reader :customer
13
+ attr_reader :purchase_units
14
+ attr_reader :domain
15
+
16
+ def initialize(attributes)
17
+ @attrs = attributes.keys
18
+ set_instance_variables_from_hash(attributes)
19
+ @customer = attributes[:customer] ? CustomerSessionInput.new(attributes[:customer]) : nil
20
+ @purchase_units = attributes[:purchase_units] ? attributes[:purchase_units].map { |pu| PayPalPurchaseUnitInput.new(pu) } : nil
21
+ end
22
+
23
+ def inspect
24
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
25
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
26
+ end
27
+
28
+ def to_graphql_variables
29
+ variables = {}
30
+ variables["merchantAccountId"] = merchant_account_id if merchant_account_id
31
+ variables["sessionId"] = session_id if session_id
32
+ variables["customer"] = customer.to_graphql_variables if customer
33
+ variables["domain"] = domain if domain
34
+ variables["purchaseUnits"] = purchase_units.map(&:to_graphql_variables) if purchase_units
35
+ variables
36
+ end
37
+ end
38
+ end
39
+
40
+
@@ -0,0 +1,45 @@
1
+ # Customer identifying information for a PayPal customer session.
2
+
3
+ #Experimental
4
+ # This class is experimental and may change in future releases.
5
+ module Braintree
6
+ class CustomerSessionInput
7
+ include BaseModule
8
+
9
+ attr_reader :attrs
10
+ attr_reader :email
11
+ attr_reader :hashed_email
12
+ attr_reader :phone
13
+ attr_reader :hashed_phone
14
+ attr_reader :device_fingerprint_id
15
+ attr_reader :paypal_app_installed
16
+ attr_reader :venmo_app_installed
17
+ attr_reader :user_agent
18
+
19
+ def initialize(attributes)
20
+ @attrs = attributes.keys
21
+ set_instance_variables_from_hash(attributes)
22
+ @phone = attributes[:phone] ? PhoneInput.new(attributes[:phone]) : nil
23
+ end
24
+
25
+ def inspect
26
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
27
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
28
+ end
29
+
30
+ def to_graphql_variables
31
+ variables = {}
32
+ variables["email"] = email if email
33
+ variables["hashedEmail"] = hashed_email if hashed_email
34
+ variables["phone"] = phone.to_graphql_variables if phone
35
+ variables["hashedPhone"] = hashed_phone if hashed_phone
36
+ variables["deviceFingerprintId"] = device_fingerprint_id if device_fingerprint_id
37
+ variables["paypalAppInstalled"] = paypal_app_installed if paypal_app_installed
38
+ variables["venmoAppInstalled"] = venmo_app_installed if venmo_app_installed
39
+ variables["userAgent"] = user_agent if user_agent
40
+ variables
41
+ end
42
+ end
43
+ end
44
+
45
+
@@ -0,0 +1,28 @@
1
+ #Experimental
2
+ # This class is experimental and may change in future releases.
3
+ module Braintree
4
+ class MonetaryAmountInput
5
+ include BaseModule
6
+
7
+ attr_reader :attrs
8
+ attr_reader :value
9
+ attr_reader :currency_code
10
+
11
+ def initialize(attributes)
12
+ @attrs = attributes.keys
13
+ set_instance_variables_from_hash(attributes)
14
+ end
15
+
16
+ def inspect
17
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
18
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
19
+ end
20
+
21
+ def to_graphql_variables
22
+ variables = {}
23
+ variables["value"] = value if value
24
+ variables["currencyCode"] = currency_code if currency_code
25
+ variables
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ #Experimental
2
+ # This class is experimental and may change in future releases.
3
+ module Braintree
4
+ class PayPalPayeeInput
5
+ include BaseModule
6
+
7
+ attr_reader :attrs
8
+ attr_reader :email_address
9
+ attr_reader :client_id
10
+
11
+ def initialize(attributes)
12
+ @attrs = attributes.keys
13
+ set_instance_variables_from_hash(attributes)
14
+ end
15
+
16
+ def inspect
17
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
18
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
19
+ end
20
+
21
+ def to_graphql_variables
22
+ variables = {}
23
+ variables["emailAddress"] = email_address if email_address
24
+ variables["clientId"] = client_id if client_id
25
+ variables
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,31 @@
1
+ #Experimental
2
+ # This class is experimental and may change in future releases.
3
+ module Braintree
4
+ class PayPalPurchaseUnitInput
5
+ include BaseModule
6
+
7
+ attr_reader :attrs
8
+ attr_reader :amount
9
+ attr_reader :payee
10
+
11
+ def initialize(attributes)
12
+ @attrs = attributes.keys
13
+ unless attributes[:amount]
14
+ raise ArgumentError, "Expected hash to contain a :amount"
15
+ end
16
+ set_instance_variables_from_hash(attributes)
17
+ @payee = attributes[:payee] ? PayPalPayeeInput.new(attributes[:payee]) : nil
18
+ @amount = attributes[:amount] ? MonetaryAmountInput.new(attributes[:amount]) : nil
19
+ end
20
+ def inspect
21
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
22
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
23
+ end
24
+ def to_graphql_variables
25
+ variables = {}
26
+ variables["amount"] = amount.to_graphql_variables if amount
27
+ variables["payee"] = payee.to_graphql_variables if payee
28
+ variables
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,34 @@
1
+ # Phone number input for PayPal customer session.
2
+
3
+ #Experimental
4
+ # This class is experimental and may change in future releases.
5
+ module Braintree
6
+ class PhoneInput
7
+ include BaseModule
8
+
9
+ attr_reader :attrs
10
+ attr_reader :country_phone_code
11
+ attr_reader :phone_number
12
+ attr_reader :extension_number
13
+
14
+ def initialize(attributes)
15
+ @attrs = attributes.keys
16
+ set_instance_variables_from_hash(attributes)
17
+ end
18
+
19
+ def inspect
20
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
21
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
22
+ end
23
+
24
+ def to_graphql_variables
25
+ variables = {}
26
+ variables["countryPhoneCode"] = country_phone_code if country_phone_code
27
+ variables["phoneNumber"] = phone_number if phone_number
28
+ variables["extensionNumber"] = extension_number if extension_number
29
+ variables
30
+ end
31
+ end
32
+ end
33
+
34
+
@@ -0,0 +1,42 @@
1
+ # Represents the input to request an update to a PayPal customer session.
2
+
3
+ #Experimental
4
+ # This class is experimental and may change in future releases.
5
+ module Braintree
6
+ class UpdateCustomerSessionInput
7
+ include BaseModule
8
+
9
+ attr_reader :attrs
10
+ attr_reader :merchant_account_id
11
+ attr_reader :session_id
12
+ attr_reader :customer
13
+ attr_reader :purchase_units
14
+
15
+ def initialize(attributes)
16
+ unless attributes[:session_id]
17
+ raise ArgumentError, "Expected hash to contain a :session_id"
18
+ end
19
+ @attrs = attributes.keys
20
+ set_instance_variables_from_hash(attributes)
21
+ @customer = attributes[:customer] ? CustomerSessionInput.new(attributes[:customer]) : nil
22
+ @purchase_units = attributes[:purchase_units] ? attributes[:purchase_units].map { |pu| PayPalPurchaseUnitInput.new(pu) } : nil
23
+ end
24
+
25
+ def inspect
26
+ inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
27
+ "#<#{self.class} #{inspected_attributes.join(" ")}>"
28
+ end
29
+
30
+ def to_graphql_variables
31
+ variables = {}
32
+ variables["merchantAccountId"] = merchant_account_id if merchant_account_id
33
+ variables["sessionId"] = session_id if session_id
34
+ variables["customer"] = customer.to_graphql_variables if customer
35
+ variables["purchaseUnits"] = purchase_units.map(&:to_graphql_variables) if purchase_units
36
+ variables
37
+ end
38
+
39
+ end
40
+ end
41
+
42
+