braintree 2.93.0 → 2.94.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 +4 -4
- data/lib/braintree.rb +2 -0
- data/lib/braintree/error_codes.rb +1 -0
- data/lib/braintree/payment_method_gateway.rb +32 -43
- data/lib/braintree/payment_method_parser.rb +32 -0
- data/lib/braintree/revoked_payment_method_metadata.rb +22 -0
- data/lib/braintree/util.rb +1 -1
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/webhook_notification.rb +3 -0
- data/spec/fixtures/files/too_long.pdf +0 -0
- data/spec/integration/braintree/add_on_spec.rb +1 -1
- data/spec/integration/braintree/credit_card_spec.rb +10 -10
- data/spec/integration/braintree/customer_spec.rb +9 -9
- data/spec/integration/braintree/discount_spec.rb +1 -1
- data/spec/integration/braintree/document_upload_spec.rb +7 -0
- data/spec/integration/braintree/ideal_payment_spec.rb +2 -2
- data/spec/integration/braintree/payment_method_nonce_spec.rb +19 -0
- data/spec/integration/braintree/payment_method_spec.rb +2 -2
- data/spec/integration/braintree/paypal_account_spec.rb +2 -2
- data/spec/integration/braintree/subscription_spec.rb +39 -39
- data/spec/integration/braintree/transaction_line_item_spec.rb +3 -3
- data/spec/integration/braintree/transaction_search_spec.rb +2 -2
- data/spec/integration/braintree/transaction_spec.rb +60 -60
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +7 -7
- data/spec/integration/braintree/transparent_redirect_spec.rb +2 -2
- data/spec/integration/braintree/us_bank_account_spec.rb +2 -2
- data/spec/spec_helper.rb +4 -4
- data/spec/unit/braintree/credit_card_verification_spec.rb +2 -2
- data/spec/unit/braintree/modification_spec.rb +1 -1
- data/spec/unit/braintree/subscription_spec.rb +2 -2
- data/spec/unit/braintree/transaction_spec.rb +2 -2
- data/spec/unit/braintree/util_spec.rb +2 -2
- data/spec/unit/braintree/webhook_notification_spec.rb +133 -0
- data/spec/unit/braintree/xml_spec.rb +3 -3
- metadata +5 -2
@@ -14,7 +14,7 @@ describe Braintree::IdealPayment do
|
|
14
14
|
)
|
15
15
|
|
16
16
|
result.success?.should == true
|
17
|
-
result.transaction.amount.should == BigDecimal
|
17
|
+
result.transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
18
18
|
result.transaction.type.should == "sale"
|
19
19
|
ideal_payment_details = result.transaction.ideal_payment_details
|
20
20
|
ideal_payment_details.ideal_payment_id.should =~ /^idealpayment_\w{6,}$/
|
@@ -36,7 +36,7 @@ describe Braintree::IdealPayment do
|
|
36
36
|
:amount => Braintree::Test::TransactionAmounts::Authorize
|
37
37
|
)
|
38
38
|
|
39
|
-
transaction.amount.should == BigDecimal
|
39
|
+
transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
40
40
|
transaction.type.should == "sale"
|
41
41
|
ideal_payment_details = transaction.ideal_payment_details
|
42
42
|
ideal_payment_details.ideal_payment_id.should =~ /^idealpayment_\w{6,}$/
|
@@ -83,6 +83,16 @@ describe Braintree::PaymentMethodNonce do
|
|
83
83
|
nonce.details.fetch(:card_type).should == "Visa"
|
84
84
|
end
|
85
85
|
|
86
|
+
it "return venmo details if details exist" do
|
87
|
+
result = Braintree::PaymentMethodNonce.find("fake-venmo-account-nonce")
|
88
|
+
|
89
|
+
nonce = result.payment_method_nonce
|
90
|
+
|
91
|
+
nonce.details.fetch(:last_two).should == "99"
|
92
|
+
nonce.details.fetch(:username).should == "venmojoe"
|
93
|
+
nonce.details.fetch(:venmo_user_id).should == "Venmo-Joe-1"
|
94
|
+
end
|
95
|
+
|
86
96
|
it "returns null 3ds_info if there isn't any" do
|
87
97
|
nonce = nonce_for_new_payment_method(
|
88
98
|
:credit_card => {
|
@@ -100,6 +110,15 @@ describe Braintree::PaymentMethodNonce do
|
|
100
110
|
nonce.three_d_secure_info.should be_nil
|
101
111
|
end
|
102
112
|
|
113
|
+
it "returns the bin" do
|
114
|
+
result = Braintree::PaymentMethodNonce.find("fake-valid-visa-nonce")
|
115
|
+
|
116
|
+
nonce = result.payment_method_nonce
|
117
|
+
result.should be_success
|
118
|
+
nonce.details.should_not be_nil
|
119
|
+
nonce.details[:bin].should == "401288"
|
120
|
+
end
|
121
|
+
|
103
122
|
it "returns bin_data with commercial set to Yes" do
|
104
123
|
result = Braintree::PaymentMethodNonce.find("fake-valid-commercial-nonce")
|
105
124
|
|
@@ -295,7 +295,7 @@ describe Braintree::PaymentMethod do
|
|
295
295
|
result.credit_card_verification.status.should == Braintree::Transaction::Status::ProcessorDeclined
|
296
296
|
result.credit_card_verification.processor_response_code.should == "2000"
|
297
297
|
result.credit_card_verification.processor_response_text.should == "Do Not Honor"
|
298
|
-
result.credit_card_verification.amount.should == BigDecimal
|
298
|
+
result.credit_card_verification.amount.should == BigDecimal("100.00")
|
299
299
|
end
|
300
300
|
|
301
301
|
it "respects fail_on_duplicate_payment_method when included outside of the nonce" do
|
@@ -759,7 +759,7 @@ describe Braintree::PaymentMethod do
|
|
759
759
|
found_card.subscriptions.first.id.should == subscription.id
|
760
760
|
found_card.subscriptions.first.plan_id.should == "integration_trialless_plan"
|
761
761
|
found_card.subscriptions.first.payment_method_token.should == credit_card.token
|
762
|
-
found_card.subscriptions.first.price.should == BigDecimal
|
762
|
+
found_card.subscriptions.first.price.should == BigDecimal("1.00")
|
763
763
|
end
|
764
764
|
end
|
765
765
|
|
@@ -272,7 +272,7 @@ describe Braintree::PayPalAccount do
|
|
272
272
|
result = Braintree::PayPalAccount.sale(customer.paypal_accounts[0].token, :amount => "100.00")
|
273
273
|
|
274
274
|
result.success?.should == true
|
275
|
-
result.transaction.amount.should == BigDecimal
|
275
|
+
result.transaction.amount.should == BigDecimal("100.00")
|
276
276
|
result.transaction.type.should == "sale"
|
277
277
|
result.transaction.customer_details.id.should == customer.id
|
278
278
|
result.transaction.paypal_details.token.should == customer.paypal_accounts[0].token
|
@@ -287,7 +287,7 @@ describe Braintree::PayPalAccount do
|
|
287
287
|
|
288
288
|
transaction = Braintree::PayPalAccount.sale!(customer.paypal_accounts[0].token, :amount => "100.00")
|
289
289
|
|
290
|
-
transaction.amount.should == BigDecimal
|
290
|
+
transaction.amount.should == BigDecimal("100.00")
|
291
291
|
transaction.type.should == "sale"
|
292
292
|
transaction.customer_details.id.should == customer.id
|
293
293
|
transaction.paypal_details.token.should == customer.paypal_accounts[0].token
|
@@ -359,7 +359,7 @@ describe Braintree::Subscription do
|
|
359
359
|
:price => 98.76
|
360
360
|
)
|
361
361
|
|
362
|
-
result.subscription.price.should == BigDecimal
|
362
|
+
result.subscription.price.should == BigDecimal("98.76")
|
363
363
|
end
|
364
364
|
end
|
365
365
|
end
|
@@ -445,14 +445,14 @@ describe Braintree::Subscription do
|
|
445
445
|
add_ons = subscription.add_ons.sort_by { |add_on| add_on.id }
|
446
446
|
|
447
447
|
add_ons.first.id.should == "increase_10"
|
448
|
-
add_ons.first.amount.should == BigDecimal
|
448
|
+
add_ons.first.amount.should == BigDecimal("10.00")
|
449
449
|
add_ons.first.quantity.should == 1
|
450
450
|
add_ons.first.number_of_billing_cycles.should be_nil
|
451
451
|
add_ons.first.never_expires?.should be(true)
|
452
452
|
add_ons.first.current_billing_cycle.should == 0
|
453
453
|
|
454
454
|
add_ons.last.id.should == "increase_20"
|
455
|
-
add_ons.last.amount.should == BigDecimal
|
455
|
+
add_ons.last.amount.should == BigDecimal("20.00")
|
456
456
|
add_ons.last.quantity.should == 1
|
457
457
|
add_ons.last.number_of_billing_cycles.should be_nil
|
458
458
|
add_ons.last.never_expires?.should be(true)
|
@@ -462,14 +462,14 @@ describe Braintree::Subscription do
|
|
462
462
|
discounts = subscription.discounts.sort_by { |discount| discount.id }
|
463
463
|
|
464
464
|
discounts.first.id.should == "discount_11"
|
465
|
-
discounts.first.amount.should == BigDecimal
|
465
|
+
discounts.first.amount.should == BigDecimal("11.00")
|
466
466
|
discounts.first.quantity.should == 1
|
467
467
|
discounts.first.number_of_billing_cycles.should be_nil
|
468
468
|
discounts.first.never_expires?.should be(true)
|
469
469
|
discounts.first.current_billing_cycle.should == 0
|
470
470
|
|
471
471
|
discounts.last.id.should == "discount_7"
|
472
|
-
discounts.last.amount.should == BigDecimal
|
472
|
+
discounts.last.amount.should == BigDecimal("7.00")
|
473
473
|
discounts.last.quantity.should == 1
|
474
474
|
discounts.last.number_of_billing_cycles.should be_nil
|
475
475
|
discounts.last.never_expires?.should be(true)
|
@@ -483,7 +483,7 @@ describe Braintree::Subscription do
|
|
483
483
|
:add_ons => {
|
484
484
|
:update => [
|
485
485
|
{
|
486
|
-
:amount => BigDecimal
|
486
|
+
:amount => BigDecimal("50.00"),
|
487
487
|
:existing_id => SpecHelper::AddOnIncrease10,
|
488
488
|
:quantity => 2,
|
489
489
|
:number_of_billing_cycles => 5
|
@@ -493,7 +493,7 @@ describe Braintree::Subscription do
|
|
493
493
|
:discounts => {
|
494
494
|
:update => [
|
495
495
|
{
|
496
|
-
:amount => BigDecimal
|
496
|
+
:amount => BigDecimal("15.00"),
|
497
497
|
:existing_id => SpecHelper::Discount7,
|
498
498
|
:quantity => 3,
|
499
499
|
:never_expires => true
|
@@ -509,14 +509,14 @@ describe Braintree::Subscription do
|
|
509
509
|
add_ons = subscription.add_ons.sort_by { |add_on| add_on.id }
|
510
510
|
|
511
511
|
add_ons.first.id.should == "increase_10"
|
512
|
-
add_ons.first.amount.should == BigDecimal
|
512
|
+
add_ons.first.amount.should == BigDecimal("50.00")
|
513
513
|
add_ons.first.quantity.should == 2
|
514
514
|
add_ons.first.number_of_billing_cycles.should == 5
|
515
515
|
add_ons.first.never_expires?.should be(false)
|
516
516
|
add_ons.first.current_billing_cycle.should == 0
|
517
517
|
|
518
518
|
add_ons.last.id.should == "increase_20"
|
519
|
-
add_ons.last.amount.should == BigDecimal
|
519
|
+
add_ons.last.amount.should == BigDecimal("20.00")
|
520
520
|
add_ons.last.quantity.should == 1
|
521
521
|
add_ons.last.current_billing_cycle.should == 0
|
522
522
|
|
@@ -524,12 +524,12 @@ describe Braintree::Subscription do
|
|
524
524
|
discounts = subscription.discounts.sort_by { |discount| discount.id }
|
525
525
|
|
526
526
|
discounts.first.id.should == "discount_11"
|
527
|
-
discounts.first.amount.should == BigDecimal
|
527
|
+
discounts.first.amount.should == BigDecimal("11.00")
|
528
528
|
discounts.first.quantity.should == 1
|
529
529
|
discounts.first.current_billing_cycle.should == 0
|
530
530
|
|
531
531
|
discounts.last.id.should == "discount_7"
|
532
|
-
discounts.last.amount.should == BigDecimal
|
532
|
+
discounts.last.amount.should == BigDecimal("15.00")
|
533
533
|
discounts.last.quantity.should == 3
|
534
534
|
discounts.last.number_of_billing_cycles.should be_nil
|
535
535
|
discounts.last.never_expires?.should be(true)
|
@@ -553,13 +553,13 @@ describe Braintree::Subscription do
|
|
553
553
|
|
554
554
|
subscription.add_ons.size.should == 1
|
555
555
|
subscription.add_ons.first.id.should == "increase_20"
|
556
|
-
subscription.add_ons.first.amount.should == BigDecimal
|
556
|
+
subscription.add_ons.first.amount.should == BigDecimal("20.00")
|
557
557
|
subscription.add_ons.first.quantity.should == 1
|
558
558
|
subscription.add_ons.first.current_billing_cycle.should == 0
|
559
559
|
|
560
560
|
subscription.discounts.size.should == 1
|
561
561
|
subscription.discounts.last.id.should == "discount_11"
|
562
|
-
subscription.discounts.last.amount.should == BigDecimal
|
562
|
+
subscription.discounts.last.amount.should == BigDecimal("11.00")
|
563
563
|
subscription.discounts.last.quantity.should == 1
|
564
564
|
subscription.discounts.last.current_billing_cycle.should == 0
|
565
565
|
end
|
@@ -582,30 +582,30 @@ describe Braintree::Subscription do
|
|
582
582
|
add_ons = subscription.add_ons.sort_by { |add_on| add_on.id }
|
583
583
|
|
584
584
|
add_ons[0].id.should == "increase_10"
|
585
|
-
add_ons[0].amount.should == BigDecimal
|
585
|
+
add_ons[0].amount.should == BigDecimal("10.00")
|
586
586
|
add_ons[0].quantity.should == 1
|
587
587
|
|
588
588
|
add_ons[1].id.should == "increase_20"
|
589
|
-
add_ons[1].amount.should == BigDecimal
|
589
|
+
add_ons[1].amount.should == BigDecimal("20.00")
|
590
590
|
add_ons[1].quantity.should == 1
|
591
591
|
|
592
592
|
add_ons[2].id.should == "increase_30"
|
593
|
-
add_ons[2].amount.should == BigDecimal
|
593
|
+
add_ons[2].amount.should == BigDecimal("30.00")
|
594
594
|
add_ons[2].quantity.should == 1
|
595
595
|
|
596
596
|
subscription.discounts.size.should == 3
|
597
597
|
discounts = subscription.discounts.sort_by { |discount| discount.id }
|
598
598
|
|
599
599
|
discounts[0].id.should == "discount_11"
|
600
|
-
discounts[0].amount.should == BigDecimal
|
600
|
+
discounts[0].amount.should == BigDecimal("11.00")
|
601
601
|
discounts[0].quantity.should == 1
|
602
602
|
|
603
603
|
discounts[1].id.should == "discount_15"
|
604
|
-
discounts[1].amount.should == BigDecimal
|
604
|
+
discounts[1].amount.should == BigDecimal("15.00")
|
605
605
|
discounts[1].quantity.should == 1
|
606
606
|
|
607
607
|
discounts[2].id.should == "discount_7"
|
608
|
-
discounts[2].amount.should == BigDecimal
|
608
|
+
discounts[2].amount.should == BigDecimal("7.00")
|
609
609
|
discounts[2].quantity.should == 1
|
610
610
|
end
|
611
611
|
|
@@ -824,7 +824,7 @@ describe Braintree::Subscription do
|
|
824
824
|
result.success?.should == true
|
825
825
|
result.subscription.id.should =~ /#{new_id}/
|
826
826
|
result.subscription.plan_id.should == SpecHelper::TrialPlan[:id]
|
827
|
-
result.subscription.price.should == BigDecimal
|
827
|
+
result.subscription.price.should == BigDecimal("9999.88")
|
828
828
|
end
|
829
829
|
|
830
830
|
context "proration" do
|
@@ -1022,7 +1022,7 @@ describe Braintree::Subscription do
|
|
1022
1022
|
:update => [
|
1023
1023
|
{
|
1024
1024
|
:existing_id => subscription.add_ons.first.id,
|
1025
|
-
:amount => BigDecimal
|
1025
|
+
:amount => BigDecimal("99.99"),
|
1026
1026
|
:quantity => 12
|
1027
1027
|
}
|
1028
1028
|
]
|
@@ -1031,7 +1031,7 @@ describe Braintree::Subscription do
|
|
1031
1031
|
:update => [
|
1032
1032
|
{
|
1033
1033
|
:existing_id => subscription.discounts.first.id,
|
1034
|
-
:amount => BigDecimal
|
1034
|
+
:amount => BigDecimal("88.88"),
|
1035
1035
|
:quantity => 9
|
1036
1036
|
}
|
1037
1037
|
]
|
@@ -1043,13 +1043,13 @@ describe Braintree::Subscription do
|
|
1043
1043
|
subscription.add_ons.size.should == 2
|
1044
1044
|
add_ons = subscription.add_ons.sort_by { |add_on| add_on.id }
|
1045
1045
|
|
1046
|
-
add_ons.first.amount.should == BigDecimal
|
1046
|
+
add_ons.first.amount.should == BigDecimal("99.99")
|
1047
1047
|
add_ons.first.quantity.should == 12
|
1048
1048
|
|
1049
1049
|
subscription.discounts.size.should == 2
|
1050
1050
|
discounts = subscription.discounts.sort_by { |discount| discount.id }
|
1051
1051
|
|
1052
|
-
discounts.last.amount.should == BigDecimal
|
1052
|
+
discounts.last.amount.should == BigDecimal("88.88")
|
1053
1053
|
discounts.last.quantity.should == 9
|
1054
1054
|
end
|
1055
1055
|
|
@@ -1075,30 +1075,30 @@ describe Braintree::Subscription do
|
|
1075
1075
|
add_ons = subscription.add_ons.sort_by { |add_on| add_on.id }
|
1076
1076
|
|
1077
1077
|
add_ons[0].id.should == "increase_10"
|
1078
|
-
add_ons[0].amount.should == BigDecimal
|
1078
|
+
add_ons[0].amount.should == BigDecimal("10.00")
|
1079
1079
|
add_ons[0].quantity.should == 1
|
1080
1080
|
|
1081
1081
|
add_ons[1].id.should == "increase_20"
|
1082
|
-
add_ons[1].amount.should == BigDecimal
|
1082
|
+
add_ons[1].amount.should == BigDecimal("20.00")
|
1083
1083
|
add_ons[1].quantity.should == 1
|
1084
1084
|
|
1085
1085
|
add_ons[2].id.should == "increase_30"
|
1086
|
-
add_ons[2].amount.should == BigDecimal
|
1086
|
+
add_ons[2].amount.should == BigDecimal("30.00")
|
1087
1087
|
add_ons[2].quantity.should == 1
|
1088
1088
|
|
1089
1089
|
subscription.discounts.size.should == 3
|
1090
1090
|
discounts = subscription.discounts.sort_by { |discount| discount.id }
|
1091
1091
|
|
1092
1092
|
discounts[0].id.should == "discount_11"
|
1093
|
-
discounts[0].amount.should == BigDecimal
|
1093
|
+
discounts[0].amount.should == BigDecimal("11.00")
|
1094
1094
|
discounts[0].quantity.should == 1
|
1095
1095
|
|
1096
1096
|
discounts[1].id.should == "discount_15"
|
1097
|
-
discounts[1].amount.should == BigDecimal
|
1097
|
+
discounts[1].amount.should == BigDecimal("15.00")
|
1098
1098
|
discounts[1].quantity.should == 1
|
1099
1099
|
|
1100
1100
|
discounts[2].id.should == "discount_7"
|
1101
|
-
discounts[2].amount.should == BigDecimal
|
1101
|
+
discounts[2].amount.should == BigDecimal("7.00")
|
1102
1102
|
discounts[2].quantity.should == 1
|
1103
1103
|
end
|
1104
1104
|
|
@@ -1123,12 +1123,12 @@ describe Braintree::Subscription do
|
|
1123
1123
|
|
1124
1124
|
subscription.add_ons.size.should == 1
|
1125
1125
|
|
1126
|
-
subscription.add_ons[0].amount.should == BigDecimal
|
1126
|
+
subscription.add_ons[0].amount.should == BigDecimal("30.00")
|
1127
1127
|
subscription.add_ons[0].quantity.should == 1
|
1128
1128
|
|
1129
1129
|
subscription.discounts.size.should == 1
|
1130
1130
|
|
1131
|
-
subscription.discounts[0].amount.should == BigDecimal
|
1131
|
+
subscription.discounts[0].amount.should == BigDecimal("15.00")
|
1132
1132
|
subscription.discounts[0].quantity.should == 1
|
1133
1133
|
end
|
1134
1134
|
|
@@ -1151,11 +1151,11 @@ describe Braintree::Subscription do
|
|
1151
1151
|
subscription = result.subscription
|
1152
1152
|
|
1153
1153
|
subscription.add_ons.size.should == 1
|
1154
|
-
subscription.add_ons.first.amount.should == BigDecimal
|
1154
|
+
subscription.add_ons.first.amount.should == BigDecimal("20.00")
|
1155
1155
|
subscription.add_ons.first.quantity.should == 1
|
1156
1156
|
|
1157
1157
|
subscription.discounts.size.should == 1
|
1158
|
-
subscription.discounts.last.amount.should == BigDecimal
|
1158
|
+
subscription.discounts.last.amount.should == BigDecimal("11.00")
|
1159
1159
|
subscription.discounts.last.quantity.should == 1
|
1160
1160
|
end
|
1161
1161
|
end
|
@@ -1180,7 +1180,7 @@ describe Braintree::Subscription do
|
|
1180
1180
|
|
1181
1181
|
subscription.id.should =~ /#{new_id}/
|
1182
1182
|
subscription.plan_id.should == SpecHelper::TrialPlan[:id]
|
1183
|
-
subscription.price.should == BigDecimal
|
1183
|
+
subscription.price.should == BigDecimal("9999.88")
|
1184
1184
|
end
|
1185
1185
|
|
1186
1186
|
it "raises a ValidationsFailed if invalid" do
|
@@ -1439,7 +1439,7 @@ describe Braintree::Subscription do
|
|
1439
1439
|
collection.should_not include(active_subscription)
|
1440
1440
|
collection.each do |s|
|
1441
1441
|
s.status.should == Braintree::Subscription::Status::PastDue
|
1442
|
-
s.balance.should == BigDecimal
|
1442
|
+
s.balance.should == BigDecimal("6.00")
|
1443
1443
|
end
|
1444
1444
|
end
|
1445
1445
|
|
@@ -1711,7 +1711,7 @@ describe Braintree::Subscription do
|
|
1711
1711
|
result.success?.should == true
|
1712
1712
|
transaction = result.transaction
|
1713
1713
|
|
1714
|
-
transaction.amount.should == BigDecimal
|
1714
|
+
transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
1715
1715
|
transaction.processor_authorization_code.should_not be_nil
|
1716
1716
|
transaction.type.should == Braintree::Transaction::Type::Sale
|
1717
1717
|
transaction.status.should == Braintree::Transaction::Status::Authorized
|
@@ -1729,7 +1729,7 @@ describe Braintree::Subscription do
|
|
1729
1729
|
result.success?.should == true
|
1730
1730
|
transaction = result.transaction
|
1731
1731
|
|
1732
|
-
transaction.amount.should == BigDecimal
|
1732
|
+
transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
1733
1733
|
transaction.processor_authorization_code.should_not be_nil
|
1734
1734
|
transaction.type.should == Braintree::Transaction::Type::Sale
|
1735
1735
|
transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
|
@@ -1747,7 +1747,7 @@ describe Braintree::Subscription do
|
|
1747
1747
|
result.success?.should == true
|
1748
1748
|
transaction = result.transaction
|
1749
1749
|
|
1750
|
-
transaction.amount.should == BigDecimal
|
1750
|
+
transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
1751
1751
|
transaction.processor_authorization_code.should_not be_nil
|
1752
1752
|
transaction.type.should == Braintree::Transaction::Type::Sale
|
1753
1753
|
transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
|
@@ -27,11 +27,11 @@ describe Braintree::TransactionLineItem do
|
|
27
27
|
line_items = Braintree::TransactionLineItem.find_all(transaction.id)
|
28
28
|
|
29
29
|
line_item = line_items[0]
|
30
|
-
line_item.quantity.should == BigDecimal
|
30
|
+
line_item.quantity.should == BigDecimal("1.0232")
|
31
31
|
line_item.name.should == "Name #1"
|
32
32
|
line_item.kind.should == "debit"
|
33
|
-
line_item.unit_amount.should == BigDecimal
|
34
|
-
line_item.total_amount.should == BigDecimal
|
33
|
+
line_item.unit_amount.should == BigDecimal("45.1232")
|
34
|
+
line_item.total_amount.should == BigDecimal("45.15")
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -538,7 +538,7 @@ describe Braintree::Transaction, "search" do
|
|
538
538
|
|
539
539
|
it "can also take BigDecimal for amount" do
|
540
540
|
transaction = Braintree::Transaction.sale!(
|
541
|
-
:amount => BigDecimal
|
541
|
+
:amount => BigDecimal("1000.00"),
|
542
542
|
:credit_card => {
|
543
543
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
544
544
|
:expiration_date => "05/12"
|
@@ -547,7 +547,7 @@ describe Braintree::Transaction, "search" do
|
|
547
547
|
|
548
548
|
collection = Braintree::Transaction.search do |search|
|
549
549
|
search.id.is transaction.id
|
550
|
-
search.amount <= BigDecimal
|
550
|
+
search.amount <= BigDecimal("1000.00")
|
551
551
|
end
|
552
552
|
|
553
553
|
collection.maximum_size.should == 1
|
@@ -41,7 +41,7 @@ describe Braintree::Transaction do
|
|
41
41
|
transaction = clone_result.transaction
|
42
42
|
|
43
43
|
transaction.id.should_not == result.transaction.id
|
44
|
-
transaction.amount.should == BigDecimal
|
44
|
+
transaction.amount.should == BigDecimal("112.44")
|
45
45
|
transaction.channel.should == "MyShoppingCartProvider"
|
46
46
|
|
47
47
|
transaction.billing_details.country_name.should == "Botswana"
|
@@ -363,7 +363,7 @@ describe Braintree::Transaction do
|
|
363
363
|
result.success?.should == true
|
364
364
|
result.transaction.id.should =~ /^\w{6,}$/
|
365
365
|
result.transaction.type.should == "sale"
|
366
|
-
result.transaction.amount.should == BigDecimal
|
366
|
+
result.transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
367
367
|
result.transaction.processor_authorization_code.should_not be_nil
|
368
368
|
result.transaction.voice_referral_number.should be_nil
|
369
369
|
result.transaction.credit_card_details.bin.should == Braintree::Test::CreditCardNumbers::Elo[0, 6]
|
@@ -385,7 +385,7 @@ describe Braintree::Transaction do
|
|
385
385
|
result.success?.should == true
|
386
386
|
result.transaction.id.should =~ /^\w{6,}$/
|
387
387
|
result.transaction.type.should == "sale"
|
388
|
-
result.transaction.amount.should == BigDecimal
|
388
|
+
result.transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
389
389
|
result.transaction.processor_authorization_code.should_not be_nil
|
390
390
|
result.transaction.processor_response_code.should == "1000"
|
391
391
|
result.transaction.processor_response_text.should == "Approved"
|
@@ -425,7 +425,7 @@ describe Braintree::Transaction do
|
|
425
425
|
result.success?.should == true
|
426
426
|
result.transaction.id.should =~ /^\w{6,}$/
|
427
427
|
result.transaction.type.should == "sale"
|
428
|
-
result.transaction.amount.should == BigDecimal
|
428
|
+
result.transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
429
429
|
result.transaction.processor_authorization_code.should_not be_nil
|
430
430
|
result.transaction.voice_referral_number.should be_nil
|
431
431
|
result.transaction.credit_card_details.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
|
@@ -1005,13 +1005,13 @@ describe Braintree::Transaction do
|
|
1005
1005
|
:add_ons => {
|
1006
1006
|
:add => [
|
1007
1007
|
{
|
1008
|
-
:amount => BigDecimal
|
1008
|
+
:amount => BigDecimal("11.00"),
|
1009
1009
|
:inherited_from_id => SpecHelper::AddOnIncrease10,
|
1010
1010
|
:quantity => 2,
|
1011
1011
|
:number_of_billing_cycles => 5
|
1012
1012
|
},
|
1013
1013
|
{
|
1014
|
-
:amount => BigDecimal
|
1014
|
+
:amount => BigDecimal("21.00"),
|
1015
1015
|
:inherited_from_id => SpecHelper::AddOnIncrease20,
|
1016
1016
|
:quantity => 3,
|
1017
1017
|
:number_of_billing_cycles => 6
|
@@ -1021,7 +1021,7 @@ describe Braintree::Transaction do
|
|
1021
1021
|
:discounts => {
|
1022
1022
|
:add => [
|
1023
1023
|
{
|
1024
|
-
:amount => BigDecimal
|
1024
|
+
:amount => BigDecimal("7.50"),
|
1025
1025
|
:inherited_from_id => SpecHelper::Discount7,
|
1026
1026
|
:quantity => 2,
|
1027
1027
|
:never_expires => true
|
@@ -1039,13 +1039,13 @@ describe Braintree::Transaction do
|
|
1039
1039
|
add_ons = transaction.add_ons.sort_by { |add_on| add_on.id }
|
1040
1040
|
|
1041
1041
|
add_ons.first.id.should == "increase_10"
|
1042
|
-
add_ons.first.amount.should == BigDecimal
|
1042
|
+
add_ons.first.amount.should == BigDecimal("11.00")
|
1043
1043
|
add_ons.first.quantity.should == 2
|
1044
1044
|
add_ons.first.number_of_billing_cycles.should == 5
|
1045
1045
|
add_ons.first.never_expires?.should be(false)
|
1046
1046
|
|
1047
1047
|
add_ons.last.id.should == "increase_20"
|
1048
|
-
add_ons.last.amount.should == BigDecimal
|
1048
|
+
add_ons.last.amount.should == BigDecimal("21.00")
|
1049
1049
|
add_ons.last.quantity.should == 3
|
1050
1050
|
add_ons.last.number_of_billing_cycles.should == 6
|
1051
1051
|
add_ons.last.never_expires?.should be(false)
|
@@ -1053,7 +1053,7 @@ describe Braintree::Transaction do
|
|
1053
1053
|
transaction.discounts.size.should == 1
|
1054
1054
|
|
1055
1055
|
transaction.discounts.first.id.should == "discount_7"
|
1056
|
-
transaction.discounts.first.amount.should == BigDecimal
|
1056
|
+
transaction.discounts.first.amount.should == BigDecimal("7.50")
|
1057
1057
|
transaction.discounts.first.quantity.should == 2
|
1058
1058
|
transaction.discounts.first.number_of_billing_cycles.should be_nil
|
1059
1059
|
transaction.discounts.first.never_expires?.should be(true)
|
@@ -1112,7 +1112,7 @@ describe Braintree::Transaction do
|
|
1112
1112
|
:purchase_order_number => '12345678901234567'
|
1113
1113
|
)
|
1114
1114
|
result.success?.should == true
|
1115
|
-
result.transaction.tax_amount.should == BigDecimal
|
1115
|
+
result.transaction.tax_amount.should == BigDecimal("0.05")
|
1116
1116
|
result.transaction.tax_exempt.should == false
|
1117
1117
|
result.transaction.purchase_order_number.should == '12345678901234567'
|
1118
1118
|
end
|
@@ -1124,11 +1124,11 @@ describe Braintree::Transaction do
|
|
1124
1124
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1125
1125
|
:expiration_date => "05/2009"
|
1126
1126
|
},
|
1127
|
-
:tax_amount => BigDecimal
|
1127
|
+
:tax_amount => BigDecimal('1.99'),
|
1128
1128
|
:tax_exempt => true
|
1129
1129
|
)
|
1130
1130
|
result.success?.should == true
|
1131
|
-
result.transaction.tax_amount.should == BigDecimal
|
1131
|
+
result.transaction.tax_amount.should == BigDecimal("1.99")
|
1132
1132
|
result.transaction.tax_exempt.should == true
|
1133
1133
|
result.transaction.purchase_order_number.should be_nil
|
1134
1134
|
end
|
@@ -1355,7 +1355,7 @@ describe Braintree::Transaction do
|
|
1355
1355
|
:service_fee_amount => "1.00"
|
1356
1356
|
)
|
1357
1357
|
result.success?.should == true
|
1358
|
-
result.transaction.service_fee_amount.should == BigDecimal
|
1358
|
+
result.transaction.service_fee_amount.should == BigDecimal("1.00")
|
1359
1359
|
end
|
1360
1360
|
|
1361
1361
|
it "raises an error if transaction merchant account is a master" do
|
@@ -2465,7 +2465,7 @@ describe Braintree::Transaction do
|
|
2465
2465
|
result.transaction.id.should =~ /^\w{6,}$/
|
2466
2466
|
result.transaction.type.should == "sale"
|
2467
2467
|
result.transaction.payment_instrument_type.should == Braintree::PaymentInstrumentType::IdealPayment
|
2468
|
-
result.transaction.amount.should == BigDecimal
|
2468
|
+
result.transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
2469
2469
|
result.transaction.status.should == Braintree::Transaction::Status::Settled
|
2470
2470
|
result.transaction.ideal_payment_details.ideal_payment_id.should =~ /^idealpayment_\w{6,}$/
|
2471
2471
|
result.transaction.ideal_payment_details.ideal_transaction_id.should =~ /^\d{16,}$/
|
@@ -2525,11 +2525,11 @@ describe Braintree::Transaction do
|
|
2525
2525
|
result.success?.should == true
|
2526
2526
|
result.transaction.line_items.length.should == 1
|
2527
2527
|
line_item = result.transaction.line_items[0]
|
2528
|
-
line_item.quantity.should == BigDecimal
|
2528
|
+
line_item.quantity.should == BigDecimal("1.0232")
|
2529
2529
|
line_item.name.should == "Name #1"
|
2530
2530
|
line_item.kind.should == "debit"
|
2531
|
-
line_item.unit_amount.should == BigDecimal
|
2532
|
-
line_item.total_amount.should == BigDecimal
|
2531
|
+
line_item.unit_amount.should == BigDecimal("45.1232")
|
2532
|
+
line_item.total_amount.should == BigDecimal("45.15")
|
2533
2533
|
end
|
2534
2534
|
|
2535
2535
|
it "allows creation with single line item with zero amount fields and returns it" do
|
@@ -2553,14 +2553,14 @@ describe Braintree::Transaction do
|
|
2553
2553
|
result.success?.should == true
|
2554
2554
|
result.transaction.line_items.length.should == 1
|
2555
2555
|
line_item = result.transaction.line_items[0]
|
2556
|
-
line_item.quantity.should == BigDecimal
|
2556
|
+
line_item.quantity.should == BigDecimal("1.0232")
|
2557
2557
|
line_item.name.should == "Name #1"
|
2558
2558
|
line_item.kind.should == "debit"
|
2559
|
-
line_item.unit_amount.should == BigDecimal
|
2560
|
-
line_item.total_amount.should == BigDecimal
|
2561
|
-
line_item.unit_tax_amount.should == BigDecimal
|
2562
|
-
line_item.discount_amount.should == BigDecimal
|
2563
|
-
line_item.tax_amount.should == BigDecimal
|
2559
|
+
line_item.unit_amount.should == BigDecimal("45.1232")
|
2560
|
+
line_item.total_amount.should == BigDecimal("45.15")
|
2561
|
+
line_item.unit_tax_amount.should == BigDecimal("0")
|
2562
|
+
line_item.discount_amount.should == BigDecimal("0")
|
2563
|
+
line_item.tax_amount.should == BigDecimal("0")
|
2564
2564
|
end
|
2565
2565
|
|
2566
2566
|
it "allows creation with single line item and returns it" do
|
@@ -2589,16 +2589,16 @@ describe Braintree::Transaction do
|
|
2589
2589
|
result.success?.should == true
|
2590
2590
|
result.transaction.line_items.length.should == 1
|
2591
2591
|
line_item = result.transaction.line_items[0]
|
2592
|
-
line_item.quantity.should == BigDecimal
|
2592
|
+
line_item.quantity.should == BigDecimal("1.0232")
|
2593
2593
|
line_item.name.should == "Name #1"
|
2594
2594
|
line_item.description.should == "Description #1"
|
2595
2595
|
line_item.kind.should == "debit"
|
2596
|
-
line_item.unit_amount.should == BigDecimal
|
2597
|
-
line_item.unit_tax_amount.should == BigDecimal
|
2596
|
+
line_item.unit_amount.should == BigDecimal("45.1232")
|
2597
|
+
line_item.unit_tax_amount.should == BigDecimal("1.23")
|
2598
2598
|
line_item.unit_of_measure.should == "gallon"
|
2599
|
-
line_item.discount_amount.should == BigDecimal
|
2600
|
-
line_item.tax_amount.should == BigDecimal
|
2601
|
-
line_item.total_amount.should == BigDecimal
|
2599
|
+
line_item.discount_amount.should == BigDecimal("1.02")
|
2600
|
+
line_item.tax_amount.should == BigDecimal("4.50")
|
2601
|
+
line_item.total_amount.should == BigDecimal("45.15")
|
2602
2602
|
line_item.product_code.should == "23434"
|
2603
2603
|
line_item.commodity_code.should == "9SAASSD8724"
|
2604
2604
|
line_item.url.should == "https://example.com/products/23434"
|
@@ -2636,24 +2636,24 @@ describe Braintree::Transaction do
|
|
2636
2636
|
result.success?.should == true
|
2637
2637
|
result.transaction.line_items.length.should == 2
|
2638
2638
|
line_item_1 = result.transaction.line_items.find { |line_item| line_item.name == "Name #1" }
|
2639
|
-
line_item_1.quantity.should == BigDecimal
|
2639
|
+
line_item_1.quantity.should == BigDecimal("1.0232")
|
2640
2640
|
line_item_1.name.should == "Name #1"
|
2641
2641
|
line_item_1.kind.should == "debit"
|
2642
|
-
line_item_1.unit_amount.should == BigDecimal
|
2642
|
+
line_item_1.unit_amount.should == BigDecimal("45.1232")
|
2643
2643
|
line_item_1.unit_of_measure.should == "gallon"
|
2644
|
-
line_item_1.discount_amount.should == BigDecimal
|
2645
|
-
line_item_1.tax_amount.should == BigDecimal
|
2646
|
-
line_item_1.total_amount.should == BigDecimal
|
2644
|
+
line_item_1.discount_amount.should == BigDecimal("1.02")
|
2645
|
+
line_item_1.tax_amount.should == BigDecimal("4.50")
|
2646
|
+
line_item_1.total_amount.should == BigDecimal("45.15")
|
2647
2647
|
line_item_1.product_code.should == "23434"
|
2648
2648
|
line_item_1.commodity_code.should == "9SAASSD8724"
|
2649
2649
|
line_item_2 = result.transaction.line_items.find { |line_item| line_item.name == "Name #2" }
|
2650
|
-
line_item_2.quantity.should == BigDecimal
|
2650
|
+
line_item_2.quantity.should == BigDecimal("2.02")
|
2651
2651
|
line_item_2.name.should == "Name #2"
|
2652
2652
|
line_item_2.kind.should == "credit"
|
2653
|
-
line_item_2.unit_amount.should == BigDecimal
|
2653
|
+
line_item_2.unit_amount.should == BigDecimal("5")
|
2654
2654
|
line_item_2.unit_of_measure.should == "gallon"
|
2655
|
-
line_item_2.total_amount.should == BigDecimal
|
2656
|
-
line_item_2.tax_amount.should == BigDecimal
|
2655
|
+
line_item_2.total_amount.should == BigDecimal("10.1")
|
2656
|
+
line_item_2.tax_amount.should == BigDecimal("1.50")
|
2657
2657
|
line_item_2.discount_amount.should == nil
|
2658
2658
|
line_item_2.product_code.should == nil
|
2659
2659
|
line_item_2.commodity_code.should == nil
|
@@ -3649,7 +3649,7 @@ describe Braintree::Transaction do
|
|
3649
3649
|
result.errors.for(:transaction).on(:line_items)[0].code.should == Braintree::ErrorCodes::Transaction::TooManyLineItems
|
3650
3650
|
end
|
3651
3651
|
end
|
3652
|
-
|
3652
|
+
|
3653
3653
|
context "level 3 summary data" do
|
3654
3654
|
it "accepts level 3 summary data" do
|
3655
3655
|
result = Braintree::Transaction.create(
|
@@ -3969,7 +3969,7 @@ describe Braintree::Transaction do
|
|
3969
3969
|
)
|
3970
3970
|
transaction.id.should =~ /^\w{6,}$/
|
3971
3971
|
transaction.type.should == "sale"
|
3972
|
-
transaction.amount.should == BigDecimal
|
3972
|
+
transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
3973
3973
|
transaction.credit_card_details.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
|
3974
3974
|
transaction.credit_card_details.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
|
3975
3975
|
transaction.credit_card_details.expiration_date.should == "05/2009"
|
@@ -4089,7 +4089,7 @@ describe Braintree::Transaction do
|
|
4089
4089
|
result.success?.should == true
|
4090
4090
|
result.transaction.id.should =~ /^\w{6,}$/
|
4091
4091
|
result.transaction.type.should == "sale"
|
4092
|
-
result.transaction.amount.should == BigDecimal
|
4092
|
+
result.transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
4093
4093
|
result.transaction.credit_card_details.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
|
4094
4094
|
result.transaction.credit_card_details.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
|
4095
4095
|
result.transaction.credit_card_details.expiration_date.should == "05/2009"
|
@@ -4143,7 +4143,7 @@ describe Braintree::Transaction do
|
|
4143
4143
|
transaction.id.should =~ /\A\w{6,}\z/
|
4144
4144
|
transaction.type.should == "sale"
|
4145
4145
|
transaction.status.should == Braintree::Transaction::Status::Authorized
|
4146
|
-
transaction.amount.should == BigDecimal
|
4146
|
+
transaction.amount.should == BigDecimal("100.00")
|
4147
4147
|
transaction.currency_iso_code.should == "USD"
|
4148
4148
|
transaction.order_id.should == "123"
|
4149
4149
|
transaction.channel.should == "MyShoppingCartProvider"
|
@@ -4671,7 +4671,7 @@ describe Braintree::Transaction do
|
|
4671
4671
|
)
|
4672
4672
|
transaction.id.should =~ /^\w{6,}$/
|
4673
4673
|
transaction.type.should == "sale"
|
4674
|
-
transaction.amount.should == BigDecimal
|
4674
|
+
transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
4675
4675
|
transaction.credit_card_details.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
|
4676
4676
|
transaction.credit_card_details.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
|
4677
4677
|
transaction.credit_card_details.expiration_date.should == "05/2009"
|
@@ -4711,10 +4711,10 @@ describe Braintree::Transaction do
|
|
4711
4711
|
:expiration_date => "06/2009"
|
4712
4712
|
}
|
4713
4713
|
)
|
4714
|
-
transaction.amount.should == BigDecimal
|
4714
|
+
transaction.amount.should == BigDecimal("1000.00")
|
4715
4715
|
result = Braintree::Transaction.submit_for_settlement(transaction.id, "999.99")
|
4716
4716
|
result.success?.should == true
|
4717
|
-
result.transaction.amount.should == BigDecimal
|
4717
|
+
result.transaction.amount.should == BigDecimal("999.99")
|
4718
4718
|
result.transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
|
4719
4719
|
result.transaction.updated_at.between?(Time.now - 60, Time.now).should == true
|
4720
4720
|
end
|
@@ -4783,7 +4783,7 @@ describe Braintree::Transaction do
|
|
4783
4783
|
:expiration_date => "06/2009"
|
4784
4784
|
}
|
4785
4785
|
)
|
4786
|
-
transaction.amount.should == BigDecimal
|
4786
|
+
transaction.amount.should == BigDecimal("1000.00")
|
4787
4787
|
result = Braintree::Transaction.submit_for_settlement(transaction.id, "1000.01")
|
4788
4788
|
result.success?.should == false
|
4789
4789
|
result.errors.for(:transaction).on(:amount)[0].code.should == Braintree::ErrorCodes::Transaction::SettlementAmountIsTooLarge
|
@@ -4846,7 +4846,7 @@ describe Braintree::Transaction do
|
|
4846
4846
|
:expiration_date => "06/2009"
|
4847
4847
|
}
|
4848
4848
|
)
|
4849
|
-
transaction.amount.should == BigDecimal
|
4849
|
+
transaction.amount.should == BigDecimal("1000.00")
|
4850
4850
|
expect do
|
4851
4851
|
Braintree::Transaction.submit_for_settlement!(transaction.id, "1000.01")
|
4852
4852
|
end.to raise_error(Braintree::ValidationsFailed)
|
@@ -4886,7 +4886,7 @@ describe Braintree::Transaction do
|
|
4886
4886
|
:order_id => '456'
|
4887
4887
|
})
|
4888
4888
|
result.success?.should == true
|
4889
|
-
result.transaction.amount.should == BigDecimal
|
4889
|
+
result.transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize) - 1
|
4890
4890
|
result.transaction.order_id.should == '456'
|
4891
4891
|
result.transaction.descriptor.name.should == '456*123456789012345678'
|
4892
4892
|
end
|
@@ -5216,7 +5216,7 @@ describe Braintree::Transaction do
|
|
5216
5216
|
:expiration_date => "06/2009"
|
5217
5217
|
}
|
5218
5218
|
)
|
5219
|
-
transaction.amount.should == BigDecimal
|
5219
|
+
transaction.amount.should == BigDecimal("1000.00")
|
5220
5220
|
expect do
|
5221
5221
|
Braintree::Transaction.submit_for_partial_settlement!(transaction.id, "1000.01")
|
5222
5222
|
end.to raise_error(Braintree::ValidationsFailed)
|
@@ -5330,7 +5330,7 @@ describe Braintree::Transaction do
|
|
5330
5330
|
result.success?.should == true
|
5331
5331
|
result.transaction.id.should =~ /^\w{6,}$/
|
5332
5332
|
result.transaction.type.should == "credit"
|
5333
|
-
result.transaction.amount.should == BigDecimal
|
5333
|
+
result.transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
5334
5334
|
result.transaction.credit_card_details.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
|
5335
5335
|
result.transaction.credit_card_details.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
|
5336
5336
|
result.transaction.credit_card_details.expiration_date.should == "05/2009"
|
@@ -5405,7 +5405,7 @@ describe Braintree::Transaction do
|
|
5405
5405
|
)
|
5406
5406
|
transaction.id.should =~ /^\w{6,}$/
|
5407
5407
|
transaction.type.should == "credit"
|
5408
|
-
transaction.amount.should == BigDecimal
|
5408
|
+
transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
5409
5409
|
transaction.credit_card_details.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
|
5410
5410
|
transaction.credit_card_details.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
|
5411
5411
|
transaction.credit_card_details.expiration_date.should == "05/2009"
|
@@ -5447,7 +5447,7 @@ describe Braintree::Transaction do
|
|
5447
5447
|
result.success?.should == true
|
5448
5448
|
transaction = result.transaction
|
5449
5449
|
transaction.type.should == "sale"
|
5450
|
-
transaction.amount.should == BigDecimal
|
5450
|
+
transaction.amount.should == BigDecimal("1000.00")
|
5451
5451
|
transaction.credit_card_details.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
|
5452
5452
|
transaction.credit_card_details.last_4.should == Braintree::Test::CreditCardNumbers::Visa[-4..-1]
|
5453
5453
|
transaction.credit_card_details.expiration_date.should == "05/2009"
|
@@ -5534,7 +5534,7 @@ describe Braintree::Transaction do
|
|
5534
5534
|
transaction.id.should =~ /\A\w{6,}\z/
|
5535
5535
|
transaction.type.should == "sale"
|
5536
5536
|
transaction.status.should == Braintree::Transaction::Status::Authorized
|
5537
|
-
transaction.amount.should == BigDecimal
|
5537
|
+
transaction.amount.should == BigDecimal("100.00")
|
5538
5538
|
transaction.order_id.should == "123"
|
5539
5539
|
transaction.channel.should == "MyShoppingCartProvider"
|
5540
5540
|
transaction.processor_response_code.should == "1000"
|
@@ -5965,10 +5965,10 @@ describe Braintree::Transaction do
|
|
5965
5965
|
:expiration_date => "06/2009"
|
5966
5966
|
}
|
5967
5967
|
)
|
5968
|
-
transaction.amount.should == BigDecimal
|
5968
|
+
transaction.amount.should == BigDecimal("1000.00")
|
5969
5969
|
result = transaction.submit_for_settlement("999.99")
|
5970
5970
|
result.success?.should == true
|
5971
|
-
transaction.amount.should == BigDecimal
|
5971
|
+
transaction.amount.should == BigDecimal("999.99")
|
5972
5972
|
end
|
5973
5973
|
|
5974
5974
|
it "updates the transaction attributes" do
|
@@ -5979,10 +5979,10 @@ describe Braintree::Transaction do
|
|
5979
5979
|
:expiration_date => "06/2009"
|
5980
5980
|
}
|
5981
5981
|
)
|
5982
|
-
transaction.amount.should == BigDecimal
|
5982
|
+
transaction.amount.should == BigDecimal("1000.00")
|
5983
5983
|
result = transaction.submit_for_settlement("999.99")
|
5984
5984
|
result.success?.should == true
|
5985
|
-
transaction.amount.should == BigDecimal
|
5985
|
+
transaction.amount.should == BigDecimal("999.99")
|
5986
5986
|
transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
|
5987
5987
|
transaction.updated_at.between?(Time.now - 60, Time.now).should == true
|
5988
5988
|
end
|
@@ -5995,7 +5995,7 @@ describe Braintree::Transaction do
|
|
5995
5995
|
:expiration_date => "06/2009"
|
5996
5996
|
}
|
5997
5997
|
)
|
5998
|
-
transaction.amount.should == BigDecimal
|
5998
|
+
transaction.amount.should == BigDecimal("1000.00")
|
5999
5999
|
result = transaction.submit_for_settlement("1000.01")
|
6000
6000
|
result.success?.should == false
|
6001
6001
|
result.errors.for(:transaction).on(:amount)[0].code.should == Braintree::ErrorCodes::Transaction::SettlementAmountIsTooLarge
|
@@ -6025,7 +6025,7 @@ describe Braintree::Transaction do
|
|
6025
6025
|
:expiration_date => "06/2009"
|
6026
6026
|
}
|
6027
6027
|
)
|
6028
|
-
transaction.amount.should == BigDecimal
|
6028
|
+
transaction.amount.should == BigDecimal("1000.00")
|
6029
6029
|
expect do
|
6030
6030
|
transaction.submit_for_settlement!("1000.01")
|
6031
6031
|
end.to raise_error(Braintree::ValidationsFailed)
|