spree_emerchantpay_genesis 0.1.4 → 0.1.6
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 +18 -0
- data/README.md +58 -3
- data/app/controllers/spree/checkout_controller_decorator.rb +88 -0
- data/app/helpers/spree_emerchantpay_genesis/mappers/genesis.rb +43 -10
- data/app/helpers/spree_emerchantpay_genesis/mappers/order.rb +9 -6
- data/app/helpers/spree_emerchantpay_genesis/mappers/threeds_attributes.rb +2 -1
- data/app/helpers/spree_emerchantpay_genesis/payment_method_helper.rb +7 -0
- data/app/models/spree/gateway/emerchantpay_checkout.rb +10 -1
- data/app/models/spree_emerchantpay_genesis/base/gateway.rb +6 -1
- data/app/services/spree_emerchantpay_genesis/notifications/service_handler.rb +0 -2
- data/app/services/spree_emerchantpay_genesis/sources/create_credit_card.rb +1 -0
- data/app/services/spree_emerchantpay_genesis/threeds/method_continue.rb +0 -2
- data/app/views/spree/admin/payments/source_views/_emerchantpay_checkout.html.erb +25 -0
- data/app/views/spree/checkout/payment/_emerchantpay_direct.html.erb +65 -1
- data/config/locales/en.yml +27 -0
- data/lib/spree_emerchantpay_genesis/version.rb +1 -1
- metadata +18 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c220bb96644c56f0979a39ad4e8465ef9560f5e58c45acf36e89faf4dcafb9d
|
4
|
+
data.tar.gz: 42f7abcc36024c096e88a39a072e57d0138aac80decc629a8278d6b1642616d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdbeb22309bc146f4cc8c957eda170fb17249afb73f7fc8e544f8d15a6560a5e22d2ed6a4749c8e0e3bdb455b533a5f8400165db6f812b6706f149addb8dbbce
|
7
|
+
data.tar.gz: 774446783c40d05322b15dd9768fda5db2873ccd2b87320ca75eb4cebee3401a2e1759e17e4d28e02ea8b5420d4e656987a20a1522608623a06820bfee73d94d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
0.1.6
|
2
|
+
-----
|
3
|
+
**Features**:
|
4
|
+
|
5
|
+
* Added Docker project
|
6
|
+
* Added Spree Rails FrontEnd Redirect URL handling (asynchronous payments)
|
7
|
+
* Updated README
|
8
|
+
|
9
|
+
0.1.5
|
10
|
+
-----
|
11
|
+
**Features**:
|
12
|
+
|
13
|
+
* Added `emerchantpay Checkout` Description field handling
|
14
|
+
* Updated Genesis Ruby SDK to version 0.1.6
|
15
|
+
* Updated project dependencies
|
16
|
+
* Added `emerchantpay Checkout` Custom Attributes handling
|
17
|
+
* Added `emerchantpay Checkout` Language support
|
18
|
+
|
1
19
|
0.1.4
|
2
20
|
-----
|
3
21
|
**Features**:
|
data/README.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
|
1
|
+
emerchantpay Genesis Gateway for Spree
|
2
|
+
===========
|
3
|
+
[](https://badge.fury.io/rb/spree_emerchantpay_genesis)
|
4
|
+
[](LICENSE)
|
5
|
+
|
6
|
+
Overview
|
7
|
+
--------
|
2
8
|
This is a Payment Module for Spree eCommerce that gives you the ability to process payments through emerchantpay's Payment Gateway - Genesis.
|
3
9
|
|
4
10
|
# Requirements
|
@@ -7,7 +13,7 @@ This is a Payment Module for Spree eCommerce that gives you the ability to proce
|
|
7
13
|
* Spree FrontEnd - Optional (Tested up to 4.4.0)
|
8
14
|
* Ruby >= 2.7
|
9
15
|
* Ruby on Rails >= 6.1.4
|
10
|
-
* [GenesisRuby v0.1.
|
16
|
+
* [GenesisRuby v0.1.6](https://github.com/GenesisGateway/genesis_ruby/releases/tag/0.1.6)
|
11
17
|
* PCI-certified server in order to use emerchantpay Direct
|
12
18
|
|
13
19
|
## Installation
|
@@ -216,7 +222,30 @@ curl --request 'POST' \
|
|
216
222
|
|
217
223
|
#### Create Checkout Payment
|
218
224
|
|
219
|
-
The Checkout Gateway doesn't require `source_attributes` (see [p.4 Update Order](#payment-point-4)). Upon Order Update or Payment Create the only required parameter is `payment_method_id`.
|
225
|
+
The Checkout Gateway doesn't require `source_attributes` by default (see [p.4 Update Order](#payment-point-4)). Upon Order Update or Payment Create the only required parameter is `payment_method_id`.
|
226
|
+
|
227
|
+
In some cases, the Gateway Web Payment Form may require Custom Attributes. Those attributes can be passed to the gateway via `api/v2/storefront/checkout/create_payment`.
|
228
|
+
public_metadata contains a list with custom attributes where the key is the transaction type chosen on the payment method configuration inside the administration backend.
|
229
|
+
|
230
|
+
```bash
|
231
|
+
curl --request 'POST' \
|
232
|
+
--header 'Accept: application/vnd.api+json' \
|
233
|
+
--header 'X-Spree-Order-Token: EsDjq1oXEgKI6kuujgfvFw1694531383712' \
|
234
|
+
--header 'Content-Type: application/vnd.api+json' \
|
235
|
+
--url 'http://localhost:4000/api/v2/storefront/checkout/create_payment' \
|
236
|
+
--data '{
|
237
|
+
"payment_method_id": "8",
|
238
|
+
"source_attributes": {
|
239
|
+
"consumer_id":"123456",
|
240
|
+
"consumer_email": "travis@example.com",
|
241
|
+
"public_metadata": {
|
242
|
+
"sale3d": { "bin": "401200", "tail": "0085"},
|
243
|
+
"trustly_sale": {"return_success_url_target": "top"}
|
244
|
+
}
|
245
|
+
}
|
246
|
+
}'
|
247
|
+
```
|
248
|
+
Full list with the available Custom Attributes for every Transaction Type can be found [here](https://emerchantpay.github.io/gateway-api-docs/#wpf-transaction-types).
|
220
249
|
|
221
250
|
The payment can be finished and a request to the Gateway will be sent with one of the Order Next or Complete endpoints.
|
222
251
|
|
@@ -362,6 +391,32 @@ _Note_: If you have trouble with your credentials or terminal configuration, get
|
|
362
391
|
|
363
392
|
`bundle exec appraisal install`
|
364
393
|
|
394
|
+
### Build Demo store
|
395
|
+
Requires [Docker Engine](https://docs.docker.com/engine/install/)
|
396
|
+
|
397
|
+
1. Clone the project
|
398
|
+
2. Create .env file in the project rood based on the .env.example
|
399
|
+
* Set `RAILS_ENV=production`
|
400
|
+
3. Execute inside project root:
|
401
|
+
```shell
|
402
|
+
docker compose up
|
403
|
+
```
|
404
|
+
4. Setup Web Server with reverse proxy configuration
|
405
|
+
|
406
|
+
### Setup plugin for development
|
407
|
+
1. Clone the project
|
408
|
+
2. Create .env file based on the .env.example
|
409
|
+
* Set `RAILS_ENV=development`
|
410
|
+
* Set `PLUGIN_SOURCE=/<local path to the plugin source>`
|
411
|
+
3. Execute inside project root:
|
412
|
+
```shell
|
413
|
+
docker compose -f compose.yaml -f development-compose.yaml up -d
|
414
|
+
```
|
415
|
+
* Optional you can set project name with the -p flag
|
416
|
+
* You can attach to the container and debug with `pry` (`docker attach <container>`).
|
417
|
+
Requires `config.web_console.whitelisted_ips = '<host_ip>'` inside the container (/mnt/spree/config/environments/development.rb)
|
418
|
+
* If you expose the localhost (ex. ngrok) requires `config.hosts.clear` inside the container (/mnt/spree/config/environments/development.rb)
|
419
|
+
|
365
420
|
## License
|
366
421
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/license/mit).
|
367
422
|
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module Spree
|
2
|
+
module CheckoutControllerDecorator
|
3
|
+
|
4
|
+
# Updates the order and advances to the next state (when possible.)
|
5
|
+
def update
|
6
|
+
result = process_emp_direct_payment? ? process_emp_direct_payment : default_payment_processing
|
7
|
+
|
8
|
+
if result
|
9
|
+
@order.temporary_address = !params[:save_user_address]
|
10
|
+
|
11
|
+
order_next
|
12
|
+
|
13
|
+
process_completed_order && return if @order.completed?
|
14
|
+
|
15
|
+
redirect_to spree.checkout_state_path @order.state
|
16
|
+
else
|
17
|
+
render :edit, status: :unprocessable_entity
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
# Default Rails FrontEnd Checkout controller `update` logic
|
24
|
+
def default_payment_processing
|
25
|
+
@order.update_from_params(params, permitted_checkout_attributes, request.headers.env)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Proceed with Spree Order current state execution and move to the next
|
29
|
+
def order_next
|
30
|
+
return if @order.next
|
31
|
+
|
32
|
+
flash[:error] = @order.errors.full_messages.join("\n")
|
33
|
+
end
|
34
|
+
|
35
|
+
# Get payment_method_id from the params
|
36
|
+
def payment_method_id
|
37
|
+
params[:order][:payments_attributes].last[:payment_method_id].presence
|
38
|
+
rescue NoMethodError
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
|
42
|
+
# Handle completed order
|
43
|
+
def process_completed_order
|
44
|
+
redirect_url = nil
|
45
|
+
@current_order = nil
|
46
|
+
flash['order_completed'] = true
|
47
|
+
|
48
|
+
redirect_url = @order.payments.last.private_metadata['redirect_url'] if @order.payments.last.private_metadata
|
49
|
+
|
50
|
+
redirect_to redirect_url || completion_route, allow_other_host: true
|
51
|
+
end
|
52
|
+
|
53
|
+
# Check for Emerchantpay Direct Payment process
|
54
|
+
def process_emp_direct_payment?
|
55
|
+
@order.state == 'payment' && emerchantpay_direct_payment?
|
56
|
+
end
|
57
|
+
|
58
|
+
# Check if the current payment method is Emerchantpay Direct
|
59
|
+
def emerchantpay_direct_payment?
|
60
|
+
return false unless payment_method_id
|
61
|
+
|
62
|
+
payment_method = Spree::PaymentMethod.find(payment_method_id)
|
63
|
+
|
64
|
+
payment_method&.type == Spree::Gateway::EmerchantpayDirect.name
|
65
|
+
end
|
66
|
+
|
67
|
+
# Process Emerchantpay Direct Payment
|
68
|
+
def process_emp_direct_payment
|
69
|
+
result = create_payment_service.call(
|
70
|
+
order: @order,
|
71
|
+
params: {
|
72
|
+
payment_method_id: payment_method_id,
|
73
|
+
source_attributes: params[:payment_source][payment_method_id.to_s.to_sym].presence
|
74
|
+
}
|
75
|
+
)
|
76
|
+
|
77
|
+
result.success?
|
78
|
+
end
|
79
|
+
|
80
|
+
# Spree Storefront Create Payment Service
|
81
|
+
def create_payment_service
|
82
|
+
Spree::Api::Dependencies.storefront_payment_create_service.constantize
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
Spree::CheckoutController.prepend(Spree::CheckoutControllerDecorator)
|
@@ -75,16 +75,15 @@ module SpreeEmerchantpayGenesis
|
|
75
75
|
end
|
76
76
|
|
77
77
|
# Map WPF request
|
78
|
-
def map_wpf(order,
|
78
|
+
def map_wpf(order, source, options)
|
79
79
|
common_attributes order, support_ip: false
|
80
|
+
description_attribute order
|
80
81
|
billing_attributes order
|
81
82
|
shipping_attributes order
|
82
|
-
asyn_attributes options
|
83
|
-
transaction_types_attributes options
|
83
|
+
asyn_attributes options, is_wpf: true
|
84
|
+
transaction_types_attributes options, source
|
84
85
|
threeds_wpf_attributes order, options if ActiveModel::Type::Boolean.new.cast options[:threeds_allowed]
|
85
|
-
|
86
|
-
@context.return_cancel_url = options[:return_cancel_url]
|
87
|
-
@context.return_pending_url = options[:return_pending_url]
|
86
|
+
wpf_locale_attributes options
|
88
87
|
|
89
88
|
self
|
90
89
|
end
|
@@ -181,11 +180,16 @@ module SpreeEmerchantpayGenesis
|
|
181
180
|
end
|
182
181
|
|
183
182
|
# Asynchronous attributes
|
184
|
-
def asyn_attributes(options)
|
183
|
+
def asyn_attributes(options, is_wpf: false)
|
185
184
|
@context.notification_url = "#{options[:hostname]}#{api_v2_storefront_emerchantpay_notification_path}"
|
186
185
|
@context.return_success_url = options[:return_success_url]
|
187
186
|
@context.return_failure_url = options[:return_failure_url]
|
188
187
|
|
188
|
+
if is_wpf
|
189
|
+
@context.return_cancel_url = options[:return_cancel_url]
|
190
|
+
@context.return_pending_url = options[:return_pending_url]
|
191
|
+
end
|
192
|
+
|
189
193
|
nil
|
190
194
|
end
|
191
195
|
|
@@ -209,12 +213,41 @@ module SpreeEmerchantpayGenesis
|
|
209
213
|
end
|
210
214
|
|
211
215
|
# Map WPF Transaction Types
|
212
|
-
def transaction_types_attributes(options)
|
213
|
-
|
214
|
-
|
216
|
+
def transaction_types_attributes(options, source)
|
217
|
+
custom_attributes = source.public_metadata
|
218
|
+
transaction_types = PaymentMethodHelper.select_options_value options, :transaction_types
|
219
|
+
|
220
|
+
transaction_types.each do |type|
|
221
|
+
next if type.empty?
|
222
|
+
|
223
|
+
if custom_attributes.key?(type.to_s) && custom_attributes[type.to_s].is_a?(Hash)
|
224
|
+
@context.add_transaction_type type, custom_attributes[type.to_s].deep_symbolize_keys
|
225
|
+
|
226
|
+
next
|
227
|
+
end
|
228
|
+
|
229
|
+
@context.add_transaction_type type
|
215
230
|
end
|
216
231
|
end
|
217
232
|
|
233
|
+
# Map WPF Description field
|
234
|
+
def description_attribute(order)
|
235
|
+
items_description = order.line_items.map { |item| ["#{item[:product_name]} x #{item[:quantity]}"] }
|
236
|
+
|
237
|
+
@context.description = items_description.join("\n")
|
238
|
+
|
239
|
+
nil
|
240
|
+
end
|
241
|
+
|
242
|
+
# Map WPF language attributes
|
243
|
+
def wpf_locale_attributes(options)
|
244
|
+
locale = PaymentMethodHelper.select_options_value options, :language
|
245
|
+
|
246
|
+
return unless locale.is_a? String
|
247
|
+
|
248
|
+
@context.locale = locale.delete_prefix('\'').delete_suffix('\'')
|
249
|
+
end
|
250
|
+
|
218
251
|
end
|
219
252
|
end
|
220
253
|
end
|
@@ -5,11 +5,10 @@ module SpreeEmerchantpayGenesis
|
|
5
5
|
|
6
6
|
NESTED_NODES = %w(billing_address shipping_address line_items user).freeze
|
7
7
|
ORDER_ALLOWED_ATTRIBUTES = %w(
|
8
|
-
id currency item_total total user_id token item_count email shipment_total
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
created_at updated_at
|
8
|
+
id currency item_total total user_id token item_count email shipment_total bill_address_id ship_address_id
|
9
|
+
last_ip_address adjustment_total additional_tax_total included_tax_total number customer ip order_id shipping
|
10
|
+
tax subtotal discount name address1 address2 city state zip country phone digital created_at updated_at
|
11
|
+
product_name
|
13
12
|
) + NESTED_NODES
|
14
13
|
|
15
14
|
# Prepare Order data used from the Order mapper
|
@@ -17,7 +16,11 @@ module SpreeEmerchantpayGenesis
|
|
17
16
|
order.attributes.symbolize_keys.merge(
|
18
17
|
gateway_options,
|
19
18
|
{ digital: order.digital? },
|
20
|
-
{
|
19
|
+
{
|
20
|
+
line_items: order.line_items.map do |line_item|
|
21
|
+
line_item.attributes.symbolize_keys.merge({ product_name: line_item.product.name })
|
22
|
+
end
|
23
|
+
},
|
21
24
|
{ user: (user ? user.attributes.symbolize_keys : {}) }
|
22
25
|
)
|
23
26
|
end
|
@@ -71,7 +71,8 @@ module SpreeEmerchantpayGenesis
|
|
71
71
|
|
72
72
|
@context.threeds_v2_control_challenge_window_size =
|
73
73
|
fetch_threeds_constant('Control::ChallengeWindowSizes::FULLSCREEN')
|
74
|
-
@context.threeds_v2_control_challenge_indicator =
|
74
|
+
@context.threeds_v2_control_challenge_indicator =
|
75
|
+
PaymentMethodHelper.select_options_value options, :challenge_indicator
|
75
76
|
|
76
77
|
nil
|
77
78
|
end
|
@@ -28,6 +28,13 @@ module SpreeEmerchantpayGenesis
|
|
28
28
|
default_attr
|
29
29
|
end
|
30
30
|
|
31
|
+
# Get default values for select options
|
32
|
+
def select_options_value(options, key)
|
33
|
+
return options[key][:selected] if options[key].is_a? Hash
|
34
|
+
|
35
|
+
options[key]
|
36
|
+
end
|
37
|
+
|
31
38
|
end
|
32
39
|
|
33
40
|
end
|
@@ -3,10 +3,19 @@ module Spree
|
|
3
3
|
class Gateway::EmerchantpayCheckout < SpreeEmerchantpayGenesis::Base::Gateway # rubocop:disable Style/ClassAndModuleChildren
|
4
4
|
|
5
5
|
preference :transaction_types, :multi_select, default: lambda {
|
6
|
-
{
|
6
|
+
{
|
7
|
+
values: GenesisRuby::Utils::Transactions::WpfTypes.all,
|
8
|
+
selected: [GenesisRuby::Api::Constants::Transactions::SALE_3D]
|
9
|
+
}
|
7
10
|
}
|
8
11
|
preference :return_cancel_url, :string, default: 'http://localhost:4000/checkout/payment'
|
9
12
|
preference :return_pending_url, :string, default: 'http://localhost:4000/orders/|:ORDER:|'
|
13
|
+
preference :language, :select, default: lambda {
|
14
|
+
{
|
15
|
+
values: GenesisRuby::Api::Constants::I18n.all,
|
16
|
+
selected: GenesisRuby::Api::Constants::I18n::EN
|
17
|
+
}
|
18
|
+
}
|
10
19
|
|
11
20
|
delegate :load_data, :load_source, :load_payment, to: :provider
|
12
21
|
|
@@ -9,7 +9,12 @@ module SpreeEmerchantpayGenesis
|
|
9
9
|
preference :return_failure_url, :string, default: 'http://localhost:4000/checkout/payment?order_number=|:ORDER:|'
|
10
10
|
preference :threeds_allowed, :boolean_select, default: true
|
11
11
|
preference :challenge_indicator, :select, default: lambda {
|
12
|
-
{
|
12
|
+
{
|
13
|
+
values: GenesisRuby::Api::Constants::Transactions::Parameters::Threeds::Version2::Control::
|
14
|
+
ChallengeIndicators.all,
|
15
|
+
selected: GenesisRuby::Api::Constants::Transactions::Parameters::Threeds::Version2::Control::
|
16
|
+
ChallengeIndicators::NO_PREFERENCE
|
17
|
+
}
|
13
18
|
}
|
14
19
|
preference :hostname, :string, default: 'http://127.0.0.1:4000'
|
15
20
|
preference :test_mode, :boolean_select, default: true
|
@@ -14,6 +14,31 @@
|
|
14
14
|
<th><%= I18n.t('emerchantpay.payments_table.source_consumer_email') %>:</th>
|
15
15
|
<td><%= payment.source.consumer_email %></td>
|
16
16
|
</tr>
|
17
|
+
<% unless payment.source.public_metadata.empty? %>
|
18
|
+
<tr>
|
19
|
+
<td colspan="2" class="text-center">
|
20
|
+
<h3><%= I18n.t('emerchantpay.payments_table.source_custom_attributes') %></h3>
|
21
|
+
<table class="table border-top-0">
|
22
|
+
<% payment.source.public_metadata.each do |transaction_type, custom_attributes| %>
|
23
|
+
<% next unless custom_attributes.is_a? Hash %>
|
24
|
+
<tr>
|
25
|
+
<th class="col-2"><%= transaction_type %></th>
|
26
|
+
<td class="text-left col-10">
|
27
|
+
<table class="table">
|
28
|
+
<% custom_attributes .each do |attribute, value| %>
|
29
|
+
<tr>
|
30
|
+
<td class="col-5"><%= attribute %></td>
|
31
|
+
<td class="col-7"><%= value %></td>
|
32
|
+
</tr>
|
33
|
+
<% end %>
|
34
|
+
</table>
|
35
|
+
</td>
|
36
|
+
</tr>
|
37
|
+
<% end %>
|
38
|
+
</table>
|
39
|
+
</td>
|
40
|
+
</tr>
|
41
|
+
<% end %>
|
17
42
|
</table>
|
18
43
|
</div>
|
19
44
|
</fieldset>
|
@@ -20,11 +20,57 @@
|
|
20
20
|
</div>
|
21
21
|
|
22
22
|
<input type="hidden" name="payment_source[<%= payment_method.id %>][cc_type]" id="emp_cc_type" value="" class="ccType">
|
23
|
+
<input name="payment_source[<%= payment_method.id %>][accept_header]"
|
24
|
+
type="hidden"
|
25
|
+
id="emp_cc_3dsv2_accept_header"
|
26
|
+
value="*/*"
|
27
|
+
>
|
28
|
+
<input name="payment_source[<%= payment_method.id %>][java_enabled]"
|
29
|
+
type="hidden"
|
30
|
+
id="emp_cc_3dsv2_java_enabled"
|
31
|
+
value=""
|
32
|
+
>
|
33
|
+
<input name="payment_source[<%= payment_method.id %>][language]"
|
34
|
+
type="hidden"
|
35
|
+
id="emp_cc_3dsv2_language"
|
36
|
+
value=""
|
37
|
+
>
|
38
|
+
<input name="payment_source[<%= payment_method.id %>][color_depth]"
|
39
|
+
type="hidden"
|
40
|
+
id="emp_cc_3dsv2_color_depth"
|
41
|
+
value=""
|
42
|
+
>
|
43
|
+
<input name="payment_source[<%= payment_method.id %>][screen_height]"
|
44
|
+
type="hidden"
|
45
|
+
id="emp_cc_3dsv2_screen_height"
|
46
|
+
value=""
|
47
|
+
>
|
48
|
+
<input name="payment_source[<%= payment_method.id %>][screen_width]"
|
49
|
+
type="hidden"
|
50
|
+
id="emp_cc_3dsv2_screen_width"
|
51
|
+
value=""
|
52
|
+
>
|
53
|
+
<input name="payment_source[<%= payment_method.id %>][time_zone_offset]"
|
54
|
+
type="hidden"
|
55
|
+
id="emp_cc_3dsv2_time_zone_offset"
|
56
|
+
value=""
|
57
|
+
>
|
58
|
+
<input name="payment_source[<%= payment_method.id %>][user_agent]"
|
59
|
+
type="hidden"
|
60
|
+
id="emp_cc_3dsv2_user_agent"
|
61
|
+
value=""
|
62
|
+
>
|
63
|
+
|
23
64
|
</div>
|
24
65
|
</div>
|
25
66
|
|
26
67
|
<script type="text/javascript">
|
27
68
|
document.addEventListener("DOMContentLoaded", function(){
|
69
|
+
initBrowserParams()
|
70
|
+
initCreditCard()
|
71
|
+
});
|
72
|
+
|
73
|
+
function initCreditCard() {
|
28
74
|
new Card({
|
29
75
|
form: document.getElementById('checkout_form_payment'),
|
30
76
|
container: '.emerchantpay-card-wrapper',
|
@@ -47,5 +93,23 @@
|
|
47
93
|
cvc: '***'
|
48
94
|
}
|
49
95
|
});
|
50
|
-
}
|
96
|
+
}
|
97
|
+
|
98
|
+
function initBrowserParams() {
|
99
|
+
document.getElementById('emp_cc_3dsv2_java_enabled').value = fetchJavaEnabled()
|
100
|
+
document.getElementById('emp_cc_3dsv2_color_depth').value = screen.colorDepth.toString()
|
101
|
+
document.getElementById('emp_cc_3dsv2_language').value = navigator.language
|
102
|
+
document.getElementById('emp_cc_3dsv2_screen_height').value = screen.height.toString()
|
103
|
+
document.getElementById('emp_cc_3dsv2_screen_width').value = screen.width.toString()
|
104
|
+
document.getElementById('emp_cc_3dsv2_time_zone_offset').value = (new Date()).getTimezoneOffset().toString()
|
105
|
+
document.getElementById('emp_cc_3dsv2_user_agent').value = navigator.userAgent
|
106
|
+
}
|
107
|
+
|
108
|
+
function fetchJavaEnabled() {
|
109
|
+
try {
|
110
|
+
return navigator.javaEnabled();
|
111
|
+
} catch (e) {
|
112
|
+
return false;
|
113
|
+
}
|
114
|
+
}
|
51
115
|
</script>
|
data/config/locales/en.yml
CHANGED
@@ -75,6 +75,32 @@ en:
|
|
75
75
|
webmoney: Webmoney
|
76
76
|
webpay: Webpay
|
77
77
|
wechat: Wechat
|
78
|
+
ar: Arabic
|
79
|
+
bg: Bulgarian
|
80
|
+
de: German
|
81
|
+
en: English
|
82
|
+
es: Spanish
|
83
|
+
fr: French
|
84
|
+
hi: Hindu
|
85
|
+
ja: Japanese
|
86
|
+
is: Icelandic
|
87
|
+
it: Italian
|
88
|
+
nl: Dutch
|
89
|
+
pt: Portuguese
|
90
|
+
pl: Polish
|
91
|
+
ru: Russian
|
92
|
+
tr: Turkish
|
93
|
+
zh: Mandarin Chinese
|
94
|
+
id: Indonesian
|
95
|
+
ms: Malay
|
96
|
+
th: Thai
|
97
|
+
cs: Czech
|
98
|
+
hr: Croatian
|
99
|
+
sl: Slovenian
|
100
|
+
fi: Finnish
|
101
|
+
"no": Norwegian
|
102
|
+
da: Danish
|
103
|
+
sv: Swedish
|
78
104
|
payment:
|
79
105
|
usage: Electronic transaction via Spree eCommerce platform
|
80
106
|
reference: Reference transaction via Spree eCommerce platform
|
@@ -96,6 +122,7 @@ en:
|
|
96
122
|
source_name: Name
|
97
123
|
source_consumer_id: Consumer ID
|
98
124
|
source_consumer_email: Consumer Email
|
125
|
+
source_custom_attributes: Custom Attributes
|
99
126
|
spree:
|
100
127
|
token: Token
|
101
128
|
username: Username
|
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.
|
4
|
+
version: 0.1.6
|
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-
|
11
|
+
date: 2024-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: genesis_ruby
|
@@ -16,49 +16,32 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.
|
19
|
+
version: 0.1.6
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1.
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rails
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '6.0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '6.0'
|
26
|
+
version: 0.1.6
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: securerandom
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
|
-
- - "
|
31
|
+
- - ">="
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0
|
33
|
+
version: '0'
|
48
34
|
type: :runtime
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
|
-
- - "
|
38
|
+
- - ">="
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0
|
40
|
+
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: spree_backend
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '4.4'
|
62
45
|
- - ">="
|
63
46
|
- !ruby/object:Gem::Version
|
64
47
|
version: 4.4.0
|
@@ -66,9 +49,6 @@ dependencies:
|
|
66
49
|
prerelease: false
|
67
50
|
version_requirements: !ruby/object:Gem::Requirement
|
68
51
|
requirements:
|
69
|
-
- - "~>"
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version: '4.4'
|
72
52
|
- - ">="
|
73
53
|
- !ruby/object:Gem::Version
|
74
54
|
version: 4.4.0
|
@@ -76,9 +56,6 @@ dependencies:
|
|
76
56
|
name: spree_core
|
77
57
|
requirement: !ruby/object:Gem::Requirement
|
78
58
|
requirements:
|
79
|
-
- - "~>"
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '4.4'
|
82
59
|
- - ">="
|
83
60
|
- !ruby/object:Gem::Version
|
84
61
|
version: 4.4.0
|
@@ -86,9 +63,6 @@ dependencies:
|
|
86
63
|
prerelease: false
|
87
64
|
version_requirements: !ruby/object:Gem::Requirement
|
88
65
|
requirements:
|
89
|
-
- - "~>"
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
version: '4.4'
|
92
66
|
- - ">="
|
93
67
|
- !ruby/object:Gem::Version
|
94
68
|
version: 4.4.0
|
@@ -96,16 +70,16 @@ dependencies:
|
|
96
70
|
name: spree_extension
|
97
71
|
requirement: !ruby/object:Gem::Requirement
|
98
72
|
requirements:
|
99
|
-
- -
|
73
|
+
- - ">="
|
100
74
|
- !ruby/object:Gem::Version
|
101
|
-
version: 0
|
75
|
+
version: '0'
|
102
76
|
type: :runtime
|
103
77
|
prerelease: false
|
104
78
|
version_requirements: !ruby/object:Gem::Requirement
|
105
79
|
requirements:
|
106
|
-
- -
|
80
|
+
- - ">="
|
107
81
|
- !ruby/object:Gem::Version
|
108
|
-
version: 0
|
82
|
+
version: '0'
|
109
83
|
- !ruby/object:Gem::Dependency
|
110
84
|
name: appraisal
|
111
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -264,16 +238,16 @@ dependencies:
|
|
264
238
|
name: rspec-rails
|
265
239
|
requirement: !ruby/object:Gem::Requirement
|
266
240
|
requirements:
|
267
|
-
- - "
|
241
|
+
- - ">="
|
268
242
|
- !ruby/object:Gem::Version
|
269
|
-
version: '
|
243
|
+
version: '0'
|
270
244
|
type: :development
|
271
245
|
prerelease: false
|
272
246
|
version_requirements: !ruby/object:Gem::Requirement
|
273
247
|
requirements:
|
274
|
-
- - "
|
248
|
+
- - ">="
|
275
249
|
- !ruby/object:Gem::Version
|
276
|
-
version: '
|
250
|
+
version: '0'
|
277
251
|
- !ruby/object:Gem::Dependency
|
278
252
|
name: rubocop
|
279
253
|
requirement: !ruby/object:Gem::Requirement
|
@@ -350,6 +324,7 @@ files:
|
|
350
324
|
- app/controllers/spree/api/v2/storefront/checkout_controller_decorator.rb
|
351
325
|
- app/controllers/spree/api/v2/storefront/emerchantpay_notification_controller.rb
|
352
326
|
- app/controllers/spree/api/v2/storefront/emerchantpay_threeds_controller.rb
|
327
|
+
- app/controllers/spree/checkout_controller_decorator.rb
|
353
328
|
- app/controllers/spree/emerchantpay_threeds_controller.rb
|
354
329
|
- app/helpers/spree/admin/payment_methods_helper.rb
|
355
330
|
- app/helpers/spree_emerchantpay_genesis/mappers/genesis.rb
|
@@ -426,7 +401,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
426
401
|
version: '0'
|
427
402
|
requirements:
|
428
403
|
- none
|
429
|
-
rubygems_version: 3.
|
404
|
+
rubygems_version: 3.4.10
|
430
405
|
signing_key:
|
431
406
|
specification_version: 4
|
432
407
|
summary: emerchantpay Gateway Module for Spree
|