genesis_ruby 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/Gemfile.lock +2 -2
- data/README.md +43 -1
- data/VERSION +1 -1
- data/genesis_ruby.gemspec +7 -4
- data/lib/genesis_ruby/api/constants/transactions/parameters/refund/bank_account_types.rb +27 -0
- data/lib/genesis_ruby/api/requests/base/financials/credit_card.rb +0 -2
- data/lib/genesis_ruby/api/requests/base/reference.rb +29 -0
- data/lib/genesis_ruby/api/requests/financial/capture.rb +30 -0
- data/lib/genesis_ruby/api/requests/financial/refund.rb +48 -0
- data/lib/genesis_ruby/api/requests/financial/void.rb +28 -0
- data/lib/genesis_ruby/api/requests/non_financial/reconcile/date_range.rb +95 -0
- data/lib/genesis_ruby/api/requests/non_financial/reconcile/transaction.rb +37 -0
- data/lib/genesis_ruby/api/requests/wpf/reconcile.rb +33 -0
- data/lib/genesis_ruby/api/response.rb +4 -5
- data/lib/genesis_ruby/dependencies.rb +7 -0
- data/lib/genesis_ruby/utils/common.rb +8 -1
- data/lib/genesis_ruby/utils/options/api_config.rb +15 -12
- data/lib/genesis_ruby/version.rb +1 -1
- data/lib/genesis_ruby.rb +5 -2
- metadata +17 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7220a925cd5f4162c331e8f76df937b25d94c61ba2b00ffa2c0e658a9555a23
|
4
|
+
data.tar.gz: b24aece0771f858eeed93a62ebb8a6ad2b1751d85f30b72c98ed647ae3b17f9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d061c605183153c41dbde88215322a084b06f3ac293509c54ba7109e2e4342437a813f340ad11fa26a3a8352c7201a05ca667d5b0092a3ef22125128501a1b3e
|
7
|
+
data.tar.gz: 108c00082a58b5addceb9f20f0d13eee410e86f4cfc38e2ad6ff47d2900f05876dc62cff5d498e56b1a10e575cb8446cce211a42d5b87e26b1be53d4578efcab
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
0.1.1
|
2
|
+
-----
|
3
|
+
**Features**:
|
4
|
+
|
5
|
+
* Added request support for the following transaction reference actions:
|
6
|
+
* Capture
|
7
|
+
* Void
|
8
|
+
* Refund
|
9
|
+
* Added support for the following Reconcile API requests:
|
10
|
+
* Transaction
|
11
|
+
* By Date Range
|
12
|
+
* Web Payment Form Reconcile
|
13
|
+
* Added Documentation URI to the project metadata description
|
14
|
+
|
15
|
+
**Fixes**:
|
16
|
+
|
17
|
+
* Fixed response parser handling with attributes inside the root element
|
18
|
+
* Fixed Changelog URI in the project metadata description
|
19
|
+
|
1
20
|
0.1.0
|
2
21
|
-----
|
3
22
|
**Features**:
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
genesis_ruby (0.1.
|
4
|
+
genesis_ruby (0.1.1)
|
5
5
|
net-http (~> 0.3.2)
|
6
6
|
nokogiri (~> 1.14)
|
7
7
|
|
@@ -140,7 +140,7 @@ PLATFORMS
|
|
140
140
|
x86_64-linux
|
141
141
|
|
142
142
|
DEPENDENCIES
|
143
|
-
bundler
|
143
|
+
bundler (~> 2.1)
|
144
144
|
faker (~> 2.22)
|
145
145
|
faraday-retry (~> 2.0)
|
146
146
|
genesis_ruby!
|
data/README.md
CHANGED
@@ -12,6 +12,8 @@ Client Library for processing payments through Genesis Payment Processing Gatewa
|
|
12
12
|
## Requirements
|
13
13
|
|
14
14
|
* Ruby version 2.7 or newer
|
15
|
+
* [net-http](https://rubygems.org/gems/net-http) 0.3.2 or newer
|
16
|
+
* [nokogiri](https://rubygems.org/gems/nokogiri) 1.14 or newer
|
15
17
|
|
16
18
|
## Installation
|
17
19
|
|
@@ -246,6 +248,35 @@ If an error occurs during the Transaction Execution the status is one of the fol
|
|
246
248
|
```
|
247
249
|
</details>
|
248
250
|
|
251
|
+
### Reference actions
|
252
|
+
The Reference transaction requests allow actions over an existing payment. The payment can be modified with:
|
253
|
+
* Capture - settles a transaction that has been authorized before
|
254
|
+
* Void - undo other transactions
|
255
|
+
* Refund - allow to return already billed amounts to customers
|
256
|
+
|
257
|
+
<kbd>!</kbd> Void transaction request doesn't require amount and currency parameters
|
258
|
+
|
259
|
+
After a successful response of a payment, reference actions can be executed by using the `unique_id`.
|
260
|
+
|
261
|
+
```ruby
|
262
|
+
require 'genesis_ruby'
|
263
|
+
|
264
|
+
begin
|
265
|
+
genesis = GenesisRuby::Genesis.for(config: configuration, request: GenesisRuby::Api::Requests::Financial::Refund) do |request|
|
266
|
+
request.transaction_id = '12345-67890'
|
267
|
+
request.amount = '0.99' # not available for GenesisRuby::Api::Requests::Financial::Void
|
268
|
+
request.currency = 'EUR' # not available for GenesisRuby::Api::Requests::Financial::Void
|
269
|
+
request.usage = 'Example usage'
|
270
|
+
request.reference_id = 'unique_id received upon successful payment transaction'
|
271
|
+
end.execute
|
272
|
+
|
273
|
+
puts genesis.response.response_object
|
274
|
+
|
275
|
+
rescue GenesisRuby::Error => error
|
276
|
+
puts error.message
|
277
|
+
end
|
278
|
+
```
|
279
|
+
|
249
280
|
### Response Helpers
|
250
281
|
|
251
282
|
#### Sates
|
@@ -284,7 +315,7 @@ configuration.sanitize_response = false
|
|
284
315
|
You can use the following request classes to initialize the Genesis client:
|
285
316
|
|
286
317
|
```ruby
|
287
|
-
#
|
318
|
+
# Financial
|
288
319
|
## Cards
|
289
320
|
GenesisRuby::Api::Requests::Financial::Cards::Authorize
|
290
321
|
GenesisRuby::Api::Requests::Financial::Cards::Authorize3d
|
@@ -294,6 +325,17 @@ GenesisRuby::Api::Requests::Financial::Cards::Sale3d
|
|
294
325
|
# Web Payment Form
|
295
326
|
## Create
|
296
327
|
GenesisRuby::Api::Requests::Wpf::Create
|
328
|
+
GenesisRuby::Api::Requests::Wpf::Reconcile
|
329
|
+
|
330
|
+
# References
|
331
|
+
GenesisRuby::Api::Requests::Financial::Capture
|
332
|
+
GenesisRuby::Api::Requests::Financial::Void
|
333
|
+
GenesisRuby::Api::Requests::Financial::Refund
|
334
|
+
|
335
|
+
# Non Financial
|
336
|
+
## Reconcile
|
337
|
+
GenesisRuby::Api::Requests::NonFinancial::Reconcile::Transaction
|
338
|
+
GenesisRuby::Api::Requests::NonFinancial::Reconcile::DateRange
|
297
339
|
```
|
298
340
|
|
299
341
|
### Manual initialization
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/genesis_ruby.gemspec
CHANGED
@@ -13,10 +13,13 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.license = 'MIT'
|
14
14
|
spec.required_ruby_version = '>= 2.7.0'
|
15
15
|
|
16
|
-
spec.metadata['homepage_uri']
|
17
|
-
spec.metadata['source_code_uri']
|
18
|
-
spec.metadata['changelog_uri']
|
16
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
17
|
+
spec.metadata['source_code_uri'] = 'https://github.com/GenesisGateway/genesis_ruby'
|
18
|
+
spec.metadata['changelog_uri'] = 'https://github.com/GenesisGateway/genesis_ruby/blob/main/CHANGELOG.md'
|
19
|
+
spec.metadata['documentation_uri'] = 'https://github.com/GenesisGateway/genesis_ruby/blob/main/README.md'
|
19
20
|
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
23
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
21
24
|
f.match(%r{^(bin|test|spec|features|sig)/|\.(?:git|pronto|rspec|rubocop)})
|
22
25
|
end
|
@@ -28,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
28
31
|
spec.add_runtime_dependency 'net-http', '~> 0.3.2'
|
29
32
|
spec.add_runtime_dependency 'nokogiri', '~> 1.14'
|
30
33
|
|
31
|
-
spec.add_development_dependency 'bundler'
|
34
|
+
spec.add_development_dependency 'bundler', '~> 2.1'
|
32
35
|
spec.add_development_dependency 'faker', '~> 2.22'
|
33
36
|
spec.add_development_dependency 'faraday-retry', '~> 2.0'
|
34
37
|
spec.add_development_dependency 'pronto', '~> 0.11'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Constants
|
4
|
+
module Transactions
|
5
|
+
module Parameters
|
6
|
+
module Refund
|
7
|
+
# Available Bank Account Types used in the Refund transaction request
|
8
|
+
class BankAccountTypes
|
9
|
+
|
10
|
+
extend Mixins::Constants::Common
|
11
|
+
|
12
|
+
# C: for Checking accounts
|
13
|
+
CHECKING = 'C'.freeze
|
14
|
+
|
15
|
+
# S: for Savings accounts
|
16
|
+
SAVINGS = 'S'.freeze
|
17
|
+
|
18
|
+
# I: for International accounts
|
19
|
+
INTERNATIONAL = 'I'.freeze
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Base
|
5
|
+
# Base class used in the Reference transaction requests
|
6
|
+
class Reference < Financial
|
7
|
+
|
8
|
+
include Mixins::Requests::Financial::PaymentAttributes
|
9
|
+
include Mixins::Requests::Financial::ReferenceAttributes
|
10
|
+
|
11
|
+
protected
|
12
|
+
|
13
|
+
# Reference transaction request structure
|
14
|
+
def reference_transaction_structure
|
15
|
+
raise NotImplementedError, 'Reference transaction structure must be implemented.'
|
16
|
+
end
|
17
|
+
|
18
|
+
# Payment transaction structure sent to the Gateway
|
19
|
+
def payment_transaction_structure
|
20
|
+
{
|
21
|
+
reference_id: reference_id
|
22
|
+
}.merge payment_attributes_structure, reference_transaction_structure
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
# Capture settles a transaction which has been authorized before
|
6
|
+
class Capture < Requests::Base::Reference
|
7
|
+
|
8
|
+
include Mixins::Requests::Financial::Business::BusinessAttributes
|
9
|
+
include Mixins::Requests::RestrictedSetter
|
10
|
+
|
11
|
+
protected
|
12
|
+
|
13
|
+
# Capture Transaction Request type
|
14
|
+
def transaction_type
|
15
|
+
Api::Constants::Transactions::CAPTURE
|
16
|
+
end
|
17
|
+
|
18
|
+
# Capture Transaction Request Structure
|
19
|
+
def reference_transaction_structure
|
20
|
+
{
|
21
|
+
reference_id: reference_id,
|
22
|
+
business_attributes: business_attributes_structure
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'genesis_ruby/api/constants/transactions/parameters/refund/bank_account_types'
|
2
|
+
|
3
|
+
module GenesisRuby
|
4
|
+
module Api
|
5
|
+
module Requests
|
6
|
+
module Financial
|
7
|
+
# Refund reference transaction request
|
8
|
+
class Refund < Requests::Base::Reference
|
9
|
+
|
10
|
+
include Mixins::Requests::RestrictedSetter
|
11
|
+
|
12
|
+
attr_accessor :beneficiary_bank_code, :beneficiary_name, :beneficiary_account_number, :bank, :bank_branch,
|
13
|
+
:bank_account
|
14
|
+
attr_reader :bank_account_type
|
15
|
+
|
16
|
+
# The type of account
|
17
|
+
def bank_account_type=(value)
|
18
|
+
allowed_options attribute: __method__,
|
19
|
+
allowed: Api::Constants::Transactions::Parameters::Refund::BankAccountTypes.all,
|
20
|
+
value: value,
|
21
|
+
allow_empty: true
|
22
|
+
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
|
26
|
+
# Refund Transaction Request type
|
27
|
+
def transaction_type
|
28
|
+
Api::Constants::Transactions::REFUND
|
29
|
+
end
|
30
|
+
|
31
|
+
# Refund Transaction Request Structure
|
32
|
+
def reference_transaction_structure
|
33
|
+
{
|
34
|
+
beneficiary_bank_code: beneficiary_bank_code,
|
35
|
+
beneficiary_name: beneficiary_name,
|
36
|
+
beneficiary_account_number: beneficiary_account_number,
|
37
|
+
bank: bank,
|
38
|
+
bank_branch: bank_branch,
|
39
|
+
bank_account: bank_account,
|
40
|
+
bank_account_type: bank_account_type
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
# Void or undo payment transaction request
|
6
|
+
class Void < Base::Financial
|
7
|
+
|
8
|
+
include Mixins::Requests::Financial::ReferenceAttributes
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
# Void transaction type
|
13
|
+
def transaction_type
|
14
|
+
Api::Constants::Transactions::VOID
|
15
|
+
end
|
16
|
+
|
17
|
+
# Void transaction request structure
|
18
|
+
def payment_transaction_structure
|
19
|
+
{
|
20
|
+
reference_id: reference_id
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module NonFinancial
|
5
|
+
module Reconcile
|
6
|
+
# Date range based reconciliation allows you to fetch information for all payment transactions from
|
7
|
+
# a terminal within a given date range.
|
8
|
+
# The response is paginated, each request will return 100 entries max.
|
9
|
+
class DateRange < Api::Request
|
10
|
+
|
11
|
+
include Mixins::Requests::RestrictedSetter
|
12
|
+
|
13
|
+
attr_reader :page
|
14
|
+
|
15
|
+
# Start of the requested date range (time is optional)
|
16
|
+
def start_date
|
17
|
+
format = if start_date_time?
|
18
|
+
Constants::DateTimeFormats::YYYY_MM_DD_H_I_S
|
19
|
+
else
|
20
|
+
Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
|
21
|
+
end
|
22
|
+
|
23
|
+
@start_date&.strftime format
|
24
|
+
end
|
25
|
+
|
26
|
+
# Start of the requested date range (time is optional)
|
27
|
+
def start_date=(value)
|
28
|
+
self.start_date_time = Utils::Common.date_has_time? value
|
29
|
+
|
30
|
+
parse_date attribute: __method__, value: value, allow_empty: false
|
31
|
+
end
|
32
|
+
|
33
|
+
# Start of the requested date range (time is optional)
|
34
|
+
def end_date
|
35
|
+
format = if end_date_time?
|
36
|
+
Constants::DateTimeFormats::YYYY_MM_DD_H_I_S
|
37
|
+
else
|
38
|
+
Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
|
39
|
+
end
|
40
|
+
|
41
|
+
@end_date&.strftime format
|
42
|
+
end
|
43
|
+
|
44
|
+
# End of the requested date range (time is optional)
|
45
|
+
def end_date=(value)
|
46
|
+
self.end_date_time = Utils::Common.date_has_time? value
|
47
|
+
|
48
|
+
parse_date attribute: __method__, value: value, allow_empty: true
|
49
|
+
end
|
50
|
+
|
51
|
+
# The page within the paginated result, defaults to 1
|
52
|
+
def page=(value)
|
53
|
+
@page = value&.to_i
|
54
|
+
end
|
55
|
+
|
56
|
+
protected
|
57
|
+
|
58
|
+
# Set Gateway API configuration
|
59
|
+
def init_configuration
|
60
|
+
init_xml_configuration
|
61
|
+
init_api_gateway_configuration request_path: 'reconcile/by_date'
|
62
|
+
@api_config.parser_skip_root_node = false
|
63
|
+
end
|
64
|
+
|
65
|
+
# API Request structure
|
66
|
+
def populate_structure
|
67
|
+
@tree_structure = {
|
68
|
+
reconcile: {
|
69
|
+
start_date: start_date,
|
70
|
+
end_date: end_date,
|
71
|
+
page: page
|
72
|
+
}
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
attr_accessor :start_date_time, :end_date_time
|
79
|
+
|
80
|
+
# Start Date has time within the given string
|
81
|
+
def start_date_time?
|
82
|
+
self.start_date_time ||= false
|
83
|
+
end
|
84
|
+
|
85
|
+
# End Date has time within the given string
|
86
|
+
def end_date_time?
|
87
|
+
self.end_date_time ||= false
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module NonFinancial
|
5
|
+
module Reconcile
|
6
|
+
# Reconcile can be used to retrieve data about a transaction.
|
7
|
+
# This can be useful if you want to retrieve information about a transaction whose status is timeout,
|
8
|
+
# which returned an error or has changed eg. has beed chargebacked.
|
9
|
+
class Transaction < Api::Request
|
10
|
+
|
11
|
+
attr_accessor :arn, :transaction_id, :unique_id
|
12
|
+
|
13
|
+
protected
|
14
|
+
|
15
|
+
# Set Gateway API configuration
|
16
|
+
def init_configuration
|
17
|
+
init_xml_configuration
|
18
|
+
init_api_gateway_configuration request_path: 'reconcile'
|
19
|
+
end
|
20
|
+
|
21
|
+
# API Request structure
|
22
|
+
def populate_structure
|
23
|
+
@tree_structure = {
|
24
|
+
reconcile: {
|
25
|
+
arn: arn,
|
26
|
+
transaction_id: transaction_id,
|
27
|
+
unique_id: unique_id
|
28
|
+
}
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Wpf
|
5
|
+
# Reconcile can be used to retrieve data about a payment.
|
6
|
+
# This can be useful if you want to retrieve information about a payment whose status is timeout,
|
7
|
+
# which returned an error or has changed eg. has beed chargebacked.
|
8
|
+
class Reconcile < Request
|
9
|
+
|
10
|
+
attr_accessor :unique_id
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
# Define WPF Reconcile request configuration
|
15
|
+
def init_configuration
|
16
|
+
init_xml_configuration
|
17
|
+
@api_config.url = build_request_url subdomain: 'wpf', path: 'wpf/reconcile'
|
18
|
+
end
|
19
|
+
|
20
|
+
# WPF Reconcile request structure
|
21
|
+
def populate_structure
|
22
|
+
@tree_structure = {
|
23
|
+
wpf_reconcile: {
|
24
|
+
unique_id: unique_id
|
25
|
+
}
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -10,10 +10,11 @@ module GenesisRuby
|
|
10
10
|
# Response - process/format an incoming Genesis response
|
11
11
|
class Response
|
12
12
|
|
13
|
-
def initialize(configuration)
|
13
|
+
def initialize(configuration, request_api_config = {})
|
14
14
|
@configuration = configuration
|
15
15
|
@object_formatter = GenesisRuby::Utils::ObjectFormatter.new
|
16
16
|
@response_formatter = GenesisRuby::Utils::Formatters::Response::Loader.new
|
17
|
+
@request_api_config = request_api_config
|
17
18
|
end
|
18
19
|
|
19
20
|
# Default Response Object initialization
|
@@ -54,11 +55,9 @@ module GenesisRuby
|
|
54
55
|
# Load the corresponding parser based on the Network header
|
55
56
|
def load_parser(network)
|
56
57
|
@parser = GenesisRuby::Parsers.new(GenesisRuby::Parser::JSON) if network.json?
|
58
|
+
@parser = GenesisRuby::Parser.new(GenesisRuby::Parser::XML) if network.xml?
|
57
59
|
|
58
|
-
if
|
59
|
-
@parser = GenesisRuby::Parser.new(GenesisRuby::Parser::XML)
|
60
|
-
@parser.skip_root_node
|
61
|
-
end
|
60
|
+
@parser.skip_root_node if @request_api_config[:parser_skip_root_node]
|
62
61
|
|
63
62
|
@parser
|
64
63
|
end
|
@@ -12,6 +12,13 @@ require 'genesis_ruby/api/mixins/requests/restricted_setter'
|
|
12
12
|
# Load API Attributes
|
13
13
|
Dir["#{File.dirname(__FILE__)}/api/mixins/**/*_attributes.rb"].sort.each { |file| require file }
|
14
14
|
|
15
|
+
# =================================
|
16
|
+
# Transaction Requests Bases
|
17
|
+
# =================================
|
18
|
+
require 'genesis_ruby/api/requests/base/financial'
|
19
|
+
require 'genesis_ruby/api/requests/base/financials/credit_card'
|
20
|
+
require 'genesis_ruby/api/requests/base/reference'
|
21
|
+
|
15
22
|
# Load Financial and Non Financial API Requests
|
16
23
|
Dir["#{File.dirname(__FILE__)}/api/requests/*financial/**/*.rb"].sort.each { |file| require file }
|
17
24
|
|
@@ -93,7 +93,7 @@ module GenesisRuby
|
|
93
93
|
parsed_date = nil
|
94
94
|
|
95
95
|
formats.each do |format|
|
96
|
-
return
|
96
|
+
return DateTime.strptime(date, format)
|
97
97
|
rescue StandardError
|
98
98
|
parsed_date = nil
|
99
99
|
end
|
@@ -101,6 +101,13 @@ module GenesisRuby
|
|
101
101
|
parsed_date
|
102
102
|
end
|
103
103
|
|
104
|
+
# Check if the given string contain time
|
105
|
+
def date_has_time?(value)
|
106
|
+
return true if value =~ /(?:\d|[01]\d|2[0-3]):[0-5]\d:[0-5]\d/
|
107
|
+
|
108
|
+
false
|
109
|
+
end
|
110
|
+
|
104
111
|
end
|
105
112
|
|
106
113
|
end
|
@@ -8,26 +8,29 @@ module GenesisRuby
|
|
8
8
|
|
9
9
|
# Load pre-defined XML configuration
|
10
10
|
def load_xml_config
|
11
|
-
self.protocol
|
12
|
-
self.port
|
13
|
-
self.type
|
14
|
-
self.format
|
11
|
+
self.protocol = GenesisRuby::Api::Request::PROTOCOL_HTTPS
|
12
|
+
self.port = GenesisRuby::Api::Request::PORT_HTTPS
|
13
|
+
self.type = GenesisRuby::Api::Request::METHOD_POST
|
14
|
+
self.format = Builder::XML
|
15
|
+
self.parser_skip_root_node = true
|
15
16
|
end
|
16
17
|
|
17
18
|
# Load pre-defined JSON configuration
|
18
19
|
def load_json_config
|
19
|
-
self.protocol
|
20
|
-
self.port
|
21
|
-
self.type
|
22
|
-
self.format
|
20
|
+
self.protocol = GenesisRuby::Api::Request::PROTOCOL_HTTPS
|
21
|
+
self.port = GenesisRuby::Api::Request::PORT_HTTPS
|
22
|
+
self.type = GenesisRuby::Api::Request::METHOD_POST
|
23
|
+
self.format = Builder::JSON
|
24
|
+
self.parser_skip_root_node = false
|
23
25
|
end
|
24
26
|
|
25
27
|
# Load pre-defined FORM configuration
|
26
28
|
def load_form_config
|
27
|
-
self.protocol
|
28
|
-
self.port
|
29
|
-
self.type
|
30
|
-
self.format
|
29
|
+
self.protocol = GenesisRuby::Api::Request::PROTOCOL_HTTPS
|
30
|
+
self.port = GenesisRuby::Api::Request::PORT_HTTPS
|
31
|
+
self.type = GenesisRuby::Api::Request::METHOD_POST
|
32
|
+
self.format = Builder::FORM
|
33
|
+
self.parser_skip_root_node = true
|
31
34
|
end
|
32
35
|
|
33
36
|
end
|
data/lib/genesis_ruby/version.rb
CHANGED
data/lib/genesis_ruby.rb
CHANGED
@@ -12,7 +12,7 @@ module GenesisRuby
|
|
12
12
|
|
13
13
|
# Transaction Request Initializer
|
14
14
|
def self.for(config:, request:)
|
15
|
-
unless request.is_a?(Class)
|
15
|
+
unless request.is_a?(Class) && request < GenesisRuby::Api::Request
|
16
16
|
raise InvalidArgumentError, 'Given Request is invalid'
|
17
17
|
end
|
18
18
|
|
@@ -31,7 +31,10 @@ module GenesisRuby
|
|
31
31
|
def initialize(configuration, request = nil)
|
32
32
|
@configuration = configuration
|
33
33
|
@request = request
|
34
|
-
@response = GenesisRuby::Api::Response.new(
|
34
|
+
@response = GenesisRuby::Api::Response.new(
|
35
|
+
configuration,
|
36
|
+
request&.api_config || GenesisRuby::Utils::Options::ApiConfig.new
|
37
|
+
)
|
35
38
|
@network = GenesisRuby::Connection.for(configuration)
|
36
39
|
end
|
37
40
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: genesis_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- emerchantpay Ltd.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09
|
11
|
+
date: 2023-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-http
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2.1'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '2.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: faker
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -232,6 +232,7 @@ files:
|
|
232
232
|
- lib/genesis_ruby/api/constants/transactions/parameters/business/payment_types.rb
|
233
233
|
- lib/genesis_ruby/api/constants/transactions/parameters/recurring/categories.rb
|
234
234
|
- lib/genesis_ruby/api/constants/transactions/parameters/recurring/types.rb
|
235
|
+
- lib/genesis_ruby/api/constants/transactions/parameters/refund/bank_account_types.rb
|
235
236
|
- lib/genesis_ruby/api/constants/transactions/parameters/sca_exemptions.rb
|
236
237
|
- lib/genesis_ruby/api/constants/transactions/parameters/threeds/version2/browser/color_depths.rb
|
237
238
|
- lib/genesis_ruby/api/constants/transactions/parameters/threeds/version2/card_holder_account/password_change_indicators.rb
|
@@ -294,11 +295,18 @@ files:
|
|
294
295
|
- lib/genesis_ruby/api/request.rb
|
295
296
|
- lib/genesis_ruby/api/requests/base/financial.rb
|
296
297
|
- lib/genesis_ruby/api/requests/base/financials/credit_card.rb
|
298
|
+
- lib/genesis_ruby/api/requests/base/reference.rb
|
299
|
+
- lib/genesis_ruby/api/requests/financial/capture.rb
|
297
300
|
- lib/genesis_ruby/api/requests/financial/cards/authorize.rb
|
298
301
|
- lib/genesis_ruby/api/requests/financial/cards/authorize3d.rb
|
299
302
|
- lib/genesis_ruby/api/requests/financial/cards/sale.rb
|
300
303
|
- lib/genesis_ruby/api/requests/financial/cards/sale3d.rb
|
304
|
+
- lib/genesis_ruby/api/requests/financial/refund.rb
|
305
|
+
- lib/genesis_ruby/api/requests/financial/void.rb
|
306
|
+
- lib/genesis_ruby/api/requests/non_financial/reconcile/date_range.rb
|
307
|
+
- lib/genesis_ruby/api/requests/non_financial/reconcile/transaction.rb
|
301
308
|
- lib/genesis_ruby/api/requests/wpf/create.rb
|
309
|
+
- lib/genesis_ruby/api/requests/wpf/reconcile.rb
|
302
310
|
- lib/genesis_ruby/api/response.rb
|
303
311
|
- lib/genesis_ruby/builder.rb
|
304
312
|
- lib/genesis_ruby/builders/base.rb
|
@@ -349,7 +357,8 @@ licenses:
|
|
349
357
|
metadata:
|
350
358
|
homepage_uri: https://github.com/GenesisGateway/genesis_ruby
|
351
359
|
source_code_uri: https://github.com/GenesisGateway/genesis_ruby
|
352
|
-
changelog_uri: https://github.com/GenesisGateway/genesis_ruby/CHANGELOG.md
|
360
|
+
changelog_uri: https://github.com/GenesisGateway/genesis_ruby/blob/main/CHANGELOG.md
|
361
|
+
documentation_uri: https://github.com/GenesisGateway/genesis_ruby/blob/main/README.md
|
353
362
|
post_install_message:
|
354
363
|
rdoc_options: []
|
355
364
|
require_paths:
|
@@ -365,7 +374,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
365
374
|
- !ruby/object:Gem::Version
|
366
375
|
version: '0'
|
367
376
|
requirements: []
|
368
|
-
rubygems_version: 3.1
|
377
|
+
rubygems_version: 3.4.1
|
369
378
|
signing_key:
|
370
379
|
specification_version: 4
|
371
380
|
summary: Ruby Client for Genesis Payment Processing Gateway
|