braintree 4.0.0 → 4.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/braintree.gemspec +1 -0
- data/lib/braintree.rb +2 -0
- data/lib/braintree/apple_pay_card.rb +9 -0
- data/lib/braintree/credit_card_gateway.rb +11 -1
- data/lib/braintree/error_codes.rb +4 -2
- data/lib/braintree/google_pay_card.rb +9 -0
- data/lib/braintree/http.rb +1 -0
- data/lib/braintree/local_payment_expired.rb +21 -0
- data/lib/braintree/local_payment_funded.rb +22 -0
- data/lib/braintree/payment_method_gateway.rb +7 -2
- data/lib/braintree/payment_method_nonce.rb +6 -3
- data/lib/braintree/transaction/paypal_details.rb +2 -0
- data/lib/braintree/transaction_gateway.rb +3 -3
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/webhook_notification.rb +8 -1
- data/lib/braintree/webhook_testing_gateway.rb +51 -2
- data/spec/integration/braintree/credit_card_spec.rb +89 -0
- data/spec/integration/braintree/customer_spec.rb +117 -0
- data/spec/integration/braintree/merchant_account_spec.rb +3 -3
- data/spec/integration/braintree/payment_method_nonce_spec.rb +2 -0
- data/spec/integration/braintree/payment_method_spec.rb +131 -0
- data/spec/integration/braintree/transaction_spec.rb +82 -2
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/braintree/credit_card_spec.rb +6 -6
- data/spec/unit/braintree/customer_spec.rb +8 -7
- data/spec/unit/braintree/http_spec.rb +2 -0
- data/spec/unit/braintree/local_payment_expired_spec.rb +24 -0
- data/spec/unit/braintree/local_payment_funded_spec.rb +34 -0
- data/spec/unit/braintree/payment_method_nonce_spec.rb +40 -0
- data/spec/unit/braintree/transaction/paypal_details_spec.rb +4 -0
- data/spec/unit/braintree/transaction_spec.rb +3 -3
- data/spec/unit/braintree/webhook_notification_spec.rb +50 -1
- metadata +22 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7279d06aef254f1954bf7b8801e4717aa258f7413f05f1c076fbb6f1e2258c5
|
4
|
+
data.tar.gz: 9b136fbc93fa3f251972a44b0728244f746ef1868507cb40385780cd2137ff22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d611127df5091cb248b434285a2cd2c5080749515d60beba2a00af28809106dca11a4b5607f8774ac111d8115e5bbc85965817ba8fb45e309bbb2ecb8b8e4382
|
7
|
+
data.tar.gz: c7f547f0a2b62aa36b94e2f410e3375d1b4a2d3d7e76c570f3c9d387c15299a8ed858237db461de7f1889b5552e4c85dd1cedd42ce741c2360eeb38b71ef87c3
|
data/braintree.gemspec
CHANGED
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.homepage = "https://www.braintreepayments.com/"
|
13
13
|
s.files = Dir.glob ["README.rdoc", "LICENSE", "lib/**/*.{rb,crt}", "spec/**/*", "*.gemspec"]
|
14
14
|
s.add_dependency "builder", ">= 3.2.4"
|
15
|
+
s.add_dependency "rexml", ">= 3.1.9" # Use rexml version associated with minimum supported Ruby version
|
15
16
|
s.required_ruby_version = ">=2.6.0"
|
16
17
|
s.metadata = {
|
17
18
|
"bug_tracker_uri" => "https://github.com/braintree/braintree_ruby/issues",
|
data/lib/braintree.rb
CHANGED
@@ -73,6 +73,8 @@ require "braintree/graphql_client"
|
|
73
73
|
require "braintree/google_pay_card"
|
74
74
|
require "braintree/local_payment_completed"
|
75
75
|
require "braintree/local_payment_reversed"
|
76
|
+
require "braintree/local_payment_expired"
|
77
|
+
require "braintree/local_payment_funded"
|
76
78
|
require "braintree/transaction/local_payment_details"
|
77
79
|
require "braintree/merchant"
|
78
80
|
require "braintree/merchant_gateway"
|
@@ -12,15 +12,24 @@ module Braintree
|
|
12
12
|
|
13
13
|
attr_reader :bin
|
14
14
|
attr_reader :card_type
|
15
|
+
attr_reader :commercial
|
16
|
+
attr_reader :country_of_issuance
|
15
17
|
attr_reader :created_at
|
16
18
|
attr_reader :customer_id
|
19
|
+
attr_reader :debit
|
17
20
|
attr_reader :default
|
21
|
+
attr_reader :durbin_regulated
|
18
22
|
attr_reader :expiration_month
|
19
23
|
attr_reader :expiration_year
|
20
24
|
attr_reader :expired
|
25
|
+
attr_reader :healthcare
|
21
26
|
attr_reader :image_url
|
27
|
+
attr_reader :issuing_bank
|
22
28
|
attr_reader :last_4
|
23
29
|
attr_reader :payment_instrument_name
|
30
|
+
attr_reader :payroll
|
31
|
+
attr_reader :prepaid
|
32
|
+
attr_reader :product_id
|
24
33
|
attr_reader :source_description
|
25
34
|
attr_reader :subscriptions
|
26
35
|
attr_reader :token
|
@@ -79,7 +79,17 @@ module Braintree
|
|
79
79
|
|
80
80
|
def self._signature(type) # :nodoc:
|
81
81
|
billing_address_params = AddressGateway._shared_signature
|
82
|
-
options = [
|
82
|
+
options = [
|
83
|
+
:fail_on_duplicate_payment_method,
|
84
|
+
:make_default,
|
85
|
+
:skip_advanced_fraud_checking,
|
86
|
+
:venmo_sdk_session,
|
87
|
+
:verification_account_type,
|
88
|
+
:verification_amount,
|
89
|
+
:verification_currency_iso_code,
|
90
|
+
:verification_merchant_account_id,
|
91
|
+
:verify_card
|
92
|
+
]
|
83
93
|
signature = [
|
84
94
|
:billing_address_id, :cardholder_name, :cvv, :expiration_date, :expiration_month,
|
85
95
|
:expiration_year, :number, :token, :venmo_sdk_payment_method_code, :device_data,
|
@@ -312,6 +312,7 @@ module Braintree
|
|
312
312
|
DiscountAmountCannotBeNegative = "915160"
|
313
313
|
DiscountAmountFormatIsInvalid = "915159"
|
314
314
|
DiscountAmountIsTooLarge = "915161"
|
315
|
+
ExchangeRateQuoteIdTooLong = "915229"
|
315
316
|
FailedAuthAdjustmentAllowRetry = "95603"
|
316
317
|
FailedAuthAdjustmentHardDecline = "95602"
|
317
318
|
FinalAuthSubmitForSettlementForDifferentAmount = "95601"
|
@@ -385,6 +386,7 @@ module Braintree
|
|
385
386
|
SubscriptionStatusMustBePastDue = "91531"
|
386
387
|
TaxAmountCannotBeNegative = "81534"
|
387
388
|
TaxAmountFormatIsInvalid = "81535"
|
389
|
+
TaxAmountIsRequiredForAibSwedish = "815224"
|
388
390
|
TaxAmountIsTooLarge = "81536"
|
389
391
|
ThreeDSecureAuthenticationFailed = "81571"
|
390
392
|
ThreeDSecureAuthenticationIdDoesntMatchNonceThreeDSecureAuthentication = "915198"
|
@@ -703,13 +705,13 @@ module Braintree
|
|
703
705
|
end
|
704
706
|
|
705
707
|
module PaymentMethod
|
706
|
-
CannotForwardPaymentMethodType = "
|
708
|
+
CannotForwardPaymentMethodType = "93106"
|
707
709
|
CustomerIdIsInvalid = "93105"
|
708
710
|
CustomerIdIsRequired = "93104"
|
709
711
|
NonceIsInvalid = "93102"
|
710
712
|
NonceIsRequired = "93103"
|
711
713
|
PaymentMethodNoLongerSupported = "93117"
|
712
|
-
PaymentMethodNonceConsumed = "
|
714
|
+
PaymentMethodNonceConsumed = "93107"
|
713
715
|
PaymentMethodNonceLocked = "93109"
|
714
716
|
PaymentMethodNonceUnknown = "93108"
|
715
717
|
PaymentMethodParamsAreRequired = "93101"
|
@@ -3,13 +3,22 @@ module Braintree
|
|
3
3
|
include BaseModule # :nodoc:
|
4
4
|
|
5
5
|
attr_reader :bin
|
6
|
+
attr_reader :commercial
|
7
|
+
attr_reader :country_of_issuance
|
6
8
|
attr_reader :created_at
|
7
9
|
attr_reader :customer_id
|
10
|
+
attr_reader :debit
|
8
11
|
attr_reader :default
|
12
|
+
attr_reader :durbin_regulated
|
9
13
|
attr_reader :expiration_month
|
10
14
|
attr_reader :expiration_year
|
11
15
|
attr_reader :google_transaction_id
|
16
|
+
attr_reader :healthcare
|
12
17
|
attr_reader :image_url
|
18
|
+
attr_reader :issuing_bank
|
19
|
+
attr_reader :payroll
|
20
|
+
attr_reader :prepaid
|
21
|
+
attr_reader :product_id
|
13
22
|
attr_reader :source_card_last_4
|
14
23
|
attr_reader :source_card_type
|
15
24
|
attr_reader :source_description
|
data/lib/braintree/http.rb
CHANGED
@@ -188,6 +188,7 @@ module Braintree
|
|
188
188
|
formatted_xml = input_xml.gsub(/^/, "[Braintree] ")
|
189
189
|
formatted_xml = formatted_xml.gsub(/<number>(.{6}).+?(.{4})<\/number>/m, '<number>\1******\2</number>')
|
190
190
|
formatted_xml = formatted_xml.gsub(/<cvv>.+?<\/cvv>/m, "<cvv>***</cvv>")
|
191
|
+
formatted_xml = formatted_xml.gsub(/<encrypted-card-data>.+?<\/encrypted-card-data>/m, "<encrypted-card-data>***</encrypted-card-data>")
|
191
192
|
formatted_xml
|
192
193
|
end
|
193
194
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Braintree
|
2
|
+
class LocalPaymentExpired
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :payment_id
|
6
|
+
attr_reader :payment_context_id
|
7
|
+
|
8
|
+
def initialize(attributes) # :nodoc:
|
9
|
+
set_instance_variables_from_hash(attributes)
|
10
|
+
end
|
11
|
+
|
12
|
+
class << self
|
13
|
+
protected :new
|
14
|
+
end
|
15
|
+
|
16
|
+
def self._new(*args) # :nodoc:
|
17
|
+
self.new(*args)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Braintree
|
2
|
+
class LocalPaymentFunded
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :payment_id
|
6
|
+
attr_reader :payment_context_id
|
7
|
+
attr_reader :transaction
|
8
|
+
|
9
|
+
def initialize(attributes) # :nodoc:
|
10
|
+
set_instance_variables_from_hash(attributes)
|
11
|
+
@transaction = Transaction._new(Configuration.gateway, transaction)
|
12
|
+
end
|
13
|
+
|
14
|
+
class << self
|
15
|
+
protected :new
|
16
|
+
end
|
17
|
+
|
18
|
+
def self._new(*args) # :nodoc:
|
19
|
+
self.new(*args)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -148,10 +148,15 @@ module Braintree
|
|
148
148
|
billing_address_params = AddressGateway._shared_signature
|
149
149
|
paypal_options_shipping_signature = AddressGateway._shared_signature
|
150
150
|
options = [
|
151
|
-
:make_default,
|
152
|
-
:
|
151
|
+
:make_default,
|
152
|
+
:skip_advanced_fraud_checking,
|
153
|
+
:us_bank_account_verification_method,
|
154
|
+
:venmo_sdk_session,
|
153
155
|
:verification_account_type,
|
156
|
+
:verification_amount,
|
154
157
|
:verification_currency_iso_code,
|
158
|
+
:verification_merchant_account_id,
|
159
|
+
:verify_card,
|
155
160
|
:paypal => [
|
156
161
|
:payee_email,
|
157
162
|
:order_id,
|
@@ -15,6 +15,7 @@ module Braintree
|
|
15
15
|
end
|
16
16
|
|
17
17
|
attr_reader :bin_data
|
18
|
+
attr_reader :default
|
18
19
|
attr_reader :details
|
19
20
|
attr_reader :nonce
|
20
21
|
attr_reader :three_d_secure_info
|
@@ -23,14 +24,16 @@ module Braintree
|
|
23
24
|
|
24
25
|
def initialize(gateway, attributes) # :nodoc:
|
25
26
|
@gateway = gateway
|
26
|
-
|
27
|
-
@type = attributes.fetch(:type)
|
27
|
+
set_instance_variables_from_hash(attributes)
|
28
28
|
@details = PaymentMethodNonceDetails.new(attributes[:details]) if attributes[:details]
|
29
|
-
@authentication_insight = attributes.fetch(:authentication_insight, nil)
|
30
29
|
@three_d_secure_info = ThreeDSecureInfo.new(attributes[:three_d_secure_info]) if attributes[:three_d_secure_info]
|
31
30
|
@bin_data = BinData.new(attributes[:bin_data]) if attributes[:bin_data]
|
32
31
|
end
|
33
32
|
|
33
|
+
def default?
|
34
|
+
@default
|
35
|
+
end
|
36
|
+
|
34
37
|
def to_s # :nodoc:
|
35
38
|
nonce
|
36
39
|
end
|
@@ -24,6 +24,8 @@ module Braintree
|
|
24
24
|
attr_reader :refund_from_transaction_fee_currency_iso_code
|
25
25
|
attr_reader :refund_id
|
26
26
|
attr_reader :seller_protection_status
|
27
|
+
attr_reader :tax_id
|
28
|
+
attr_reader :tax_id_type
|
27
29
|
attr_reader :token
|
28
30
|
attr_reader :transaction_fee_amount
|
29
31
|
attr_reader :transaction_fee_currency_iso_code
|
@@ -61,7 +61,7 @@ module Braintree
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def find(id)
|
64
|
-
raise ArgumentError if id.nil? || id.strip.to_s == ""
|
64
|
+
raise ArgumentError, "id can not be empty" if id.nil? || id.strip.to_s == ""
|
65
65
|
response = @config.http.get("#{@config.base_merchant_path}/transactions/#{id}")
|
66
66
|
Transaction._new(@gateway, response[:transaction])
|
67
67
|
rescue NotFoundError
|
@@ -192,10 +192,10 @@ module Braintree
|
|
192
192
|
:shared_shipping_address_id, :shipping_address_id, :shipping_amount,
|
193
193
|
:ships_from_postal_code, :tax_amount, :tax_exempt, :three_d_secure_authentication_id,
|
194
194
|
:three_d_secure_token, :transaction_source, :type, :venmo_sdk_payment_method_code,
|
195
|
-
:sca_exemption, :currency_iso_code,
|
195
|
+
:sca_exemption, :currency_iso_code, :exchange_rate_quote_id,
|
196
196
|
{:line_items => [:quantity, :name, :description, :kind, :unit_amount, :unit_tax_amount, :total_amount, :discount_amount, :tax_amount, :unit_of_measure, :product_code, :commodity_code, :url]},
|
197
197
|
{:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]},
|
198
|
-
{:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number]},
|
198
|
+
{:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number, {:payment_reader_card_details => [:encrypted_card_data, :key_serial_number]}]},
|
199
199
|
{:customer => [:id, :company, :email, :fax, :first_name, :last_name, :phone, :website]},
|
200
200
|
{
|
201
201
|
:billing => AddressGateway._shared_signature
|
data/lib/braintree/version.rb
CHANGED
@@ -25,8 +25,11 @@ module Braintree
|
|
25
25
|
GrantedPaymentInstrumentRevoked = "granted_payment_instrument_revoked"
|
26
26
|
|
27
27
|
GrantorUpdatedGrantedPaymentMethod = "grantor_updated_granted_payment_method"
|
28
|
+
GrantedPaymentMethodRevoked = "granted_payment_method_revoked"
|
28
29
|
|
29
30
|
LocalPaymentCompleted = "local_payment_completed"
|
31
|
+
LocalPaymentExpired = "local_payment_expired"
|
32
|
+
LocalPaymentFunded = "local_payment_funded"
|
30
33
|
LocalPaymentReversed = "local_payment_reversed"
|
31
34
|
|
32
35
|
OAuthAccessRevoked = "oauth_access_revoked"
|
@@ -64,6 +67,8 @@ module Braintree
|
|
64
67
|
attr_reader :revoked_payment_method_metadata
|
65
68
|
attr_reader :kind
|
66
69
|
attr_reader :local_payment_completed
|
70
|
+
attr_reader :local_payment_expired
|
71
|
+
attr_reader :local_payment_funded
|
67
72
|
attr_reader :local_payment_reversed
|
68
73
|
attr_reader :oauth_access_revocation
|
69
74
|
attr_reader :partner_merchant
|
@@ -95,8 +100,10 @@ module Braintree
|
|
95
100
|
@connected_merchant_status_transitioned = ConnectedMerchantStatusTransitioned._new(@subject[:connected_merchant_status_transitioned]) if @subject.has_key?(:connected_merchant_status_transitioned)
|
96
101
|
@connected_merchant_paypal_status_changed = ConnectedMerchantPayPalStatusChanged._new(@subject[:connected_merchant_paypal_status_changed]) if @subject.has_key?(:connected_merchant_paypal_status_changed)
|
97
102
|
@granted_payment_instrument_update = GrantedPaymentInstrumentUpdate._new(@subject[:granted_payment_instrument_update]) if @subject.has_key?(:granted_payment_instrument_update)
|
98
|
-
@revoked_payment_method_metadata = RevokedPaymentMethodMetadata._new(gateway, @subject) if [Kind::GrantedPaymentInstrumentRevoked, Kind::PaymentMethodRevokedByCustomer].include?(@kind)
|
103
|
+
@revoked_payment_method_metadata = RevokedPaymentMethodMetadata._new(gateway, @subject) if [Kind::GrantedPaymentInstrumentRevoked, Kind::PaymentMethodRevokedByCustomer, Kind::GrantedPaymentMethodRevoked].include?(@kind)
|
99
104
|
@local_payment_completed = LocalPaymentCompleted._new(@subject[:local_payment]) if @subject.has_key?(:local_payment) && Kind::LocalPaymentCompleted == @kind
|
105
|
+
@local_payment_expired = LocalPaymentExpired._new(@subject[:local_payment_expired]) if @subject.has_key?(:local_payment_expired) && Kind::LocalPaymentExpired == @kind
|
106
|
+
@local_payment_funded = LocalPaymentFunded._new(@subject[:local_payment_funded]) if @subject.has_key?(:local_payment_funded) && Kind::LocalPaymentFunded == @kind
|
100
107
|
@local_payment_reversed = LocalPaymentReversed._new(@subject[:local_payment_reversed]) if @subject.has_key?(:local_payment_reversed) && Kind::LocalPaymentReversed == @kind
|
101
108
|
end
|
102
109
|
|
@@ -82,12 +82,18 @@ module Braintree
|
|
82
82
|
_granted_payment_instrument_update_sample_xml(id)
|
83
83
|
when Braintree::WebhookNotification::Kind::RecipientUpdatedGrantedPaymentMethod
|
84
84
|
_granted_payment_instrument_update_sample_xml(id)
|
85
|
+
when Braintree::WebhookNotification::Kind::GrantedPaymentMethodRevoked
|
86
|
+
_granted_payment_method_revoked_xml(id)
|
85
87
|
when Braintree::WebhookNotification::Kind::PaymentMethodRevokedByCustomer
|
86
88
|
_payment_method_revoked_by_customer_sample_xml(id)
|
87
89
|
when Braintree::WebhookNotification::Kind::LocalPaymentCompleted
|
88
90
|
_local_payment_completed_sample_xml(id)
|
91
|
+
when Braintree::WebhookNotification::Kind::LocalPaymentExpired
|
92
|
+
_local_payment_expired_sample_xml
|
93
|
+
when Braintree::WebhookNotification::Kind::LocalPaymentFunded
|
94
|
+
_local_payment_funded_sample_xml(id)
|
89
95
|
when Braintree::WebhookNotification::Kind::LocalPaymentReversed
|
90
|
-
_local_payment_reversed_sample_xml
|
96
|
+
_local_payment_reversed_sample_xml
|
91
97
|
else
|
92
98
|
_subscription_sample_xml(id)
|
93
99
|
end
|
@@ -877,6 +883,24 @@ module Braintree
|
|
877
883
|
XML
|
878
884
|
end
|
879
885
|
|
886
|
+
def _granted_payment_method_revoked_xml(id)
|
887
|
+
<<-XML
|
888
|
+
<venmo-account>
|
889
|
+
<created-at type='dateTime'>2018-10-11T21:28:37Z</created-at>
|
890
|
+
<updated-at type='dateTime'>2018-10-11T21:28:37Z</updated-at>
|
891
|
+
<default type='boolean'>true</default>
|
892
|
+
<image-url>https://assets.braintreegateway.com/payment_method_logo/venmo.png?environment=test</image-url>
|
893
|
+
<token>#{id}</token>
|
894
|
+
<source-description>Venmo Account: venmojoe</source-description>
|
895
|
+
<username>venmojoe</username>
|
896
|
+
<venmo-user-id>456</venmo-user-id>
|
897
|
+
<subscriptions type='array'/>
|
898
|
+
<customer-id>venmo_customer_id</customer-id>
|
899
|
+
<global-id>cGF5bWVudG1ldGhvZF92ZW5tb2FjY291bnQ</global-id>
|
900
|
+
</venmo-account>
|
901
|
+
XML
|
902
|
+
end
|
903
|
+
|
880
904
|
def _payment_method_revoked_by_customer_sample_xml(id)
|
881
905
|
<<-XML
|
882
906
|
<paypal-account>
|
@@ -915,10 +939,35 @@ module Braintree
|
|
915
939
|
XML
|
916
940
|
end
|
917
941
|
|
918
|
-
def
|
942
|
+
def _local_payment_expired_sample_xml
|
943
|
+
<<-XML
|
944
|
+
<local-payment-expired>
|
945
|
+
<payment-id>PAY-XYZ123</payment-id>
|
946
|
+
<payment-context-id>cG5b=</payment-context-id>
|
947
|
+
</local-payment-expired>
|
948
|
+
XML
|
949
|
+
end
|
950
|
+
|
951
|
+
def _local_payment_funded_sample_xml(id)
|
952
|
+
<<-XML
|
953
|
+
<local-payment-funded>
|
954
|
+
<payment-id>PAY-XYZ123</payment-id>
|
955
|
+
<payment-context-id>cG5b=</payment-context-id>
|
956
|
+
<transaction>
|
957
|
+
<id>#{id}</id>
|
958
|
+
<status>settled</status>
|
959
|
+
<amount>49.99</amount>
|
960
|
+
<order-id>order4567</order-id>
|
961
|
+
</transaction>
|
962
|
+
</local-payment-funded>
|
963
|
+
XML
|
964
|
+
end
|
965
|
+
|
966
|
+
def _local_payment_reversed_sample_xml
|
919
967
|
<<-XML
|
920
968
|
<local-payment-reversed>
|
921
969
|
<payment-id>PAY-XYZ123</payment-id>
|
970
|
+
<payment-context-id>cG5b=</payment-context-id>
|
922
971
|
</local-payment-reversed>
|
923
972
|
XML
|
924
973
|
end
|
@@ -157,6 +157,48 @@ describe Braintree::CreditCard do
|
|
157
157
|
end
|
158
158
|
end
|
159
159
|
|
160
|
+
it "includes risk data when skip_advanced_fraud_checking is false" do
|
161
|
+
with_fraud_protection_enterprise_merchant do
|
162
|
+
customer = Braintree::Customer.create!
|
163
|
+
result = Braintree::CreditCard.create(
|
164
|
+
:cardholder_name => "Original Holder",
|
165
|
+
:customer_id => customer.id,
|
166
|
+
:cvv => "123",
|
167
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
168
|
+
:expiration_date => "05/2020",
|
169
|
+
:options => {
|
170
|
+
:skip_advanced_fraud_checking => false,
|
171
|
+
:verify_card => true,
|
172
|
+
},
|
173
|
+
)
|
174
|
+
|
175
|
+
expect(result).to be_success
|
176
|
+
verification = result.credit_card.verification
|
177
|
+
expect(verification.risk_data).not_to be_nil
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
it "does not include risk data when skip_advanced_fraud_checking is true" do
|
182
|
+
with_fraud_protection_enterprise_merchant do
|
183
|
+
customer = Braintree::Customer.create!
|
184
|
+
result = Braintree::CreditCard.create(
|
185
|
+
:cardholder_name => "Original Holder",
|
186
|
+
:customer_id => customer.id,
|
187
|
+
:cvv => "123",
|
188
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
189
|
+
:expiration_date => "05/2020",
|
190
|
+
:options => {
|
191
|
+
:skip_advanced_fraud_checking => true,
|
192
|
+
:verify_card => true,
|
193
|
+
},
|
194
|
+
)
|
195
|
+
|
196
|
+
expect(result).to be_success
|
197
|
+
verification = result.credit_card.verification
|
198
|
+
expect(verification.risk_data).to be_nil
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
160
202
|
it "exposes the gateway rejection reason on verification" do
|
161
203
|
old_merchant = Braintree::Configuration.merchant_id
|
162
204
|
old_public_key = Braintree::Configuration.public_key
|
@@ -852,7 +894,54 @@ describe Braintree::CreditCard do
|
|
852
894
|
)
|
853
895
|
|
854
896
|
result.success?.should == true
|
897
|
+
end
|
855
898
|
|
899
|
+
it "includes risk data when skip_advanced_fraud_checking is false" do
|
900
|
+
with_fraud_protection_enterprise_merchant do
|
901
|
+
customer = Braintree::Customer.create!
|
902
|
+
credit_card = Braintree::CreditCard.create!(
|
903
|
+
:cardholder_name => "Original Holder",
|
904
|
+
:customer_id => customer.id,
|
905
|
+
:cvv => "123",
|
906
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
907
|
+
:expiration_date => "05/2020",
|
908
|
+
)
|
909
|
+
updated_result = Braintree::CreditCard.update(credit_card.token,
|
910
|
+
:expiration_date => "05/2021",
|
911
|
+
:options => {
|
912
|
+
:verify_card => true,
|
913
|
+
:skip_advanced_fraud_checking => false,
|
914
|
+
},
|
915
|
+
)
|
916
|
+
|
917
|
+
expect(updated_result).to be_success
|
918
|
+
verification = updated_result.credit_card.verification
|
919
|
+
expect(verification.risk_data).not_to be_nil
|
920
|
+
end
|
921
|
+
end
|
922
|
+
|
923
|
+
it "does not include risk data when skip_advanced_fraud_checking is true" do
|
924
|
+
with_fraud_protection_enterprise_merchant do
|
925
|
+
customer = Braintree::Customer.create!
|
926
|
+
credit_card = Braintree::CreditCard.create!(
|
927
|
+
:cardholder_name => "Original Holder",
|
928
|
+
:customer_id => customer.id,
|
929
|
+
:cvv => "123",
|
930
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
931
|
+
:expiration_date => "05/2020",
|
932
|
+
)
|
933
|
+
updated_result = Braintree::CreditCard.update(credit_card.token,
|
934
|
+
:expiration_date => "05/2021",
|
935
|
+
:options => {
|
936
|
+
:verify_card => true,
|
937
|
+
:skip_advanced_fraud_checking => true,
|
938
|
+
},
|
939
|
+
)
|
940
|
+
|
941
|
+
expect(updated_result).to be_success
|
942
|
+
verification = updated_result.credit_card.verification
|
943
|
+
expect(verification.risk_data).to be_nil
|
944
|
+
end
|
856
945
|
end
|
857
946
|
|
858
947
|
context "billing address" do
|