revo-remit 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- 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,29 @@
|
|
1
|
+
require 'units/units_helper'
|
2
|
+
|
3
|
+
describe "the CancelSubscriptionAndRefund 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/CancelSubscriptionAndRefundResponse.xml")
|
9
|
+
|
10
|
+
@response = Remit::CancelSubscriptionAndRefund::Response.new(doc)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "has metadata" do
|
14
|
+
@response.response_metadata
|
15
|
+
end
|
16
|
+
|
17
|
+
it "has results" do
|
18
|
+
@response.cancel_subscription_and_refund_result.should_not be_nil
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "the result" do
|
22
|
+
it "should have refund_transaction_id" do
|
23
|
+
@response.cancel_subscription_and_refund_result.refund_transaction_id.should == 'string'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,24 @@
|
|
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/CancelTokenResponse.xml")
|
9
|
+
|
10
|
+
@response = Remit::CancelToken::Response.new(doc)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "has metadata" do
|
14
|
+
@response.response_metadata
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "metadata" do
|
18
|
+
it "has request_id" do
|
19
|
+
@response.response_metadata.request_id
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/units_helper'
|
2
|
+
|
3
|
+
describe "the FundPrepaid 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/FundPrepaidResponse.xml")
|
9
|
+
|
10
|
+
@response = Remit::FundPrepaid::Response.new(doc)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "has metadata" do
|
14
|
+
@response.response_metadata.should_not be_nil
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "metadata" do
|
18
|
+
it "has request_id" do
|
19
|
+
@response.response_metadata.request_id
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it "has results" do
|
24
|
+
@response.fund_prepaid_result.should_not be_nil
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/units_helper'
|
2
|
+
|
3
|
+
describe "the GetAccountActivity 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/GetAccountActivityResponse.xml")
|
9
|
+
|
10
|
+
@response = Remit::GetAccountActivity::Response.new(doc)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "has results" do
|
14
|
+
@response.get_account_activity_result.should_not be_nil
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "the result" do
|
18
|
+
before(:all) do
|
19
|
+
@activity = @response.get_account_activity_result
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should have transactions" do
|
23
|
+
@activity.transactions.should_not be_nil
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should have transactions" do
|
27
|
+
@activity.transactions.size.should_not == 0
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should have batch_size" do
|
31
|
+
@activity.batch_size.should_not be_nil
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should have start_time_for_next_transaction" do
|
35
|
+
@activity.start_time_for_next_transaction.should_not be_nil
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "a transaction" do
|
39
|
+
before(:all) do
|
40
|
+
@transaction = @activity.transactions.first
|
41
|
+
end
|
42
|
+
it "should have transaction_status" do
|
43
|
+
@transaction.transaction_status.should == "string"
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should have status_code" do
|
47
|
+
@transaction.status_code.should == "string"
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should have status_message" do
|
51
|
+
@transaction.status_message.should_not be_nil
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/units_helper'
|
2
|
+
|
3
|
+
describe "the GetAccountBalance 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/GetAccountBalanceResponse.xml")
|
9
|
+
|
10
|
+
@response = Remit::GetAccountBalance::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_account_balance_result.should_not be_nil
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "the result" do
|
22
|
+
it "should have a total_balance" do
|
23
|
+
@response.get_account_balance_result.account_balance.total_balance.value.should == 0
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/units_helper'
|
2
|
+
|
3
|
+
describe "the GetDebtBalance 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/GetDebtBalanceResponse.xml")
|
9
|
+
|
10
|
+
@response = Remit::GetDebtBalance::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_debt_balance_result.should_not be_nil
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "the result" do
|
22
|
+
it "should have an available_balance" do
|
23
|
+
@response.get_debt_balance_result.debt_balance.available_balance.value.should == 0
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/units_helper'
|
2
|
+
|
3
|
+
describe "the GetOutstandingDebtBalance 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/GetOutstandingDebtBalanceResponse.xml")
|
9
|
+
|
10
|
+
@response = Remit::GetOutstandingDebtBalance::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_outstanding_debt_balance_result.should_not be_nil
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "the result" do
|
22
|
+
it "should have refund_transaction_id" do
|
23
|
+
@response.get_outstanding_debt_balance_result.outstanding_debt.outstanding_balance.value.should == 0
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,181 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/units_helper'
|
2
|
+
|
3
|
+
describe 'A pipeline', :shared => true do
|
4
|
+
before do
|
5
|
+
@pipeline_options = {
|
6
|
+
:return_url => 'http://example.com/'
|
7
|
+
}
|
8
|
+
@pipeline = remit.get_single_use_pipeline(@pipeline_options)
|
9
|
+
end
|
10
|
+
|
11
|
+
describe 'with signed url' do
|
12
|
+
before(:each) do
|
13
|
+
@uri = URI.parse(@pipeline.url)
|
14
|
+
end
|
15
|
+
it "should have a signature" do
|
16
|
+
@uri.query.should =~ /signature=/
|
17
|
+
end
|
18
|
+
it "should specify a signature version" do
|
19
|
+
@uri.query.should =~ /signatureVersion=2/
|
20
|
+
end
|
21
|
+
it "should specify a signature method" do
|
22
|
+
@uri.query.should =~ /signatureMethod=HmacSHA256/
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should sign its URL' do
|
27
|
+
uri = URI.parse(@pipeline.url)
|
28
|
+
pipeline = Remit::SignedQuery.parse(uri, remit.secret_key, uri.query)
|
29
|
+
query = Relax::Query.parse(uri)
|
30
|
+
|
31
|
+
pipeline[:awsSignature].should == query[:awsSignature]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'A single-use pipeline' do
|
36
|
+
it_should_behave_like 'A pipeline'
|
37
|
+
|
38
|
+
before do
|
39
|
+
@pipeline_options.merge!({
|
40
|
+
:transaction_amount => 10,
|
41
|
+
:caller_reference => 'N2PCBEIA5864E27EL7C86PJL1FGUGPBL61QTJJM5GQK265SPEN8ZKIJPMQARDVJK',
|
42
|
+
:recipient_token => 'N5PCME5A5Q6FE2QEB7CD64JLGFTUGXBE61HTCJMGGAK2R5IPEQ8EKIVP3QAVD7JP'
|
43
|
+
})
|
44
|
+
|
45
|
+
@pipeline = remit.get_single_use_pipeline(@pipeline_options)
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should ignore unused parameters' do
|
49
|
+
uri = URI.parse(@pipeline.url)
|
50
|
+
query = Relax::Query.parse(uri)
|
51
|
+
|
52
|
+
query[:paymentReason].should be_nil
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'should have the right name' do
|
56
|
+
@pipeline.pipeline_name.should == Remit::PipelineName::SINGLE_USE
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe 'A multi-use pipeline' do
|
61
|
+
it_should_behave_like 'A pipeline'
|
62
|
+
|
63
|
+
before do
|
64
|
+
@pipeline_options.merge!({
|
65
|
+
:transaction_amount => 10,
|
66
|
+
:caller_reference => 'N2PCBEIA5864E27EL7C86PJL1FGUGPBL61QTJJM5GQK265SPEN8ZKIJPMQARDVJK',
|
67
|
+
:recipient_token_list => 'N5PCME5A5Q6FE2QEB7CD64JLGFTUGXBE61HTCJMGGAK2R5IPEQ8EKIVP3QAVD7JP'
|
68
|
+
})
|
69
|
+
|
70
|
+
@pipeline = remit.get_multi_use_pipeline(@pipeline_options)
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'should ignore unused parameters' do
|
74
|
+
uri = URI.parse(@pipeline.url)
|
75
|
+
query = Relax::Query.parse(uri)
|
76
|
+
|
77
|
+
query[:paymentReason].should be_nil
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'should have the right name' do
|
81
|
+
@pipeline.pipeline_name.should == Remit::PipelineName::MULTI_USE
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe 'A recipient pipeline' do
|
86
|
+
it_should_behave_like 'A pipeline'
|
87
|
+
|
88
|
+
before do
|
89
|
+
@validity_start = Time.now + (3600 * 24) # 1 day from now
|
90
|
+
@validity_expiry = Time.now + (2600 * 24 * 180) # ~6 months from now
|
91
|
+
|
92
|
+
@pipeline_options.merge!({
|
93
|
+
:validity_start => @validity_start,
|
94
|
+
:validity_expiry => @validity_expiry,
|
95
|
+
:caller_reference => 'N2PCBEIA5864E27EL7C86PJL1FGUGPBL61QTJJM5GQK265SPEN8ZKIJPMQARDVJK',
|
96
|
+
:max_variable_fee => '0.25',
|
97
|
+
:recipient_pays_fee => true
|
98
|
+
})
|
99
|
+
|
100
|
+
@pipeline = remit.get_recipient_pipeline(@pipeline_options)
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'should have the recipient pay marketplace fees' do
|
104
|
+
@pipeline.url.should match(/recipientPaysFee=true/)
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'should have the right name' do
|
108
|
+
@pipeline.pipeline_name.should == Remit::PipelineName::RECIPIENT
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
describe 'A recurring-use pipeline' do
|
113
|
+
it_should_behave_like 'A pipeline'
|
114
|
+
|
115
|
+
before do
|
116
|
+
@validity_start = Time.now + (3600 * 24) # 1 day from now
|
117
|
+
@validity_expiry = Time.now + (3600 * 24 * 180) # ~6 months from now
|
118
|
+
@recurring_period = '1 Month'
|
119
|
+
|
120
|
+
@pipeline_options.merge!({
|
121
|
+
:validity_start => @validity_start,
|
122
|
+
:validity_expiry => @validity_expiry,
|
123
|
+
:recurring_period => @recurring_period,
|
124
|
+
:transaction_amount => 10,
|
125
|
+
:caller_reference => 'N2PCBEIA5864E27EL7C86PJL1FGUGPBL61QTJJM5GQK265SPEN8ZKIJPMQARDVJK',
|
126
|
+
:recipient_token => 'N5PCME5A5Q6FE2QEB7CD64JLGFTUGXBE61HTCJMGGAK2R5IPEQ8EKIVP3QAVD7JP'
|
127
|
+
})
|
128
|
+
|
129
|
+
@pipeline = remit.get_recurring_use_pipeline(@pipeline_options)
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'should convert times to seconds from epoch' do
|
133
|
+
uri = URI.parse(@pipeline.url)
|
134
|
+
query = Relax::Query.parse(uri)
|
135
|
+
|
136
|
+
@validity_start.to_i.to_s.should == query[:validityStart]
|
137
|
+
@validity_expiry.to_i.to_s.should == query[:validityExpiry]
|
138
|
+
end
|
139
|
+
|
140
|
+
it 'should allow time in seconds' do
|
141
|
+
options = @pipeline_options.merge({
|
142
|
+
:validity_start => @validity_start.to_i,
|
143
|
+
:validity_expiry => @validity_expiry.to_i
|
144
|
+
})
|
145
|
+
@pipeline = remit.get_recurring_use_pipeline(options)
|
146
|
+
|
147
|
+
uri = URI.parse(@pipeline.url)
|
148
|
+
query = Relax::Query.parse(uri)
|
149
|
+
|
150
|
+
@validity_start.to_i.to_s.should == query[:validityStart]
|
151
|
+
@validity_expiry.to_i.to_s.should == query[:validityExpiry]
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'should have the right name' do
|
155
|
+
@pipeline.pipeline_name.should == Remit::PipelineName::RECURRING
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
describe 'A postpaid pipeline' do
|
160
|
+
it_should_behave_like 'A pipeline'
|
161
|
+
|
162
|
+
before do
|
163
|
+
@credit_limit = 100
|
164
|
+
@global_amount_limit = 100
|
165
|
+
|
166
|
+
@pipeline_options.merge!({
|
167
|
+
:credit_limit => @credit_limit,
|
168
|
+
:global_amount_limit => @global_amount_limit
|
169
|
+
})
|
170
|
+
|
171
|
+
@pipeline = remit.get_postpaid_pipeline(@pipeline_options)
|
172
|
+
end
|
173
|
+
|
174
|
+
it 'should create a PostpaidPipeline' do
|
175
|
+
@pipeline.class.should == Remit::GetPipeline::PostpaidPipeline
|
176
|
+
end
|
177
|
+
|
178
|
+
it 'should have the right name' do
|
179
|
+
@pipeline.pipeline_name.should == Remit::PipelineName::SETUP_POSTPAID
|
180
|
+
end
|
181
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/units_helper'
|
2
|
+
|
3
|
+
describe "the GetPrepaidBalance 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/GetPrepaidBalanceResponse.xml")
|
9
|
+
|
10
|
+
@response = Remit::GetPrepaidBalance::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_prepaid_balance_result.should_not be_nil
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "the result" do
|
22
|
+
it "should have refund_transaction_id" do
|
23
|
+
@response.get_prepaid_balance_result.prepaid_balance.available_balance.value.should == 0
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/units_helper'
|
2
|
+
|
3
|
+
describe "the GetRecipientVerificationStatus 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/GetRecipientVerificationStatusResponse.xml")
|
9
|
+
|
10
|
+
@response = Remit::GetRecipientVerificationStatus::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_recipient_verification_status_result.should_not be_nil
|
19
|
+
end
|
20
|
+
|
21
|
+
it "has status" do
|
22
|
+
@response.get_recipient_verification_status_result.recipient_verification_status.should_not be_nil
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|