eway_rapid 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/LICENSE.md +1 -1
- data/lib/eway_rapid.rb +5 -0
- data/lib/eway_rapid/constants.rb +19 -0
- data/lib/eway_rapid/entities/direct_settlement_search_response.rb +26 -0
- data/lib/eway_rapid/message/convert/internal_settlement_to_settlement.rb +27 -0
- data/lib/eway_rapid/message/convert/internal_summary_to_summary.rb +39 -0
- data/lib/eway_rapid/message/convert/response/direct_settlement_to_settlement.rb +38 -0
- data/lib/eway_rapid/message/process/customer_process.rb +2 -2
- data/lib/eway_rapid/message/process/transaction_process.rb +24 -0
- data/lib/eway_rapid/models/enums.rb +14 -0
- data/lib/eway_rapid/models/internal_models.rb +112 -0
- data/lib/eway_rapid/models/models.rb +43 -0
- data/lib/eway_rapid/output/settlement_search_response.rb +11 -0
- data/lib/eway_rapid/rapid_client.rb +25 -3
- data/lib/eway_rapid/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f20ee75f57d184d2fd32650fa8ac12e355261e0
|
4
|
+
data.tar.gz: 9cdee807c8e6036d51db197bc844621eeaf7a20b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76ef286463949b3d6e22696875794c79c51c13130599f1b99420ac9321d3765fb900d226e03e37c7b689dd1305849cdecf0b8225e0e2746ef037d53b0de0e259
|
7
|
+
data.tar.gz: 2c9916c8e2027c9c159fba0d54916a3bf749ca610e569b948a74bbcbdd44c3498f10b005bb9d843c79e9c5c18d4a23f063eeef99b13b1d211f78de55e98530cc
|
data/CHANGELOG.md
CHANGED
data/LICENSE.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2015 Web Active Corporation Pty Ltd
|
3
|
+
Copyright (c) 2015-2016 Web Active Corporation Pty Ltd
|
4
4
|
|
5
5
|
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
> of this software and associated documentation files (the "Software"), to deal
|
data/lib/eway_rapid.rb
CHANGED
@@ -18,6 +18,7 @@ require File.join(File.dirname(__FILE__), 'eway_rapid', 'output', 'create_transa
|
|
18
18
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'output', 'query_customer_response')
|
19
19
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'output', 'query_transaction_response')
|
20
20
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'output', 'refund_response')
|
21
|
+
require File.join(File.dirname(__FILE__), 'eway_rapid', 'output', 'settlement_search_response')
|
21
22
|
|
22
23
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'cancel_authorisation_request')
|
23
24
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'cancel_authorisation_response')
|
@@ -34,12 +35,15 @@ require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'direct_paym
|
|
34
35
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'direct_payment_response')
|
35
36
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'direct_refund_request')
|
36
37
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'direct_refund_response')
|
38
|
+
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'direct_settlement_search_response')
|
37
39
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'transaction_search_response')
|
38
40
|
|
39
41
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'customer_to_internal_customer')
|
40
42
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'direct_payment_to_trans_status')
|
41
43
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'direct_refund_to_trans_status')
|
42
44
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'internal_customer_to_customer')
|
45
|
+
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'internal_settlement_to_settlement')
|
46
|
+
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'internal_summary_to_summary')
|
43
47
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'internal_trans_to_trans')
|
44
48
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'internal_transaction_to_address')
|
45
49
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'internal_transaction_to_status')
|
@@ -67,6 +71,7 @@ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'r
|
|
67
71
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'direct_payment_to_create_cust')
|
68
72
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'direct_payment_to_create_trans')
|
69
73
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'direct_refund_to_refund_response')
|
74
|
+
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'direct_settlement_to_settlement')
|
70
75
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'search_to_query_trans')
|
71
76
|
|
72
77
|
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'process', 'rest_process')
|
data/lib/eway_rapid/constants.rb
CHANGED
@@ -94,6 +94,24 @@ module EwayRapid
|
|
94
94
|
CUSTOMER_VIEW = 'CustomView'
|
95
95
|
VERIFY_CUSTOMER_PHONE = 'VerifyCustomerPhone'
|
96
96
|
VERIFY_CUSTOMER_EMAIL = 'VerifyCustomerEmail'
|
97
|
+
SETTLEMENT_SUMMARIES = 'SettlementSummaries'
|
98
|
+
SETTLEMENT_TRANSACTIONS = 'SettlementTransactions'
|
99
|
+
SETTLEMENT_ID = 'SettlementID'
|
100
|
+
CURRENCY = 'Currency'
|
101
|
+
TOTAL_CREDIT = 'TotalCredit'
|
102
|
+
TOTAL_DEBIT = 'TotalDebit'
|
103
|
+
TOTAL_BALANCE = 'TotalBalance'
|
104
|
+
BALANCE_PER_CARD_TYPE = 'BalancePerCardType'
|
105
|
+
CARD_TYPE = 'CardType'
|
106
|
+
NUMBER_OF_TRANSACTIONS = 'NumberOfTransactions'
|
107
|
+
CREDIT = 'Credit'
|
108
|
+
DEBIT = 'Debit'
|
109
|
+
BALANCE = 'Balance'
|
110
|
+
EWAY_CUSTOMER_ID = 'eWAYCustomerID'
|
111
|
+
TXN_REFERENCE = 'TxnReference'
|
112
|
+
AMOUNT = 'Amount'
|
113
|
+
TRANSACTION_DATE = 'TransactionDateTime'
|
114
|
+
SETTLEMENT_DATE = 'SettlementDateTime'
|
97
115
|
JSON_SUFFIX = '.json'
|
98
116
|
LIBRARY_NOT_HAVE_ENDPOINT_ERROR_CODE = 'S9990'
|
99
117
|
API_KEY_INVALID_ERROR_CODE = 'S9991'
|
@@ -122,5 +140,6 @@ module EwayRapid
|
|
122
140
|
TRANSACTION_QUERY_WITH_INVOICE_REF_METHOD = 'InvoiceRef'
|
123
141
|
REFUND_SUB_PATH_METHOD = 'Refund'
|
124
142
|
CAPTURE_PAYMENT_METHOD = 'CapturePayment'
|
143
|
+
SETTLEMENT_SEARCH_METHOD = 'Search/Settlement?'
|
125
144
|
end
|
126
145
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module EwayRapid
|
2
|
+
class DirectSettlementSearchResponse
|
3
|
+
attr_accessor :settlement_summaries
|
4
|
+
attr_accessor :settlement_transactions
|
5
|
+
attr_accessor :error
|
6
|
+
|
7
|
+
def to_json(summaries={}, transactions={})
|
8
|
+
{Constants::SETTLEMENT_SUMMARIES => summaries,
|
9
|
+
Constants::SETTLEMENT_TRANSACTIONS => transactions,
|
10
|
+
Constants::ERRORS_CAPITALIZED => error}.to_json
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.from_json(json)
|
14
|
+
hash = JSON.parse(json)
|
15
|
+
from_hash(hash)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.from_hash(hash)
|
19
|
+
settlement_search_response = DirectSettlementSearchResponse.new
|
20
|
+
settlement_search_response.settlement_summaries = InternalModels::SettlementSummary.from_array(hash[Constants::SETTLEMENT_SUMMARIES])
|
21
|
+
settlement_search_response.settlement_transactions = InternalModels::SettlementTransaction.from_array(hash[Constants::SETTLEMENT_TRANSACTIONS])
|
22
|
+
settlement_search_response.error = hash[Constants::ERRORS_CAPITALIZED]
|
23
|
+
settlement_search_response
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module EwayRapid
|
2
|
+
module Message
|
3
|
+
module Convert
|
4
|
+
class InternalSettlementToSettlement
|
5
|
+
|
6
|
+
# @param [InternalModels::SettlementTransaction] i_settlement
|
7
|
+
# @return [Models::SettlementTransaction]
|
8
|
+
def do_convert(i_settlement)
|
9
|
+
settlement = Models::SettlementTransaction.new
|
10
|
+
settlement.settlement_id = i_settlement.settlement_id
|
11
|
+
settlement.eway_customer_id = i_settlement.eway_customer_id
|
12
|
+
settlement.currency = i_settlement.currency
|
13
|
+
settlement.currency_code = i_settlement.transaction_id
|
14
|
+
settlement.transaction_id = i_settlement.transaction_id
|
15
|
+
settlement.txn_reference = i_settlement.txn_reference
|
16
|
+
settlement.card_type = i_settlement.card_type
|
17
|
+
settlement.amount = i_settlement.amount
|
18
|
+
settlement.transaction_type = i_settlement.transaction_type
|
19
|
+
settlement.transaction_date = Time.at(i_settlement.transaction_date.delete('^0-9').to_i / 1000.0 )
|
20
|
+
settlement.settlement_date = Time.at(i_settlement.settlement_date.delete('^0-9').to_i / 1000.0 )
|
21
|
+
settlement
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module EwayRapid
|
2
|
+
module Message
|
3
|
+
module Convert
|
4
|
+
class InternalSummaryToSummary
|
5
|
+
|
6
|
+
# @param [InternalModels::SettlementSummary] i_summary
|
7
|
+
# @return [Models::SettlementSummary]
|
8
|
+
def do_convert(i_summary)
|
9
|
+
summary = Models::SettlementSummary.new
|
10
|
+
summary.settlement_id = i_summary.settlement_id
|
11
|
+
summary.currency = i_summary.currency
|
12
|
+
summary.currency_code = i_summary.currency_code
|
13
|
+
summary.total_credit = i_summary.total_credit
|
14
|
+
summary.total_debit = i_summary.total_debit
|
15
|
+
summary.total_balance = i_summary.total_balance
|
16
|
+
summary.balance_per_card_type = []
|
17
|
+
i_summary.balance_per_card_type.each {|balance|
|
18
|
+
obj = get_balance(balance)
|
19
|
+
summary.balance_per_card_type.push(obj)
|
20
|
+
}
|
21
|
+
summary
|
22
|
+
end
|
23
|
+
|
24
|
+
# @param [InternalModels::BalancePerCardType] i_balance
|
25
|
+
# @return [Models::BalancePerCardType]
|
26
|
+
def get_balance(i_balance)
|
27
|
+
balance = Models::BalancePerCardType.new
|
28
|
+
balance.card_type = i_balance.card_type
|
29
|
+
balance.number_of_transactions = i_balance.number_of_transactions
|
30
|
+
balance.credit = i_balance.credit
|
31
|
+
balance.debit = i_balance.debit
|
32
|
+
balance.balance = i_balance.balance
|
33
|
+
balance
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module EwayRapid
|
2
|
+
module Message
|
3
|
+
module Convert
|
4
|
+
module Response
|
5
|
+
class DirectSettlementToSettlement
|
6
|
+
|
7
|
+
# @param [DirectSettlementSearchResponse] response
|
8
|
+
# @return [SettlementSearchResponse]
|
9
|
+
def do_convert(response)
|
10
|
+
settlement_search_response = SettlementSearchResponse.new
|
11
|
+
|
12
|
+
if response.settlement_summaries && response.settlement_summaries.length > 0
|
13
|
+
summary_convert = InternalSummaryToSummary.new
|
14
|
+
settlement_search_response.settlement_summaries = []
|
15
|
+
response.settlement_summaries.each {|summary|
|
16
|
+
obj = summary_convert.do_convert(summary)
|
17
|
+
settlement_search_response.settlement_summaries.push(obj)
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
if response.settlement_transactions && response.settlement_summaries.length > 0
|
22
|
+
settlement_convert = InternalSettlementToSettlement.new
|
23
|
+
settlement_search_response.settlement_transactions = []
|
24
|
+
response.settlement_transactions.each {|transaction|
|
25
|
+
obj = settlement_convert.do_convert(transaction)
|
26
|
+
settlement_search_response.settlement_transactions.push(obj)
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
settlement_search_response.errors = response.error.split(/\s*,\s*/) if response.error
|
31
|
+
|
32
|
+
settlement_search_response
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -14,7 +14,7 @@ module EwayRapid
|
|
14
14
|
request.customer = convert.do_convert(input)
|
15
15
|
request.customer_ip = input.customer_device_ip
|
16
16
|
request.method = Constants::CREATE_TOKEN_CUSTOMER_METHOD
|
17
|
-
request.transaction_type = Enums::TransactionType::
|
17
|
+
request.transaction_type = Enums::TransactionType::MOTO
|
18
18
|
request
|
19
19
|
end
|
20
20
|
|
@@ -157,7 +157,7 @@ module EwayRapid
|
|
157
157
|
request.customer = converter.do_convert(input)
|
158
158
|
request.customer_ip = input.customer_device_ip
|
159
159
|
request.method = Constants::UPDATE_TOKEN_CUSTOMER_METHOD
|
160
|
-
request.transaction_type = Enums::TransactionType::
|
160
|
+
request.transaction_type = Enums::TransactionType::MOTO
|
161
161
|
request
|
162
162
|
end
|
163
163
|
|
@@ -134,6 +134,30 @@ module EwayRapid
|
|
134
134
|
converter.do_convert(transaction_search_resp)
|
135
135
|
end
|
136
136
|
end
|
137
|
+
|
138
|
+
# Settlement search message process
|
139
|
+
class SettlementSearchMsgProcess
|
140
|
+
include RestProcess
|
141
|
+
|
142
|
+
def self.create_request(input)
|
143
|
+
hash = {}
|
144
|
+
input.instance_variables.map do |var|
|
145
|
+
hash[var.to_s.delete('@').split('_').collect(&:capitalize).join] = input.instance_variable_get(var)
|
146
|
+
end
|
147
|
+
|
148
|
+
URI.encode_www_form(hash)
|
149
|
+
end
|
150
|
+
|
151
|
+
def self.send_request(url, api_key, password)
|
152
|
+
SettlementSearchMsgProcess.new.do_get(url, api_key, password)
|
153
|
+
end
|
154
|
+
|
155
|
+
def self.make_result(response)
|
156
|
+
settlement_search_resp = DirectSettlementSearchResponse.from_json(response)
|
157
|
+
converter = Convert::Response::DirectSettlementToSettlement.new
|
158
|
+
converter.do_convert(settlement_search_resp)
|
159
|
+
end
|
160
|
+
end
|
137
161
|
end
|
138
162
|
end
|
139
163
|
end
|
@@ -122,5 +122,19 @@ module EwayRapid
|
|
122
122
|
end
|
123
123
|
end
|
124
124
|
end
|
125
|
+
|
126
|
+
class CardType
|
127
|
+
ALL = 'ALL'
|
128
|
+
VISA = 'VI'
|
129
|
+
MASTERCARD = 'MC'
|
130
|
+
AMEX = 'AX'
|
131
|
+
DINERS = 'DC'
|
132
|
+
JCB = 'JC'
|
133
|
+
MAESTRO_UK = 'MD'
|
134
|
+
MAESTRO_INTERNATIONAL = 'MI'
|
135
|
+
SOLO = 'SO'
|
136
|
+
LASER = 'LA'
|
137
|
+
DISCOVER = 'DS'
|
138
|
+
end
|
125
139
|
end
|
126
140
|
end
|
@@ -427,5 +427,117 @@ module EwayRapid
|
|
427
427
|
verification
|
428
428
|
end
|
429
429
|
end
|
430
|
+
|
431
|
+
class SettlementSummary
|
432
|
+
attr_accessor :settlement_id
|
433
|
+
attr_accessor :currency
|
434
|
+
attr_accessor :currency_code
|
435
|
+
attr_accessor :total_credit
|
436
|
+
attr_accessor :total_debit
|
437
|
+
attr_accessor :total_balance
|
438
|
+
attr_accessor :balance_per_card_type
|
439
|
+
|
440
|
+
def self.from_json(json)
|
441
|
+
hash = JSON.parse(json)
|
442
|
+
from_hash(hash)
|
443
|
+
end
|
444
|
+
|
445
|
+
def self.from_hash(hash)
|
446
|
+
settlement_summary = SettlementSummary.new
|
447
|
+
settlement_summary.settlement_id = hash[Constants::SETTLEMENT_ID]
|
448
|
+
settlement_summary.currency = hash[Constants::CURRENCY]
|
449
|
+
settlement_summary.currency_code = hash[Constants::CURRENCY_CODE]
|
450
|
+
settlement_summary.total_credit = hash[Constants::TOTAL_CREDIT]
|
451
|
+
settlement_summary.total_debit = hash[Constants::TOTAL_DEBIT]
|
452
|
+
settlement_summary.total_balance = hash[Constants::TOTAL_BALANCE]
|
453
|
+
settlement_summary.balance_per_card_type = BalancePerCardType.from_array(hash[Constants::BALANCE_PER_CARD_TYPE])
|
454
|
+
settlement_summary
|
455
|
+
end
|
456
|
+
|
457
|
+
def self.from_array(array)
|
458
|
+
summaries = []
|
459
|
+
array.each {|summary_hash|
|
460
|
+
obj = from_hash(summary_hash)
|
461
|
+
summaries.push(obj)
|
462
|
+
}
|
463
|
+
summaries
|
464
|
+
end
|
465
|
+
end
|
466
|
+
|
467
|
+
class BalancePerCardType
|
468
|
+
attr_accessor :card_type
|
469
|
+
attr_accessor :number_of_transactions
|
470
|
+
attr_accessor :credit
|
471
|
+
attr_accessor :debit
|
472
|
+
attr_accessor :balance
|
473
|
+
|
474
|
+
def self.from_json(json)
|
475
|
+
hash = JSON.parse(json)
|
476
|
+
from_hash(hash)
|
477
|
+
end
|
478
|
+
|
479
|
+
def self.from_hash(hash)
|
480
|
+
balance = BalancePerCardType.new
|
481
|
+
balance.card_type = hash[Constants::CARD_TYPE]
|
482
|
+
balance.number_of_transactions = hash[Constants::NUMBER_OF_TRANSACTIONS]
|
483
|
+
balance.credit = hash[Constants::CREDIT]
|
484
|
+
balance.debit = hash[Constants::DEBIT]
|
485
|
+
balance.balance = hash[Constants::BALANCE]
|
486
|
+
balance
|
487
|
+
end
|
488
|
+
|
489
|
+
def self.from_array(array)
|
490
|
+
balances = []
|
491
|
+
array.each {|balance_hash|
|
492
|
+
obj = from_hash(balance_hash)
|
493
|
+
balances.push(obj)
|
494
|
+
}
|
495
|
+
balances
|
496
|
+
end
|
497
|
+
end
|
498
|
+
|
499
|
+
class SettlementTransaction
|
500
|
+
attr_accessor :settlement_id
|
501
|
+
attr_accessor :eway_customer_id
|
502
|
+
attr_accessor :currency
|
503
|
+
attr_accessor :currency_code
|
504
|
+
attr_accessor :transaction_id
|
505
|
+
attr_accessor :txn_reference
|
506
|
+
attr_accessor :card_type
|
507
|
+
attr_accessor :amount
|
508
|
+
attr_accessor :transaction_type
|
509
|
+
attr_accessor :transaction_date
|
510
|
+
attr_accessor :settlement_date
|
511
|
+
|
512
|
+
def self.from_json(json)
|
513
|
+
hash = JSON.parse(json)
|
514
|
+
from_hash(hash)
|
515
|
+
end
|
516
|
+
|
517
|
+
def self.from_hash(hash)
|
518
|
+
transaction = SettlementTransaction.new
|
519
|
+
transaction.settlement_id = hash[Constants::SETTLEMENT_ID]
|
520
|
+
transaction.eway_customer_id = hash[Constants::EWAY_CUSTOMER_ID]
|
521
|
+
transaction.currency = hash[Constants::CURRENCY]
|
522
|
+
transaction.currency_code = hash[Constants::CURRENCY_CODE]
|
523
|
+
transaction.transaction_id = hash[Constants::TRANSACTION_ID]
|
524
|
+
transaction.txn_reference = hash[Constants::TXN_REFERENCE]
|
525
|
+
transaction.card_type = hash[Constants::CARD_TYPE]
|
526
|
+
transaction.amount = hash[Constants::AMOUNT]
|
527
|
+
transaction.transaction_type = hash[Constants::TRANSACTION_TYPE]
|
528
|
+
transaction.transaction_date = hash[Constants::TRANSACTION_DATE]
|
529
|
+
transaction.settlement_date = hash[Constants::SETTLEMENT_DATE]
|
530
|
+
transaction
|
531
|
+
end
|
532
|
+
|
533
|
+
def self.from_array(array)
|
534
|
+
transactions = []
|
535
|
+
array.each {|transaction_hash|
|
536
|
+
obj = from_hash(transaction_hash)
|
537
|
+
transactions.push(obj)
|
538
|
+
}
|
539
|
+
transactions
|
540
|
+
end
|
541
|
+
end
|
430
542
|
end
|
431
543
|
end
|
@@ -330,5 +330,48 @@ module EwayRapid
|
|
330
330
|
# The result of the Beagle Verify phone verification
|
331
331
|
attr_accessor :beagle_phone
|
332
332
|
end
|
333
|
+
|
334
|
+
class SettlementSearch
|
335
|
+
attr_accessor :report_mode
|
336
|
+
attr_accessor :settlement_date
|
337
|
+
attr_accessor :start_date
|
338
|
+
attr_accessor :end_date
|
339
|
+
attr_accessor :card_type
|
340
|
+
attr_accessor :currency
|
341
|
+
attr_accessor :page
|
342
|
+
attr_accessor :page_size
|
343
|
+
end
|
344
|
+
|
345
|
+
class SettlementSummary
|
346
|
+
attr_accessor :settlement_id
|
347
|
+
attr_accessor :currency
|
348
|
+
attr_accessor :currency_code
|
349
|
+
attr_accessor :total_credit
|
350
|
+
attr_accessor :total_debit
|
351
|
+
attr_accessor :total_balance
|
352
|
+
attr_accessor :balance_per_card_type
|
353
|
+
end
|
354
|
+
|
355
|
+
class BalancePerCardType
|
356
|
+
attr_accessor :card_type
|
357
|
+
attr_accessor :number_of_transactions
|
358
|
+
attr_accessor :credit
|
359
|
+
attr_accessor :debit
|
360
|
+
attr_accessor :balance
|
361
|
+
end
|
362
|
+
|
363
|
+
class SettlementTransaction
|
364
|
+
attr_accessor :settlement_id
|
365
|
+
attr_accessor :eway_customer_id
|
366
|
+
attr_accessor :currency
|
367
|
+
attr_accessor :currency_code
|
368
|
+
attr_accessor :transaction_id
|
369
|
+
attr_accessor :txn_reference
|
370
|
+
attr_accessor :card_type
|
371
|
+
attr_accessor :amount
|
372
|
+
attr_accessor :transaction_type
|
373
|
+
attr_accessor :transaction_date
|
374
|
+
attr_accessor :settlement_date
|
375
|
+
end
|
333
376
|
end
|
334
377
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module EwayRapid
|
2
|
+
# Settlement search response
|
3
|
+
class SettlementSearchResponse < ResponseOutput
|
4
|
+
|
5
|
+
# Array of daily settlement summaries
|
6
|
+
attr_accessor :settlement_summaries
|
7
|
+
|
8
|
+
# Array of settlement transactions
|
9
|
+
attr_accessor :settlement_transactions
|
10
|
+
end
|
11
|
+
end
|
@@ -270,13 +270,35 @@ module EwayRapid
|
|
270
270
|
end
|
271
271
|
end
|
272
272
|
|
273
|
+
# Performs a search of settlements
|
274
|
+
#
|
275
|
+
# @param [SettlementSearch]
|
276
|
+
# @return [SettlementSearchResponse]
|
277
|
+
def settlement_search(search_request)
|
278
|
+
unless @is_valid
|
279
|
+
return make_response_with_exception(Exceptions::APIKeyInvalidException.new('API key, password or Rapid endpoint missing or invalid'), QueryCustomerResponse)
|
280
|
+
end
|
281
|
+
begin
|
282
|
+
|
283
|
+
request = Message::TransactionProcess::SettlementSearchMsgProcess.create_request(search_request)
|
284
|
+
url = @web_url + Constants::SETTLEMENT_SEARCH_METHOD + request
|
285
|
+
|
286
|
+
response = Message::TransactionProcess::SettlementSearchMsgProcess.send_request(url, @api_key, @password)
|
287
|
+
Message::TransactionProcess::SettlementSearchMsgProcess.make_result(response)
|
288
|
+
|
289
|
+
rescue => e
|
290
|
+
@logger.error(e.to_s) if @logger
|
291
|
+
make_response_with_exception(e, SettlementSearchResponse)
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
273
295
|
# Translate an error code to a user friendly message
|
274
296
|
#
|
275
297
|
# @param [String] code The code to translate
|
276
298
|
# @param [String] language The 2 letter code for the language to translate to (only en at this time)
|
277
299
|
# @return [String] Error message
|
278
300
|
def self.user_display_message(code, language = 'en')
|
279
|
-
find_error_code(code, language)
|
301
|
+
find_error_code(code, language.downcase)
|
280
302
|
end
|
281
303
|
|
282
304
|
# Gets the valid status of this Rapid client
|
@@ -354,7 +376,7 @@ module EwayRapid
|
|
354
376
|
if @is_valid
|
355
377
|
begin
|
356
378
|
parser_endpoint_to_web_url
|
357
|
-
|
379
|
+
unless @list_error.nil?
|
358
380
|
@list_error.clear
|
359
381
|
end
|
360
382
|
set_valid(true)
|
@@ -365,7 +387,7 @@ module EwayRapid
|
|
365
387
|
add_error_code(Constants::LIBRARY_NOT_HAVE_ENDPOINT_ERROR_CODE)
|
366
388
|
end
|
367
389
|
else
|
368
|
-
@logger.warn
|
390
|
+
@logger.warn 'Invalid parameter passed to Rapid client' if @logger
|
369
391
|
end
|
370
392
|
end
|
371
393
|
|
data/lib/eway_rapid/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eway_rapid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- eWAY
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01
|
11
|
+
date: 2016-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -125,12 +125,15 @@ files:
|
|
125
125
|
- lib/eway_rapid/entities/direct_payment_response.rb
|
126
126
|
- lib/eway_rapid/entities/direct_refund_request.rb
|
127
127
|
- lib/eway_rapid/entities/direct_refund_response.rb
|
128
|
+
- lib/eway_rapid/entities/direct_settlement_search_response.rb
|
128
129
|
- lib/eway_rapid/entities/transaction_search_response.rb
|
129
130
|
- lib/eway_rapid/exceptions.rb
|
130
131
|
- lib/eway_rapid/message/convert/customer_to_internal_customer.rb
|
131
132
|
- lib/eway_rapid/message/convert/direct_payment_to_trans_status.rb
|
132
133
|
- lib/eway_rapid/message/convert/direct_refund_to_trans_status.rb
|
133
134
|
- lib/eway_rapid/message/convert/internal_customer_to_customer.rb
|
135
|
+
- lib/eway_rapid/message/convert/internal_settlement_to_settlement.rb
|
136
|
+
- lib/eway_rapid/message/convert/internal_summary_to_summary.rb
|
134
137
|
- lib/eway_rapid/message/convert/internal_trans_to_trans.rb
|
135
138
|
- lib/eway_rapid/message/convert/internal_transaction_to_address.rb
|
136
139
|
- lib/eway_rapid/message/convert/internal_transaction_to_status.rb
|
@@ -150,6 +153,7 @@ files:
|
|
150
153
|
- lib/eway_rapid/message/convert/response/direct_payment_to_create_cust.rb
|
151
154
|
- lib/eway_rapid/message/convert/response/direct_payment_to_create_trans.rb
|
152
155
|
- lib/eway_rapid/message/convert/response/direct_refund_to_refund_response.rb
|
156
|
+
- lib/eway_rapid/message/convert/response/direct_settlement_to_settlement.rb
|
153
157
|
- lib/eway_rapid/message/convert/response/search_to_query_trans.rb
|
154
158
|
- lib/eway_rapid/message/convert/shipping_details_to_address.rb
|
155
159
|
- lib/eway_rapid/message/convert/transaction_shipping_address.rb
|
@@ -169,6 +173,7 @@ files:
|
|
169
173
|
- lib/eway_rapid/output/query_transaction_response.rb
|
170
174
|
- lib/eway_rapid/output/refund_response.rb
|
171
175
|
- lib/eway_rapid/output/response_output.rb
|
176
|
+
- lib/eway_rapid/output/settlement_search_response.rb
|
172
177
|
- lib/eway_rapid/rapid_client.rb
|
173
178
|
- lib/eway_rapid/rapid_logger.rb
|
174
179
|
- lib/eway_rapid/resources/err_code_resource_en.yml
|