genesis_ruby 0.2.2 → 0.2.3
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 +17 -0
- data/Gemfile.lock +50 -41
- data/README.md +16 -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/sort_directions.rb +24 -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/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/paging_attributes.rb +33 -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/graphql.rb +60 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/banco_do_brasil.rb +60 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/eps.rb +47 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/idebit/pay_in.rb +55 -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/wechat.rb +53 -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 +61 -0
- data/lib/genesis_ruby/api/requests/financial/wallets/alipay.rb +49 -0
- data/lib/genesis_ruby/api/requests/non_financial/billing_api/transactions.rb +203 -0
- data/lib/genesis_ruby/api/requests/non_financial/reconcile/date_range.rb +2 -50
- 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 +2 -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 +25 -4
- /data/lib/genesis_ruby/api/requests/financial/wallets/{pay_pay.rb → pay_pal.rb} +0 -0
@@ -19,6 +19,9 @@ module GenesisRuby
|
|
19
19
|
METHOD_GET = 'GET'.freeze
|
20
20
|
METHOD_PUT = 'PUT'.freeze
|
21
21
|
|
22
|
+
AUTH_TYPE_BASIC = 'basic'.freeze
|
23
|
+
AUTH_TYPE_TOKEN = 'bearer'.freeze
|
24
|
+
|
22
25
|
attr_reader :api_config
|
23
26
|
|
24
27
|
def initialize(configuration, builder_interface = 'xml')
|
@@ -75,6 +78,11 @@ module GenesisRuby
|
|
75
78
|
@api_config.load_get_config
|
76
79
|
end
|
77
80
|
|
81
|
+
# Pre-defined GraphQL Request Configuration
|
82
|
+
def init_graphql_configuration
|
83
|
+
@api_config.load_graphql_config
|
84
|
+
end
|
85
|
+
|
78
86
|
# Initializes Api EndPoint Url with request path & terminal token
|
79
87
|
def init_api_gateway_configuration(options = { request_path: 'process', include_token: true })
|
80
88
|
request_path = options.fetch :request_path, 'process'
|
@@ -101,6 +109,13 @@ module GenesisRuby
|
|
101
109
|
)
|
102
110
|
end
|
103
111
|
|
112
|
+
# Initializes API Service Configuration
|
113
|
+
def init_api_service_configuration(options = { request_path: 'graphql' })
|
114
|
+
request_path = options.fetch :request_path, 'graphql'
|
115
|
+
|
116
|
+
api_config.url = build_request_url({ subdomain: 'api_service', path: request_path })
|
117
|
+
end
|
118
|
+
|
104
119
|
# Process Everything the variables set previously
|
105
120
|
#
|
106
121
|
# Step 1: Execute per-field actions
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Base
|
5
|
+
# Base class for GraphQL API services
|
6
|
+
class Graphql < Versioned
|
7
|
+
|
8
|
+
# GraphQL base class constructor
|
9
|
+
def initialize(configuration, builder_interface = Builder::GRAPHQL)
|
10
|
+
super configuration, builder_interface
|
11
|
+
|
12
|
+
@root_key = 'query'
|
13
|
+
@request_name = ''
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
attr_accessor :request_name, :root_key
|
19
|
+
|
20
|
+
# Init GraphQL configuration
|
21
|
+
def init_configuration
|
22
|
+
init_graphql_configuration
|
23
|
+
|
24
|
+
init_authorization_token
|
25
|
+
|
26
|
+
init_api_service_configuration request_path: "#{request_path}/#{version}/graphql", include_token: false
|
27
|
+
end
|
28
|
+
|
29
|
+
# Every Request must load the proper token in the Request API Config
|
30
|
+
def init_authorization_token
|
31
|
+
raise NoMethodError, "Authorization token isn't defined for #{self.class.name}"
|
32
|
+
end
|
33
|
+
|
34
|
+
# Response Filters
|
35
|
+
def query_filters
|
36
|
+
raise NoMethodError, "Response Filters isn't defined for #{self.class.name}"
|
37
|
+
end
|
38
|
+
|
39
|
+
# Response Fields
|
40
|
+
def query_response_fields
|
41
|
+
raise NoMethodError, "Response Fields isn't defined for #{self.class.name}"
|
42
|
+
end
|
43
|
+
|
44
|
+
# GraphQL request structure
|
45
|
+
def request_structure
|
46
|
+
Hash[
|
47
|
+
root_key,
|
48
|
+
Hash[
|
49
|
+
:action, request_name,
|
50
|
+
:filters, query_filters,
|
51
|
+
:response_fields, query_response_fields
|
52
|
+
]
|
53
|
+
]
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
module OnlineBankingPayments
|
6
|
+
# Banco do Brasil offers online bank transfer payment service
|
7
|
+
class BancoDoBrasil < Base::Financial
|
8
|
+
|
9
|
+
include Api::Mixins::Requests::AddressInfoAttributes
|
10
|
+
include Api::Mixins::Requests::Financial::AsyncAttributes
|
11
|
+
include Api::Mixins::Requests::Financial::PendingPaymentAttributes
|
12
|
+
include Api::Mixins::Requests::BirthDateAttributes
|
13
|
+
include Api::Mixins::Requests::Financial::PaymentAttributes
|
14
|
+
include Api::Mixins::Requests::Financial::ConsumerIdentifierAttributes
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
# Banco do Brasil transaction type
|
19
|
+
def transaction_type
|
20
|
+
Api::Constants::Transactions::BANCO_DO_BRASIL
|
21
|
+
end
|
22
|
+
|
23
|
+
# Allowed billing country for Banco do Brasil transaction request
|
24
|
+
def allowed_billing_countries
|
25
|
+
%w(BR)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Banco Do Brasil field validations
|
29
|
+
def init_field_validations
|
30
|
+
super
|
31
|
+
|
32
|
+
required_fields.push *%i[transaction_id return_success_url return_failure_url
|
33
|
+
amount currency consumer_reference national_id customer_email billing_country]
|
34
|
+
|
35
|
+
field_values.merge! billing_country: allowed_billing_countries
|
36
|
+
end
|
37
|
+
|
38
|
+
# Banco do Brasil request structure
|
39
|
+
def payment_transaction_structure # rubocop:disable Metrics/MethodLength
|
40
|
+
payment_attributes_structure.merge(
|
41
|
+
{
|
42
|
+
return_success_url: return_success_url,
|
43
|
+
return_failure_url: return_failure_url,
|
44
|
+
return_pending_url: return_pending_url,
|
45
|
+
consumer_reference: consumer_reference,
|
46
|
+
national_id: national_id,
|
47
|
+
birth_date: birth_date,
|
48
|
+
customer_email: customer_email,
|
49
|
+
billing_address: billing_address_parameters_structure,
|
50
|
+
shipping_address: shipping_address_parameters_structure
|
51
|
+
}
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
module OnlineBankingPayments
|
6
|
+
# EPS is the main bank transfer payment method in Austria
|
7
|
+
class Eps < Base::Financial
|
8
|
+
|
9
|
+
include Api::Mixins::Requests::AddressInfoAttributes
|
10
|
+
include Api::Mixins::Requests::Financial::AsyncAttributes
|
11
|
+
include Api::Mixins::Requests::Financial::PaymentAttributes
|
12
|
+
include Api::Mixins::Requests::Financial::PendingPaymentAttributes
|
13
|
+
|
14
|
+
protected
|
15
|
+
|
16
|
+
# EPS transaction type
|
17
|
+
def transaction_type
|
18
|
+
Api::Constants::Transactions::EPS
|
19
|
+
end
|
20
|
+
|
21
|
+
# EPS field validations
|
22
|
+
def init_field_validations
|
23
|
+
required_fields.push *%i[transaction_id return_success_url return_failure_url
|
24
|
+
amount currency billing_country]
|
25
|
+
field_values.merge! currency: 'EUR',
|
26
|
+
billing_country: 'AT'
|
27
|
+
end
|
28
|
+
|
29
|
+
# EPS request structure
|
30
|
+
def payment_transaction_structure
|
31
|
+
payment_attributes_structure.merge(
|
32
|
+
{
|
33
|
+
return_success_url: return_success_url,
|
34
|
+
return_failure_url: return_failure_url,
|
35
|
+
return_pending_url: return_pending_url,
|
36
|
+
billing_address: billing_address_parameters_structure,
|
37
|
+
shipping_address: shipping_address_parameters_structure
|
38
|
+
}
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
module OnlineBankingPayments
|
6
|
+
module Idebit
|
7
|
+
# iDebit PayIn transaction class
|
8
|
+
class PayIn < Requests::Base::Financial
|
9
|
+
|
10
|
+
include Api::Mixins::Requests::AddressInfoAttributes
|
11
|
+
include Api::Mixins::Requests::BirthDateAttributes
|
12
|
+
include Api::Mixins::Requests::Financial::PaymentAttributes
|
13
|
+
|
14
|
+
attr_reader :customer_account_id
|
15
|
+
|
16
|
+
# Customer account id parameter validation
|
17
|
+
def customer_account_id=(value)
|
18
|
+
limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 20
|
19
|
+
end
|
20
|
+
|
21
|
+
protected
|
22
|
+
|
23
|
+
# iDebit PayIn transaction type
|
24
|
+
def transaction_type
|
25
|
+
Api::Constants::Transactions::IDEBIT_PAYIN
|
26
|
+
end
|
27
|
+
|
28
|
+
# iDebit PayIn field validations
|
29
|
+
def init_field_validations
|
30
|
+
required_fields.push *%i[transaction_id customer_account_id amount currency billing_country]
|
31
|
+
|
32
|
+
field_values.merge! billing_country: 'CA'
|
33
|
+
end
|
34
|
+
|
35
|
+
# iDebit PayIn parameters structure
|
36
|
+
def payment_transaction_structure
|
37
|
+
payment_attributes_structure.merge(
|
38
|
+
{
|
39
|
+
customer_email: customer_email,
|
40
|
+
customer_phone: customer_phone,
|
41
|
+
customer_account_id: customer_account_id,
|
42
|
+
birth_date: birth_date,
|
43
|
+
billing_address: billing_address_parameters_structure,
|
44
|
+
shipping_address: shipping_address_parameters_structure
|
45
|
+
}
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
module OnlineBankingPayments
|
6
|
+
module Idebit
|
7
|
+
# iDebit PayOut transaction class
|
8
|
+
class PayOut < Requests::Base::Reference
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
# iDebit PayOut transaction type
|
13
|
+
def transaction_type
|
14
|
+
Constants::Transactions::IDEBIT_PAYOUT
|
15
|
+
end
|
16
|
+
|
17
|
+
# iDebit PayOut parameters 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,53 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
module OnlineBankingPayments
|
6
|
+
# WeChat Pay solution offers merchants access to the over 300 million
|
7
|
+
# WeChat users that have linked payment accounts to their WeChat account
|
8
|
+
class Wechat < Base::Financial
|
9
|
+
|
10
|
+
include Api::Mixins::Requests::AddressInfoAttributes
|
11
|
+
include Api::Mixins::Requests::Financial::PaymentAttributes
|
12
|
+
include Api::Mixins::Requests::Financial::AsyncAttributes
|
13
|
+
|
14
|
+
attr_accessor :product_code, :product_num, :product_desc
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
# WeChat transaction type
|
19
|
+
def transaction_type
|
20
|
+
Api::Constants::Transactions::WECHAT
|
21
|
+
end
|
22
|
+
|
23
|
+
# WeChat field validations
|
24
|
+
def init_field_validations
|
25
|
+
super
|
26
|
+
|
27
|
+
required_fields.push *%i[transaction_id usage return_success_url return_failure_url
|
28
|
+
amount currency billing_country]
|
29
|
+
end
|
30
|
+
|
31
|
+
# WeChat transaction request structure
|
32
|
+
def payment_transaction_structure # rubocop:disable Metrics/MethodLength
|
33
|
+
payment_attributes_structure.merge(
|
34
|
+
{
|
35
|
+
return_success_url: return_success_url,
|
36
|
+
return_failure_url: return_failure_url,
|
37
|
+
product_code: product_code,
|
38
|
+
product_num: product_num,
|
39
|
+
product_desc: product_desc,
|
40
|
+
customer_email: customer_email,
|
41
|
+
customer_phone: customer_phone,
|
42
|
+
billing_address: billing_address_parameters_structure,
|
43
|
+
shipping_address: shipping_address_parameters_structure
|
44
|
+
}
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -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,61 @@
|
|
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::PaymentAttributes
|
14
|
+
include Api::Mixins::Requests::Financial::PendingPaymentAttributes
|
15
|
+
include Api::Mixins::Requests::Financial::DynamicDescriptorAttributes
|
16
|
+
|
17
|
+
attr_accessor :company_name, :mandate_reference
|
18
|
+
|
19
|
+
protected
|
20
|
+
|
21
|
+
# SDD Sale transaction type
|
22
|
+
def transaction_type
|
23
|
+
Api::Constants::Transactions::SDD_SALE
|
24
|
+
end
|
25
|
+
|
26
|
+
# SDD field validation
|
27
|
+
def init_field_validations
|
28
|
+
super
|
29
|
+
|
30
|
+
required_fields.push *%i[
|
31
|
+
transaction_id usage amount currency iban billing_first_name billing_last_name billing_country
|
32
|
+
]
|
33
|
+
|
34
|
+
field_values.merge! currency: Api::Constants::Currencies::Iso4217.all.map(&:upcase),
|
35
|
+
billing_country: %w(AT BE CY EE FI FR DE GR IE IT LV LT LU MT MC NL PT SK SM SI ES)
|
36
|
+
end
|
37
|
+
|
38
|
+
# SDD Sale request structure
|
39
|
+
def payment_transaction_structure # rubocop:disable Metrics/MethodLength
|
40
|
+
payment_attributes_structure.merge(
|
41
|
+
{
|
42
|
+
iban: iban,
|
43
|
+
bic: bic,
|
44
|
+
company_name: company_name,
|
45
|
+
mandate_reference: mandate_reference,
|
46
|
+
return_success_url: return_success_url,
|
47
|
+
return_failure_url: return_failure_url,
|
48
|
+
return_pending_url: return_pending_url,
|
49
|
+
billing_address: billing_address_parameters_structure,
|
50
|
+
shipping_address: shipping_address_parameters_structure,
|
51
|
+
dynamic_descriptor_params: dynamic_descriptor_structure
|
52
|
+
}
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,49 @@
|
|
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
|
+
include Api::Mixins::Requests::Financial::PaymentAttributes
|
13
|
+
|
14
|
+
protected
|
15
|
+
|
16
|
+
# Alipay transaction type
|
17
|
+
def transaction_type
|
18
|
+
Api::Constants::Transactions::ALIPAY
|
19
|
+
end
|
20
|
+
|
21
|
+
# Alipay Field Validations
|
22
|
+
def init_field_validations
|
23
|
+
super
|
24
|
+
|
25
|
+
required_fields.push *%i[transaction_id amount currency return_success_url return_failure_url]
|
26
|
+
field_values.merge! currency: %w(EUR CNY)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Alipay request structure
|
30
|
+
def payment_transaction_structure # rubocop:disable Metrics/MethodLength
|
31
|
+
payment_attributes_structure.merge(
|
32
|
+
{
|
33
|
+
return_success_url: return_success_url,
|
34
|
+
return_failure_url: return_failure_url,
|
35
|
+
customer_email: customer_email,
|
36
|
+
customer_phone: customer_phone,
|
37
|
+
birth_date: birth_date,
|
38
|
+
billing_address: billing_address_parameters_structure,
|
39
|
+
shipping_address: shipping_address_parameters_structure
|
40
|
+
}
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|