diff --git a/README.md b/README.md index 580a154..8ab5a3d 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,56 @@ # Vue Storefront Adyen Payment Module -Use at Your own risk. +This module allows payments through Adyen Payments from Vue Storefront using Magento as backend. +The module follows [Adyen's recomendations](https://docs.adyen.com/plugins/magento-2/magento-pwa-storefront) for integrating a PWA using their magento extension. + +## Requirements +- Magento >= 2.3.5 (may work in earlier version but it has not been tested) +- Adyen Magento2 extension version >= 6.5.0 +- Vue Storefront >= 1.10.0 +- Have latest version of [magento2-rest-client](magento2-rest-client). At least you need [this PR](https://github.com/DivanteLtd/magento2-rest-client/pull/35) + +## Before you begin + +Before starting to integrate this module in your VueStorefront project, you will have to set-up the following: +- [Create a Adyen test account if you do not have one.](https://www.adyen.com/) +- [Set up the Adyen Customer Area.](https://docs.adyen.com/plugins/magento-2/set-up-adyen-customer-area) +- [Set up the plugin in Magento.](https://docs.adyen.com/plugins/magento-2/set-up-the-plugin-in-magento) +- [Set up the payment methods in Magento.](https://docs.adyen.com/plugins/magento-2/set-up-the-payment-methods-in-magento) #### Features: - [x] Adyen CreditCard payment -- [x] Adyen PayPal payment - [x] Adyen field validation and encryption. +- [x] 3DS2 authentification #### To be done: -- [ ] Add notifications depend on Adyen callbacks. +- [ ] Retry 3DS2 Authentification after entering wrong code. +- [ ] Adyen PayPal payment. - [ ] Add other payments methods. - -If you have any questions or suggestion then please feel free to drop a line ;) +- [ ] 3DS1 authentification. +- [ ] Store credit carts with Adyen Vault. ## Installation: ```shell -$ git clone git@github.com:melvin-hamilton-digital/vsf-payment-adyen.git ./vue-storefront/src/modules/adyen +$ git clone https://github.com/jimmylion/vsf-payment-adyen.git ./vue-storefront/src/modules/adyen ``` ## Configuration `config/local.json` Add API Key and paypal endpoint to hendle PayPal result from adyen. ```json -"adyen": { - "originKey": "origin_key", - "paypalResultHandler": "https://your-backend/adyen-end-points/paypal" -} + "adyen": { + "originKey": "origin_key", + "paypalResultHandler": "https://your-backend/adyen-end-points/paypal", + "environment": "test", + "saveCards": true/false, + "allow3DS2": true/false, + "originKeys": { + "http://localhost:3000": "your localhost origin_key", + "https://staging.your-vsf.com": "your staging origin_key", + "https://your-vsf.com": "your production origin key" + } + }, ``` set Driver for adyen @@ -40,11 +64,6 @@ set Driver for adyen } ``` -[How to get the API key](https://docs.adyen.com/developers/user-management/how-to-get-the-api-key) - -`sprykerConfirm` - used in /store/actions.ts -> backConfirmation - - ## Register the Adyen module @@ -52,11 +71,11 @@ In `./src/modules/index.ts` ```js ... -import { Adyen } from './adyen' +import { PaymentAdyen } from './payment-adyen'; export const registerModules: VueStorefrontModule[] = [ ..., - Adyen + PaymentAdyen ] ``` @@ -64,61 +83,32 @@ export const registerModules: VueStorefrontModule[] = [ Under your theme `components/core/blocks/Checkout/Payment.vue`. ```js -import CardForm from 'src/modules/adyen/components/CardForm' -import PayPal from 'src/modules/adyen/components/PayPal' - export default { components: { ... - CardForm, - PayPal - }, - ... - computed: { - ... - isAdyenValid () { - return this.$store.state.adyen.isAdyenValid - } + AdyenPayments: () => + import("src/modules/payment-adyen/components/AdyenPayments.vue") }, ``` +@todo - explain where and how to include the FinishPayment component. In our case it is in: +src/themes/jimmylion-theme/pages/Checkout.vue +src/themes/jimmylion-theme/components/ui/Checkout/OrderReview.vue + Also add form component to your template: ```html - - -``` -and !isAdyenValid to "Go review the order" button, for disabling it until all card data was validate. -```html - - {{ $t('Go review the order') }} - + ``` -Your backend should return -`"paymentmethods_endpoint": "https://www.en.spryker-demo.melvin-hamilton.store/vsbridge/cart/payment-methods?token={{token}}&cartId={{cartId}}",` -```json -{ - "code": 200, - "result": [ - { - "code": "adyenCreditCard", - "title": "Credit Card" - }, - { - "code": "adyenPayPal", - "title": "PayPal" - } - ] -} -``` -## References -In vue-storefront/src/modules/adyen/components/CardForm.vue find `csfSetupObj` inside you can add styles, placeholders, define rootNode etc. +## API Installation +[How to get the API key](https://docs.adyen.com/developers/user-management/how-to-get-the-api-key) + +## References [Styling Secured Fields](https://docs.adyen.com/developers/checkout/api-integration/configure-secured-fields/styling-secured-fields) ```js diff --git a/adyen-utils/.babelrc b/adyen-utils/.babelrc deleted file mode 100644 index 4d83c57..0000000 --- a/adyen-utils/.babelrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "presets": [ - ["@babel/preset-env", { - "targets": { - "browsers": [ ">0.25%"] - } - }] - ] -} diff --git a/adyen-utils/.gitignore b/adyen-utils/.gitignore deleted file mode 100644 index d3f255a..0000000 --- a/adyen-utils/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -node_modules -/coverage -/.idea -/*.log -.idea -.env -.idea/ - -.DS_Store -stats.json diff --git a/adyen-utils/LICENSE b/adyen-utils/LICENSE deleted file mode 100644 index 9df8200..0000000 --- a/adyen-utils/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2019 Adyen bv - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/adyen-utils/README.md b/adyen-utils/README.md deleted file mode 100644 index 48ce5b4..0000000 --- a/adyen-utils/README.md +++ /dev/null @@ -1,173 +0,0 @@ -# 3DS 2.0 JavaScript utilities - -These utilities are helper functions to get 3DS 2.0 integrated on to your webpage. - -## Requirements -3DS 2.0 Back-end integration with Adyen: https://docs.adyen.com/classic-integration/3d-secure-2-classic-integration/browser-based-integration/ - -## Installation - -#### Option A: Clone the repo and import functions directly through UMD / ES2015 -```javascript -import collectBrowserInfo from "./browser"; -import base64Url from "./base64url"; -import createIframe from "./iframe"; -import createForm from "./form"; -import config from "./config.js"; -``` - -#### Option B: Build the file, link to it and use ThreeDS2Utils on the global scope - -Install the development dependencies: -```terminal -npm install -``` -Build the file: -```terminal -npm run build -``` - -Embed it on your page: -``` - - \ No newline at end of file +