pboling-remit 0.0.8 → 0.2.1

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.
Files changed (46) hide show
  1. metadata +19 -72
  2. data/LICENSE +0 -20
  3. data/README.markdown +0 -91
  4. data/lib/remit.rb +0 -127
  5. data/lib/remit/common.rb +0 -110
  6. data/lib/remit/data_types.rb +0 -170
  7. data/lib/remit/error_codes.rb +0 -118
  8. data/lib/remit/get_pipeline.rb +0 -212
  9. data/lib/remit/ipn_request.rb +0 -46
  10. data/lib/remit/operations/cancel_token.rb +0 -18
  11. data/lib/remit/operations/discard_results.rb +0 -18
  12. data/lib/remit/operations/fund_prepaid.rb +0 -31
  13. data/lib/remit/operations/get_account_activity.rb +0 -60
  14. data/lib/remit/operations/get_account_balance.rb +0 -29
  15. data/lib/remit/operations/get_all_credit_instruments.rb +0 -18
  16. data/lib/remit/operations/get_all_prepaid_instruments.rb +0 -18
  17. data/lib/remit/operations/get_debt_balance.rb +0 -23
  18. data/lib/remit/operations/get_outstanding_debt_balance.rb +0 -22
  19. data/lib/remit/operations/get_payment_instruction.rb +0 -21
  20. data/lib/remit/operations/get_prepaid_balance.rb +0 -23
  21. data/lib/remit/operations/get_results.rb +0 -27
  22. data/lib/remit/operations/get_token_by_caller.rb +0 -19
  23. data/lib/remit/operations/get_token_usage.rb +0 -18
  24. data/lib/remit/operations/get_tokens.rb +0 -20
  25. data/lib/remit/operations/get_total_prepaid_liability.rb +0 -22
  26. data/lib/remit/operations/get_transaction.rb +0 -54
  27. data/lib/remit/operations/install_payment_instruction.rb +0 -22
  28. data/lib/remit/operations/pay.rb +0 -30
  29. data/lib/remit/operations/refund.rb +0 -44
  30. data/lib/remit/operations/reserve.rb +0 -30
  31. data/lib/remit/operations/retry_transaction.rb +0 -18
  32. data/lib/remit/operations/settle.rb +0 -20
  33. data/lib/remit/operations/settle_debt.rb +0 -30
  34. data/lib/remit/operations/subscribe_for_caller_notification.rb +0 -18
  35. data/lib/remit/operations/unsubscribe_for_caller_notification.rb +0 -17
  36. data/lib/remit/operations/write_off_debt.rb +0 -28
  37. data/lib/remit/pipeline_response.rb +0 -64
  38. data/spec/integrations/get_account_activity_spec.rb +0 -36
  39. data/spec/integrations/get_tokens_spec.rb +0 -38
  40. data/spec/integrations/integrations_helper.rb +0 -8
  41. data/spec/spec_helper.rb +0 -36
  42. data/spec/units/get_pipeline_spec.rb +0 -165
  43. data/spec/units/get_results_spec.rb +0 -49
  44. data/spec/units/ipn_request_spec.rb +0 -32
  45. data/spec/units/pay_spec.rb +0 -133
  46. data/spec/units/units_helper.rb +0 -4
@@ -1,8 +0,0 @@
1
- ACCESS_KEY = ENV['AWS_ACCESS_KEY'] || ENV['AMAZON_ACCESS_KEY_ID']
2
- SECRET_KEY = ENV['AWS_SECRET_KEY'] || ENV['AMAZON_SECRET_ACCESS_KEY']
3
-
4
- unless ACCESS_KEY and SECRET_KEY
5
- raise RuntimeError, "You must set your AWS_ACCESS_KEY and AWS_SECRET_KEY environment variables to run integration tests"
6
- end
7
-
8
- require File.dirname(__FILE__) + '/../spec_helper'
@@ -1,36 +0,0 @@
1
- require 'rubygems'
2
- require 'spec'
3
-
4
- require File.dirname(__FILE__) + '/../lib/remit'
5
-
6
- def remit
7
- @remit ||= Remit::API.new(ACCESS_KEY, SECRET_KEY, true)
8
- end
9
-
10
- describe 'a successful response', :shared => true do
11
- it 'should return success' do
12
- @response.status.should == 'Success'
13
- end
14
-
15
- it 'should not have any errors' do
16
- @response.errors.should be_nil
17
- end
18
-
19
- it 'should have a request ID' do
20
- @response.request_id.should_not be_nil
21
- end
22
- end
23
-
24
- describe 'a failed response', :shared => true do
25
- it "is not successful" do
26
- @response.should_not be_successful
27
- end
28
-
29
- it "has a request id" do
30
- @response.request_id.should_not be_empty
31
- end
32
-
33
- it "has errors" do
34
- @response.errors.should_not be_empty
35
- end
36
- end
@@ -1,165 +0,0 @@
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
- end
9
-
10
- it 'should sign its URL' do
11
- uri = URI.parse(@pipeline.url)
12
- pipeline = Remit::SignedQuery.new(uri, remit.secret_key, uri.query)
13
- query = Relax::Query.parse(uri)
14
-
15
- pipeline[:awsSignature].should == query[:awsSignature]
16
- end
17
- end
18
-
19
- describe 'A single-use pipeline' do
20
- it_should_behave_like 'A pipeline'
21
-
22
- before do
23
- @pipeline_options.merge!({
24
- :transaction_amount => 10,
25
- :caller_reference => 'N2PCBEIA5864E27EL7C86PJL1FGUGPBL61QTJJM5GQK265SPEN8ZKIJPMQARDVJK',
26
- :recipient_token => 'N5PCME5A5Q6FE2QEB7CD64JLGFTUGXBE61HTCJMGGAK2R5IPEQ8EKIVP3QAVD7JP'
27
- })
28
-
29
- @pipeline = remit.get_single_use_pipeline(@pipeline_options)
30
- end
31
-
32
- it 'should ignore unused parameters' do
33
- uri = URI.parse(@pipeline.url)
34
- query = Relax::Query.parse(uri)
35
-
36
- query[:paymentReason].should be_nil
37
- end
38
-
39
- it 'should have the right name' do
40
- @pipeline.pipeline_name.should == Remit::PipelineName::SINGLE_USE
41
- end
42
- end
43
-
44
- describe 'A multi-use pipeline' do
45
- it_should_behave_like 'A pipeline'
46
-
47
- before do
48
- @pipeline_options.merge!({
49
- :transaction_amount => 10,
50
- :caller_reference => 'N2PCBEIA5864E27EL7C86PJL1FGUGPBL61QTJJM5GQK265SPEN8ZKIJPMQARDVJK',
51
- :recipient_token_list => 'N5PCME5A5Q6FE2QEB7CD64JLGFTUGXBE61HTCJMGGAK2R5IPEQ8EKIVP3QAVD7JP'
52
- })
53
-
54
- @pipeline = remit.get_multi_use_pipeline(@pipeline_options)
55
- end
56
-
57
- it 'should ignore unused parameters' do
58
- uri = URI.parse(@pipeline.url)
59
- query = Relax::Query.parse(uri)
60
-
61
- query[:paymentReason].should be_nil
62
- end
63
-
64
- it 'should have the right name' do
65
- @pipeline.pipeline_name.should == Remit::PipelineName::MULTI_USE
66
- end
67
- end
68
-
69
- describe 'A recipient pipeline' do
70
- it_should_behave_like 'A pipeline'
71
-
72
- before do
73
- @validity_start = Time.now + (3600 * 24) # 1 day from now
74
- @validity_expiry = Time.now + (2600 * 24 * 180) # ~6 months from now
75
-
76
- @pipeline_options.merge!({
77
- :validity_start => @validity_start,
78
- :validity_expiry => @validity_expiry,
79
- :caller_reference => 'N2PCBEIA5864E27EL7C86PJL1FGUGPBL61QTJJM5GQK265SPEN8ZKIJPMQARDVJK',
80
- :max_variable_fee => '0.25',
81
- :recipient_pays_fee => true
82
- })
83
-
84
- @pipeline = remit.get_recipient_pipeline(@pipeline_options)
85
- end
86
-
87
- it 'should have the recipient pay marketplace fees' do
88
- @pipeline.url.should match(/recipientPaysFee=true/)
89
- end
90
-
91
- it 'should have the right name' do
92
- @pipeline.pipeline_name.should == Remit::PipelineName::RECIPIENT
93
- end
94
- end
95
-
96
- describe 'A recurring-use pipeline' do
97
- it_should_behave_like 'A pipeline'
98
-
99
- before do
100
- @validity_start = Time.now + (3600 * 24) # 1 day from now
101
- @validity_expiry = Time.now + (3600 * 24 * 180) # ~6 months from now
102
- @recurring_period = '1 Month'
103
-
104
- @pipeline_options.merge!({
105
- :validity_start => @validity_start,
106
- :validity_expiry => @validity_expiry,
107
- :recurring_period => @recurring_period,
108
- :transaction_amount => 10,
109
- :caller_reference => 'N2PCBEIA5864E27EL7C86PJL1FGUGPBL61QTJJM5GQK265SPEN8ZKIJPMQARDVJK',
110
- :recipient_token => 'N5PCME5A5Q6FE2QEB7CD64JLGFTUGXBE61HTCJMGGAK2R5IPEQ8EKIVP3QAVD7JP'
111
- })
112
-
113
- @pipeline = remit.get_recurring_use_pipeline(@pipeline_options)
114
- end
115
-
116
- it 'should convert times to seconds from epoch' do
117
- uri = URI.parse(@pipeline.url)
118
- query = Relax::Query.parse(uri)
119
-
120
- @validity_start.to_i.to_s.should == query[:validityStart]
121
- @validity_expiry.to_i.to_s.should == query[:validityExpiry]
122
- end
123
-
124
- it 'should allow time in seconds' do
125
- options = @pipeline_options.merge({
126
- :validity_start => @validity_start.to_i,
127
- :validity_expiry => @validity_expiry.to_i
128
- })
129
- @pipeline = remit.get_recurring_use_pipeline(options)
130
-
131
- uri = URI.parse(@pipeline.url)
132
- query = Relax::Query.parse(uri)
133
-
134
- @validity_start.to_i.to_s.should == query[:validityStart]
135
- @validity_expiry.to_i.to_s.should == query[:validityExpiry]
136
- end
137
-
138
- it 'should have the right name' do
139
- @pipeline.pipeline_name.should == Remit::PipelineName::RECURRING
140
- end
141
- end
142
-
143
- describe 'A postpaid pipeline' do
144
- it_should_behave_like 'A pipeline'
145
-
146
- before do
147
- @credit_limit = 100
148
- @global_amount_limit = 100
149
-
150
- @pipeline_options.merge!({
151
- :credit_limit => @credit_limit,
152
- :global_amount_limit => @global_amount_limit
153
- })
154
-
155
- @pipeline = remit.get_postpaid_pipeline(@pipeline_options)
156
- end
157
-
158
- it 'should create a PostpaidPipeline' do
159
- @pipeline.class.should == Remit::GetPipeline::PostpaidPipeline
160
- end
161
-
162
- it 'should have the right name' do
163
- @pipeline.pipeline_name.should == Remit::PipelineName::SETUP_POSTPAID
164
- end
165
- end
@@ -1,49 +0,0 @@
1
- require File.dirname(__FILE__) + '/units_helper'
2
-
3
- describe "the GetResults API" do
4
- describe "a successful response" do
5
- it_should_behave_like 'a successful response'
6
-
7
- before do
8
- doc = <<-XML
9
- <?xml version=\"1.0\"?>
10
- <ns3:GetResultsResponse xmlns:ns3=\"http://fps.amazonaws.com/doc/2007-01-08/\">
11
- <TransactionResults>
12
- <TransactionId>abc123</TransactionId>
13
- <Operation>Pay</Operation>
14
- <CallerReference>1827</CallerReference>
15
- <Status>Success</Status>
16
- </TransactionResults>
17
- <NumberPending>1</NumberPending>
18
- <Status>Success</Status>
19
- <RequestId>f89727ba-9ff6-4ca8-87a3-0fd6c9de6b95:0</RequestId>
20
- </ns3:GetResultsResponse>
21
- XML
22
-
23
- @response = Remit::GetResults::Response.new(doc)
24
- end
25
-
26
- it "has one result" do
27
- @response.number_pending.should == 1
28
- @response.transaction_results.size == "1"
29
- end
30
-
31
- describe "the result" do
32
- before do
33
- @result = @response.transaction_results.first
34
- end
35
-
36
- it "references a previous transaction" do
37
- @result.transaction_id.should == "abc123"
38
- end
39
-
40
- it "references a pay transaction" do
41
- @result.operation_type.should == 'Pay'
42
- end
43
-
44
- it "reports the transaction's new status" do
45
- @result.transaction_status.should == 'Success'
46
- end
47
- end
48
- end
49
- end
@@ -1,32 +0,0 @@
1
- require File.dirname(__FILE__) + '/units_helper'
2
-
3
- describe 'an IPN request' do
4
- before(:each) do
5
- @request_params = {
6
- "action" => "notice",
7
- "buyerName" => "Fps Buyer",
8
- "callerReference" => "4-8-1-3.5",
9
- "controller" => "amazon_fps/ipn",
10
- "operation" => "PAY",
11
- "paymentMethod" => "CC",
12
- "recipientEmail" => "recipient@email.url",
13
- "recipientName" => "Fps Business",
14
- "signature" => "DA7ZbuQaBDt2/+Mty9XweJyqI1E=",
15
- "status" => "SUCCESS",
16
- "transactionAmount" => "USD 3.50",
17
- "transactionDate" => "1224687134",
18
- "transactionId" => "13KIGL9RC25853BGPPOS2VSKBKF2JERR3HO"
19
- }
20
- @request = Remit::IpnRequest.new(@request_params, 'THISISMYTESTKEY')
21
- end
22
-
23
- it 'should be a valid request' do
24
- @request.should be_valid
25
- end
26
-
27
- it 'should pass through access to given parameters' do
28
- @request.status.should == 'SUCCESS'
29
- @request.operation.should == 'PAY'
30
- @request.transactionId.should == '13KIGL9RC25853BGPPOS2VSKBKF2JERR3HO'
31
- end
32
- end
@@ -1,133 +0,0 @@
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
- <ns3:PayResponse xmlns:ns3="http://fps.amazonaws.com/doc/2007-01-08/">
10
- <ns3:TransactionResponse>
11
- <TransactionId>abc123</TransactionId>
12
- <Status>Initiated</Status>
13
- </ns3:TransactionResponse>
14
- <Status>Success</Status>
15
- <RequestId>foo</RequestId>
16
- </ns3:PayResponse>
17
- XML
18
-
19
- @response = Remit::Pay::Response.new(doc)
20
- end
21
-
22
- it "has a transaction response" do
23
- @response.transaction_response.should_not be_nil
24
- end
25
-
26
- it "has a transaction id" do
27
- @response.transaction_response.transaction_id.should == 'abc123'
28
- end
29
-
30
- it "has a transaction status" do
31
- @response.transaction_response.status.should == 'Initiated'
32
- end
33
-
34
- it "has status shortcuts" do
35
- @response.transaction_response.should be_initiated
36
- end
37
- end
38
-
39
- describe "for a failed request" do
40
- before do
41
- doc = <<-XML
42
- <?xml version=\"1.0\"?>
43
- <ns3:PayResponse xmlns:ns3=\"http://fps.amazonaws.com/doc/2007-01-08/\">
44
- <Status>Failure</Status>
45
- <Errors>
46
- <Errors>
47
- <ErrorType>Business</ErrorType>
48
- <IsRetriable>false</IsRetriable>
49
- <ErrorCode>InvalidParams</ErrorCode>
50
- <ReasonText>callerTokenId can not be empty</ReasonText>
51
- </Errors>
52
- </Errors>
53
- <RequestId>7966a2d9-5ce9-4902-aefc-b01d254c931a:0</RequestId>
54
- </ns3:PayResponse>
55
- XML
56
-
57
- @response = Remit::Pay::Response.new(doc)
58
- @error = @response.errors.first
59
- end
60
-
61
- it_should_behave_like 'a failed response'
62
-
63
- describe "with an invalid params error" do
64
- it "should be a service error" do
65
- @error.should be_kind_of(Remit::ServiceError)
66
- end
67
-
68
- it "should have an error type of 'Business'" do
69
- @error.error_type.should == 'Business'
70
- end
71
-
72
- it "should have an error code of 'InvalidParams'" do
73
- @error.error_code.should == 'InvalidParams'
74
- end
75
-
76
- it "should not be retriable" do
77
- @error.is_retriable.should == 'false'
78
- end
79
-
80
- it "should have reason text" do
81
- @error.reason_text.should == 'callerTokenId can not be empty'
82
- end
83
- end
84
- end
85
-
86
- describe "for a failed request" do
87
- before do
88
- doc = <<-XML
89
- <?xml version=\"1.0\"?>
90
- <ns3:PayResponse xmlns:ns3=\"http://fps.amazonaws.com/doc/2007-01-08/\">
91
- <Status>Failure</Status>
92
- <Errors>
93
- <Errors>
94
- <ErrorType>Business</ErrorType>
95
- <IsRetriable>false</IsRetriable>
96
- <ErrorCode>TokenUsageError</ErrorCode>
97
- <ReasonText>The token \"45XU7TLBN995ZQA2U1PS1ZCTJXJMJ3H1GH6VZAB82C1BGLK9X3AXUQDA3QDLJVPX\" has violated its usage policy.</ReasonText>
98
- </Errors>
99
- </Errors>
100
- <RequestId>78acff80-b740-4b57-9301-18d0576e6855:0
101
- </RequestId>
102
- </ns3:PayResponse>
103
- XML
104
-
105
- @response = Remit::Pay::Response.new(doc)
106
- @error = @response.errors.first
107
- end
108
-
109
- it_should_behave_like 'a failed response'
110
-
111
- describe "with a token usage error" do
112
- it "should be a service error" do
113
- @error.should be_kind_of(Remit::ServiceError)
114
- end
115
-
116
- it "should have an error type of 'Business'" do
117
- @error.error_type.should == 'Business'
118
- end
119
-
120
- it "should have an error code of 'TokenUsageError'" do
121
- @error.error_code.should == 'TokenUsageError'
122
- end
123
-
124
- it "should not be retriable" do
125
- @error.is_retriable.should == 'false'
126
- end
127
-
128
- it "should have reason text" do
129
- @error.reason_text.should == 'The token "45XU7TLBN995ZQA2U1PS1ZCTJXJMJ3H1GH6VZAB82C1BGLK9X3AXUQDA3QDLJVPX" has violated its usage policy.'
130
- end
131
- end
132
- end
133
- end
@@ -1,4 +0,0 @@
1
- ACCESS_KEY = 'foo'
2
- SECRET_KEY = 'bar'
3
-
4
- require File.dirname(__FILE__) + '/../spec_helper'