braintree 2.101.0 → 2.102.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: 4a5d32a025ec741caa8fd1de8f33b64951f8e61cf6c16dbfd32b12ec0d88d81a
4
- data.tar.gz: e7500376e7de67a7ebda3c275b22235dc298d386edec860994aa15c129807006
3
+ metadata.gz: dadf0e37290b308d07f0856ce1b98b46dd24545c7aabd504516f9a07c8d6937f
4
+ data.tar.gz: 46cd35b0d94e2a48db329c7699df7288bf5db85a47bc965847db0ddb2b1794b9
5
5
  SHA512:
6
- metadata.gz: 5f8f63a4af2e318f9ac5b9fcbd88f8e7b185e61f9f0fa4e090a75a66ce0c534a50b712af237b8d22b0741319a2764a081991be0b7d8535ab4246858dd8150600
7
- data.tar.gz: 23cc9b627afc2804750d41a64bbdae27a5ad68df550a7aaebc4c291b96dd31265569ed917cb980952a47190aee52c5d0a04192dbe5e72850eedb534a25419508
6
+ metadata.gz: c8af0480b494e769733cb03fc98813483c085fb567be2962af22dc6cae2cd162e448693047da262796b2686dd4ec0c778eef26614e93a20410660667329f7061
7
+ data.tar.gz: 4f046887ad84d29b41f09f6927ae5a7d19e0710a98ea5ce31355a74c7361805c1c0d3432e273a852862d8ccb0f5506baea60241785d4c0d105592fc988b71f67
@@ -118,6 +118,19 @@ module Braintree
118
118
  {:billing_address => billing_address_params}
119
119
  ]
120
120
 
121
+ signature << {
122
+ :three_d_secure_pass_thru => [
123
+ :eci_flag,
124
+ :cavv,
125
+ :xid,
126
+ :three_d_secure_version,
127
+ :authentication_response,
128
+ :directory_response,
129
+ :cavv_algorithm,
130
+ :ds_transaction_id,
131
+ ]
132
+ }
133
+
121
134
  case type
122
135
  when :create
123
136
  signature << :customer_id
@@ -181,6 +181,7 @@ module Braintree
181
181
  FileTypeIsInvalid = "84903"
182
182
  FileIsMalformedOrEncrypted = "84904"
183
183
  FileIsTooLong = "84905"
184
+ FileIsEmpty = "84906"
184
185
  end
185
186
 
186
187
  module PayPalAccount
@@ -767,6 +768,28 @@ module Braintree
767
768
  AccountTypeIsInvalid = "942184"
768
769
  AccountTypeNotSupported = "942185"
769
770
  end
771
+
772
+ ThreeDSecureAuthenticationIdIsInvalid = "942196"
773
+ ThreeDSecureAuthenticationIdDoesntMatchNonceThreeDSecureAuthentication = "942198"
774
+ ThreeDSecureTransactionPaymentMethodDoesntMatchThreeDSecureAuthenticationPaymentMethod = "942197"
775
+ ThreeDSecureAuthenticationIdWithThreeDSecurePassThruIsInvalid = "942199"
776
+ ThreeDSecureAuthenticationFailed = "94271"
777
+ ThreeDSecureTokenIsInvalid = "94268"
778
+ ThreeDSecureVerificationDataDoesntMatchVerify = "94270"
779
+ MerchantAccountDoesNotSupport3DSecure = "942169"
780
+ MerchantAcountDoesNotMatch3DSecureMerchantAccount = "94284"
781
+ AmountDoesNotMatch3DSecureAmount = "94285"
782
+
783
+ module ThreeDSecurePassThru
784
+ EciFlagIsRequired = "942113"
785
+ EciFlagIsInvalid = "942114"
786
+ CavvIsRequired = "942116"
787
+ ThreeDSecureVersionIsRequired = "942117"
788
+ ThreeDSecureVersionIsInvalid = "942119"
789
+ AuthenticationResponseIsInvalid = "942120"
790
+ DirectoryResponseIsInvalid = "942121"
791
+ CavvAlgorithmIsInvalid = "942122"
792
+ end
770
793
  end
771
794
 
772
795
  module UsBankAccountVerification
@@ -172,6 +172,18 @@ module Braintree
172
172
  {:options => options},
173
173
  {:billing_address => billing_address_params}
174
174
  ]
175
+ signature << {
176
+ :three_d_secure_pass_thru => [
177
+ :eci_flag,
178
+ :cavv,
179
+ :xid,
180
+ :three_d_secure_version,
181
+ :authentication_response,
182
+ :directory_response,
183
+ :cavv_algorithm,
184
+ :ds_transaction_id,
185
+ ]
186
+ }
175
187
 
176
188
  case type
177
189
  when :create
@@ -19,12 +19,14 @@ module Braintree
19
19
  attr_reader :nonce
20
20
  attr_reader :three_d_secure_info
21
21
  attr_reader :type
22
+ attr_reader :authentication_insight
22
23
 
23
24
  def initialize(gateway, attributes) # :nodoc:
24
25
  @gateway = gateway
25
26
  @nonce = attributes.fetch(:nonce)
26
27
  @type = attributes.fetch(:type)
27
28
  @details = attributes.fetch(:details)
29
+ @authentication_insight = attributes.fetch(:authentication_insight, nil)
28
30
  @three_d_secure_info = ThreeDSecureInfo.new(attributes[:three_d_secure_info]) if attributes[:three_d_secure_info]
29
31
  @bin_data = BinData.new(attributes[:bin_data]) if attributes[:bin_data]
30
32
  end
@@ -8,12 +8,23 @@ module Braintree
8
8
  @config.assert_has_access_token_or_keys
9
9
  end
10
10
 
11
- def create(payment_method_token)
12
- response = @config.http.post("#{@config.base_merchant_path}/payment_methods/#{payment_method_token}/nonces")
11
+ def create(payment_method_token, args = { payment_method_nonce: {} })
12
+ Util.verify_keys(PaymentMethodNonceGateway._create_signature, args)
13
+
14
+ response = @config.http.post("#{@config.base_merchant_path}/payment_methods/#{payment_method_token}/nonces", args)
13
15
  payment_method_nonce = PaymentMethodNonce._new(@gateway, response.fetch(:payment_method_nonce))
14
16
  SuccessfulResult.new(:payment_method_nonce => payment_method_nonce)
15
17
  end
16
18
 
19
+ def self._create_signature
20
+ [ {
21
+ :payment_method_nonce=> [
22
+ :merchant_account_id, :authentication_insight,
23
+ {:authentication_insight_options => [:amount, :recurring_customer_consent, :recurring_max_amount]}
24
+ ]
25
+ }]
26
+ end
27
+
17
28
  def create!(*args)
18
29
  return_object_or_raise(:payment_method_nonce) { create(*args) }
19
30
  end
@@ -0,0 +1,21 @@
1
+ module Braintree
2
+ module Test
3
+ module AuthenticationId
4
+ ThreeDSecureVisaFullAuthentication = "fake-three-d-secure-visa-full-authentication-id"
5
+ ThreeDSecureVisaLookupTimeout = "fake-three-d-secure-visa-lookup-timeout-id"
6
+ ThreeDSecureVisaFailedSignature = "fake-three-d-secure-visa-failed-signature-id"
7
+ ThreeDSecureVisaFailedAuthentication = "fake-three-d-secure-visa-failed-authentication-id"
8
+ ThreeDSecureVisaAttemptsNonParticipating = "fake-three-d-secure-visa-attempts-non-participating-id"
9
+ ThreeDSecureVisaNoteEnrolled = "fake-three-d-secure-visa-not-enrolled-id"
10
+ ThreeDSecureVisaUnavailable = "fake-three-d-secure-visa-unavailable-id"
11
+ ThreeDSecureVisaMPILookupError = "fake-three-d-secure-visa-mpi-lookup-error-id"
12
+ ThreeDSecureVisaMPIAuthenticateError = "fake-three-d-secure-visa-mpi-authenticate-error-id"
13
+ ThreeDSecureVisaAuthenticationUnavailable = "fake-three-d-secure-visa-authentication-unavailable-id"
14
+ ThreeDSecureVisaBypassedAuthentication = "fake-three-d-secure-visa-bypassed-authentication-id"
15
+ ThreeDSecureTwoVisaSuccessfulFrictionlessAuthentication = "fake-three-d-secure-two-visa-successful-frictionless-authentication-id"
16
+ ThreeDSecureTwoVisaSuccessfulStepUpAuthentication = "fake-three-d-secure-two-visa-successful-step-up-authentication-id"
17
+ ThreeDSecureTwoVisaErrorOnLookup = "fake-three-d-secure-two-visa-error-on-lookup-id"
18
+ ThreeDSecureTwoVisaTimeoutOnLookup = "fake-three-d-secure-two-visa-timeout-on-lookup-id"
19
+ end
20
+ end
21
+ end
@@ -21,6 +21,20 @@ module Braintree
21
21
  VenmoAccount = "fake-venmo-account-nonce"
22
22
  VenmoAccountTokenIssuanceError = "fake-token-issuance-error-venmo-account-nonce"
23
23
  ThreeDSecureVisaFullAuthentication = "fake-three-d-secure-visa-full-authentication-nonce"
24
+ ThreeDSecureVisaLookupTimeout = "fake-three-d-secure-visa-lookup-timeout-nonce"
25
+ ThreeDSecureVisaFailedSignature = "fake-three-d-secure-visa-failed-signature-nonce"
26
+ ThreeDSecureVisaFailedAuthentication = "fake-three-d-secure-visa-failed-authentication-nonce"
27
+ ThreeDSecureVisaAttemptsNonParticipating = "fake-three-d-secure-visa-attempts-non-participating-nonce"
28
+ ThreeDSecureVisaNoteEnrolled = "fake-three-d-secure-visa-not-enrolled-nonce"
29
+ ThreeDSecureVisaUnavailable = "fake-three-d-secure-visa-unavailable-nonce"
30
+ ThreeDSecureVisaMPILookupError = "fake-three-d-secure-visa-mpi-lookup-error-nonce"
31
+ ThreeDSecureVisaMPIAuthenticateError = "fake-three-d-secure-visa-mpi-authenticate-error-nonce"
32
+ ThreeDSecureVisaAuthenticationUnavailable = "fake-three-d-secure-visa-authentication-unavailable-nonce"
33
+ ThreeDSecureVisaBypassedAuthentication = "fake-three-d-secure-visa-bypassed-authentication-nonce"
34
+ ThreeDSecureTwoVisaSuccessfulFrictionlessAuthentication = "fake-three-d-secure-two-visa-successful-frictionless-authentication-nonce"
35
+ ThreeDSecureTwoVisaSuccessfulStepUpAuthentication = "fake-three-d-secure-two-visa-successful-step-up-authentication-nonce"
36
+ ThreeDSecureTwoVisaErrorOnLookup = "fake-three-d-secure-two-visa-error-on-lookup-nonce"
37
+ ThreeDSecureTwoVisaTimeoutOnLookup = "fake-three-d-secure-two-visa-timeout-on-lookup-nonce"
24
38
  TransactableVisa = "fake-valid-visa-nonce"
25
39
  TransactableAmEx = "fake-valid-amex-nonce"
26
40
  TransactableMasterCard = "fake-valid-mastercard-nonce"
@@ -166,6 +166,7 @@ module Braintree
166
166
  attr_reader :venmo_account_details
167
167
  attr_reader :visa_checkout_card_details
168
168
  attr_reader :voice_referral_number
169
+ attr_reader :retrieval_reference_number
169
170
 
170
171
  def self.create(*args)
171
172
  Configuration.gateway.transaction.create(*args)
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 2
4
- Minor = 101
4
+ Minor = 102
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
@@ -13,6 +13,9 @@ module Braintree
13
13
  DisputeOpened = "dispute_opened"
14
14
  DisputeLost = "dispute_lost"
15
15
  DisputeWon = "dispute_won"
16
+ DisputeAccepted = "dispute_accepted"
17
+ DisputeDisputed = "dispute_disputed"
18
+ DisputeExpired = "dispute_expired"
16
19
 
17
20
  SubscriptionCanceled = "subscription_canceled"
18
21
  SubscriptionChargedSuccessfully = "subscription_charged_successfully"
@@ -40,6 +40,12 @@ module Braintree
40
40
  _dispute_lost_sample_xml(id)
41
41
  when Braintree::WebhookNotification::Kind::DisputeWon
42
42
  _dispute_won_sample_xml(id)
43
+ when Braintree::WebhookNotification::Kind::DisputeAccepted
44
+ _dispute_accepted_sample_xml(id)
45
+ when Braintree::WebhookNotification::Kind::DisputeDisputed
46
+ _dispute_disputed_sample_xml(id)
47
+ when Braintree::WebhookNotification::Kind::DisputeExpired
48
+ _dispute_expired_sample_xml(id)
43
49
  when Braintree::WebhookNotification::Kind::PartnerMerchantConnected
44
50
  _partner_merchant_connected_sample_xml(id)
45
51
  when Braintree::WebhookNotification::Kind::PartnerMerchantDisconnected
@@ -309,6 +315,30 @@ module Braintree
309
315
  end
310
316
  end
311
317
 
318
+ def _dispute_accepted_sample_xml(id)
319
+ if id == "legacy_dispute_id"
320
+ _old_dispute_accepted_sample_xml(id)
321
+ else
322
+ _new_dispute_accepted_sample_xml(id)
323
+ end
324
+ end
325
+
326
+ def _dispute_disputed_sample_xml(id)
327
+ if id == "legacy_dispute_id"
328
+ _old_dispute_disputed_sample_xml(id)
329
+ else
330
+ _new_dispute_disputed_sample_xml(id)
331
+ end
332
+ end
333
+
334
+ def _dispute_expired_sample_xml(id)
335
+ if id == "legacy_dispute_id"
336
+ _old_dispute_expired_sample_xml(id)
337
+ else
338
+ _new_dispute_expired_sample_xml(id)
339
+ end
340
+ end
341
+
312
342
  def _old_dispute_opened_sample_xml(id)
313
343
  <<-XML
314
344
  <dispute>
@@ -370,6 +400,66 @@ module Braintree
370
400
  XML
371
401
  end
372
402
 
403
+ def _old_dispute_accepted_sample_xml(id)
404
+ <<-XML
405
+ <dispute>
406
+ <amount>100.00</amount>
407
+ <currency-iso-code>USD</currency-iso-code>
408
+ <received-date type="date">2014-03-01</received-date>
409
+ <reply-by-date type="date">2014-03-21</reply-by-date>
410
+ <kind>chargeback</kind>
411
+ <status>accepted</status>
412
+ <reason>fraud</reason>
413
+ <id>#{id}</id>
414
+ <transaction>
415
+ <id>#{id}</id>
416
+ <amount>100.00</amount>
417
+ </transaction>
418
+ <date-opened type=\"date\">2014-03-21</date-opened>
419
+ </dispute>
420
+ XML
421
+ end
422
+
423
+ def _old_dispute_disputed_sample_xml(id)
424
+ <<-XML
425
+ <dispute>
426
+ <amount>100.00</amount>
427
+ <currency-iso-code>USD</currency-iso-code>
428
+ <received-date type="date">2014-03-01</received-date>
429
+ <reply-by-date type="date">2014-03-21</reply-by-date>
430
+ <kind>chargeback</kind>
431
+ <status>disputed</status>
432
+ <reason>fraud</reason>
433
+ <id>#{id}</id>
434
+ <transaction>
435
+ <id>#{id}</id>
436
+ <amount>100.00</amount>
437
+ </transaction>
438
+ <date-opened type=\"date\">2014-03-21</date-opened>
439
+ </dispute>
440
+ XML
441
+ end
442
+
443
+ def _old_dispute_expired_sample_xml(id)
444
+ <<-XML
445
+ <dispute>
446
+ <amount>100.00</amount>
447
+ <currency-iso-code>USD</currency-iso-code>
448
+ <received-date type="date">2014-03-01</received-date>
449
+ <reply-by-date type="date">2014-03-21</reply-by-date>
450
+ <kind>chargeback</kind>
451
+ <status>expired</status>
452
+ <reason>fraud</reason>
453
+ <id>#{id}</id>
454
+ <transaction>
455
+ <id>#{id}</id>
456
+ <amount>100.00</amount>
457
+ </transaction>
458
+ <date-opened type=\"date\">2014-03-21</date-opened>
459
+ </dispute>
460
+ XML
461
+ end
462
+
373
463
  def _new_dispute_opened_sample_xml(id)
374
464
  <<-XML
375
465
  <dispute>
@@ -535,6 +625,159 @@ module Braintree
535
625
  XML
536
626
  end
537
627
 
628
+ def _new_dispute_accepted_sample_xml(id)
629
+ <<-XML
630
+ <dispute>
631
+ <id>#{id}</id>
632
+ <amount>100.00</amount>
633
+ <amount-disputed>100.00</amount-disputed>
634
+ <amount-won>95.00</amount-won>
635
+ <case-number>CASE-12345</case-number>
636
+ <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
637
+ <currency-iso-code>USD</currency-iso-code>
638
+ <forwarded-comments nil="true"/>
639
+ <kind>chargeback</kind>
640
+ <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
641
+ <reason>fraud</reason>
642
+ <reason-code nil="true"/>
643
+ <reason-description nil="true"/>
644
+ <received-date type="date">2016-02-15</received-date>
645
+ <reference-number>REF-9876</reference-number>
646
+ <reply-by-date type="date">2016-02-22</reply-by-date>
647
+ <status>accepted</status>
648
+ <updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
649
+ <original-dispute-id>9qde5qgp</original-dispute-id>
650
+ <status-history type="array">
651
+ <status-history>
652
+ <status>open</status>
653
+ <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
654
+ </status-history>
655
+ <status-history>
656
+ <status>accepted</status>
657
+ <timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
658
+ </status-history>
659
+ </status-history>
660
+ <evidence type="array"/>
661
+ <transaction>
662
+ <id>#{id}</id>
663
+ <amount>100.00</amount>
664
+ <created-at>2017-06-21T20:44:41Z</created-at>
665
+ <order-id nil="true"/>
666
+ <purchase-order-number nil="true"/>
667
+ <payment-instrument-subtype>Visa</payment-instrument-subtype>
668
+ </transaction>
669
+ <date-opened type=\"date\">2014-03-21</date-opened>
670
+ </dispute>
671
+ XML
672
+ end
673
+
674
+ def _new_dispute_disputed_sample_xml(id)
675
+ <<-XML
676
+ <dispute>
677
+ <id>#{id}</id>
678
+ <amount>100.00</amount>
679
+ <amount-disputed>100.00</amount-disputed>
680
+ <amount-won>95.00</amount-won>
681
+ <case-number>CASE-12345</case-number>
682
+ <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
683
+ <currency-iso-code>USD</currency-iso-code>
684
+ <forwarded-comments nil="true"/>
685
+ <kind>chargeback</kind>
686
+ <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
687
+ <reason>fraud</reason>
688
+ <reason-code nil="true"/>
689
+ <reason-description nil="true"/>
690
+ <received-date type="date">2016-02-15</received-date>
691
+ <reference-number>REF-9876</reference-number>
692
+ <reply-by-date type="date">2016-02-22</reply-by-date>
693
+ <status>disputed</status>
694
+ <updated-at type="datetime">2017-06-21T20:44:41Z</updated-at>
695
+ <original-dispute-id>9qde5qgp</original-dispute-id>
696
+ <status-history type="array">
697
+ <status-history>
698
+ <status>open</status>
699
+ <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
700
+ </status-history>
701
+ <status-history>
702
+ <status>disputed</status>
703
+ <timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
704
+ </status-history>
705
+ </status-history>
706
+ <evidence type="array">
707
+ <evidence>
708
+ <id>rxtngk9j5j93tsrq</id>
709
+ <comments nil="true"/>
710
+ <created-at type="datetime">2017-06-21T20:44:42Z</created-at>
711
+ <sent-to-processor-at nil="true"/>
712
+ <url>s3.amazonaws.com/foo.jpg</url>
713
+ </evidence>
714
+ <evidence>
715
+ <id>88cfb8dd</id>
716
+ <comments>text evidence</comments>
717
+ <created-at type="datetime">2017-06-21T20:44:42Z</created-at>
718
+ <sent-to-processor-at nil="true"/>
719
+ <url nil="true"/>
720
+ </evidence>
721
+ </evidence>
722
+ <transaction>
723
+ <id>#{id}</id>
724
+ <amount>100.00</amount>
725
+ <created-at>2017-06-21T20:44:41Z</created-at>
726
+ <order-id nil="true"/>
727
+ <purchase-order-number nil="true"/>
728
+ <payment-instrument-subtype>Visa</payment-instrument-subtype>
729
+ </transaction>
730
+ <date-opened type=\"date\">2014-03-21</date-opened>
731
+ </dispute>
732
+ XML
733
+ end
734
+
735
+ def _new_dispute_expired_sample_xml(id)
736
+ <<-XML
737
+ <dispute>
738
+ <id>#{id}</id>
739
+ <amount>100.00</amount>
740
+ <amount-disputed>100.00</amount-disputed>
741
+ <amount-won>95.00</amount-won>
742
+ <case-number>CASE-12345</case-number>
743
+ <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
744
+ <currency-iso-code>USD</currency-iso-code>
745
+ <forwarded-comments nil="true"/>
746
+ <kind>chargeback</kind>
747
+ <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
748
+ <reason>fraud</reason>
749
+ <reason-code nil="true"/>
750
+ <reason-description nil="true"/>
751
+ <received-date type="date">2016-02-15</received-date>
752
+ <reference-number>REF-9876</reference-number>
753
+ <reply-by-date type="date">2016-02-22</reply-by-date>
754
+ <status>expired</status>
755
+ <updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
756
+ <original-dispute-id>9qde5qgp</original-dispute-id>
757
+ <status-history type="array">
758
+ <status-history>
759
+ <status>open</status>
760
+ <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
761
+ </status-history>
762
+ <status-history>
763
+ <status>expired</status>
764
+ <timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
765
+ </status-history>
766
+ </status-history>
767
+ <evidence type="array"/>
768
+ <transaction>
769
+ <id>#{id}</id>
770
+ <amount>100.00</amount>
771
+ <created-at>2017-06-21T20:44:41Z</created-at>
772
+ <order-id nil="true"/>
773
+ <purchase-order-number nil="true"/>
774
+ <payment-instrument-subtype>Visa</payment-instrument-subtype>
775
+ </transaction>
776
+ <date-opened type=\"date\">2014-03-21</date-opened>
777
+ </dispute>
778
+ XML
779
+ end
780
+
538
781
  def _disbursement_exception_sample_xml(id)
539
782
 
540
783
  <<-XML