braintree 2.97.0 → 2.98.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 +0 -2
- data/lib/braintree.rb +1 -0
- data/lib/braintree/credit_card_verification.rb +6 -0
- data/lib/braintree/error_codes.rb +1 -0
- data/lib/braintree/gateway.rb +3 -1
- data/lib/braintree/payment_instrument_type.rb +1 -0
- data/lib/braintree/test/nonce.rb +1 -0
- data/lib/braintree/three_d_secure_info.rb +17 -1
- data/lib/braintree/transaction.rb +4 -0
- data/lib/braintree/transaction/paypal_here_details.rb +23 -0
- data/lib/braintree/version.rb +1 -1
- data/spec/integration/braintree/braintree_gateway_spec.rb +71 -0
- data/spec/integration/braintree/credit_card_spec.rb +21 -0
- data/spec/integration/braintree/credit_card_verification_spec.rb +22 -0
- data/spec/integration/braintree/customer_spec.rb +21 -0
- data/spec/integration/braintree/payment_method_spec.rb +21 -0
- data/spec/integration/braintree/transaction_spec.rb +84 -0
- data/spec/unit/braintree/credit_card_verification_spec.rb +16 -2
- data/spec/unit/braintree/three_d_secure_info_spec.rb +10 -2
- data/spec/unit/braintree/transaction_spec.rb +10 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67e6afaacba1448a5c2aafd4b1e9432aa6875c3f22d5a8812c4e102a156e2d67
|
4
|
+
data.tar.gz: 2c620e47df93ef23542d98b092bf93cf9ef7bfe21b5d4e424976d5b51187836a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca18891a468ccdfa0e22960490781c60206775cccad4a2e23edad4a7a3883b515e68ec71436c6b1edf4e57c51c3633e6127986025aead83055f1f37b55640459
|
7
|
+
data.tar.gz: 0cdcff4610e50bfd41d939f27d164dc87d95c7949fef5fa07dd3d21a42df851cb642590be7088aa9e53008611208cbfac7d3dbd062e0eca6a5197430e7a61266
|
data/braintree.gemspec
CHANGED
@@ -10,8 +10,6 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.author = "Braintree"
|
11
11
|
s.email = "code@getbraintree.com"
|
12
12
|
s.homepage = "https://www.braintreepayments.com/"
|
13
|
-
s.rubyforge_project = "braintree"
|
14
|
-
s.has_rdoc = false
|
15
13
|
s.files = Dir.glob ["README.rdoc", "LICENSE", "lib/**/*.{rb,crt}", "spec/**/*", "*.gemspec"]
|
16
14
|
s.add_dependency "builder", ">= 2.0.0"
|
17
15
|
s.metadata = {
|
data/lib/braintree.rb
CHANGED
@@ -141,6 +141,7 @@ require "braintree/transaction/credit_card_details"
|
|
141
141
|
require "braintree/transaction/customer_details"
|
142
142
|
require "braintree/transaction/disbursement_details"
|
143
143
|
require "braintree/transaction/paypal_details"
|
144
|
+
require "braintree/transaction/paypal_here_details"
|
144
145
|
require "braintree/transaction/subscription_details"
|
145
146
|
require "braintree/transaction_gateway"
|
146
147
|
require "braintree/transaction_line_item_gateway"
|
@@ -24,10 +24,13 @@ module Braintree
|
|
24
24
|
attr_reader :gateway_rejection_reason
|
25
25
|
attr_reader :id
|
26
26
|
attr_reader :merchant_account_id
|
27
|
+
attr_reader :network_response_code
|
28
|
+
attr_reader :network_response_text
|
27
29
|
attr_reader :processor_response_code
|
28
30
|
attr_reader :processor_response_text
|
29
31
|
attr_reader :processor_response_type
|
30
32
|
attr_reader :risk_data
|
33
|
+
attr_reader :three_d_secure_info
|
31
34
|
attr_reader :status
|
32
35
|
|
33
36
|
def initialize(attributes) # :nodoc:
|
@@ -36,6 +39,7 @@ module Braintree
|
|
36
39
|
@amount = Util.to_big_decimal(amount)
|
37
40
|
|
38
41
|
@risk_data = RiskData.new(attributes[:risk_data]) if attributes[:risk_data]
|
42
|
+
@three_d_secure_info = ThreeDSecureInfo.new(attributes[:three_d_secure_info]) if attributes[:three_d_secure_info]
|
39
43
|
end
|
40
44
|
|
41
45
|
def inspect # :nodoc:
|
@@ -49,6 +53,8 @@ module Braintree
|
|
49
53
|
:avs_error_response_code,
|
50
54
|
:avs_postal_code_response_code,
|
51
55
|
:avs_street_address_response_code,
|
56
|
+
:network_response_code,
|
57
|
+
:network_response_text,
|
52
58
|
:merchant_account_id,
|
53
59
|
:gateway_rejection_reason,
|
54
60
|
:id,
|
@@ -300,6 +300,7 @@ module Braintree
|
|
300
300
|
AmountIsRequired = "81502"
|
301
301
|
AmountIsTooLarge = "81528"
|
302
302
|
AmountMustBeGreaterThanZero = "81531"
|
303
|
+
AmountNotSupportedByProcessor = "815193"
|
303
304
|
BillingAddressConflict = "91530"
|
304
305
|
CannotBeVoided = "91504"
|
305
306
|
CannotCancelRelease = "91562"
|
data/lib/braintree/gateway.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Braintree
|
2
2
|
class Gateway
|
3
|
-
attr_reader :config
|
3
|
+
attr_reader :config, :graphql_client
|
4
4
|
|
5
5
|
def initialize(config)
|
6
6
|
if config.is_a?(Hash)
|
@@ -10,6 +10,8 @@ module Braintree
|
|
10
10
|
else
|
11
11
|
raise ArgumentError, "config is an invalid type"
|
12
12
|
end
|
13
|
+
|
14
|
+
@graphql_client = GraphQLClient.new(@config)
|
13
15
|
end
|
14
16
|
|
15
17
|
def add_on
|
data/lib/braintree/test/nonce.rb
CHANGED
@@ -20,6 +20,7 @@ module Braintree
|
|
20
20
|
AmexExpressCheckout = "fake-amex-express-checkout-nonce"
|
21
21
|
VenmoAccount = "fake-venmo-account-nonce"
|
22
22
|
VenmoAccountTokenIssuanceError = "fake-token-issuance-error-venmo-account-nonce"
|
23
|
+
ThreeDSecureVisaFullAuthentication = "fake-three-d-secure-visa-full-authentication-nonce"
|
23
24
|
TransactableVisa = "fake-valid-visa-nonce"
|
24
25
|
TransactableAmEx = "fake-valid-amex-nonce"
|
25
26
|
TransactableMasterCard = "fake-valid-mastercard-nonce"
|
@@ -6,6 +6,11 @@ module Braintree
|
|
6
6
|
attr_reader :liability_shifted
|
7
7
|
attr_reader :liability_shift_possible
|
8
8
|
attr_reader :status
|
9
|
+
attr_reader :cavv
|
10
|
+
attr_reader :xid
|
11
|
+
attr_reader :eci_flag
|
12
|
+
attr_reader :three_d_secure_version
|
13
|
+
attr_reader :ds_transaction_id
|
9
14
|
|
10
15
|
alias_method :liability_shifted?, :liability_shifted
|
11
16
|
alias_method :liability_shift_possible?, :liability_shift_possible
|
@@ -15,7 +20,18 @@ module Braintree
|
|
15
20
|
end
|
16
21
|
|
17
22
|
def inspect
|
18
|
-
attr_order = [
|
23
|
+
attr_order = [
|
24
|
+
:enrolled,
|
25
|
+
:liability_shifted,
|
26
|
+
:liability_shift_possible,
|
27
|
+
:status,
|
28
|
+
:cavv,
|
29
|
+
:xid,
|
30
|
+
:eci_flag,
|
31
|
+
:three_d_secure_version,
|
32
|
+
:ds_transaction_id,
|
33
|
+
]
|
34
|
+
|
19
35
|
formatted_attrs = attr_order.map do |attr|
|
20
36
|
"#{attr}: #{send(attr).inspect}"
|
21
37
|
end
|
@@ -126,11 +126,14 @@ module Braintree
|
|
126
126
|
attr_reader :local_payment_details
|
127
127
|
attr_reader :masterpass_card_details
|
128
128
|
attr_reader :merchant_account_id
|
129
|
+
attr_reader :network_response_code # Response code from the card network
|
130
|
+
attr_reader :network_response_text # Response text from the card network
|
129
131
|
attr_reader :network_transaction_id
|
130
132
|
attr_reader :order_id
|
131
133
|
attr_reader :partial_settlement_transaction_ids
|
132
134
|
attr_reader :payment_instrument_type
|
133
135
|
attr_reader :paypal_details
|
136
|
+
attr_reader :paypal_here_details
|
134
137
|
attr_reader :plan_id
|
135
138
|
attr_reader :processor_authorization_code # Authorization code from the processor.
|
136
139
|
attr_reader :processor_response_code # Response code from the processor.
|
@@ -299,6 +302,7 @@ module Braintree
|
|
299
302
|
@descriptor = Descriptor.new(@descriptor)
|
300
303
|
@local_payment_details = LocalPaymentDetails.new(@local_payment)
|
301
304
|
@paypal_details = PayPalDetails.new(@paypal)
|
305
|
+
@paypal_here_details = PayPalHereDetails.new(@paypal_here)
|
302
306
|
@apple_pay_details = ApplePayDetails.new(@apple_pay)
|
303
307
|
@android_pay_details = AndroidPayDetails.new(@android_pay_card)
|
304
308
|
@amex_express_checkout_details = AmexExpressCheckoutDetails.new(@amex_express_checkout_card)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Braintree
|
2
|
+
class Transaction
|
3
|
+
class PayPalHereDetails
|
4
|
+
include BaseModule
|
5
|
+
|
6
|
+
attr_reader :authorization_id
|
7
|
+
attr_reader :capture_id
|
8
|
+
attr_reader :invoice_id
|
9
|
+
attr_reader :last_4
|
10
|
+
attr_reader :payment_id
|
11
|
+
attr_reader :payment_type
|
12
|
+
attr_reader :refund_id
|
13
|
+
attr_reader :transaction_fee_amount
|
14
|
+
attr_reader :transaction_fee_currency_iso_code
|
15
|
+
attr_reader :transaction_initiation_date
|
16
|
+
attr_reader :transaction_updated_date
|
17
|
+
|
18
|
+
def initialize(attributes)
|
19
|
+
set_instance_variables_from_hash attributes unless attributes.nil?
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/braintree/version.rb
CHANGED
@@ -0,0 +1,71 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::Gateway do
|
4
|
+
before :each do
|
5
|
+
@gateway = Braintree::Gateway.new(
|
6
|
+
:environment => :development,
|
7
|
+
:merchant_id => "integration_merchant_id",
|
8
|
+
:public_key => "integration_public_key",
|
9
|
+
:private_key => "integration_private_key",
|
10
|
+
)
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "query" do
|
15
|
+
it "makes valid GraphQL queries when given a definition" do
|
16
|
+
definition = <<-GRAPHQL
|
17
|
+
mutation ExampleServerSideSingleUseToken($input: TokenizeCreditCardInput!) {
|
18
|
+
tokenizeCreditCard(input: $input) {
|
19
|
+
paymentMethod {
|
20
|
+
id
|
21
|
+
usage
|
22
|
+
details {
|
23
|
+
... on CreditCardDetails {
|
24
|
+
bin
|
25
|
+
brandCode
|
26
|
+
last4
|
27
|
+
expirationYear
|
28
|
+
expirationMonth
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
GRAPHQL
|
35
|
+
|
36
|
+
variables = {
|
37
|
+
"input" => {
|
38
|
+
"creditCard" => {
|
39
|
+
"number" => "4005519200000004",
|
40
|
+
"expirationYear" => "2024",
|
41
|
+
"expirationMonth" => "05",
|
42
|
+
"cardholderName" => "Joe Bloggs",
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
response = @gateway.graphql_client.query(definition, variables)
|
48
|
+
payment_method = response[:data][:tokenizeCreditCard][:paymentMethod]
|
49
|
+
details = payment_method[:details]
|
50
|
+
|
51
|
+
expect(payment_method[:id]).to be
|
52
|
+
expect(details[:bin]).to eq("400551")
|
53
|
+
expect(details[:last4]).to eq("0004")
|
54
|
+
expect(details[:brandCode]).to eq("VISA")
|
55
|
+
expect(details[:expirationMonth]).to eq("05")
|
56
|
+
expect(details[:expirationYear]).to eq("2024")
|
57
|
+
end
|
58
|
+
|
59
|
+
it "makes valid GraphQL queries when given a definition" do
|
60
|
+
definition = <<-GRAPHQL
|
61
|
+
query {
|
62
|
+
ping
|
63
|
+
}
|
64
|
+
GRAPHQL
|
65
|
+
|
66
|
+
response = @gateway.graphql_client.query(definition)
|
67
|
+
|
68
|
+
expect(response[:data]).to eq({:ping=>"pong"})
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -227,6 +227,27 @@ describe Braintree::CreditCard do
|
|
227
227
|
result.success?.should == true
|
228
228
|
end
|
229
229
|
|
230
|
+
it "returns 3DS info on cc verification" do
|
231
|
+
customer = Braintree::Customer.create!
|
232
|
+
result = Braintree::CreditCard.create(
|
233
|
+
:customer_id => customer.id,
|
234
|
+
:payment_method_nonce => Braintree::Test::Nonce::ThreeDSecureVisaFullAuthentication,
|
235
|
+
:options => {:verify_card => true}
|
236
|
+
)
|
237
|
+
result.success?.should == true
|
238
|
+
|
239
|
+
three_d_secure_info = result.credit_card.verification.three_d_secure_info
|
240
|
+
three_d_secure_info.enrolled.should == "Y"
|
241
|
+
three_d_secure_info.should be_liability_shifted
|
242
|
+
three_d_secure_info.should be_liability_shift_possible
|
243
|
+
three_d_secure_info.status.should == "authenticate_successful"
|
244
|
+
three_d_secure_info.cavv.should == "cavv_value"
|
245
|
+
three_d_secure_info.xid.should == "xid_value"
|
246
|
+
three_d_secure_info.eci_flag.should == "05"
|
247
|
+
three_d_secure_info.three_d_secure_version.should == "1.0.2"
|
248
|
+
three_d_secure_info.ds_transaction_id.should == nil
|
249
|
+
end
|
250
|
+
|
230
251
|
it "adds credit card with billing address to customer" do
|
231
252
|
customer = Braintree::Customer.create!
|
232
253
|
result = Braintree::CreditCard.create(
|
@@ -24,6 +24,28 @@ describe Braintree::CreditCardVerification, "search" do
|
|
24
24
|
result.credit_card_verification.processor_response_type.should == Braintree::ProcessorResponseTypes::Approved
|
25
25
|
end
|
26
26
|
|
27
|
+
it "creates a new verification with network response code/text" do
|
28
|
+
verification_params = {
|
29
|
+
:credit_card => {
|
30
|
+
:expiration_date => "05/2012",
|
31
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
32
|
+
},
|
33
|
+
:options => {
|
34
|
+
:amount => "10.00"
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
result = Braintree::CreditCardVerification.create(verification_params)
|
39
|
+
|
40
|
+
expect(result).to be_success
|
41
|
+
expect(result.credit_card_verification.status).to eq(Braintree::CreditCardVerification::Status::Verified)
|
42
|
+
expect(result.credit_card_verification.processor_response_code).to eq("1000")
|
43
|
+
expect(result.credit_card_verification.processor_response_text).to eq("Approved")
|
44
|
+
expect(result.credit_card_verification.network_response_code).to eq("XX")
|
45
|
+
expect(result.credit_card_verification.network_response_text).to eq("sample network response text")
|
46
|
+
expect(result.credit_card_verification.processor_response_type).to eq(Braintree::ProcessorResponseTypes::Approved)
|
47
|
+
end
|
48
|
+
|
27
49
|
it "returns processor response code and text as well as the additional processor response if declined" do
|
28
50
|
verification_params = {
|
29
51
|
:credit_card => {
|
@@ -1309,6 +1309,27 @@ describe Braintree::Customer do
|
|
1309
1309
|
result.success?.should == true
|
1310
1310
|
end
|
1311
1311
|
|
1312
|
+
it "returns 3DS info on cc verification" do
|
1313
|
+
result = Braintree::Customer.create(
|
1314
|
+
:payment_method_nonce => Braintree::Test::Nonce::ThreeDSecureVisaFullAuthentication,
|
1315
|
+
:credit_card => {
|
1316
|
+
:options => {:verify_card => true}
|
1317
|
+
}
|
1318
|
+
)
|
1319
|
+
result.success?.should == true
|
1320
|
+
|
1321
|
+
three_d_secure_info = result.customer.payment_methods.first.verification.three_d_secure_info
|
1322
|
+
three_d_secure_info.enrolled.should == "Y"
|
1323
|
+
three_d_secure_info.should be_liability_shifted
|
1324
|
+
three_d_secure_info.should be_liability_shift_possible
|
1325
|
+
three_d_secure_info.status.should == "authenticate_successful"
|
1326
|
+
three_d_secure_info.cavv.should == "cavv_value"
|
1327
|
+
three_d_secure_info.xid.should == "xid_value"
|
1328
|
+
three_d_secure_info.eci_flag.should == "05"
|
1329
|
+
three_d_secure_info.three_d_secure_version.should == "1.0.2"
|
1330
|
+
three_d_secure_info.ds_transaction_id.should == nil
|
1331
|
+
end
|
1332
|
+
|
1312
1333
|
it "can update the nested billing address with billing_address_id" do
|
1313
1334
|
customer = Braintree::Customer.create!
|
1314
1335
|
|
@@ -298,6 +298,27 @@ describe Braintree::PaymentMethod do
|
|
298
298
|
result.credit_card_verification.amount.should == BigDecimal("100.00")
|
299
299
|
end
|
300
300
|
|
301
|
+
it "returns 3DS info on cc verification" do
|
302
|
+
customer = Braintree::Customer.create.customer
|
303
|
+
result = Braintree::PaymentMethod.create(
|
304
|
+
:payment_method_nonce => Braintree::Test::Nonce::ThreeDSecureVisaFullAuthentication,
|
305
|
+
:options => {:verify_card => true},
|
306
|
+
:customer_id => customer.id,
|
307
|
+
)
|
308
|
+
result.success?.should == true
|
309
|
+
|
310
|
+
three_d_secure_info = result.payment_method.verification.three_d_secure_info
|
311
|
+
three_d_secure_info.enrolled.should == "Y"
|
312
|
+
three_d_secure_info.should be_liability_shifted
|
313
|
+
three_d_secure_info.should be_liability_shift_possible
|
314
|
+
three_d_secure_info.status.should == "authenticate_successful"
|
315
|
+
three_d_secure_info.cavv.should == "cavv_value"
|
316
|
+
three_d_secure_info.xid.should == "xid_value"
|
317
|
+
three_d_secure_info.eci_flag.should == "05"
|
318
|
+
three_d_secure_info.three_d_secure_version.should == "1.0.2"
|
319
|
+
three_d_secure_info.ds_transaction_id.should == nil
|
320
|
+
end
|
321
|
+
|
301
322
|
it "respects fail_on_duplicate_payment_method when included outside of the nonce" do
|
302
323
|
customer = Braintree::Customer.create!
|
303
324
|
result = Braintree::CreditCard.create(
|
@@ -421,6 +421,31 @@ describe Braintree::Transaction do
|
|
421
421
|
result.transaction.credit_card_details.customer_location.should == "US"
|
422
422
|
end
|
423
423
|
|
424
|
+
it "returns a successful network response code if successful" do
|
425
|
+
result = Braintree::Transaction.create(
|
426
|
+
:type => "sale",
|
427
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
428
|
+
:credit_card => {
|
429
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
430
|
+
:expiration_date => "05/2009"
|
431
|
+
}
|
432
|
+
)
|
433
|
+
expect(result.success?).to eq(true)
|
434
|
+
expect(result.transaction.type).to eq("sale")
|
435
|
+
expect(result.transaction.amount).to eq(BigDecimal(Braintree::Test::TransactionAmounts::Authorize))
|
436
|
+
expect(result.transaction.processor_authorization_code).not_to be_nil
|
437
|
+
expect(result.transaction.processor_response_code).to eq("1000")
|
438
|
+
expect(result.transaction.processor_response_text).to eq("Approved")
|
439
|
+
expect(result.transaction.processor_response_type).to eq(Braintree::ProcessorResponseTypes::Approved)
|
440
|
+
expect(result.transaction.network_response_code).to eq("XX")
|
441
|
+
expect(result.transaction.network_response_text).to eq("sample network response text")
|
442
|
+
expect(result.transaction.voice_referral_number).to be_nil
|
443
|
+
expect(result.transaction.credit_card_details.bin).to eq(Braintree::Test::CreditCardNumbers::Visa[0, 6])
|
444
|
+
expect(result.transaction.credit_card_details.last_4).to eq(Braintree::Test::CreditCardNumbers::Visa[-4..-1])
|
445
|
+
expect(result.transaction.credit_card_details.expiration_date).to eq("05/2009")
|
446
|
+
expect(result.transaction.credit_card_details.customer_location).to eq("US")
|
447
|
+
end
|
448
|
+
|
424
449
|
it "returns a successful result using an access token" do
|
425
450
|
oauth_gateway = Braintree::Gateway.new(
|
426
451
|
:client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
|
@@ -929,6 +954,25 @@ describe Braintree::Transaction do
|
|
929
954
|
result.errors.for(:transaction).on(:amount)[0].code.should == Braintree::ErrorCodes::Transaction::AmountCannotBeNegative
|
930
955
|
end
|
931
956
|
|
957
|
+
it "returns an error if amount is not supported by processor" do
|
958
|
+
result = Braintree::Transaction.create(
|
959
|
+
:type => "sale",
|
960
|
+
:merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
961
|
+
:credit_card => {
|
962
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
963
|
+
:expiration_date => "05/2009"
|
964
|
+
},
|
965
|
+
:amount => "0.20",
|
966
|
+
:options => {
|
967
|
+
:credit_card => {
|
968
|
+
:account_type => "credit",
|
969
|
+
}
|
970
|
+
}
|
971
|
+
)
|
972
|
+
result.success?.should == false
|
973
|
+
result.errors.for(:transaction).on(:amount)[0].code.should == Braintree::ErrorCodes::Transaction::AmountNotSupportedByProcessor
|
974
|
+
end
|
975
|
+
|
932
976
|
it "returns an error if amount is invalid format" do
|
933
977
|
params = {
|
934
978
|
:transaction => {
|
@@ -5970,6 +6014,11 @@ describe Braintree::Transaction do
|
|
5970
6014
|
transaction.three_d_secure_info.should be_liability_shifted
|
5971
6015
|
transaction.three_d_secure_info.should be_liability_shift_possible
|
5972
6016
|
transaction.three_d_secure_info.status.should == "authenticate_successful"
|
6017
|
+
transaction.three_d_secure_info.cavv.should == "somebase64value"
|
6018
|
+
transaction.three_d_secure_info.xid.should == "xidvalue"
|
6019
|
+
transaction.three_d_secure_info.eci_flag.should == "07"
|
6020
|
+
transaction.three_d_secure_info.three_d_secure_version.should == "1.0.2"
|
6021
|
+
transaction.three_d_secure_info.ds_transaction_id.should == "dstxnid"
|
5973
6022
|
end
|
5974
6023
|
|
5975
6024
|
it "is nil if the transaction wasn't 3d secured" do
|
@@ -6735,4 +6784,39 @@ describe Braintree::Transaction do
|
|
6735
6784
|
result.transaction.facilitator_details.oauth_application_name.should == "PseudoShop"
|
6736
6785
|
end
|
6737
6786
|
end
|
6787
|
+
|
6788
|
+
context "paypal here" do
|
6789
|
+
it "gets the details of an auth/capture transaction" do
|
6790
|
+
result = Braintree::Transaction.find('paypal_here_auth_capture_id')
|
6791
|
+
result.payment_instrument_type.should eq(Braintree::PaymentInstrumentType::PayPalHere)
|
6792
|
+
result.paypal_here_details.should_not be_nil
|
6793
|
+
|
6794
|
+
details = result.paypal_here_details
|
6795
|
+
details.authorization_id.should_not be_nil
|
6796
|
+
details.capture_id.should_not be_nil
|
6797
|
+
details.invoice_id.should_not be_nil
|
6798
|
+
details.last_4.should_not be_nil
|
6799
|
+
details.payment_type.should_not be_nil
|
6800
|
+
details.transaction_fee_amount.should_not be_nil
|
6801
|
+
details.transaction_fee_currency_iso_code.should_not be_nil
|
6802
|
+
details.transaction_initiation_date.should_not be_nil
|
6803
|
+
details.transaction_updated_date.should_not be_nil
|
6804
|
+
end
|
6805
|
+
|
6806
|
+
it "gets the details of a sale transaction" do
|
6807
|
+
result = Braintree::Transaction.find('paypal_here_sale_id')
|
6808
|
+
result.paypal_here_details.should_not be_nil
|
6809
|
+
|
6810
|
+
details = result.paypal_here_details
|
6811
|
+
details.payment_id.should_not be_nil
|
6812
|
+
end
|
6813
|
+
|
6814
|
+
it "gets the details of a refunded sale transaction" do
|
6815
|
+
result = Braintree::Transaction.find('paypal_here_refund_id')
|
6816
|
+
result.paypal_here_details.should_not be_nil
|
6817
|
+
|
6818
|
+
details = result.paypal_here_details
|
6819
|
+
details.refund_id.should_not be_nil
|
6820
|
+
end
|
6821
|
+
end
|
6738
6822
|
end
|
@@ -13,10 +13,12 @@ describe Braintree::CreditCardVerification do
|
|
13
13
|
:cvv_response_code => "I",
|
14
14
|
:processor_response_code => "2000",
|
15
15
|
:processor_response_text => "Do Not Honor",
|
16
|
-
:merchant_account_id => "some_id"
|
16
|
+
:merchant_account_id => "some_id",
|
17
|
+
:network_response_code => "05",
|
18
|
+
:network_response_text => "Do not Honor",
|
17
19
|
)
|
18
20
|
|
19
|
-
verification.inspect.should == %(#<Braintree::CreditCardVerification status: "verified", processor_response_code: "2000", processor_response_text: "Do Not Honor", amount: "12.45", currency_iso_code: "USD", cvv_response_code: "I", avs_error_response_code: "I", avs_postal_code_response_code: "I", avs_street_address_response_code: "I", merchant_account_id: "some_id", gateway_rejection_reason: nil, id: nil, credit_card: nil, billing: nil, created_at: nil>)
|
21
|
+
verification.inspect.should == %(#<Braintree::CreditCardVerification status: "verified", processor_response_code: "2000", processor_response_text: "Do Not Honor", amount: "12.45", currency_iso_code: "USD", cvv_response_code: "I", avs_error_response_code: "I", avs_postal_code_response_code: "I", avs_street_address_response_code: "I", network_response_code: "05", network_response_text: "Do not Honor", merchant_account_id: "some_id", gateway_rejection_reason: nil, id: nil, credit_card: nil, billing: nil, created_at: nil>)
|
20
22
|
end
|
21
23
|
|
22
24
|
it "has a status" do
|
@@ -123,4 +125,16 @@ describe Braintree::CreditCardVerification do
|
|
123
125
|
verification.risk_data.should be_nil
|
124
126
|
end
|
125
127
|
end
|
128
|
+
|
129
|
+
describe "network responses" do
|
130
|
+
it "accepts network_response_code and network_response_text" do
|
131
|
+
verification = Braintree::CreditCardVerification._new(
|
132
|
+
:network_response_code => "00",
|
133
|
+
:network_response_text => "Successful approval/completion or V.I.P. PIN verification is successful",
|
134
|
+
)
|
135
|
+
|
136
|
+
expect(verification.network_response_code).to eq("00")
|
137
|
+
expect(verification.network_response_text).to eq("Successful approval/completion or V.I.P. PIN verification is successful")
|
138
|
+
end
|
139
|
+
end
|
126
140
|
end
|
@@ -8,7 +8,10 @@ describe Braintree::ThreeDSecureInfo do
|
|
8
8
|
:liability_shift_possible => true,
|
9
9
|
:cavv => "cavvvalue",
|
10
10
|
:xid => "xidvalue",
|
11
|
-
:status => "authenticate_successful"
|
11
|
+
:status => "authenticate_successful",
|
12
|
+
:eci_flag => "06",
|
13
|
+
:three_d_secure_version => "1.0.2",
|
14
|
+
:ds_transaction_id => "dstrxid",
|
12
15
|
)
|
13
16
|
}
|
14
17
|
|
@@ -18,12 +21,17 @@ describe Braintree::ThreeDSecureInfo do
|
|
18
21
|
three_d_secure_info.status.should == "authenticate_successful"
|
19
22
|
three_d_secure_info.liability_shifted.should == true
|
20
23
|
three_d_secure_info.liability_shift_possible.should == true
|
24
|
+
three_d_secure_info.cavv.should == "cavvvalue"
|
25
|
+
three_d_secure_info.xid.should == "xidvalue"
|
26
|
+
three_d_secure_info.eci_flag.should == "06"
|
27
|
+
three_d_secure_info.three_d_secure_version.should == "1.0.2"
|
28
|
+
three_d_secure_info.ds_transaction_id.should == "dstrxid"
|
21
29
|
end
|
22
30
|
end
|
23
31
|
|
24
32
|
describe "inspect" do
|
25
33
|
it "prints the attributes" do
|
26
|
-
three_d_secure_info.inspect.should == %(#<ThreeDSecureInfo enrolled: "Y", liability_shifted: true, liability_shift_possible: true, status: "authenticate_successful">)
|
34
|
+
three_d_secure_info.inspect.should == %(#<ThreeDSecureInfo enrolled: "Y", liability_shifted: true, liability_shift_possible: true, status: "authenticate_successful", cavv: "cavvvalue", xid: "xidvalue", eci_flag: "06", three_d_secure_version: "1.0.2", ds_transaction_id: "dstrxid">)
|
27
35
|
end
|
28
36
|
end
|
29
37
|
|
@@ -263,6 +263,16 @@ describe Braintree::Transaction do
|
|
263
263
|
)
|
264
264
|
transaction.network_transaction_id.should == "123456789012345"
|
265
265
|
end
|
266
|
+
|
267
|
+
it "accepts network_response code and network_response_text" do
|
268
|
+
transaction = Braintree::Transaction._new(
|
269
|
+
:gateway,
|
270
|
+
:network_response_code => "00",
|
271
|
+
:network_response_text => "Successful approval/completion or V.I.P. PIN verification is successful",
|
272
|
+
)
|
273
|
+
expect(transaction.network_response_code).to eq("00")
|
274
|
+
expect(transaction.network_response_text).to eq("Successful approval/completion or V.I.P. PIN verification is successful")
|
275
|
+
end
|
266
276
|
end
|
267
277
|
|
268
278
|
describe "inspect" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: braintree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.98.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Braintree
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -154,6 +154,7 @@ files:
|
|
154
154
|
- lib/braintree/transaction/local_payment_details.rb
|
155
155
|
- lib/braintree/transaction/masterpass_card_details.rb
|
156
156
|
- lib/braintree/transaction/paypal_details.rb
|
157
|
+
- lib/braintree/transaction/paypal_here_details.rb
|
157
158
|
- lib/braintree/transaction/samsung_pay_card_details.rb
|
158
159
|
- lib/braintree/transaction/status_details.rb
|
159
160
|
- lib/braintree/transaction/subscription_details.rb
|
@@ -198,6 +199,7 @@ files:
|
|
198
199
|
- spec/integration/braintree/address_spec.rb
|
199
200
|
- spec/integration/braintree/advanced_search_spec.rb
|
200
201
|
- spec/integration/braintree/apple_pay_spec.rb
|
202
|
+
- spec/integration/braintree/braintree_gateway_spec.rb
|
201
203
|
- spec/integration/braintree/client_api/client_token_spec.rb
|
202
204
|
- spec/integration/braintree/client_api/spec_helper.rb
|
203
205
|
- spec/integration/braintree/coinbase_spec.rb
|