remit 0.0.6 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +36 -5
- data/lib/remit.rb +35 -39
- data/lib/remit/common.rb +79 -24
- data/lib/remit/data_types.rb +118 -17
- data/lib/remit/get_pipeline.rb +160 -80
- data/lib/remit/inbound_request.rb +85 -0
- data/lib/remit/ipn_request.rb +4 -39
- data/lib/remit/operations/cancel.rb +20 -0
- data/lib/remit/operations/cancel_subscription_and_refund.rb +5 -1
- data/lib/remit/operations/cancel_token.rb +1 -0
- data/lib/remit/operations/fund_prepaid.rb +6 -4
- data/lib/remit/operations/get_account_activity.rb +5 -34
- data/lib/remit/operations/get_account_balance.rb +14 -11
- data/lib/remit/operations/get_all_credit_instruments.rb +2 -0
- data/lib/remit/operations/get_all_prepaid_instruments.rb +2 -0
- data/lib/remit/operations/get_debt_balance.rb +9 -4
- data/lib/remit/operations/get_outstanding_debt_balance.rb +8 -5
- data/lib/remit/operations/get_payment_instruction.rb +2 -0
- data/lib/remit/operations/get_prepaid_balance.rb +9 -5
- data/lib/remit/operations/get_recipient_verification_status.rb +25 -0
- data/lib/remit/operations/get_token_by_caller.rb +5 -1
- data/lib/remit/operations/get_token_usage.rb +5 -1
- data/lib/remit/operations/get_tokens.rb +5 -1
- data/lib/remit/operations/get_total_prepaid_liability.rb +9 -5
- data/lib/remit/operations/get_transaction.rb +1 -25
- data/lib/remit/operations/get_transaction_status.rb +28 -0
- data/lib/remit/operations/install_payment_instruction.rb +8 -1
- data/lib/remit/operations/pay.rb +5 -9
- data/lib/remit/operations/refund.rb +20 -11
- data/lib/remit/operations/reserve.rb +2 -4
- data/lib/remit/operations/settle.rb +2 -1
- data/lib/remit/operations/settle_debt.rb +2 -4
- data/lib/remit/operations/subscribe_for_caller_notification.rb +2 -0
- data/lib/remit/operations/unsubscribe_for_caller_notification.rb +2 -0
- data/lib/remit/operations/write_off_debt.rb +2 -4
- data/lib/remit/pipeline_response.rb +8 -41
- 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 +25 -19
- data/spec/integrations/get_tokens_spec.rb +9 -7
- data/spec/integrations/integrations_helper.rb +7 -0
- data/spec/integrations/ipn_request_spec.rb +28 -20
- 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 +59 -10
- 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 +16 -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 +36 -57
- 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 +23 -2
- data/spec/units/write_off_debt_spec.rb +41 -0
- metadata +116 -12
- data/lib/remit/operations/discard_results.rb +0 -18
- data/lib/remit/operations/get_results.rb +0 -27
- data/lib/remit/operations/retry_transaction.rb +0 -18
- data/spec/units/get_results_spec.rb +0 -49
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<GetTokenByCallerResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
3
|
+
<!--Optional:-->
|
4
|
+
<GetTokenByCallerResult>
|
5
|
+
<!--Optional:-->
|
6
|
+
<Token>
|
7
|
+
<TokenId>string</TokenId>
|
8
|
+
<FriendlyName>string</FriendlyName>
|
9
|
+
<TokenStatus>string</TokenStatus>
|
10
|
+
<DateInstalled>2008-09-28T18:49:45</DateInstalled>
|
11
|
+
<CallerReference>string</CallerReference>
|
12
|
+
<TokenType>string</TokenType>
|
13
|
+
<!--Optional:-->
|
14
|
+
<OldTokenId>string</OldTokenId>
|
15
|
+
<!--Optional:-->
|
16
|
+
<PaymentReason>string</PaymentReason>
|
17
|
+
</Token>
|
18
|
+
</GetTokenByCallerResult>
|
19
|
+
<ResponseMetadata>
|
20
|
+
<RequestId>string</RequestId>
|
21
|
+
</ResponseMetadata>
|
22
|
+
</GetTokenByCallerResponse>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<GetTokenUsageResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
3
|
+
<!--Optional:-->
|
4
|
+
<GetTokenUsageResult>
|
5
|
+
<!--0 to 3 repetitions:-->
|
6
|
+
<TokenUsageLimits>
|
7
|
+
<!--Optional:-->
|
8
|
+
<Count>100</Count>
|
9
|
+
<!--Optional:-->
|
10
|
+
<Amount>
|
11
|
+
<CurrencyCode>string</CurrencyCode>
|
12
|
+
<Value>string</Value>
|
13
|
+
</Amount>
|
14
|
+
<!--Optional:-->
|
15
|
+
<LastResetCount>100</LastResetCount>
|
16
|
+
<!--Optional:-->
|
17
|
+
<LastResetAmount>
|
18
|
+
<CurrencyCode>string</CurrencyCode>
|
19
|
+
<Value>string</Value>
|
20
|
+
</LastResetAmount>
|
21
|
+
<!--Optional:-->
|
22
|
+
<LastResetTimestamp>2008-09-28T18:49:45</LastResetTimestamp>
|
23
|
+
</TokenUsageLimits>
|
24
|
+
</GetTokenUsageResult>
|
25
|
+
<ResponseMetadata>
|
26
|
+
<RequestId>string</RequestId>
|
27
|
+
</ResponseMetadata>
|
28
|
+
</GetTokenUsageResponse>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<GetTokensResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
3
|
+
<!--Optional:-->
|
4
|
+
<GetTokensResult>
|
5
|
+
<!--Zero or more repetitions:-->
|
6
|
+
<Token>
|
7
|
+
<TokenId>string</TokenId>
|
8
|
+
<FriendlyName>string</FriendlyName>
|
9
|
+
<TokenStatus>string</TokenStatus>
|
10
|
+
<DateInstalled>2008-09-28T18:49:45</DateInstalled>
|
11
|
+
<CallerReference>string</CallerReference>
|
12
|
+
<TokenType>string</TokenType>
|
13
|
+
<!--Optional:-->
|
14
|
+
<OldTokenId>string</OldTokenId>
|
15
|
+
<!--Optional:-->
|
16
|
+
<PaymentReason>string</PaymentReason>
|
17
|
+
</Token>
|
18
|
+
</GetTokensResult>
|
19
|
+
<ResponseMetadata>
|
20
|
+
<RequestId>string</RequestId>
|
21
|
+
</ResponseMetadata>
|
22
|
+
</GetTokensResponse>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<GetTotalPrepaidLiabilityResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
3
|
+
<!--Optional:-->
|
4
|
+
<GetTotalPrepaidLiabilityResult>
|
5
|
+
<!--Optional:-->
|
6
|
+
<OutstandingPrepaidLiability>
|
7
|
+
<OutstandingBalance>
|
8
|
+
<CurrencyCode>string</CurrencyCode>
|
9
|
+
<Value>string</Value>
|
10
|
+
</OutstandingBalance>
|
11
|
+
<!--Optional:-->
|
12
|
+
<PendingInBalance>
|
13
|
+
<CurrencyCode>string</CurrencyCode>
|
14
|
+
<Value>string</Value>
|
15
|
+
</PendingInBalance>
|
16
|
+
</OutstandingPrepaidLiability>
|
17
|
+
</GetTotalPrepaidLiabilityResult>
|
18
|
+
<ResponseMetadata>
|
19
|
+
<RequestId>string</RequestId>
|
20
|
+
</ResponseMetadata>
|
21
|
+
</GetTotalPrepaidLiabilityResponse>
|
@@ -0,0 +1,76 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<GetTransactionResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
3
|
+
<!--Optional:-->
|
4
|
+
<GetTransactionResult>
|
5
|
+
<!--Optional:-->
|
6
|
+
<Transaction>
|
7
|
+
<TransactionId>string</TransactionId>
|
8
|
+
<CallerReference>string</CallerReference>
|
9
|
+
<!--Optional:-->
|
10
|
+
<CallerDescription>string</CallerDescription>
|
11
|
+
<!--Optional:-->
|
12
|
+
<SenderDescription>string</SenderDescription>
|
13
|
+
<DateReceived>2008-09-28T18:49:45</DateReceived>
|
14
|
+
<!--Optional:-->
|
15
|
+
<DateCompleted>2014-09-18T16:18:33</DateCompleted>
|
16
|
+
<TransactionAmount>
|
17
|
+
<CurrencyCode>string</CurrencyCode>
|
18
|
+
<Value>string</Value>
|
19
|
+
</TransactionAmount>
|
20
|
+
<FPSFees>
|
21
|
+
<CurrencyCode>string</CurrencyCode>
|
22
|
+
<Value>string</Value>
|
23
|
+
</FPSFees>
|
24
|
+
<!--Optional:-->
|
25
|
+
<MarketplaceFees>
|
26
|
+
<CurrencyCode>string</CurrencyCode>
|
27
|
+
<Value>string</Value>
|
28
|
+
</MarketplaceFees>
|
29
|
+
<FPSFeesPaidBy>string</FPSFeesPaidBy>
|
30
|
+
<!--Optional:-->
|
31
|
+
<SenderTokenId>string</SenderTokenId>
|
32
|
+
<!--Optional:-->
|
33
|
+
<RecipientTokenId>string</RecipientTokenId>
|
34
|
+
<!--Optional:-->
|
35
|
+
<PrepaidInstrumentId>string</PrepaidInstrumentId>
|
36
|
+
<!--Optional:-->
|
37
|
+
<CreditInstrumentId>string</CreditInstrumentId>
|
38
|
+
<FPSOperation>string</FPSOperation>
|
39
|
+
<PaymentMethod>string</PaymentMethod>
|
40
|
+
<TransactionStatus>string</TransactionStatus>
|
41
|
+
<!--Optional:-->
|
42
|
+
<StatusCode>string</StatusCode>
|
43
|
+
<!--Optional:-->
|
44
|
+
<StatusMessage>string</StatusMessage>
|
45
|
+
<!--Optional:-->
|
46
|
+
<SenderName>string</SenderName>
|
47
|
+
<!--Optional:-->
|
48
|
+
<SenderEmail>string</SenderEmail>
|
49
|
+
<CallerName>string</CallerName>
|
50
|
+
<!--Optional:-->
|
51
|
+
<RecipientName>string</RecipientName>
|
52
|
+
<!--Optional:-->
|
53
|
+
<RecipientEmail>string</RecipientEmail>
|
54
|
+
<!--Zero or more repetitions:-->
|
55
|
+
<RelatedTransaction>
|
56
|
+
<TransactionId>string</TransactionId>
|
57
|
+
<!--Optional:-->
|
58
|
+
<RelationType>string</RelationType>
|
59
|
+
</RelatedTransaction>
|
60
|
+
<!--1 or more repetitions:-->
|
61
|
+
<StatusHistory>
|
62
|
+
<Date>2006-08-19T10:27:14-07:00</Date>
|
63
|
+
<TransactionStatus>string</TransactionStatus>
|
64
|
+
<!--Optional:-->
|
65
|
+
<StatusCode>string</StatusCode>
|
66
|
+
<Amount>
|
67
|
+
<CurrencyCode>string</CurrencyCode>
|
68
|
+
<Value>string</Value>
|
69
|
+
</Amount>
|
70
|
+
</StatusHistory>
|
71
|
+
</Transaction>
|
72
|
+
</GetTransactionResult>
|
73
|
+
<ResponseMetadata>
|
74
|
+
<RequestId>string</RequestId>
|
75
|
+
</ResponseMetadata>
|
76
|
+
</GetTransactionResponse>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<GetTransactionStatusResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
3
|
+
<!--Optional:-->
|
4
|
+
<GetTransactionStatusResult>
|
5
|
+
<TransactionId>string</TransactionId>
|
6
|
+
<TransactionStatus>string</TransactionStatus>
|
7
|
+
<CallerReference>string</CallerReference>
|
8
|
+
<!--Optional:-->
|
9
|
+
<StatusCode>string</StatusCode>
|
10
|
+
<!--Optional:-->
|
11
|
+
<StatusMessage>string</StatusMessage>
|
12
|
+
</GetTransactionStatusResult>
|
13
|
+
<ResponseMetadata>
|
14
|
+
<RequestId>string</RequestId>
|
15
|
+
</ResponseMetadata>
|
16
|
+
</GetTransactionStatusResponse>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<InstallPaymentInstructionResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
3
|
+
<!--Optional:-->
|
4
|
+
<InstallPaymentInstructionResult>
|
5
|
+
<TokenId>string</TokenId>
|
6
|
+
</InstallPaymentInstructionResult>
|
7
|
+
<ResponseMetadata>
|
8
|
+
<RequestId>string</RequestId>
|
9
|
+
</ResponseMetadata>
|
10
|
+
</InstallPaymentInstructionResponse>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<PayResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
3
|
+
<!--Optional:-->
|
4
|
+
<PayResult>
|
5
|
+
<TransactionId>string</TransactionId>
|
6
|
+
<TransactionStatus>string</TransactionStatus>
|
7
|
+
</PayResult>
|
8
|
+
<ResponseMetadata>
|
9
|
+
<RequestId>string</RequestId>
|
10
|
+
</ResponseMetadata>
|
11
|
+
</PayResponse>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<RefundResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
3
|
+
<!--Optional:-->
|
4
|
+
<RefundResult>
|
5
|
+
<TransactionId>string</TransactionId>
|
6
|
+
<TransactionStatus>string</TransactionStatus>
|
7
|
+
</RefundResult>
|
8
|
+
<ResponseMetadata>
|
9
|
+
<RequestId>string</RequestId>
|
10
|
+
</ResponseMetadata>
|
11
|
+
</RefundResponse>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<ReserveResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
3
|
+
<!--Optional:-->
|
4
|
+
<ReserveResult>
|
5
|
+
<TransactionId>string</TransactionId>
|
6
|
+
<TransactionStatus>string</TransactionStatus>
|
7
|
+
</ReserveResult>
|
8
|
+
<ResponseMetadata>
|
9
|
+
<RequestId>string</RequestId>
|
10
|
+
</ResponseMetadata>
|
11
|
+
</ReserveResponse>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<SettleDebtResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
3
|
+
<!--Optional:-->
|
4
|
+
<SettleDebtResult>
|
5
|
+
<TransactionId>string</TransactionId>
|
6
|
+
<TransactionStatus>string</TransactionStatus>
|
7
|
+
</SettleDebtResult>
|
8
|
+
<ResponseMetadata>
|
9
|
+
<RequestId>string</RequestId>
|
10
|
+
</ResponseMetadata>
|
11
|
+
</SettleDebtResponse>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<SettleResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
3
|
+
<!--Optional:-->
|
4
|
+
<SettleResult>
|
5
|
+
<TransactionId>string</TransactionId>
|
6
|
+
<TransactionStatus>string</TransactionStatus>
|
7
|
+
</SettleResult>
|
8
|
+
<ResponseMetadata>
|
9
|
+
<RequestId>string</RequestId>
|
10
|
+
</ResponseMetadata>
|
11
|
+
</SettleResponse>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<VerifySignatureResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
3
|
+
<!--Optional:-->
|
4
|
+
<VerifySignatureResult>
|
5
|
+
<!--Optional:-->
|
6
|
+
<VerificationStatus>string</VerificationStatus>
|
7
|
+
</VerifySignatureResult>
|
8
|
+
<ResponseMetadata>
|
9
|
+
<RequestId>string</RequestId>
|
10
|
+
</ResponseMetadata>
|
11
|
+
</VerifySignatureResponse>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<WriteOffDebtResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
|
3
|
+
<!--Optional:-->
|
4
|
+
<WriteOffDebtResult>
|
5
|
+
<TransactionId>string</TransactionId>
|
6
|
+
<TransactionStatus>string</TransactionStatus>
|
7
|
+
</WriteOffDebtResult>
|
8
|
+
<ResponseMetadata>
|
9
|
+
<RequestId>string</RequestId>
|
10
|
+
</ResponseMetadata>
|
11
|
+
</WriteOffDebtResponse>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<Response>
|
3
|
+
<Errors>
|
4
|
+
<Error>
|
5
|
+
<Code>InvalidParameterValue</Code>
|
6
|
+
<Message>Value (2010-02-26 T19:48:05.000Z) for parameter Timestamp is invalid. Must be in ISO8601 format.</Message>
|
7
|
+
</Error>
|
8
|
+
</Errors>
|
9
|
+
<RequestID>794c2c9f-2d0e-4a9b-9ade-e80a58d09956</RequestID>
|
10
|
+
</Response>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<Response>
|
3
|
+
<Errors>
|
4
|
+
<Error>
|
5
|
+
<Code>RequestExpired</Code>
|
6
|
+
<Message>Request has expired. Timestamp date is 2010-02-26T19:48:05.000Z</Message>
|
7
|
+
</Error>
|
8
|
+
</Errors>
|
9
|
+
<RequestID>465f3304-acc4-4831-9e58-bc07f80c8b50</RequestID>
|
10
|
+
</Response>
|
data/spec/spec_helper.rb
CHANGED
@@ -1,22 +1,53 @@
|
|
1
|
+
# figure out where we are being loaded from
|
2
|
+
if $LOADED_FEATURES.grep(/spec\/spec_helper\.rb/).any?
|
3
|
+
begin
|
4
|
+
raise "foo"
|
5
|
+
rescue => e
|
6
|
+
puts <<-MSG
|
7
|
+
===================================================
|
8
|
+
It looks like spec_helper.rb has been loaded
|
9
|
+
multiple times. Normalize the require to:
|
10
|
+
|
11
|
+
require "spec/spec_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
|
+
|
1
24
|
require 'rubygems'
|
2
25
|
require 'spec'
|
3
26
|
|
4
|
-
require File.dirname(__FILE__) + '/../lib/remit'
|
27
|
+
require File.expand_path(File.dirname(__FILE__) + '/../lib/remit')
|
5
28
|
|
6
|
-
def remit
|
7
|
-
@remit ||= Remit::API.new(
|
29
|
+
def remit(access_key = ACCESS_KEY, seret_key = SECRET_KEY)
|
30
|
+
@remit ||= Remit::API.new(access_key, seret_key, true)
|
8
31
|
end
|
9
32
|
|
10
33
|
describe 'a successful response', :shared => true do
|
11
|
-
|
12
|
-
|
13
|
-
|
34
|
+
#The new API version doesn't return an explicit 'status'
|
35
|
+
#Either you get errors or not
|
36
|
+
#it 'should return success' do
|
37
|
+
# @response.status.should == 'Success'
|
38
|
+
#end
|
14
39
|
|
15
|
-
it '
|
16
|
-
@response.errors
|
40
|
+
it 'has no errors' do
|
41
|
+
if @response.errors
|
42
|
+
@response.errors.should == []
|
43
|
+
else
|
44
|
+
@response.errors.should be_nil
|
45
|
+
end
|
46
|
+
#puts "errors = #{@response.errors.class} - #{@response.errors.size}"
|
47
|
+
|
17
48
|
end
|
18
49
|
|
19
|
-
it
|
50
|
+
it "has a request id" do
|
20
51
|
@response.request_id.should_not be_nil
|
21
52
|
end
|
22
53
|
end
|
@@ -27,10 +58,28 @@ describe 'a failed response', :shared => true do
|
|
27
58
|
end
|
28
59
|
|
29
60
|
it "has a request id" do
|
30
|
-
@response.request_id.should_not
|
61
|
+
@response.request_id.should_not be_nil
|
31
62
|
end
|
32
63
|
|
33
64
|
it "has errors" do
|
34
65
|
@response.errors.should_not be_empty
|
35
66
|
end
|
36
67
|
end
|
68
|
+
|
69
|
+
describe 'a pending response', :shared => true do
|
70
|
+
it "is not successful" do
|
71
|
+
@response.should_not be_successful
|
72
|
+
end
|
73
|
+
|
74
|
+
it "has a request id" do
|
75
|
+
@response.request_id.should_not be_nil
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'has no errors' do
|
79
|
+
if @response.errors
|
80
|
+
@response.errors.should == []
|
81
|
+
else
|
82
|
+
@response.errors.should be_nil
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -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
|