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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3f946f18fcb121abeb5227927b4d8480f73aedfd549cca1eae4a069a322b34b
4
- data.tar.gz: 675f4efd4755f39eca482ef49dcb4c75555eb98e8cd89217cd2b713f90074d59
3
+ metadata.gz: d2dbd23a908a23677fb4ee2bea0a49cc739052aa5d882e57b7c532d57c480602
4
+ data.tar.gz: d6b2c2fbbe86dcc820946edda7c79d7ff34b83ba702e0b678226ad5c87667306
5
5
  SHA512:
6
- metadata.gz: eda4500c230e18a04b44eb67613c7911666e27730dd8f9eafc19fe6e43d636673479b3f47c9762465ee839ccbff026acb2e4b6dad5cde36f0b7fd07c2fff216f
7
- data.tar.gz: 958cdcf91ac6ce0cd617e14d17c8cc09bde302fb829197e1b74c77ff9829f8e961b5847c419710b2372149baf1b1e72eb4956b0ce7ffaaa7e94121304af46895
6
+ metadata.gz: '0487117b7c98132dd864200b76d52c9b9c2b678244726bb6386a3c4c2c3220de2b729dc3c6f8d767abc46bf460c6655e158c301664777b10cf71d6a22f9268a9'
7
+ data.tar.gz: 861e78025ac386920634ddacb4c130d2d6285067fb693ddad00da2b9fc897a3e0011999d567795cd385931aada42d280e0e105225c07652bd618d786e282cfbf
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ 0.1.5
2
+ -----
3
+ **Features**:
4
+
5
+ * Added `emerchantpay Checkout` Description field handling
6
+ * Updated Genesis Ruby SDK to version 0.1.6
7
+ * Updated project dependencies
8
+ * Added `emerchantpay Checkout` Custom Attributes handling
9
+ * Added `emerchantpay Checkout` Language support
10
+
11
+ 0.1.4
12
+ -----
13
+ **Features**:
14
+
15
+ * Added `EmerchantpayCheckout` payment method
16
+ * Updated Genesis Ruby SDK to version 0.1.5
17
+ * Update Card JS to the latest version
18
+
19
+ **Fixes**:
20
+
21
+ * Fixed project's URLs listed on RubyGems
22
+
1
23
  0.1.3
2
24
  -----
3
25
  **Features**
data/README.md CHANGED
@@ -7,7 +7,7 @@ This is a Payment Module for Spree eCommerce that gives you the ability to proce
7
7
  * Spree FrontEnd - Optional (Tested up to 4.4.0)
8
8
  * Ruby >= 2.7
9
9
  * Ruby on Rails >= 6.1.4
10
- * [GenesisRuby v0.1.3](https://github.com/GenesisGateway/genesis_ruby/releases/tag/0.1.3)
10
+ * [GenesisRuby v0.1.6](https://github.com/GenesisGateway/genesis_ruby/releases/tag/0.1.6)
11
11
  * PCI-certified server in order to use emerchantpay Direct
12
12
 
13
13
  ## Installation
@@ -37,14 +37,14 @@ Restart your server
37
37
  ## Create Payment Method
38
38
  * Sign in to Spree Admin BackEnd
39
39
  * Navigate to Configurations -> Payment Methods -> New Payment Method
40
- * For Provider `Choose Spree::Gateway::Emerchantpay*`
40
+ * For Provider choose `Spree::Gateway::EmerchantpayDirect` or `Spree:Gateway::EmerchantpayCheckout`
41
41
  * Fill in Name, Description and Stores
42
42
  * Click Create
43
43
 
44
44
  # Usage
45
45
 
46
46
  ## Configuration
47
- * Navigate to the `Spree::Gateway::Emerchantpay*` payment method in the Configurations
47
+ * Navigate to the `Spree::Gateway::EmerchantpayDirect` or `Spree:Gateway::EmerchantpayCheckout` payment method in the Configurations
48
48
  * Fill in Username, Password and Token
49
49
  * Fill in `hostname` used for the generation of the notification webhook. In most cases, the hostname should be the hostname of the Spree backend.
50
50
  * Fill in `return_success_url` and `return_failure_url`. Those endpoints will be returned to the `create_payment` response
@@ -128,6 +128,7 @@ curl --request 'PATCH' \
128
128
  ```
129
129
 
130
130
  4. Update Order
131
+ <a id="payment-point-4"></a>
131
132
  ```bash
132
133
  curl --request 'PATCH' \
133
134
  --header 'Accept: application/vnd.api+json' \
@@ -175,10 +176,15 @@ curl --request 'PATCH' \
175
176
  }
176
177
  }'
177
178
  ```
178
- 5. Create Payment
179
+
180
+ ### Create Payment
181
+
182
+ #### Create Direct Payment
183
+
179
184
  **CAUTION** Create Payment endpoint will Complete the order! Call this endpoint in order to finish the order!
180
- Accept Header, Java Enabled, Language, Color Depth, Screen height, Screen Width, Time Zone Offset, User Agent parameters must be retrieved from the customer browser. More info [here](https://emerchantpay.github.io/gateway-api-docs/?shell#3ds-v2-request-params).
181
185
 
186
+ Accept Header, Java Enabled, Language, Color Depth, Screen height, Screen Width, Time Zone Offset, User Agent parameters must be retrieved from the customer browser. More info [here](https://emerchantpay.github.io/gateway-api-docs/?shell#3ds-v2-request-params).
187
+
182
188
  ```bash
183
189
  curl --request 'POST' \
184
190
  --header 'Accept: application/vnd.api+json' \
@@ -206,9 +212,49 @@ curl --request 'POST' \
206
212
  }'
207
213
  ```
208
214
 
209
- Response:
210
- **CAUTION** If a redirect URL exists in the response object you MUST redirect the customer for payment completion
215
+ **CAUTION** If a redirect URL exists in the response object you MUST redirect the customer for payment completion. Check [Response](#payment-response).
216
+
217
+ #### Create Checkout Payment
218
+
219
+ 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`.
211
220
 
221
+ 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`.
222
+ 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.
223
+
224
+ ```bash
225
+ curl --request 'POST' \
226
+ --header 'Accept: application/vnd.api+json' \
227
+ --header 'X-Spree-Order-Token: EsDjq1oXEgKI6kuujgfvFw1694531383712' \
228
+ --header 'Content-Type: application/vnd.api+json' \
229
+ --url 'http://localhost:4000/api/v2/storefront/checkout/create_payment' \
230
+ --data '{
231
+ "payment_method_id": "8",
232
+ "source_attributes": {
233
+ "consumer_id":"123456",
234
+ "consumer_email": "travis@example.com",
235
+ "public_metadata": {
236
+ "sale3d": { "bin": "401200", "tail": "0085"},
237
+ "trustly_sale": {"return_success_url_target": "top"}
238
+ }
239
+ }
240
+ }'
241
+ ```
242
+ 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).
243
+
244
+ The payment can be finished and a request to the Gateway will be sent with one of the Order Next or Complete endpoints.
245
+
246
+ * Order complete:
247
+ ```bash
248
+ curl --request 'PATCH' \
249
+ --header 'Accept: application/vnd.api+json' \
250
+ --header 'X-Spree-Order-Token: EsDjq1oXEgKI6kuujgfvFw1694531383712' \
251
+ --header 'Content-Type: application/vnd.api+json' \
252
+ --url 'http://localhost:4000/api/v2/storefront/checkout/complete'
253
+ ```
254
+ In the JSON Response document you will find a `redirect_url` where the customer must be redirected for completing the payment. Check [Response](#payment-response).
255
+
256
+ ## Response:
257
+ <a id="payment-response"></a>
212
258
  Create Payment response will contain `emerchantpay_payment` object. It will contain the current status of the payment.
213
259
  Redirect URL will give you the next step.
214
260
 
@@ -216,6 +262,7 @@ States:
216
262
  * error or declined - redirect URL will be the Failure URL filled in plugin settings
217
263
  * approved - redirect URL will be the Success URL filled in the plugin settings
218
264
  * pending_async - redirect URL will be the 3DSecure Method Continue endpoint for the next step of the payment
265
+ * new - redirect URL will be the Web Payment Form URL where the customer must finish the payment
219
266
 
220
267
  ```json
221
268
  {
@@ -238,8 +285,81 @@ States:
238
285
  * Refund
239
286
  * Void
240
287
 
241
- ## Contributing
242
- Contribution directions go here.
288
+ ## Supported Transactions
289
+
290
+ * ```emerchantpay Direct``` Payment Method
291
+ * __Authorize__
292
+ * __Authorize (3D-Secure)__
293
+ * __Sale__
294
+ * __Sale (3D-Secure)__
295
+
296
+ * ```emerchantpay Checkout``` Payment Method
297
+ * __Apple Pay__
298
+ * __Argencard__
299
+ * __Aura__
300
+ * __Authorize__
301
+ * __Authorize (3D-Secure)__
302
+ * __Baloto__
303
+ * __Bancomer__
304
+ * __Bancontact__
305
+ * __Banco de Occidente__
306
+ * __Banco do Brasil__
307
+ * __BitPay__
308
+ * __Boleto__
309
+ * __Bradesco__
310
+ * __Cabal__
311
+ * __CashU__
312
+ * __Cencosud__
313
+ * __Davivienda__
314
+ * __Efecty__
315
+ * __Elo__
316
+ * __eps__
317
+ * __eZeeWallet__
318
+ * __Fashioncheque__
319
+ * __GiroPay__
320
+ * __Google Pay__
321
+ * __iDeal__
322
+ * __iDebit__
323
+ * __InstaDebit__
324
+ * __Intersolve__
325
+ * __Itau__
326
+ * __Klarna__
327
+ * __Multibanco__
328
+ * __MyBank__
329
+ * __Naranja__
330
+ * __Nativa__
331
+ * __Neosurf__
332
+ * __Neteller__
333
+ * __Online Banking__
334
+ * __OXXO__
335
+ * __P24__
336
+ * __Pago Facil__
337
+ * __PayPal__
338
+ * __PaySafeCard__
339
+ * __PayU__
340
+ * __Pix__
341
+ * __POLi__
342
+ * __Post Finance__
343
+ * __PPRO__
344
+ * __PSE__
345
+ * __RapiPago__
346
+ * __Redpagos__
347
+ * __SafetyPay__
348
+ * __Sale__
349
+ * __Sale (3D-Secure)__
350
+ * __Santander__
351
+ * __Sepa Direct Debit__
352
+ * __SOFORT__
353
+ * __Tarjeta Shopping__
354
+ * __TCS__
355
+ * __Trustly__
356
+ * __TrustPay__
357
+ * __UPI__
358
+ * __WebMoney__
359
+ * __WebPay__
360
+ * __WeChat__
361
+
362
+ _Note_: If you have trouble with your credentials or terminal configuration, get in touch with our [support] team
243
363
 
244
364
  ## Development
245
365
 
@@ -266,4 +386,6 @@ Contribution directions go here.
266
386
  `bundle exec appraisal install`
267
387
 
268
388
  ## License
269
- The gem is available as open source under the terms of the [GPL-2.0 License](https://opensource.org/license/gpl-2-0/).
389
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/license/mit).
390
+
391
+ [support]: mailto:tech-support@emerchantpay.net