genesis_ruby 0.2.4 → 0.2.5
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 +38 -0
- data/Gemfile.lock +14 -14
- data/README.md +38 -0
- data/VERSION +1 -1
- data/lib/genesis_ruby/api/constants/currencies/iso4217.rb +6 -0
- data/lib/genesis_ruby/api/constants/non_financial/kyc/document_types.rb +49 -0
- data/lib/genesis_ruby/api/constants/non_financial/kyc/genders.rb +22 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/african_mobile_operators.rb +37 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/customer_identification/customer_identification_owner.rb +24 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/customer_identification/customer_identification_subtype.rb +24 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/customer_identification/customer_identification_type.rb +63 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/digital_asset_types.rb +31 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/purpose_of_payment.rb +136 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/source_of_funds.rb +34 -0
- data/lib/genesis_ruby/api/mixins/requests/digital_asset_type_attributes.rb +26 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/african_mobile_attributes.rb +30 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/tokenization_params_attributes.rb +36 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/customer_identification_attributes.rb +82 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/gift_cards_attributes.rb +26 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/preauthorization_attributes.rb +25 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/purpose_of_payment_attributes.rb +29 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/source_of_funds_attributes.rb +38 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/travel_data/airline_itinerary_attributes.rb +1 -1
- data/lib/genesis_ruby/api/mixins/requests/non_financial/fx/id_attributes.rb +28 -0
- data/lib/genesis_ruby/api/mixins/requests/non_financial/fx/tier_id_attributes.rb +28 -0
- data/lib/genesis_ruby/api/mixins/requests/non_financial/kyc/customer_information_attributes.rb +62 -0
- data/lib/genesis_ruby/api/request.rb +7 -0
- data/lib/genesis_ruby/api/requests/base/financials/credit_card.rb +4 -2
- data/lib/genesis_ruby/api/requests/base/non_financial/kyc/base.rb +33 -0
- data/lib/genesis_ruby/api/requests/base/reference.rb +1 -2
- data/lib/genesis_ruby/api/requests/financial/Preauthorizations/incremental_authorize.rb +24 -0
- data/lib/genesis_ruby/api/requests/financial/cards/authorize.rb +5 -1
- data/lib/genesis_ruby/api/requests/financial/cards/authorize3d.rb +5 -1
- data/lib/genesis_ruby/api/requests/financial/cards/credit.rb +39 -0
- data/lib/genesis_ruby/api/requests/financial/cards/payout.rb +72 -0
- data/lib/genesis_ruby/api/requests/financial/cards/sale.rb +3 -1
- data/lib/genesis_ruby/api/requests/financial/cards/sale3d.rb +3 -1
- data/lib/genesis_ruby/api/requests/financial/crypto/bit_pay/payout.rb +52 -0
- data/lib/genesis_ruby/api/requests/financial/crypto/bit_pay/refund.rb +36 -0
- data/lib/genesis_ruby/api/requests/financial/crypto/bit_pay/sale.rb +55 -0
- data/lib/genesis_ruby/api/requests/financial/gift_cards/fashioncheque.rb +47 -0
- data/lib/genesis_ruby/api/requests/financial/gift_cards/intersolve.rb +46 -0
- data/lib/genesis_ruby/api/requests/financial/gift_cards/tcs.rb +47 -0
- data/lib/genesis_ruby/api/requests/financial/mobile/african_mobile_sale.rb +81 -0
- data/lib/genesis_ruby/api/requests/financial/mobile/russian_mobile_sale.rb +55 -0
- data/lib/genesis_ruby/api/requests/financial/vouchers/neosurf.rb +61 -0
- data/lib/genesis_ruby/api/requests/non_financial/fraud/chargeback/date_range.rb +82 -0
- data/lib/genesis_ruby/api/requests/non_financial/fraud/chargeback/transaction.rb +52 -0
- data/lib/genesis_ruby/api/requests/non_financial/fraud/reports/date_range.rb +108 -0
- data/lib/genesis_ruby/api/requests/non_financial/fraud/reports/transaction.rb +52 -0
- data/lib/genesis_ruby/api/requests/non_financial/fx/get_rate.rb +55 -0
- data/lib/genesis_ruby/api/requests/non_financial/fx/get_rates.rb +53 -0
- data/lib/genesis_ruby/api/requests/non_financial/fx/get_tier.rb +53 -0
- data/lib/genesis_ruby/api/requests/non_financial/fx/get_tiers.rb +35 -0
- data/lib/genesis_ruby/api/requests/non_financial/fx/search_rate.rb +61 -0
- data/lib/genesis_ruby/api/requests/non_financial/kyc/consumer_registration/create.rb +99 -0
- data/lib/genesis_ruby/api/requests/non_financial/tokenization/cryptogram.rb +5 -2
- data/lib/genesis_ruby/api/requests/wpf/create.rb +3 -1
- data/lib/genesis_ruby/configuration.rb +4 -0
- data/lib/genesis_ruby/dependencies.rb +1 -0
- data/lib/genesis_ruby/utils/country.rb +272 -0
- data/lib/genesis_ruby/utils/money/conversions/amount_to_exponent.rb +1 -4
- data/lib/genesis_ruby/version.rb +1 -1
- metadata +46 -2
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'genesis_ruby/api/requests/base/financials/credit_card'
|
2
|
+
|
3
|
+
module GenesisRuby
|
4
|
+
module Api
|
5
|
+
module Requests
|
6
|
+
module Financial
|
7
|
+
module Cards
|
8
|
+
# Payouts are credits without a reference transaction and as such are highly regulated
|
9
|
+
# and need specific gateway terminal configuration
|
10
|
+
class Payout < Requests::Base::Financials::CreditCard
|
11
|
+
|
12
|
+
include Mixins::Requests::AddressInfoAttributes
|
13
|
+
include Mixins::Requests::BirthDateAttributes
|
14
|
+
include Mixins::Requests::DigitalAssetTypeAttributes
|
15
|
+
include Mixins::Requests::DocumentAttributes
|
16
|
+
include Mixins::Requests::Financial::Cards::FxRateAttributes
|
17
|
+
include Mixins::Requests::Financial::CryptoAttributes
|
18
|
+
include Mixins::Requests::Financial::CustomerIdentificationAttributes
|
19
|
+
include Mixins::Requests::Financial::DynamicDescriptorAttributes
|
20
|
+
include Mixins::Requests::Financial::GamingAttributes
|
21
|
+
include Mixins::Requests::Financial::MotoAttributes
|
22
|
+
include Mixins::Requests::Financial::PurposeOfPaymentAttributes
|
23
|
+
include Mixins::Requests::Financial::SourceOfFundsAttributes
|
24
|
+
|
25
|
+
protected
|
26
|
+
|
27
|
+
# Payout Transaction Type
|
28
|
+
def transaction_type
|
29
|
+
GenesisRuby::Api::Constants::Transactions::PAYOUT
|
30
|
+
end
|
31
|
+
|
32
|
+
# Payout Field validations
|
33
|
+
def init_field_validations
|
34
|
+
super
|
35
|
+
|
36
|
+
required_fields.push *%i[card_holder card_number expiration_month expiration_year]
|
37
|
+
|
38
|
+
field_value_dependencies.merge! required_tokenization_fields_conditional
|
39
|
+
end
|
40
|
+
|
41
|
+
# Payout request structure
|
42
|
+
def payment_transaction_structure # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
43
|
+
super.delete(:credential_on_file_settlement_date)
|
44
|
+
super.delete(:scheme_tokenized)
|
45
|
+
|
46
|
+
super.merge(
|
47
|
+
source_of_funds_attributes_structure,
|
48
|
+
{
|
49
|
+
gaming: gaming,
|
50
|
+
moto: moto,
|
51
|
+
crypto: crypto,
|
52
|
+
digital_asset_type: digital_asset_type,
|
53
|
+
purpose_of_payment: purpose_of_payment,
|
54
|
+
customer_email: customer_email,
|
55
|
+
customer_phone: customer_phone,
|
56
|
+
birth_date: birth_date,
|
57
|
+
document_id: document_id,
|
58
|
+
fx_rate_id: fx_rate_id,
|
59
|
+
billing_address: billing_address_parameters_structure,
|
60
|
+
shipping_address: shipping_address_parameters_structure,
|
61
|
+
customer_identification: customer_identification_attributes_structure,
|
62
|
+
dynamic_descriptor_params: dynamic_descriptor_structure
|
63
|
+
}
|
64
|
+
)
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -9,6 +9,7 @@ module GenesisRuby
|
|
9
9
|
class Sale < Requests::Base::Financials::CreditCard
|
10
10
|
|
11
11
|
include Mixins::Requests::AddressInfoAttributes
|
12
|
+
include Mixins::Requests::DigitalAssetTypeAttributes
|
12
13
|
include Mixins::Requests::DocumentAttributes
|
13
14
|
include Mixins::Requests::Financial::Business::BusinessAttributes
|
14
15
|
include Mixins::Requests::Financial::Cards::FxRateAttributes
|
@@ -70,7 +71,8 @@ module GenesisRuby
|
|
70
71
|
travel: travel_data_attributes_structure,
|
71
72
|
funding: funding_attributes_structure,
|
72
73
|
installment_plan_id: installment_plan_id,
|
73
|
-
installment_plan_reference: installment_plan_reference
|
74
|
+
installment_plan_reference: installment_plan_reference,
|
75
|
+
digital_asset_type: digital_asset_type
|
74
76
|
)
|
75
77
|
end
|
76
78
|
|
@@ -9,6 +9,7 @@ module GenesisRuby
|
|
9
9
|
class Sale3d < Requests::Base::Financials::CreditCard
|
10
10
|
|
11
11
|
include Mixins::Requests::AddressInfoAttributes
|
12
|
+
include Mixins::Requests::DigitalAssetTypeAttributes
|
12
13
|
include Mixins::Requests::DocumentAttributes
|
13
14
|
include Mixins::Requests::Financial::AsyncAttributes
|
14
15
|
include Mixins::Requests::Financial::Business::BusinessAttributes
|
@@ -85,7 +86,8 @@ module GenesisRuby
|
|
85
86
|
travel: travel_data_attributes_structure,
|
86
87
|
funding: funding_attributes_structure,
|
87
88
|
installment_plan_id: installment_plan_id,
|
88
|
-
installment_plan_reference: installment_plan_reference
|
89
|
+
installment_plan_reference: installment_plan_reference,
|
90
|
+
digital_asset_type: digital_asset_type
|
89
91
|
)
|
90
92
|
end
|
91
93
|
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
module Crypto
|
6
|
+
module BitPay
|
7
|
+
# BitPay Payout is a crypto currency payout method where merchants are requesting payouts
|
8
|
+
# in FIAT currency and the funds are transferred in Bitcoin equivalent to a crypto wallet address
|
9
|
+
class Payout < Requests::Base::Financial
|
10
|
+
|
11
|
+
include Api::Mixins::Requests::AddressInfoAttributes
|
12
|
+
include Api::Mixins::Requests::Financial::AsyncAttributes
|
13
|
+
include Api::Mixins::Requests::Financial::NotificationAttributes
|
14
|
+
|
15
|
+
attr_accessor :crypto_address, :crypto_wallet_provider
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
# BitPay Payout transaction type
|
20
|
+
def transaction_type
|
21
|
+
Api::Constants::Transactions::BITPAY_PAYOUT
|
22
|
+
end
|
23
|
+
|
24
|
+
# BitPay Payout field validations
|
25
|
+
def init_field_validations
|
26
|
+
super
|
27
|
+
|
28
|
+
required_fields.push *%i[transaction_id notification_url return_success_url
|
29
|
+
return_failure_url amount currency crypto_address crypto_wallet_provider]
|
30
|
+
end
|
31
|
+
|
32
|
+
# BitPay Payout parameters structure
|
33
|
+
def payment_transaction_structure
|
34
|
+
{
|
35
|
+
notification_url: notification_url,
|
36
|
+
return_success_url: return_success_url,
|
37
|
+
return_failure_url: return_failure_url,
|
38
|
+
customer_email: customer_email,
|
39
|
+
crypto_address: crypto_address,
|
40
|
+
crypto_wallet_provider: crypto_wallet_provider,
|
41
|
+
billing_address: billing_address_parameters_structure,
|
42
|
+
shipping_address: shipping_address_parameters_structure
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
module Crypto
|
6
|
+
module BitPay
|
7
|
+
# BitPay Refund is a custom refund method which will handle the asynchronous
|
8
|
+
# BitPay refund workflow
|
9
|
+
class Refund < Requests::Base::Reference
|
10
|
+
|
11
|
+
protected
|
12
|
+
|
13
|
+
# BitPay Refund transaction type
|
14
|
+
def transaction_type
|
15
|
+
Api::Constants::Transactions::BITPAY_REFUND
|
16
|
+
end
|
17
|
+
|
18
|
+
# BitPay Refund field validations
|
19
|
+
def init_field_validations
|
20
|
+
super
|
21
|
+
|
22
|
+
required_fields.push *%i[transaction_id amount currency reference_id]
|
23
|
+
end
|
24
|
+
|
25
|
+
# BitPay Refund parameters structure
|
26
|
+
def reference_transaction_structure
|
27
|
+
{}
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
module Crypto
|
6
|
+
module BitPay
|
7
|
+
# BitPay is a cryptocurrency payments provider supporting blockchain payments
|
8
|
+
# with Bitcoin (BTC) and BitcoinCash (BCH)
|
9
|
+
# BitPay Sale is an asynchronous transaction type
|
10
|
+
class Sale < Requests::Base::Financial
|
11
|
+
|
12
|
+
include Api::Mixins::Requests::AddressInfoAttributes
|
13
|
+
|
14
|
+
attr_reader :return_url
|
15
|
+
|
16
|
+
# Return URL setter
|
17
|
+
def return_url=(value)
|
18
|
+
unless GenesisRuby::Utils::Common.valid_url?(value)
|
19
|
+
raise ParameterError, "Invalid URL given for #{__method__}"
|
20
|
+
end
|
21
|
+
|
22
|
+
@return_url = value
|
23
|
+
end
|
24
|
+
|
25
|
+
protected
|
26
|
+
|
27
|
+
# BitPay Sale transaction type
|
28
|
+
def transaction_type
|
29
|
+
Api::Constants::Transactions::BITPAY_SALE
|
30
|
+
end
|
31
|
+
|
32
|
+
# BitPay Sale field validations
|
33
|
+
def init_field_validations
|
34
|
+
super
|
35
|
+
|
36
|
+
required_fields.push *%i[transaction_id return_url amount currency customer_email]
|
37
|
+
end
|
38
|
+
|
39
|
+
# BitPay Sale parameters structure
|
40
|
+
def payment_transaction_structure
|
41
|
+
{
|
42
|
+
return_url: return_url,
|
43
|
+
customer_email: customer_email,
|
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
|
55
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
module GiftCards
|
6
|
+
# Fashioncheque transactions are made using gift cards provided by Fashioncheque
|
7
|
+
class Fashioncheque < Requests::Base::Financial
|
8
|
+
|
9
|
+
include Api::Mixins::Requests::AddressInfoAttributes
|
10
|
+
include Api::Mixins::Requests::Financial::DynamicDescriptorAttributes
|
11
|
+
include Api::Mixins::Requests::Financial::GiftCardsAttributes
|
12
|
+
include Api::Mixins::Requests::Financial::ReferenceAttributes
|
13
|
+
include Api::Mixins::Requests::NonFinancial::Tokenization::TokenAttributes
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
# Fashioncheque transaction type
|
18
|
+
def transaction_type
|
19
|
+
Api::Constants::Transactions::FASHIONCHEQUE
|
20
|
+
end
|
21
|
+
|
22
|
+
# Fashioncheque field validations
|
23
|
+
def init_field_validations
|
24
|
+
super
|
25
|
+
|
26
|
+
required_fields.push *%i[transaction_id amount currency card_number]
|
27
|
+
end
|
28
|
+
|
29
|
+
# Fashioncheque parameters structure
|
30
|
+
def payment_transaction_structure
|
31
|
+
{
|
32
|
+
card_number: card_number,
|
33
|
+
cvv: cvv,
|
34
|
+
token: token,
|
35
|
+
reference_id: reference_id,
|
36
|
+
billing_address: billing_address_parameters_structure,
|
37
|
+
shipping_address: shipping_address_parameters_structure,
|
38
|
+
dynamic_descriptor_params: dynamic_descriptor_structure
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
module GiftCards
|
6
|
+
# Intersolve transactions are made using gift card provided by Intersolve
|
7
|
+
class Intersolve < Requests::Base::Financial
|
8
|
+
|
9
|
+
include Api::Mixins::Requests::AddressInfoAttributes
|
10
|
+
include Api::Mixins::Requests::Financial::DynamicDescriptorAttributes
|
11
|
+
include Api::Mixins::Requests::Financial::GiftCardsAttributes
|
12
|
+
include Api::Mixins::Requests::Financial::ReferenceAttributes
|
13
|
+
include Api::Mixins::Requests::Financial::Cards::TokenizationAttributes
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
# Intersolve transaction type
|
18
|
+
def transaction_type
|
19
|
+
Api::Constants::Transactions::INTERSOLVE
|
20
|
+
end
|
21
|
+
|
22
|
+
# Intersolve field validations
|
23
|
+
def init_field_validations
|
24
|
+
super
|
25
|
+
|
26
|
+
required_fields.push *%i[transaction_id amount currency card_number]
|
27
|
+
end
|
28
|
+
|
29
|
+
# Intersolve parameters structure
|
30
|
+
def payment_transaction_structure
|
31
|
+
{
|
32
|
+
card_number: card_number,
|
33
|
+
cvv: cvv,
|
34
|
+
reference_id: reference_id,
|
35
|
+
billing_address: billing_address_parameters_structure,
|
36
|
+
shipping_address: shipping_address_parameters_structure,
|
37
|
+
dynamic_descriptor_params: dynamic_descriptor_structure
|
38
|
+
}.merge(tokenization_attributes_structure)
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
module GiftCards
|
6
|
+
# The container store transactions are made using gift cards provided by TCS
|
7
|
+
class Tcs < Requests::Base::Financial
|
8
|
+
|
9
|
+
include Api::Mixins::Requests::AddressInfoAttributes
|
10
|
+
include Api::Mixins::Requests::Financial::DynamicDescriptorAttributes
|
11
|
+
include Api::Mixins::Requests::Financial::GiftCardsAttributes
|
12
|
+
include Api::Mixins::Requests::Financial::ReferenceAttributes
|
13
|
+
include Api::Mixins::Requests::NonFinancial::Tokenization::TokenAttributes
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
# TCS transaction type
|
18
|
+
def transaction_type
|
19
|
+
Api::Constants::Transactions::TCS
|
20
|
+
end
|
21
|
+
|
22
|
+
# TCS field validations
|
23
|
+
def init_field_validations
|
24
|
+
super
|
25
|
+
|
26
|
+
required_fields.push *%i[transaction_id amount currency card_number]
|
27
|
+
end
|
28
|
+
|
29
|
+
# TCS parameters structure
|
30
|
+
def payment_transaction_structure
|
31
|
+
{
|
32
|
+
card_number: card_number,
|
33
|
+
cvv: cvv,
|
34
|
+
token: token,
|
35
|
+
reference_id: reference_id,
|
36
|
+
billing_address: billing_address_parameters_structure,
|
37
|
+
shipping_address: shipping_address_parameters_structure,
|
38
|
+
dynamic_descriptor_params: dynamic_descriptor_structure
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'genesis_ruby/api/constants/transactions/parameters/african_mobile_operators'
|
2
|
+
|
3
|
+
module GenesisRuby
|
4
|
+
module Api
|
5
|
+
module Requests
|
6
|
+
module Financial
|
7
|
+
module Mobile
|
8
|
+
# African Mobile Sale, otherwise known as Charge, is an APM used to process
|
9
|
+
# Mobile network operator payments
|
10
|
+
class AfricanMobileSale < Requests::Base::Financial
|
11
|
+
|
12
|
+
include Mixins::Requests::AddressInfoAttributes
|
13
|
+
include Mixins::Requests::Financial::AfricanMobileAttributes
|
14
|
+
include Mixins::Requests::Financial::AsyncAttributes
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
# African Mobile Sale transaction type
|
19
|
+
def transaction_type
|
20
|
+
Api::Constants::Transactions::AFRICAN_MOBILE_SALE
|
21
|
+
end
|
22
|
+
|
23
|
+
# African Mobile Sale field validations
|
24
|
+
def init_field_validations # rubocop:disable Metrics/MethodLength
|
25
|
+
super
|
26
|
+
|
27
|
+
required_fields.push *%i[transaction_id return_success_url return_failure_url
|
28
|
+
amount currency operator target customer_phone billing_country]
|
29
|
+
|
30
|
+
field_values.merge! billing_country: %w(GH KE UG),
|
31
|
+
currency: %w(GHS KES UGX),
|
32
|
+
operator:
|
33
|
+
Api::Constants::Transactions::Parameters::AfricanMobileOperators.sale
|
34
|
+
|
35
|
+
field_value_dependencies.merge!(
|
36
|
+
{
|
37
|
+
currency: {
|
38
|
+
GHS: {
|
39
|
+
billing_country: %w(GH),
|
40
|
+
operator: [
|
41
|
+
Api::Constants::Transactions::Parameters::AfricanMobileOperators::VODACOM
|
42
|
+
]
|
43
|
+
},
|
44
|
+
KES: {
|
45
|
+
billing_country: %w(KE),
|
46
|
+
operator: [
|
47
|
+
Api::Constants::Transactions::Parameters::AfricanMobileOperators::SAFARICOM
|
48
|
+
]
|
49
|
+
},
|
50
|
+
UGX: {
|
51
|
+
billing_country: %w(UG),
|
52
|
+
operator: [
|
53
|
+
Api::Constants::Transactions::Parameters::AfricanMobileOperators::AIRTEL,
|
54
|
+
Api::Constants::Transactions::Parameters::AfricanMobileOperators::MTN
|
55
|
+
]
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
)
|
60
|
+
end
|
61
|
+
|
62
|
+
# African Mobile Sale request structure
|
63
|
+
def payment_transaction_structure
|
64
|
+
{
|
65
|
+
return_success_url: return_success_url,
|
66
|
+
return_failure_url: return_failure_url,
|
67
|
+
operator: operator,
|
68
|
+
target: target,
|
69
|
+
customer_email: customer_email,
|
70
|
+
customer_phone: customer_phone,
|
71
|
+
billing_address: billing_address_parameters_structure,
|
72
|
+
shipping_address: shipping_address_parameters_structure
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'genesis_ruby/api/constants/transactions/parameters/mobile/apple_pay/payment_subtypes'
|
2
|
+
|
3
|
+
module GenesisRuby
|
4
|
+
module Api
|
5
|
+
module Requests
|
6
|
+
module Financial
|
7
|
+
module Mobile
|
8
|
+
# Russian Mobile Sale, otherwise known as Charge, is an APM used
|
9
|
+
# to process Mobile network operator payments
|
10
|
+
class RussianMobileSale < Requests::Base::Financial
|
11
|
+
|
12
|
+
include Mixins::Requests::AddressInfoAttributes
|
13
|
+
include Mixins::Requests::Financial::AsyncAttributes
|
14
|
+
|
15
|
+
attr_accessor :target, :operator
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
# Russian Mobile Sale transaction type
|
20
|
+
def transaction_type
|
21
|
+
Api::Constants::Transactions::RUSSIAN_MOBILE_SALE
|
22
|
+
end
|
23
|
+
|
24
|
+
# Russian Mobile Sale field validations
|
25
|
+
def init_field_validations
|
26
|
+
super
|
27
|
+
|
28
|
+
required_fields.push *%i[transaction_id usage return_success_url return_failure_url
|
29
|
+
amount currency operator target customer_phone billing_country]
|
30
|
+
|
31
|
+
field_values.merge! billing_country: %w(RU),
|
32
|
+
currency: %w(RUB),
|
33
|
+
operator: %w(mtc megafon tele2 beeline)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Russian Mobile Sale request structure
|
37
|
+
def payment_transaction_structure
|
38
|
+
{
|
39
|
+
return_success_url: return_success_url,
|
40
|
+
return_failure_url: return_failure_url,
|
41
|
+
operator: operator,
|
42
|
+
target: target,
|
43
|
+
customer_email: customer_email,
|
44
|
+
customer_phone: customer_phone,
|
45
|
+
billing_address: billing_address_parameters_structure,
|
46
|
+
shipping_address: shipping_address_parameters_structure
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
module Vouchers
|
6
|
+
# Neosurf is a prepaid card (voucher) that is used for online shopping
|
7
|
+
class Neosurf < Base::Financial
|
8
|
+
|
9
|
+
include Api::Mixins::Requests::AddressInfoAttributes
|
10
|
+
include Api::Mixins::Requests::Financial::AsyncAttributes
|
11
|
+
|
12
|
+
attr_reader :voucher_number
|
13
|
+
|
14
|
+
# Voucher number. Alphanumeric maximum 10 characters
|
15
|
+
def voucher_number=(value)
|
16
|
+
limited_string attribute: __method__,
|
17
|
+
value: value.to_s.empty? ? nil : value.to_s,
|
18
|
+
min: 1,
|
19
|
+
max: 10
|
20
|
+
end
|
21
|
+
|
22
|
+
protected
|
23
|
+
|
24
|
+
# Neosurf transaction type
|
25
|
+
def transaction_type
|
26
|
+
Api::Constants::Transactions::NEOSURF
|
27
|
+
end
|
28
|
+
|
29
|
+
# Neosurf Field Validations
|
30
|
+
def init_field_validations
|
31
|
+
super
|
32
|
+
|
33
|
+
required_fields.push *%i[transaction_id amount currency billing_country]
|
34
|
+
field_values.merge! currency: %w( AUD BGN BRL CAD CHF CNY CZK DKK EUR GBP HKD HUF IDR
|
35
|
+
ILS INR JPY KRW MXN MYR NOK NZD PHP PLN RON RUB SEK
|
36
|
+
SGD THB TRY USD XOF ZAR ),
|
37
|
+
billing_country: %w( AT DZ AU BI BF BJ BE CV CY CA CF TD CO CG CM CD DK GQ
|
38
|
+
FR GM DE GA GN GH GW HK IE IT CI KE LU MW MZ MA MR ML
|
39
|
+
NE NG NL NZ NO PL PT RW RU RO SE ES SL SN ST CH RS TR
|
40
|
+
TG TN GB TZ UG ZW ZM )
|
41
|
+
end
|
42
|
+
|
43
|
+
# Neosurf request structure
|
44
|
+
def payment_transaction_structure
|
45
|
+
{
|
46
|
+
voucher_number: voucher_number,
|
47
|
+
customer_email: customer_email,
|
48
|
+
customer_phone: customer_phone,
|
49
|
+
return_success_url: return_success_url,
|
50
|
+
return_failure_url: return_failure_url,
|
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,82 @@
|
|
1
|
+
require 'genesis_ruby/api/constants/transactions/parameters/non_financial/externally_processed'
|
2
|
+
require 'genesis_ruby/api/constants/transactions/parameters/non_financial/processing_type'
|
3
|
+
|
4
|
+
module GenesisRuby
|
5
|
+
module Api
|
6
|
+
module Requests
|
7
|
+
module NonFinancial
|
8
|
+
module Fraud
|
9
|
+
module Chargeback
|
10
|
+
# Date range based chargeback retrieval allows you to fetch information for all
|
11
|
+
# chargebacks for a given merchant within a given date range
|
12
|
+
class DateRange < Api::Request
|
13
|
+
|
14
|
+
include Api::Mixins::Requests::NonFinancial::DateAttributes
|
15
|
+
include Api::Mixins::Requests::NonFinancial::PagingAttributes
|
16
|
+
|
17
|
+
attr_accessor :externally_processed, :processing_type
|
18
|
+
|
19
|
+
# Start of the requested date range
|
20
|
+
def start_date
|
21
|
+
@start_date&.strftime Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
|
22
|
+
end
|
23
|
+
|
24
|
+
# End of the requested date range
|
25
|
+
def end_date
|
26
|
+
@end_date&.strftime Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
|
27
|
+
end
|
28
|
+
|
29
|
+
# Date of import in the system
|
30
|
+
def import_date
|
31
|
+
@import_date&.strftime Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
|
32
|
+
end
|
33
|
+
|
34
|
+
# Date of import in the system
|
35
|
+
def import_date=(value)
|
36
|
+
parse_date attribute: __method__, value: value, allow_empty: true
|
37
|
+
end
|
38
|
+
|
39
|
+
protected
|
40
|
+
|
41
|
+
# Set Gateway API configuration
|
42
|
+
def init_configuration
|
43
|
+
init_xml_configuration
|
44
|
+
init_api_gateway_configuration request_path: 'chargebacks/by_date', include_token: false
|
45
|
+
@api_config.parser_skip_root_node = false
|
46
|
+
end
|
47
|
+
|
48
|
+
# Field Validations
|
49
|
+
def init_field_validations
|
50
|
+
super
|
51
|
+
|
52
|
+
constant_values = {
|
53
|
+
externally_processed: Constants::Transactions::Parameters::NonFinancial::ExternallyProcessed.all,
|
54
|
+
processing_type: Constants::Transactions::Parameters::NonFinancial::ProcessingType.all
|
55
|
+
}
|
56
|
+
|
57
|
+
required_fields.push *%i[start_date]
|
58
|
+
field_values.merge! constant_values
|
59
|
+
end
|
60
|
+
|
61
|
+
# API Request structure
|
62
|
+
def populate_structure # rubocop:disable Metrics/MethodLength
|
63
|
+
@tree_structure = {
|
64
|
+
chargeback_request: {
|
65
|
+
start_date: start_date,
|
66
|
+
end_date: end_date,
|
67
|
+
import_date: import_date,
|
68
|
+
page: page,
|
69
|
+
per_page: per_page,
|
70
|
+
externally_processed: externally_processed,
|
71
|
+
processing_type: processing_type
|
72
|
+
}
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|