genesis_ruby 0.2.2 → 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 +57 -0
- data/Gemfile.lock +50 -41
- data/README.md +56 -0
- data/VERSION +1 -1
- data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/order_by_fields.rb +33 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/response_fields.rb +67 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/transaction_types.rb +48 -0
- 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/non_financial/sort_directions.rb +24 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/online_banking/iframe_targets.rb +26 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/online_banking/payment_types.rb +3 -0
- data/lib/genesis_ruby/api/constants/transactions.rb +5 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/bank_attributes.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/billing_api/sort_attributes.rb +18 -0
- data/lib/genesis_ruby/api/mixins/requests/non_financial/date_attributes.rb +64 -0
- data/lib/genesis_ruby/api/mixins/requests/non_financial/mode_attributes.rb +24 -0
- data/lib/genesis_ruby/api/mixins/requests/non_financial/paging_attributes.rb +33 -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/mixins/requests/restricted_setter.rb +18 -0
- data/lib/genesis_ruby/api/request.rb +15 -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/graphql.rb +60 -0
- 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 +57 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/eps.rb +46 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/idebit/pay_in.rb +48 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/idebit/pay_out.rb +28 -0
- 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 +50 -0
- data/lib/genesis_ruby/api/requests/financial/sdd/recurring/init_recurring_sale.rb +23 -0
- data/lib/genesis_ruby/api/requests/financial/sdd/recurring/recurring_sale.rb +28 -0
- data/lib/genesis_ruby/api/requests/financial/sdd/refund.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/sdd/sale.rb +57 -0
- data/lib/genesis_ruby/api/requests/financial/void.rb +12 -5
- data/lib/genesis_ruby/api/requests/financial/wallets/alipay.rb +46 -0
- data/lib/genesis_ruby/api/requests/financial/wallets/{pay_pay.rb → pay_pal.rb} +18 -20
- data/lib/genesis_ruby/api/requests/non_financial/billing_api/transactions.rb +203 -0
- 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/reconcile/date_range.rb +2 -50
- 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/builder.rb +5 -0
- data/lib/genesis_ruby/builders/graphql.rb +118 -0
- data/lib/genesis_ruby/configuration.rb +11 -2
- data/lib/genesis_ruby/dependencies.rb +3 -0
- data/lib/genesis_ruby/network/adapter/net_http_adapter.rb +20 -9
- data/lib/genesis_ruby/network/base_network.rb +1 -14
- data/lib/genesis_ruby/utils/formatters/response/formats/timestamp.rb +1 -1
- data/lib/genesis_ruby/utils/options/api_config.rb +19 -0
- data/lib/genesis_ruby/utils/options/network_adapter_config.rb +49 -14
- data/lib/genesis_ruby/utils/transactions/financial_types.rb +1 -1
- data/lib/genesis_ruby/utils/transactions/references/refundable_types.rb +1 -1
- data/lib/genesis_ruby/utils/transactions/wpf_types.rb +1 -1
- data/lib/genesis_ruby/version.rb +1 -1
- metadata +66 -4
@@ -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
|
@@ -8,43 +8,9 @@ module GenesisRuby
|
|
8
8
|
# The response is paginated, each request will return 100 entries max.
|
9
9
|
class DateRange < Api::Request
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
# Start of the requested date range (time is optional)
|
14
|
-
def start_date
|
15
|
-
format = if start_date_time?
|
16
|
-
Constants::DateTimeFormats::YYYY_MM_DD_H_I_S
|
17
|
-
else
|
18
|
-
Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
|
19
|
-
end
|
20
|
-
|
21
|
-
@start_date&.strftime format
|
22
|
-
end
|
23
|
-
|
24
|
-
# Start of the requested date range (time is optional)
|
25
|
-
def start_date=(value)
|
26
|
-
self.start_date_time = Utils::Common.date_has_time? value
|
27
|
-
|
28
|
-
parse_date attribute: __method__, value: value, allow_empty: false
|
29
|
-
end
|
30
|
-
|
31
|
-
# Start of the requested date range (time is optional)
|
32
|
-
def end_date
|
33
|
-
format = if end_date_time?
|
34
|
-
Constants::DateTimeFormats::YYYY_MM_DD_H_I_S
|
35
|
-
else
|
36
|
-
Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
|
37
|
-
end
|
38
|
-
|
39
|
-
@end_date&.strftime format
|
40
|
-
end
|
11
|
+
include Api::Mixins::Requests::NonFinancial::DateAttributes
|
41
12
|
|
42
|
-
|
43
|
-
def end_date=(value)
|
44
|
-
self.end_date_time = Utils::Common.date_has_time? value
|
45
|
-
|
46
|
-
parse_date attribute: __method__, value: value, allow_empty: true
|
47
|
-
end
|
13
|
+
attr_reader :page
|
48
14
|
|
49
15
|
# The page within the paginated result, defaults to 1
|
50
16
|
def page=(value)
|
@@ -75,20 +41,6 @@ module GenesisRuby
|
|
75
41
|
}
|
76
42
|
end
|
77
43
|
|
78
|
-
private
|
79
|
-
|
80
|
-
attr_accessor :start_date_time, :end_date_time
|
81
|
-
|
82
|
-
# Start Date has time within the given string
|
83
|
-
def start_date_time?
|
84
|
-
self.start_date_time ||= false
|
85
|
-
end
|
86
|
-
|
87
|
-
# End Date has time within the given string
|
88
|
-
def end_date_time?
|
89
|
-
self.end_date_time ||= false
|
90
|
-
end
|
91
|
-
|
92
44
|
end
|
93
45
|
end
|
94
46
|
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'genesis_ruby/api/constants/transactions/parameters/non_financial/sca_exemptions'
|
2
|
+
|
3
|
+
module GenesisRuby
|
4
|
+
module Api
|
5
|
+
module Requests
|
6
|
+
module NonFinancial
|
7
|
+
module Sca
|
8
|
+
# SCA Checker call is used for the determination whether SCA is required
|
9
|
+
class Checker < Base::Versioned
|
10
|
+
|
11
|
+
include Api::Mixins::Requests::Financial::MotoAttributes
|
12
|
+
|
13
|
+
attr_reader :mit, :card_number
|
14
|
+
attr_accessor :transaction_amount, :transaction_currency, :recurring_type, :transaction_exemption
|
15
|
+
|
16
|
+
# SCA Checker constructor
|
17
|
+
def initialize(configuration, _builder_interface = nil)
|
18
|
+
super configuration
|
19
|
+
|
20
|
+
self.request_path = "sca/checker/#{configuration.token}"
|
21
|
+
end
|
22
|
+
|
23
|
+
# Full card number or first 6 digits
|
24
|
+
def card_number=(value)
|
25
|
+
unless value.nil? || value.to_s =~ /\A\d{6,16}\Z/
|
26
|
+
raise(
|
27
|
+
InvalidArgumentError,
|
28
|
+
'Invalid value for card_number. Allowed only digits with min length 6 and max length 16'
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
@card_number = value.to_s
|
33
|
+
end
|
34
|
+
|
35
|
+
# Signifies whether a MIT (merchant initiated transaction) is performed
|
36
|
+
def mit=(value)
|
37
|
+
allowed_options attribute: __method__,
|
38
|
+
value: value,
|
39
|
+
allowed: [true, false],
|
40
|
+
allow_empty: true,
|
41
|
+
error_message: 'Accepts only boolean values'
|
42
|
+
end
|
43
|
+
|
44
|
+
protected
|
45
|
+
|
46
|
+
# SCA Checker field validations
|
47
|
+
def init_field_validations
|
48
|
+
super
|
49
|
+
|
50
|
+
required_fields.push *%i[card_number transaction_amount transaction_currency]
|
51
|
+
field_values.merge! transaction_currency: Constants::Currencies::Iso4217.all.map(&:upcase),
|
52
|
+
recurring_type: [Constants::Transactions::Parameters::Recurring::Types::
|
53
|
+
INITIAL,
|
54
|
+
Constants::Transactions::Parameters::Recurring::Types::
|
55
|
+
SUBSEQUENT],
|
56
|
+
transaction_exemption: Constants::Transactions::Parameters::ScaExemptions.all
|
57
|
+
end
|
58
|
+
|
59
|
+
# SCA Checker request structure
|
60
|
+
def request_structure
|
61
|
+
{
|
62
|
+
card_number: card_number,
|
63
|
+
transaction_amount: transform_amount(transaction_amount, transaction_currency).to_i,
|
64
|
+
transaction_currency: transaction_currency,
|
65
|
+
moto: moto,
|
66
|
+
mit: mit,
|
67
|
+
recurring_type: recurring_type,
|
68
|
+
transaction_exemption: transaction_exemption
|
69
|
+
}
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module NonFinancial
|
5
|
+
module Tokenization
|
6
|
+
# Get cryptogram on behalf of a token that will be used for the authorization
|
7
|
+
class Cryptogram < Base::Versioned
|
8
|
+
|
9
|
+
include Api::Mixins::Requests::NonFinancial::Tokenization::TokenAttributes
|
10
|
+
include Api::Mixins::Requests::NonFinancial::Tokenization::TokenizationAttributes
|
11
|
+
|
12
|
+
def initialize(configuration, builder_interface = Builder::XML)
|
13
|
+
super configuration, builder_interface
|
14
|
+
|
15
|
+
self.request_path = 'cryptogram'
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
# Cryptogram field validations
|
21
|
+
def init_field_validations
|
22
|
+
super
|
23
|
+
|
24
|
+
required_fields.push *tokenization_required_fields, *%i[token]
|
25
|
+
end
|
26
|
+
|
27
|
+
# API Request structure
|
28
|
+
def request_structure
|
29
|
+
{
|
30
|
+
cryptogram_request: tokenization_attributes_structure.merge(
|
31
|
+
{
|
32
|
+
token: token
|
33
|
+
}
|
34
|
+
)
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module NonFinancial
|
5
|
+
module Tokenization
|
6
|
+
# Deletes a token
|
7
|
+
class DeleteToken < Base::Versioned
|
8
|
+
|
9
|
+
include Api::Mixins::Requests::NonFinancial::Tokenization::TokenAttributes
|
10
|
+
include Api::Mixins::Requests::NonFinancial::Tokenization::TokenizationAttributes
|
11
|
+
|
12
|
+
def initialize(configuration, builder_interface = Builder::XML)
|
13
|
+
super configuration, builder_interface
|
14
|
+
|
15
|
+
self.request_path = 'delete_token'
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
# Delete Token field validations
|
21
|
+
def init_field_validations
|
22
|
+
super
|
23
|
+
|
24
|
+
required_fields.push *tokenization_required_fields, *%i[token]
|
25
|
+
end
|
26
|
+
|
27
|
+
# API Request structure
|
28
|
+
def request_structure
|
29
|
+
{
|
30
|
+
delete_token_request: tokenization_attributes_structure.merge(
|
31
|
+
{
|
32
|
+
token: token
|
33
|
+
}
|
34
|
+
)
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module NonFinancial
|
5
|
+
module Tokenization
|
6
|
+
# Exchanges the token with the tokenized cardholder data
|
7
|
+
class Detokenize < Base::Versioned
|
8
|
+
|
9
|
+
include Api::Mixins::Requests::NonFinancial::Tokenization::TokenAttributes
|
10
|
+
include Api::Mixins::Requests::NonFinancial::Tokenization::TokenizationAttributes
|
11
|
+
|
12
|
+
def initialize(configuration, builder_interface = Builder::XML)
|
13
|
+
super configuration, builder_interface
|
14
|
+
|
15
|
+
self.request_path = 'detokenize'
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
# Detokenize field validations
|
21
|
+
def init_field_validations
|
22
|
+
super
|
23
|
+
|
24
|
+
required_fields.push *tokenization_required_fields, *%i[token]
|
25
|
+
end
|
26
|
+
|
27
|
+
# API Request structure
|
28
|
+
def request_structure
|
29
|
+
{
|
30
|
+
detokenize_request: tokenization_attributes_structure.merge(
|
31
|
+
{
|
32
|
+
token: token
|
33
|
+
}
|
34
|
+
)
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module NonFinancial
|
5
|
+
module Tokenization
|
6
|
+
# Exchanges the token with the tokenized masked cardholder data
|
7
|
+
class GetCard < Base::Versioned
|
8
|
+
|
9
|
+
include Api::Mixins::Requests::NonFinancial::Tokenization::TokenAttributes
|
10
|
+
include Api::Mixins::Requests::NonFinancial::Tokenization::TokenizationAttributes
|
11
|
+
|
12
|
+
def initialize(configuration, builder_interface = Builder::XML)
|
13
|
+
super configuration, builder_interface
|
14
|
+
|
15
|
+
self.request_path = 'get_card'
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
# Get Card field validations
|
21
|
+
def init_field_validations
|
22
|
+
super
|
23
|
+
|
24
|
+
required_fields.push *tokenization_required_fields, *%i[token]
|
25
|
+
end
|
26
|
+
|
27
|
+
# API Request structure
|
28
|
+
def request_structure
|
29
|
+
{
|
30
|
+
get_card_request: tokenization_attributes_structure.merge(
|
31
|
+
{
|
32
|
+
token: token
|
33
|
+
}
|
34
|
+
)
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|