genesis_ruby 0.2.3 → 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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +40 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +40 -0
  5. data/VERSION +1 -1
  6. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/externally_processed.rb +22 -0
  7. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/processing_type.rb +22 -0
  8. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/sca_exemptions.rb +25 -0
  9. data/lib/genesis_ruby/api/constants/transactions/parameters/online_banking/iframe_targets.rb +26 -0
  10. data/lib/genesis_ruby/api/mixins/requests/financial/beneficiary_attributes.rb +38 -0
  11. data/lib/genesis_ruby/api/mixins/requests/financial/customer_account_attributes.rb +21 -0
  12. data/lib/genesis_ruby/api/mixins/requests/financial/online_banking_payments/payer_attributes.rb +65 -0
  13. data/lib/genesis_ruby/api/mixins/requests/non_financial/mode_attributes.rb +24 -0
  14. data/lib/genesis_ruby/api/mixins/requests/non_financial/tokenization/card_data_attributes.rb +62 -0
  15. data/lib/genesis_ruby/api/mixins/requests/non_financial/tokenization/token_attributes.rb +23 -0
  16. data/lib/genesis_ruby/api/mixins/requests/non_financial/tokenization/tokenization_attributes.rb +51 -0
  17. data/lib/genesis_ruby/api/requests/base/consumer.rb +24 -0
  18. data/lib/genesis_ruby/api/requests/base/financial.rb +10 -1
  19. data/lib/genesis_ruby/api/requests/base/financials/credit_card.rb +5 -7
  20. data/lib/genesis_ruby/api/requests/base/financials/south_american_payments.rb +11 -14
  21. data/lib/genesis_ruby/api/requests/base/reference.rb +2 -1
  22. data/lib/genesis_ruby/api/requests/financial/cards/bancontact.rb +8 -9
  23. data/lib/genesis_ruby/api/requests/financial/cash_payments/cash.rb +13 -14
  24. data/lib/genesis_ruby/api/requests/financial/cash_payments/pix.rb +23 -25
  25. data/lib/genesis_ruby/api/requests/financial/mobile/apple_pay.rb +18 -20
  26. data/lib/genesis_ruby/api/requests/financial/mobile/google_pay.rb +20 -24
  27. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/banco_do_brasil.rb +11 -14
  28. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/eps.rb +9 -10
  29. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/idebit/pay_in.rb +11 -18
  30. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/insta_debit/pay_in.rb +61 -0
  31. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/insta_debit/pay_out.rb +24 -0
  32. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/multibanco.rb +48 -0
  33. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/my_bank.rb +47 -0
  34. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/online_banking/pay_in.rb +17 -18
  35. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/online_banking/pay_out.rb +33 -38
  36. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/pay_u.rb +61 -0
  37. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/post_finance.rb +53 -0
  38. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/safety_pay.rb +57 -0
  39. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/sofort.rb +63 -0
  40. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/trustly_sale.rb +75 -0
  41. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/upi.rb +54 -0
  42. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/wechat.rb +11 -14
  43. data/lib/genesis_ruby/api/requests/financial/sdd/sale.rb +13 -17
  44. data/lib/genesis_ruby/api/requests/financial/void.rb +12 -5
  45. data/lib/genesis_ruby/api/requests/financial/wallets/alipay.rb +10 -13
  46. data/lib/genesis_ruby/api/requests/financial/wallets/pay_pal.rb +18 -20
  47. data/lib/genesis_ruby/api/requests/non_financial/consumers/create.rb +44 -0
  48. data/lib/genesis_ruby/api/requests/non_financial/consumers/disable.rb +40 -0
  49. data/lib/genesis_ruby/api/requests/non_financial/consumers/enable.rb +40 -0
  50. data/lib/genesis_ruby/api/requests/non_financial/consumers/get_cards.rb +40 -0
  51. data/lib/genesis_ruby/api/requests/non_financial/consumers/retrieve.rb +40 -0
  52. data/lib/genesis_ruby/api/requests/non_financial/consumers/update.rb +45 -0
  53. data/lib/genesis_ruby/api/requests/non_financial/fraud/retrieval/date_range.rb +81 -0
  54. data/lib/genesis_ruby/api/requests/non_financial/fraud/retrieval/transaction.rb +52 -0
  55. data/lib/genesis_ruby/api/requests/non_financial/processed_transactions/date_range.rb +68 -0
  56. data/lib/genesis_ruby/api/requests/non_financial/processed_transactions/post_date_range.rb +72 -0
  57. data/lib/genesis_ruby/api/requests/non_financial/processed_transactions/transaction.rb +48 -0
  58. data/lib/genesis_ruby/api/requests/non_financial/sca/checker.rb +77 -0
  59. data/lib/genesis_ruby/api/requests/non_financial/tokenization/cryptogram.rb +43 -0
  60. data/lib/genesis_ruby/api/requests/non_financial/tokenization/delete_token.rb +43 -0
  61. data/lib/genesis_ruby/api/requests/non_financial/tokenization/detokenize.rb +43 -0
  62. data/lib/genesis_ruby/api/requests/non_financial/tokenization/get_card.rb +43 -0
  63. data/lib/genesis_ruby/api/requests/non_financial/tokenization/tokenize.rb +45 -0
  64. data/lib/genesis_ruby/api/requests/non_financial/tokenization/update_token.rb +45 -0
  65. data/lib/genesis_ruby/api/requests/non_financial/tokenization/validate_token.rb +43 -0
  66. data/lib/genesis_ruby/dependencies.rb +1 -0
  67. data/lib/genesis_ruby/utils/formatters/response/formats/timestamp.rb +1 -1
  68. data/lib/genesis_ruby/version.rb +1 -1
  69. metadata +43 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f03e064990c5ab2c2f8d128db6cdda17ffb306ab6b945dbec7e66e28c9a40ebc
4
- data.tar.gz: 8aadefd87afbfb72e608fa702161a0ec5653397cc2a3e31f480004d631ae8985
3
+ metadata.gz: 9072aff1c90817e3c33b33fb2edb13dd233eb1215a431ea48929f04097f0bb0b
4
+ data.tar.gz: 3799ea143d2abddaf7c8afded420e332a60ceeef1218c839483575428c735eda
5
5
  SHA512:
6
- metadata.gz: bdee942af8926d926df609438829638c0bf71b404e03b85e9614e30e252d11a300f268aa6d12936ce19403898292556c631a3e05043941b30a6701378a6d4a0c
7
- data.tar.gz: 2f2bcfd52842fdf936589908a8d82b6dc97bfd928363cf663a83eebc6d2dad40067e6de916150428c919d6f9cd4ec195a9487ecc41b8626d0173726f204b6a09
6
+ metadata.gz: ed1030a2956b575dc61ff111e07bc89f45b78a61c33c2d8ae5b0278c350313c1308fec9c046e2bcb59a33e4b258b765ca49761f052fa10ce95d5514f40d6379e
7
+ data.tar.gz: 6efa9c63b505b4c5ab09518e12db4e68131e93e203c964bf20b57263c2569d67ef5fb72acf0c742fbe9027783bae64d891a43cd58d79de4af25bae71a738814b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,43 @@
1
+ 0.2.4
2
+ -----
3
+ **Features**:
4
+
5
+ * Added Tokenization API support:
6
+ * Tokenize
7
+ * Detokenize
8
+ * Token
9
+ * Cryptogram
10
+ * Validate token
11
+ * Delete token
12
+ * Get Card
13
+ * Added Payer attributes support to Bank Payout
14
+ * Added Beneficiary attributes support to PIX transaction request
15
+ * Added Processed Transactions API support:
16
+ * Single Processed Transaction
17
+ * By Date Range
18
+ * Post By Date Range
19
+ * Added SCA Checker API support
20
+ * Added Retrieval API support:
21
+ * Single Retrieval
22
+ * List of Retrievals
23
+ * By Date Range
24
+ * Added Consumer API support:
25
+ * Create
26
+ * Retrieve
27
+ * Update
28
+ * Disable
29
+ * Enable
30
+ * Get Consumer Cards
31
+ * Added PayU transaction request support
32
+ * Added Post Finance transaction request support
33
+ * Added SafetyPay transaction request support
34
+ * Added TrustlySale transaction request support
35
+ * Added MyBank transaction request support
36
+ * Added InstaDebit transaction request support
37
+ * Added UPI transaction request support
38
+ * Added Sofort transaction request support
39
+ * Added Multibanco transaction request support
40
+
1
41
  0.2.3
2
42
  -----
3
43
  **Features**:
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- genesis_ruby (0.2.3)
4
+ genesis_ruby (0.2.4)
5
5
  net-http (~> 0.3.2)
6
6
  nokogiri (~> 1.14)
7
7
 
data/README.md CHANGED
@@ -1038,9 +1038,17 @@ GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::Bradesco
1038
1038
  GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::Davivienda
1039
1039
  GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::Eps
1040
1040
  GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::Itau
1041
+ GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::Multibanco
1042
+ GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::PayU
1043
+ GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::PostFinance
1044
+ GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::MyBank
1041
1045
  GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::Pse
1042
1046
  GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::RapiPago
1047
+ GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::SafetyPay
1043
1048
  GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::Santander
1049
+ GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::TrustlySale
1050
+ GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::Upi
1051
+ GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::Sofort
1044
1052
  GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::Webpay
1045
1053
  GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::Wechat
1046
1054
  # PayIn
@@ -1050,6 +1058,9 @@ GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::OnlineBanking::Pay
1050
1058
  # iDebit
1051
1059
  GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::Idebit::PayIn
1052
1060
  GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::Idebit::PayOut
1061
+ # InstaDebit
1062
+ GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::InstaDebit::PayIn
1063
+ GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::InstaDebit::PayOut
1053
1064
 
1054
1065
  # SDD
1055
1066
  GenesisRuby::Api::Requests::Financial::Sdd::Sale
@@ -1073,6 +1084,35 @@ GenesisRuby::Api::Requests::NonFinancial::Installments::Fetch
1073
1084
  ## Billing API
1074
1085
  GenesisRuby::Api::Requests::NonFinancial::BillingApi::Transactions
1075
1086
 
1087
+ ## Consumer API
1088
+ GenesisRuby::Api::Requests::NonFinancial::Consumers::Create
1089
+ GenesisRuby::Api::Requests::NonFinancial::Consumers::Retrieve
1090
+ GenesisRuby::Api::Requests::NonFinancial::Consumers::Update
1091
+ GenesisRuby::Api::Requests::NonFinancial::Consumers::Disable
1092
+ GenesisRuby::Api::Requests::NonFinancial::Consumers::Enable
1093
+ GenesisRuby::Api::Requests::NonFinancial::Consumers::GetCards
1094
+
1095
+ ## Retrieval API
1096
+ GenesisRuby::Api::Requests::NonFinancial::Fraud::Retrieval::Transaction
1097
+ GenesisRuby::Api::Requests::NonFinancial::Fraud::Retrieval::DateRange
1098
+
1099
+ ## SCA API
1100
+ GenesisRuby::Api::Requests::NonFinancial::Sca::Checker
1101
+
1102
+ ## Processed Transaction API
1103
+ GenesisRuby::Api::Requests::NonFinancial::ProcessedTransactions::Transaction
1104
+ GenesisRuby::Api::Requests::NonFinancial::ProcessedTransactions::DateRange
1105
+ GenesisRuby::Api::Requests::NonFinancial::ProcessedTransactions::PostDateRange
1106
+
1107
+ ## Tokenization API
1108
+ GenesisRuby::Api::Requests::NonFinancial::Tokenization::Tokenize
1109
+ GenesisRuby::Api::Requests::NonFinancial::Tokenization::Detokenize
1110
+ GenesisRuby::Api::Requests::NonFinancial::Tokenization::UpdateToken
1111
+ GenesisRuby::Api::Requests::NonFinancial::Tokenization::Cryptogram
1112
+ GenesisRuby::Api::Requests::NonFinancial::Tokenization::ValidateToken
1113
+ GenesisRuby::Api::Requests::NonFinancial::Tokenization::DeleteToken
1114
+ GenesisRuby::Api::Requests::NonFinancial::Tokenization::GetCard
1115
+
1076
1116
  ```
1077
1117
 
1078
1118
  ### Manual initialization
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.2.4
@@ -0,0 +1,22 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Constants
4
+ module Transactions
5
+ module Parameters
6
+ module NonFinancial
7
+ # Filter requests by being externally processed or being native to Genesis
8
+ class ExternallyProcessed
9
+
10
+ extend Mixins::Constants::Common
11
+
12
+ GENESIS = 'genesis'.freeze
13
+ EXTERNAL = 'external'.freeze
14
+ ALL = 'all'.freeze
15
+
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Constants
4
+ module Transactions
5
+ module Parameters
6
+ module NonFinancial
7
+ # Filter requests by being card present or card not present
8
+ class ProcessingType
9
+
10
+ extend Mixins::Constants::Common
11
+
12
+ CARD_PRESENT = 'card_present'.freeze
13
+ CARD_NOT_PRESENT = 'card_not_present'.freeze
14
+ ALL = 'all'.freeze
15
+
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,25 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Constants
4
+ module Transactions
5
+ module Parameters
6
+ module NonFinancial
7
+ # SCA Exemption Values
8
+ class ScaExemptions
9
+
10
+ extend Mixins::Constants::Common
11
+
12
+ LOW_VALUE = 'low_value'.freeze
13
+ LOW_RISK = 'low_risk'.freeze
14
+ TRUSTED_MERCHANT = 'trusted_merchant'.freeze
15
+ CORPORATE_PAYMENT = 'corporate_payment'.freeze
16
+ DELEGATED_AUTHENTICATION = 'delegated_authentication'.freeze
17
+ AUTH_NETWORK_OUTAGE = 'auth_network_outage'.freeze
18
+
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Constants
4
+ module Transactions
5
+ module Parameters
6
+ module OnlineBanking
7
+ # Return URL Target attributes
8
+ class IframeTargets
9
+
10
+ extend Api::Mixins::Constants::Common
11
+
12
+ # URL target for successful payment in Trustly iFrame.
13
+ # Self
14
+ SELF = 'self'.freeze
15
+ # Parent
16
+ PARENT = 'parent'.freeze
17
+ # Top
18
+ TOP = 'TOP'.freeze
19
+
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,38 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Mixins
4
+ module Requests
5
+ module Financial
6
+ # The beneficiary parameters attributes
7
+ module BeneficiaryAttributes
8
+
9
+ attr_accessor :beneficiary_name
10
+ attr_reader :beneficiary_document_id, :beneficiary_pix_key
11
+
12
+ # The Document ID of the beneficiary, such as CPF or CNPJ for Brazilian entities
13
+ def beneficiary_document_id=(value)
14
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 14
15
+ end
16
+
17
+ # The PIX key associated with the beneficiary
18
+ def beneficiary_pix_key=(value)
19
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 36
20
+ end
21
+
22
+ protected
23
+
24
+ # Beneficiary parameters structure
25
+ def beneficiary_parameters_structure
26
+ {
27
+ name: beneficiary_name,
28
+ document_id: beneficiary_document_id,
29
+ pix_key: beneficiary_pix_key
30
+ }
31
+ end
32
+
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,21 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Mixins
4
+ module Requests
5
+ module Financial
6
+ # Customer Account Attributes
7
+ module CustomerAccountAttributes
8
+
9
+ attr_reader :customer_account_id
10
+
11
+ # Customer account id parameter validation
12
+ def customer_account_id=(value)
13
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 20
14
+ end
15
+
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,65 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Mixins
4
+ module Requests
5
+ module Financial
6
+ module OnlineBankingPayments
7
+ # Payer attributes
8
+ module PayerAttributes
9
+
10
+ attr_reader :payer_document_id, :payer_bank_code, :payer_bank_account_number,
11
+ :payer_bank_branch, :payer_bank_account_verification_digit,
12
+ :payer_bank_phone_number
13
+
14
+ # Payer document ID
15
+ def payer_document_id=(value)
16
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 16
17
+ end
18
+
19
+ # The bank code used to process the transaction
20
+ def payer_bank_code=(value)
21
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 12
22
+ end
23
+
24
+ # The payer's bank account number
25
+ def payer_bank_account_number=(value)
26
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 33
27
+ end
28
+
29
+ # The name of the bank branch where the account is held
30
+ def payer_bank_branch=(value)
31
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 11
32
+ end
33
+
34
+ # Single digit verification code assigned by the external provider,
35
+ # used to validate the bank account
36
+ def payer_bank_account_verification_digit=(value)
37
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 1
38
+ end
39
+
40
+ # The payer's bank contact phone number
41
+ def payer_bank_phone_number=(value)
42
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 11
43
+ end
44
+
45
+ protected
46
+
47
+ # Payer parameters structure
48
+ def payer_parameters_structure
49
+ {
50
+ document_id: payer_document_id,
51
+ bank_code: payer_bank_code,
52
+ bank_account_number: payer_bank_account_number,
53
+ bank_branch: payer_bank_branch,
54
+ bank_account_verification_digit: payer_bank_account_verification_digit,
55
+ bank_phone_number: payer_bank_phone_number
56
+ }
57
+ end
58
+
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,24 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Mixins
4
+ module Requests
5
+ module NonFinancial
6
+ # Mode Attributes mixin
7
+ module ModeAttributes
8
+
9
+ attr_reader :mode
10
+
11
+ # Mode
12
+ def mode=(value)
13
+ allowed_options attribute: __method__,
14
+ allowed: %w(list),
15
+ value: value.to_s.downcase,
16
+ allow_empty: true
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,62 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Mixins
4
+ module Requests
5
+ module NonFinancial
6
+ module Tokenization
7
+ # Card Data Attributes mixin
8
+ module CardDataAttributes
9
+
10
+ attr_accessor :card_holder
11
+ attr_reader :card_number, :expiration_month, :expiration_year
12
+
13
+ # Complete credit/debit card number of customer
14
+ def card_number=(value)
15
+ limited_string attribute: __method__, value: value.to_s, min: 13, max: 19
16
+ end
17
+
18
+ # Expiration month as printed on credit card
19
+ def expiration_month=(value)
20
+ error_message = format(
21
+ 'Invalid value "%{value}" given for %{attribute}, should be in MM format',
22
+ value: value,
23
+ attribute: __method__
24
+ )
25
+
26
+ raise GenesisRuby::ParameterError, error_message unless value.nil? || value =~ /^(0[1-9]|1[0-2])$/
27
+
28
+ @expiration_month = value
29
+ end
30
+
31
+ # Expiration year as printed on credit card
32
+ def expiration_year=(value)
33
+ error_message = format(
34
+ 'Invalid value "%{value}" given for %{attribute}, should be in YYYY format',
35
+ value: value,
36
+ attribute: __method__
37
+ )
38
+
39
+ raise GenesisRuby::ParameterError, error_message unless value.nil? || value =~ /^(20)\d{2}$/
40
+
41
+ @expiration_year = value
42
+ end
43
+
44
+ protected
45
+
46
+ # Card Data Attributes Structure
47
+ def card_data_attributes_structure
48
+ {
49
+ card_number: card_number,
50
+ card_holder: card_holder,
51
+ expiration_month: expiration_month,
52
+ expiration_year: expiration_year
53
+ }
54
+ end
55
+
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,23 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Mixins
4
+ module Requests
5
+ module NonFinancial
6
+ module Tokenization
7
+ # Token Attributes mixin
8
+ module TokenAttributes
9
+
10
+ attr_reader :token
11
+
12
+ # Plain-text token value
13
+ def token=(value)
14
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 36
15
+ end
16
+
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,51 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Mixins
4
+ module Requests
5
+ module NonFinancial
6
+ module Tokenization
7
+ # Common Tokenization API Attributes mixin
8
+ module TokenizationAttributes
9
+
10
+ attr_accessor :token_type
11
+ attr_reader :consumer_id, :email
12
+
13
+ # Consumer unique reference
14
+ def consumer_id=(value)
15
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 10
16
+ end
17
+
18
+ # Consumer e-mail address
19
+ def email=(value)
20
+ error_message = format(
21
+ 'Invalid value given for %{attribute}',
22
+ attribute: __method__
23
+ )
24
+
25
+ raise GenesisRuby::ParameterError, error_message unless value.nil? || value =~ /\A.+@.+\..+\Z/
26
+
27
+ @email = value
28
+ end
29
+
30
+ protected
31
+
32
+ def tokenization_required_fields
33
+ %i[consumer_id email token_type]
34
+ end
35
+
36
+ # Tokenization Attributes Structure
37
+ def tokenization_attributes_structure
38
+ {
39
+ consumer_id: consumer_id,
40
+ email: email,
41
+ token_type: token_type
42
+ }
43
+ end
44
+
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,24 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module Base
5
+ # Consumers API base request class
6
+ class Consumer < Versioned
7
+
8
+ def initialize(configuration, builder_interface = Builder::XML)
9
+ super configuration, builder_interface
10
+ end
11
+
12
+ protected
13
+
14
+ def populate_structure
15
+ super
16
+
17
+ @tree_structure = Hash["#{request_path}_request", request_structure]
18
+ end
19
+
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -6,6 +6,7 @@ module GenesisRuby
6
6
  class Financial < Request
7
7
 
8
8
  include Mixins::Requests::Financial::BaseAttributes
9
+ include Mixins::Requests::Financial::PaymentAttributes
9
10
 
10
11
  # Use Smart Router endpoint for the current request
11
12
  def use_smart_router
@@ -48,6 +49,7 @@ module GenesisRuby
48
49
  super
49
50
  end
50
51
 
52
+ # Populate the request structure
51
53
  def populate_structure
52
54
  self.tree_structure = {
53
55
  payment_transaction: {
@@ -55,7 +57,7 @@ module GenesisRuby
55
57
  transaction_id: transaction_id,
56
58
  usage: usage,
57
59
  remote_ip: remote_ip
58
- }.merge(payment_transaction_structure)
60
+ }.merge(payment_attributes_structure, payment_transaction_structure)
59
61
  }
60
62
  end
61
63
 
@@ -64,6 +66,13 @@ module GenesisRuby
64
66
  api_config.url = build_request_url({ subdomain: 'smart_router', path: 'transactions' })
65
67
  end
66
68
 
69
+ # Initialize Financial class validations
70
+ def init_field_validations
71
+ super
72
+
73
+ field_values.merge! currency: Api::Constants::Currencies::Iso4217.all.map(&:upcase)
74
+ end
75
+
67
76
  end
68
77
  end
69
78
  end
@@ -11,7 +11,6 @@ module GenesisRuby
11
11
  include Mixins::Requests::Financial::Cards::CreditCardAttributes
12
12
  include Mixins::Requests::Financial::Cards::TokenizationAttributes
13
13
  include Mixins::Requests::Financial::Cards::UcofAttributes
14
- include Mixins::Requests::Financial::PaymentAttributes
15
14
 
16
15
  attr_reader :scheme_tokenized
17
16
 
@@ -29,17 +28,16 @@ module GenesisRuby
29
28
 
30
29
  # Request Field validations
31
30
  def init_field_validations
31
+ super
32
+
32
33
  required_fields.push *%i[transaction_id amount currency]
33
- field_values.merge!(
34
- { currency: Api::Constants::Currencies::Iso4217.all.map(&:upcase) },
35
- credential_on_file_field_validations
36
- )
34
+ field_values.merge! credential_on_file_field_validations
37
35
  end
38
36
 
39
37
  # Credit Card attributes
40
38
  def payment_transaction_structure
41
- payment_attributes_structure.merge(
42
- credit_card_attributes_structure, tokenization_attributes_structure,
39
+ credit_card_attributes_structure.merge(
40
+ tokenization_attributes_structure,
43
41
  {
44
42
  account_owner: account_owner_attributes_structure,
45
43
  credential_on_file: credential_on_file,
@@ -9,7 +9,6 @@ module GenesisRuby
9
9
  include Api::Mixins::Requests::AddressInfoAttributes
10
10
  include Api::Mixins::Requests::Financial::AsyncAttributes
11
11
  include Api::Mixins::Requests::BirthDateAttributes
12
- include Api::Mixins::Requests::Financial::PaymentAttributes
13
12
  include Api::Mixins::Requests::Financial::ConsumerIdentifierAttributes
14
13
 
15
14
  # Billing Country custom accessor
@@ -36,19 +35,17 @@ module GenesisRuby
36
35
  end
37
36
 
38
37
  # South American payments
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
- consumer_reference: consumer_reference,
45
- national_id: national_id,
46
- birth_date: birth_date,
47
- customer_email: customer_email,
48
- billing_address: billing_address_parameters_structure,
49
- shipping_address: shipping_address_parameters_structure
50
- }
51
- )
38
+ def payment_transaction_structure
39
+ {
40
+ return_success_url: return_success_url,
41
+ return_failure_url: return_failure_url,
42
+ consumer_reference: consumer_reference,
43
+ national_id: national_id,
44
+ birth_date: birth_date,
45
+ customer_email: customer_email,
46
+ billing_address: billing_address_parameters_structure,
47
+ shipping_address: shipping_address_parameters_structure
48
+ }
52
49
  end
53
50
 
54
51
  end
@@ -11,8 +11,9 @@ module GenesisRuby
11
11
  protected
12
12
 
13
13
  def init_field_validations
14
+ super
15
+
14
16
  required_fields.push *%i[transaction_id reference_id amount currency]
15
- field_values.merge! currency: Api::Constants::Currencies::Iso4217.all.map(&:upcase)
16
17
  end
17
18
 
18
19
  # Reference transaction request structure