remit 0.0.6 → 2.0.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 (102) hide show
  1. data/README.markdown +36 -5
  2. data/lib/remit.rb +35 -39
  3. data/lib/remit/common.rb +79 -24
  4. data/lib/remit/data_types.rb +118 -17
  5. data/lib/remit/get_pipeline.rb +160 -80
  6. data/lib/remit/inbound_request.rb +85 -0
  7. data/lib/remit/ipn_request.rb +4 -39
  8. data/lib/remit/operations/cancel.rb +20 -0
  9. data/lib/remit/operations/cancel_subscription_and_refund.rb +5 -1
  10. data/lib/remit/operations/cancel_token.rb +1 -0
  11. data/lib/remit/operations/fund_prepaid.rb +6 -4
  12. data/lib/remit/operations/get_account_activity.rb +5 -34
  13. data/lib/remit/operations/get_account_balance.rb +14 -11
  14. data/lib/remit/operations/get_all_credit_instruments.rb +2 -0
  15. data/lib/remit/operations/get_all_prepaid_instruments.rb +2 -0
  16. data/lib/remit/operations/get_debt_balance.rb +9 -4
  17. data/lib/remit/operations/get_outstanding_debt_balance.rb +8 -5
  18. data/lib/remit/operations/get_payment_instruction.rb +2 -0
  19. data/lib/remit/operations/get_prepaid_balance.rb +9 -5
  20. data/lib/remit/operations/get_recipient_verification_status.rb +25 -0
  21. data/lib/remit/operations/get_token_by_caller.rb +5 -1
  22. data/lib/remit/operations/get_token_usage.rb +5 -1
  23. data/lib/remit/operations/get_tokens.rb +5 -1
  24. data/lib/remit/operations/get_total_prepaid_liability.rb +9 -5
  25. data/lib/remit/operations/get_transaction.rb +1 -25
  26. data/lib/remit/operations/get_transaction_status.rb +28 -0
  27. data/lib/remit/operations/install_payment_instruction.rb +8 -1
  28. data/lib/remit/operations/pay.rb +5 -9
  29. data/lib/remit/operations/refund.rb +20 -11
  30. data/lib/remit/operations/reserve.rb +2 -4
  31. data/lib/remit/operations/settle.rb +2 -1
  32. data/lib/remit/operations/settle_debt.rb +2 -4
  33. data/lib/remit/operations/subscribe_for_caller_notification.rb +2 -0
  34. data/lib/remit/operations/unsubscribe_for_caller_notification.rb +2 -0
  35. data/lib/remit/operations/write_off_debt.rb +2 -4
  36. data/lib/remit/pipeline_response.rb +8 -41
  37. data/lib/remit/signature_utils_for_outbound.rb +74 -0
  38. data/lib/remit/verify_signature.rb +21 -0
  39. data/spec/integrations/get_account_activity_spec.rb +25 -19
  40. data/spec/integrations/get_tokens_spec.rb +9 -7
  41. data/spec/integrations/integrations_helper.rb +7 -0
  42. data/spec/integrations/ipn_request_spec.rb +28 -20
  43. data/spec/integrations/pipeline_response_spec.rb +27 -0
  44. data/spec/integrations/verify_signature_spec.rb +140 -0
  45. data/spec/mocks/CancelResponse.xml +13 -0
  46. data/spec/mocks/CancelSubscriptionAndRefundResponse.xml +10 -0
  47. data/spec/mocks/CancelTokenResponse.xml +6 -0
  48. data/spec/mocks/ErrorResponse.xml +15 -0
  49. data/spec/mocks/FundPrepaidResponse.xml +11 -0
  50. data/spec/mocks/GetAccountActivityResponse.xml +68 -0
  51. data/spec/mocks/GetAccountBalanceResponse.xml +34 -0
  52. data/spec/mocks/GetDebtBalanceResponse.xml +21 -0
  53. data/spec/mocks/GetOutstandingDebtBalanceResponse.xml +21 -0
  54. data/spec/mocks/GetPaymentInstructionResponse.xml +25 -0
  55. data/spec/mocks/GetPrepaidBalanceResponse.xml +21 -0
  56. data/spec/mocks/GetRecipientVerificationStatusResponse.xml +9 -0
  57. data/spec/mocks/GetTokenByCallerResponse.xml +22 -0
  58. data/spec/mocks/GetTokenUsageResponse.xml +28 -0
  59. data/spec/mocks/GetTokensResponse.xml +22 -0
  60. data/spec/mocks/GetTotalPrepaidLiabilityResponse.xml +21 -0
  61. data/spec/mocks/GetTransactionResponse.xml +76 -0
  62. data/spec/mocks/GetTransactionStatusResponse.xml +16 -0
  63. data/spec/mocks/InstallPaymentInstructionResponse.xml +10 -0
  64. data/spec/mocks/PayResponse.xml +11 -0
  65. data/spec/mocks/RefundResponse.xml +11 -0
  66. data/spec/mocks/ReserveResponse.xml +11 -0
  67. data/spec/mocks/SettleDebtResponse.xml +11 -0
  68. data/spec/mocks/SettleResponse.xml +11 -0
  69. data/spec/mocks/VerifySignatureResponse.xml +11 -0
  70. data/spec/mocks/WriteOffDebtResponse.xml +11 -0
  71. data/spec/mocks/errors/InvalidParameterValue.xml +10 -0
  72. data/spec/mocks/errors/InvalidParams_certificateUrl.xml +2 -0
  73. data/spec/mocks/errors/RequestExpired.xml +10 -0
  74. data/spec/spec_helper.rb +59 -10
  75. data/spec/units/cancel_subscription_and_refund_spec.rb +29 -0
  76. data/spec/units/cancel_token_spec.rb +24 -0
  77. data/spec/units/fund_prepaid_spec.rb +28 -0
  78. data/spec/units/get_account_activity_spec.rb +58 -0
  79. data/spec/units/get_account_balance_spec.rb +28 -0
  80. data/spec/units/get_debt_balance_spec.rb +29 -0
  81. data/spec/units/get_outstanding_debt_balance_spec.rb +29 -0
  82. data/spec/units/get_pipeline_spec.rb +16 -0
  83. data/spec/units/get_prepaid_balance_spec.rb +29 -0
  84. data/spec/units/get_recipient_verification_status_spec.rb +26 -0
  85. data/spec/units/get_token_by_caller_spec.rb +56 -0
  86. data/spec/units/get_token_usage_spec.rb +51 -0
  87. data/spec/units/get_tokens_spec.rb +56 -0
  88. data/spec/units/get_total_prepaid_liability_spec.rb +26 -0
  89. data/spec/units/get_transaction_spec.rb +103 -0
  90. data/spec/units/get_transaction_status_spec.rb +44 -0
  91. data/spec/units/pay_spec.rb +36 -57
  92. data/spec/units/refund_spec.rb +41 -0
  93. data/spec/units/reserve_spec.rb +41 -0
  94. data/spec/units/settle_debt_spec.rb +41 -0
  95. data/spec/units/settle_spec.rb +41 -0
  96. data/spec/units/units_helper.rb +23 -2
  97. data/spec/units/write_off_debt_spec.rb +41 -0
  98. metadata +116 -12
  99. data/lib/remit/operations/discard_results.rb +0 -18
  100. data/lib/remit/operations/get_results.rb +0 -27
  101. data/lib/remit/operations/retry_transaction.rb +0 -18
  102. data/spec/units/get_results_spec.rb +0 -49
@@ -1,4 +1,25 @@
1
- ACCESS_KEY = 'foo'
2
- SECRET_KEY = 'bar'
1
+ # figure out where we are being loaded from
2
+ if $LOADED_FEATURES.grep(/spec\/units\/units_helper\.rb/).any?
3
+ begin
4
+ raise "foo"
5
+ rescue => e
6
+ puts <<-MSG
7
+ ===================================================
8
+ It looks like units/units_helper.rb has been loaded
9
+ multiple times. Normalize the require to:
3
10
 
11
+ require "spec/units/units_helper"
12
+
13
+ Things like File.join and File.expand_path will
14
+ cause it to be loaded multiple times.
15
+
16
+ Loaded this time from:
17
+
18
+ #{e.backtrace.join("\n ")}
19
+ ===================================================
20
+ MSG
21
+ end
22
+ end
23
+
24
+ # Actual code of Units Helper below:
4
25
  require File.dirname(__FILE__) + '/../spec_helper'
@@ -0,0 +1,41 @@
1
+ require File.dirname(__FILE__) + '/units_helper'
2
+
3
+ describe "the WriteOffDebt API" do
4
+ describe "a successful response" do
5
+ it_should_behave_like 'a successful response'
6
+
7
+ before do
8
+ doc = <<-XML
9
+ <WriteOffDebtResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
10
+ <WriteOffDebtResult>
11
+ <TransactionId>14GK6F2QU755ODS27SGHEURLKPG72Z54KMF</TransactionId>
12
+ <TransactionStatus>Pending</TransactionStatus>
13
+ </WriteOffDebtResult>
14
+ <ResponseMetadata>
15
+ <RequestId>1a146b9a-b37b-4f5f-bda6-012a5b9e45c3:0</RequestId>
16
+ </ResponseMetadata>
17
+ </WriteOffDebtResponse>
18
+ XML
19
+
20
+ @response = Remit::WriteOffDebt::Response.new(doc)
21
+ end
22
+
23
+ it "has metadata" do
24
+ @response.response_metadata.should_not be_nil
25
+ end
26
+
27
+ it "has results" do
28
+ @response.write_off_debt_result.should_not be_nil
29
+ end
30
+
31
+
32
+ it "has a transaction id" do
33
+ @response.write_off_debt_result.transaction_id.should_not be_nil
34
+ end
35
+
36
+ it "has a transaction status" do
37
+ @response.write_off_debt_result.transaction_status.should_not be_nil
38
+ end
39
+
40
+ end
41
+ end
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remit
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
+ - 2
7
8
  - 0
8
- - 0
9
- - 6
10
- version: 0.0.6
9
+ - 1
10
+ version: 2.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tyler Hunt
14
+ - Peter Boling
14
15
  autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
@@ -35,7 +36,7 @@ dependencies:
35
36
  type: :runtime
36
37
  version_requirements: *id001
37
38
  description:
38
- email: tyler@tylerhunt.com
39
+ email: peter.boling+remit@gmail.com
39
40
  executables: []
40
41
 
41
42
  extensions: []
@@ -52,10 +53,11 @@ files:
52
53
  - lib/remit/data_types.rb
53
54
  - lib/remit/error_codes.rb
54
55
  - lib/remit/get_pipeline.rb
56
+ - lib/remit/inbound_request.rb
55
57
  - lib/remit/ipn_request.rb
58
+ - lib/remit/operations/cancel.rb
56
59
  - lib/remit/operations/cancel_subscription_and_refund.rb
57
60
  - lib/remit/operations/cancel_token.rb
58
- - lib/remit/operations/discard_results.rb
59
61
  - lib/remit/operations/fund_prepaid.rb
60
62
  - lib/remit/operations/get_account_activity.rb
61
63
  - lib/remit/operations/get_account_balance.rb
@@ -65,36 +67,88 @@ files:
65
67
  - lib/remit/operations/get_outstanding_debt_balance.rb
66
68
  - lib/remit/operations/get_payment_instruction.rb
67
69
  - lib/remit/operations/get_prepaid_balance.rb
68
- - lib/remit/operations/get_results.rb
70
+ - lib/remit/operations/get_recipient_verification_status.rb
69
71
  - lib/remit/operations/get_token_by_caller.rb
70
72
  - lib/remit/operations/get_token_usage.rb
71
73
  - lib/remit/operations/get_tokens.rb
72
74
  - lib/remit/operations/get_total_prepaid_liability.rb
73
75
  - lib/remit/operations/get_transaction.rb
76
+ - lib/remit/operations/get_transaction_status.rb
74
77
  - lib/remit/operations/install_payment_instruction.rb
75
78
  - lib/remit/operations/pay.rb
76
79
  - lib/remit/operations/refund.rb
77
80
  - lib/remit/operations/reserve.rb
78
- - lib/remit/operations/retry_transaction.rb
79
81
  - lib/remit/operations/settle.rb
80
82
  - lib/remit/operations/settle_debt.rb
81
83
  - lib/remit/operations/subscribe_for_caller_notification.rb
82
84
  - lib/remit/operations/unsubscribe_for_caller_notification.rb
83
85
  - lib/remit/operations/write_off_debt.rb
84
86
  - lib/remit/pipeline_response.rb
87
+ - lib/remit/signature_utils_for_outbound.rb
88
+ - lib/remit/verify_signature.rb
85
89
  - LICENSE
86
90
  - README.markdown
87
91
  - spec/integrations/get_account_activity_spec.rb
88
92
  - spec/integrations/get_tokens_spec.rb
89
93
  - spec/integrations/ipn_request_spec.rb
94
+ - spec/integrations/pipeline_response_spec.rb
95
+ - spec/integrations/verify_signature_spec.rb
96
+ - spec/units/cancel_subscription_and_refund_spec.rb
97
+ - spec/units/cancel_token_spec.rb
98
+ - spec/units/fund_prepaid_spec.rb
99
+ - spec/units/get_account_activity_spec.rb
100
+ - spec/units/get_account_balance_spec.rb
101
+ - spec/units/get_debt_balance_spec.rb
102
+ - spec/units/get_outstanding_debt_balance_spec.rb
90
103
  - spec/units/get_pipeline_spec.rb
91
- - spec/units/get_results_spec.rb
104
+ - spec/units/get_prepaid_balance_spec.rb
105
+ - spec/units/get_recipient_verification_status_spec.rb
106
+ - spec/units/get_token_by_caller_spec.rb
107
+ - spec/units/get_token_usage_spec.rb
108
+ - spec/units/get_tokens_spec.rb
109
+ - spec/units/get_total_prepaid_liability_spec.rb
110
+ - spec/units/get_transaction_spec.rb
111
+ - spec/units/get_transaction_status_spec.rb
92
112
  - spec/units/pay_spec.rb
113
+ - spec/units/refund_spec.rb
114
+ - spec/units/reserve_spec.rb
115
+ - spec/units/settle_debt_spec.rb
116
+ - spec/units/settle_spec.rb
117
+ - spec/units/write_off_debt_spec.rb
93
118
  - spec/integrations/integrations_helper.rb
94
119
  - spec/spec_helper.rb
95
120
  - spec/units/units_helper.rb
121
+ - spec/mocks/CancelResponse.xml
122
+ - spec/mocks/CancelSubscriptionAndRefundResponse.xml
123
+ - spec/mocks/CancelTokenResponse.xml
124
+ - spec/mocks/ErrorResponse.xml
125
+ - spec/mocks/errors/InvalidParameterValue.xml
126
+ - spec/mocks/errors/InvalidParams_certificateUrl.xml
127
+ - spec/mocks/errors/RequestExpired.xml
128
+ - spec/mocks/FundPrepaidResponse.xml
129
+ - spec/mocks/GetAccountActivityResponse.xml
130
+ - spec/mocks/GetAccountBalanceResponse.xml
131
+ - spec/mocks/GetDebtBalanceResponse.xml
132
+ - spec/mocks/GetOutstandingDebtBalanceResponse.xml
133
+ - spec/mocks/GetPaymentInstructionResponse.xml
134
+ - spec/mocks/GetPrepaidBalanceResponse.xml
135
+ - spec/mocks/GetRecipientVerificationStatusResponse.xml
136
+ - spec/mocks/GetTokenByCallerResponse.xml
137
+ - spec/mocks/GetTokensResponse.xml
138
+ - spec/mocks/GetTokenUsageResponse.xml
139
+ - spec/mocks/GetTotalPrepaidLiabilityResponse.xml
140
+ - spec/mocks/GetTransactionResponse.xml
141
+ - spec/mocks/GetTransactionStatusResponse.xml
142
+ - spec/mocks/InstallPaymentInstructionResponse.xml
143
+ - spec/mocks/PayResponse.xml
144
+ - spec/mocks/RefundResponse.xml
145
+ - spec/mocks/ReserveResponse.xml
146
+ - spec/mocks/SettleDebtResponse.xml
147
+ - spec/mocks/SettleResponse.xml
148
+ - spec/mocks/VerifySignatureResponse.xml
149
+ - spec/mocks/WriteOffDebtResponse.xml
96
150
  has_rdoc: true
97
- homepage: http://github.com/tylerhunt/remit
151
+ homepage: http://github.com/nyc-ruby-meetup/remit
98
152
  licenses: []
99
153
 
100
154
  post_install_message:
@@ -122,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
176
  version: "0"
123
177
  requirements: []
124
178
 
125
- rubyforge_project: remit
179
+ rubyforge_project: remit-nyc
126
180
  rubygems_version: 1.3.7
127
181
  signing_key:
128
182
  specification_version: 3
@@ -131,9 +185,59 @@ test_files:
131
185
  - spec/integrations/get_account_activity_spec.rb
132
186
  - spec/integrations/get_tokens_spec.rb
133
187
  - spec/integrations/ipn_request_spec.rb
188
+ - spec/integrations/pipeline_response_spec.rb
189
+ - spec/integrations/verify_signature_spec.rb
190
+ - spec/units/cancel_subscription_and_refund_spec.rb
191
+ - spec/units/cancel_token_spec.rb
192
+ - spec/units/fund_prepaid_spec.rb
193
+ - spec/units/get_account_activity_spec.rb
194
+ - spec/units/get_account_balance_spec.rb
195
+ - spec/units/get_debt_balance_spec.rb
196
+ - spec/units/get_outstanding_debt_balance_spec.rb
134
197
  - spec/units/get_pipeline_spec.rb
135
- - spec/units/get_results_spec.rb
198
+ - spec/units/get_prepaid_balance_spec.rb
199
+ - spec/units/get_recipient_verification_status_spec.rb
200
+ - spec/units/get_token_by_caller_spec.rb
201
+ - spec/units/get_token_usage_spec.rb
202
+ - spec/units/get_tokens_spec.rb
203
+ - spec/units/get_total_prepaid_liability_spec.rb
204
+ - spec/units/get_transaction_spec.rb
205
+ - spec/units/get_transaction_status_spec.rb
136
206
  - spec/units/pay_spec.rb
207
+ - spec/units/refund_spec.rb
208
+ - spec/units/reserve_spec.rb
209
+ - spec/units/settle_debt_spec.rb
210
+ - spec/units/settle_spec.rb
211
+ - spec/units/write_off_debt_spec.rb
137
212
  - spec/integrations/integrations_helper.rb
138
213
  - spec/spec_helper.rb
139
214
  - spec/units/units_helper.rb
215
+ - spec/mocks/CancelResponse.xml
216
+ - spec/mocks/CancelSubscriptionAndRefundResponse.xml
217
+ - spec/mocks/CancelTokenResponse.xml
218
+ - spec/mocks/ErrorResponse.xml
219
+ - spec/mocks/errors/InvalidParameterValue.xml
220
+ - spec/mocks/errors/InvalidParams_certificateUrl.xml
221
+ - spec/mocks/errors/RequestExpired.xml
222
+ - spec/mocks/FundPrepaidResponse.xml
223
+ - spec/mocks/GetAccountActivityResponse.xml
224
+ - spec/mocks/GetAccountBalanceResponse.xml
225
+ - spec/mocks/GetDebtBalanceResponse.xml
226
+ - spec/mocks/GetOutstandingDebtBalanceResponse.xml
227
+ - spec/mocks/GetPaymentInstructionResponse.xml
228
+ - spec/mocks/GetPrepaidBalanceResponse.xml
229
+ - spec/mocks/GetRecipientVerificationStatusResponse.xml
230
+ - spec/mocks/GetTokenByCallerResponse.xml
231
+ - spec/mocks/GetTokensResponse.xml
232
+ - spec/mocks/GetTokenUsageResponse.xml
233
+ - spec/mocks/GetTotalPrepaidLiabilityResponse.xml
234
+ - spec/mocks/GetTransactionResponse.xml
235
+ - spec/mocks/GetTransactionStatusResponse.xml
236
+ - spec/mocks/InstallPaymentInstructionResponse.xml
237
+ - spec/mocks/PayResponse.xml
238
+ - spec/mocks/RefundResponse.xml
239
+ - spec/mocks/ReserveResponse.xml
240
+ - spec/mocks/SettleDebtResponse.xml
241
+ - spec/mocks/SettleResponse.xml
242
+ - spec/mocks/VerifySignatureResponse.xml
243
+ - spec/mocks/WriteOffDebtResponse.xml
@@ -1,18 +0,0 @@
1
- require 'remit/common'
2
-
3
- module Remit
4
- module DiscardResults
5
- class Request < Remit::Request
6
- action :DiscardResults
7
- parameter :transaction_ids, :required => true
8
- end
9
-
10
- class Response < Remit::Response
11
- parameter :discard_errors
12
- end
13
-
14
- def discard_results(request = Request.new)
15
- call(request, Response)
16
- end
17
- end
18
- end
@@ -1,27 +0,0 @@
1
- require 'remit/common'
2
-
3
- module Remit
4
- module GetResults
5
- class Request < Remit::Request
6
- action :GetResults
7
- parameter :operation
8
- parameter :max_results_count
9
- end
10
-
11
- class Response < Remit::Response
12
- class TransactionResults < Remit::BaseResponse
13
- parameter :transaction_id
14
- parameter :operation_type, :element => :operation
15
- parameter :caller_reference
16
- parameter :transaction_status, :element => :status
17
- end
18
-
19
- parameter :transaction_results, :collection => TransactionResults
20
- parameter :number_pending, :type => :integer
21
- end
22
-
23
- def get_results(request = Request.new)
24
- call(request, Response)
25
- end
26
- end
27
- end
@@ -1,18 +0,0 @@
1
- require 'remit/common'
2
-
3
- module Remit
4
- module RetryTransaction
5
- class Request < Remit::Request
6
- action :RetryTransaction
7
- parameter :original_transaction_id, :required => true
8
- end
9
-
10
- class Response < Remit::Response
11
- parameter :transaction_response, :type => TransactionResponse
12
- end
13
-
14
- def retry_transaction(request = Request.new)
15
- call(request, Response)
16
- end
17
- end
18
- 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