spree_emerchantpay_genesis 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 780dbc4ae182d28335cde135ac8c42c1b1cac4b33408e0018897c9985a218d8d
4
- data.tar.gz: 2b2cb5f7934ddefe248bd0e4e59d842016fd92e145b69c90be3e8d42498fc10e
3
+ metadata.gz: 6d390e6cc5288100f5e9e6ab7cd9a22aa95f07e20c61a9f10f9acc2b1ae9e271
4
+ data.tar.gz: d15382aa75902bf130c603d899049c2a4c9a4f51fb8c9bd36d21e9a83bc44459
5
5
  SHA512:
6
- metadata.gz: 17f0eb4b85dc0bc53a406ca5e50fe130fbfe18ed0bd508d5c760adad4557e2955dbc6b4bb1cfe9053f29530bb446b481e1ee36224af641f0381d4f12e2f9f201
7
- data.tar.gz: e57d6888dff0949ae30618278240027d5fb75a0d2ec1927975f6358090689943041ab3633a1f9f4eb8490279976b180bbf3828618bc66722b6903304b6dbb5d6
6
+ metadata.gz: 4959a1a4fddc57e9fce2e3b2545759561816299b777346bc54b8c43554364eb7fe845a4bf205b6106d4aacffa8d4582e023bde8efaaea1107e3f29075ac91a9e
7
+ data.tar.gz: 2538d617eb79d5d49bdeb8806646acc5d829f5b3df97a40ec944805b1c806860b36874bee7e001945935beb1c580a946d88c97e229c776811d960dba3d813784
data/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ 0.1.9
2
+ -----
3
+ **Features**:
4
+
5
+ * Added the following Bank Codes support for Online Banking transaction type through the Checkout payment method:
6
+ * Interac Combined Pay-in (CPI)
7
+ * Bancontact (BCT)
8
+ * BLIK (BLK)
9
+ * SPEI (SE)
10
+ * Post Finance (PF)
11
+ * Santander (SN)
12
+ * Itau (IT)
13
+ * Bradesco (BR)
14
+ * Banco do Brasil (BB)
15
+ * Webpay (WP)
16
+ * Bancomer (BN)
17
+ * PSE (PS)
18
+ * Banco de Occidente (BO)
19
+ * LatiPay (PID)
20
+
1
21
  0.1.8
2
22
  -----
3
23
  **Features**:
data/README.md CHANGED
@@ -9,7 +9,7 @@ This is a Payment Module for Spree eCommerce that gives you the ability to proce
9
9
 
10
10
  # Requirements
11
11
  * Spree Core 4.x (Tested up to 4.8.3)
12
- * Spree Backend 4.x (Tested up to 4.8.3)
12
+ * Spree Backend 4.x (Tested up to 4.8.4)
13
13
  * Spree FrontEnd - Optional (Tested up to 4.8.0)
14
14
  * Ruby >= 2.7
15
15
  * Ruby on Rails >= 6.1.4
@@ -336,6 +336,20 @@ States:
336
336
  * __Neosurf__
337
337
  * __Neteller__
338
338
  * __Online Banking__
339
+ * __Interac Combined Pay-in (CPI)__
340
+ * __Bancontact (BCT)__
341
+ * __BLIK (BLK)__
342
+ * __SPEI (SE)__
343
+ * __Post Finance (PF)__
344
+ * __Santander (SN)__
345
+ * __Itau (IT)__
346
+ * __Bradesco (BR)__
347
+ * __Banco do Brasil (BB)__
348
+ * __Webpay (WP)__
349
+ * __Bancomer (BN)__
350
+ * __PSE (PS)__
351
+ * __Banco de Occidente (BO)__
352
+ * __LatiPay (PID)__
339
353
  * __OXXO__
340
354
  * __P24__
341
355
  * __Pago Facil__
@@ -214,7 +214,10 @@ module SpreeEmerchantpayGenesis
214
214
 
215
215
  # Map WPF Transaction Types
216
216
  def transaction_types_attributes(options, source)
217
- transaction_types, custom_attributes = wpf_selected_transaction_types options, source
217
+ transaction_types, custom_attributes = wpf_selected_transaction_types options
218
+
219
+ # Make sure to merge to the public_metadata params. Those params can be send via create_payment API call.
220
+ custom_attributes = source.public_metadata.merge custom_attributes
218
221
 
219
222
  transaction_types.each do |type|
220
223
  next if type.empty?
@@ -248,16 +251,20 @@ module SpreeEmerchantpayGenesis
248
251
  end
249
252
 
250
253
  # Map WPF transaction types selected in the Payment Method Options
251
- def wpf_selected_transaction_types(options, source)
254
+ def wpf_selected_transaction_types(options)
255
+ bank_codes = {}
252
256
  transaction_types = PaymentMethodHelper.select_options_value options, :transaction_types
253
257
  mobile_types = PaymentMethodHelper.fetch_wpf_mobile_types transaction_types
254
258
 
255
- custom_attributes = source.public_metadata.merge mobile_types
259
+ if transaction_types.include? GenesisRuby::Api::Constants::Transactions::ONLINE_BANKING_PAYIN
260
+ bank_codes = PaymentMethodHelper.fetch_online_banking_bank_codes options
261
+ end
262
+
256
263
  transaction_types = (transaction_types - Mappers::Transaction.mobile_types_with_payment_sub_types).push(
257
264
  *mobile_types.keys
258
265
  )
259
266
 
260
- [transaction_types, custom_attributes]
267
+ [transaction_types, {}.merge(mobile_types, bank_codes)]
261
268
  end
262
269
 
263
270
  end
@@ -56,6 +56,19 @@ module SpreeEmerchantpayGenesis
56
56
  attributes
57
57
  end
58
58
 
59
+ # Online Banking supported bank codes list
60
+ def online_banking_bank_codes
61
+ %w(CPI BCT BLK SE PF SN IT BR BB WP BN PS BO PID)
62
+ end
63
+
64
+ # Fetch selected bank codes and prepare the structure suitable for the Gateway SDK
65
+ def fetch_online_banking_bank_codes(options)
66
+ Hash[
67
+ GenesisRuby::Api::Constants::Transactions::ONLINE_BANKING_PAYIN,
68
+ { bank_codes: { bank_code: options[:bank_codes].reject { |code| code.to_s.empty? } } }
69
+ ]
70
+ end
71
+
59
72
  end
60
73
 
61
74
  end
@@ -56,7 +56,12 @@ module SpreeEmerchantpayGenesis
56
56
 
57
57
  # Fetch 3DSv2 Card Holder Shipping Address first used
58
58
  def fetch_shipping_address_first_used(shipping_address)
59
- return DateTime.now.strftime(SpreeEmerchantpayGenesis::ThreedsHelper::DATE_ISO_FORMAT) if shipping_address.nil?
59
+ # Code format that suit plugin generation
60
+ if shipping_address.nil?
61
+ return DateTime.now.strftime(
62
+ SpreeEmerchantpayGenesis::ThreedsHelper::DATE_ISO_FORMAT
63
+ )
64
+ end
60
65
 
61
66
  shipping_address.created_at.strftime(SpreeEmerchantpayGenesis::ThreedsHelper::DATE_ISO_FORMAT)
62
67
  end
@@ -16,6 +16,11 @@ module Spree
16
16
  selected: GenesisRuby::Api::Constants::I18n::EN
17
17
  }
18
18
  }
19
+ preference :bank_codes, :multi_select, default: lambda {
20
+ {
21
+ values: SpreeEmerchantpayGenesis::PaymentMethodHelper.online_banking_bank_codes
22
+ }
23
+ }
19
24
 
20
25
  delegate :load_data, :load_source, :load_payment, to: :provider
21
26
 
@@ -13,7 +13,9 @@ module Spree
13
13
  return unless new_record?
14
14
 
15
15
  if default_emerchantpay_checkout_source?
16
- self.source_attributes = SpreeEmerchantpayGenesis::PaymentMethodHelper.default_checkout_source_attributes order
16
+ # Code format that suit plugin generation
17
+ self.source_attributes = SpreeEmerchantpayGenesis::
18
+ PaymentMethodHelper.default_checkout_source_attributes order
17
19
  end
18
20
 
19
21
  build_default_source if can_build_source?
@@ -126,7 +126,10 @@ module SpreeEmerchantpayGenesis
126
126
  response_object = genesis_response.response_object
127
127
 
128
128
  if TransactionHelper.success_result? genesis_response
129
- EmerchantpayPaymentsRepository.save_reference_from_transaction original_transaction, response_object[:unique_id]
129
+ # Code format that suit plugin generation
130
+ EmerchantpayPaymentsRepository.save_reference_from_transaction(
131
+ original_transaction, response_object[:unique_id]
132
+ )
130
133
  end
131
134
 
132
135
  handle_response genesis_request, genesis_response, is_payment: false
@@ -7,11 +7,12 @@ module SpreeEmerchantpayGenesis
7
7
 
8
8
  # Constructor
9
9
  def initialize(params)
10
- @params = params
10
+ # Alignment that suits plugin generation
11
+ @params = params
11
12
  @emerchantpay_payment = fetch_emerchantapy_payment
12
- @order = load_order
13
- @spree_payment = load_spree_payment
14
- @genesis_provider = initialize_genesis_provider
13
+ @order = load_order
14
+ @spree_payment = load_spree_payment
15
+ @genesis_provider = initialize_genesis_provider
15
16
  end
16
17
 
17
18
  protected
@@ -107,6 +107,20 @@ en:
107
107
  "no": Norwegian
108
108
  da: Danish
109
109
  sv: Swedish
110
+ CPI: Interac Combined Pay-in
111
+ BCT: Bancontact
112
+ BLK: BLIK
113
+ SE: SPEI
114
+ PF: Post Finance
115
+ SN: Santander
116
+ IT: Itau
117
+ BR: Bradesco
118
+ BB: Banco do Brasil
119
+ WP: Webpay
120
+ BN: Bancomer
121
+ PS: PSE
122
+ BO: Banco de Occidente
123
+ PID: LatiPay
110
124
  payment:
111
125
  usage: Electronic transaction via Spree eCommerce platform
112
126
  reference: Reference transaction via Spree eCommerce platform
@@ -143,3 +157,4 @@ en:
143
157
  threeds_allowed: Threeds V2 parameters handling
144
158
  enabled: Enabled
145
159
  disabled: Disabled
160
+ bank_codes: Bank Codes
@@ -1,7 +1,7 @@
1
1
  # :nocov:
2
2
  module SpreeEmerchantpayGenesis
3
3
 
4
- VERSION = '0.1.8'.freeze
4
+ VERSION = '0.1.9'.freeze
5
5
 
6
6
  end
7
7
  # :nocov:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_emerchantpay_genesis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - emerchantpay ltd.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-31 00:00:00.000000000 Z
11
+ date: 2024-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: genesis_ruby