revo-remit 0.2.3
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.
- data/LICENSE +20 -0
- data/README.markdown +122 -0
- data/lib/remit.rb +132 -0
- data/lib/remit/common.rb +151 -0
- data/lib/remit/data_types.rb +265 -0
- data/lib/remit/error_codes.rb +118 -0
- data/lib/remit/get_pipeline.rb +286 -0
- data/lib/remit/inbound_request.rb +85 -0
- data/lib/remit/ipn_request.rb +8 -0
- data/lib/remit/operations/cancel.rb +20 -0
- data/lib/remit/operations/cancel_subscription_and_refund.rb +26 -0
- data/lib/remit/operations/cancel_token.rb +19 -0
- data/lib/remit/operations/fund_prepaid.rb +33 -0
- data/lib/remit/operations/get_account_activity.rb +31 -0
- data/lib/remit/operations/get_account_balance.rb +32 -0
- data/lib/remit/operations/get_all_credit_instruments.rb +20 -0
- data/lib/remit/operations/get_all_prepaid_instruments.rb +20 -0
- data/lib/remit/operations/get_debt_balance.rb +28 -0
- data/lib/remit/operations/get_outstanding_debt_balance.rb +25 -0
- data/lib/remit/operations/get_payment_instruction.rb +23 -0
- data/lib/remit/operations/get_prepaid_balance.rb +27 -0
- data/lib/remit/operations/get_recipient_verification_status.rb +25 -0
- data/lib/remit/operations/get_token_by_caller.rb +23 -0
- data/lib/remit/operations/get_token_usage.rb +22 -0
- data/lib/remit/operations/get_tokens.rb +24 -0
- data/lib/remit/operations/get_total_prepaid_liability.rb +26 -0
- data/lib/remit/operations/get_transaction.rb +18 -0
- data/lib/remit/operations/get_transaction_status.rb +28 -0
- data/lib/remit/operations/install_payment_instruction.rb +29 -0
- data/lib/remit/operations/pay.rb +31 -0
- data/lib/remit/operations/refund.rb +46 -0
- data/lib/remit/operations/reserve.rb +28 -0
- data/lib/remit/operations/settle.rb +21 -0
- data/lib/remit/operations/settle_debt.rb +28 -0
- data/lib/remit/operations/subscribe_for_caller_notification.rb +20 -0
- data/lib/remit/operations/unsubscribe_for_caller_notification.rb +19 -0
- data/lib/remit/operations/write_off_debt.rb +26 -0
- data/lib/remit/pipeline_response.rb +20 -0
- data/lib/remit/signature_utils_for_outbound.rb +74 -0
- data/lib/remit/verify_signature.rb +21 -0
- data/spec/integrations/get_account_activity_spec.rb +42 -0
- data/spec/integrations/get_tokens_spec.rb +39 -0
- data/spec/integrations/integrations_helper.rb +15 -0
- data/spec/integrations/ipn_request_spec.rb +40 -0
- data/spec/integrations/pipeline_response_spec.rb +27 -0
- data/spec/integrations/verify_signature_spec.rb +140 -0
- data/spec/mocks/CancelResponse.xml +13 -0
- data/spec/mocks/CancelSubscriptionAndRefundResponse.xml +10 -0
- data/spec/mocks/CancelTokenResponse.xml +6 -0
- data/spec/mocks/ErrorResponse.xml +15 -0
- data/spec/mocks/FundPrepaidResponse.xml +11 -0
- data/spec/mocks/GetAccountActivityResponse.xml +68 -0
- data/spec/mocks/GetAccountBalanceResponse.xml +34 -0
- data/spec/mocks/GetDebtBalanceResponse.xml +21 -0
- data/spec/mocks/GetOutstandingDebtBalanceResponse.xml +21 -0
- data/spec/mocks/GetPaymentInstructionResponse.xml +25 -0
- data/spec/mocks/GetPrepaidBalanceResponse.xml +21 -0
- data/spec/mocks/GetRecipientVerificationStatusResponse.xml +9 -0
- data/spec/mocks/GetTokenByCallerResponse.xml +22 -0
- data/spec/mocks/GetTokenUsageResponse.xml +28 -0
- data/spec/mocks/GetTokensResponse.xml +22 -0
- data/spec/mocks/GetTotalPrepaidLiabilityResponse.xml +21 -0
- data/spec/mocks/GetTransactionResponse.xml +76 -0
- data/spec/mocks/GetTransactionStatusResponse.xml +16 -0
- data/spec/mocks/InstallPaymentInstructionResponse.xml +10 -0
- data/spec/mocks/PayResponse.xml +11 -0
- data/spec/mocks/RefundResponse.xml +11 -0
- data/spec/mocks/ReserveResponse.xml +11 -0
- data/spec/mocks/SettleDebtResponse.xml +11 -0
- data/spec/mocks/SettleResponse.xml +11 -0
- data/spec/mocks/VerifySignatureResponse.xml +11 -0
- data/spec/mocks/WriteOffDebtResponse.xml +11 -0
- data/spec/mocks/errors/InvalidParameterValue.xml +10 -0
- data/spec/mocks/errors/InvalidParams_certificateUrl.xml +2 -0
- data/spec/mocks/errors/RequestExpired.xml +10 -0
- data/spec/spec_helper.rb +85 -0
- data/spec/units/cancel_subscription_and_refund_spec.rb +29 -0
- data/spec/units/cancel_token_spec.rb +24 -0
- data/spec/units/fund_prepaid_spec.rb +28 -0
- data/spec/units/get_account_activity_spec.rb +58 -0
- data/spec/units/get_account_balance_spec.rb +28 -0
- data/spec/units/get_debt_balance_spec.rb +29 -0
- data/spec/units/get_outstanding_debt_balance_spec.rb +29 -0
- data/spec/units/get_pipeline_spec.rb +181 -0
- data/spec/units/get_prepaid_balance_spec.rb +29 -0
- data/spec/units/get_recipient_verification_status_spec.rb +26 -0
- data/spec/units/get_token_by_caller_spec.rb +56 -0
- data/spec/units/get_token_usage_spec.rb +51 -0
- data/spec/units/get_tokens_spec.rb +56 -0
- data/spec/units/get_total_prepaid_liability_spec.rb +26 -0
- data/spec/units/get_transaction_spec.rb +103 -0
- data/spec/units/get_transaction_status_spec.rb +44 -0
- data/spec/units/pay_spec.rb +112 -0
- data/spec/units/refund_spec.rb +41 -0
- data/spec/units/reserve_spec.rb +41 -0
- data/spec/units/settle_debt_spec.rb +41 -0
- data/spec/units/settle_spec.rb +41 -0
- data/spec/units/units_helper.rb +25 -0
- data/spec/units/write_off_debt_spec.rb +41 -0
- metadata +236 -0
@@ -0,0 +1,56 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/units_helper'
|
2
|
+
|
3
|
+
describe "the GetTokenByCaller API" do
|
4
|
+
describe "a successful response" do
|
5
|
+
it_should_behave_like 'a successful response'
|
6
|
+
|
7
|
+
before(:all) do
|
8
|
+
doc = File.read("spec/mocks/GetTokenByCallerResponse.xml")
|
9
|
+
|
10
|
+
@response = Remit::GetTokenByCaller::Response.new(doc)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "has metadata" do
|
14
|
+
@response.response_metadata.should_not be_nil
|
15
|
+
end
|
16
|
+
|
17
|
+
it "has results" do
|
18
|
+
@response.get_token_by_caller_result.should_not be_nil
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should have Token" do
|
22
|
+
@response.get_token_by_caller_result.token.should_not be_nil
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "has Token" do
|
26
|
+
before(:all) do
|
27
|
+
@token = @response.get_token_by_caller_result.token
|
28
|
+
end
|
29
|
+
it "should have TokenId" do
|
30
|
+
@token.token_id.should_not be_nil
|
31
|
+
end
|
32
|
+
it "should have FriendlyName" do
|
33
|
+
@token.friendly_name.should_not be_nil
|
34
|
+
end
|
35
|
+
it "should have TokenStatus" do
|
36
|
+
@token.token_status.should_not be_nil
|
37
|
+
end
|
38
|
+
it "should have DateInstalled" do
|
39
|
+
@token.date_installed.should_not be_nil
|
40
|
+
end
|
41
|
+
it "should have CallerReference" do
|
42
|
+
@token.caller_reference.should_not be_nil
|
43
|
+
end
|
44
|
+
it "should have TokenType" do
|
45
|
+
@token.token_type.should_not be_nil
|
46
|
+
end
|
47
|
+
it "should have OldTokenId" do
|
48
|
+
@token.old_token_id.should_not be_nil
|
49
|
+
end
|
50
|
+
it "should have PaymentReason" do
|
51
|
+
@token.payment_reason.should_not be_nil
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/units_helper'
|
2
|
+
|
3
|
+
describe "the GetTokenUsage API" do
|
4
|
+
describe "a successful response" do
|
5
|
+
it_should_behave_like 'a successful response'
|
6
|
+
|
7
|
+
before do
|
8
|
+
doc = <<-XML
|
9
|
+
<GetTokenUsageResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
10
|
+
<GetTokenUsageResult>
|
11
|
+
<TokenUsageLimits>
|
12
|
+
<Amount>
|
13
|
+
<CurrencyCode>USD</CurrencyCode>
|
14
|
+
<Value>10.000000</Value>
|
15
|
+
</Amount>
|
16
|
+
<LastResetAmount>
|
17
|
+
<CurrencyCode>USD</CurrencyCode>
|
18
|
+
<Value>0.000000</Value>
|
19
|
+
</LastResetAmount>
|
20
|
+
<LastResetTimestamp>
|
21
|
+
2008-01-01T02:00:00.000-08:00
|
22
|
+
</LastResetTimestamp>
|
23
|
+
</TokenUsageLimits>
|
24
|
+
<TokenUsageLimits>
|
25
|
+
<Count>1</Count>
|
26
|
+
<LastResetCount>0</LastResetCount>
|
27
|
+
<LastResetTimestamp>
|
28
|
+
2008-01-01T02:00:00.000-08:00
|
29
|
+
</LastResetTimestamp>
|
30
|
+
</TokenUsageLimits>
|
31
|
+
</GetTokenUsageResult>
|
32
|
+
<ResponseMetadata>
|
33
|
+
<RequestId>9faeed71-9362-4eb8-9431-b99e92b441ee:0</RequestId>
|
34
|
+
</ResponseMetadata>
|
35
|
+
</GetTokenUsageResponse>
|
36
|
+
XML
|
37
|
+
|
38
|
+
@response = Remit::GetTokenUsage::Response.new(doc)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "has metadata" do
|
42
|
+
@response.response_metadata.should_not be_nil
|
43
|
+
end
|
44
|
+
|
45
|
+
it "has results" do
|
46
|
+
@response.get_token_usage_result.should_not be_nil
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/units_helper'
|
2
|
+
|
3
|
+
describe "the GetTokens API" do
|
4
|
+
describe "a successful response" do
|
5
|
+
it_should_behave_like 'a successful response'
|
6
|
+
|
7
|
+
before(:all) do
|
8
|
+
doc = File.read("spec/mocks/GetTokensResponse.xml")
|
9
|
+
|
10
|
+
@response = Remit::GetTokens::Response.new(doc)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "has metadata" do
|
14
|
+
@response.response_metadata.should_not be_nil
|
15
|
+
end
|
16
|
+
|
17
|
+
it "has results" do
|
18
|
+
@response.get_tokens_result.should_not be_nil
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should have tokens" do
|
22
|
+
@response.get_tokens_result.tokens.length.should > 0
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "Tokens" do
|
26
|
+
before(:all) do
|
27
|
+
@token = @response.get_tokens_result.tokens.first
|
28
|
+
end
|
29
|
+
it "should have a TokenId" do
|
30
|
+
@token.token_id.should_not be_nil
|
31
|
+
end
|
32
|
+
it "should have a FriendlyName" do
|
33
|
+
@token.friendly_name.should_not be_nil
|
34
|
+
end
|
35
|
+
it "should have a TokenStatus" do
|
36
|
+
@token.token_status.should_not be_nil
|
37
|
+
end
|
38
|
+
it "should have a DateInstalled" do
|
39
|
+
@token.date_installed.should_not be_nil
|
40
|
+
end
|
41
|
+
it "should have a CallerReference" do
|
42
|
+
@token.caller_reference.should_not be_nil
|
43
|
+
end
|
44
|
+
it "should have a TokenType" do
|
45
|
+
@token.token_type.should_not be_nil
|
46
|
+
end
|
47
|
+
it "should have a OldTokenId" do
|
48
|
+
@token.old_token_id.should_not be_nil
|
49
|
+
end
|
50
|
+
it "should have a PaymentReason" do
|
51
|
+
@token.payment_reason.should_not be_nil
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/units_helper'
|
2
|
+
|
3
|
+
describe "the GetTotalPrepaidLiability API" do
|
4
|
+
describe "a successful response" do
|
5
|
+
it_should_behave_like 'a successful response'
|
6
|
+
|
7
|
+
before do
|
8
|
+
doc = File.read("spec/mocks/GetTotalPrepaidLiabilityResponse.xml")
|
9
|
+
|
10
|
+
@response = Remit::GetTotalPrepaidLiability::Response.new(doc)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "has metadata" do
|
14
|
+
@response.response_metadata.should_not be_nil
|
15
|
+
end
|
16
|
+
|
17
|
+
it "has results" do
|
18
|
+
@response.get_total_prepaid_liability_result.should be_a_kind_of Remit::GetTotalPrepaidLiability::Response::GetTotalPrepaidLiabilityResult
|
19
|
+
end
|
20
|
+
|
21
|
+
it "has outstanding prepaid liability" do
|
22
|
+
@response.get_total_prepaid_liability_result.outstanding_prepaid_liability.should be_a_kind_of Remit::GetTotalPrepaidLiability::Response::GetTotalPrepaidLiabilityResult::OutstandingPrepaidLiability
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/units_helper'
|
2
|
+
|
3
|
+
describe "the GetTransaction API" do
|
4
|
+
describe "a successful response" do
|
5
|
+
it_should_behave_like 'a successful response'
|
6
|
+
|
7
|
+
before(:all) do
|
8
|
+
doc = File.read("spec/mocks/GetTransactionResponse.xml")
|
9
|
+
|
10
|
+
@response = Remit::GetTransaction::Response.new(doc)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "has one transaction" do
|
14
|
+
@response.transaction.should_not be_nil
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "the result" do
|
18
|
+
before(:all) do
|
19
|
+
@transaction = @response.transaction
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should have a transaction_id" do
|
23
|
+
@transaction.transaction_id.should_not be_nil
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should have caller_reference" do
|
27
|
+
@transaction.caller_reference.should_not be_nil
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should have caller_description" do
|
31
|
+
@transaction.caller_description.should_not be_nil
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should have date_received" do
|
35
|
+
@transaction.date_received.should_not be_nil
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should have date_completed" do
|
39
|
+
@transaction.date_completed.should_not be_nil
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should have transaction_amount" do
|
43
|
+
@transaction.transaction_amount.should_not be_nil
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should have transaction_amount.value" do
|
47
|
+
@transaction.transaction_amount.value.should == 0
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should have fps_fess_paid_by" do
|
51
|
+
@transaction.fps_fees_paid_by.should_not be_nil
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should have sender_token_id" do
|
55
|
+
@transaction.sender_token_id.strip.should_not be_nil
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should have fps_operation" do
|
59
|
+
@transaction.fps_operation.should_not be_nil
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should have payment_method" do
|
63
|
+
@transaction.payment_method.should_not be_nil
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should have transaction_status" do
|
67
|
+
@transaction.transaction_status.should_not be_nil
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should have status_code" do
|
71
|
+
@transaction.status_code.should_not be_nil
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should have status_message" do
|
75
|
+
@transaction.status_message.should_not be_nil
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should have sender name" do
|
79
|
+
@transaction.sender_name.should_not be_nil
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should have sender email" do
|
83
|
+
@transaction.sender_email.should_not be_nil
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should have caller name" do
|
87
|
+
@transaction.caller_name.should_not be_nil
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should have recipient name" do
|
91
|
+
@transaction.recipient_name.should_not be_nil
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should have recipient email" do
|
95
|
+
@transaction.recipient_email.should_not be_nil
|
96
|
+
end
|
97
|
+
|
98
|
+
it "reports the transaction's new status" do
|
99
|
+
@transaction.transaction_status.should_not be_nil
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/units_helper'
|
2
|
+
|
3
|
+
describe "the GetTransaction API" do
|
4
|
+
describe "a successful response" do
|
5
|
+
it_should_behave_like 'a successful response'
|
6
|
+
|
7
|
+
before do
|
8
|
+
doc = File.read("spec/mocks/GetTransactionStatusResponse.xml")
|
9
|
+
|
10
|
+
@response = Remit::GetTransactionStatus::Response.new(doc)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "has one transaction" do
|
14
|
+
@response.get_transaction_status_result.should_not be_nil
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "the result" do
|
18
|
+
before do
|
19
|
+
@transaction = @response.get_transaction_status_result
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should have a transaction_id" do
|
23
|
+
@transaction.transaction_id.should_not be_nil
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
it "should have transaction_status" do
|
28
|
+
@transaction.transaction_status.should_not be_nil
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should have status_code" do
|
32
|
+
@transaction.status_code.should_not be_nil
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should have status_message" do
|
36
|
+
@transaction.status_message.should_not be_nil
|
37
|
+
end
|
38
|
+
|
39
|
+
it "reports the transaction's new status" do
|
40
|
+
@transaction.transaction_status.should_not be_nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/units_helper'
|
2
|
+
|
3
|
+
describe "the Pay API" do
|
4
|
+
describe "a successful response" do
|
5
|
+
it_should_behave_like 'a successful response'
|
6
|
+
|
7
|
+
before do
|
8
|
+
doc = <<-XML
|
9
|
+
<PayResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
10
|
+
<PayResult>
|
11
|
+
<TransactionId>abc123</TransactionId>
|
12
|
+
<TransactionStatus>Success</TransactionStatus>
|
13
|
+
</PayResult>
|
14
|
+
<ResponseMetadata>
|
15
|
+
<RequestId>foo-bar</RequestId>
|
16
|
+
</ResponseMetadata>
|
17
|
+
</PayResponse>
|
18
|
+
XML
|
19
|
+
|
20
|
+
@response = Remit::Pay::Response.new(doc)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "has a transaction response" do
|
24
|
+
@response.pay_result.should_not be_nil
|
25
|
+
end
|
26
|
+
|
27
|
+
it "has a transaction id" do
|
28
|
+
@response.pay_result.transaction_id.should == 'abc123'
|
29
|
+
end
|
30
|
+
|
31
|
+
it "has a transaction status" do
|
32
|
+
@response.pay_result.transaction_status.should == 'Success'
|
33
|
+
end
|
34
|
+
|
35
|
+
#it "has status shortcuts" do
|
36
|
+
# @response.pay_result.should be_initiated
|
37
|
+
#end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "for a pending request" do
|
41
|
+
before do
|
42
|
+
doc = <<-XML
|
43
|
+
<PayResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
44
|
+
<PayResult>
|
45
|
+
<TransactionId>14GK6BGKA7U6OU6SUTNLBI5SBBV9PGDJ6UL</TransactionId>
|
46
|
+
<TransactionStatus>Pending</TransactionStatus>
|
47
|
+
</PayResult>
|
48
|
+
<ResponseMetadata>
|
49
|
+
<RequestId>c21e7735-9c08-4cd8-99bf-535a848c79b4:0</RequestId>
|
50
|
+
</ResponseMetadata>
|
51
|
+
</PayResponse>
|
52
|
+
XML
|
53
|
+
|
54
|
+
@response = Remit::Pay::Response.new(doc)
|
55
|
+
@error = @response.errors.first
|
56
|
+
end
|
57
|
+
|
58
|
+
it_should_behave_like 'a pending response'
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
describe "for a failed request" do
|
63
|
+
before do
|
64
|
+
doc = <<-XML
|
65
|
+
<PayResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
66
|
+
<PayResult>
|
67
|
+
<TransactionId>14GK6BGKA7U6OU6SUTNLBI5SBBV9PGDJ6UL</TransactionId>
|
68
|
+
<TransactionStatus>Pending</TransactionStatus>
|
69
|
+
</PayResult>
|
70
|
+
<ResponseMetadata>
|
71
|
+
<RequestId>c21e7735-9c08-4cd8-99bf-535a848c79b4:0</RequestId>
|
72
|
+
</ResponseMetadata>
|
73
|
+
<Errors>
|
74
|
+
<Errors>
|
75
|
+
<ErrorType>Business</ErrorType>
|
76
|
+
<IsRetriable>false</IsRetriable>
|
77
|
+
<ErrorCode>TokenUsageError</ErrorCode>
|
78
|
+
<ReasonText>The token "45XU7TLBN995ZQA2U1PS1ZCTJXJMJ3H1GH6VZAB82C1BGLK9X3AXUQDA3QDLJVPX" has violated its usage policy.</ReasonText>
|
79
|
+
</Errors>
|
80
|
+
</Errors>
|
81
|
+
</PayResponse>
|
82
|
+
XML
|
83
|
+
|
84
|
+
@response = Remit::Pay::Response.new(doc)
|
85
|
+
@error = @response.errors.first
|
86
|
+
end
|
87
|
+
|
88
|
+
it_should_behave_like 'a failed response'
|
89
|
+
|
90
|
+
describe "with a token usage error" do
|
91
|
+
it "should be a service error" do
|
92
|
+
@error.should be_kind_of(Remit::ServiceError)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should have an error type of 'Business'" do
|
96
|
+
@error.error_type.should == 'Business'
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should have an error code of 'TokenUsageError'" do
|
100
|
+
@error.error_code.should == 'TokenUsageError'
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should not be retriable" do
|
104
|
+
@error.is_retriable.should == 'false'
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should have reason text" do
|
108
|
+
@error.reason_text.should == 'The token "45XU7TLBN995ZQA2U1PS1ZCTJXJMJ3H1GH6VZAB82C1BGLK9X3AXUQDA3QDLJVPX" has violated its usage policy.'
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|