dbalatero-remit 0.0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/remit.rb +133 -0
- data/lib/remit/common.rb +88 -0
- data/lib/remit/data_types.rb +181 -0
- data/lib/remit/error_codes.rb +118 -0
- data/lib/remit/get_pipeline.rb +181 -0
- data/lib/remit/ipn_request.rb +46 -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 +43 -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 +104 -0
data/lib/remit.rb
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
2
|
+
|
3
|
+
require 'openssl'
|
4
|
+
require 'net/https'
|
5
|
+
require 'uri'
|
6
|
+
require 'date'
|
7
|
+
require 'base64'
|
8
|
+
require 'erb'
|
9
|
+
|
10
|
+
require 'rubygems'
|
11
|
+
|
12
|
+
gem 'dbalatero-relax', '0.0.7.1'
|
13
|
+
require 'relax'
|
14
|
+
|
15
|
+
require 'remit/common'
|
16
|
+
require 'remit/data_types'
|
17
|
+
require 'remit/error_codes'
|
18
|
+
require 'remit/ipn_request'
|
19
|
+
require 'remit/get_pipeline'
|
20
|
+
require 'remit/pipeline_response'
|
21
|
+
|
22
|
+
require 'remit/operations/cancel_token'
|
23
|
+
require 'remit/operations/discard_results'
|
24
|
+
require 'remit/operations/fund_prepaid'
|
25
|
+
require 'remit/operations/get_account_activity'
|
26
|
+
require 'remit/operations/get_account_balance'
|
27
|
+
require 'remit/operations/get_all_credit_instruments'
|
28
|
+
require 'remit/operations/get_all_prepaid_instruments'
|
29
|
+
require 'remit/operations/get_debt_balance'
|
30
|
+
require 'remit/operations/get_outstanding_debt_balance'
|
31
|
+
require 'remit/operations/get_payment_instruction'
|
32
|
+
require 'remit/operations/get_prepaid_balance'
|
33
|
+
require 'remit/operations/get_results'
|
34
|
+
require 'remit/operations/get_token_by_caller'
|
35
|
+
require 'remit/operations/get_token_usage'
|
36
|
+
require 'remit/operations/get_tokens'
|
37
|
+
require 'remit/operations/get_total_prepaid_liability'
|
38
|
+
require 'remit/operations/get_transaction'
|
39
|
+
require 'remit/operations/install_payment_instruction'
|
40
|
+
require 'remit/operations/pay'
|
41
|
+
require 'remit/operations/refund'
|
42
|
+
require 'remit/operations/reserve'
|
43
|
+
require 'remit/operations/retry_transaction'
|
44
|
+
require 'remit/operations/settle'
|
45
|
+
require 'remit/operations/settle_debt'
|
46
|
+
require 'remit/operations/subscribe_for_caller_notification'
|
47
|
+
require 'remit/operations/unsubscribe_for_caller_notification'
|
48
|
+
require 'remit/operations/write_off_debt'
|
49
|
+
|
50
|
+
module Remit
|
51
|
+
class API < Relax::Service
|
52
|
+
include CancelToken
|
53
|
+
include DiscardResults
|
54
|
+
include FundPrepaid
|
55
|
+
include GetAccountActivity
|
56
|
+
include GetAccountBalance
|
57
|
+
include GetAllCreditInstruments
|
58
|
+
include GetAllPrepaidInstruments
|
59
|
+
include GetDebtBalance
|
60
|
+
include GetOutstandingDebtBalance
|
61
|
+
include GetPaymentInstruction
|
62
|
+
include GetPipeline
|
63
|
+
include GetPrepaidBalance
|
64
|
+
include GetResults
|
65
|
+
include GetTokenUsage
|
66
|
+
include GetTokens
|
67
|
+
include GetTokenByCaller
|
68
|
+
include GetTotalPrepaidLiability
|
69
|
+
include GetTransaction
|
70
|
+
include InstallPaymentInstruction
|
71
|
+
include Pay
|
72
|
+
include Refund
|
73
|
+
include Reserve
|
74
|
+
include RetryTransaction
|
75
|
+
include Settle
|
76
|
+
include SettleDebt
|
77
|
+
include SubscribeForCallerNotification
|
78
|
+
include UnsubscribeForCallerNotification
|
79
|
+
include WriteOffDebt
|
80
|
+
|
81
|
+
API_ENDPOINT = 'https://fps.amazonaws.com/'.freeze
|
82
|
+
API_SANDBOX_ENDPOINT = 'https://fps.sandbox.amazonaws.com/'.freeze
|
83
|
+
PIPELINE_URL = 'https://authorize.payments.amazon.com/cobranded-ui/actions/start'.freeze
|
84
|
+
PIPELINE_SANDBOX_URL = 'https://authorize.payments-sandbox.amazon.com/cobranded-ui/actions/start'.freeze
|
85
|
+
API_VERSION = Date.new(2007, 1, 8).to_s.freeze
|
86
|
+
SIGNATURE_VERSION = 1.freeze
|
87
|
+
|
88
|
+
attr_reader :access_key
|
89
|
+
attr_reader :secret_key
|
90
|
+
attr_reader :pipeline_url
|
91
|
+
|
92
|
+
def initialize(access_key, secret_key, sandbox=false)
|
93
|
+
@access_key = access_key
|
94
|
+
@secret_key = secret_key
|
95
|
+
@pipeline_url = sandbox ? PIPELINE_SANDBOX_URL : PIPELINE_URL
|
96
|
+
|
97
|
+
super(sandbox ? API_SANDBOX_ENDPOINT : API_ENDPOINT)
|
98
|
+
end
|
99
|
+
|
100
|
+
def new_query(query={})
|
101
|
+
SignedQuery.new(@endpoint, @secret_key, query)
|
102
|
+
end
|
103
|
+
private :new_query
|
104
|
+
|
105
|
+
def default_query
|
106
|
+
new_query({
|
107
|
+
:AWSAccessKeyId => @access_key,
|
108
|
+
:SignatureVersion => SIGNATURE_VERSION,
|
109
|
+
:Version => API_VERSION,
|
110
|
+
:Timestamp => Time.now.utc.strftime('%Y-%m-%dT%H:%M:%SZ')
|
111
|
+
})
|
112
|
+
end
|
113
|
+
private :default_query
|
114
|
+
|
115
|
+
def query(request)
|
116
|
+
query = super
|
117
|
+
query[:Signature] = sign(query)
|
118
|
+
query
|
119
|
+
end
|
120
|
+
private :query
|
121
|
+
|
122
|
+
def sign(values)
|
123
|
+
keys = values.keys.sort { |a, b| a.to_s.downcase <=> b.to_s.downcase }
|
124
|
+
|
125
|
+
signature = keys.inject('') do |signature, key|
|
126
|
+
signature += key.to_s + values[key].to_s
|
127
|
+
end
|
128
|
+
|
129
|
+
Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::SHA1.new, @secret_key, signature)).strip
|
130
|
+
end
|
131
|
+
private :sign
|
132
|
+
end
|
133
|
+
end
|
data/lib/remit/common.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'base64'
|
2
|
+
require 'erb'
|
3
|
+
require 'uri'
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
require 'relax'
|
7
|
+
|
8
|
+
module Remit
|
9
|
+
class Request < Relax::Request
|
10
|
+
def self.action(name)
|
11
|
+
parameter :action, :value => name
|
12
|
+
end
|
13
|
+
|
14
|
+
def convert_key(key)
|
15
|
+
key.to_s.gsub(/(^|_)(.)/) { $2.upcase }.to_sym
|
16
|
+
end
|
17
|
+
protected :convert_key
|
18
|
+
end
|
19
|
+
|
20
|
+
class BaseResponse < Relax::Response
|
21
|
+
def node_name(name, namespace=nil)
|
22
|
+
super(name.to_s.gsub(/(^|_)(.)/) { $2.upcase }, namespace)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class Response < BaseResponse
|
27
|
+
parameter :request_id
|
28
|
+
|
29
|
+
attr_accessor :status
|
30
|
+
attr_accessor :errors
|
31
|
+
|
32
|
+
def initialize(xml)
|
33
|
+
super
|
34
|
+
|
35
|
+
if is?(:Response) && has?(:Errors)
|
36
|
+
@errors = elements(:Errors).collect do |error|
|
37
|
+
Error.new(error)
|
38
|
+
end
|
39
|
+
else
|
40
|
+
@status = text_value(element(:Status))
|
41
|
+
@errors = elements('errors/errors').collect do |error|
|
42
|
+
ServiceError.new(error)
|
43
|
+
end unless successful?
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def successful?
|
48
|
+
@status == ResponseStatus::SUCCESS
|
49
|
+
end
|
50
|
+
|
51
|
+
def node_name(name, namespace=nil)
|
52
|
+
super(name.to_s.split('/').collect{ |tag|
|
53
|
+
tag.gsub(/(^|_)(.)/) { $2.upcase }
|
54
|
+
}.join('/'), namespace)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
class SignedQuery < Relax::Query
|
59
|
+
def initialize(uri, secret_key, query={})
|
60
|
+
super(query)
|
61
|
+
@uri = URI.parse(uri.to_s)
|
62
|
+
@secret_key = secret_key
|
63
|
+
end
|
64
|
+
|
65
|
+
def sign
|
66
|
+
delete(:awsSignature)
|
67
|
+
store(:awsSignature, Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::SHA1.new, @secret_key, "#{@uri.path}?#{to_s(false)}".gsub('%20', '+'))).strip)
|
68
|
+
end
|
69
|
+
|
70
|
+
def to_s(signed=true)
|
71
|
+
sign if signed
|
72
|
+
super()
|
73
|
+
end
|
74
|
+
|
75
|
+
class << self
|
76
|
+
def parse(uri, secret_key, query_string)
|
77
|
+
query = self.new(uri, secret_key)
|
78
|
+
|
79
|
+
query_string.split('&').each do |parameter|
|
80
|
+
key, value = parameter.split('=', 2)
|
81
|
+
query[key] = unescape_value(value)
|
82
|
+
end
|
83
|
+
|
84
|
+
query
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,181 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'relax'
|
3
|
+
|
4
|
+
require 'remit/common'
|
5
|
+
|
6
|
+
module Remit
|
7
|
+
class Amount < BaseResponse
|
8
|
+
parameter :currency_code
|
9
|
+
parameter :amount, :type => :float
|
10
|
+
end
|
11
|
+
|
12
|
+
class TemporaryDeclinePolicy < BaseResponse
|
13
|
+
parameter :temporary_decline_policy_type
|
14
|
+
parameter :implicit_retry_timeout_in_mins
|
15
|
+
end
|
16
|
+
|
17
|
+
class DescriptorPolicy < BaseResponse
|
18
|
+
parameter :soft_descriptor_type
|
19
|
+
parameter :CS_number_of
|
20
|
+
end
|
21
|
+
|
22
|
+
class ChargeFeeTo
|
23
|
+
CALLER = 'Caller'
|
24
|
+
RECIPIENT = 'Recipient'
|
25
|
+
end
|
26
|
+
|
27
|
+
class Error < BaseResponse
|
28
|
+
parameter :code
|
29
|
+
parameter :message
|
30
|
+
end
|
31
|
+
|
32
|
+
class InstrumentStatus
|
33
|
+
ALL = 'ALL'
|
34
|
+
ACTIVE = 'Active'
|
35
|
+
INACTIVE = 'Inactive'
|
36
|
+
end
|
37
|
+
|
38
|
+
class PaymentMethods
|
39
|
+
BALANCE_TRANSFER = 'abt'
|
40
|
+
BANK_ACCOUNT = 'ach'
|
41
|
+
CREDIT_CARD = 'credit card'
|
42
|
+
PREPAID = 'prepaid'
|
43
|
+
DEBT = 'Debt'
|
44
|
+
end
|
45
|
+
|
46
|
+
class ServiceError < BaseResponse
|
47
|
+
parameter :error_type
|
48
|
+
parameter :is_retriable
|
49
|
+
parameter :error_code
|
50
|
+
parameter :reason_text
|
51
|
+
|
52
|
+
class ErrorType
|
53
|
+
SYSTEM = 'System'
|
54
|
+
BUSINESS = 'Business'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
class ResponseStatus
|
59
|
+
SUCCESS = 'Success'
|
60
|
+
FAILURE = 'Failure'
|
61
|
+
end
|
62
|
+
|
63
|
+
class Token < BaseResponse
|
64
|
+
parameter :token_id
|
65
|
+
parameter :friendly_name
|
66
|
+
parameter :status
|
67
|
+
parameter :date_installed, :type => :time
|
68
|
+
parameter :caller_installed
|
69
|
+
parameter :caller_reference
|
70
|
+
parameter :token_type
|
71
|
+
parameter :old_token_id
|
72
|
+
parameter :payment_reason
|
73
|
+
|
74
|
+
class TokenStatus
|
75
|
+
ACTIVE = 'Active'
|
76
|
+
INACTIVE = 'Inactive'
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
class TokenUsageLimit < BaseResponse
|
81
|
+
parameter :count
|
82
|
+
parameter :limit
|
83
|
+
parameter :last_reset_amount
|
84
|
+
parameter :last_reset_count
|
85
|
+
parameter :last_reset_time_stamp
|
86
|
+
end
|
87
|
+
|
88
|
+
class TransactionResponse < BaseResponse
|
89
|
+
parameter :transaction_id
|
90
|
+
parameter :status
|
91
|
+
parameter :status_detail
|
92
|
+
parameter :new_sender_token_usage, :type => TokenUsageLimit
|
93
|
+
|
94
|
+
%w(reserved success failure initiated reinitiated temporary_decline).each do |status_name|
|
95
|
+
define_method("#{status_name}?") do
|
96
|
+
self.status == Remit::TransactionStatus.const_get(status_name.sub('_', '').upcase)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
class TransactionStatus
|
102
|
+
RESERVED = 'Reserved'
|
103
|
+
SUCCESS = 'Success'
|
104
|
+
FAILURE = 'Failure'
|
105
|
+
INITIATED = 'Initiated'
|
106
|
+
REINITIATED = 'Reinitiated'
|
107
|
+
TEMPORARYDECLINE = 'TemporaryDecline'
|
108
|
+
end
|
109
|
+
|
110
|
+
class TokenType
|
111
|
+
SINGLE_USE = 'SingleUse'
|
112
|
+
MULTI_USE = 'MultiUse'
|
113
|
+
RECURRING = 'Recurring'
|
114
|
+
UNRESTRICTED = 'Unrestricted'
|
115
|
+
end
|
116
|
+
|
117
|
+
class PipelineName
|
118
|
+
SINGLE_USE = 'SingleUse'
|
119
|
+
MULTI_USE = 'MultiUse'
|
120
|
+
RECURRING = 'Recurring'
|
121
|
+
RECIPIENT = 'Recipient'
|
122
|
+
SETUP_PREPAID = 'SetupPrepaid'
|
123
|
+
SETUP_POSTPAID = 'SetupPostpaid'
|
124
|
+
end
|
125
|
+
|
126
|
+
class PipelineStatusCode
|
127
|
+
CALLER_EXCEPTION = 'CE' # problem with your code
|
128
|
+
SYSTEM_ERROR = 'SE' # system error, try again
|
129
|
+
SUCCESS_ABT = 'SA' # successful payment with Amazon balance
|
130
|
+
SUCCESS_ACH = 'SB' # successful payment with bank transfer
|
131
|
+
SUCCESS_CC = 'SC' # successful payment with credit card
|
132
|
+
ABORTED = 'A' # user aborted payment
|
133
|
+
PAYMENT_METHOD_MISMATCH = 'PE' # user does not have payment method requested
|
134
|
+
PAYMENT_METHOD_UNSUPPORTED = 'NP' # account doesn't support requested payment method
|
135
|
+
INVALID_CALLER = 'NM' # you are not a valid 3rd party caller to the transaction
|
136
|
+
SUCCESS_RECIPIENT_TOKEN_INSTALLED = 'SR'
|
137
|
+
end
|
138
|
+
|
139
|
+
module RequestTypes
|
140
|
+
class Amount < Remit::Request
|
141
|
+
parameter :amount
|
142
|
+
parameter :currency_code
|
143
|
+
end
|
144
|
+
|
145
|
+
class TemporaryDeclinePolicy < Remit::Request
|
146
|
+
parameter :temporary_decline_policy_type
|
147
|
+
parameter :implicit_retry_timeout_in_mins
|
148
|
+
end
|
149
|
+
|
150
|
+
class DescriptorPolicy < Remit::Request
|
151
|
+
parameter :soft_descriptor_type
|
152
|
+
parameter :CS_number_of
|
153
|
+
end
|
154
|
+
|
155
|
+
#Amazon Docs list MarketplaceRefundPolicy as a ComplexDataType, but it is not.
|
156
|
+
#It really should be listed under Enumerated DataTypes
|
157
|
+
#MarketplaceTxnOnly Caller refunds his fee to the recipient. String
|
158
|
+
#MasterAndMarketplaceTxn Caller and Amazon FPS refund their fees to the String
|
159
|
+
# sender, and the recipient refunds his amount
|
160
|
+
#MasterTxnOnly Caller does not refund his fee. Amazon FPS String
|
161
|
+
# refunds its fee and the recipient refunds his amount
|
162
|
+
# plus the caller's fee to the sender.
|
163
|
+
class MarketplaceRefundPolicy < Remit::Request
|
164
|
+
POLICY = {
|
165
|
+
:marketplace_txn_only => 'MarketplaceTxnOnly',
|
166
|
+
:master_and_marketplace_txn => 'MasterAndMarketplaceTxn',
|
167
|
+
:master_txn_only => 'MasterTxnOnly'
|
168
|
+
}
|
169
|
+
end
|
170
|
+
|
171
|
+
end
|
172
|
+
|
173
|
+
class Operation
|
174
|
+
PAY = "Pay"
|
175
|
+
REFUND = "Refund"
|
176
|
+
SETTLE = "Settle"
|
177
|
+
SETTLE_DEBT = "SettleDebt"
|
178
|
+
WRITE_OFF_DEBT = "WriteOffDebt"
|
179
|
+
FUND_PREPAID = "FundPrepaid"
|
180
|
+
end
|
181
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# Scraped and categorized from http://docs.amazonwebservices.com/AmazonFPS/\
|
2
|
+
# 2007-01-08/FPSDeveloperGuide/index.html?ErrorCodesTable.html. You can use
|
3
|
+
# these categories to specify default error handling in your application such
|
4
|
+
# as asking users to retry or sending an exception email.
|
5
|
+
module Remit::ErrorCodes
|
6
|
+
class << self
|
7
|
+
def sender_error?(code)
|
8
|
+
SENDER.include? code.to_sym
|
9
|
+
end
|
10
|
+
|
11
|
+
def recipient_error?(code)
|
12
|
+
RECIPIENT.include? code.to_sym
|
13
|
+
end
|
14
|
+
|
15
|
+
def caller_error?(code)
|
16
|
+
CALLER.include?(code.to_sym)
|
17
|
+
end
|
18
|
+
|
19
|
+
def amazon_error?(code)
|
20
|
+
AMAZON.include? code.to_sym
|
21
|
+
end
|
22
|
+
|
23
|
+
def api_error?(code)
|
24
|
+
API.include? code.to_sym
|
25
|
+
end
|
26
|
+
|
27
|
+
def unknown_error?(code)
|
28
|
+
UNKNOWN.include? code.to_sym
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
SENDER = [
|
33
|
+
:InactiveAccount_Sender, # The sender's account is in suspended or closed state.
|
34
|
+
:InactiveInstrument, # The payment instrument used for this transaction is no longer active.
|
35
|
+
:InstrumentExpired, # The prepaid or the postpaid instrument has expired.
|
36
|
+
:InstrumentNotActive, # The prepaid or postpaid instrument used in the transaction is not active.
|
37
|
+
:InvalidAccountState_Sender, # Sender account cannot participate in the transaction.
|
38
|
+
:InvalidInstrumentForAccountType, # The sender account can use only credit cards
|
39
|
+
:InvalidInstrumentState, # The prepaid or credit instrument should be active
|
40
|
+
:InvalidTokenId_Sender, # The send token specified is either invalid or canceled or the token is not active.
|
41
|
+
:PaymentInstrumentNotCC, # The payment method specified in the transaction is not a credit card. You can only use a credit card for this transaction.
|
42
|
+
:PaymentInstrumentMissing, # There needs to be a payment instrument defined in the token which defines the payment method.
|
43
|
+
:TokenNotActive_Sender, # The sender token is canceled.
|
44
|
+
:UnverifiedAccount_Sender, # The sender's account must have a verified U.S. credit card or a verified U.S bank account before this transaction can be initiated
|
45
|
+
:UnverifiedBankAccount, # A verified bank account should be used for this transaction
|
46
|
+
:UnverifiedEmailAddress_Sender, # The sender account must have a verified e-mail address for this payment
|
47
|
+
]
|
48
|
+
|
49
|
+
RECIPIENT = [
|
50
|
+
:InactiveAccount_Recipient, # The recipient's account is in suspended or closed state.
|
51
|
+
:InvalidAccountState_Recipient, # Recipient account cannot participate in the transaction
|
52
|
+
:InvalidRecipientRoleForAccountType, # The recipient account is not allowed to receive payments
|
53
|
+
:InvalidRecipientForCCTransaction, # This account cannot receive credit card payments.
|
54
|
+
:InvalidTokenId_Recipient, # The recipient token specified is either invalid or canceled.
|
55
|
+
:TokenNotActive_Recipient, # The recipient token is canceled.
|
56
|
+
:UnverifiedAccount_Recipient, # The recipient's account must have a verified bank account or a credit card before this transaction can be initiated.
|
57
|
+
:UnverifiedEmailAddress_Recipient, # The recipient account must have a verified e-mail address for receiving payments.
|
58
|
+
]
|
59
|
+
|
60
|
+
CALLER = [
|
61
|
+
:InactiveAccount_Caller, # The caller's account is in suspended or closed state.
|
62
|
+
:InvalidAccountState_Caller, # The caller account cannot participate in the transaction
|
63
|
+
:InvalidTokenId_Caller, # The caller token specified is either invalid or canceled or the specified token is not active.
|
64
|
+
:TokenNotActive_Caller, # The caller token is canceled.
|
65
|
+
:UnverifiedEmailAddress_Caller, # The caller account must have a verified e-mail address
|
66
|
+
]
|
67
|
+
|
68
|
+
AMAZON = [
|
69
|
+
:InternalError # A retriable error that happens due to some transient problem in the system.
|
70
|
+
]
|
71
|
+
|
72
|
+
# bad syntax or logic
|
73
|
+
API = [
|
74
|
+
:AmountOutOfRange, # The transaction amount is more than the allowed range.
|
75
|
+
:BadRule, # One of the GK constructs is not well defined
|
76
|
+
:CannotSpecifyUsageForSingleUseToken, # Token usages cannot be specified for a single use token.
|
77
|
+
:ConcurrentModification, # A retriable error can happen due to concurrent modification of data by two processes.
|
78
|
+
:DuplicateRequest, # A different request associated with this caller reference already exists.
|
79
|
+
:IncompatibleTokens, # The transaction could not be completed because the tokens have incompatible payment instructions.
|
80
|
+
:InstrumentAccessDenied, # The external calling application is not the recipient for this postpaid or prepaid instrument. The caller should be the liability holder
|
81
|
+
:InvalidCallerReference, # The CallerReferece does not have a token associated with it.
|
82
|
+
:InvalidDateRange, # The end date specified is before the start date or the start date is in the future.
|
83
|
+
:InvalidEvent, # The event specified was not subscribed using the SubscribeForCallerNotification operation.
|
84
|
+
:InvalidParams, # One or more parameters in the request is invalid.
|
85
|
+
:InvalidPaymentInstrument, # The payment method used in the transaction is invalid.
|
86
|
+
:InvalidPaymentMethod, # Payment method specified in the GK construct is invalid.
|
87
|
+
:InvalidSenderRoleForAccountType, # This token cannot be used for this operation.
|
88
|
+
:InvalidTokenId, # The token that you are trying to cancel was not installed by you.
|
89
|
+
:InvalidTokenType, # Invalid operation performed on the token. Example, getting the token usage information on a single use token.
|
90
|
+
:InvalidTransactionId, # The specified transaction could not be found or the caller did not execute the transaction or this is not a Pay or Reserve call.
|
91
|
+
:InvalidTransactionState, # The transaction is not completed or it has been temporarily failed.
|
92
|
+
:InvalidUsageDuration, # The duration cannot be less than one hour.
|
93
|
+
:InvalidUsageLimitCount, # The usage count is null or empty.
|
94
|
+
:InvalidUsageStartTime, # The start time specified for the token is not valid.
|
95
|
+
:InvalidUsageType, # The usage type specified is invalid.
|
96
|
+
:OriginalTransactionIncomplete, # The original transaction is still in progress.
|
97
|
+
:OriginalTransactionFailed, # The original transaction has failed
|
98
|
+
:PaymentMethodNotDefined, # Payment method is not defined in the transaction.
|
99
|
+
:RefundAmountExceeded, # The refund amount is more than the refundable amount.
|
100
|
+
:SameTokenIdUsedMultipleTimes, # This token is already used in earlier transactions.
|
101
|
+
:SenderNotOriginalRecipient, # The sender in the refund transaction is not the recipient of the original transaction.
|
102
|
+
:SettleAmountGreaterThanReserveAmount, # The amount being settled is greater than the reserved amount.
|
103
|
+
:TransactionDenied, # This transaction is not allowed.
|
104
|
+
:TransactionExpired, # Returned when the Caller attempts to explicitly retry a transaction that is temporarily declined and is in queue for implicit retry.
|
105
|
+
:TransactionFullyRefundedAlready, # The complete refund for this transaction is already completed
|
106
|
+
:TransactionTypeNotRefundable, # You cannot refund this transaction.
|
107
|
+
:TokenAccessDenied, # Permission is denied to cancel the token.
|
108
|
+
:TokenUsageError, # The token usage limit is exceeded.
|
109
|
+
:UsageNotDefined, # For a multi-use token or a recurring token the usage limits are not specified in the GateKeeper text.
|
110
|
+
]
|
111
|
+
|
112
|
+
# these errors don't specify who is at fault
|
113
|
+
UNKNOWN = [
|
114
|
+
:InvalidAccountState, # The account is either suspended or closed. Payment instructions cannot be installed on this account.
|
115
|
+
:InsufficientBalance, # The sender, caller, or recipient's account balance has insufficient funds to complete the transaction.
|
116
|
+
:AccountLimitsExceeded, # The spending or the receiving limit on the account is exceeded
|
117
|
+
]
|
118
|
+
end
|