genesis_ruby 0.3.2 → 0.4.0

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 (121) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -0
  3. data/README.md +169 -1
  4. data/VERSION +1 -1
  5. data/lib/genesis_ruby/api/constants/non_financial/alternatives/alipay/merchant_types.rb +26 -0
  6. data/lib/genesis_ruby/api/constants/non_financial/alternatives/alipay/site_types.rb +26 -0
  7. data/lib/genesis_ruby/api/constants/non_financial/kyc/bank_account_types.rb +24 -0
  8. data/lib/genesis_ruby/api/constants/transactions/parameters/foreign_retailer_indicators.rb +24 -0
  9. data/lib/genesis_ruby/api/constants/transactions/parameters/funding/person_types.rb +26 -0
  10. data/lib/genesis_ruby/api/constants/transactions/parameters/money_transfer/purpose_of_payments.rb +46 -19
  11. data/lib/genesis_ruby/api/constants/transactions/parameters/money_transfer/sender_account_number_types.rb +14 -17
  12. data/lib/genesis_ruby/api/constants/transactions/parameters/money_transfer/source_of_funds.rb +9 -18
  13. data/lib/genesis_ruby/api/constants/transactions/parameters/money_transfer/types.rb +31 -4
  14. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/enhanced_statement_response_fields.rb +39 -0
  15. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/response_fields.rb +2 -0
  16. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/statement_order_by_fields.rb +31 -0
  17. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/statement_response_fields.rb +14 -13
  18. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/{processing_type.rb → scopes.rb} +4 -3
  19. data/lib/genesis_ruby/api/constants/transactions/parameters/purpose_of_payment.rb +117 -0
  20. data/lib/genesis_ruby/api/constants/transactions/parameters/purpose_of_payment_values.rb +267 -0
  21. data/lib/genesis_ruby/api/constants/transactions/parameters/wallets/e_wallet/payment_types.rb +46 -0
  22. data/lib/genesis_ruby/api/constants/transactions.rb +9 -0
  23. data/lib/genesis_ruby/api/mixins/requests/customer_address/billing_info_attributes.rb +3 -1
  24. data/lib/genesis_ruby/api/mixins/requests/financial/cards/credential_on_file_transaction_link_attributes.rb +83 -0
  25. data/lib/genesis_ruby/api/mixins/requests/financial/commercial_card_attributes.rb +143 -0
  26. data/lib/genesis_ruby/api/mixins/requests/financial/funding_attributes.rb +32 -3
  27. data/lib/genesis_ruby/api/mixins/requests/financial/marketplace_data_attributes.rb +179 -0
  28. data/lib/genesis_ruby/api/mixins/requests/financial/money_transfer_payout_attributes.rb +49 -46
  29. data/lib/genesis_ruby/api/mixins/requests/financial/order_attributes.rb +36 -0
  30. data/lib/genesis_ruby/api/mixins/requests/financial/purpose_of_payment_attributes.rb +14 -4
  31. data/lib/genesis_ruby/api/mixins/requests/financial/refund/bank_attributes.rb +41 -0
  32. data/lib/genesis_ruby/api/mixins/requests/financial/refund/beneficiary_attributes.rb +31 -0
  33. data/lib/genesis_ruby/api/mixins/requests/financial/refund/travel_ticket_attributes.rb +52 -0
  34. data/lib/genesis_ruby/api/mixins/requests/financial/threeds/force_threeds_attributes.rb +29 -0
  35. data/lib/genesis_ruby/api/mixins/requests/non_financial/alternatives/alipay/site_information_attributes.rb +57 -0
  36. data/lib/genesis_ruby/api/mixins/requests/non_financial/date_time_from_to_attributes.rb +102 -0
  37. data/lib/genesis_ruby/api/mixins/requests/non_financial/kyc/background_checks_attributes.rb +31 -10
  38. data/lib/genesis_ruby/api/mixins/requests/non_financial/kyc/verification_document_attributes.rb +49 -7
  39. data/lib/genesis_ruby/api/mixins/requests/non_financial/kyc/verification_instructions_attributes.rb +90 -0
  40. data/lib/genesis_ruby/api/mixins/requests/non_financial/reconcile_order_attributes.rb +30 -0
  41. data/lib/genesis_ruby/api/mixins/requests/non_financial/scope_attributes.rb +29 -0
  42. data/lib/genesis_ruby/api/mixins/requests/restricted_setter.rb +12 -0
  43. data/lib/genesis_ruby/api/mixins/requests/scheme_tokenized_attributes.rb +35 -0
  44. data/lib/genesis_ruby/api/requests/base/financials/credit_card.rb +1 -12
  45. data/lib/genesis_ruby/api/requests/base/graphql.rb +7 -0
  46. data/lib/genesis_ruby/api/requests/base/non_financial/billing_api/abstract_statement.rb +226 -0
  47. data/lib/genesis_ruby/api/requests/base/non_financial/billing_api/base.rb +39 -37
  48. data/lib/genesis_ruby/api/requests/base/non_financial/reconcile/base.rb +45 -0
  49. data/lib/genesis_ruby/api/requests/financial/async_refund.rb +41 -0
  50. data/lib/genesis_ruby/api/requests/financial/cards/authorize.rb +43 -24
  51. data/lib/genesis_ruby/api/requests/financial/cards/authorize3d.rb +13 -1
  52. data/lib/genesis_ruby/api/requests/financial/cards/payout.rb +21 -5
  53. data/lib/genesis_ruby/api/requests/financial/cards/sale.rb +42 -23
  54. data/lib/genesis_ruby/api/requests/financial/cards/sale3d.rb +13 -1
  55. data/lib/genesis_ruby/api/requests/financial/mobile/apple_pay.rb +5 -1
  56. data/lib/genesis_ruby/api/requests/financial/mobile/google_pay.rb +6 -2
  57. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/my_bank.rb +1 -1
  58. data/lib/genesis_ruby/api/requests/financial/refund.rb +20 -35
  59. data/lib/genesis_ruby/api/requests/financial/sdd/sale.rb +6 -1
  60. data/lib/genesis_ruby/api/requests/financial/wallets/e_wallet.rb +72 -0
  61. data/lib/genesis_ruby/api/requests/non_financial/alternatives/alipay/register_merchant.rb +147 -0
  62. data/lib/genesis_ruby/api/requests/non_financial/billing_api/enhanced_statement.rb +46 -0
  63. data/lib/genesis_ruby/api/requests/non_financial/billing_api/statement.rb +12 -137
  64. data/lib/genesis_ruby/api/requests/non_financial/billing_api/transactions.rb +4 -2
  65. data/lib/genesis_ruby/api/requests/non_financial/fraud/chargeback/date_range.rb +10 -19
  66. data/lib/genesis_ruby/api/requests/non_financial/fraud/rdr/date_range.rb +91 -0
  67. data/lib/genesis_ruby/api/requests/non_financial/fraud/rdr/transaction.rb +54 -0
  68. data/lib/genesis_ruby/api/requests/non_financial/fraud/retrieval/date_range.rb +10 -19
  69. data/lib/genesis_ruby/api/requests/non_financial/kyc/verifications/bank_account.rb +76 -0
  70. data/lib/genesis_ruby/api/requests/non_financial/kyc/verifications/create.rb +31 -4
  71. data/lib/genesis_ruby/api/requests/non_financial/payment_authorizations/date_range.rb +124 -0
  72. data/lib/genesis_ruby/api/requests/non_financial/processed_transactions/date_range.rb +8 -15
  73. data/lib/genesis_ruby/api/requests/non_financial/processed_transactions/post_date_range.rb +12 -18
  74. data/lib/genesis_ruby/api/requests/non_financial/reconcile/date_range.rb +29 -4
  75. data/lib/genesis_ruby/api/requests/non_financial/reconcile/order.rb +40 -0
  76. data/lib/genesis_ruby/api/requests/non_financial/reconcile/transaction.rb +1 -15
  77. data/lib/genesis_ruby/api/requests/non_financial/tokenization/cryptogram.rb +3 -1
  78. data/lib/genesis_ruby/api/requests/non_financial/tokenization/tokenize.rb +3 -1
  79. data/lib/genesis_ruby/api/requests/wpf/create.rb +4 -0
  80. data/lib/genesis_ruby/api/requests/wpf/reconcile.rb +11 -4
  81. data/lib/genesis_ruby/api/requests/wpf/reconcile_by_date.rb +62 -0
  82. data/lib/genesis_ruby/api/requests/wpf/reconcile_by_order.rb +38 -0
  83. data/lib/genesis_ruby/builders/graphql.rb +95 -40
  84. data/lib/genesis_ruby/dependencies.rb +2 -0
  85. data/lib/genesis_ruby/utils/money/format.rb +2 -1
  86. data/lib/genesis_ruby/utils/transactions/financial_types.rb +3 -2
  87. data/lib/genesis_ruby/utils/transactions/references/refundable_types.rb +2 -1
  88. data/lib/genesis_ruby/utils/transactions/wpf_types.rb +1 -1
  89. data/lib/genesis_ruby/version.rb +1 -1
  90. metadata +40 -35
  91. data/.kiro/specs/f2025112509-add_managed_recurring_api/.config.kiro +0 -1
  92. data/.kiro/specs/f2025112509-add_managed_recurring_api/design.md +0 -332
  93. data/.kiro/specs/f2025112509-add_managed_recurring_api/requirements.md +0 -91
  94. data/.kiro/specs/f2025112509-add_managed_recurring_api/tasks.md +0 -139
  95. data/.kiro/specs/f2025112603-add_reverify_endpoint_to_payee_account/.config.kiro +0 -1
  96. data/.kiro/specs/f2025112603-add_reverify_endpoint_to_payee_account/design.md +0 -148
  97. data/.kiro/specs/f2025112603-add_reverify_endpoint_to_payee_account/requirements.md +0 -81
  98. data/.kiro/specs/f2025112603-add_reverify_endpoint_to_payee_account/tasks.md +0 -48
  99. data/.kiro/specs/f2025112606-add_list_payees_trx_request/.config.kiro +0 -1
  100. data/.kiro/specs/f2025112606-add_list_payees_trx_request/design.md +0 -112
  101. data/.kiro/specs/f2025112606-add_list_payees_trx_request/requirements.md +0 -74
  102. data/.kiro/specs/f2025112606-add_list_payees_trx_request/tasks.md +0 -38
  103. data/.kiro/specs/f2025112609_update_payee_request_params/design.md +0 -86
  104. data/.kiro/specs/f2025112609_update_payee_request_params/requirements.md +0 -86
  105. data/.kiro/specs/f2025112609_update_payee_request_params/tasks.md +0 -40
  106. data/.kiro/specs/f2025112612-add_payee_owner_documents_and_verification_requests/.config.kiro +0 -1
  107. data/.kiro/specs/f2025112612-add_payee_owner_documents_and_verification_requests/design.md +0 -246
  108. data/.kiro/specs/f2025112612-add_payee_owner_documents_and_verification_requests/requirements.md +0 -287
  109. data/.kiro/specs/f2025112612-add_payee_owner_documents_and_verification_requests/tasks.md +0 -76
  110. data/.kiro/specs/f2025112614-add_money_transfer_payout_attributes_to_payout_rq/design.md +0 -84
  111. data/.kiro/specs/f2025112614-add_money_transfer_payout_attributes_to_payout_rq/requirements.md +0 -88
  112. data/.kiro/specs/f2025112614-add_money_transfer_payout_attributes_to_payout_rq/tasks.md +0 -38
  113. data/.kiro/steering/product.md +0 -15
  114. data/.kiro/steering/spec-folder-naming.md +0 -16
  115. data/.kiro/steering/structure.md +0 -96
  116. data/.kiro/steering/tech.md +0 -66
  117. data/Gemfile +0 -6
  118. data/Gemfile.lock +0 -176
  119. data/Rakefile +0 -24
  120. data/genesis_ruby.gemspec +0 -47
  121. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/externally_processed.rb +0 -24
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'genesis_ruby/api/requests/base/financials/credit_card'
4
+ require 'genesis_ruby/api/constants/transactions/parameters/money_transfer/purpose_of_payments'
4
5
 
5
6
  module GenesisRuby
6
7
  module Api
@@ -19,12 +20,21 @@ module GenesisRuby
19
20
  include Mixins::Requests::Financial::CryptoAttributes
20
21
  include Mixins::Requests::Financial::CustomerIdentificationAttributes
21
22
  include Mixins::Requests::Financial::DynamicDescriptorAttributes
22
- include Mixins::Requests::Financial::GamingAttributes
23
23
  include Mixins::Requests::Financial::MoneyTransferPayoutAttributes
24
24
  include Mixins::Requests::Financial::MotoAttributes
25
25
  include Mixins::Requests::Financial::PurposeOfPaymentAttributes
26
26
  include Mixins::Requests::Financial::SourceOfFundsAttributes
27
27
 
28
+ # Credential on file settlement date is not supported by the Payout transaction
29
+ def credential_on_file_settlement_date=(_value)
30
+ raise ParameterError, "Parameter #{__method__} is not supported by the Payout transaction"
31
+ end
32
+
33
+ # Scheme tokenized is not supported by the Payout transaction
34
+ def scheme_tokenized=(_value)
35
+ raise ParameterError, "Parameter #{__method__} is not supported by the Payout transaction"
36
+ end
37
+
28
38
  protected
29
39
 
30
40
  # Payout Transaction Type
@@ -41,15 +51,21 @@ module GenesisRuby
41
51
  field_value_dependencies.merge! required_tokenization_fields_conditional
42
52
  end
43
53
 
54
+ # Payout accepts the Visa and the Mastercard Money Transfer purpose of payment values
55
+ def allowed_purpose_of_payment_values
56
+ super | Api::Constants::Transactions::Parameters::MoneyTransfer::PurposeOfPayments.all
57
+ end
58
+
44
59
  # Payout request structure
45
60
  def payment_transaction_structure # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
46
- super.delete(:credential_on_file_settlement_date)
47
- super.delete(:scheme_tokenized)
61
+ parent_structure = super
62
+
63
+ parent_structure.delete :credential_on_file_settlement_date
64
+ parent_structure.delete :scheme_tokenized
48
65
 
49
- super.merge(
66
+ parent_structure.merge(
50
67
  source_of_funds_attributes_structure,
51
68
  {
52
- gaming: gaming,
53
69
  moto: moto,
54
70
  crypto: crypto,
55
71
  digital_asset_type: digital_asset_type,
@@ -14,16 +14,21 @@ module GenesisRuby
14
14
  include Mixins::Requests::DigitalAssetTypeAttributes
15
15
  include Mixins::Requests::DocumentAttributes
16
16
  include Mixins::Requests::Financial::Business::BusinessAttributes
17
+ include Mixins::Requests::Financial::Cards::CredentialOnFileTransactionLinkAttributes
17
18
  include Mixins::Requests::Financial::Cards::FxRateAttributes
18
19
  include Mixins::Requests::Financial::Cards::InstallmentAttributes
19
20
  include Mixins::Requests::Financial::Cards::Recurring::ManagedRecurringAttributes
20
21
  include Mixins::Requests::Financial::Cards::Recurring::RecurringCategoryAttributes
21
22
  include Mixins::Requests::Financial::Cards::Recurring::RecurringTypeAttributes
23
+ include Mixins::Requests::Financial::CommercialCardAttributes
22
24
  include Mixins::Requests::Financial::CryptoAttributes
23
25
  include Mixins::Requests::Financial::DynamicDescriptorAttributes
24
26
  include Mixins::Requests::Financial::FundingAttributes
25
27
  include Mixins::Requests::Financial::GamingAttributes
28
+ include Mixins::Requests::Financial::MarketplaceDataAttributes
26
29
  include Mixins::Requests::Financial::MotoAttributes
30
+ include Mixins::Requests::Financial::OrderAttributes
31
+ include Mixins::Requests::Financial::PurposeOfPaymentAttributes
27
32
  include Mixins::Requests::Financial::ReferenceAttributes
28
33
  include Mixins::Requests::Financial::RiskAttributes
29
34
  include Mixins::Requests::Financial::ScaAttributes
@@ -36,6 +41,16 @@ module GenesisRuby
36
41
  GenesisRuby::Api::Constants::Transactions::SALE
37
42
  end
38
43
 
44
+ # Special validations upon document building
45
+ def check_requirements
46
+ validate_credential_on_file_transaction_link_id
47
+
48
+ super
49
+
50
+ validate_marketplace_data_attributes
51
+ validate_commercial_card_attributes
52
+ end
53
+
39
54
  # Request Field validations
40
55
  def init_field_validations
41
56
  super
@@ -53,29 +68,33 @@ module GenesisRuby
53
68
 
54
69
  def payment_transaction_structure # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
55
70
  super.merge(
56
- gaming: gaming,
57
- moto: moto,
58
- crypto: crypto,
59
- customer_email: customer_email,
60
- customer_phone: customer_phone,
61
- reference_id: reference_id,
62
- document_id: document_id,
63
- fx_rate_id: fx_rate_id,
64
- billing_address: billing_address_parameters_structure,
65
- shipping_address: shipping_address_parameters_structure,
66
- risk_params: risk_parameters_structure,
67
- dynamic_descriptor_params: dynamic_descriptor_structure,
68
- business_attributes: business_attributes_structure,
69
- recurring_type: recurring_type,
70
- recurring_category: recurring_category,
71
- sca_params: sca_attributes_structure,
72
- managed_recurring: managed_recurring_attributes_structure,
73
- travel: travel_data_attributes_structure,
74
- funding: funding_attributes_structure,
75
- installment_plan_id: installment_plan_id,
76
- installment_plan_reference: installment_plan_reference,
77
- digital_asset_type: digital_asset_type
78
- )
71
+ gaming: gaming,
72
+ moto: moto,
73
+ crypto: crypto,
74
+ customer_email: customer_email,
75
+ customer_phone: customer_phone,
76
+ reference_id: reference_id,
77
+ document_id: document_id,
78
+ fx_rate_id: fx_rate_id,
79
+ billing_address: billing_address_parameters_structure,
80
+ shipping_address: shipping_address_parameters_structure,
81
+ risk_params: risk_parameters_structure,
82
+ dynamic_descriptor_params: dynamic_descriptor_structure,
83
+ business_attributes: business_attributes_structure,
84
+ recurring_type: recurring_type,
85
+ recurring_category: recurring_category,
86
+ sca_params: sca_attributes_structure,
87
+ managed_recurring: managed_recurring_attributes_structure,
88
+ travel: travel_data_attributes_structure,
89
+ marketplace_data: marketplace_data_attributes_structure,
90
+ funding: funding_attributes_structure,
91
+ items: commercial_card_attributes_structure,
92
+ purpose_of_payment: purpose_of_payment,
93
+ installment_plan_id: installment_plan_id,
94
+ installment_plan_reference: installment_plan_reference,
95
+ digital_asset_type: digital_asset_type,
96
+ credential_on_file_transaction_link_id: credential_on_file_transaction_link_id
97
+ ).merge(order_attributes_structure)
79
98
  end
80
99
 
81
100
  end
@@ -21,14 +21,19 @@ module GenesisRuby
21
21
  include Mixins::Requests::Financial::Cards::Recurring::ManagedRecurringAttributes
22
22
  include Mixins::Requests::Financial::Cards::Recurring::RecurringCategoryAttributes
23
23
  include Mixins::Requests::Financial::Cards::Recurring::RecurringTypeAttributes
24
+ include Mixins::Requests::Financial::CommercialCardAttributes
24
25
  include Mixins::Requests::Financial::CryptoAttributes
25
26
  include Mixins::Requests::Financial::DynamicDescriptorAttributes
26
27
  include Mixins::Requests::Financial::FundingAttributes
27
28
  include Mixins::Requests::Financial::GamingAttributes
29
+ include Mixins::Requests::Financial::MarketplaceDataAttributes
28
30
  include Mixins::Requests::Financial::MotoAttributes
29
31
  include Mixins::Requests::Financial::NotificationAttributes
32
+ include Mixins::Requests::Financial::OrderAttributes
33
+ include Mixins::Requests::Financial::PurposeOfPaymentAttributes
30
34
  include Mixins::Requests::Financial::RiskAttributes
31
35
  include Mixins::Requests::Financial::ScaAttributes
36
+ include Mixins::Requests::Financial::Threeds::ForceThreedsAttributes
32
37
  include Mixins::Requests::Financial::Threeds::Version2::CommonAttributes
33
38
  include Mixins::Requests::Financial::TravelData::TravelAttributes
34
39
 
@@ -57,6 +62,9 @@ module GenesisRuby
57
62
  validate_threeds_card_holder_dates
58
63
 
59
64
  super
65
+
66
+ validate_marketplace_data_attributes
67
+ validate_commercial_card_attributes
60
68
  end
61
69
 
62
70
  # Sale 3D transaction request parameters
@@ -82,13 +90,17 @@ module GenesisRuby
82
90
  recurring_category: recurring_category,
83
91
  sca_params: sca_attributes_structure,
84
92
  threeds_v2_params: threeds_v2_common_attributes_structure,
93
+ force_threeds: force_threeds,
85
94
  managed_recurring: managed_recurring_attributes_structure,
86
95
  travel: travel_data_attributes_structure,
96
+ marketplace_data: marketplace_data_attributes_structure,
87
97
  funding: funding_attributes_structure,
98
+ items: commercial_card_attributes_structure,
99
+ purpose_of_payment: purpose_of_payment,
88
100
  installment_plan_id: installment_plan_id,
89
101
  installment_plan_reference: installment_plan_reference,
90
102
  digital_asset_type: digital_asset_type
91
- )
103
+ ).merge(order_attributes_structure)
92
104
  end
93
105
 
94
106
  end
@@ -19,6 +19,8 @@ module GenesisRuby
19
19
  include Mixins::Requests::Financial::DynamicDescriptorAttributes
20
20
  include Mixins::Requests::Financial::FundingAttributes
21
21
  include Mixins::Requests::Financial::Mobile::ApplePayTokenAttributes
22
+ include Mixins::Requests::Financial::PurposeOfPaymentAttributes
23
+ include Mixins::Requests::Financial::Threeds::ForceThreedsAttributes
22
24
 
23
25
  attr_accessor :payment_subtype
24
26
 
@@ -62,9 +64,11 @@ module GenesisRuby
62
64
  document_id: document_id,
63
65
  crypto: crypto,
64
66
  recurring_type: recurring_type,
67
+ force_threeds: force_threeds,
65
68
  business_attributes: business_attributes_structure,
66
69
  dynamic_descriptor_params: dynamic_descriptor_structure,
67
- funding: funding_attributes_structure
70
+ funding: funding_attributes_structure,
71
+ purpose_of_payment: purpose_of_payment
68
72
  }
69
73
  end
70
74
 
@@ -22,6 +22,8 @@ module GenesisRuby
22
22
  include Mixins::Requests::Financial::FundingAttributes
23
23
  include Mixins::Requests::Financial::Mobile::GooglePayTokenAttributes
24
24
  include Mixins::Requests::Financial::NotificationAttributes
25
+ include Mixins::Requests::Financial::PurposeOfPaymentAttributes
26
+ include Mixins::Requests::Financial::Threeds::ForceThreedsAttributes
25
27
  include Mixins::Requests::Financial::Threeds::Version2::CommonAttributes
26
28
 
27
29
  # Define a payment token from a JSON string
@@ -61,7 +63,7 @@ module GenesisRuby
61
63
  end
62
64
 
63
65
  # Google Pay Payment Transaction Structure
64
- def payment_transaction_structure # rubocop:disable Metrics/MethodLength
66
+ def payment_transaction_structure # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
65
67
  {
66
68
  payment_subtype: payment_subtype,
67
69
  payment_token: google_pay_token_structure,
@@ -77,8 +79,10 @@ module GenesisRuby
77
79
  dynamic_descriptor_params: dynamic_descriptor_structure,
78
80
  document_id: document_id,
79
81
  recurring_type: recurring_type,
82
+ force_threeds: force_threeds,
80
83
  threeds_v2_params: threeds_v2_common_attributes_structure,
81
- funding: funding_attributes_structure
84
+ funding: funding_attributes_structure,
85
+ purpose_of_payment: purpose_of_payment
82
86
  }
83
87
  end
84
88
 
@@ -27,7 +27,7 @@ module GenesisRuby
27
27
  amount currency billing_country]
28
28
 
29
29
  field_values.merge! currency: 'EUR',
30
- billing_country: %w(IT BE PT ES)
30
+ billing_country: %w(IT BE PT ES FR)
31
31
  end
32
32
 
33
33
  # MyBank request structure
@@ -1,10 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'genesis_ruby/api/constants/transactions/parameters/refund/bank_account_types'
4
- require 'genesis_ruby/api/constants/transactions/parameters/refund/credit_reason_indicators'
5
- require 'genesis_ruby/api/constants/transactions/parameters/refund/ticket_change_indicators'
6
-
7
- # rubocop:disable Naming/VariableNumber
8
3
  module GenesisRuby
9
4
  module Api
10
5
  module Requests
@@ -13,10 +8,11 @@ module GenesisRuby
13
8
  class Refund < Requests::Base::Reference
14
9
 
15
10
  include Mixins::Requests::Financial::Cards::InstallmentAttributes
11
+ include Mixins::Requests::Financial::Refund::BankAttributes
12
+ include Mixins::Requests::Financial::Refund::BeneficiaryAttributes
13
+ include Mixins::Requests::Financial::Refund::TravelTicketAttributes
16
14
 
17
- attr_accessor :beneficiary_bank_code, :beneficiary_name, :beneficiary_account_number, :bank, :bank_branch,
18
- :bank_account, :bank_account_type, :credit_reason_indicator_1, :credit_reason_indicator_2,
19
- :ticket_change_indicator
15
+ include Mixins::Requests::Financial::CommercialCardAttributes
20
16
 
21
17
  protected
22
18
 
@@ -24,13 +20,15 @@ module GenesisRuby
24
20
  def init_field_validations
25
21
  super
26
22
 
27
- field_values.merge! bank_account_type: Constants::Transactions::Parameters::Refund::BankAccountTypes.all,
28
- credit_reason_indicator_1: Constants::Transactions::Parameters::Refund::
29
- CreditReasonIndicators.all,
30
- credit_reason_indicator_2: Constants::Transactions::Parameters::Refund::
31
- CreditReasonIndicators.all,
32
- ticket_change_indicator: Constants::Transactions::Parameters::Refund::
33
- TicketChangeIndicators.all
23
+ field_values.merge! refund_bank_attributes_field_validations,
24
+ refund_travel_ticket_attributes_field_validations
25
+ end
26
+
27
+ # Special validations upon document building
28
+ def check_requirements
29
+ super
30
+
31
+ validate_commercial_card_attributes
34
32
  end
35
33
 
36
34
  # Refund Transaction Request type
@@ -39,25 +37,13 @@ module GenesisRuby
39
37
  end
40
38
 
41
39
  # Refund Transaction Request Structure
42
- def reference_transaction_structure # rubocop:disable Metrics/MethodLength
43
- {
44
- beneficiary_bank_code: beneficiary_bank_code,
45
- beneficiary_name: beneficiary_name,
46
- beneficiary_account_number: beneficiary_account_number,
47
- bank: bank,
48
- bank_branch: bank_branch,
49
- bank_account: bank_account,
50
- bank_account_type: bank_account_type,
51
- installment_plan_id: installment_plan_id,
52
- installment_plan_reference: installment_plan_reference,
53
- travel: {
54
- ticket: {
55
- credit_reason_indicator_1: credit_reason_indicator_1,
56
- credit_reason_indicator_2: credit_reason_indicator_2,
57
- ticket_change_indicator: ticket_change_indicator
58
- }
59
- }
60
- }
40
+ def reference_transaction_structure
41
+ refund_beneficiary_attributes_structure.merge(
42
+ refund_bank_attributes_structure,
43
+ { installment_plan_id: installment_plan_id, installment_plan_reference: installment_plan_reference },
44
+ refund_travel_ticket_attributes_structure,
45
+ { items: commercial_card_attributes_structure }
46
+ )
61
47
  end
62
48
 
63
49
  end
@@ -65,4 +51,3 @@ module GenesisRuby
65
51
  end
66
52
  end
67
53
  end
68
- # rubocop:enable Naming/VariableNumber
@@ -32,7 +32,12 @@ module GenesisRuby
32
32
  transaction_id usage amount currency iban billing_first_name billing_last_name billing_country
33
33
  ]
34
34
 
35
- 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)
35
+ field_values.merge!(
36
+ billing_country: %w(
37
+ AL AD AT BE BG HR CY CZ DK EE FI FR DE GI GR GG HU IS IE IM IT JE LV LI LT LU MT MD MC ME NL MK NO
38
+ PL PT RO SM SK SI ES SE CH GB VA
39
+ )
40
+ )
36
41
  end
37
42
 
38
43
  # SDD Sale request structure
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'genesis_ruby/api/constants/transactions/parameters/wallets/e_wallet/payment_types'
4
+
5
+ module GenesisRuby
6
+ module Api
7
+ module Requests
8
+ module Financial
9
+ module Wallets
10
+ # eWallet transaction that handles different e-wallet providers
11
+ class EWallet < Requests::Base::Financial
12
+
13
+ include Api::Mixins::Requests::AddressInfoAttributes
14
+ include Api::Mixins::Requests::Financial::AsyncAttributes
15
+
16
+ attr_accessor :payment_type
17
+
18
+ # Billing Country custom accessor
19
+ def billing_country
20
+ return nil unless @billing_country
21
+
22
+ @billing_country.to_s.upcase
23
+ end
24
+
25
+ protected
26
+
27
+ # eWallet transaction type
28
+ def transaction_type
29
+ Api::Constants::Transactions::E_WALLET
30
+ end
31
+
32
+ # eWallet field validations
33
+ def init_field_validations # rubocop:disable Metrics/MethodLength
34
+ super
35
+
36
+ required_fields.push *%i[
37
+ transaction_id payment_type return_success_url return_failure_url amount currency billing_country
38
+ ]
39
+
40
+ field_values.merge! currency: 'INR',
41
+ payment_type: Api::Constants::Transactions::Parameters::Wallets::EWallet::
42
+ PaymentTypes.all
43
+
44
+ field_value_dependencies.merge!(
45
+ {
46
+ billing_country: {
47
+ US: %i[billing_state],
48
+ CA: %i[billing_state]
49
+ }
50
+ }
51
+ )
52
+ end
53
+
54
+ # eWallet request structure
55
+ def payment_transaction_structure
56
+ {
57
+ payment_type: payment_type,
58
+ return_success_url: return_success_url,
59
+ return_failure_url: return_failure_url,
60
+ customer_email: customer_email,
61
+ customer_phone: customer_phone,
62
+ billing_address: billing_address_parameters_structure,
63
+ shipping_address: shipping_address_parameters_structure
64
+ }
65
+ end
66
+
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,147 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'genesis_ruby/api/constants/non_financial/alternatives/alipay/merchant_types'
4
+
5
+ module GenesisRuby
6
+ module Api
7
+ module Requests
8
+ module NonFinancial
9
+ module Alternatives
10
+ module Alipay
11
+ # Registers an online-payment merchant in Alipay or updates an existing registration
12
+ class RegisterMerchant < Api::Requests::Base::Versioned
13
+
14
+ include Api::Mixins::Requests::NonFinancial::Alternatives::Alipay::SiteInformationAttributes
15
+
16
+ PHONE_PATTERN = /\A[0-9+\-()]+\z/.freeze
17
+ ALPHANUMERIC_PATTERN = /\A[a-zA-Z0-9]+\z/.freeze
18
+ EMAIL_PATTERN = /\A.+@.+\..+\z/.freeze
19
+ private_constant :PHONE_PATTERN, :ALPHANUMERIC_PATTERN, :EMAIL_PATTERN
20
+
21
+ attr_accessor :merchant_type
22
+ attr_reader :shareholder_id, :shareholder_name, :registration_number, :representative_name,
23
+ :representative_id, :settlement_number, :contact_number, :contact_email,
24
+ :customer_service_number, :customer_service_email
25
+
26
+ # Register Merchant constructor
27
+ def initialize(configuration, _builder_interface = nil)
28
+ super configuration, Builder::JSON
29
+
30
+ self.request_path = 'alipay/register_merchant'
31
+ end
32
+
33
+ # Shareholder ID, max 128 characters
34
+ def shareholder_id=(value)
35
+ restricted_string attribute: __method__, value: value, max: 128
36
+ end
37
+
38
+ # Shareholder name, max 64 characters
39
+ def shareholder_name=(value)
40
+ restricted_string attribute: __method__, value: value, max: 64
41
+ end
42
+
43
+ # Business registration number, max 128 characters
44
+ def registration_number=(value)
45
+ restricted_string attribute: __method__, value: value, max: 128
46
+ end
47
+
48
+ # Legal representative name, max 64 characters
49
+ def representative_name=(value)
50
+ restricted_string attribute: __method__, value: value, max: 64
51
+ end
52
+
53
+ # Legal representative ID, max 128 characters
54
+ def representative_id=(value)
55
+ restricted_string attribute: __method__, value: value, max: 128
56
+ end
57
+
58
+ # Settlement number, letters and digits only, max 64 characters
59
+ def settlement_number=(value)
60
+ restricted_string attribute: __method__, value: value, max: 64, pattern: ALPHANUMERIC_PATTERN
61
+ end
62
+
63
+ # Contact phone number, digits and + - ( ), max 64 characters
64
+ def contact_number=(value)
65
+ restricted_string attribute: __method__, value: value, max: 64, pattern: PHONE_PATTERN
66
+ end
67
+
68
+ # Contact email address, max 128 characters
69
+ def contact_email=(value)
70
+ restricted_string attribute: __method__, value: value, max: 128, pattern: EMAIL_PATTERN
71
+ end
72
+
73
+ # Customer service phone number, digits and + - ( ), max 64 characters
74
+ def customer_service_number=(value)
75
+ restricted_string attribute: __method__, value: value, max: 64, pattern: PHONE_PATTERN
76
+ end
77
+
78
+ # Customer service email address, max 128 characters
79
+ def customer_service_email=(value)
80
+ restricted_string attribute: __method__, value: value, max: 128, pattern: EMAIL_PATTERN
81
+ end
82
+
83
+ protected
84
+
85
+ # Append the terminal token to the versioned gateway URL
86
+ def init_configuration
87
+ super
88
+
89
+ init_api_gateway_configuration request_path: "#{version}/#{request_path}", include_token: true
90
+ end
91
+
92
+ # Register Merchant field validations
93
+ def init_field_validations
94
+ super
95
+
96
+ merchant_types = Constants::NonFinancial::Alternatives::Alipay::MerchantTypes
97
+
98
+ required_fields.push *%i[merchant_type site_information_type site_information_url contact_number]
99
+
100
+ field_values.merge! merchant_type: merchant_types.all
101
+ field_values.merge! site_information_field_validations
102
+
103
+ field_value_dependencies.merge! merchant_type: {
104
+ merchant_types::ENTERPRISE => %i[shareholder_id shareholder_name registration_number],
105
+ merchant_types::INDIVIDUAL => %i[representative_name representative_id]
106
+ }
107
+ end
108
+
109
+ # Register Merchant request structure
110
+ def request_structure # rubocop:disable Metrics/MethodLength
111
+ {
112
+ merchant_type: merchant_type,
113
+ site_information: site_information_structure,
114
+ shareholder_id: shareholder_id,
115
+ shareholder_name: shareholder_name,
116
+ registration_number: registration_number,
117
+ representative_name: representative_name,
118
+ representative_id: representative_id,
119
+ settlement_number: settlement_number,
120
+ contact_number: contact_number,
121
+ contact_email: contact_email,
122
+ customer_service_number: customer_service_number,
123
+ customer_service_email: customer_service_email
124
+ }
125
+ end
126
+
127
+ private
128
+
129
+ # Store nil for empty input, otherwise validate the format first and the length last,
130
+ # so that a failed assignment keeps the previous value
131
+ def restricted_string(attribute:, value:, max:, pattern: nil)
132
+ return assign_instance_variable attribute, nil if value.to_s.empty?
133
+
134
+ if pattern && !pattern.match?(value.to_s)
135
+ raise InvalidArgumentError, "Invalid value for #{attribute.to_s.chomp("=")}! Invalid format."
136
+ end
137
+
138
+ limited_string attribute: attribute, value: value.to_s, max: max
139
+ end
140
+
141
+ end
142
+ end
143
+ end
144
+ end
145
+ end
146
+ end
147
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/' \
4
+ 'enhanced_statement_response_fields'
5
+ require 'genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/statement_order_by_fields'
6
+ require 'genesis_ruby/api/requests/base/non_financial/billing_api/abstract_statement'
7
+
8
+ module GenesisRuby
9
+ module Api
10
+ module Requests
11
+ module NonFinancial
12
+ module BillingApi
13
+ # Enhanced Billing Statements API request
14
+ class EnhancedStatement < Base::NonFinancial::BillingApi::AbstractStatement
15
+
16
+ def initialize(configuration, _builder_interface = nil)
17
+ super configuration
18
+
19
+ self.root_key = 'query'
20
+ self.request_name = 'enhancedBillingStatements'
21
+ self.request_path = 'billing_statements'
22
+ end
23
+
24
+ protected
25
+
26
+ # GraphQL query name targeted by the request
27
+ def request_name
28
+ 'enhancedBillingStatements'
29
+ end
30
+
31
+ # Allowed top-level response fields (includes pricingMethod)
32
+ def allowed_response_fields
33
+ Api::Constants::Transactions::Parameters::NonFinancial::BillingApi::EnhancedStatementResponseFields
34
+ end
35
+
36
+ # Allowed order-by fields (shared with the standard statement request)
37
+ def allowed_order_by_fields
38
+ Api::Constants::Transactions::Parameters::NonFinancial::BillingApi::StatementOrderByFields
39
+ end
40
+
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end