revo-remit 0.2.3
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 +122 -0
- data/lib/remit.rb +132 -0
- data/lib/remit/common.rb +151 -0
- data/lib/remit/data_types.rb +265 -0
- data/lib/remit/error_codes.rb +118 -0
- data/lib/remit/get_pipeline.rb +286 -0
- data/lib/remit/inbound_request.rb +85 -0
- data/lib/remit/ipn_request.rb +8 -0
- data/lib/remit/operations/cancel.rb +20 -0
- data/lib/remit/operations/cancel_subscription_and_refund.rb +26 -0
- data/lib/remit/operations/cancel_token.rb +19 -0
- data/lib/remit/operations/fund_prepaid.rb +33 -0
- data/lib/remit/operations/get_account_activity.rb +31 -0
- data/lib/remit/operations/get_account_balance.rb +32 -0
- data/lib/remit/operations/get_all_credit_instruments.rb +20 -0
- data/lib/remit/operations/get_all_prepaid_instruments.rb +20 -0
- data/lib/remit/operations/get_debt_balance.rb +28 -0
- data/lib/remit/operations/get_outstanding_debt_balance.rb +25 -0
- data/lib/remit/operations/get_payment_instruction.rb +23 -0
- data/lib/remit/operations/get_prepaid_balance.rb +27 -0
- data/lib/remit/operations/get_recipient_verification_status.rb +25 -0
- data/lib/remit/operations/get_token_by_caller.rb +23 -0
- data/lib/remit/operations/get_token_usage.rb +22 -0
- data/lib/remit/operations/get_tokens.rb +24 -0
- data/lib/remit/operations/get_total_prepaid_liability.rb +26 -0
- data/lib/remit/operations/get_transaction.rb +18 -0
- data/lib/remit/operations/get_transaction_status.rb +28 -0
- data/lib/remit/operations/install_payment_instruction.rb +29 -0
- data/lib/remit/operations/pay.rb +31 -0
- data/lib/remit/operations/refund.rb +46 -0
- data/lib/remit/operations/reserve.rb +28 -0
- data/lib/remit/operations/settle.rb +21 -0
- data/lib/remit/operations/settle_debt.rb +28 -0
- data/lib/remit/operations/subscribe_for_caller_notification.rb +20 -0
- data/lib/remit/operations/unsubscribe_for_caller_notification.rb +19 -0
- data/lib/remit/operations/write_off_debt.rb +26 -0
- data/lib/remit/pipeline_response.rb +20 -0
- 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 +42 -0
- data/spec/integrations/get_tokens_spec.rb +39 -0
- data/spec/integrations/integrations_helper.rb +15 -0
- data/spec/integrations/ipn_request_spec.rb +40 -0
- 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 +85 -0
- 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 +181 -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 +112 -0
- 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 +25 -0
- data/spec/units/write_off_debt_spec.rb +41 -0
- metadata +236 -0
@@ -0,0 +1,18 @@
|
|
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
|
+
parameter :transaction, :type => Transaction, :element=>"GetTransactionResult/Transaction"
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_transaction(request = Request.new)
|
15
|
+
call(request, Response)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module GetTransactionStatus
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :GetTransaction
|
7
|
+
parameter :transaction_id, :required => true
|
8
|
+
end
|
9
|
+
|
10
|
+
class Response < Remit::Response
|
11
|
+
class GetTransactionStatusResult < Remit::BaseResponse
|
12
|
+
|
13
|
+
parameter :caller_reference
|
14
|
+
parameter :status_code
|
15
|
+
parameter :status_message
|
16
|
+
parameter :transaction_id
|
17
|
+
parameter :transaction_status
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
parameter :get_transaction_status_result, :type => GetTransactionStatusResult, :element=>"GetTransactionStatusResult"
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_transaction(request = Request.new)
|
25
|
+
call(request, Response)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
# This action seems to have been deprecated
|
4
|
+
|
5
|
+
module Remit
|
6
|
+
module InstallPaymentInstruction
|
7
|
+
class Request < Remit::Request
|
8
|
+
action :InstallPaymentInstruction
|
9
|
+
parameter :payment_instruction, :required => true
|
10
|
+
parameter :caller_reference, :required => true
|
11
|
+
parameter :token_friendly_name
|
12
|
+
parameter :token_type, :required => true
|
13
|
+
parameter :payment_reason
|
14
|
+
end
|
15
|
+
|
16
|
+
class Response < Remit::Response
|
17
|
+
class InstallPaymentInstructionResult < Remit::BaseResponse
|
18
|
+
parameter :token_id
|
19
|
+
end
|
20
|
+
|
21
|
+
parameter :install_payment_instruction_result, :type =>InstallPaymentInstructionResult
|
22
|
+
alias :result :install_payment_instruction_result
|
23
|
+
end
|
24
|
+
|
25
|
+
def install_payment_instruction(request)
|
26
|
+
call(request, Response)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,31 @@
|
|
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 :charge_fee_to, :required => true
|
10
|
+
parameter :descriptor_policy, :type => Remit::RequestTypes::DescriptorPolicy
|
11
|
+
parameter :marketplace_fixed_fee, :type => Remit::RequestTypes::Amount
|
12
|
+
parameter :marketplace_variable_fee
|
13
|
+
parameter :recipient_token_id #, Only required for MarketPlace transactions
|
14
|
+
parameter :sender_description
|
15
|
+
parameter :sender_token_id, :required => true
|
16
|
+
parameter :transaction_amount, :type => Remit::RequestTypes::Amount, :required => true
|
17
|
+
parameter :transaction_timeout_in_mins
|
18
|
+
parameter :timestamp
|
19
|
+
end
|
20
|
+
|
21
|
+
# The response is odd, when it succeeds. --JonMoses
|
22
|
+
class Response < Remit::Response
|
23
|
+
parser :rexml
|
24
|
+
parameter :pay_result, :type => Remit::TransactionResponse
|
25
|
+
end
|
26
|
+
|
27
|
+
def pay(request = Request.new)
|
28
|
+
call(request, Response)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,46 @@
|
|
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 :refund_amount, :type => Remit::RequestTypes::Amount
|
10
|
+
parameter :transaction_id, :required => true
|
11
|
+
#MarketplaceRefundPolicy is available in these APIs:
|
12
|
+
# Amazon FPS Advanced Quick Start
|
13
|
+
# Amazon FPS Marketplace Quick Start
|
14
|
+
# Amazon FPS Aggregated Payments Quick Start
|
15
|
+
# i.e. Not Basic Quick Start
|
16
|
+
#Amazon Docs now correctly list it as an Enumerated DataType
|
17
|
+
parameter :marketplace_refund_policy
|
18
|
+
parameter :timestamp
|
19
|
+
# TODO: Check these parameters in Latest FPS API
|
20
|
+
# parameter :refund_recipient_description
|
21
|
+
# parameter :refund_recipient_reference
|
22
|
+
# parameter :refund_sender_description
|
23
|
+
# parameter :refund_sender_reference
|
24
|
+
# parameter :refund_sender_token_id
|
25
|
+
# parameter :transaction_date
|
26
|
+
|
27
|
+
# The RefundAmount parameter has multiple components. It is specified on the query string like
|
28
|
+
# so: RefundAmount.Amount=XXX&RefundAmount.CurrencyCode=YYY
|
29
|
+
def convert_complex_key(key, parameter)
|
30
|
+
"#{convert_key(key)}.#{convert_key(parameter)}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class Response < Remit::Response
|
35
|
+
parser :rexml
|
36
|
+
#Namespace changed with new API:
|
37
|
+
# parameter :transaction_response, :namespace => 'ns3', :type => TransactionResponse
|
38
|
+
parameter :refund_result, :type => Remit::TransactionResponse
|
39
|
+
parameter :response_metadata, :type => ResponseMetadata
|
40
|
+
end
|
41
|
+
|
42
|
+
def refund(request = Request.new)
|
43
|
+
call(request, Response)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,28 @@
|
|
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 :sender_reference
|
10
|
+
parameter :recipient_reference
|
11
|
+
parameter :caller_reference, :required => true
|
12
|
+
parameter :transaction_date
|
13
|
+
parameter :transaction_amount, :type => Remit::RequestTypes::Amount, :required => true
|
14
|
+
parameter :charge_fee_to, :required => true
|
15
|
+
parameter :sender_description
|
16
|
+
parameter :caller_description
|
17
|
+
end
|
18
|
+
|
19
|
+
class Response < Remit::Response
|
20
|
+
parameter :reserve_result, :type => Remit::TransactionResponse
|
21
|
+
parameter :response_metadata, :type=>ResponseMetadata
|
22
|
+
end
|
23
|
+
|
24
|
+
def reserve(request = Request.new)
|
25
|
+
call(request, Response)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,21 @@
|
|
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 :settle_result, :type => Remit::TransactionResponse
|
14
|
+
parameter :response_metadata, :type=>ResponseMetadata
|
15
|
+
end
|
16
|
+
|
17
|
+
def settle(request = Request.new)
|
18
|
+
call(request, Response)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module SettleDebt
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :SettleDebt
|
7
|
+
parameter :caller_description
|
8
|
+
parameter :caller_reference, :required => true
|
9
|
+
parameter :charge_fee_to, :required => true
|
10
|
+
parameter :credit_instrument_id, :required => true
|
11
|
+
parameter :recipient_reference
|
12
|
+
parameter :sender_description
|
13
|
+
parameter :sender_reference
|
14
|
+
parameter :sender_token_id, :required => true
|
15
|
+
parameter :settlement_amount, :type => Remit::RequestTypes::Amount, :required => true
|
16
|
+
parameter :transaction_date
|
17
|
+
end
|
18
|
+
|
19
|
+
class Response < Remit::Response
|
20
|
+
parameter :settle_debt_result, :type => Remit::TransactionResponse
|
21
|
+
parameter :response_metadata, :type=>ResponseMetadata
|
22
|
+
end
|
23
|
+
|
24
|
+
def settle_debt(request = Request.new)
|
25
|
+
call(request, Response)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
# This action seems to have been deprecated
|
4
|
+
|
5
|
+
module Remit
|
6
|
+
module SubscribeForCallerNotification
|
7
|
+
class Request < Remit::Request
|
8
|
+
action :SubscribeForCallerNotification
|
9
|
+
parameter :notification_operation_name, :required => true
|
10
|
+
parameter :web_service_api_url, :required => true
|
11
|
+
end
|
12
|
+
|
13
|
+
class Response < Remit::Response
|
14
|
+
end
|
15
|
+
|
16
|
+
def subscribe_for_caller_notification(request = Request.new)
|
17
|
+
call(request, Response)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
# This action seems to have been deprecated
|
4
|
+
|
5
|
+
module Remit
|
6
|
+
module UnsubscribeForCallerNotification
|
7
|
+
class Request < Remit::Request
|
8
|
+
action :UnSubscribeForCallerNotification
|
9
|
+
parameter :notification_operation_name, :required => true
|
10
|
+
end
|
11
|
+
|
12
|
+
class Response < Remit::Response
|
13
|
+
end
|
14
|
+
|
15
|
+
def unsubscribe_for_caller_notification(request = Request.new)
|
16
|
+
call(request, Response)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'remit/common'
|
2
|
+
|
3
|
+
module Remit
|
4
|
+
module WriteOffDebt
|
5
|
+
class Request < Remit::Request
|
6
|
+
action :WriteOffDebt
|
7
|
+
parameter :credit_instrument_id, :required => true
|
8
|
+
parameter :adjustment_amount, :required => true
|
9
|
+
parameter :transaction_date
|
10
|
+
parameter :sender_reference
|
11
|
+
parameter :caller_reference, :required => true
|
12
|
+
parameter :recipient_reference
|
13
|
+
parameter :sender_description
|
14
|
+
parameter :caller_description
|
15
|
+
end
|
16
|
+
|
17
|
+
class Response < Remit::Response
|
18
|
+
parameter :write_off_debt_result, :type => Remit::TransactionResponse
|
19
|
+
parameter :response_metadata, :type=>ResponseMetadata
|
20
|
+
end
|
21
|
+
|
22
|
+
def write_off_debt(request = Request.new)
|
23
|
+
call(request, Response)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Remit
|
2
|
+
|
3
|
+
class PipelineResponse < InboundRequest
|
4
|
+
# signature key name
|
5
|
+
SIGNATURE_KEY = 'awsSignature'
|
6
|
+
|
7
|
+
def successful?
|
8
|
+
[
|
9
|
+
Remit::PipelineStatusCode::SUCCESS_UNCHANGED,
|
10
|
+
Remit::PipelineStatusCode::SUCCESS_ABT,
|
11
|
+
Remit::PipelineStatusCode::SUCCESS_ACH,
|
12
|
+
Remit::PipelineStatusCode::SUCCESS_CC,
|
13
|
+
Remit::PipelineStatusCode::SUCCESS_RECIPIENT_TOKEN_INSTALLED
|
14
|
+
].include?(@hash_params['status']) #:status])
|
15
|
+
# BJM: 'status' not :status
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'base64'
|
2
|
+
require 'cgi'
|
3
|
+
#require 'openssl'
|
4
|
+
#require 'net/http'
|
5
|
+
#require 'net/https'
|
6
|
+
|
7
|
+
#Lifted From Amazon FPSRuby Code example and then refactored for remit
|
8
|
+
module Remit
|
9
|
+
module SignatureUtilsForOutbound
|
10
|
+
# Convert a string into URL encoded form.
|
11
|
+
def urlencode(plaintext)
|
12
|
+
CGI.escape(plaintext.to_s).gsub("+", "%20").gsub("%7E", "~")
|
13
|
+
end
|
14
|
+
|
15
|
+
# def get_http_data(url)
|
16
|
+
# #2. fetch certificate if not found in cache
|
17
|
+
# uri = URI.parse(url)
|
18
|
+
# http_session = Net::HTTP.new(uri.host, uri.port)
|
19
|
+
# http_session.use_ssl = true
|
20
|
+
# http_session.ca_file = 'ca-bundle.crt'
|
21
|
+
# http_session.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
22
|
+
# http_session.verify_depth = 5
|
23
|
+
#
|
24
|
+
# res = http_session.start {|http_session|
|
25
|
+
# req = Net::HTTP::Get.new(url, {"User-Agent" => USER_AGENT_STRING})
|
26
|
+
# http_session.request(req)
|
27
|
+
# }
|
28
|
+
#
|
29
|
+
# return res.body
|
30
|
+
# end
|
31
|
+
#
|
32
|
+
# def starts_with(string, prefix)
|
33
|
+
# prefix = prefix.to_s
|
34
|
+
# string[0, prefix.length] == prefix
|
35
|
+
# end
|
36
|
+
|
37
|
+
def get_http_params(params)
|
38
|
+
params.map do |(k, v)|
|
39
|
+
urlencode(k) + "=" + urlencode(v)
|
40
|
+
end.join("&")
|
41
|
+
end
|
42
|
+
|
43
|
+
SIGNATURE_KEYNAME = "signature"
|
44
|
+
SIGNATURE_METHOD_KEYNAME = "signatureMethod"
|
45
|
+
SIGNATURE_VERSION_KEYNAME = "signatureVersion"
|
46
|
+
CERTIFICATE_URL_KEYNAME = "certificateUrl"
|
47
|
+
SIGNATURE_VERSION_2 = "2"
|
48
|
+
|
49
|
+
#Will raise an error if there are obvious problems with the request (indicating it was forged or corrupted)
|
50
|
+
def check_parameters(params)
|
51
|
+
# begin
|
52
|
+
raise ":parameters must be enumerable" unless params.kind_of? Enumerable
|
53
|
+
|
54
|
+
signature = params[SIGNATURE_KEYNAME];
|
55
|
+
raise "'signature' is missing from the parameters." if (signature.nil?)
|
56
|
+
|
57
|
+
signature_version = params[SIGNATURE_VERSION_KEYNAME];
|
58
|
+
raise "'signatureVersion' is missing from the parameters." if (signature_version.nil?)
|
59
|
+
raise "'signatureVersion' present in parameters is invalid. Valid values are: 2" if (signature_version != SIGNATURE_VERSION_2)
|
60
|
+
|
61
|
+
signature_method = params[SIGNATURE_METHOD_KEYNAME]
|
62
|
+
raise "'signatureMethod' is missing from the parameters." if (signature_method.nil?)
|
63
|
+
|
64
|
+
certificate_url = params[CERTIFICATE_URL_KEYNAME]
|
65
|
+
raise "'certificate_url' is missing from the parameters." if (certificate_url.nil?)
|
66
|
+
return true
|
67
|
+
# rescue
|
68
|
+
# puts "There was a problem with parameters being invalid or missing."
|
69
|
+
# return false
|
70
|
+
# end
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Remit
|
2
|
+
module VerifySignature
|
3
|
+
class Request < Remit::Request
|
4
|
+
action :VerifySignature
|
5
|
+
parameter :url_end_point, :required => true
|
6
|
+
parameter :http_parameters, :required => true
|
7
|
+
parameter :version, :required => true
|
8
|
+
end
|
9
|
+
|
10
|
+
class Response < Remit::Response
|
11
|
+
class VerifySignatureResult < BaseResponse
|
12
|
+
parameter :verification_status
|
13
|
+
end
|
14
|
+
parameter :verify_signature_result, :type => VerifySignatureResult
|
15
|
+
end
|
16
|
+
|
17
|
+
def verify_signature(request = Request.new)
|
18
|
+
call(request, Response)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/integrations_helper'
|
2
|
+
|
3
|
+
describe 'a GetAccountActivity call' do
|
4
|
+
it_should_behave_like 'a successful response'
|
5
|
+
|
6
|
+
before(:all) do
|
7
|
+
request = Remit::GetAccountActivity::Request.new
|
8
|
+
request.start_date = Date.today - 7
|
9
|
+
@response = remit.get_account_activity(request)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "has results" do
|
13
|
+
@response.get_account_activity_result.should_not be_nil
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should have a collection of transactions' do
|
17
|
+
@response.get_account_activity_result.transactions.class.should == Array
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should have a transaction with all of its values set' do
|
21
|
+
transaction = @response.get_account_activity_result.transactions.first
|
22
|
+
#Depending on the data in the sandbox used there may or may not actually be data here:
|
23
|
+
if transaction
|
24
|
+
transaction.caller_name.should_not be_empty
|
25
|
+
transaction.caller_transaction_date.should_not be_nil
|
26
|
+
transaction.date_completed.should_not be_nil
|
27
|
+
transaction.date_received.should_not be_nil
|
28
|
+
transaction.error_code.should eql("")
|
29
|
+
#transaction.error_detail.should eql("")
|
30
|
+
#transaction.error_message.should eql("")
|
31
|
+
transaction.fees.should_not be_nil
|
32
|
+
transaction.fps_operation.should_not be_empty
|
33
|
+
transaction.recipient_name.should_not be_empty
|
34
|
+
transaction.sender_name.should_not be_empty
|
35
|
+
transaction.sender_token_id.should_not be_nil #some transactions have '' here.
|
36
|
+
transaction.status_code.should_not be_empty
|
37
|
+
transaction.transaction_amount.should_not be_nil
|
38
|
+
transaction.transaction_id.should_not be_empty
|
39
|
+
transaction.transaction_parts.should_not be_empty
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|