micah-remit 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.markdown +91 -0
- data/lib/remit.rb +135 -0
- data/lib/remit/common.rb +88 -0
- data/lib/remit/data_types.rb +164 -0
- data/lib/remit/error_codes.rb +118 -0
- data/lib/remit/get_pipeline.rb +189 -0
- data/lib/remit/ipn_request.rb +49 -0
- data/lib/remit/operations/cancel_subscription_and_refund.rb +23 -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 +37 -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 +52 -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 +120 -0
@@ -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
|