spree_emerchantpay_genesis 0.1.3 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/README.md +132 -10
  4. data/app/assets/javascripts/spree/frontend/card.min.js +3 -3
  5. data/app/controllers/spree/api/v2/storefront/checkout_controller_decorator.rb +45 -16
  6. data/app/controllers/spree/api/v2/storefront/emerchantpay_notification_controller.rb +5 -3
  7. data/app/helpers/spree/admin/payment_methods_helper.rb +20 -13
  8. data/app/helpers/spree_emerchantpay_genesis/mappers/genesis.rb +73 -152
  9. data/app/helpers/spree_emerchantpay_genesis/mappers/order.rb +9 -6
  10. data/app/helpers/spree_emerchantpay_genesis/mappers/threeds_attributes.rb +228 -0
  11. data/app/helpers/spree_emerchantpay_genesis/payment_method_helper.rb +41 -0
  12. data/app/helpers/spree_emerchantpay_genesis/threeds_helper.rb +2 -1
  13. data/app/helpers/spree_emerchantpay_genesis/transaction_helper.rb +9 -5
  14. data/app/models/spree/emerchantpay_checkout_source.rb +37 -0
  15. data/app/models/spree/gateway/emerchantpay_checkout.rb +61 -0
  16. data/app/models/spree/gateway/emerchantpay_direct.rb +4 -19
  17. data/app/models/spree/payment_decorator.rb +31 -0
  18. data/app/models/spree_emerchantpay_genesis/base/gateway.rb +24 -2
  19. data/app/models/spree_emerchantpay_genesis/genesis_provider.rb +74 -18
  20. data/app/repositories/spree_emerchantpay_genesis/emerchantpay_payments_repository.rb +6 -5
  21. data/app/repositories/spree_emerchantpay_genesis/spree_payments_repository.rb +4 -8
  22. data/app/serializers/spree/api/v2/platform/emerchantpay_checkout_source_serializer.rb +17 -0
  23. data/app/services/spree/payments/create_decorator.rb +13 -1
  24. data/app/services/spree_emerchantpay_genesis/base/payment_service.rb +28 -2
  25. data/app/services/spree_emerchantpay_genesis/notifications/service_handler.rb +0 -2
  26. data/app/services/spree_emerchantpay_genesis/sources/create_checkout.rb +40 -0
  27. data/app/services/spree_emerchantpay_genesis/threeds/method_continue.rb +0 -2
  28. data/app/views/partials/_gateway_messages.html.erb +21 -0
  29. data/app/views/partials/_transaction_table.html.erb +34 -0
  30. data/app/views/spree/admin/payments/source_views/_emerchantpay_checkout.html.erb +48 -0
  31. data/app/views/spree/admin/payments/source_views/_emerchantpay_direct.html.erb +2 -55
  32. data/app/views/spree/checkout/payment/_emerchantpay_checkout.html.erb +3 -0
  33. data/config/initializers/extend_spree_permitted_checkout_attributes.rb +13 -0
  34. data/config/locales/en.yml +94 -0
  35. data/db/migrate/20240306152438_add_checkout_source.rb +22 -0
  36. data/lib/spree_emerchantpay_genesis/engine.rb +3 -1
  37. data/lib/spree_emerchantpay_genesis/version.rb +1 -1
  38. metadata +30 -44
@@ -5,9 +5,10 @@ module SpreeEmerchantpayGenesis
5
5
  attr_reader :provider_data
6
6
 
7
7
  # Constructor
8
- def initialize(options)
9
- @options = options
10
- @configuration = Mappers::Genesis.for_config(@options).context
8
+ def initialize(method_type, options)
9
+ @options = options
10
+ @configuration = Mappers::Genesis.for_config(@options).context
11
+ @method_type = method_type
11
12
  end
12
13
 
13
14
  # Load Order data
@@ -32,16 +33,11 @@ module SpreeEmerchantpayGenesis
32
33
  # Create a payment
33
34
  def purchase
34
35
  safe_execute do
35
- genesis_request = TransactionHelper.init_genesis_req @configuration, @options[:transaction_types]
36
-
37
- genesis = GenesisRuby::Genesis.new(
38
- @configuration,
39
- Mappers::Genesis.for_payment(genesis_request, @order, @source, @options).context
40
- )
36
+ genesis = init_gateway_req
41
37
 
42
38
  response = genesis.execute.response
43
39
 
44
- handle_response genesis_request, response
40
+ handle_response genesis.request, response
45
41
 
46
42
  response
47
43
  end
@@ -140,12 +136,14 @@ module SpreeEmerchantpayGenesis
140
136
 
141
137
  # Handle Genesis Response
142
138
  def handle_response(request, response, is_payment: true)
143
- if TransactionHelper.can_save_genesis_response? response
144
- EmerchantpayPaymentsRepository.save_from_response_data request, response, @order, @payment
139
+ response_object = fetch_response_object response
140
+
141
+ if TransactionHelper.can_save_genesis_response? response_object
142
+ EmerchantpayPaymentsRepository.save_from_response_data request, response_object, @order, @payment
145
143
  end
146
144
 
147
- SpreePaymentsRepository.update_payment @payment, response if is_payment
148
- SpreePaymentsRepository.add_payment_metadata @payment, @options, response
145
+ SpreePaymentsRepository.update_payment @payment, response_object if is_payment
146
+ SpreePaymentsRepository.add_payment_metadata @payment, @options, response, response_object
149
147
 
150
148
  # Missing shipping amount fix
151
149
  @payment.amount = response.response_object[:amount] if response.response_object&.key?(:amount) && is_payment
@@ -158,11 +156,13 @@ module SpreeEmerchantpayGenesis
158
156
 
159
157
  # Handle Genesis Notification Response
160
158
  def handle_reconciliation_response(emerchantpay_payment, reconciliation)
161
- EmerchantpayPaymentsRepository.update_from_response_data(emerchantpay_payment, reconciliation, @payment)
159
+ response_object = fetch_reconciliation_object reconciliation, emerchantpay_payment.unique_id
160
+
161
+ EmerchantpayPaymentsRepository.update_from_response_data emerchantpay_payment, response_object, @payment
162
162
 
163
- SpreePaymentsRepository.update_payment @payment, reconciliation
164
- SpreePaymentsRepository.add_payment_metadata @payment, @options, reconciliation
165
- SpreePaymentsRepository.update_payment_status @payment, reconciliation
163
+ SpreePaymentsRepository.update_payment @payment, response_object
164
+ SpreePaymentsRepository.add_payment_metadata @payment, @options, reconciliation, response_object
165
+ SpreePaymentsRepository.update_payment_status @payment, reconciliation, response_object[:transaction_type]
166
166
 
167
167
  @payment.save
168
168
 
@@ -199,5 +199,61 @@ module SpreeEmerchantpayGenesis
199
199
  @options
200
200
  end
201
201
 
202
+ # Initialize Gateway API Request
203
+ def init_gateway_req
204
+ case @method_type
205
+ when PaymentMethodHelper::CHECKOUT_PAYMENT
206
+ init_wpf_api
207
+ when PaymentMethodHelper::DIRECT_PAYMENT
208
+ init_processing_api
209
+ else
210
+ raise GenesisRuby::Error, 'Invalid Payment Method Type given!'
211
+ end
212
+ end
213
+
214
+ # Init Processing API Request
215
+ def init_processing_api
216
+ genesis_request = TransactionHelper.init_genesis_req @configuration, @options[:transaction_types]
217
+
218
+ GenesisRuby::Genesis.new(
219
+ @configuration,
220
+ Mappers::Genesis.for_payment(genesis_request, @order, @source, @options).context
221
+ )
222
+ end
223
+
224
+ # Init WPF API Request
225
+ def init_wpf_api
226
+ genesis_request = TransactionHelper.init_wpf_req @configuration
227
+
228
+ GenesisRuby::Genesis.new(
229
+ @configuration,
230
+ Mappers::Genesis.for_wpf(genesis_request, @order, @source, @options).context
231
+ )
232
+ end
233
+
234
+ # Prepare the response object
235
+ def fetch_response_object(genesis_response)
236
+ response_object = genesis_response.response_object
237
+ test_mode = ActiveModel::Type::Boolean.new.cast(@options[:test_mode]) ? 'test' : 'live'
238
+
239
+ if @method_type == PaymentMethodHelper::CHECKOUT_PAYMENT && genesis_response.new?
240
+ response_object.merge!(
241
+ { transaction_type: TransactionHelper::WPF_TRANSACTION_TYPE, mode: test_mode, terminal_token: '' }
242
+ )
243
+ end
244
+
245
+ response_object
246
+ end
247
+
248
+ # Fetch the payment_transaction object from the given reconciliation response
249
+ def fetch_reconciliation_object(reconciliation, unique_id)
250
+ response_object = reconciliation.response_object
251
+
252
+ return response_object unless response_object.key? :payment_transaction
253
+ return response_object[:payment_transaction] if response_object[:payment_transaction].is_a? Hash
254
+
255
+ response_object[:payment_transaction].select { |payment| payment[:unique_id] == unique_id }.first
256
+ end
257
+
202
258
  end
203
259
  end
@@ -22,7 +22,6 @@ module SpreeEmerchantpayGenesis
22
22
  # Store Genesis Payment to the DB
23
23
  def save_from_response_data(genesis_request, genesis_response, order, spree_payment)
24
24
  payment = Db::EmerchantpayPayment.new
25
- genesis_response = genesis_response.response_object
26
25
  formatted_genesis_request = format_genesis_request(genesis_request)
27
26
 
28
27
  map_payment spree_payment, payment, formatted_genesis_request, genesis_response
@@ -34,11 +33,13 @@ module SpreeEmerchantpayGenesis
34
33
  end
35
34
 
36
35
  # Update Existing payment
37
- def update_from_response_data(emerchantpay_payment, genesis_response, spree_payment)
38
- genesis_response = genesis_response.response_object
39
- request = { configuration: { token: emerchantpay_payment.terminal_token } }.with_indifferent_access
36
+ def update_from_response_data(emerchantpay_payment, response_object, spree_payment)
37
+ request = { configuration: {
38
+ token: emerchantpay_payment.terminal_token || response_object[:terminal_token]
39
+ } }.with_indifferent_access
40
+ response_object[:mode] = emerchantpay_payment.mode unless response_object.key? :mode
40
41
 
41
- map_payment spree_payment, emerchantpay_payment, request, genesis_response
42
+ map_payment spree_payment, emerchantpay_payment, request, response_object
42
43
 
43
44
  emerchantpay_payment.save
44
45
  end
@@ -10,9 +10,7 @@ module SpreeEmerchantpayGenesis
10
10
  end
11
11
 
12
12
  # Update Spree payment from response
13
- def update_payment(payment, response)
14
- response_object = response.response_object
15
-
13
+ def update_payment(payment, response_object)
16
14
  payment.cvv_response_code = response_object[:cvv_result_code] if response_object.key?(:cvv_result_code)
17
15
  payment.avs_response = response_object[:avs_response_code] if response_object.key?(:avs_response_code)
18
16
 
@@ -25,8 +23,7 @@ module SpreeEmerchantpayGenesis
25
23
  end
26
24
 
27
25
  # Add metadata to the Payment model
28
- def add_payment_metadata(payment, options, genesis_response)
29
- response_object = genesis_response.response_object
26
+ def add_payment_metadata(payment, options, genesis_response, response_object)
30
27
  redirect_url = TransactionHelper.fetch_redirect_url(options, genesis_response)
31
28
  state = response_object.key?(:status) ? { state: response_object[:status] } : {}
32
29
  message = response_object.key?(:message) ? { message: response_object[:message] } : {}
@@ -37,9 +34,8 @@ module SpreeEmerchantpayGenesis
37
34
  end
38
35
 
39
36
  # Update the Spree Payment status from GenesisRuby::Api::Response object
40
- def update_payment_status(payment, response)
37
+ def update_payment_status(payment, response, transaction_type)
41
38
  capturable_types = GenesisRuby::Utils::Transactions::References::CapturableTypes
42
- transaction_type = response.response_object[:transaction_type]
43
39
 
44
40
  if response.approved?
45
41
  action = :complete
@@ -48,7 +44,7 @@ module SpreeEmerchantpayGenesis
48
44
  payment.public_send(action)
49
45
  end
50
46
 
51
- payment.failure if response.error? || response.declined?
47
+ payment.failure if TransactionHelper.failure_result? response
52
48
  payment.void if response.voided?
53
49
  end
54
50
 
@@ -0,0 +1,17 @@
1
+ module Spree
2
+ module Api
3
+ module V2
4
+ module Platform
5
+ # Emerchantpay Checkout Source Serializer
6
+ class EmerchantpayCheckoutSourceSerializer < BaseSerializer
7
+
8
+ include ResourceSerializerConcern
9
+
10
+ belongs_to :payment_method
11
+ belongs_to :user
12
+
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -31,8 +31,11 @@ module Spree
31
31
 
32
32
  # Create payment source
33
33
  def create_payment_source(payment_method, params, order)
34
- if payment_method.type == Spree::Gateway::EmerchantpayDirect.name
34
+ case payment_method.type
35
+ when Spree::Gateway::EmerchantpayDirect.name
35
36
  emerchantpay_direct_payment_source payment_method, params, order
37
+ when Spree::Gateway::EmerchantpayCheckout.name
38
+ emerchantpay_checkout_payment_source payment_method, params, order
36
39
  else
37
40
  default_payment_source payment_method, params, order
38
41
  end
@@ -56,6 +59,15 @@ module Spree
56
59
  )
57
60
  end
58
61
 
62
+ # Emerchantpay Checkout payment source creation
63
+ def emerchantpay_checkout_payment_source(payment_method, params, order)
64
+ SpreeEmerchantpayGenesis::Sources::CreateCheckout.call(
65
+ payment_method: payment_method,
66
+ params: params.delete(:source_attributes),
67
+ order: order
68
+ )
69
+ end
70
+
59
71
  end
60
72
  end
61
73
  end
@@ -18,7 +18,7 @@ module SpreeEmerchantpayGenesis
18
18
 
19
19
  # Fetch emerchantpay payment
20
20
  def fetch_emerchantapy_payment
21
- result = SpreeEmerchantpayGenesis::EmerchantpayPaymentsRepository.find_by_unique_id(params[:unique_id])
21
+ result = wpf_params? ? load_wpf_payment : load_processing_payment
22
22
 
23
23
  raise 'Invalid parameters given. Payment not found.' unless result
24
24
 
@@ -37,7 +37,10 @@ module SpreeEmerchantpayGenesis
37
37
 
38
38
  # Initialize the payment provider
39
39
  def initialize_genesis_provider
40
- provider = SpreeEmerchantpayGenesis::GenesisProvider.new genesis_preferences
40
+ provider = GenesisProvider.new(
41
+ PaymentMethodHelper.fetch_method_type(@emerchantpay_payment.payment_method),
42
+ genesis_preferences
43
+ )
41
44
  provider.load_source spree_payment.source
42
45
  provider.load_data SpreeEmerchantpayGenesis::Mappers::Order.for order.attributes.symbolize_keys
43
46
  provider.load_payment spree_payment
@@ -78,6 +81,29 @@ module SpreeEmerchantpayGenesis
78
81
  @spree_payment.payment_method.preferences.merge token: @emerchantpay_payment[:terminal_token]
79
82
  end
80
83
 
84
+ # Load Processing payment via params[:unique_id]
85
+ def load_processing_payment
86
+ EmerchantpayPaymentsRepository.find_by_unique_id params[:unique_id]
87
+ end
88
+
89
+ # Load WPF initial or reference payment
90
+ def load_wpf_payment
91
+ # WPF Initial transaction case
92
+ result = EmerchantpayPaymentsRepository.find_by_unique_id params[:wpf_unique_id]
93
+
94
+ return result if result
95
+
96
+ return nil unless params.key? :payment_transaction_unique_id
97
+
98
+ # WPF Reference transaction notifications
99
+ EmerchantpayPaymentsRepository.find_by_unique_id params[:payment_transaction_unique_id]
100
+ end
101
+
102
+ # Fetch the parameters type
103
+ def wpf_params?
104
+ params.key? :wpf_unique_id
105
+ end
106
+
81
107
  end
82
108
  end
83
109
  end
@@ -1,5 +1,3 @@
1
- require 'spree/gateway/emerchantpay_direct'
2
-
3
1
  module SpreeEmerchantpayGenesis
4
2
  module Notifications
5
3
  # Notification Handler Service
@@ -0,0 +1,40 @@
1
+ module SpreeEmerchantpayGenesis
2
+ module Sources
3
+ # Alternative for Spree::Wallet::CreatePaymentSource
4
+ # Serve Web Payment Form Checkout payment method
5
+ class CreateCheckout
6
+
7
+ prepend Spree::ServiceModule::Base
8
+
9
+ def call(payment_method:, params: {}, order: nil)
10
+ source = payment_method.payment_source_class.new source_attributes(payment_method, params, order)
11
+
12
+ source.save ? success(source) : failure(source)
13
+ end
14
+
15
+ private
16
+
17
+ # Checkout source attributes
18
+ def source_attributes(payment_method, params, order) # rubocop:disable Metrics/MethodLength
19
+ user = order&.user
20
+ default = PaymentMethodHelper.default_checkout_source_attributes order
21
+
22
+ default[:payment_method_id] = payment_method.id
23
+ default[:user_id] = user&.id
24
+
25
+ return default unless params.present?
26
+
27
+ default.merge(
28
+ {
29
+ name: params[:name] || default[:name],
30
+ consumer_id: params[:consumer_id],
31
+ consumer_email: params[:consumer_email] || default[:consumer_email],
32
+ public_metadata: params[:public_metadata],
33
+ private_metadata: params[:private_metadata]
34
+ }
35
+ )
36
+ end
37
+
38
+ end
39
+ end
40
+ end
@@ -1,5 +1,3 @@
1
- require 'spree/gateway/emerchantpay_direct'
2
-
3
1
  module SpreeEmerchantpayGenesis
4
2
  module Threeds
5
3
  # Method Continue service
@@ -0,0 +1,21 @@
1
+ <fieldset data-hook="emerchantpay_gateway_response">
2
+ <% if payment.private_metadata[:message] || payment.private_metadata[:technical_message] %>
3
+ <legend><%= "#{payment.payment_method.name} #{I18n.t('emerchantpay.payments_table.gateway_response')}" %></legend>
4
+ <div class="table-responsive border rounded bg-white mb-3">
5
+ <table class="table table-condensed">
6
+ <% if payment.private_metadata[:message] %>
7
+ <tr>
8
+ <th><%= I18n.t('emerchantpay.payments_table.message') %></th>
9
+ <td><%= payment.private_metadata[:message] %></td>
10
+ </tr>
11
+ <% end %>
12
+ <% if payment.private_metadata[:technical_message] %>
13
+ <tr>
14
+ <th><%= I18n.t('emerchantpay.payments_table.technical_message') %></th>
15
+ <td><%= payment.private_metadata[:technical_message] %></td>
16
+ </tr>
17
+ <% end %>
18
+ </table>
19
+ </div>
20
+ <% end %>
21
+ </fieldset>
@@ -0,0 +1,34 @@
1
+ <fieldset data-hook="emerchantpay_gateway_payments">
2
+ <% if payment.emerchantpay_payments.count > 0 %>
3
+ <legend><%= "#{payment.payment_method.name} #{I18n.t('emerchantpay.payments_table.title')}" %></legend>
4
+ <div class="table-responsive border rouded bg-white mb-3">
5
+ <table class="table table-condensed">
6
+ <tr>
7
+ <th><%= I18n.t('emerchantpay.payments_table.unique_id') %></th>
8
+ <th><%= I18n.t('emerchantpay.payments_table.reference_id') %></th>
9
+ <th><%= I18n.t('emerchantpay.payments_table.status') %></th>
10
+ <th><%= I18n.t('emerchantpay.payments_table.transaction_type') %></th>
11
+ <th><%= I18n.t('emerchantpay.payments_table.mode') %></th>
12
+ <th><%= I18n.t('emerchantpay.payments_table.amount') %></th>
13
+ <th><%= I18n.t('emerchantpay.payments_table.currency') %></th>
14
+ <th><%= I18n.t('emerchantpay.payments_table.created_at') %></th>
15
+ <th><%= I18n.t('emerchantpay.payments_table.updated_at') %></th>
16
+ </tr>
17
+
18
+ <% payment.emerchantpay_payments.each do |emerchantpay_payment| %>
19
+ <tr>
20
+ <td><%= emerchantpay_payment.unique_id %></td>
21
+ <td><%= emerchantpay_payment.reference_id %></td>
22
+ <td><%= emerchantpay_payment.status %></td>
23
+ <td><%= emerchantpay_payment.transaction_type %></td>
24
+ <td><%= emerchantpay_payment.mode %></td>
25
+ <td><%= emerchantpay_payment.major_amount %></td>
26
+ <td><%= emerchantpay_payment.currency %></td>
27
+ <td><%= emerchantpay_payment.formatted_created_at %></td>
28
+ <td><%= emerchantpay_payment.formatted_updated_at %></td>
29
+ </tr>
30
+ <% end %>
31
+ </table>
32
+ </div>
33
+ <% end %>
34
+ </fieldset>
@@ -0,0 +1,48 @@
1
+ <fieldset data-hook="emerchantpay_checkout">
2
+ <legend><%= I18n.t('emerchantpay.payments_table.checkout_source') %></legend>
3
+ <div class="table-responsive border rounded bg-white mb-3">
4
+ <table class="table table-condensed">
5
+ <tr>
6
+ <th><%= I18n.t('emerchantpay.payments_table.source_name') %>:</th>
7
+ <td><%= payment.source.name %></td>
8
+ </tr>
9
+ <tr>
10
+ <th><%= I18n.t('emerchantpay.payments_table.source_consumer_id') %>:</th>
11
+ <td><%= payment.source.consumer_id %></td>
12
+ </tr>
13
+ <tr>
14
+ <th><%= I18n.t('emerchantpay.payments_table.source_consumer_email') %>:</th>
15
+ <td><%= payment.source.consumer_email %></td>
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 %>
42
+ </table>
43
+ </div>
44
+ </fieldset>
45
+
46
+ <%= render :partial => 'partials/gateway_messages', locals: { payment: payment } %>
47
+
48
+ <%= render :partial => 'partials/transaction_table', locals: { payment: payment} %>
@@ -22,59 +22,6 @@
22
22
  </div>
23
23
  </fieldset>
24
24
 
25
- <fieldset data-hook="emerchantpay_gateway_response">
26
- <% if payment.private_metadata[:message] || payment.private_metadata[:technical_message] %>
27
- <legend><%= "#{payment.payment_method.name} #{I18n.t('emerchantpay.payments_table.gateway_response')}" %></legend>
28
- <div class="table-responsive border rounded bg-white mb-3">
29
- <table class="table table-condensed">
30
- <% if payment.private_metadata[:message] %>
31
- <tr>
32
- <th><%= I18n.t('emerchantpay.payments_table.message') %></th>
33
- <td><%= payment.private_metadata[:message] %></td>
34
- </tr>
35
- <% end %>
36
- <% if payment.private_metadata[:technical_message] %>
37
- <tr>
38
- <th><%= I18n.t('emerchantpay.payments_table.technical_message') %></th>
39
- <td><%= payment.private_metadata[:technical_message] %></td>
40
- </tr>
41
- <% end %>
42
- </table>
43
- </div>
44
- <% end %>
45
- </fieldset>
46
-
47
- <fieldset data-hook="emerchantpay_gateway_payments">
48
- <% if payment.emerchantpay_payments.count > 0 %>
49
- <legend><%= "#{payment.payment_method.name} #{I18n.t('emerchantpay.payments_table.title')}" %></legend>
50
- <div class="table-responsive border rouded bg-white mb-3">
51
- <table class="table table-condensed">
52
- <tr>
53
- <th><%= I18n.t('emerchantpay.payments_table.unique_id') %></th>
54
- <th><%= I18n.t('emerchantpay.payments_table.reference_id') %></th>
55
- <th><%= I18n.t('emerchantpay.payments_table.status') %></th>
56
- <th><%= I18n.t('emerchantpay.payments_table.transaction_type') %></th>
57
- <th><%= I18n.t('emerchantpay.payments_table.mode') %></th>
58
- <th><%= I18n.t('emerchantpay.payments_table.amount') %></th>
59
- <th><%= I18n.t('emerchantpay.payments_table.currency') %></th>
60
- <th><%= I18n.t('emerchantpay.payments_table.created_at') %></th>
61
- <th><%= I18n.t('emerchantpay.payments_table.updated_at') %></th>
62
- </tr>
25
+ <%= render :partial => 'partials/gateway_messages', locals: { payment: payment } %>
63
26
 
64
- <% payment.emerchantpay_payments.each do |emerchantpay_payment| %>
65
- <tr>
66
- <td><%= emerchantpay_payment.unique_id %></td>
67
- <td><%= emerchantpay_payment.reference_id %></td>
68
- <td><%= emerchantpay_payment.status %></td>
69
- <td><%= emerchantpay_payment.transaction_type %></td>
70
- <td><%= emerchantpay_payment.mode %></td>
71
- <td><%= emerchantpay_payment.major_amount %></td>
72
- <td><%= emerchantpay_payment.currency %></td>
73
- <td><%= emerchantpay_payment.formatted_created_at %></td>
74
- <td><%= emerchantpay_payment.formatted_updated_at %></td>
75
- </tr>
76
- <% end %>
77
- </table>
78
- </div>
79
- <% end %>
80
- </fieldset>
27
+ <%= render :partial => 'partials/transaction_table', locals: { payment: payment } %>
@@ -0,0 +1,3 @@
1
+ <div class="emerchantpay-payment-gateway">
2
+ Pay safely through emerchantpay's Secure Gateway.
3
+ </div>
@@ -0,0 +1,13 @@
1
+ module Spree
2
+ module PermittedAttributes
3
+
4
+ # month / year may be provided by some sources, or others may elect to use one field
5
+ @@source_attributes = [ # rubocop:disable Style/ClassVars
6
+ :number, :month, :year, :expiry, :verification_value,
7
+ :first_name, :last_name, :cc_type, :gateway_customer_profile_id,
8
+ :gateway_payment_profile_id, :last_digits, :name, :encrypted_data,
9
+ :consumer_id, :consumer_email
10
+ ]
11
+
12
+ end
13
+ end
@@ -14,6 +14,93 @@ en:
14
14
  no_challenge_requested: No Challenge Requested
15
15
  preference: Preference
16
16
  mandate: Mandate
17
+ account_verification: Account Verification
18
+ argencard: Argencard
19
+ apple_pay: Apple Pay
20
+ aura: Aura
21
+ baloto: Baloto
22
+ bancomer: Bancomer
23
+ bcmc: Bcmc
24
+ banco_de_occidente: Banco de Occidente
25
+ banco_do_brasil: Banco do Brasil
26
+ bitpay_payout: Bitpay Payout
27
+ bitpay_sale: Bitpay Sale
28
+ boleto: Boleto
29
+ bradesco: Bradesco
30
+ cabal: Cabal
31
+ cashu: Cashu
32
+ cencosud: Cencosud
33
+ davivienda: Davivienda
34
+ efecty: Efecty
35
+ elo: Elo
36
+ eps: Eps
37
+ ezeewallet: eZeeWallet
38
+ fashioncheque: Fashioncheque
39
+ giropay: Giropay
40
+ google_pay: Google Pay
41
+ ideal: Ideal
42
+ idebit_payin: Idebit Payin
43
+ insta_debit_payin: Insta Debit Payin
44
+ intersolve: Intersolve
45
+ itau: Itau
46
+ multibanco: Multibanco
47
+ my_bank: My Bank
48
+ naranja: Naranja
49
+ nativa: Nativa
50
+ neosurf: Neosurf
51
+ neteller: Neteller
52
+ online_banking: Online Banking
53
+ oxxo: Oxxo
54
+ p24: P24
55
+ pago_facil: Pago Facil
56
+ pay_pal: Pay Pal
57
+ paysafecard: Paysafecard
58
+ payu: PayU
59
+ pix: Pix
60
+ poli: Poli
61
+ post_finance: Post Finance
62
+ ppro: PPRO
63
+ pse: PSE
64
+ rapi_pago: Rapi Pago
65
+ redpagos: RedPagos
66
+ russian_mobile_sale: Russian Mobile Sale
67
+ safetypay: Safetypay
68
+ santander: Santander
69
+ sdd_init_recurring_sale: SDD Init Recurring Sale
70
+ sdd_sale: SDD Sale
71
+ tarjeta_shopping: Tarjeta Shopping
72
+ container_store: Container Store
73
+ trustly_sale: Trustly Sale
74
+ upi: Upi
75
+ webmoney: Webmoney
76
+ webpay: Webpay
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
17
104
  payment:
18
105
  usage: Electronic transaction via Spree eCommerce platform
19
106
  reference: Reference transaction via Spree eCommerce platform
@@ -31,6 +118,11 @@ en:
31
118
  updated_at: Updated
32
119
  message: Message
33
120
  technical_message: Technical Message
121
+ checkout_source: Checkout source
122
+ source_name: Name
123
+ source_consumer_id: Consumer ID
124
+ source_consumer_email: Consumer Email
125
+ source_custom_attributes: Custom Attributes
34
126
  spree:
35
127
  token: Token
36
128
  username: Username
@@ -38,6 +130,8 @@ en:
38
130
  transaction_types: Transaction Types
39
131
  return_success_url: Return Success URL
40
132
  return_failure_url: Return Failure URL
133
+ return_cancel_url: Return Cancel URL
134
+ return_pending_url: Return Pending URL
41
135
  challenge_indicator: Challenge Indicator
42
136
  hostname: Hostname
43
137
  threeds_allowed: Threeds V2 parameters handling