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,23 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
module Sdd
|
6
|
+
module Recurring
|
7
|
+
# Sepa Direct Debit initial recurring
|
8
|
+
class InitRecurringSale < Api::Requests::Financial::Sdd::Sale
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
# SDD Sale transaction type
|
13
|
+
def transaction_type
|
14
|
+
Api::Constants::Transactions::SDD_INIT_RECURRING_SALE
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
module Sdd
|
6
|
+
module Recurring
|
7
|
+
# Sepa Direct Debit Payment, popular in Germany.
|
8
|
+
class RecurringSale < Requests::Base::Reference
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
# SDD Recurring Sale transaction type
|
13
|
+
def transaction_type
|
14
|
+
Constants::Transactions::SDD_RECURRING_SALE
|
15
|
+
end
|
16
|
+
|
17
|
+
# Reference transaction request structure
|
18
|
+
def reference_transaction_structure
|
19
|
+
{}
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
module Sdd
|
6
|
+
# Sepa Direct Debit Payment, popular in Germany.
|
7
|
+
class Refund < Requests::Base::Reference
|
8
|
+
|
9
|
+
protected
|
10
|
+
|
11
|
+
# SDD Refund transaction type
|
12
|
+
def transaction_type
|
13
|
+
Api::Constants::Transactions::SDD_REFUND
|
14
|
+
end
|
15
|
+
|
16
|
+
# Reference transaction request structure
|
17
|
+
def reference_transaction_structure
|
18
|
+
{}
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
module Sdd
|
6
|
+
# Sepa Direct Debit Payment, popular in Germany.
|
7
|
+
class Sale < Requests::Base::Financial
|
8
|
+
|
9
|
+
include Api::Mixins::Requests::CustomerAddress::BillingInfoAttributes
|
10
|
+
include Api::Mixins::Requests::CustomerAddress::ShippingInfoAttributes
|
11
|
+
include Api::Mixins::Requests::Financial::AsyncAttributes
|
12
|
+
include Api::Mixins::Requests::Financial::BankAttributes
|
13
|
+
include Api::Mixins::Requests::Financial::PendingPaymentAttributes
|
14
|
+
include Api::Mixins::Requests::Financial::DynamicDescriptorAttributes
|
15
|
+
|
16
|
+
attr_accessor :company_name, :mandate_reference
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
# SDD Sale transaction type
|
21
|
+
def transaction_type
|
22
|
+
Api::Constants::Transactions::SDD_SALE
|
23
|
+
end
|
24
|
+
|
25
|
+
# SDD field validation
|
26
|
+
def init_field_validations
|
27
|
+
super
|
28
|
+
|
29
|
+
required_fields.push *%i[
|
30
|
+
transaction_id usage amount currency iban billing_first_name billing_last_name billing_country
|
31
|
+
]
|
32
|
+
|
33
|
+
field_values.merge! billing_country: %w(AT BE CY EE FI FR DE GR IE IT LV LT LU MT MC NL PT SK SM SI ES)
|
34
|
+
end
|
35
|
+
|
36
|
+
# SDD Sale request structure
|
37
|
+
def payment_transaction_structure # rubocop:disable Metrics/MethodLength
|
38
|
+
{
|
39
|
+
iban: iban,
|
40
|
+
bic: bic,
|
41
|
+
company_name: company_name,
|
42
|
+
mandate_reference: mandate_reference,
|
43
|
+
return_success_url: return_success_url,
|
44
|
+
return_failure_url: return_failure_url,
|
45
|
+
return_pending_url: return_pending_url,
|
46
|
+
billing_address: billing_address_parameters_structure,
|
47
|
+
shipping_address: shipping_address_parameters_structure,
|
48
|
+
dynamic_descriptor_params: dynamic_descriptor_structure
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -3,8 +3,9 @@ module GenesisRuby
|
|
3
3
|
module Requests
|
4
4
|
module Financial
|
5
5
|
# Void or undo payment transaction request
|
6
|
-
class Void <
|
6
|
+
class Void < Request
|
7
7
|
|
8
|
+
include Mixins::Requests::Financial::BaseAttributes
|
8
9
|
include Mixins::Requests::Financial::ReferenceAttributes
|
9
10
|
|
10
11
|
protected
|
@@ -18,10 +19,16 @@ module GenesisRuby
|
|
18
19
|
required_fields.push *%i[transaction_id reference_id]
|
19
20
|
end
|
20
21
|
|
21
|
-
#
|
22
|
-
def
|
23
|
-
{
|
24
|
-
|
22
|
+
# Returns the Request transaction structure
|
23
|
+
def populate_structure
|
24
|
+
@tree_structure = {
|
25
|
+
payment_transaction: {
|
26
|
+
transaction_type: transaction_type,
|
27
|
+
transaction_id: transaction_id,
|
28
|
+
usage: usage,
|
29
|
+
reference_id: reference_id,
|
30
|
+
remote_ip: remote_ip
|
31
|
+
}
|
25
32
|
}
|
26
33
|
end
|
27
34
|
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
module Wallets
|
6
|
+
# Alipay is an oBeP-style alternative payment method that allows you to pay directly with your ebank account.
|
7
|
+
class Alipay < Base::Financial
|
8
|
+
|
9
|
+
include Api::Mixins::Requests::AddressInfoAttributes
|
10
|
+
include Api::Mixins::Requests::BirthDateAttributes
|
11
|
+
include Api::Mixins::Requests::Financial::AsyncAttributes
|
12
|
+
|
13
|
+
protected
|
14
|
+
|
15
|
+
# Alipay transaction type
|
16
|
+
def transaction_type
|
17
|
+
Api::Constants::Transactions::ALIPAY
|
18
|
+
end
|
19
|
+
|
20
|
+
# Alipay Field Validations
|
21
|
+
def init_field_validations
|
22
|
+
super
|
23
|
+
|
24
|
+
required_fields.push *%i[transaction_id amount currency return_success_url return_failure_url]
|
25
|
+
field_values.merge! currency: %w(EUR CNY)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Alipay request structure
|
29
|
+
def payment_transaction_structure
|
30
|
+
{
|
31
|
+
return_success_url: return_success_url,
|
32
|
+
return_failure_url: return_failure_url,
|
33
|
+
customer_email: customer_email,
|
34
|
+
customer_phone: customer_phone,
|
35
|
+
birth_date: birth_date,
|
36
|
+
billing_address: billing_address_parameters_structure,
|
37
|
+
shipping_address: shipping_address_parameters_structure
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -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,203 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/order_by_fields'
|
3
|
+
require 'genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/response_fields'
|
4
|
+
require 'genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/transaction_types'
|
5
|
+
require 'genesis_ruby/api/constants/transactions/parameters/non_financial/sort_directions'
|
6
|
+
|
7
|
+
module GenesisRuby
|
8
|
+
module Api
|
9
|
+
module Requests
|
10
|
+
module NonFinancial
|
11
|
+
module BillingApi
|
12
|
+
# Billing Transactions API allows to programmatically retrieve information about billing transactions
|
13
|
+
# using given filters, pagination, and sort parameters.
|
14
|
+
class Transactions < Base::Graphql # rubocop:disable Metrics/ClassLength
|
15
|
+
|
16
|
+
include Api::Mixins::Requests::NonFinancial::BillingApi::SortAttributes
|
17
|
+
include Api::Mixins::Requests::NonFinancial::DateAttributes
|
18
|
+
include Api::Mixins::Requests::NonFinancial::PagingAttributes
|
19
|
+
|
20
|
+
def initialize(configuration, _builder_interface = nil)
|
21
|
+
super configuration
|
22
|
+
|
23
|
+
self.root_key = 'query'
|
24
|
+
self.request_name = 'billingTransactions'
|
25
|
+
self.request_path = 'billing_transactions'
|
26
|
+
end
|
27
|
+
|
28
|
+
# Response Fields
|
29
|
+
def response_fields
|
30
|
+
@response_fields || []
|
31
|
+
end
|
32
|
+
|
33
|
+
# Response Fields
|
34
|
+
def response_fields=(value)
|
35
|
+
parse_array_of_strings attribute: __method__,
|
36
|
+
value: value,
|
37
|
+
allowed: Api::Constants::Transactions::Parameters::NonFinancial::BillingApi::
|
38
|
+
ResponseFields.all
|
39
|
+
end
|
40
|
+
|
41
|
+
# List of billing transaction unique IDs. Max number of elements is 10000. Primary filter.
|
42
|
+
def unique_id
|
43
|
+
@unique_id || []
|
44
|
+
end
|
45
|
+
|
46
|
+
# List of billing transaction unique IDs. Max number of elements is 10000. Primary filter.
|
47
|
+
def unique_id=(value)
|
48
|
+
parse_array_of_strings attribute: __method__, value: value, allow_empty: true
|
49
|
+
end
|
50
|
+
|
51
|
+
# List of billing statement names. Max number of elements allowed is 10. Primary filter.
|
52
|
+
def billing_statement
|
53
|
+
@billing_statement || []
|
54
|
+
end
|
55
|
+
|
56
|
+
# List of billing statement names. Max number of elements allowed is 10. Primary filter.
|
57
|
+
def billing_statement=(value)
|
58
|
+
parse_array_of_strings attribute: __method__, value: value, allow_empty: true
|
59
|
+
end
|
60
|
+
|
61
|
+
# List of merchant transaction IDs. Max number of elements allowed is 10000. Primary filter.
|
62
|
+
def merchant_transaction_id
|
63
|
+
@merchant_transaction_id || []
|
64
|
+
end
|
65
|
+
|
66
|
+
# List of merchant transaction IDs. Max number of elements allowed is 10000. Primary filter.
|
67
|
+
def merchant_transaction_id=(value)
|
68
|
+
parse_array_of_strings attribute: __method__, value: value, allow_empty: true
|
69
|
+
end
|
70
|
+
|
71
|
+
# List of master account names. Max number of elements allowed is 10. Secondary filter.
|
72
|
+
def master_account_name
|
73
|
+
@master_account_name || []
|
74
|
+
end
|
75
|
+
|
76
|
+
# List of master account names. Max number of elements allowed is 10. Secondary filter.
|
77
|
+
def master_account_name=(value)
|
78
|
+
parse_array_of_strings attribute: __method__, value: value, allow_empty: true
|
79
|
+
end
|
80
|
+
|
81
|
+
# List of billing transaction types. Max number of elements allowed is 10.
|
82
|
+
def transaction_type
|
83
|
+
@transaction_type || []
|
84
|
+
end
|
85
|
+
|
86
|
+
# List of billing transaction types. Max number of elements allowed is 10.
|
87
|
+
def transaction_type=(value)
|
88
|
+
parse_array_of_strings attribute: __method__,
|
89
|
+
value: value,
|
90
|
+
allowed: Api::Constants::Transactions::Parameters::NonFinancial::BillingApi::
|
91
|
+
TransactionTypes.all,
|
92
|
+
allow_empty: true
|
93
|
+
end
|
94
|
+
|
95
|
+
protected
|
96
|
+
|
97
|
+
# Billing API Authorization Token
|
98
|
+
def init_authorization_token
|
99
|
+
api_config.bearer_token = configuration.billing_api_token
|
100
|
+
end
|
101
|
+
|
102
|
+
# Billing API Transactions field validations
|
103
|
+
def init_field_validations
|
104
|
+
super
|
105
|
+
|
106
|
+
required_fields.push *%i[response_fields]
|
107
|
+
field_values.merge! sort_by_direction: Api::Constants::Transactions::Parameters::NonFinancial::
|
108
|
+
SortDirections.all,
|
109
|
+
sort_by_field: Api::Constants::Transactions::Parameters::NonFinancial::BillingApi::
|
110
|
+
OrderByFields.all
|
111
|
+
end
|
112
|
+
|
113
|
+
# Billing API Transactions custom validations
|
114
|
+
def check_requirements
|
115
|
+
super
|
116
|
+
|
117
|
+
validate_filters
|
118
|
+
validate_dates if @start_date || @end_date
|
119
|
+
validate_array_fields_size
|
120
|
+
end
|
121
|
+
|
122
|
+
# Transactions GraphQL query filters
|
123
|
+
def query_filters # rubocop:disable Metrics/MethodLength
|
124
|
+
{
|
125
|
+
filter: {
|
126
|
+
startDate: escape_argument(:start_date),
|
127
|
+
endDate: escape_argument(:end_date),
|
128
|
+
uniqueId: unique_id,
|
129
|
+
billingStatement: billing_statement,
|
130
|
+
merchantTransactionId: merchant_transaction_id,
|
131
|
+
masterAccountName: master_account_name,
|
132
|
+
transactionType: transaction_type
|
133
|
+
},
|
134
|
+
sort: {
|
135
|
+
byDirection: sort_by_direction,
|
136
|
+
byField: sort_by_field
|
137
|
+
},
|
138
|
+
paging: {
|
139
|
+
page: page,
|
140
|
+
perPage: per_page
|
141
|
+
}
|
142
|
+
}
|
143
|
+
end
|
144
|
+
|
145
|
+
# Transactions Response Fields
|
146
|
+
def query_response_fields
|
147
|
+
{
|
148
|
+
items: response_fields,
|
149
|
+
paging: paging_query_fields
|
150
|
+
}
|
151
|
+
end
|
152
|
+
|
153
|
+
# Format given timestamp string to GraphQL suitable argument
|
154
|
+
def escape_argument(attribute)
|
155
|
+
__send__(attribute).to_s.empty? ? nil : "\"#{__send__(attribute)}\""
|
156
|
+
end
|
157
|
+
|
158
|
+
# Validate Billing API Primary filters
|
159
|
+
def validate_filters
|
160
|
+
unless start_date.nil? && end_date.nil? && unique_id.empty? && billing_statement.empty? &&
|
161
|
+
merchant_transaction_id.empty?
|
162
|
+
return
|
163
|
+
end
|
164
|
+
|
165
|
+
raise ParameterError, 'At least one Primary filter is required!'
|
166
|
+
end
|
167
|
+
|
168
|
+
# Validate StartDate and EndDate
|
169
|
+
def validate_dates
|
170
|
+
message = 'If filter startDate is provided, then endDate should also be provided and vice versa.'
|
171
|
+
raise ParameterError, message unless @start_date.is_a?(DateTime) && @end_date.is_a?(DateTime)
|
172
|
+
|
173
|
+
raise ParameterError, 'EndData must be after StartDate!' if @start_date == @end_date
|
174
|
+
|
175
|
+
days_diff = @end_date - @start_date
|
176
|
+
message = 'Maximum difference between StartDate and EndDate is 7 days'
|
177
|
+
raise ParameterError, message unless days_diff >= 0 && days_diff <= 7
|
178
|
+
end
|
179
|
+
|
180
|
+
# Validate Billing API Array field requirements
|
181
|
+
def validate_array_fields_size
|
182
|
+
validate_array_size :unique_id, 10_000
|
183
|
+
validate_array_size :billing_statement, 10
|
184
|
+
validate_array_size :merchant_transaction_id, 10_000
|
185
|
+
validate_array_size :master_account_name, 10
|
186
|
+
validate_array_size :transaction_type, 10
|
187
|
+
end
|
188
|
+
|
189
|
+
# Validate Max size of the given Array attribute
|
190
|
+
def validate_array_size(attribute, size)
|
191
|
+
message = format 'Max array length on %{attribute} exceed allowed size of %{size}',
|
192
|
+
attribute: attribute,
|
193
|
+
size: size
|
194
|
+
|
195
|
+
raise ParameterError, message if __send__(attribute).length > size
|
196
|
+
end
|
197
|
+
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
203
|
+
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
|