braintree 4.15.0 → 4.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/braintree/account_updater_daily_report.rb +3 -3
- data/lib/braintree/ach_mandate.rb +1 -1
- data/lib/braintree/add_on_gateway.rb +1 -1
- data/lib/braintree/address.rb +4 -4
- data/lib/braintree/address_gateway.rb +5 -5
- data/lib/braintree/advanced_search.rb +10 -10
- data/lib/braintree/apple_pay.rb +3 -3
- data/lib/braintree/apple_pay_card.rb +3 -3
- data/lib/braintree/apple_pay_options.rb +3 -3
- data/lib/braintree/authorization_adjustment.rb +3 -3
- data/lib/braintree/base_module.rb +1 -1
- data/lib/braintree/bin_data.rb +2 -2
- data/lib/braintree/client_token_gateway.rb +1 -1
- data/lib/braintree/configuration.rb +22 -22
- data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
- data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
- data/lib/braintree/credit_card.rb +9 -9
- data/lib/braintree/credit_card_gateway.rb +8 -8
- data/lib/braintree/credit_card_verification.rb +3 -3
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +5 -9
- data/lib/braintree/customer_gateway.rb +7 -7
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/descriptor.rb +1 -1
- data/lib/braintree/digest.rb +1 -1
- data/lib/braintree/disbursement.rb +5 -5
- data/lib/braintree/discount_gateway.rb +1 -1
- data/lib/braintree/dispute/evidence.rb +1 -1
- data/lib/braintree/dispute/paypal_message.rb +1 -1
- data/lib/braintree/dispute/status_history.rb +1 -1
- data/lib/braintree/dispute/transaction.rb +1 -1
- data/lib/braintree/dispute/transaction_details.rb +1 -1
- data/lib/braintree/dispute.rb +3 -3
- data/lib/braintree/dispute_gateway.rb +1 -1
- data/lib/braintree/dispute_search.rb +1 -1
- data/lib/braintree/document_upload.rb +2 -2
- data/lib/braintree/document_upload_gateway.rb +3 -3
- data/lib/braintree/enriched_customer_data.rb +2 -2
- data/lib/braintree/error_result.rb +2 -3
- data/lib/braintree/errors.rb +3 -3
- data/lib/braintree/exceptions.rb +1 -2
- data/lib/braintree/exchange_rate.rb +2 -2
- data/lib/braintree/exchange_rate_quote.rb +3 -3
- data/lib/braintree/exchange_rate_quote_gateway.rb +1 -1
- data/lib/braintree/exchange_rate_quote_input.rb +3 -3
- data/lib/braintree/exchange_rate_quote_request.rb +3 -3
- data/lib/braintree/exchange_rate_quote_response.rb +3 -3
- data/lib/braintree/facilitated_details.rb +1 -1
- data/lib/braintree/facilitator_details.rb +1 -1
- data/lib/braintree/google_pay_card.rb +3 -3
- data/lib/braintree/granted_payment_instrument_update.rb +1 -1
- data/lib/braintree/graphql_client.rb +1 -1
- data/lib/braintree/http.rb +1 -1
- data/lib/braintree/local_payment_completed.rb +2 -2
- data/lib/braintree/local_payment_expired.rb +2 -2
- data/lib/braintree/local_payment_funded.rb +2 -2
- data/lib/braintree/local_payment_reversed.rb +2 -2
- data/lib/braintree/merchant.rb +3 -3
- data/lib/braintree/merchant_account.rb +2 -2
- data/lib/braintree/merchant_account_gateway.rb +9 -9
- data/lib/braintree/meta_checkout_card.rb +89 -0
- data/lib/braintree/meta_checkout_token.rb +88 -0
- data/lib/braintree/modification.rb +3 -3
- data/lib/braintree/oauth_credentials.rb +3 -3
- data/lib/braintree/paginated_collection.rb +2 -2
- data/lib/braintree/paginated_result.rb +1 -1
- data/lib/braintree/payment_instrument_type.rb +2 -0
- data/lib/braintree/payment_method_customer_data_updated_metadata.rb +2 -2
- data/lib/braintree/payment_method_gateway.rb +8 -7
- data/lib/braintree/payment_method_nonce.rb +4 -4
- data/lib/braintree/payment_method_nonce_details.rb +1 -1
- data/lib/braintree/payment_method_nonce_details_payer_info.rb +1 -1
- data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
- data/lib/braintree/paypal_account.rb +1 -2
- data/lib/braintree/paypal_account_gateway.rb +5 -5
- data/lib/braintree/plan.rb +1 -1
- data/lib/braintree/plan_gateway.rb +2 -2
- data/lib/braintree/resource_collection.rb +2 -2
- data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
- data/lib/braintree/risk_data.rb +1 -1
- data/lib/braintree/samsung_pay_card.rb +5 -5
- data/lib/braintree/sepa_direct_debit_account.rb +2 -2
- data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +1 -1
- data/lib/braintree/settlement_batch_summary_gateway.rb +1 -1
- data/lib/braintree/sha256_digest.rb +1 -1
- data/lib/braintree/subscription/status_details.rb +1 -1
- data/lib/braintree/subscription.rb +2 -2
- data/lib/braintree/subscription_gateway.rb +6 -6
- data/lib/braintree/subscription_search.rb +1 -1
- data/lib/braintree/successful_result.rb +2 -2
- data/lib/braintree/test/credit_card.rb +7 -10
- data/lib/braintree/test/merchant_account.rb +1 -1
- data/lib/braintree/test/nonce.rb +3 -0
- data/lib/braintree/test/transaction_amounts.rb +2 -3
- data/lib/braintree/testing_gateway.rb +1 -1
- data/lib/braintree/three_d_secure_info.rb +1 -1
- data/lib/braintree/transaction/address_details.rb +1 -1
- data/lib/braintree/transaction/credit_card_details.rb +1 -1
- data/lib/braintree/transaction/customer_details.rb +1 -1
- data/lib/braintree/transaction/disbursement_details.rb +1 -1
- data/lib/braintree/transaction/meta_checkout_card_details.rb +52 -0
- data/lib/braintree/transaction/meta_checkout_token_details.rb +54 -0
- data/lib/braintree/transaction/samsung_pay_card_details.rb +1 -1
- data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +1 -1
- data/lib/braintree/transaction/status_details.rb +1 -1
- data/lib/braintree/transaction/subscription_details.rb +1 -1
- data/lib/braintree/transaction/us_bank_account_details.rb +1 -1
- data/lib/braintree/transaction/visa_checkout_card_details.rb +1 -1
- data/lib/braintree/transaction.rb +22 -16
- data/lib/braintree/transaction_gateway.rb +9 -10
- data/lib/braintree/transaction_line_item.rb +2 -2
- data/lib/braintree/transaction_line_item_gateway.rb +1 -1
- data/lib/braintree/transaction_review.rb +1 -1
- data/lib/braintree/transaction_search.rb +1 -1
- data/lib/braintree/unknown_payment_method.rb +1 -1
- data/lib/braintree/us_bank_account.rb +2 -2
- data/lib/braintree/us_bank_account_verification.rb +23 -15
- data/lib/braintree/us_bank_account_verification_search.rb +1 -1
- data/lib/braintree/util.rb +3 -3
- data/lib/braintree/validation_error.rb +1 -1
- data/lib/braintree/validation_error_collection.rb +3 -3
- data/lib/braintree/venmo_account.rb +3 -3
- data/lib/braintree/venmo_profile_data.rb +6 -4
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/visa_checkout_card.rb +7 -7
- data/lib/braintree/webhook_notification.rb +2 -2
- data/lib/braintree/webhook_notification_gateway.rb +3 -3
- data/lib/braintree/webhook_testing.rb +1 -1
- data/lib/braintree/webhook_testing_gateway.rb +1 -1
- data/lib/braintree/xml/generator.rb +1 -1
- data/lib/braintree/xml/libxml.rb +1 -1
- data/lib/braintree/xml/parser.rb +2 -2
- data/lib/braintree/xml/rexml.rb +2 -2
- data/lib/braintree/xml.rb +1 -1
- data/lib/braintree.rb +4 -1
- data/spec/integration/braintree/dispute_search_spec.rb +0 -1
- data/spec/integration/braintree/payment_method_nonce_spec.rb +20 -0
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +72 -0
- data/spec/integration/braintree/transaction_search_spec.rb +27 -0
- data/spec/integration/braintree/transaction_spec.rb +192 -66
- data/spec/unit/braintree/enriched_customer_data_spec.rb +9 -0
- data/spec/unit/braintree/http_spec.rb +1 -1
- data/spec/unit/braintree/meta_checkout_card_details_spec.rb +60 -0
- data/spec/unit/braintree/meta_checkout_card_spec.rb +60 -0
- data/spec/unit/braintree/meta_checkout_token_details_spec.rb +63 -0
- data/spec/unit/braintree/meta_checkout_token_spec.rb +63 -0
- data/spec/unit/braintree/transaction_gateway_spec.rb +30 -1
- data/spec/unit/braintree/us_bank_account_verification_spec.rb +5 -0
- data/spec/unit/braintree/venmo_profile_data_spec.rb +11 -0
- metadata +10 -2
@@ -2,6 +2,72 @@ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
|
2
2
|
require File.expand_path(File.dirname(__FILE__) + "/client_api/spec_helper")
|
3
3
|
|
4
4
|
describe Braintree::Transaction do
|
5
|
+
let(:industry_data_flight_params) do
|
6
|
+
{
|
7
|
+
:industry => {
|
8
|
+
:industry_type => Braintree::Transaction::IndustryType::TravelAndFlight,
|
9
|
+
:data => {
|
10
|
+
:country_code => "US",
|
11
|
+
:date_of_birth => "2012-12-12",
|
12
|
+
:passenger_first_name => "John",
|
13
|
+
:passenger_last_name => "Doe",
|
14
|
+
:passenger_middle_initial => "M",
|
15
|
+
:passenger_title => "Mr.",
|
16
|
+
:issued_date => Date.new(2018, 1, 1),
|
17
|
+
:travel_agency_name => "Expedia",
|
18
|
+
:travel_agency_code => "12345678",
|
19
|
+
:ticket_number => "ticket-number",
|
20
|
+
:issuing_carrier_code => "AA",
|
21
|
+
:customer_code => "customer-code",
|
22
|
+
:fare_amount => 70_00,
|
23
|
+
:fee_amount => 10_00,
|
24
|
+
:tax_amount => 20_00,
|
25
|
+
:restricted_ticket => false,
|
26
|
+
:legs => [
|
27
|
+
{
|
28
|
+
:conjunction_ticket => "CJ0001",
|
29
|
+
:exchange_ticket => "ET0001",
|
30
|
+
:coupon_number => "1",
|
31
|
+
:service_class => "Y",
|
32
|
+
:carrier_code => "AA",
|
33
|
+
:fare_basis_code => "W",
|
34
|
+
:flight_number => "AA100",
|
35
|
+
:departure_date => Date.new(2018, 1, 2),
|
36
|
+
:departure_airport_code => "MDW",
|
37
|
+
:departure_time => "08:00",
|
38
|
+
:arrival_airport_code => "ATX",
|
39
|
+
:arrival_time => "10:00",
|
40
|
+
:stopover_permitted => false,
|
41
|
+
:fare_amount => 35_00,
|
42
|
+
:fee_amount => 5_00,
|
43
|
+
:tax_amount => 10_00,
|
44
|
+
:endorsement_or_restrictions => "NOT REFUNDABLE"
|
45
|
+
},
|
46
|
+
{
|
47
|
+
:conjunction_ticket => "CJ0002",
|
48
|
+
:exchange_ticket => "ET0002",
|
49
|
+
:coupon_number => "1",
|
50
|
+
:service_class => "Y",
|
51
|
+
:carrier_code => "AA",
|
52
|
+
:fare_basis_code => "W",
|
53
|
+
:flight_number => "AA200",
|
54
|
+
:departure_date => Date.new(2018, 1, 3),
|
55
|
+
:departure_airport_code => "ATX",
|
56
|
+
:departure_time => "12:00",
|
57
|
+
:arrival_airport_code => "MDW",
|
58
|
+
:arrival_time => "14:00",
|
59
|
+
:stopover_permitted => false,
|
60
|
+
:fare_amount => 35_00,
|
61
|
+
:fee_amount => 5_00,
|
62
|
+
:tax_amount => 10_00,
|
63
|
+
:endorsement_or_restrictions => "NOT REFUNDABLE"
|
64
|
+
}
|
65
|
+
]
|
66
|
+
}
|
67
|
+
},
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
5
71
|
describe "self.clone_transaction" do
|
6
72
|
it "creates a new transaction from the card of the transaction to clone" do
|
7
73
|
result = Braintree::Transaction.sale(
|
@@ -306,8 +372,8 @@ describe Braintree::Transaction do
|
|
306
372
|
check_out_date_must_follow_check_in_date = Braintree::ErrorCodes::Transaction::Industry::Lodging::CheckOutDateMustFollowCheckInDate
|
307
373
|
room_rate_format_is_invalid = Braintree::ErrorCodes::Transaction::Industry::Lodging::RoomRateFormatIsInvalid
|
308
374
|
invalid_additional_charge_kind = Braintree::ErrorCodes::Transaction::Industry::AdditionalCharge::KindIsInvalid
|
309
|
-
expect(result.errors.for(:transaction).for(:industry).map { |e| e.code }.sort).to include(
|
310
|
-
expect(result.errors.for(:transaction).for(:industry).for(:additional_charges).for(:index_0).on(:kind).map { |e| e.code }.sort).to include(
|
375
|
+
expect(result.errors.for(:transaction).for(:industry).map { |e| e.code }.sort).to include(invalid_folio, check_out_date_must_follow_check_in_date, room_rate_format_is_invalid)
|
376
|
+
expect(result.errors.for(:transaction).for(:industry).for(:additional_charges).for(:index_0).on(:kind).map { |e| e.code }.sort).to include(invalid_additional_charge_kind)
|
311
377
|
end
|
312
378
|
end
|
313
379
|
|
@@ -356,74 +422,18 @@ describe Braintree::Transaction do
|
|
356
422
|
|
357
423
|
context "for travel flight" do
|
358
424
|
it "accepts valid industry data" do
|
359
|
-
|
425
|
+
params = {
|
360
426
|
:type => "sale",
|
361
427
|
:amount => 1_00,
|
362
428
|
:payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment,
|
363
429
|
:options => {
|
364
430
|
:submit_for_settlement => true
|
365
431
|
},
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
:passenger_middle_initial => "M",
|
372
|
-
:passenger_title => "Mr.",
|
373
|
-
:issued_date => Date.new(2018, 1, 1),
|
374
|
-
:travel_agency_name => "Expedia",
|
375
|
-
:travel_agency_code => "12345678",
|
376
|
-
:ticket_number => "ticket-number",
|
377
|
-
:issuing_carrier_code => "AA",
|
378
|
-
:customer_code => "customer-code",
|
379
|
-
:fare_amount => 70_00,
|
380
|
-
:fee_amount => 10_00,
|
381
|
-
:tax_amount => 20_00,
|
382
|
-
:restricted_ticket => false,
|
383
|
-
:legs => [
|
384
|
-
{
|
385
|
-
:conjunction_ticket => "CJ0001",
|
386
|
-
:exchange_ticket => "ET0001",
|
387
|
-
:coupon_number => "1",
|
388
|
-
:service_class => "Y",
|
389
|
-
:carrier_code => "AA",
|
390
|
-
:fare_basis_code => "W",
|
391
|
-
:flight_number => "AA100",
|
392
|
-
:departure_date => Date.new(2018, 1, 2),
|
393
|
-
:departure_airport_code => "MDW",
|
394
|
-
:departure_time => "08:00",
|
395
|
-
:arrival_airport_code => "ATX",
|
396
|
-
:arrival_time => "10:00",
|
397
|
-
:stopover_permitted => false,
|
398
|
-
:fare_amount => 35_00,
|
399
|
-
:fee_amount => 5_00,
|
400
|
-
:tax_amount => 10_00,
|
401
|
-
:endorsement_or_restrictions => "NOT REFUNDABLE"
|
402
|
-
},
|
403
|
-
{
|
404
|
-
:conjunction_ticket => "CJ0002",
|
405
|
-
:exchange_ticket => "ET0002",
|
406
|
-
:coupon_number => "1",
|
407
|
-
:service_class => "Y",
|
408
|
-
:carrier_code => "AA",
|
409
|
-
:fare_basis_code => "W",
|
410
|
-
:flight_number => "AA200",
|
411
|
-
:departure_date => Date.new(2018, 1, 3),
|
412
|
-
:departure_airport_code => "ATX",
|
413
|
-
:departure_time => "12:00",
|
414
|
-
:arrival_airport_code => "MDW",
|
415
|
-
:arrival_time => "14:00",
|
416
|
-
:stopover_permitted => false,
|
417
|
-
:fare_amount => 35_00,
|
418
|
-
:fee_amount => 5_00,
|
419
|
-
:tax_amount => 10_00,
|
420
|
-
:endorsement_or_restrictions => "NOT REFUNDABLE"
|
421
|
-
}
|
422
|
-
]
|
423
|
-
}
|
424
|
-
},
|
425
|
-
)
|
426
|
-
expect(result.success?).to be(true)
|
432
|
+
}
|
433
|
+
params.merge(industry_data_flight_params)
|
434
|
+
|
435
|
+
result = Braintree::Transaction.create(params)
|
436
|
+
result.success?.should be(true)
|
427
437
|
end
|
428
438
|
|
429
439
|
it "returns errors if validations on industry data fails" do
|
@@ -1452,8 +1462,7 @@ describe Braintree::Transaction do
|
|
1452
1462
|
|
1453
1463
|
it "returns an error if no credit card is given" do
|
1454
1464
|
params = {
|
1455
|
-
:transaction => {
|
1456
|
-
}
|
1465
|
+
:transaction => {}
|
1457
1466
|
}
|
1458
1467
|
result = Braintree::Transaction.create(params[:transaction])
|
1459
1468
|
expect(result.success?).to eq(false)
|
@@ -2107,6 +2116,61 @@ describe Braintree::Transaction do
|
|
2107
2116
|
expect(result.transaction.paypal_details.debug_id).not_to be_nil
|
2108
2117
|
end
|
2109
2118
|
|
2119
|
+
it "can create a transaction with a fake meta checkout card nonce" do
|
2120
|
+
result = Braintree::Transaction.create(
|
2121
|
+
:type => "sale",
|
2122
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
2123
|
+
:payment_method_nonce => Braintree::Test::Nonce::MetaCheckoutCard,
|
2124
|
+
)
|
2125
|
+
|
2126
|
+
result.success?.should == true
|
2127
|
+
result.transaction.should_not be_nil
|
2128
|
+
meta_checkout_card_details = result.transaction.meta_checkout_card_details
|
2129
|
+
meta_checkout_card_details.should_not be_nil
|
2130
|
+
meta_checkout_card_details.bin.should == "401288"
|
2131
|
+
meta_checkout_card_details.card_type.should == Braintree::CreditCard::CardType::Visa
|
2132
|
+
meta_checkout_card_details.cardholder_name.should == "Meta Checkout Card Cardholder"
|
2133
|
+
meta_checkout_card_details.container_id.should == "container123"
|
2134
|
+
meta_checkout_card_details.customer_location.should == "US"
|
2135
|
+
meta_checkout_card_details.expiration_date.should == "12/2024"
|
2136
|
+
meta_checkout_card_details.expiration_year.should == "2024"
|
2137
|
+
meta_checkout_card_details.expiration_month.should == "12"
|
2138
|
+
meta_checkout_card_details.image_url.should == "https://assets.braintreegateway.com/payment_method_logo/visa.png?environment=development"
|
2139
|
+
meta_checkout_card_details.is_network_tokenized.should == false
|
2140
|
+
meta_checkout_card_details.last_4.should == "1881"
|
2141
|
+
meta_checkout_card_details.masked_number.should == "401288******1881"
|
2142
|
+
meta_checkout_card_details.prepaid.should == "No"
|
2143
|
+
end
|
2144
|
+
|
2145
|
+
it "can create a transaction with a fake meta checkout token nonce" do
|
2146
|
+
result = Braintree::Transaction.create(
|
2147
|
+
:type => "sale",
|
2148
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
2149
|
+
:payment_method_nonce => Braintree::Test::Nonce::MetaCheckoutToken,
|
2150
|
+
)
|
2151
|
+
|
2152
|
+
result.success?.should == true
|
2153
|
+
result.transaction.should_not be_nil
|
2154
|
+
meta_checkout_token_details = result.transaction.meta_checkout_token_details
|
2155
|
+
|
2156
|
+
meta_checkout_token_details.should_not be_nil
|
2157
|
+
meta_checkout_token_details.bin.should == "401288"
|
2158
|
+
meta_checkout_token_details.card_type.should == Braintree::CreditCard::CardType::Visa
|
2159
|
+
meta_checkout_token_details.cardholder_name.should == "Meta Checkout Token Cardholder"
|
2160
|
+
meta_checkout_token_details.container_id.should == "container123"
|
2161
|
+
meta_checkout_token_details.cryptogram.should == "AlhlvxmN2ZKuAAESNFZ4GoABFA=="
|
2162
|
+
meta_checkout_token_details.customer_location.should == "US"
|
2163
|
+
meta_checkout_token_details.ecommerce_indicator.should == "07"
|
2164
|
+
meta_checkout_token_details.expiration_date.should == "12/2024"
|
2165
|
+
meta_checkout_token_details.expiration_year.should == "2024"
|
2166
|
+
meta_checkout_token_details.expiration_month.should == "12"
|
2167
|
+
meta_checkout_token_details.image_url.should == "https://assets.braintreegateway.com/payment_method_logo/visa.png?environment=development"
|
2168
|
+
meta_checkout_token_details.is_network_tokenized.should == true
|
2169
|
+
meta_checkout_token_details.last_4.should == "1881"
|
2170
|
+
meta_checkout_token_details.masked_number.should == "401288******1881"
|
2171
|
+
meta_checkout_token_details.prepaid.should == "No"
|
2172
|
+
end
|
2173
|
+
|
2110
2174
|
it "can create a transaction with a fake apple pay nonce" do
|
2111
2175
|
customer = Braintree::Customer.create!
|
2112
2176
|
result = Braintree::Transaction.create(
|
@@ -5935,6 +5999,54 @@ describe Braintree::Transaction do
|
|
5935
5999
|
end
|
5936
6000
|
end
|
5937
6001
|
|
6002
|
+
it "succeeds when industry data is provided" do
|
6003
|
+
transaction = Braintree::Transaction.create(
|
6004
|
+
:type => "sale",
|
6005
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
6006
|
+
:payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment,
|
6007
|
+
:options => {
|
6008
|
+
:submit_for_settlement => false
|
6009
|
+
},
|
6010
|
+
).transaction
|
6011
|
+
|
6012
|
+
result = Braintree::Transaction.submit_for_settlement(transaction.id, Braintree::Test::TransactionAmounts::Authorize, industry_data_flight_params)
|
6013
|
+
expect(result.success?).to be_truthy
|
6014
|
+
end
|
6015
|
+
|
6016
|
+
it "returns errors if validations on industry data fails" do
|
6017
|
+
transaction = Braintree::Transaction.create(
|
6018
|
+
:type => "sale",
|
6019
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
6020
|
+
:payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment,
|
6021
|
+
:options => {
|
6022
|
+
:submit_for_settlement => false
|
6023
|
+
},
|
6024
|
+
).transaction
|
6025
|
+
|
6026
|
+
options = {
|
6027
|
+
:industry => {
|
6028
|
+
:industry_type => Braintree::Transaction::IndustryType::TravelAndFlight,
|
6029
|
+
:data => {
|
6030
|
+
:fare_amount => -1_23,
|
6031
|
+
:restricted_ticket => false,
|
6032
|
+
:legs => [
|
6033
|
+
{
|
6034
|
+
:fare_amount => -1_23
|
6035
|
+
}
|
6036
|
+
]
|
6037
|
+
}
|
6038
|
+
},
|
6039
|
+
}
|
6040
|
+
|
6041
|
+
result = Braintree::Transaction.submit_for_settlement(transaction.id, Braintree::Test::TransactionAmounts::Authorize, options)
|
6042
|
+
expect(result.success?).to be_falsey
|
6043
|
+
industry_errors = result.errors.for(:transaction).for(:industry).map { |e| e.code }.sort
|
6044
|
+
expect(industry_errors).to eq([Braintree::ErrorCodes::Transaction::Industry::TravelFlight::FareAmountCannotBeNegative])
|
6045
|
+
|
6046
|
+
leg_errors = result.errors.for(:transaction).for(:industry).for(:legs).for(:index_0).map { |e| e.code }.sort
|
6047
|
+
expect(leg_errors).to eq([Braintree::ErrorCodes::Transaction::Industry::Leg::TravelFlight::FareAmountCannotBeNegative])
|
6048
|
+
end
|
6049
|
+
|
5938
6050
|
xit "succeeds when level 2 data is provided" do
|
5939
6051
|
result = Braintree::Transaction.sale(
|
5940
6052
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
@@ -6371,6 +6483,20 @@ describe Braintree::Transaction do
|
|
6371
6483
|
expect(result.success?).to eq(false)
|
6372
6484
|
expect(result.errors.for(:transaction).on(:base)[0].code).to eq(Braintree::ErrorCodes::Transaction::CannotSubmitForSettlement)
|
6373
6485
|
end
|
6486
|
+
|
6487
|
+
it "succeeds when industry data is provided" do
|
6488
|
+
transaction = Braintree::Transaction.create(
|
6489
|
+
:type => "sale",
|
6490
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
6491
|
+
:payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment,
|
6492
|
+
:options => {
|
6493
|
+
:submit_for_settlement => false
|
6494
|
+
},
|
6495
|
+
).transaction
|
6496
|
+
|
6497
|
+
result = Braintree::Transaction.submit_for_partial_settlement(transaction.id, Braintree::Test::TransactionAmounts::Authorize, industry_data_flight_params)
|
6498
|
+
expect(result.success?).to be_truthy
|
6499
|
+
end
|
6374
6500
|
end
|
6375
6501
|
|
6376
6502
|
describe "self.submit_for_partial_settlement!" do
|
@@ -12,6 +12,13 @@ describe Braintree::EnrichedCustomerData do
|
|
12
12
|
describe "self._new" do
|
13
13
|
it "initializes the object with the appropriate attributes set" do
|
14
14
|
|
15
|
+
address = {
|
16
|
+
street_address: "a-street-address",
|
17
|
+
extended_address: "an-extended-address",
|
18
|
+
locality: "a-locality",
|
19
|
+
region: "a-region",
|
20
|
+
postal_code: "a-postal-code"
|
21
|
+
}
|
15
22
|
params = {
|
16
23
|
fields_updated: ["username"],
|
17
24
|
profile_data: {
|
@@ -20,6 +27,8 @@ describe Braintree::EnrichedCustomerData do
|
|
20
27
|
last_name: "a-last-name",
|
21
28
|
phone_number: "a-phone-number",
|
22
29
|
email: "a-email",
|
30
|
+
billing_address: address,
|
31
|
+
shipping_address: address,
|
23
32
|
},
|
24
33
|
}
|
25
34
|
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::Transaction::MetaCheckoutCardDetails do
|
4
|
+
let(:attributes) do {
|
5
|
+
|
6
|
+
:bin => "abc1234",
|
7
|
+
:container_id => "a-container-id",
|
8
|
+
:card_type => "Visa",
|
9
|
+
:cardholder_name => "Meta Checkout Card CardHolder",
|
10
|
+
:commercial => "NO",
|
11
|
+
:country_of_issuance => "US",
|
12
|
+
:created_at => "2023-05-05T21:28:37Z",
|
13
|
+
:debit => "NO",
|
14
|
+
:durbin_regulated => "NO",
|
15
|
+
:expiration_month => "05",
|
16
|
+
:expiration_year => "2024",
|
17
|
+
:healthcare => "NO",
|
18
|
+
:last_4 => "1234",
|
19
|
+
:payroll => "NO",
|
20
|
+
:prepaid => "NO",
|
21
|
+
:token => "token1",
|
22
|
+
:unique_number_identifier => "abc1234",
|
23
|
+
:updated_at => "2023-05-05T21:28:37Z"
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "unit tests" do
|
28
|
+
it "initializes with the correct attributes" do
|
29
|
+
card = Braintree::Transaction::MetaCheckoutCardDetails.new(attributes)
|
30
|
+
|
31
|
+
card.bin.should == "abc1234"
|
32
|
+
card.container_id.should == "a-container-id"
|
33
|
+
card.card_type.should == "Visa"
|
34
|
+
card.cardholder_name.should == "Meta Checkout Card CardHolder"
|
35
|
+
card.commercial == "NO"
|
36
|
+
card.country_of_issuance == "US"
|
37
|
+
card.created_at == "2023-05-05T21:28:37Z"
|
38
|
+
card.updated_at == "2023-05-05T21:28:37Z"
|
39
|
+
card.debit == "NO"
|
40
|
+
card.payroll == "NO"
|
41
|
+
card.prepaid == "NO"
|
42
|
+
card.healthcare == "NO"
|
43
|
+
card.token == "token1"
|
44
|
+
card.unique_number_identifier == "abc1234"
|
45
|
+
card.expiration_month.should == "05"
|
46
|
+
card.expiration_year.should == "2024"
|
47
|
+
card.last_4.should == "1234"
|
48
|
+
end
|
49
|
+
|
50
|
+
it "sets expiration date correctly" do
|
51
|
+
card = Braintree::Transaction::MetaCheckoutCardDetails.new(attributes)
|
52
|
+
card.expiration_date.should == "05/2024"
|
53
|
+
end
|
54
|
+
|
55
|
+
it "masks the card number correctly" do
|
56
|
+
card = Braintree::Transaction::MetaCheckoutCardDetails.new(attributes)
|
57
|
+
card.masked_number.should == "abc1234******1234"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::MetaCheckoutCard do
|
4
|
+
let(:attributes) do {
|
5
|
+
|
6
|
+
:bin => "abc1234",
|
7
|
+
:container_id => "a-container-id",
|
8
|
+
:card_type => "Visa",
|
9
|
+
:cardholder_name => "Meta Checkout Card CardHolder",
|
10
|
+
:commercial => "NO",
|
11
|
+
:country_of_issuance => "US",
|
12
|
+
:created_at => "2023-05-05T21:28:37Z",
|
13
|
+
:debit => "NO",
|
14
|
+
:durbin_regulated => "NO",
|
15
|
+
:expiration_month => "05",
|
16
|
+
:expiration_year => "2024",
|
17
|
+
:healthcare => "NO",
|
18
|
+
:last_4 => "1234",
|
19
|
+
:payroll => "NO",
|
20
|
+
:prepaid => "NO",
|
21
|
+
:token => "token1",
|
22
|
+
:unique_number_identifier => "abc1234",
|
23
|
+
:updated_at => "2023-05-05T21:28:37Z"
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "unit tests" do
|
28
|
+
it "initializes with the correct attributes" do
|
29
|
+
card = Braintree::MetaCheckoutCard._new(:gateway, attributes)
|
30
|
+
|
31
|
+
card.bin.should == "abc1234"
|
32
|
+
card.container_id.should == "a-container-id"
|
33
|
+
card.card_type.should == "Visa"
|
34
|
+
card.cardholder_name.should == "Meta Checkout Card CardHolder"
|
35
|
+
card.commercial == "NO"
|
36
|
+
card.country_of_issuance == "US"
|
37
|
+
card.created_at == "2023-05-05T21:28:37Z"
|
38
|
+
card.updated_at == "2023-05-05T21:28:37Z"
|
39
|
+
card.debit == "NO"
|
40
|
+
card.payroll == "NO"
|
41
|
+
card.prepaid == "NO"
|
42
|
+
card.healthcare == "NO"
|
43
|
+
card.token == "token1"
|
44
|
+
card.unique_number_identifier == "abc1234"
|
45
|
+
card.expiration_month.should == "05"
|
46
|
+
card.expiration_year.should == "2024"
|
47
|
+
card.last_4.should == "1234"
|
48
|
+
end
|
49
|
+
|
50
|
+
it "sets expiration date correctly" do
|
51
|
+
card = Braintree::MetaCheckoutCard._new(:gateway, attributes)
|
52
|
+
card.expiration_date.should == "05/2024"
|
53
|
+
end
|
54
|
+
|
55
|
+
it "masks the card number correctly" do
|
56
|
+
card = Braintree::MetaCheckoutCard._new(:gateway, attributes)
|
57
|
+
card.masked_number.should == "abc1234******1234"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::Transaction::MetaCheckoutTokenDetails do
|
4
|
+
let(:attributes) do {
|
5
|
+
:bin => "abc1234",
|
6
|
+
:container_id => "a-container-id",
|
7
|
+
:card_type => "Visa",
|
8
|
+
:cardholder_name => "Meta Checkout Card CardHolder",
|
9
|
+
:commercial => "NO",
|
10
|
+
:country_of_issuance => "US",
|
11
|
+
:created_at => "2023-05-05T21:28:37Z",
|
12
|
+
:debit => "NO",
|
13
|
+
:durbin_regulated => "NO",
|
14
|
+
:expiration_month => "05",
|
15
|
+
:expiration_year => "2024",
|
16
|
+
:healthcare => "NO",
|
17
|
+
:last_4 => "1234",
|
18
|
+
:payroll => "NO",
|
19
|
+
:prepaid => "NO",
|
20
|
+
:token => "token1",
|
21
|
+
:unique_number_identifier => "abc1234",
|
22
|
+
:updated_at => "2023-05-05T21:28:37Z",
|
23
|
+
:cryptogram => "AlhlvxmN2ZKuAAESNFZ4GoABFA==",
|
24
|
+
:ecommerce_indicator => "07"
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "unit tests" do
|
29
|
+
it "initializes with the correct attributes" do
|
30
|
+
card = Braintree::Transaction::MetaCheckoutTokenDetails.new(attributes)
|
31
|
+
|
32
|
+
card.bin.should == "abc1234"
|
33
|
+
card.container_id.should == "a-container-id"
|
34
|
+
card.card_type.should == "Visa"
|
35
|
+
card.cardholder_name.should == "Meta Checkout Card CardHolder"
|
36
|
+
card.commercial == "NO"
|
37
|
+
card.country_of_issuance == "US"
|
38
|
+
card.created_at == "2023-05-05T21:28:37Z"
|
39
|
+
card.updated_at == "2023-05-05T21:28:37Z"
|
40
|
+
card.debit == "NO"
|
41
|
+
card.payroll == "NO"
|
42
|
+
card.prepaid == "NO"
|
43
|
+
card.healthcare == "NO"
|
44
|
+
card.token == "token1"
|
45
|
+
card.unique_number_identifier == "abc1234"
|
46
|
+
card.expiration_month.should == "05"
|
47
|
+
card.expiration_year.should == "2024"
|
48
|
+
card.last_4.should == "1234"
|
49
|
+
card.cryptogram == "AlhlvxmN2ZKuAAESNFZ4GoABFA=="
|
50
|
+
card.ecommerce_indicator == "07"
|
51
|
+
end
|
52
|
+
|
53
|
+
it "sets expiration date correctly" do
|
54
|
+
card = Braintree::Transaction::MetaCheckoutTokenDetails.new(attributes)
|
55
|
+
card.expiration_date.should == "05/2024"
|
56
|
+
end
|
57
|
+
|
58
|
+
it "masks the card number correctly" do
|
59
|
+
card = Braintree::Transaction::MetaCheckoutTokenDetails.new(attributes)
|
60
|
+
card.masked_number.should == "abc1234******1234"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::MetaCheckoutToken do
|
4
|
+
let(:attributes) do {
|
5
|
+
:bin => "abc1234",
|
6
|
+
:container_id => "a-container-id",
|
7
|
+
:card_type => "Visa",
|
8
|
+
:cardholder_name => "Meta Checkout Card CardHolder",
|
9
|
+
:commercial => "NO",
|
10
|
+
:country_of_issuance => "US",
|
11
|
+
:created_at => "2023-05-05T21:28:37Z",
|
12
|
+
:debit => "NO",
|
13
|
+
:durbin_regulated => "NO",
|
14
|
+
:expiration_month => "05",
|
15
|
+
:expiration_year => "2024",
|
16
|
+
:healthcare => "NO",
|
17
|
+
:last_4 => "1234",
|
18
|
+
:payroll => "NO",
|
19
|
+
:prepaid => "NO",
|
20
|
+
:token => "token1",
|
21
|
+
:unique_number_identifier => "abc1234",
|
22
|
+
:updated_at => "2023-05-05T21:28:37Z",
|
23
|
+
:cryptogram => "AlhlvxmN2ZKuAAESNFZ4GoABFA==",
|
24
|
+
:ecommerce_indicator => "07"
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "unit tests" do
|
29
|
+
it "initializes with the correct attributes" do
|
30
|
+
card = Braintree::MetaCheckoutToken._new(:gateway, attributes)
|
31
|
+
|
32
|
+
card.bin.should == "abc1234"
|
33
|
+
card.container_id.should == "a-container-id"
|
34
|
+
card.card_type.should == "Visa"
|
35
|
+
card.cardholder_name.should == "Meta Checkout Card CardHolder"
|
36
|
+
card.commercial == "NO"
|
37
|
+
card.country_of_issuance == "US"
|
38
|
+
card.created_at == "2023-05-05T21:28:37Z"
|
39
|
+
card.updated_at == "2023-05-05T21:28:37Z"
|
40
|
+
card.debit == "NO"
|
41
|
+
card.payroll == "NO"
|
42
|
+
card.prepaid == "NO"
|
43
|
+
card.healthcare == "NO"
|
44
|
+
card.token == "token1"
|
45
|
+
card.unique_number_identifier == "abc1234"
|
46
|
+
card.expiration_month.should == "05"
|
47
|
+
card.expiration_year.should == "2024"
|
48
|
+
card.last_4.should == "1234"
|
49
|
+
card.cryptogram == "AlhlvxmN2ZKuAAESNFZ4GoABFA=="
|
50
|
+
card.ecommerce_indicator == "07"
|
51
|
+
end
|
52
|
+
|
53
|
+
it "sets expiration date correctly" do
|
54
|
+
card = Braintree::MetaCheckoutToken._new(:gateway, attributes)
|
55
|
+
card.expiration_date.should == "05/2024"
|
56
|
+
end
|
57
|
+
|
58
|
+
it "masks the card number correctly" do
|
59
|
+
card = Braintree::MetaCheckoutToken._new(:gateway, attributes)
|
60
|
+
card.masked_number.should == "abc1234******1234"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -94,7 +94,7 @@ describe Braintree::TransactionGateway do
|
|
94
94
|
{:industry => [
|
95
95
|
:industry_type,
|
96
96
|
{:data => [
|
97
|
-
:folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
|
97
|
+
:country_code, :date_of_birth, :folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
|
98
98
|
:passenger_first_name, :passenger_last_name, :passenger_middle_initial, :passenger_title, :issued_date, :travel_agency_name, :travel_agency_code, :ticket_number,
|
99
99
|
:issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket, :no_show, :advanced_deposit, :fire_safe, :property_phone, :ticket_issuer_address, :arrival_date,
|
100
100
|
{:legs => [
|
@@ -111,5 +111,34 @@ describe Braintree::TransactionGateway do
|
|
111
111
|
{:installments => [:count]},
|
112
112
|
])
|
113
113
|
end
|
114
|
+
|
115
|
+
it "creates a transaction gateway submit for settlement signature" do
|
116
|
+
expect(Braintree::TransactionGateway._submit_for_settlement_signature).to match([
|
117
|
+
:order_id,
|
118
|
+
{:descriptor => [:name, :phone, :url]},
|
119
|
+
{:industry => [
|
120
|
+
:industry_type,
|
121
|
+
{:data => [
|
122
|
+
:country_code, :date_of_birth, :folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
|
123
|
+
:passenger_first_name, :passenger_last_name, :passenger_middle_initial, :passenger_title, :issued_date, :travel_agency_name, :travel_agency_code, :ticket_number,
|
124
|
+
:issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket, :no_show, :advanced_deposit, :fire_safe, :property_phone, :ticket_issuer_address, :arrival_date,
|
125
|
+
{:legs => [
|
126
|
+
:conjunction_ticket, :exchange_ticket, :coupon_number, :service_class, :carrier_code, :fare_basis_code, :flight_number, :departure_date, :departure_airport_code, :departure_time,
|
127
|
+
:arrival_airport_code, :arrival_time, :stopover_permitted, :fare_amount, :fee_amount, :tax_amount, :endorsement_or_restrictions,
|
128
|
+
]},
|
129
|
+
{:additional_charges => [
|
130
|
+
:kind, :amount,
|
131
|
+
]},
|
132
|
+
]},
|
133
|
+
]},
|
134
|
+
:purchase_order_number,
|
135
|
+
:tax_amount,
|
136
|
+
:tax_exempt,
|
137
|
+
:discount_amount,
|
138
|
+
:shipping_amount,
|
139
|
+
:ships_from_postal_code,
|
140
|
+
:line_items => [:commodity_code, :description, :discount_amount, :kind, :name, :product_code, :quantity, :tax_amount, :total_amount, :unit_amount, :unit_of_measure, :unit_tax_amount, :url, :tax_amount],
|
141
|
+
])
|
142
|
+
end
|
114
143
|
end
|
115
144
|
end
|
@@ -8,12 +8,17 @@ describe Braintree::UsBankAccountVerification do
|
|
8
8
|
:status => Braintree::UsBankAccountVerification::Status::Verified,
|
9
9
|
:verification_method => Braintree::UsBankAccountVerification::VerificationMethod::IndependentCheck,
|
10
10
|
:verification_determined_at => "2018-02-28T12:01:01Z",
|
11
|
+
:additional_processor_response => "some_invalid_processor_response",
|
11
12
|
)
|
12
13
|
end
|
13
14
|
|
14
15
|
it "has a status" do
|
15
16
|
expect(verification.status).to eq(Braintree::UsBankAccountVerification::Status::Verified)
|
16
17
|
end
|
18
|
+
|
19
|
+
it "has additional processor response" do
|
20
|
+
expect(verification.additional_processor_response).to eq("some_invalid_processor_response")
|
21
|
+
end
|
17
22
|
end
|
18
23
|
|
19
24
|
describe "self.confirm_micro_transfer_amounts" do
|