genesis_ruby 0.2.3 → 0.2.4
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 +40 -0
- data/Gemfile.lock +1 -1
- data/README.md +40 -0
- data/VERSION +1 -1
- data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/externally_processed.rb +22 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/processing_type.rb +22 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/sca_exemptions.rb +25 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/online_banking/iframe_targets.rb +26 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/beneficiary_attributes.rb +38 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/customer_account_attributes.rb +21 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/online_banking_payments/payer_attributes.rb +65 -0
- data/lib/genesis_ruby/api/mixins/requests/non_financial/mode_attributes.rb +24 -0
- data/lib/genesis_ruby/api/mixins/requests/non_financial/tokenization/card_data_attributes.rb +62 -0
- data/lib/genesis_ruby/api/mixins/requests/non_financial/tokenization/token_attributes.rb +23 -0
- data/lib/genesis_ruby/api/mixins/requests/non_financial/tokenization/tokenization_attributes.rb +51 -0
- data/lib/genesis_ruby/api/requests/base/consumer.rb +24 -0
- data/lib/genesis_ruby/api/requests/base/financial.rb +10 -1
- data/lib/genesis_ruby/api/requests/base/financials/credit_card.rb +5 -7
- data/lib/genesis_ruby/api/requests/base/financials/south_american_payments.rb +11 -14
- data/lib/genesis_ruby/api/requests/base/reference.rb +2 -1
- data/lib/genesis_ruby/api/requests/financial/cards/bancontact.rb +8 -9
- data/lib/genesis_ruby/api/requests/financial/cash_payments/cash.rb +13 -14
- data/lib/genesis_ruby/api/requests/financial/cash_payments/pix.rb +23 -25
- data/lib/genesis_ruby/api/requests/financial/mobile/apple_pay.rb +18 -20
- data/lib/genesis_ruby/api/requests/financial/mobile/google_pay.rb +20 -24
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/banco_do_brasil.rb +11 -14
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/eps.rb +9 -10
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/idebit/pay_in.rb +11 -18
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/insta_debit/pay_in.rb +61 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/insta_debit/pay_out.rb +24 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/multibanco.rb +48 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/my_bank.rb +47 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/online_banking/pay_in.rb +17 -18
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/online_banking/pay_out.rb +33 -38
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/pay_u.rb +61 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/post_finance.rb +53 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/safety_pay.rb +57 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/sofort.rb +63 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/trustly_sale.rb +75 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/upi.rb +54 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/wechat.rb +11 -14
- data/lib/genesis_ruby/api/requests/financial/sdd/sale.rb +13 -17
- data/lib/genesis_ruby/api/requests/financial/void.rb +12 -5
- data/lib/genesis_ruby/api/requests/financial/wallets/alipay.rb +10 -13
- data/lib/genesis_ruby/api/requests/financial/wallets/pay_pal.rb +18 -20
- data/lib/genesis_ruby/api/requests/non_financial/consumers/create.rb +44 -0
- data/lib/genesis_ruby/api/requests/non_financial/consumers/disable.rb +40 -0
- data/lib/genesis_ruby/api/requests/non_financial/consumers/enable.rb +40 -0
- data/lib/genesis_ruby/api/requests/non_financial/consumers/get_cards.rb +40 -0
- data/lib/genesis_ruby/api/requests/non_financial/consumers/retrieve.rb +40 -0
- data/lib/genesis_ruby/api/requests/non_financial/consumers/update.rb +45 -0
- data/lib/genesis_ruby/api/requests/non_financial/fraud/retrieval/date_range.rb +81 -0
- data/lib/genesis_ruby/api/requests/non_financial/fraud/retrieval/transaction.rb +52 -0
- data/lib/genesis_ruby/api/requests/non_financial/processed_transactions/date_range.rb +68 -0
- data/lib/genesis_ruby/api/requests/non_financial/processed_transactions/post_date_range.rb +72 -0
- data/lib/genesis_ruby/api/requests/non_financial/processed_transactions/transaction.rb +48 -0
- data/lib/genesis_ruby/api/requests/non_financial/sca/checker.rb +77 -0
- data/lib/genesis_ruby/api/requests/non_financial/tokenization/cryptogram.rb +43 -0
- data/lib/genesis_ruby/api/requests/non_financial/tokenization/delete_token.rb +43 -0
- data/lib/genesis_ruby/api/requests/non_financial/tokenization/detokenize.rb +43 -0
- data/lib/genesis_ruby/api/requests/non_financial/tokenization/get_card.rb +43 -0
- data/lib/genesis_ruby/api/requests/non_financial/tokenization/tokenize.rb +45 -0
- data/lib/genesis_ruby/api/requests/non_financial/tokenization/update_token.rb +45 -0
- data/lib/genesis_ruby/api/requests/non_financial/tokenization/validate_token.rb +43 -0
- data/lib/genesis_ruby/dependencies.rb +1 -0
- data/lib/genesis_ruby/utils/formatters/response/formats/timestamp.rb +1 -1
- data/lib/genesis_ruby/version.rb +1 -1
- metadata +43 -2
@@ -14,7 +14,6 @@ module GenesisRuby
|
|
14
14
|
include Api::Mixins::Requests::Financial::Business::BusinessAttributes
|
15
15
|
include Api::Mixins::Requests::DocumentAttributes
|
16
16
|
include Api::Mixins::Requests::Financial::NotificationAttributes
|
17
|
-
include Api::Mixins::Requests::Financial::PaymentAttributes
|
18
17
|
include Api::Mixins::Requests::Financial::NotificationAttributes
|
19
18
|
include Api::Mixins::Requests::Financial::PendingPaymentAttributes
|
20
19
|
|
@@ -24,12 +23,13 @@ module GenesisRuby
|
|
24
23
|
|
25
24
|
# Initialize PayPal request field validations
|
26
25
|
def init_field_validations
|
26
|
+
super
|
27
|
+
|
27
28
|
required_fields
|
28
29
|
.push *%i[transaction_id payment_type amount currency return_success_url return_failure_url]
|
29
30
|
|
30
|
-
field_values.merge!
|
31
|
-
|
32
|
-
PaymentTypes.all
|
31
|
+
field_values.merge! payment_type:
|
32
|
+
Api::Constants::Transactions::Parameters::Wallets::PayPal::PaymentTypes.all
|
33
33
|
end
|
34
34
|
|
35
35
|
# PayPal transaction type
|
@@ -39,22 +39,20 @@ module GenesisRuby
|
|
39
39
|
|
40
40
|
# PayPal request attributes structure
|
41
41
|
def payment_transaction_structure # rubocop:disable Metrics/MethodLength
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
}
|
57
|
-
)
|
42
|
+
{
|
43
|
+
notification_url: notification_url,
|
44
|
+
return_success_url: return_success_url,
|
45
|
+
return_failure_url: return_failure_url,
|
46
|
+
return_pending_url: return_pending_url,
|
47
|
+
customer_email: customer_email,
|
48
|
+
customer_phone: customer_phone,
|
49
|
+
payment_type: payment_type,
|
50
|
+
birth_date: birth_date,
|
51
|
+
document_id: document_id,
|
52
|
+
billing_address: billing_address_parameters_structure,
|
53
|
+
shipping_address: shipping_address_parameters_structure,
|
54
|
+
business_attributes: business_attributes_structure
|
55
|
+
}
|
58
56
|
end
|
59
57
|
|
60
58
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module NonFinancial
|
5
|
+
module Consumers
|
6
|
+
# Creates a consumer based on email address
|
7
|
+
class Create < Base::Consumer
|
8
|
+
|
9
|
+
include Api::Mixins::Requests::CustomerAddress::BillingInfoAttributes
|
10
|
+
include Api::Mixins::Requests::CustomerAddress::ShippingInfoAttributes
|
11
|
+
|
12
|
+
attr_accessor :email
|
13
|
+
|
14
|
+
# Create Consumer constructor
|
15
|
+
def initialize(configuration, _builder_interface = nil)
|
16
|
+
super configuration
|
17
|
+
|
18
|
+
self.request_path = 'create_consumer'
|
19
|
+
end
|
20
|
+
|
21
|
+
protected
|
22
|
+
|
23
|
+
# Create Consumer field validations
|
24
|
+
def init_field_validations
|
25
|
+
super
|
26
|
+
|
27
|
+
required_fields.push *%i[email]
|
28
|
+
end
|
29
|
+
|
30
|
+
# Create Consumer request structure
|
31
|
+
def request_structure
|
32
|
+
{
|
33
|
+
email: email,
|
34
|
+
billing_address: billing_address_parameters_structure,
|
35
|
+
shipping_address: shipping_address_parameters_structure
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module NonFinancial
|
5
|
+
module Consumers
|
6
|
+
# Disable consumer from usage until further action.
|
7
|
+
class Disable < Base::Consumer
|
8
|
+
|
9
|
+
attr_accessor :email, :consumer_id
|
10
|
+
|
11
|
+
# Disable Consumer constructor
|
12
|
+
def initialize(configuration, _builder_interface = nil)
|
13
|
+
super configuration
|
14
|
+
|
15
|
+
self.request_path = 'disable_consumer'
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
# Disable consumer field validations
|
21
|
+
def init_field_validations
|
22
|
+
super
|
23
|
+
|
24
|
+
required_fields.push *%i[email consumer_id]
|
25
|
+
end
|
26
|
+
|
27
|
+
# Disable Consumer request structure
|
28
|
+
def request_structure
|
29
|
+
{
|
30
|
+
email: email,
|
31
|
+
consumer_id: consumer_id
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module NonFinancial
|
5
|
+
module Consumers
|
6
|
+
# Enable consumer that was disabled in the past.
|
7
|
+
class Enable < Base::Consumer
|
8
|
+
|
9
|
+
attr_accessor :email, :consumer_id
|
10
|
+
|
11
|
+
# Enable Consumer constructor
|
12
|
+
def initialize(configuration, _builder_interface = nil)
|
13
|
+
super configuration
|
14
|
+
|
15
|
+
self.request_path = 'enable_consumer'
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
# Enable consumer field validations
|
21
|
+
def init_field_validations
|
22
|
+
super
|
23
|
+
|
24
|
+
required_fields.push *%i[email consumer_id]
|
25
|
+
end
|
26
|
+
|
27
|
+
# Enable Consumer request structure
|
28
|
+
def request_structure
|
29
|
+
{
|
30
|
+
email: email,
|
31
|
+
consumer_id: consumer_id
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module NonFinancial
|
5
|
+
module Consumers
|
6
|
+
# Get previously tokenized card details for a consumer.
|
7
|
+
class GetCards < Base::Consumer
|
8
|
+
|
9
|
+
attr_accessor :email, :consumer_id
|
10
|
+
|
11
|
+
# GetCards Consumer constructor
|
12
|
+
def initialize(configuration, _builder_interface = nil)
|
13
|
+
super configuration
|
14
|
+
|
15
|
+
self.request_path = 'get_consumer_cards'
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
# GetCards consumer field validations
|
21
|
+
def init_field_validations
|
22
|
+
super
|
23
|
+
|
24
|
+
required_fields.push *%i[email consumer_id]
|
25
|
+
end
|
26
|
+
|
27
|
+
# GetCards Consumer request structure
|
28
|
+
def request_structure
|
29
|
+
{
|
30
|
+
email: email,
|
31
|
+
consumer_id: consumer_id
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module NonFinancial
|
5
|
+
module Consumers
|
6
|
+
# Retrieves consumer details based on consumer id or email
|
7
|
+
class Retrieve < Base::Consumer
|
8
|
+
|
9
|
+
attr_accessor :email, :consumer_id
|
10
|
+
|
11
|
+
# Retrieve Consumer constructor
|
12
|
+
def initialize(configuration, _builder_interface = nil)
|
13
|
+
super configuration
|
14
|
+
|
15
|
+
self.request_path = 'retrieve_consumer'
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
# Retrieve Consumer custom field validations
|
21
|
+
def check_requirements
|
22
|
+
raise ParameterError, 'Either email or consumer_id field has to be set.' if email.nil? && consumer_id.nil?
|
23
|
+
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
27
|
+
# Retrieve Consumer request structure
|
28
|
+
def request_structure
|
29
|
+
{
|
30
|
+
email: email,
|
31
|
+
consumer_id: consumer_id
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module NonFinancial
|
5
|
+
module Consumers
|
6
|
+
# Updates consumer email and addresses.
|
7
|
+
class Update < Base::Consumer
|
8
|
+
|
9
|
+
include Api::Mixins::Requests::CustomerAddress::BillingInfoAttributes
|
10
|
+
include Api::Mixins::Requests::CustomerAddress::ShippingInfoAttributes
|
11
|
+
|
12
|
+
attr_accessor :email, :consumer_id
|
13
|
+
|
14
|
+
# Update Consumer constructor
|
15
|
+
def initialize(configuration, _builder_interface = nil)
|
16
|
+
super configuration
|
17
|
+
|
18
|
+
self.request_path = 'update_consumer'
|
19
|
+
end
|
20
|
+
|
21
|
+
protected
|
22
|
+
|
23
|
+
# Update Consumer field validations
|
24
|
+
def init_field_validations
|
25
|
+
super
|
26
|
+
|
27
|
+
required_fields.push *%i[email consumer_id]
|
28
|
+
end
|
29
|
+
|
30
|
+
# Update Consumer request structure
|
31
|
+
def request_structure
|
32
|
+
{
|
33
|
+
email: email,
|
34
|
+
consumer_id: consumer_id,
|
35
|
+
billing_address: billing_address_parameters_structure,
|
36
|
+
shipping_address: shipping_address_parameters_structure
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'genesis_ruby/api/constants/transactions/parameters/non_financial/externally_processed'
|
2
|
+
require 'genesis_ruby/api/constants/transactions/parameters/non_financial/processing_type'
|
3
|
+
|
4
|
+
module GenesisRuby
|
5
|
+
module Api
|
6
|
+
module Requests
|
7
|
+
module NonFinancial
|
8
|
+
module Fraud
|
9
|
+
module Retrieval
|
10
|
+
# Date range based retrieval request retrieval allows you to fetch information
|
11
|
+
# for all retrieval requests for a given merchant within a given date range
|
12
|
+
class DateRange < Api::Request
|
13
|
+
|
14
|
+
include Api::Mixins::Requests::NonFinancial::DateAttributes
|
15
|
+
include Api::Mixins::Requests::NonFinancial::PagingAttributes
|
16
|
+
|
17
|
+
attr_accessor :externally_processed, :processing_type
|
18
|
+
|
19
|
+
# Start of the requested date range
|
20
|
+
def start_date
|
21
|
+
@start_date&.strftime Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
|
22
|
+
end
|
23
|
+
|
24
|
+
# End of the requested date range
|
25
|
+
def end_date
|
26
|
+
@end_date&.strftime Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
|
27
|
+
end
|
28
|
+
|
29
|
+
# Date of import in the system
|
30
|
+
def import_date
|
31
|
+
@import_date&.strftime Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
|
32
|
+
end
|
33
|
+
|
34
|
+
def import_date=(value)
|
35
|
+
parse_date attribute: __method__, value: value, allow_empty: true
|
36
|
+
end
|
37
|
+
|
38
|
+
protected
|
39
|
+
|
40
|
+
# Set Gateway API configuration
|
41
|
+
def init_configuration
|
42
|
+
init_xml_configuration
|
43
|
+
init_api_gateway_configuration request_path: 'retrieval_requests/by_date', include_token: false
|
44
|
+
@api_config.parser_skip_root_node = false
|
45
|
+
end
|
46
|
+
|
47
|
+
# Field Validations
|
48
|
+
def init_field_validations
|
49
|
+
super
|
50
|
+
|
51
|
+
constant_values = {
|
52
|
+
externally_processed: Constants::Transactions::Parameters::NonFinancial::ExternallyProcessed.all,
|
53
|
+
processing_type: Constants::Transactions::Parameters::NonFinancial::ProcessingType.all
|
54
|
+
}
|
55
|
+
|
56
|
+
required_fields.push *%i[start_date]
|
57
|
+
field_values.merge! constant_values
|
58
|
+
end
|
59
|
+
|
60
|
+
# API Request structure
|
61
|
+
def populate_structure # rubocop:disable Metrics/MethodLength
|
62
|
+
@tree_structure = {
|
63
|
+
retrieval_request_request: {
|
64
|
+
start_date: start_date,
|
65
|
+
end_date: end_date,
|
66
|
+
import_date: import_date,
|
67
|
+
page: page,
|
68
|
+
per_page: per_page,
|
69
|
+
externally_processed: externally_processed,
|
70
|
+
processing_type: processing_type
|
71
|
+
}
|
72
|
+
}
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module NonFinancial
|
5
|
+
module Fraud
|
6
|
+
module Retrieval
|
7
|
+
# Retrieve a single retrieval request or a list of requests by ARN or by passing the unique ID
|
8
|
+
# of the original transaction.
|
9
|
+
class Transaction < Api::Request
|
10
|
+
|
11
|
+
include Api::Mixins::Requests::NonFinancial::ModeAttributes
|
12
|
+
|
13
|
+
attr_accessor :arn, :original_transaction_unique_id
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
# Set Gateway API configuration
|
18
|
+
def init_configuration
|
19
|
+
init_xml_configuration
|
20
|
+
init_api_gateway_configuration request_path: 'retrieval_requests', include_token: false
|
21
|
+
end
|
22
|
+
|
23
|
+
# Retrieval custom field validations
|
24
|
+
def check_requirements
|
25
|
+
unless arn.nil? ^ original_transaction_unique_id.nil?
|
26
|
+
raise(
|
27
|
+
ParameterError,
|
28
|
+
'Either arn or original_transaction_unique_id field has to be set, not both.'
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
super
|
33
|
+
end
|
34
|
+
|
35
|
+
# API Request structure
|
36
|
+
def populate_structure
|
37
|
+
@tree_structure = {
|
38
|
+
retrieval_request_request: {
|
39
|
+
arn: arn,
|
40
|
+
original_transaction_unique_id: original_transaction_unique_id,
|
41
|
+
mode: mode
|
42
|
+
}
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'genesis_ruby/api/constants/transactions/parameters/non_financial/externally_processed'
|
2
|
+
require 'genesis_ruby/api/constants/transactions/parameters/non_financial/processing_type'
|
3
|
+
|
4
|
+
module GenesisRuby
|
5
|
+
module Api
|
6
|
+
module Requests
|
7
|
+
module NonFinancial
|
8
|
+
module ProcessedTransactions
|
9
|
+
# Date range based processed transaction retrieval allows you to fetch information for
|
10
|
+
# all processed transactions for a given merchant within a given date range.
|
11
|
+
class DateRange < Request
|
12
|
+
|
13
|
+
include Api::Mixins::Requests::NonFinancial::DateAttributes
|
14
|
+
include Api::Mixins::Requests::NonFinancial::PagingAttributes
|
15
|
+
|
16
|
+
attr_accessor :externally_processed, :processing_type
|
17
|
+
|
18
|
+
# Start of the requested date range
|
19
|
+
def start_date
|
20
|
+
@start_date&.strftime GenesisRuby::Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
|
21
|
+
end
|
22
|
+
|
23
|
+
# End of the requested date range
|
24
|
+
def end_date
|
25
|
+
@end_date&.strftime GenesisRuby::Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
29
|
+
|
30
|
+
# Processed Transactions API DateRange request configuration
|
31
|
+
def init_configuration
|
32
|
+
init_xml_configuration
|
33
|
+
@api_config.parser_skip_root_node = false
|
34
|
+
|
35
|
+
init_api_gateway_configuration request_path: 'processed_transactions/by_date', include_token: false
|
36
|
+
end
|
37
|
+
|
38
|
+
# Processed Transactions API DateRange field validations
|
39
|
+
def init_field_validations
|
40
|
+
super
|
41
|
+
|
42
|
+
required_fields.push *%i[start_date]
|
43
|
+
field_values.merge! externally_processed: Constants::Transactions::Parameters::NonFinancial::
|
44
|
+
ExternallyProcessed.all,
|
45
|
+
processing_type: Constants::Transactions::Parameters::NonFinancial::
|
46
|
+
ProcessingType.all
|
47
|
+
end
|
48
|
+
|
49
|
+
# Processed Transactions API DateRange request structure
|
50
|
+
def populate_structure
|
51
|
+
@tree_structure = {
|
52
|
+
processed_transaction_request: {
|
53
|
+
start_date: start_date,
|
54
|
+
end_date: end_date,
|
55
|
+
externally_processed: externally_processed,
|
56
|
+
processing_type: processing_type,
|
57
|
+
page: page,
|
58
|
+
per_page: per_page
|
59
|
+
}
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'genesis_ruby/api/constants/transactions/parameters/non_financial/externally_processed'
|
2
|
+
require 'genesis_ruby/api/constants/transactions/parameters/non_financial/processing_type'
|
3
|
+
|
4
|
+
module GenesisRuby
|
5
|
+
module Api
|
6
|
+
module Requests
|
7
|
+
module NonFinancial
|
8
|
+
module ProcessedTransactions
|
9
|
+
# Post Date range based processed transaction retrieval allows you to fetch information for
|
10
|
+
# all processed transactions for a given merchant within a given post date range.
|
11
|
+
class PostDateRange < Request
|
12
|
+
|
13
|
+
include Api::Mixins::Requests::NonFinancial::DateAttributes
|
14
|
+
include Api::Mixins::Requests::NonFinancial::PagingAttributes
|
15
|
+
|
16
|
+
attr_accessor :batch_number, :batch_slip_number, :deposit_slip_number, :externally_processed,
|
17
|
+
:processing_type
|
18
|
+
|
19
|
+
# Start of the requested date range
|
20
|
+
def start_date
|
21
|
+
@start_date&.strftime GenesisRuby::Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
|
22
|
+
end
|
23
|
+
|
24
|
+
# End of the requested date range
|
25
|
+
def end_date
|
26
|
+
@end_date&.strftime GenesisRuby::Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
|
27
|
+
end
|
28
|
+
|
29
|
+
protected
|
30
|
+
|
31
|
+
# Processed Transactions API DateRange request configuration
|
32
|
+
def init_configuration
|
33
|
+
init_xml_configuration
|
34
|
+
@api_config.parser_skip_root_node = false
|
35
|
+
|
36
|
+
init_api_gateway_configuration request_path: 'processed_transactions/by_post_date', include_token: false
|
37
|
+
end
|
38
|
+
|
39
|
+
# Processed Transactions API DateRange field validations
|
40
|
+
def init_field_validations
|
41
|
+
super
|
42
|
+
|
43
|
+
required_fields.push *%i[start_date]
|
44
|
+
field_values.merge! externally_processed: Constants::Transactions::Parameters::NonFinancial::
|
45
|
+
ExternallyProcessed.all,
|
46
|
+
processing_type: Constants::Transactions::Parameters::NonFinancial::
|
47
|
+
ProcessingType.all
|
48
|
+
end
|
49
|
+
|
50
|
+
# Processed Transactions API DateRange request structure
|
51
|
+
def populate_structure # rubocop:disable Metrics/MethodLength
|
52
|
+
@tree_structure = {
|
53
|
+
processed_transaction_request: {
|
54
|
+
start_date: start_date,
|
55
|
+
end_date: end_date,
|
56
|
+
batch_number: batch_number,
|
57
|
+
batch_slip_number: batch_slip_number,
|
58
|
+
deposit_slip_number: deposit_slip_number,
|
59
|
+
externally_processed: externally_processed,
|
60
|
+
processing_type: processing_type,
|
61
|
+
page: page,
|
62
|
+
per_page: per_page
|
63
|
+
}
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module NonFinancial
|
5
|
+
module ProcessedTransactions
|
6
|
+
# Single processed transaction retrieval allows to get a certain processed transaction by
|
7
|
+
# its ARN or by passing its unique ID.
|
8
|
+
class Transaction < Request
|
9
|
+
|
10
|
+
attr_accessor :arn, :unique_id
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
# Processed Transactions API Transaction request configuration
|
15
|
+
def init_configuration
|
16
|
+
init_xml_configuration
|
17
|
+
|
18
|
+
init_api_gateway_configuration request_path: 'processed_transactions', include_token: false
|
19
|
+
end
|
20
|
+
|
21
|
+
# Processed Transactions API Transaction custom validations
|
22
|
+
def check_requirements
|
23
|
+
unless arn.nil? ^ unique_id.nil?
|
24
|
+
raise(
|
25
|
+
ParameterError,
|
26
|
+
'Either ARN or unique ID field has to be set, not both'
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
# Processed Transactions API Transaction request structure
|
34
|
+
def populate_structure
|
35
|
+
@tree_structure = {
|
36
|
+
processed_transaction_request: {
|
37
|
+
arn: arn,
|
38
|
+
unique_id: unique_id
|
39
|
+
}
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|