amazon_flex_pay 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.rdoc +41 -0
- data/Rakefile +23 -0
- data/lib/amazon_flex_pay/api/base.rb +86 -0
- data/lib/amazon_flex_pay/api/cancel.rb +11 -0
- data/lib/amazon_flex_pay/api/cancel_token.rb +9 -0
- data/lib/amazon_flex_pay/api/get_account_activity.rb +21 -0
- data/lib/amazon_flex_pay/api/get_account_balance.rb +8 -0
- data/lib/amazon_flex_pay/api/get_recipient_verification_status.rb +9 -0
- data/lib/amazon_flex_pay/api/get_token_by_caller.rb +10 -0
- data/lib/amazon_flex_pay/api/get_token_usage.rb +9 -0
- data/lib/amazon_flex_pay/api/get_tokens.rb +13 -0
- data/lib/amazon_flex_pay/api/get_transaction.rb +9 -0
- data/lib/amazon_flex_pay/api/get_transaction_status.rb +13 -0
- data/lib/amazon_flex_pay/api/pay.rb +20 -0
- data/lib/amazon_flex_pay/api/refund.rb +14 -0
- data/lib/amazon_flex_pay/api/reserve.rb +20 -0
- data/lib/amazon_flex_pay/api/settle.rb +11 -0
- data/lib/amazon_flex_pay/api/verify_signature.rb +14 -0
- data/lib/amazon_flex_pay/api.rb +162 -0
- data/lib/amazon_flex_pay/data_types.rb +138 -0
- data/lib/amazon_flex_pay/enumerations.rb +23 -0
- data/lib/amazon_flex_pay/model.rb +130 -0
- data/lib/amazon_flex_pay/pipelines/base.rb +40 -0
- data/lib/amazon_flex_pay/pipelines/edit_token.rb +6 -0
- data/lib/amazon_flex_pay/pipelines/multi_use.rb +28 -0
- data/lib/amazon_flex_pay/pipelines/recipient.rb +10 -0
- data/lib/amazon_flex_pay/pipelines/single_use.rb +24 -0
- data/lib/amazon_flex_pay/pipelines.rb +41 -0
- data/lib/amazon_flex_pay/signing.rb +42 -0
- data/lib/amazon_flex_pay.rb +53 -0
- data/test/amazon_flex_pay_test.rb +117 -0
- data/test/api_test.rb +310 -0
- data/test/pipelines_test.rb +46 -0
- data/test/response_samples.rb +588 -0
- data/test/test_helper.rb +22 -0
- metadata +167 -0
@@ -0,0 +1,588 @@
|
|
1
|
+
# Sample REST responses pulled from Amazon's Docs
|
2
|
+
module ResponseSamples
|
3
|
+
|
4
|
+
def cancel_response
|
5
|
+
<<-END
|
6
|
+
<CancelResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
7
|
+
<CancelResult>
|
8
|
+
<TransactionId>14GKI1SKSR1V6DO1RCCB32RBR6KLODMGQUD</TransactionId>
|
9
|
+
<TransactionStatus>Cancelled</TransactionStatus>
|
10
|
+
</CancelResult>
|
11
|
+
<ResponseMetadata>
|
12
|
+
<RequestId>6fe4b755-a328-419d-8967-e1d3b43779fc:0</RequestId>
|
13
|
+
</ResponseMetadata>
|
14
|
+
</CancelResponse>
|
15
|
+
END
|
16
|
+
end
|
17
|
+
|
18
|
+
def cancel_token_response
|
19
|
+
<<-END
|
20
|
+
<CancelTokenResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
21
|
+
<ResponseMetadata>
|
22
|
+
<RequestId>a10e0ad6-148f-4afe-8bcd-e80a2680793d:0</RequestId>
|
23
|
+
</ResponseMetadata>
|
24
|
+
</CancelTokenResponse>
|
25
|
+
END
|
26
|
+
end
|
27
|
+
|
28
|
+
def error_response
|
29
|
+
<<-END
|
30
|
+
<?xml version="1.0"?>
|
31
|
+
<Response>
|
32
|
+
<Errors>
|
33
|
+
<Error>
|
34
|
+
<Code>InvalidParams</Code>
|
35
|
+
<Message>transactionId has to be a valid transaction ID. Specified value: FAKE</Message>
|
36
|
+
</Error>
|
37
|
+
</Errors>
|
38
|
+
<RequestID>50ca0b2f-9435-4852-a889-89d144c07ff6</RequestID>
|
39
|
+
</Response>
|
40
|
+
END
|
41
|
+
end
|
42
|
+
|
43
|
+
def get_account_activity_response
|
44
|
+
<<-END
|
45
|
+
<GetAccountActivityResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
46
|
+
<GetAccountActivityResult>
|
47
|
+
<BatchSize>5</BatchSize>
|
48
|
+
<Transaction>
|
49
|
+
<TransactionId>14GN2BUHUAV4KG5S8USHN79PQH1NGN5ADK4</TransactionId>
|
50
|
+
<CallerTransactionDate>
|
51
|
+
2009-10-07T01:37:54.765-07:00
|
52
|
+
</CallerTransactionDate>
|
53
|
+
<DateReceived>2009-10-07T01:38:11.262-07:00</DateReceived>
|
54
|
+
<DateCompleted>2009-10-07T01:38:12.857-07:00</DateCompleted>
|
55
|
+
<TransactionAmount>
|
56
|
+
<CurrencyCode>USD</CurrencyCode>
|
57
|
+
<Value>1.000000</Value>
|
58
|
+
</TransactionAmount>
|
59
|
+
<FPSOperation>FundPrepaid</FPSOperation>
|
60
|
+
<TransactionStatus>Success</TransactionStatus>
|
61
|
+
<StatusMessage>
|
62
|
+
The transaction was successful and the payment instrument was charged.
|
63
|
+
</StatusMessage>
|
64
|
+
<StatusCode>Success</StatusCode>
|
65
|
+
<TransactionPart>
|
66
|
+
<Role>Recipient</Role>
|
67
|
+
<Name>Test Business</Name>
|
68
|
+
<FeesPaid>
|
69
|
+
<CurrencyCode>USD</CurrencyCode>
|
70
|
+
<Value>0.100000</Value>
|
71
|
+
</FeesPaid>
|
72
|
+
</TransactionPart>
|
73
|
+
<TransactionPart>
|
74
|
+
<Role>Caller</Role>
|
75
|
+
<Name>Test Business</Name>
|
76
|
+
<Reference>CallerReference10</Reference>
|
77
|
+
<Description>MyWish</Description>
|
78
|
+
<FeesPaid>
|
79
|
+
<CurrencyCode>USD</CurrencyCode>
|
80
|
+
<Value>0.000000</Value>
|
81
|
+
</FeesPaid>
|
82
|
+
</TransactionPart>
|
83
|
+
<PaymentMethod>CC</PaymentMethod>
|
84
|
+
<SenderName>Test Business</SenderName>
|
85
|
+
<CallerName>Test Business</CallerName>
|
86
|
+
<RecipientName>Test Business</RecipientName>
|
87
|
+
<FPSFees>
|
88
|
+
<CurrencyCode>USD</CurrencyCode>
|
89
|
+
<Value>0.100000</Value>
|
90
|
+
</FPSFees>
|
91
|
+
<Balance>
|
92
|
+
<CurrencyCode>USD</CurrencyCode>
|
93
|
+
<Value>7.400000</Value>
|
94
|
+
</Balance>
|
95
|
+
<SenderTokenId>
|
96
|
+
563INMLCG3ZJJ4L1I7BB31MN2FBQUCVXNTDRTCT5A2DJDXG6LNZ7KSNUJPI7TVIF
|
97
|
+
</SenderTokenId>
|
98
|
+
</Transaction>
|
99
|
+
<Transaction>
|
100
|
+
<TransactionId>14GN1O5992IEOB3ELM1SCUFTSOQ3C6S7NR2</TransactionId>
|
101
|
+
<CallerTransactionDate>2009-10-07T01:27:21.469-07:00</CallerTransactionDate>
|
102
|
+
<DateReceived>2009-10-07T01:27:22.793-07:00</DateReceived>
|
103
|
+
<DateCompleted>2009-10-07T01:27:23.335-07:00</DateCompleted>
|
104
|
+
<TransactionAmount>
|
105
|
+
<CurrencyCode>USD</CurrencyCode>
|
106
|
+
<Value>4.000000</Value>
|
107
|
+
</TransactionAmount>
|
108
|
+
<FPSOperation>Pay</FPSOperation>
|
109
|
+
<TransactionStatus>Success</TransactionStatus>
|
110
|
+
<StatusMessage>
|
111
|
+
The transaction was successful and the payment instrument was charged.
|
112
|
+
</StatusMessage>
|
113
|
+
<StatusCode>Success</StatusCode>
|
114
|
+
<TransactionPart>
|
115
|
+
<Role>Recipient</Role>
|
116
|
+
<Name>Test Business</Name>
|
117
|
+
<Reference>Prepaid Digital Download - 1254904041469</Reference>
|
118
|
+
<Description>Prepaid Digital Download</Description>
|
119
|
+
<FeesPaid>
|
120
|
+
<CurrencyCode>USD</CurrencyCode>
|
121
|
+
<Value>0.000000</Value>
|
122
|
+
</FeesPaid>
|
123
|
+
</TransactionPart>
|
124
|
+
<TransactionPart>
|
125
|
+
<Role>Caller</Role>
|
126
|
+
<Name>Test Business</Name>
|
127
|
+
<Reference>Prepaid Digital Download - 1254904034205</Reference>
|
128
|
+
<Description>
|
129
|
+
Prepaid Digital Download - payment for mp3 from digital.
|
130
|
+
</Description>
|
131
|
+
<FeesPaid>
|
132
|
+
<CurrencyCode>USD</CurrencyCode>
|
133
|
+
<Value>0.000000</Value>
|
134
|
+
</FeesPaid>
|
135
|
+
</TransactionPart>
|
136
|
+
<PaymentMethod>Prepaid</PaymentMethod>
|
137
|
+
<SenderName>Test Business</SenderName>
|
138
|
+
<CallerName>Test Business</CallerName>
|
139
|
+
<RecipientName>Test Business</RecipientName>
|
140
|
+
<FPSFees>
|
141
|
+
<CurrencyCode>USD</CurrencyCode>
|
142
|
+
<Value>0</Value>
|
143
|
+
</FPSFees>
|
144
|
+
<Balance>
|
145
|
+
<CurrencyCode>USD</CurrencyCode>
|
146
|
+
<Value>6.500000</Value>
|
147
|
+
</Balance>
|
148
|
+
<SenderTokenId>
|
149
|
+
513I1MGCG6ZZJ49157BZ3EMNJFAQU6V9NTSRUCTEANDJ3X46LGZNKSJUVPIXTPID
|
150
|
+
</SenderTokenId>
|
151
|
+
<RecipientTokenId>
|
152
|
+
D639FT4TMP4QK9UBH6PAK2WAXGHDZSBUX3UJSGVX3LEFVGU7XDQXMENL4OGVZEGB
|
153
|
+
</RecipientTokenId>
|
154
|
+
</Transaction>
|
155
|
+
<Transaction>
|
156
|
+
<TransactionId>14GN1NHHN489BFGH6D8BMGT8NLSR2DJ4PNK</TransactionId>
|
157
|
+
<CallerTransactionDate>
|
158
|
+
2009-10-07T01:26:58.190-07:00
|
159
|
+
</CallerTransactionDate>
|
160
|
+
<DateReceived>2009-10-07T01:27:02.583-07:00</DateReceived>
|
161
|
+
<DateCompleted>2009-10-07T01:27:04.435-07:00</DateCompleted>
|
162
|
+
<TransactionAmount>
|
163
|
+
<CurrencyCode>USD</CurrencyCode>
|
164
|
+
<Value>5.000000</Value>
|
165
|
+
</TransactionAmount>
|
166
|
+
<FPSOperation>FundPrepaid</FPSOperation>
|
167
|
+
<TransactionStatus>Success</TransactionStatus>
|
168
|
+
<StatusMessage>
|
169
|
+
The transaction was successful and the payment instrument was charged.
|
170
|
+
</StatusMessage>
|
171
|
+
<StatusCode>Success</StatusCode>
|
172
|
+
<TransactionPart>
|
173
|
+
<Role>Caller</Role>
|
174
|
+
<Name>Test Business</Name>
|
175
|
+
<Reference>Prepaid Digital Download - 1254903995419</Reference>
|
176
|
+
<FeesPaid>
|
177
|
+
<CurrencyCode>USD</CurrencyCode>
|
178
|
+
<Value>0.000000</Value>
|
179
|
+
</FeesPaid>
|
180
|
+
</TransactionPart>
|
181
|
+
<TransactionPart>
|
182
|
+
<Role>Recipient</Role>
|
183
|
+
<Name>Test Business</Name>
|
184
|
+
<FeesPaid>
|
185
|
+
<CurrencyCode>USD</CurrencyCode>
|
186
|
+
<Value>0.300000</Value>
|
187
|
+
</FeesPaid>
|
188
|
+
</TransactionPart>
|
189
|
+
<PaymentMethod>CC</PaymentMethod>
|
190
|
+
<SenderName>Test Business</SenderName>
|
191
|
+
<CallerName>Test Business</CallerName>
|
192
|
+
<RecipientName>Test Business</RecipientName>
|
193
|
+
<FPSFees>
|
194
|
+
<CurrencyCode>USD</CurrencyCode>
|
195
|
+
<Value>0.300000</Value>
|
196
|
+
</FPSFees>
|
197
|
+
<Balance>
|
198
|
+
<CurrencyCode>USD</CurrencyCode>
|
199
|
+
<Value>6.500000</Value>
|
200
|
+
</Balance>
|
201
|
+
<SenderTokenId>
|
202
|
+
513ISM2CGDZPJ4S1D7BH3HMNIFCQUAVNNTQRXCTHAUDJLXV6LMZLKSTUKPITTXIV
|
203
|
+
</SenderTokenId>
|
204
|
+
</Transaction>
|
205
|
+
<Transaction>
|
206
|
+
<TransactionId>14GMNT2PDVUJA18L44TO4DIFJEJRF9LTV2T</TransactionId>
|
207
|
+
<CallerTransactionDate>
|
208
|
+
2009-10-06T22:35:02.031-07:00
|
209
|
+
</CallerTransactionDate>
|
210
|
+
<DateReceived>2009-10-06T22:35:18.317-07:00</DateReceived>
|
211
|
+
<DateCompleted>2009-10-06T22:35:19.332-07:00</DateCompleted>
|
212
|
+
<TransactionAmount>
|
213
|
+
<CurrencyCode>USD</CurrencyCode>
|
214
|
+
<Value>1.000000</Value>
|
215
|
+
</TransactionAmount>
|
216
|
+
<FPSOperation>Refund</FPSOperation>
|
217
|
+
<TransactionStatus>Success</TransactionStatus>
|
218
|
+
<StatusMessage>
|
219
|
+
The transaction was successful and the payment instrument was charged.
|
220
|
+
</StatusMessage>
|
221
|
+
<StatusCode>Success</StatusCode>
|
222
|
+
<TransactionPart>
|
223
|
+
<Role>Caller</Role>
|
224
|
+
<Name>Test Business</Name>
|
225
|
+
<Reference>CallerReference09</Reference>
|
226
|
+
<FeesPaid>
|
227
|
+
<CurrencyCode>USD</CurrencyCode>
|
228
|
+
<Value>0.000000</Value>
|
229
|
+
</FeesPaid>
|
230
|
+
</TransactionPart>
|
231
|
+
<TransactionPart>
|
232
|
+
<Role>Sender</Role>
|
233
|
+
<Name>Test Business</Name>
|
234
|
+
<FeesPaid>
|
235
|
+
<CurrencyCode>USD</CurrencyCode>
|
236
|
+
<Value>-0.100000</Value>
|
237
|
+
</FeesPaid>
|
238
|
+
</TransactionPart>
|
239
|
+
<PaymentMethod>CC</PaymentMethod>
|
240
|
+
<SenderName>Test Business</SenderName>
|
241
|
+
<CallerName>Test Business</CallerName>
|
242
|
+
<RecipientName>Test Business</RecipientName>
|
243
|
+
<FPSFees>
|
244
|
+
<CurrencyCode>USD</CurrencyCode>
|
245
|
+
<Value>-0.100000</Value>
|
246
|
+
</FPSFees>
|
247
|
+
<Balance>
|
248
|
+
<CurrencyCode>USD</CurrencyCode>
|
249
|
+
<Value>1.800000</Value>
|
250
|
+
</Balance>
|
251
|
+
</Transaction>
|
252
|
+
<Transaction>
|
253
|
+
<TransactionId>14GMNRDSJ6TJTNDUTOUA917PIFJDSGNB2JP</TransactionId>
|
254
|
+
<CallerTransactionDate>
|
255
|
+
2009-10-06T22:34:24.053-07:00
|
256
|
+
</CallerTransactionDate>
|
257
|
+
<DateReceived>2009-10-06T22:34:24.147-07:00</DateReceived>
|
258
|
+
<DateCompleted>2009-10-06T22:34:25.223-07:00</DateCompleted>
|
259
|
+
<TransactionAmount>
|
260
|
+
<CurrencyCode>USD</CurrencyCode>
|
261
|
+
<Value>1.000000</Value>
|
262
|
+
</TransactionAmount>
|
263
|
+
<FPSOperation>Pay</FPSOperation>
|
264
|
+
<TransactionStatus>Success</TransactionStatus>
|
265
|
+
<StatusMessage>
|
266
|
+
The transaction was successful and the payment instrument was charged.
|
267
|
+
</StatusMessage>
|
268
|
+
<StatusCode>Success</StatusCode>
|
269
|
+
<TransactionPart>
|
270
|
+
<Role>Recipient</Role>
|
271
|
+
<Name>Test Business</Name>
|
272
|
+
<Description>SubscriptionTesting</Description>
|
273
|
+
<FeesPaid>
|
274
|
+
<CurrencyCode>USD</CurrencyCode>
|
275
|
+
<Value>0.100000</Value>
|
276
|
+
</FeesPaid>
|
277
|
+
</TransactionPart>
|
278
|
+
<TransactionPart>
|
279
|
+
<Role>Caller</Role>
|
280
|
+
<Name>Test Business</Name>
|
281
|
+
<Reference>63314e32-d6b0-4abd-a0ab-7b89717ba5cb</Reference>
|
282
|
+
<FeesPaid>
|
283
|
+
<CurrencyCode>USD</CurrencyCode>
|
284
|
+
<Value>0.000000</Value>
|
285
|
+
</FeesPaid>
|
286
|
+
</TransactionPart>
|
287
|
+
<PaymentMethod>CC</PaymentMethod>
|
288
|
+
<SenderName>Test Business</SenderName>
|
289
|
+
<CallerName>Test Business</CallerName>
|
290
|
+
<RecipientName>Test Business</RecipientName>
|
291
|
+
<FPSFees>
|
292
|
+
<CurrencyCode>USD</CurrencyCode>
|
293
|
+
<Value>0.100000</Value>
|
294
|
+
</FPSFees>
|
295
|
+
<Balance>
|
296
|
+
<CurrencyCode>USD</CurrencyCode>
|
297
|
+
<Value>2.700000</Value>
|
298
|
+
</Balance>
|
299
|
+
<SenderTokenId>
|
300
|
+
533I1M9CGUZ9J4M197BM3LMNKFVQUFVFNT5RRCT2ACDJBXV6LRZ6KSRUSPI6T3I3
|
301
|
+
</SenderTokenId>
|
302
|
+
<RecipientTokenId>
|
303
|
+
D139MTVTMK4CK9QB26PKKLWA1GHDZGBGX3SJLGVU37EFUGJ7XVQIMETLSOGAZJGV
|
304
|
+
</RecipientTokenId>
|
305
|
+
</Transaction>
|
306
|
+
</GetAccountActivityResult>
|
307
|
+
<ResponseMetadata>
|
308
|
+
<RequestId>87e1570a-ef8c-4846-8265-74d07a6a83fb:0</RequestId>
|
309
|
+
</ResponseMetadata>
|
310
|
+
</GetAccountActivityResponse>
|
311
|
+
END
|
312
|
+
end
|
313
|
+
|
314
|
+
def get_account_balance_response
|
315
|
+
<<-END
|
316
|
+
<GetAccountBalanceResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
317
|
+
<GetAccountBalanceResult>
|
318
|
+
<AccountBalance>
|
319
|
+
<TotalBalance>
|
320
|
+
<CurrencyCode>USD</CurrencyCode>
|
321
|
+
<Value>7.400000</Value>
|
322
|
+
</TotalBalance>
|
323
|
+
<PendingInBalance>
|
324
|
+
<CurrencyCode>USD</CurrencyCode>
|
325
|
+
<Value>0.000000</Value>
|
326
|
+
</PendingInBalance>
|
327
|
+
<PendingOutBalance>
|
328
|
+
<CurrencyCode>USD</CurrencyCode>
|
329
|
+
<Value>0.000000</Value>
|
330
|
+
</PendingOutBalance>
|
331
|
+
<AvailableBalances>
|
332
|
+
<DisburseBalance>
|
333
|
+
<CurrencyCode>USD</CurrencyCode>
|
334
|
+
<Value>7.400000</Value>
|
335
|
+
</DisburseBalance>
|
336
|
+
<RefundBalance>
|
337
|
+
<CurrencyCode>USD</CurrencyCode>
|
338
|
+
<Value>7.400000</Value>
|
339
|
+
</RefundBalance>
|
340
|
+
</AvailableBalances>
|
341
|
+
</AccountBalance>
|
342
|
+
</GetAccountBalanceResult>
|
343
|
+
<ResponseMetadata>
|
344
|
+
<RequestId>7b74a504-7517-4d81-8312-1427570d028c:0</RequestId>
|
345
|
+
</ResponseMetadata>
|
346
|
+
</GetAccountBalanceResponse>
|
347
|
+
END
|
348
|
+
end
|
349
|
+
|
350
|
+
def get_recipient_verification_status_response
|
351
|
+
<<-END
|
352
|
+
<GetRecipientVerificationResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
353
|
+
<GetRecipientVerificationResult>
|
354
|
+
<RecipientVerificationStatus>
|
355
|
+
VerificationComplete
|
356
|
+
</RecipientVerificationStatus>
|
357
|
+
</GetRecipientVerificationResult>
|
358
|
+
<ResponseMetadata>
|
359
|
+
<RequestId>197e2085-1ed7-47a2-93d8-d76b452acc74:0</RequestId>
|
360
|
+
</ResponseMetadata>
|
361
|
+
</GetRecipientVerificationResponse>
|
362
|
+
END
|
363
|
+
end
|
364
|
+
|
365
|
+
def get_token_by_caller_response
|
366
|
+
<<-END
|
367
|
+
<GetTokenByCallerResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
368
|
+
<GetTokenByCallerResult>
|
369
|
+
<Token>
|
370
|
+
<TokenId>
|
371
|
+
543IJMECGZZ3J4K1F7BJ3TMNXFBQU9VXNT7RRCTNAJDJ8X36L1ZRKSUUPPIBTTIK
|
372
|
+
</TokenId>
|
373
|
+
<FriendlyName>Friendly1339359778</FriendlyName>
|
374
|
+
<TokenStatus>Active</TokenStatus>
|
375
|
+
<DateInstalled>2009-10-07T04:29:05.054-07:00</DateInstalled>
|
376
|
+
<CallerReference>callerReferenceSingleUse10</CallerReference>
|
377
|
+
<TokenType>SingleUse</TokenType>
|
378
|
+
<OldTokenId>
|
379
|
+
543IJMECGZZ3J4K1F7BJ3TMNXFBQU9VXNT7RRCTNAJDJ8X36L1ZRKSUUPPIBTTIK
|
380
|
+
</OldTokenId>
|
381
|
+
<PaymentReason>PaymentReason</PaymentReason>
|
382
|
+
</Token>
|
383
|
+
</GetTokenByCallerResult>
|
384
|
+
<ResponseMetadata>
|
385
|
+
<RequestId>45b6c560-8aa9-463c-84be-80eeefb21034:0</RequestId>
|
386
|
+
</ResponseMetadata>
|
387
|
+
</GetTokenByCallerResponse>
|
388
|
+
END
|
389
|
+
end
|
390
|
+
|
391
|
+
def get_token_usage_response
|
392
|
+
<<-END
|
393
|
+
<GetTokenUsageResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
394
|
+
<GetTokenUsageResult>
|
395
|
+
<TokenUsageLimits>
|
396
|
+
<Amount>
|
397
|
+
<CurrencyCode>USD</CurrencyCode>
|
398
|
+
<Value>10.000000</Value>
|
399
|
+
</Amount>
|
400
|
+
<LastResetAmount>
|
401
|
+
<CurrencyCode>USD</CurrencyCode>
|
402
|
+
<Value>0.000000</Value>
|
403
|
+
</LastResetAmount>
|
404
|
+
<LastResetTimestamp>
|
405
|
+
2008-01-01T02:00:00.000-08:00
|
406
|
+
</LastResetTimestamp>
|
407
|
+
</TokenUsageLimits>
|
408
|
+
<TokenUsageLimits>
|
409
|
+
<Count>1</Count>
|
410
|
+
<LastResetCount>0</LastResetCount>
|
411
|
+
<LastResetTimestamp>
|
412
|
+
2008-01-01T02:00:00.000-08:00
|
413
|
+
</LastResetTimestamp>
|
414
|
+
</TokenUsageLimits>
|
415
|
+
</GetTokenUsageResult>
|
416
|
+
<ResponseMetadata>
|
417
|
+
<RequestId>9faeed71-9362-4eb8-9431-b99e92b441ee:0</RequestId>
|
418
|
+
</ResponseMetadata>
|
419
|
+
</GetTokenUsageResponse>
|
420
|
+
END
|
421
|
+
end
|
422
|
+
|
423
|
+
def get_tokens_response
|
424
|
+
<<-END
|
425
|
+
<GetTokensResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
426
|
+
<GetTokensResult>
|
427
|
+
<Token>
|
428
|
+
<TokenId>
|
429
|
+
D439DTSTMP4FK9NBL6PEKZWAPGRDZ2BDX3MJNGVX37EF3GA7XRQHMEELQOGFZ9GK
|
430
|
+
</TokenId>
|
431
|
+
<TokenStatus>Active</TokenStatus>
|
432
|
+
<DateInstalled>2009-10-07T04:37:57.375-07:00</DateInstalled>
|
433
|
+
<CallerReference>CallerReference12</CallerReference>
|
434
|
+
<TokenType>SingleUse</TokenType>
|
435
|
+
<OldTokenId>
|
436
|
+
D439DTSTMP4FK9NBL6PEKZWAPGRDZ2BDX3MJNGVX37EF3GA7XRQHMEELQOGFZ9GK
|
437
|
+
</OldTokenId>
|
438
|
+
</Token>
|
439
|
+
</GetTokensResult>
|
440
|
+
<ResponseMetadata>
|
441
|
+
<RequestId>c9db3c80-ff03-4a32-b6b6-ee071cd118c8:0</RequestId>
|
442
|
+
</ResponseMetadata>
|
443
|
+
</GetTokensResponse>
|
444
|
+
END
|
445
|
+
end
|
446
|
+
|
447
|
+
def get_transaction_response
|
448
|
+
<<-END
|
449
|
+
<GetTransactionResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
450
|
+
<GetTransactionResult>
|
451
|
+
<Transaction>
|
452
|
+
<TransactionId>14GK6BGKA7U6OU6SUTNLBI5SBBV9PGDJ6UL</TransactionId>
|
453
|
+
<CallerReference>CallerReference02</CallerReference>
|
454
|
+
<CallerDescription>MyWish</CallerDescription>
|
455
|
+
<DateReceived>2009-10-05T22:50:08.010-07:00</DateReceived>
|
456
|
+
<DateCompleted>2009-10-05T22:50:09.086-07:00</DateCompleted>
|
457
|
+
<TransactionAmount>
|
458
|
+
<CurrencyCode>USD</CurrencyCode>
|
459
|
+
<Value>1.000000</Value>
|
460
|
+
</TransactionAmount>
|
461
|
+
<FPSFees>
|
462
|
+
<CurrencyCode>USD</CurrencyCode>
|
463
|
+
<Value>0.100000</Value>
|
464
|
+
</FPSFees>
|
465
|
+
<FPSFeesPaidBy>Recipient</FPSFeesPaidBy>
|
466
|
+
<SenderTokenId>
|
467
|
+
553ILMLCG6Z8J431H7BX3UMN3FFQU8VSNTSRNCTAASDJNX66LNZLKSZU3PI7TXIH
|
468
|
+
</SenderTokenId>
|
469
|
+
<FPSOperation>Pay</FPSOperation>
|
470
|
+
<PaymentMethod>CC</PaymentMethod>
|
471
|
+
<TransactionStatus>Success</TransactionStatus>
|
472
|
+
<StatusCode>Success</StatusCode>
|
473
|
+
<StatusMessage>
|
474
|
+
The transaction was successful and the payment instrument was charged.
|
475
|
+
</StatusMessage>
|
476
|
+
<SenderName>Test Business</SenderName>
|
477
|
+
<SenderEmail>new_premium@amazon.com</SenderEmail>
|
478
|
+
<CallerName>Test Business</CallerName>
|
479
|
+
<RecipientName>Test Business</RecipientName>
|
480
|
+
<RecipientEmail>test-caller@amazon.com</RecipientEmail>
|
481
|
+
<StatusHistory>
|
482
|
+
<Date>2009-10-05T22:50:08.092-07:00</Date>
|
483
|
+
<TransactionStatus>Pending</TransactionStatus>
|
484
|
+
<StatusCode>PendingNetworkResponse</StatusCode>
|
485
|
+
</StatusHistory>
|
486
|
+
<StatusHistory>
|
487
|
+
<Date>2009-10-05T22:50:09.086-07:00</Date>
|
488
|
+
<TransactionStatus>Success</TransactionStatus>
|
489
|
+
<StatusCode>Success</StatusCode>
|
490
|
+
</StatusHistory>
|
491
|
+
</Transaction>
|
492
|
+
</GetTransactionResult>
|
493
|
+
<ResponseMetadata>
|
494
|
+
<RequestId>0702960e-8221-4e04-9413-ca7d010d3b06:0</RequestId>
|
495
|
+
</ResponseMetadata>
|
496
|
+
</GetTransactionResponse>
|
497
|
+
END
|
498
|
+
end
|
499
|
+
|
500
|
+
def get_transaction_status_response
|
501
|
+
<<-END
|
502
|
+
<GetTransactionStatusResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
503
|
+
<GetTransactionStatusResult>
|
504
|
+
<TransactionId>14GKE3B85HCMF1BTSH5C4PD2IHZL95RJ2LM</TransactionId>
|
505
|
+
<TransactionStatus>Success</TransactionStatus>
|
506
|
+
<CallerReference>CallerReference07</CallerReference>
|
507
|
+
<StatusCode>Success</StatusCode>
|
508
|
+
<StatusMessage>
|
509
|
+
The transaction was successful and the payment instrument was charged.
|
510
|
+
</StatusMessage>
|
511
|
+
</GetTransactionStatusResult>
|
512
|
+
<ResponseMetadata>
|
513
|
+
<RequestId>13279842-6f84-41ef-ae36-c1ededaf278d:0</RequestId>
|
514
|
+
</ResponseMetadata>
|
515
|
+
</GetTransactionStatusResponse>
|
516
|
+
END
|
517
|
+
end
|
518
|
+
|
519
|
+
def pay_response
|
520
|
+
<<-END
|
521
|
+
<PayResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
522
|
+
<PayResult>
|
523
|
+
<TransactionId>14GK6BGKA7U6OU6SUTNLBI5SBBV9PGDJ6UL</TransactionId>
|
524
|
+
<TransactionStatus>Pending</TransactionStatus>
|
525
|
+
</PayResult>
|
526
|
+
<ResponseMetadata>
|
527
|
+
<RequestId>c21e7735-9c08-4cd8-99bf-535a848c79b4:0</RequestId>
|
528
|
+
</ResponseMetadata>
|
529
|
+
</PayResponse>
|
530
|
+
END
|
531
|
+
end
|
532
|
+
|
533
|
+
def refund_response
|
534
|
+
<<-END
|
535
|
+
<RefundResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
536
|
+
<RefundResult>
|
537
|
+
<TransactionId>14GK6F2QU755ODS27SGHEURLKPG72Z54KMF</TransactionId>
|
538
|
+
<TransactionStatus>Pending</TransactionStatus>
|
539
|
+
</RefundResult>
|
540
|
+
<ResponseMetadata>
|
541
|
+
<RequestId>1a146b9a-b37b-4f5f-bda6-012a5b9e45c3:0</RequestId>
|
542
|
+
</ResponseMetadata>
|
543
|
+
</RefundResponse>
|
544
|
+
END
|
545
|
+
end
|
546
|
+
|
547
|
+
def reserve_response
|
548
|
+
<<-END
|
549
|
+
<ReserveResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
550
|
+
<ReserveResult>
|
551
|
+
<TransactionId>14GKD9GE66FAA63E6O6B2JDPZKN53LZ7F22</TransactionId>
|
552
|
+
<TransactionStatus>Pending</TransactionStatus>
|
553
|
+
</ReserveResult>
|
554
|
+
<ResponseMetadata>
|
555
|
+
<RequestId>d13273fc-fca8-4963-8fbc-66d03e66055f:0</RequestId>
|
556
|
+
</ResponseMetadata>
|
557
|
+
</ReserveResponse>
|
558
|
+
END
|
559
|
+
end
|
560
|
+
|
561
|
+
def settle_response
|
562
|
+
<<-END
|
563
|
+
<SettleResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
564
|
+
<SettleResult>
|
565
|
+
<TransactionId>14GKD9GE66FAA63E6O6B2JDPZKN53LZ7F22</TransactionId>
|
566
|
+
<TransactionStatus>Pending</TransactionStatus>
|
567
|
+
</SettleResult>
|
568
|
+
<ResponseMetadata>
|
569
|
+
<RequestId>9ed2008b-b230-4ed0-9210-095f77fc2359:0</RequestId>
|
570
|
+
</ResponseMetadata>
|
571
|
+
</SettleResponse>
|
572
|
+
END
|
573
|
+
end
|
574
|
+
|
575
|
+
def verify_signature_response
|
576
|
+
<<-END
|
577
|
+
<VerifySignatureResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
578
|
+
<VerifySignatureResult>
|
579
|
+
<VerificationStatus>Success</VerificationStatus>
|
580
|
+
</VerifySignatureResult>
|
581
|
+
<ResponseMetadata>
|
582
|
+
<RequestId>197e2085-1ed7-47a2-93d8-d76b452acc74:0</RequestId>
|
583
|
+
</ResponseMetadata>
|
584
|
+
</VerifySignatureResponse>
|
585
|
+
END
|
586
|
+
end
|
587
|
+
|
588
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# load the support libraries
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rubygems'
|
4
|
+
require 'mocha'
|
5
|
+
|
6
|
+
# load the gem
|
7
|
+
root = File.dirname(__FILE__) + '/../lib'
|
8
|
+
$LOAD_PATH.unshift root
|
9
|
+
require root + '/amazon_flex_pay'
|
10
|
+
|
11
|
+
require 'response_samples'
|
12
|
+
|
13
|
+
class AmazonFlexPay::Test < Test::Unit::TestCase
|
14
|
+
def default_test; end # quiet Test::Unit
|
15
|
+
|
16
|
+
def self.should(name, &block) # very simple syntax
|
17
|
+
define_method("test_should_#{name.gsub(/[ -]/, '_')}", &block)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
AmazonFlexPay.access_key = 'foo'
|
22
|
+
AmazonFlexPay.secret_key = 'bar'
|