ianlevesque-remit 0.0.6
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.
- data/LICENSE +20 -0
- data/README.markdown +91 -0
- data/lib/remit/common.rb +88 -0
- data/lib/remit/data_types.rb +166 -0
- data/lib/remit/error_codes.rb +118 -0
- data/lib/remit/get_pipeline.rb +195 -0
- data/lib/remit/ipn_request.rb +49 -0
- data/lib/remit/operations/cancel_token.rb +18 -0
- data/lib/remit/operations/discard_results.rb +18 -0
- data/lib/remit/operations/fund_prepaid.rb +31 -0
- data/lib/remit/operations/get_account_activity.rb +60 -0
- data/lib/remit/operations/get_account_balance.rb +29 -0
- data/lib/remit/operations/get_all_credit_instruments.rb +18 -0
- data/lib/remit/operations/get_all_prepaid_instruments.rb +18 -0
- data/lib/remit/operations/get_debt_balance.rb +23 -0
- data/lib/remit/operations/get_outstanding_debt_balance.rb +22 -0
- data/lib/remit/operations/get_payment_instruction.rb +21 -0
- data/lib/remit/operations/get_prepaid_balance.rb +23 -0
- data/lib/remit/operations/get_results.rb +27 -0
- data/lib/remit/operations/get_token_by_caller.rb +19 -0
- data/lib/remit/operations/get_token_usage.rb +18 -0
- data/lib/remit/operations/get_tokens.rb +20 -0
- data/lib/remit/operations/get_total_prepaid_liability.rb +22 -0
- data/lib/remit/operations/get_transaction.rb +42 -0
- data/lib/remit/operations/install_payment_instruction.rb +22 -0
- data/lib/remit/operations/pay.rb +35 -0
- data/lib/remit/operations/refund.rb +36 -0
- data/lib/remit/operations/reserve.rb +30 -0
- data/lib/remit/operations/retry_transaction.rb +18 -0
- data/lib/remit/operations/settle.rb +20 -0
- data/lib/remit/operations/settle_debt.rb +30 -0
- data/lib/remit/operations/subscribe_for_caller_notification.rb +18 -0
- data/lib/remit/operations/unsubscribe_for_caller_notification.rb +17 -0
- data/lib/remit/operations/write_off_debt.rb +28 -0
- data/lib/remit/pipeline_response.rb +53 -0
- data/lib/remit.rb +133 -0
- data/spec/integrations/get_account_activity_spec.rb +36 -0
- data/spec/integrations/get_tokens_spec.rb +38 -0
- data/spec/integrations/integrations_helper.rb +8 -0
- data/spec/spec_helper.rb +36 -0
- data/spec/units/get_pipeline_spec.rb +165 -0
- data/spec/units/get_results_spec.rb +49 -0
- data/spec/units/ipn_request_spec.rb +32 -0
- data/spec/units/pay_spec.rb +133 -0
- data/spec/units/units_helper.rb +4 -0
- metadata +106 -0
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'base64'
|
2
|
+
require 'openssl/digest'
|
3
|
+
|
4
|
+
module Remit
|
5
|
+
# Encapsulates the logic for IPN request validation and attribute retrieval.
|
6
|
+
#
|
7
|
+
# Note: if your responses from Amazon are not validating, please pass the
|
8
|
+
# :version parameter to your original CBUI request.
|
9
|
+
class IpnRequest
|
10
|
+
# Signature key name used by AmazonFPS IPNs
|
11
|
+
SIGNATURE_KEY = 'signature'
|
12
|
+
|
13
|
+
# +params+ should be your controllers request parameters.
|
14
|
+
def initialize(params, secret_key)
|
15
|
+
raise ArgumentError, "Expected the request params hash, received: #{params.inspect}" unless params.kind_of?(Hash)
|
16
|
+
@params = strip_keys_from(params, 'action', 'controller')
|
17
|
+
@supplied_signature = @params.delete(SIGNATURE_KEY)
|
18
|
+
@secret_key = secret_key
|
19
|
+
end
|
20
|
+
|
21
|
+
def valid?
|
22
|
+
return false unless @supplied_signature
|
23
|
+
generate_signature_for(@params) == @supplied_signature
|
24
|
+
end
|
25
|
+
|
26
|
+
def method_missing(method, *args) #:nodoc:
|
27
|
+
if @params.has_key?(method.to_s)
|
28
|
+
@params[method.to_s]
|
29
|
+
else
|
30
|
+
super(method, *args)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def generate_signature_for(params)
|
35
|
+
query = params.sort_by { |k,v| k.downcase }
|
36
|
+
digest = OpenSSL::Digest::Digest.new('sha1')
|
37
|
+
hmac = OpenSSL::HMAC.digest(digest, @secret_key, query.to_s)
|
38
|
+
encoded = Base64.encode64(hmac).chomp
|
39
|
+
end
|
40
|
+
private :generate_signature_for
|
41
|
+
|
42
|
+
def strip_keys_from(params, *ignore_keys)
|
43
|
+
parsed = params.dup
|
44
|
+
ignore_keys.each { |key| parsed.delete(key) }
|
45
|
+
parsed
|
46
|
+
end
|
47
|
+
private :strip_keys_from
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module CancelToken
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :CancelToken
|
7
|
+
parameter :token_id, :required => true
|
8
|
+
parameter :reason_text
|
9
|
+
end
|
10
|
+
|
11
|
+
class Response < Remit::Response
|
12
|
+
end
|
13
|
+
|
14
|
+
def cancel_token(request = Request.new)
|
15
|
+
call(request, Response)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
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
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module FundPrepaid
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :FundPrepaid
|
7
|
+
parameter :transaction_ids
|
8
|
+
parameter :caller_description
|
9
|
+
parameter :caller_reference, :required => true
|
10
|
+
parameter :caller_token_id, :required => true
|
11
|
+
parameter :charge_fee_to, :required => true
|
12
|
+
parameter :funding_amount, :type => Remit::RequestTypes::Amount, :required => true
|
13
|
+
parameter :meta_data
|
14
|
+
parameter :prepaid_instrument_id, :required => true
|
15
|
+
parameter :recipient_description
|
16
|
+
parameter :recipient_reference
|
17
|
+
parameter :sender_description
|
18
|
+
parameter :sender_reference
|
19
|
+
parameter :sender_token_id, :required => true
|
20
|
+
parameter :transaction_date
|
21
|
+
end
|
22
|
+
|
23
|
+
class Response < Remit::Response
|
24
|
+
parameter :transaction_response, :type => TransactionResponse
|
25
|
+
end
|
26
|
+
|
27
|
+
def fund_prepaid(request = Request.new)
|
28
|
+
call(request, Response)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module GetAccountActivity
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :GetAccountActivity
|
7
|
+
parameter :start_date, :required => true
|
8
|
+
parameter :end_date
|
9
|
+
parameter :max_batch_size
|
10
|
+
parameter :sort_order_by_date
|
11
|
+
parameter :response_group
|
12
|
+
parameter :operation
|
13
|
+
parameter :payment_method
|
14
|
+
parameter :role
|
15
|
+
parameter :status
|
16
|
+
end
|
17
|
+
|
18
|
+
class Response < Remit::Response
|
19
|
+
class Transaction < Remit::BaseResponse
|
20
|
+
class TransactionPart < Remit::BaseResponse
|
21
|
+
parameter :account_id
|
22
|
+
parameter :role
|
23
|
+
parameter :name
|
24
|
+
parameter :reference
|
25
|
+
parameter :description
|
26
|
+
parameter :fee_paid, :type => Amount
|
27
|
+
end
|
28
|
+
|
29
|
+
parameter :caller_name
|
30
|
+
parameter :caller_token_id
|
31
|
+
parameter :caller_transaction_date, :type => :time
|
32
|
+
parameter :date_completed, :type => :time
|
33
|
+
parameter :date_received, :type => :time
|
34
|
+
parameter :error_code
|
35
|
+
parameter :error_detail
|
36
|
+
parameter :error_message
|
37
|
+
parameter :fees, :type => Amount
|
38
|
+
parameter :meta_data
|
39
|
+
parameter :operation
|
40
|
+
parameter :original_transaction_id
|
41
|
+
parameter :payment_method
|
42
|
+
parameter :recipient_name
|
43
|
+
parameter :sender_name
|
44
|
+
parameter :sender_token_id
|
45
|
+
parameter :status
|
46
|
+
parameter :transaction_amount, :type => Amount
|
47
|
+
parameter :transaction_id
|
48
|
+
parameter :transaction_parts, :collection => TransactionPart
|
49
|
+
end
|
50
|
+
|
51
|
+
parameter :response_batch_size
|
52
|
+
parameter :transactions, :collection => Transaction
|
53
|
+
parameter :start_time_for_next_transaction, :type => :time
|
54
|
+
end
|
55
|
+
|
56
|
+
def get_account_activity(request = Request.new)
|
57
|
+
call(request, Response)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module GetAccountBalance
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :GetAccountBalance
|
7
|
+
end
|
8
|
+
|
9
|
+
class Response < Remit::Response
|
10
|
+
class AccountBalance < Remit::BaseResponse
|
11
|
+
class AvailableBalances < Remit::BaseResponse
|
12
|
+
parameter :disburse_balance, :type => Amount
|
13
|
+
parameter :refund_balance, :type => Amount
|
14
|
+
end
|
15
|
+
|
16
|
+
parameter :total_balance, :type => Amount
|
17
|
+
parameter :pending_in_balance, :type => Amount
|
18
|
+
parameter :pending_out_balance, :type => Amount
|
19
|
+
parameter :available_balances, :type => AvailableBalances
|
20
|
+
end
|
21
|
+
|
22
|
+
parameter :account_balance, :type => AccountBalance
|
23
|
+
end
|
24
|
+
|
25
|
+
def get_account_balance(request = Request.new)
|
26
|
+
call(request, Response)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module GetAllCreditInstruments
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :GetAllCreditInstruments
|
7
|
+
parameter :instrument_status
|
8
|
+
end
|
9
|
+
|
10
|
+
class Response < Remit::Response
|
11
|
+
parameter :credit_instrument_ids
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_all_credit_instruments(request = Request.new)
|
15
|
+
call(request, Response)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module GetAllPrepaidInstruments
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :GetAllPrepaidInstruments
|
7
|
+
parameter :instrument_status
|
8
|
+
end
|
9
|
+
|
10
|
+
class Response < Remit::Response
|
11
|
+
parameter :prepaid_instrument_ids
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_all_prepaid_instruments(request = Request.new)
|
15
|
+
call(request, Response)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module GetDebtBalance
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :GetDebtBalance
|
7
|
+
parameter :credit_instrument_id, :required => true
|
8
|
+
end
|
9
|
+
|
10
|
+
class Response < Remit::Response
|
11
|
+
class DebtBalance < Remit::BaseResponse
|
12
|
+
parameter :available_balance, :type => Amount
|
13
|
+
parameter :pending_out_balance, :type => Amount
|
14
|
+
end
|
15
|
+
|
16
|
+
parameter :debt_balance, :type => DebtBalance
|
17
|
+
end
|
18
|
+
|
19
|
+
def get_debt_balance(request = Request.new)
|
20
|
+
call(request, Response)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module GetOutstandingDebtBalance
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :GetOutStandingDebtBalance
|
7
|
+
end
|
8
|
+
|
9
|
+
class Response < Remit::Response
|
10
|
+
class OutstandingDebtBalance < Remit::BaseResponse
|
11
|
+
parameter :outstanding_balance, :type => Amount
|
12
|
+
parameter :pending_out_balance, :type => Amount
|
13
|
+
end
|
14
|
+
|
15
|
+
parameter :outstanding_debt, :type => OutstandingDebtBalance
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_outstanding_debt_balance(request = Request.new)
|
19
|
+
call(request, Response)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module GetPaymentInstruction
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :GetPaymentInstruction
|
7
|
+
parameter :token_id, :required => true
|
8
|
+
end
|
9
|
+
|
10
|
+
class Response < Remit::Response
|
11
|
+
parameter :token, :type => Token
|
12
|
+
parameter :payment_instruction
|
13
|
+
parameter :account_id
|
14
|
+
parameter :token_friendly_name
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_payment_instruction(request = Request.new)
|
18
|
+
call(request, Response)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module GetPrepaidBalance
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :GetPrepaidBalance
|
7
|
+
parameter :prepaid_instrument_id, :required => true
|
8
|
+
end
|
9
|
+
|
10
|
+
class Response < Remit::Response
|
11
|
+
class PrepaidBalance < Remit::BaseResponse
|
12
|
+
parameter :available_balance, :type => Amount
|
13
|
+
parameter :pending_in_balance, :type => Amount
|
14
|
+
end
|
15
|
+
|
16
|
+
parameter :prepaid_balance, :type => PrepaidBalance
|
17
|
+
end
|
18
|
+
|
19
|
+
def get_prepaid_balance(request = Request.new)
|
20
|
+
call(request, Response)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,27 @@
|
|
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
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module GetTokenByCaller
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :GetTokenByCaller
|
7
|
+
parameter :caller_reference
|
8
|
+
parameter :token_id
|
9
|
+
end
|
10
|
+
|
11
|
+
class Response < Remit::Response
|
12
|
+
parameter :token, :type => Token
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_token_by_caller(request = Request.new)
|
16
|
+
call(request, Response)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module GetTokenUsage
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :GetTokenUsage
|
7
|
+
parameter :token_id, :required => true
|
8
|
+
end
|
9
|
+
|
10
|
+
class Response < Remit::Response
|
11
|
+
parameter :token_usage_limits, :type => TokenUsageLimit
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_token_usage(request = Request.new)
|
15
|
+
call(request, Response)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module GetTokens
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :GetTokens
|
7
|
+
parameter :caller_reference
|
8
|
+
parameter :token_friendly_name
|
9
|
+
parameter :token_status
|
10
|
+
end
|
11
|
+
|
12
|
+
class Response < Remit::Response
|
13
|
+
parameter :tokens, :collection => Token
|
14
|
+
end
|
15
|
+
|
16
|
+
def get_tokens(request = Request.new)
|
17
|
+
call(request, Response)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module GetTotalPrepaidLiability
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :GetTotalPrepaidLiability
|
7
|
+
end
|
8
|
+
|
9
|
+
class Response < Remit::Response
|
10
|
+
class OutstandingPrepaidLiability < Remit::BaseResponse
|
11
|
+
parameter :outstanding_balance, :type => Amount
|
12
|
+
parameter :panding_in_balance, :type => Amount
|
13
|
+
end
|
14
|
+
|
15
|
+
parameter :outstanding_prepaid_liability, :type => OutstandingPrepaidLiability
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_total_prepaid_liability(request = Request.new)
|
19
|
+
call(request, Response)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module GetTransaction
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :GetTransaction
|
7
|
+
parameter :transaction_id, :required => true
|
8
|
+
end
|
9
|
+
|
10
|
+
class Response < Remit::Response
|
11
|
+
class TransactionDetail < Remit::BaseResponse
|
12
|
+
parameter :caller_name
|
13
|
+
parameter :caller_token_id
|
14
|
+
parameter :caller_transaction_date, :type => :time
|
15
|
+
parameter :date_completed, :type => :time
|
16
|
+
parameter :date_received, :type => :time
|
17
|
+
parameter :error_code
|
18
|
+
parameter :error_message
|
19
|
+
parameter :fees, :type => Amount
|
20
|
+
parameter :meta_data
|
21
|
+
parameter :operation
|
22
|
+
parameter :payment_method
|
23
|
+
parameter :recipient_name
|
24
|
+
parameter :recipient_token_id
|
25
|
+
parameter :related_transactions
|
26
|
+
parameter :sender_name
|
27
|
+
parameter :sender_token_id
|
28
|
+
parameter :status
|
29
|
+
parameter :status_history
|
30
|
+
parameter :transaction_amount, :type => Amount
|
31
|
+
parameter :transaction_id
|
32
|
+
parameter :transaction_parts
|
33
|
+
end
|
34
|
+
|
35
|
+
parameter :transaction, :type => TransactionDetail
|
36
|
+
end
|
37
|
+
|
38
|
+
def get_transaction(request = Request.new)
|
39
|
+
call(request, Response)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module InstallPaymentInstruction
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :InstallPaymentInstruction
|
7
|
+
parameter :payment_instruction, :required => true
|
8
|
+
parameter :caller_reference, :required => true
|
9
|
+
parameter :token_friendly_name
|
10
|
+
parameter :token_type, :required => true
|
11
|
+
parameter :payment_reason
|
12
|
+
end
|
13
|
+
|
14
|
+
class Response < Remit::Response
|
15
|
+
parameter :token_id
|
16
|
+
end
|
17
|
+
|
18
|
+
def install_payment_instruction(request)
|
19
|
+
call(request, Response)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module Pay
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :Pay
|
7
|
+
parameter :caller_description
|
8
|
+
parameter :caller_reference, :required => true
|
9
|
+
parameter :caller_token_id, :required => true
|
10
|
+
parameter :charge_fee_to, :required => true
|
11
|
+
parameter :descriptor_policy, :type => Remit::RequestTypes::DescriptorPolicy
|
12
|
+
parameter :marketplace_fixed_fee, :type => Remit::RequestTypes::Amount
|
13
|
+
parameter :marketplace_variable_fee
|
14
|
+
parameter :meta_data
|
15
|
+
parameter :recipient_description
|
16
|
+
parameter :recipient_reference
|
17
|
+
parameter :recipient_token_id, :required => true
|
18
|
+
parameter :sender_description
|
19
|
+
parameter :sender_reference
|
20
|
+
parameter :sender_token_id, :required => true
|
21
|
+
parameter :temporary_decline_policy, :type => Remit::RequestTypes::TemporaryDeclinePolicy
|
22
|
+
parameter :transaction_amount, :type => Remit::RequestTypes::Amount, :required => true
|
23
|
+
parameter :transaction_date
|
24
|
+
end
|
25
|
+
|
26
|
+
class Response < Remit::Response
|
27
|
+
parser :rexml
|
28
|
+
parameter :transaction_response, :namespace => 'ns3', :type => TransactionResponse
|
29
|
+
end
|
30
|
+
|
31
|
+
def pay(request = Request.new)
|
32
|
+
call(request, Response)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module Refund
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :Refund
|
7
|
+
parameter :caller_description
|
8
|
+
parameter :caller_reference, :required => true
|
9
|
+
parameter :caller_token_id, :required => true
|
10
|
+
parameter :charge_fee_to, :required => true
|
11
|
+
parameter :meta_data
|
12
|
+
parameter :refund_amount, :type => Remit::RequestTypes::Amount
|
13
|
+
parameter :refund_recipient_description
|
14
|
+
parameter :refund_recipient_reference
|
15
|
+
parameter :refund_sender_description
|
16
|
+
parameter :refund_sender_reference
|
17
|
+
parameter :refund_sender_token_id, :required => true
|
18
|
+
parameter :transaction_date
|
19
|
+
parameter :transaction_id, :required => true
|
20
|
+
|
21
|
+
# The RefundAmount parameter has multiple components. It is specified on the query string like
|
22
|
+
# so: RefundAmount.Amount=XXX&RefundAmount.CurrencyCode=YYY
|
23
|
+
def convert_complex_key(key, parameter)
|
24
|
+
"#{convert_key(key).to_s}.#{convert_key(parameter).to_s}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class Response < Remit::Response
|
29
|
+
parameter :transaction_response, :type => TransactionResponse
|
30
|
+
end
|
31
|
+
|
32
|
+
def refund(request = Request.new)
|
33
|
+
call(request, Response)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module Reserve
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :Reserve
|
7
|
+
parameter :recipient_token_id, :required => true
|
8
|
+
parameter :sender_token_id, :required => true
|
9
|
+
parameter :caller_token_id, :required => true
|
10
|
+
parameter :sender_reference
|
11
|
+
parameter :recipient_reference
|
12
|
+
parameter :caller_reference, :required => true
|
13
|
+
parameter :transaction_date
|
14
|
+
parameter :transaction_amount, :type => Remit::RequestTypes::Amount, :required => true
|
15
|
+
parameter :charge_fee_to, :required => true
|
16
|
+
parameter :sender_description
|
17
|
+
parameter :recipient_description
|
18
|
+
parameter :caller_description
|
19
|
+
parameter :meta_data
|
20
|
+
end
|
21
|
+
|
22
|
+
class Response < Remit::Response
|
23
|
+
parameter :transaction_response, :type => TransactionResponse
|
24
|
+
end
|
25
|
+
|
26
|
+
def reserve(request = Request.new)
|
27
|
+
call(request, Response)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,18 @@
|
|
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
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module Settle
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :Settle
|
7
|
+
parameter :reserve_transaction_id, :required => true
|
8
|
+
parameter :transaction_amount, :type => Remit::RequestTypes::Amount
|
9
|
+
parameter :transaction_date
|
10
|
+
end
|
11
|
+
|
12
|
+
class Response < Remit::Response
|
13
|
+
parameter :transaction_response, :type => TransactionResponse
|
14
|
+
end
|
15
|
+
|
16
|
+
def settle(request = Request.new)
|
17
|
+
call(request, Response)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|