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.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +57 -0
  3. data/Gemfile.lock +50 -41
  4. data/README.md +56 -0
  5. data/VERSION +1 -1
  6. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/order_by_fields.rb +33 -0
  7. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/response_fields.rb +67 -0
  8. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/transaction_types.rb +48 -0
  9. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/externally_processed.rb +22 -0
  10. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/processing_type.rb +22 -0
  11. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/sca_exemptions.rb +25 -0
  12. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/sort_directions.rb +24 -0
  13. data/lib/genesis_ruby/api/constants/transactions/parameters/online_banking/iframe_targets.rb +26 -0
  14. data/lib/genesis_ruby/api/constants/transactions/parameters/online_banking/payment_types.rb +3 -0
  15. data/lib/genesis_ruby/api/constants/transactions.rb +5 -0
  16. data/lib/genesis_ruby/api/mixins/requests/financial/bank_attributes.rb +26 -0
  17. data/lib/genesis_ruby/api/mixins/requests/financial/beneficiary_attributes.rb +38 -0
  18. data/lib/genesis_ruby/api/mixins/requests/financial/customer_account_attributes.rb +21 -0
  19. data/lib/genesis_ruby/api/mixins/requests/financial/online_banking_payments/payer_attributes.rb +65 -0
  20. data/lib/genesis_ruby/api/mixins/requests/non_financial/billing_api/sort_attributes.rb +18 -0
  21. data/lib/genesis_ruby/api/mixins/requests/non_financial/date_attributes.rb +64 -0
  22. data/lib/genesis_ruby/api/mixins/requests/non_financial/mode_attributes.rb +24 -0
  23. data/lib/genesis_ruby/api/mixins/requests/non_financial/paging_attributes.rb +33 -0
  24. data/lib/genesis_ruby/api/mixins/requests/non_financial/tokenization/card_data_attributes.rb +62 -0
  25. data/lib/genesis_ruby/api/mixins/requests/non_financial/tokenization/token_attributes.rb +23 -0
  26. data/lib/genesis_ruby/api/mixins/requests/non_financial/tokenization/tokenization_attributes.rb +51 -0
  27. data/lib/genesis_ruby/api/mixins/requests/restricted_setter.rb +18 -0
  28. data/lib/genesis_ruby/api/request.rb +15 -0
  29. data/lib/genesis_ruby/api/requests/base/consumer.rb +24 -0
  30. data/lib/genesis_ruby/api/requests/base/financial.rb +10 -1
  31. data/lib/genesis_ruby/api/requests/base/financials/credit_card.rb +5 -7
  32. data/lib/genesis_ruby/api/requests/base/financials/south_american_payments.rb +11 -14
  33. data/lib/genesis_ruby/api/requests/base/graphql.rb +60 -0
  34. data/lib/genesis_ruby/api/requests/base/reference.rb +2 -1
  35. data/lib/genesis_ruby/api/requests/financial/cards/bancontact.rb +8 -9
  36. data/lib/genesis_ruby/api/requests/financial/cash_payments/cash.rb +13 -14
  37. data/lib/genesis_ruby/api/requests/financial/cash_payments/pix.rb +23 -25
  38. data/lib/genesis_ruby/api/requests/financial/mobile/apple_pay.rb +18 -20
  39. data/lib/genesis_ruby/api/requests/financial/mobile/google_pay.rb +20 -24
  40. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/banco_do_brasil.rb +57 -0
  41. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/eps.rb +46 -0
  42. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/idebit/pay_in.rb +48 -0
  43. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/idebit/pay_out.rb +28 -0
  44. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/insta_debit/pay_in.rb +61 -0
  45. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/insta_debit/pay_out.rb +24 -0
  46. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/multibanco.rb +48 -0
  47. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/my_bank.rb +47 -0
  48. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/online_banking/pay_in.rb +17 -18
  49. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/online_banking/pay_out.rb +33 -38
  50. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/pay_u.rb +61 -0
  51. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/post_finance.rb +53 -0
  52. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/safety_pay.rb +57 -0
  53. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/sofort.rb +63 -0
  54. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/trustly_sale.rb +75 -0
  55. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/upi.rb +54 -0
  56. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/wechat.rb +50 -0
  57. data/lib/genesis_ruby/api/requests/financial/sdd/recurring/init_recurring_sale.rb +23 -0
  58. data/lib/genesis_ruby/api/requests/financial/sdd/recurring/recurring_sale.rb +28 -0
  59. data/lib/genesis_ruby/api/requests/financial/sdd/refund.rb +26 -0
  60. data/lib/genesis_ruby/api/requests/financial/sdd/sale.rb +57 -0
  61. data/lib/genesis_ruby/api/requests/financial/void.rb +12 -5
  62. data/lib/genesis_ruby/api/requests/financial/wallets/alipay.rb +46 -0
  63. data/lib/genesis_ruby/api/requests/financial/wallets/{pay_pay.rb → pay_pal.rb} +18 -20
  64. data/lib/genesis_ruby/api/requests/non_financial/billing_api/transactions.rb +203 -0
  65. data/lib/genesis_ruby/api/requests/non_financial/consumers/create.rb +44 -0
  66. data/lib/genesis_ruby/api/requests/non_financial/consumers/disable.rb +40 -0
  67. data/lib/genesis_ruby/api/requests/non_financial/consumers/enable.rb +40 -0
  68. data/lib/genesis_ruby/api/requests/non_financial/consumers/get_cards.rb +40 -0
  69. data/lib/genesis_ruby/api/requests/non_financial/consumers/retrieve.rb +40 -0
  70. data/lib/genesis_ruby/api/requests/non_financial/consumers/update.rb +45 -0
  71. data/lib/genesis_ruby/api/requests/non_financial/fraud/retrieval/date_range.rb +81 -0
  72. data/lib/genesis_ruby/api/requests/non_financial/fraud/retrieval/transaction.rb +52 -0
  73. data/lib/genesis_ruby/api/requests/non_financial/processed_transactions/date_range.rb +68 -0
  74. data/lib/genesis_ruby/api/requests/non_financial/processed_transactions/post_date_range.rb +72 -0
  75. data/lib/genesis_ruby/api/requests/non_financial/processed_transactions/transaction.rb +48 -0
  76. data/lib/genesis_ruby/api/requests/non_financial/reconcile/date_range.rb +2 -50
  77. data/lib/genesis_ruby/api/requests/non_financial/sca/checker.rb +77 -0
  78. data/lib/genesis_ruby/api/requests/non_financial/tokenization/cryptogram.rb +43 -0
  79. data/lib/genesis_ruby/api/requests/non_financial/tokenization/delete_token.rb +43 -0
  80. data/lib/genesis_ruby/api/requests/non_financial/tokenization/detokenize.rb +43 -0
  81. data/lib/genesis_ruby/api/requests/non_financial/tokenization/get_card.rb +43 -0
  82. data/lib/genesis_ruby/api/requests/non_financial/tokenization/tokenize.rb +45 -0
  83. data/lib/genesis_ruby/api/requests/non_financial/tokenization/update_token.rb +45 -0
  84. data/lib/genesis_ruby/api/requests/non_financial/tokenization/validate_token.rb +43 -0
  85. data/lib/genesis_ruby/builder.rb +5 -0
  86. data/lib/genesis_ruby/builders/graphql.rb +118 -0
  87. data/lib/genesis_ruby/configuration.rb +11 -2
  88. data/lib/genesis_ruby/dependencies.rb +3 -0
  89. data/lib/genesis_ruby/network/adapter/net_http_adapter.rb +20 -9
  90. data/lib/genesis_ruby/network/base_network.rb +1 -14
  91. data/lib/genesis_ruby/utils/formatters/response/formats/timestamp.rb +1 -1
  92. data/lib/genesis_ruby/utils/options/api_config.rb +19 -0
  93. data/lib/genesis_ruby/utils/options/network_adapter_config.rb +49 -14
  94. data/lib/genesis_ruby/utils/transactions/financial_types.rb +1 -1
  95. data/lib/genesis_ruby/utils/transactions/references/refundable_types.rb +1 -1
  96. data/lib/genesis_ruby/utils/transactions/wpf_types.rb +1 -1
  97. data/lib/genesis_ruby/version.rb +1 -1
  98. metadata +66 -4
@@ -0,0 +1,48 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module Financial
5
+ module OnlineBankingPayments
6
+ # Multibanco allows Portuguese shoppers to do payments through the Internet
7
+ # by using virtual credit cards
8
+ class Multibanco < Base::Financial
9
+
10
+ include Api::Mixins::Requests::AddressInfoAttributes
11
+ include Api::Mixins::Requests::Financial::AsyncAttributes
12
+ include Api::Mixins::Requests::Financial::PendingPaymentAttributes
13
+
14
+ protected
15
+
16
+ # Multibanco transaction type
17
+ def transaction_type
18
+ Api::Constants::Transactions::MULTIBANCO
19
+ end
20
+
21
+ # Multibanco field validations
22
+ def init_field_validations
23
+ super
24
+
25
+ required_fields.push *%i[transaction_id return_success_url return_failure_url
26
+ amount currency billing_country]
27
+
28
+ field_values.merge! billing_country: %w(PT)
29
+ end
30
+
31
+ # Multibanco request structure
32
+ def payment_transaction_structure
33
+ {
34
+ return_success_url: return_success_url,
35
+ return_failure_url: return_failure_url,
36
+ return_pending_url: return_pending_url,
37
+ customer_email: customer_email,
38
+ billing_address: billing_address_parameters_structure,
39
+ shipping_address: shipping_address_parameters_structure
40
+ }
41
+ end
42
+
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,47 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module Financial
5
+ module OnlineBankingPayments
6
+ # MyBank is an overlay banking system for Italy and Spain
7
+ class MyBank < Base::Financial
8
+
9
+ include Api::Mixins::Requests::AddressInfoAttributes
10
+ include Api::Mixins::Requests::Financial::AsyncAttributes
11
+ include Api::Mixins::Requests::Financial::PendingPaymentAttributes
12
+
13
+ protected
14
+
15
+ # MyBank transaction type
16
+ def transaction_type
17
+ Api::Constants::Transactions::MY_BANK
18
+ end
19
+
20
+ # MyBank field validations
21
+ def init_field_validations
22
+ super
23
+
24
+ required_fields.push *%i[transaction_id return_success_url return_failure_url
25
+ amount currency billing_country]
26
+
27
+ field_values.merge! currency: 'EUR',
28
+ billing_country: %w(IT BE PT ES)
29
+ end
30
+
31
+ # MyBank request structure
32
+ def payment_transaction_structure
33
+ {
34
+ return_success_url: return_success_url,
35
+ return_failure_url: return_failure_url,
36
+ return_pending_url: return_pending_url,
37
+ billing_address: billing_address_parameters_structure,
38
+ shipping_address: shipping_address_parameters_structure
39
+ }
40
+ end
41
+
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -14,7 +14,6 @@ module GenesisRuby
14
14
  include Api::Mixins::Requests::DocumentAttributes
15
15
  include Api::Mixins::Requests::Financial::AsyncAttributes
16
16
  include Api::Mixins::Requests::Financial::OnlineBankingPayments::VirtualPaymentAddressAttributes
17
- include Api::Mixins::Requests::Financial::PaymentAttributes
18
17
 
19
18
  attr_accessor :user_category, :payment_type, :bank_code, :consumer_reference, :auth_code
20
19
 
@@ -27,6 +26,8 @@ module GenesisRuby
27
26
 
28
27
  # Online Banking PayIn field validations
29
28
  def init_field_validations # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
29
+ super
30
+
30
31
  required_fields.push *%i[transaction_id return_success_url return_failure_url amount currency bank_code]
31
32
 
32
33
  field_values.merge! payment_type: Api::Constants::Transactions::Parameters::OnlineBanking::
@@ -133,23 +134,21 @@ module GenesisRuby
133
134
 
134
135
  # Online Banking PayIn parameters structure
135
136
  def payment_transaction_structure # rubocop:disable Metrics/MethodLength
136
- payment_attributes_structure.merge(
137
- {
138
- return_success_url: return_success_url,
139
- return_failure_url: return_failure_url,
140
- billing_address: billing_address_parameters_structure,
141
- shipping_address: shipping_address_parameters_structure,
142
- customer_email: customer_email,
143
- customer_phone: customer_phone,
144
- payment_type: payment_type,
145
- bank_code: bank_code,
146
- document_id: document_id,
147
- user_category: user_category,
148
- virtual_payment_address: virtual_payment_address,
149
- consumer_reference: consumer_reference,
150
- auth_code: auth_code
151
- }
152
- )
137
+ {
138
+ return_success_url: return_success_url,
139
+ return_failure_url: return_failure_url,
140
+ billing_address: billing_address_parameters_structure,
141
+ shipping_address: shipping_address_parameters_structure,
142
+ customer_email: customer_email,
143
+ customer_phone: customer_phone,
144
+ payment_type: payment_type,
145
+ bank_code: bank_code,
146
+ document_id: document_id,
147
+ user_category: user_category,
148
+ virtual_payment_address: virtual_payment_address,
149
+ consumer_reference: consumer_reference,
150
+ auth_code: auth_code
151
+ }
153
152
  end
154
153
 
155
154
  end
@@ -15,8 +15,8 @@ module GenesisRuby
15
15
  include Api::Mixins::Requests::DocumentAttributes
16
16
  include Api::Mixins::Requests::Financial::AsyncAttributes
17
17
  include Api::Mixins::Requests::Financial::NotificationAttributes
18
+ include Api::Mixins::Requests::Financial::OnlineBankingPayments::PayerAttributes
18
19
  include Api::Mixins::Requests::Financial::OnlineBankingPayments::PixAttributes
19
- include Api::Mixins::Requests::Financial::PaymentAttributes
20
20
 
21
21
  attr_reader :id_card_number, :payer_bank_phone_number, :document_type, :account_id, :user_id
22
22
  attr_accessor :bank_name, :bank_code, :bank_branch, :bank_account_name, :bank_account_number, :pix_key,
@@ -27,11 +27,6 @@ module GenesisRuby
27
27
  limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 30
28
28
  end
29
29
 
30
- # Payer bank phone Number
31
- def payer_bank_phone_number=(value)
32
- limited_string attribute: __method__, value: value.to_s, min: 11, max: 14
33
- end
34
-
35
30
  # ID card/document type
36
31
  def document_type=(value)
37
32
  limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 10
@@ -56,6 +51,8 @@ module GenesisRuby
56
51
 
57
52
  # Set field validations
58
53
  def init_field_validations
54
+ super
55
+
59
56
  required_fields.push *%i[transaction_id amount currency notification_url return_success_url
60
57
  return_failure_url billing_first_name billing_last_name billing_state billing_country]
61
58
 
@@ -75,38 +72,36 @@ module GenesisRuby
75
72
 
76
73
  # Bank Payout payment transaction structure
77
74
  def payment_transaction_structure # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
78
- payment_attributes_structure.merge(
79
- {
80
- return_success_url: return_success_url,
81
- return_failure_url: return_failure_url,
82
- notification_url: notification_url,
83
- customer_email: customer_email,
84
- customer_phone: customer_phone,
85
- bank_name: bank_name,
86
- bank_code: bank_code,
87
- bank_account_name: bank_account_name,
88
- bank_account_number: bank_account_number,
89
- bank_account_type: bank_account_type,
90
- bank_account_verification_digit: bank_account_verification_digit,
91
- bank_province: bank_province,
92
- bank_branch: bank_branch,
93
- id_card_number: id_card_number,
94
- payer_bank_phone_number: payer_bank_phone_number,
95
- document_type: document_type,
96
- document_id: document_id,
97
- account_id: account_id,
98
- user_id: user_id,
99
- birth_date: birth_date,
100
- payment_type: payment_type,
101
- company_type: company_type,
102
- company_activity: company_activity,
103
- incorporation_date: incorporation_date,
104
- mothers_name: mothers_name,
105
- pix_key: pix_key,
106
- billing_address: billing_address_parameters_structure,
107
- shipping_address: shipping_address_parameters_structure
108
- }
109
- )
75
+ {
76
+ return_success_url: return_success_url,
77
+ return_failure_url: return_failure_url,
78
+ notification_url: notification_url,
79
+ customer_email: customer_email,
80
+ customer_phone: customer_phone,
81
+ bank_name: bank_name,
82
+ bank_code: bank_code,
83
+ bank_account_name: bank_account_name,
84
+ bank_account_number: bank_account_number,
85
+ bank_account_type: bank_account_type,
86
+ bank_account_verification_digit: bank_account_verification_digit,
87
+ bank_province: bank_province,
88
+ bank_branch: bank_branch,
89
+ id_card_number: id_card_number,
90
+ payer: payer_parameters_structure,
91
+ document_type: document_type,
92
+ document_id: document_id,
93
+ account_id: account_id,
94
+ user_id: user_id,
95
+ birth_date: birth_date,
96
+ payment_type: payment_type,
97
+ company_type: company_type,
98
+ company_activity: company_activity,
99
+ incorporation_date: incorporation_date,
100
+ mothers_name: mothers_name,
101
+ pix_key: pix_key,
102
+ billing_address: billing_address_parameters_structure,
103
+ shipping_address: shipping_address_parameters_structure
104
+ }
110
105
  end
111
106
 
112
107
  private
@@ -0,0 +1,61 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module Financial
5
+ module OnlineBankingPayments
6
+ # PayU is a payment method for Czech Republic and Poland
7
+ class PayU < Base::Financial
8
+
9
+ include Api::Mixins::Requests::AddressInfoAttributes
10
+ include Api::Mixins::Requests::Financial::AsyncAttributes
11
+ include Api::Mixins::Requests::Financial::PendingPaymentAttributes
12
+
13
+ protected
14
+
15
+ # PayU transaction type
16
+ def transaction_type
17
+ Api::Constants::Transactions::PAYU
18
+ end
19
+
20
+ # PayU field validations
21
+ def init_field_validations # rubocop:disable Metrics/MethodLength
22
+ super
23
+
24
+ required_fields.push *%i[transaction_id return_success_url return_failure_url
25
+ amount currency billing_first_name billing_last_name billing_country]
26
+
27
+ field_values.merge! billing_country: %w(CZ PL),
28
+ currency: %w(CZK PLN)
29
+
30
+ field_value_dependencies.merge!(
31
+ {
32
+ currency: {
33
+ CZK: {
34
+ billing_country: %w(CZ)
35
+ },
36
+ PLN: {
37
+ billing_country: %w(PL)
38
+ }
39
+ }
40
+ }
41
+ )
42
+ end
43
+
44
+ # PayU request structure
45
+ def payment_transaction_structure
46
+ {
47
+ return_success_url: return_success_url,
48
+ return_failure_url: return_failure_url,
49
+ return_pending_url: return_pending_url,
50
+ customer_email: customer_email,
51
+ billing_address: billing_address_parameters_structure,
52
+ shipping_address: shipping_address_parameters_structure
53
+ }
54
+ end
55
+
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,53 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module Financial
5
+ module OnlineBankingPayments
6
+ # PostFinance is an online banking provider in Switzerland
7
+ class PostFinance < Base::Financial
8
+
9
+ include Api::Mixins::Requests::AddressInfoAttributes
10
+ include Api::Mixins::Requests::Financial::AsyncAttributes
11
+ include Api::Mixins::Requests::Financial::PendingPaymentAttributes
12
+
13
+ protected
14
+
15
+ # PostFinance transaction type
16
+ def transaction_type
17
+ Api::Constants::Transactions::POST_FINANCE
18
+ end
19
+
20
+ # PostFinance field validations
21
+ def init_field_validations # rubocop:disable Metrics/MethodLength
22
+ super
23
+
24
+ required_fields.push *%i[
25
+ transaction_id
26
+ return_success_url
27
+ return_failure_url
28
+ amount
29
+ currency
30
+ billing_country
31
+ ]
32
+
33
+ field_values.merge! currency: %w(EUR CHF),
34
+ billing_country: 'CH'
35
+ end
36
+
37
+ # PostFinance request structure
38
+ def payment_transaction_structure
39
+ {
40
+ return_success_url: return_success_url,
41
+ return_failure_url: return_failure_url,
42
+ return_pending_url: return_pending_url,
43
+ billing_address: billing_address_parameters_structure,
44
+ shipping_address: shipping_address_parameters_structure
45
+ }
46
+ end
47
+
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,57 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module Financial
5
+ module OnlineBankingPayments
6
+ # SafetyPay, bank transfer payment method, popular in Germany
7
+ class SafetyPay < Requests::Base::Financial
8
+
9
+ include Api::Mixins::Requests::CustomerAddress::BillingInfoAttributes
10
+ include Api::Mixins::Requests::CustomerAddress::ShippingInfoAttributes
11
+ include Api::Mixins::Requests::CustomerAddress::CustomerInfoAttributes
12
+ include Api::Mixins::Requests::Financial::AsyncAttributes
13
+ include Api::Mixins::Requests::Financial::PendingPaymentAttributes
14
+
15
+ protected
16
+
17
+ # SafetyPay transaction type
18
+ def transaction_type
19
+ Api::Constants::Transactions::SAFETYPAY
20
+ end
21
+
22
+ # SafetyPay field validation
23
+ def init_field_validations # rubocop:disable Metrics/MethodLength
24
+ super
25
+
26
+ required_fields.push *%i[
27
+ transaction_id
28
+ return_success_url
29
+ return_failure_url
30
+ amount
31
+ currency
32
+ customer_email
33
+ billing_country
34
+ ]
35
+
36
+ field_values.merge! currency: %w(EUR USD),
37
+ billing_country: %w(AT BE BR CL CO DE EC ES MX NL PE PR)
38
+ end
39
+
40
+ # SafetyPay request structure
41
+ def payment_transaction_structure
42
+ {
43
+ return_success_url: return_success_url,
44
+ return_failure_url: return_failure_url,
45
+ return_pending_url: return_pending_url,
46
+ customer_email: customer_email,
47
+ billing_address: billing_address_parameters_structure,
48
+ shipping_address: shipping_address_parameters_structure
49
+ }
50
+ end
51
+
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,63 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module Financial
5
+ module OnlineBankingPayments
6
+ # Sofort, bank transfer payment method, popular in Germany
7
+ class Sofort < Requests::Base::Financial
8
+
9
+ include Api::Mixins::Requests::CustomerAddress::BillingInfoAttributes
10
+ include Api::Mixins::Requests::CustomerAddress::ShippingInfoAttributes
11
+ include Api::Mixins::Requests::CustomerAddress::CustomerInfoAttributes
12
+ include Api::Mixins::Requests::Financial::AsyncAttributes
13
+ include Api::Mixins::Requests::Financial::BankAttributes
14
+ include Api::Mixins::Requests::Financial::PendingPaymentAttributes
15
+ include Api::Mixins::Requests::Financial::NotificationAttributes
16
+
17
+ protected
18
+
19
+ # Sofort transaction type
20
+ def transaction_type
21
+ Api::Constants::Transactions::SOFORT
22
+ end
23
+
24
+ # Sofort field validation
25
+ def init_field_validations # rubocop:disable Metrics/MethodLength
26
+ super
27
+
28
+ required_fields.push *%i[
29
+ transaction_id
30
+ remote_ip
31
+ return_success_url
32
+ return_failure_url
33
+ amount
34
+ currency
35
+ customer_email
36
+ billing_country
37
+ ]
38
+
39
+ field_values.merge! billing_country: %w(AT BE DE IT NL PL ES CH)
40
+ end
41
+
42
+ # Sofort request structure
43
+ def payment_transaction_structure # rubocop:disable Metrics/MethodLength
44
+ {
45
+ notification_url: notification_url,
46
+ return_success_url: return_success_url,
47
+ return_failure_url: return_failure_url,
48
+ return_pending_url: return_pending_url,
49
+ customer_email: customer_email,
50
+ customer_phone: customer_phone,
51
+ iban: iban,
52
+ bic: bic,
53
+ billing_address: billing_address_parameters_structure,
54
+ shipping_address: shipping_address_parameters_structure
55
+ }
56
+ end
57
+
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,75 @@
1
+ require 'genesis_ruby/api/constants/transactions/parameters/online_banking/iframe_targets'
2
+
3
+ module GenesisRuby
4
+ module Api
5
+ module Requests
6
+ module Financial
7
+ module OnlineBankingPayments
8
+ # Online Banking TrustlySale transaction class
9
+ class TrustlySale < Base::Financial
10
+
11
+ include Api::Mixins::Requests::AddressInfoAttributes
12
+ include Api::Mixins::Requests::BirthDateAttributes
13
+ include Api::Mixins::Requests::Financial::AsyncAttributes
14
+ include Api::Mixins::Requests::Financial::Business::BusinessAttributes
15
+
16
+ attr_accessor :account_id, :user_id
17
+ attr_reader :return_success_url_target
18
+
19
+ # Allowed values for return_success_url_target
20
+ def return_success_url_target=(value)
21
+ allowed_options attribute: __method__,
22
+ allowed: Constants::Transactions::Parameters::OnlineBanking::IframeTargets.all,
23
+ value: value,
24
+ allow_empty: true
25
+ end
26
+
27
+ protected
28
+
29
+ # TrustlySale transaction type
30
+ def transaction_type
31
+ Api::Constants::Transactions::TRUSTLY_SALE
32
+ end
33
+
34
+ # TrustlySale field validations
35
+ def init_field_validations # rubocop:disable Metrics/MethodLength
36
+ super
37
+
38
+ required_fields.push *%i[
39
+ transaction_id
40
+ remote_ip
41
+ return_success_url
42
+ return_failure_url
43
+ amount
44
+ currency
45
+ customer_email
46
+ billing_country
47
+ account_id
48
+ ]
49
+
50
+ field_values.merge! billing_country: %w(AT BE CZ DK EE FI DE LV LT NL NO PL SK ES SE GB)
51
+ end
52
+
53
+ # TrustlySale parameters structure
54
+ def payment_transaction_structure # rubocop:disable Metrics/MethodLength
55
+ {
56
+ return_success_url: return_success_url,
57
+ return_failure_url: return_failure_url,
58
+ return_success_url_target: return_success_url_target,
59
+ customer_email: customer_email,
60
+ customer_phone: customer_phone,
61
+ user_id: user_id,
62
+ birth_date: birth_date,
63
+ billing_address: billing_address_parameters_structure,
64
+ shipping_address: shipping_address_parameters_structure,
65
+ business_attributes: business_attributes_structure,
66
+ account_id: account_id
67
+ }
68
+ end
69
+
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,54 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module Financial
5
+ module OnlineBankingPayments
6
+ # Online Banking UPI transaction class
7
+ class Upi < Base::Financial
8
+
9
+ include Api::Mixins::Requests::AddressInfoAttributes
10
+ include Api::Mixins::Requests::DocumentAttributes
11
+ include Api::Mixins::Requests::Financial::AsyncAttributes
12
+ include Api::Mixins::Requests::Financial::OnlineBankingPayments::VirtualPaymentAddressAttributes
13
+
14
+ attr_accessor :user_category
15
+
16
+ protected
17
+
18
+ # Upi transaction type
19
+ def transaction_type
20
+ Api::Constants::Transactions::UPI
21
+ end
22
+
23
+ # Upi field validations
24
+ def init_field_validations
25
+ super
26
+
27
+ required_fields.push *%i[
28
+ transaction_id return_success_url return_failure_url amount currency billing_country
29
+ ]
30
+
31
+ field_values.merge! currency: 'INR'
32
+ end
33
+
34
+ # Upi parameters structure
35
+ def payment_transaction_structure # rubocop:disable Metrics/MethodLength
36
+ {
37
+ return_success_url: return_success_url,
38
+ return_failure_url: return_failure_url,
39
+ customer_email: customer_email,
40
+ customer_phone: customer_phone,
41
+ document_id: document_id,
42
+ virtual_payment_address: virtual_payment_address,
43
+ user_category: user_category,
44
+ billing_address: billing_address_parameters_structure,
45
+ shipping_address: shipping_address_parameters_structure
46
+ }
47
+ end
48
+
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,50 @@
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::AsyncAttributes
12
+
13
+ attr_accessor :product_code, :product_num, :product_desc
14
+
15
+ protected
16
+
17
+ # WeChat transaction type
18
+ def transaction_type
19
+ Api::Constants::Transactions::WECHAT
20
+ end
21
+
22
+ # WeChat field validations
23
+ def init_field_validations
24
+ super
25
+
26
+ required_fields.push *%i[transaction_id usage return_success_url return_failure_url
27
+ amount currency billing_country]
28
+ end
29
+
30
+ # WeChat transaction request structure
31
+ def payment_transaction_structure # rubocop:disable Metrics/MethodLength
32
+ {
33
+ return_success_url: return_success_url,
34
+ return_failure_url: return_failure_url,
35
+ product_code: product_code,
36
+ product_num: product_num,
37
+ product_desc: product_desc,
38
+ customer_email: customer_email,
39
+ customer_phone: customer_phone,
40
+ billing_address: billing_address_parameters_structure,
41
+ shipping_address: shipping_address_parameters_structure
42
+ }
43
+ end
44
+
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end