spree_emerchantpay_genesis 0.1.8 → 0.1.10

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: d03b6c21f5bfb4de3af96b24d466070211f38d4f85d25de2106fe933dc1b2818
4
+ data.tar.gz: 92d30f5025e7b95b4d97cce354b5633eae0d0a6f46f0e587fa360c9319edd73c
5
5
  SHA512:
6
- metadata.gz: 17f0eb4b85dc0bc53a406ca5e50fe130fbfe18ed0bd508d5c760adad4557e2955dbc6b4bb1cfe9053f29530bb446b481e1ee36224af641f0381d4f12e2f9f201
7
- data.tar.gz: e57d6888dff0949ae30618278240027d5fb75a0d2ec1927975f6358090689943041ab3633a1f9f4eb8490279976b180bbf3828618bc66722b6903304b6dbb5d6
6
+ metadata.gz: ff3ef9718a6aa011ab18c37990e1cb03b69d986d1a14aa1e732a61f70dfb21dace28cad49884de31031ca7355e187c5714a4fd9f6c14d0c3ae1a3e2ebc28f8f4
7
+ data.tar.gz: eff7ea1473012e5792a8d75eaa56747bcefaae0179824859e8789ced6b3f5724b9fc2b82d8d74e88372733941ebc741ea6c06b51818150d93333742ad52cbed6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ 0.1.10
2
+ -----
3
+ **Features**:
4
+
5
+ * Improved plugin compatibility with the others
6
+ * Updated project dependencies
7
+ * Updated Threeds CSS used by the Spree Frontend
8
+
9
+ 0.1.9
10
+ -----
11
+ **Features**:
12
+
13
+ * Added the following Bank Codes support for Online Banking transaction type through the Checkout payment method:
14
+ * Interac Combined Pay-in (CPI)
15
+ * Bancontact (BCT)
16
+ * BLIK (BLK)
17
+ * SPEI (SE)
18
+ * Post Finance (PF)
19
+ * Santander (SN)
20
+ * Itau (IT)
21
+ * Bradesco (BR)
22
+ * Banco do Brasil (BB)
23
+ * Webpay (WP)
24
+ * Bancomer (BN)
25
+ * PSE (PS)
26
+ * Banco de Occidente (BO)
27
+ * LatiPay (PID)
28
+
1
29
  0.1.8
2
30
  -----
3
31
  **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__
@@ -1,7 +1,7 @@
1
- body {
1
+ body.emp-form-helper-body {
2
2
  padding-top: 50px;
3
3
  }
4
- .center {
4
+ .emp-center {
5
5
  max-width: 819px;
6
6
  height: 423px;
7
7
  background-color: #ffffff;
@@ -12,13 +12,13 @@ body {
12
12
  justify-content: center;
13
13
  align-items: center;
14
14
  }
15
- .center h3 {
15
+ .emp-center h3 {
16
16
  font-family: 'Segoe UI', Arial, sans-serif;
17
17
  text-align: center;
18
18
  font-weight: 500;
19
19
  font-size: 2em;
20
20
  }
21
- .center h3 span {
21
+ .emp-center h3 span {
22
22
  font-family: 'Segoe UI', Arial, sans-serif;
23
23
  display: block;
24
24
  text-align: center;
@@ -26,10 +26,10 @@ body {
26
26
  font-size: 16px;
27
27
  padding-top: 30px;
28
28
  }
29
- .hidden {
29
+ .emp-hidden {
30
30
  display: none;
31
31
  }
32
- .screen-logo
32
+ .emp-screen-logo
33
33
  {
34
34
  width: 152px;
35
35
  height: 50px;
@@ -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?
@@ -23,7 +25,8 @@ module Spree
23
25
 
24
26
  # Check if emerchantpay checkout source should be build with the default source_attributes
25
27
  def default_emerchantpay_checkout_source?
26
- payment_method.is_a?(Spree::Gateway::EmerchantpayCheckout) && !source_attributes.present?
28
+ (payment_method&.type == 'Spree::Gateway::EmerchantpayCheckout' ||
29
+ payment_method&.type == 'Spree::Gateway::EcomprocessingCheckout') && !source_attributes.present?
27
30
  end
28
31
 
29
32
  # Check 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
@@ -66,11 +66,11 @@
66
66
 
67
67
  <script type="text/javascript">
68
68
  document.addEventListener("DOMContentLoaded", function(){
69
- initBrowserParams()
70
- initCreditCard()
69
+ empInitBrowserParams()
70
+ empInitCreditCard()
71
71
  });
72
72
 
73
- function initCreditCard() {
73
+ function empInitCreditCard() {
74
74
  new Card({
75
75
  form: document.getElementById('checkout_form_payment'),
76
76
  container: '.emerchantpay-card-wrapper',
@@ -95,8 +95,8 @@
95
95
  });
96
96
  }
97
97
 
98
- function initBrowserParams() {
99
- document.getElementById('emp_cc_3dsv2_java_enabled').value = fetchJavaEnabled()
98
+ function empInitBrowserParams() {
99
+ document.getElementById('emp_cc_3dsv2_java_enabled').value = empFetchJavaEnabled()
100
100
  document.getElementById('emp_cc_3dsv2_color_depth').value = screen.colorDepth.toString()
101
101
  document.getElementById('emp_cc_3dsv2_language').value = navigator.language
102
102
  document.getElementById('emp_cc_3dsv2_screen_height').value = screen.height.toString()
@@ -105,7 +105,7 @@
105
105
  document.getElementById('emp_cc_3dsv2_user_agent').value = navigator.userAgent
106
106
  }
107
107
 
108
- function fetchJavaEnabled() {
108
+ function empFetchJavaEnabled() {
109
109
  try {
110
110
  return navigator.javaEnabled();
111
111
  } catch (e) {
@@ -1,12 +1,12 @@
1
1
  <iframe width="1200" height="800" id="threedsMethodIframe" name="threedsMethodIframe" class="hidden">
2
2
  <html>
3
- <body>
3
+ <body class="emp-form-helper-body">
4
4
  </body>
5
5
  </html>
6
6
  </iframe>
7
- <div class="center">
7
+ <div class="emp-center">
8
8
  <div class="content">
9
- <div class="screen-logo">
9
+ <div class="emp-screen-logo">
10
10
  <%= image_tag 'spree/emerchantpay_logo.png', alt: 'emerchantpay ltd.' %>
11
11
  </div>
12
12
  <h3>The payment is being processed
@@ -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,4 +1,4 @@
1
- class AddCheckoutSource < ActiveRecord::Migration[6.1]
1
+ class AddEmerchantpayCheckoutSource < ActiveRecord::Migration[6.1]
2
2
 
3
3
  def up # rubocop:disable Metrics/MethodLength
4
4
  create_table 'emerchantpay_checkout_sources', if_not_exists: true do |t|
@@ -1,7 +1,7 @@
1
1
  # :nocov:
2
2
  module SpreeEmerchantpayGenesis
3
3
 
4
- VERSION = '0.1.8'.freeze
4
+ VERSION = '0.1.10'.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.10
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-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: genesis_ruby
@@ -28,20 +28,23 @@ dependencies:
28
28
  name: securerandom
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '0.3'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '0.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: spree_backend
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '4.4'
45
48
  - - ">="
46
49
  - !ruby/object:Gem::Version
47
50
  version: 4.4.0
@@ -49,6 +52,9 @@ dependencies:
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '4.4'
52
58
  - - ">="
53
59
  - !ruby/object:Gem::Version
54
60
  version: 4.4.0
@@ -56,6 +62,9 @@ dependencies:
56
62
  name: spree_core
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '4.4'
59
68
  - - ">="
60
69
  - !ruby/object:Gem::Version
61
70
  version: 4.4.0
@@ -63,6 +72,9 @@ dependencies:
63
72
  prerelease: false
64
73
  version_requirements: !ruby/object:Gem::Requirement
65
74
  requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '4.4'
66
78
  - - ">="
67
79
  - !ruby/object:Gem::Version
68
80
  version: 4.4.0
@@ -70,16 +82,16 @@ dependencies:
70
82
  name: spree_extension
71
83
  requirement: !ruby/object:Gem::Requirement
72
84
  requirements:
73
- - - ">="
85
+ - - "~>"
74
86
  - !ruby/object:Gem::Version
75
- version: '0'
87
+ version: '0.1'
76
88
  type: :runtime
77
89
  prerelease: false
78
90
  version_requirements: !ruby/object:Gem::Requirement
79
91
  requirements:
80
- - - ">="
92
+ - - "~>"
81
93
  - !ruby/object:Gem::Version
82
- version: '0'
94
+ version: '0.1'
83
95
  - !ruby/object:Gem::Dependency
84
96
  name: appraisal
85
97
  requirement: !ruby/object:Gem::Requirement
@@ -385,7 +397,7 @@ files:
385
397
  - config/routes.rb
386
398
  - db/migrate/20230927072418_add_emerchantpay_payments.rb
387
399
  - db/migrate/20231128153140_add_callback_status_to_emerchantpay_payments.rb
388
- - db/migrate/20240306152438_add_checkout_source.rb
400
+ - db/migrate/20240306152438_add_emerchantpay_checkout_source.rb
389
401
  - lib/generators/spree_emerchantpay_genesis/install/install_generator.rb
390
402
  - lib/spree_emerchantpay_genesis.rb
391
403
  - lib/spree_emerchantpay_genesis/engine.rb