GithubHelp home page GithubHelp logo

adyen / adyen-commercetools Goto Github PK

View Code? Open in Web Editor NEW
44.0 20.0 45.0 6.43 MB

commercetools-adyen-integration provides an integration between the commercetools and Adyen payment service provider based on the concept of Adyen Web Components.

License: MIT License

JavaScript 94.64% HTML 4.66% Dockerfile 0.06% Shell 0.65%
payment adyen commercetools integration hacktoberfest

adyen-commercetools's Introduction

commercetools-adyen-integration

Build Status

commercetools-adyen-integration provides an Adyen Web Components based integration between the commercetools and Adyen PSP.

Supported features

  • Adyen Web Component based payment methods. For full list of payment methods that have been tested for CommerceTools integration please refer to supported payment methods section of this document.
    • Note: since the integration relies on the usage of Adyen's web components it does not need to process sensitive credit card data and thus is fully PCI DSS compliant.
  • Asynchronous notifications handling via notification module.
  • Multi-tenancy to serve multiple Adyen merchant accounts/commercetools projects with one application instance.
  • Refunding a payment back to the shopper.
  • Authorisation cancellation on a payment that has not yet been captured.
  • Manual capture of a payment.
  • Restore, which gives your shoppers an opportunity to offset their carbon emissions from the delivery or lifecycle of their purchase at checkout.
  • Store payment and disable stored payment gives your shoppers the ability to store payments for later use and removing these stored payments.

Supported payment methods

When adding payment methods in the Adyen Customer Area, please ensure you refer to the Adyen links below, as some payment methods require additional configuration. If you need assistance configuring your payment methods please contact Adyen Support via your Customer Area.

Credit and debit cards

Buy Now Pay Later

Cash and ATM payment methods

Online payments

Wallets

Prepaid and gift cards

Mobile

Overview

This repository contains two standalone modules that interact with commercetools and Adyen. Complete integration requires running both of the modules.

Payment flow

  1. Front end uses Adyen Web Components to present required payment methods. The list of available payment methods can be also obtained through the integration with the help of get available payment methods request. On user interaction, frontend web-component generates JSON payloads for create payment sessions which has to be provided to commercetools payment as described here.
  2. With help of the commercetools HTTP API Extensions provided data is sent to the Extension Module.
  3. The Extension Module processes provided web component payload passed by the front end, exchanges it with Adyen API, and provides synchronous response back to the front end / commercetools caller. Based on result, the front end either creates an order or continues with further payment steps as described in the integration guide. Note that order/cart creations/modifications should be part of the front end business logic. commercetools-adyen-integration will neither change the cart nor the order.

In addition with help of Adyen notifications any payment status changes are asynchronously exchanged between Adyen and commercetools. Please follow the detailed guides below in order to integrate your front end with the Extension and Notification modules.

Extension module

Docker Pulls

The extension module is a publicly exposed service that acts as a middleware between the commercetools platform and Adyen. Once commercetools HTTP API Extensions is configured to call Adyen extension module, for every payment create or update request an Adyen extension will be remotely called by the commercetools platform.

Notification module

Docker Pulls

Notification module is a publicly exposed service which receives asynchronous notifications sent by Adyen. Through notifications, Adyen provides asynchronously payment status changes like authorization, charge, or refund of the payment. The notification module will process the notification sent by Adyen and matches the commercetools payment for this notification, and modifies commercetools payment accordingly.

Other guides

  • Follow the FAQ for the answers to frequently asked questions, such as order creation, deployment etc.
  • Follow the Contribution Guide if you would like to run modules locally.

adyen-commercetools's People

Contributors

ahmetoz avatar aqum avatar brankologeecom avatar butenkor avatar cneijenhuis avatar danilomsou avatar dependabot-preview[bot] avatar dependabot[bot] avatar emmenko avatar ethann avatar goran-stamenkovski-logeecom avatar heshammassoud avatar hollowman6 avatar jamiegardiner avatar jasond-adyen avatar judeniroshan avatar leqada avatar leungkinghin avatar leungkinghin-ct avatar logeecom avatar lojzatran avatar luispinto-commercetools avatar marijaiv avatar max-john avatar merijndebeer-adyen avatar praveenkumarct avatar renovate-bot avatar renovate[bot] avatar salander85 avatar zackpollard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adyen-commercetools's Issues

On error write interfaceInteraction only once

When we receive error response from Adyen, we should check if the error has been already logged in interfaceInteractions. If yes, then don't add new interfaceInteractions. This will prevent unnecessary load on our platform in case someone tries to make a payment multiple times with wrong credentials.

Add support for Chargeback/Refund/Cancelation of reservation

It is not un-common that front end or any other party would like to trigger over CTP API a Chargeback/Refund/Cancelation of reservation for existing payment object (wrong payment amount due tab usage, refunds triggered by logistic system). We should be able to process such transaction and exchange required data with Adyen. It involves changes on both sides of the module.

  • Extensions (in case new transaction has been added)
  • Notifications (create transaction of type refund/cancelation/chargeback or just map notification status to existing transaction)

Implement Paypal

Docs: https://docs.adyen.com/developers/payment-methods/paypal

Q: If I don’t do last step, then I will not receive money? https://docs.adyen.com/developers/payment-methods/paypal#step4presentpaymentresult
A: the last step to verify is request even is mandatory but it doesn't play any significant role. Everything has happened already. You need to treat credit card 3ds and Local methods (everything except credit cards) separately.

Q: In Adyen’s docs for Paypal it is written authorised: The payment was successful. You will receive the funds in 3 days. Does it mean the shop can already prepare the order when the payment got authorised or should the shop wait until the funds are transferred? And will I receive any notifications from Adyen when the money is transfered?
A: We don't provide notification when the money are settled. It takes up to 3 days for money to settle. The money are authorsied and cannot be used by the user. The settlement time is 3 days.

Create an interfaceInteraction type on initialisation

Define it with the following draft:

{
  "key": "ctp-adyen-integration-interaction-notification",
  "name": {
    "en": "ctp-adyen-integration-interaction-notification"
  },
  "resourceTypeIds": [
    "payment-interface-interaction"
  ],
  "fieldDefinitions": [
    {
      "name": "timestamp",
      "label": {
        "en": "timestamp"
      },
      "required": true,
      "type": {
        "name": "String"
      },
      "inputHint": "SingleLine"
    },
    {
      "name": "transactionId",
      "label": {
        "en": "transactionId"
      },
      "required": false,
      "type": {
        "name": "String"
      },
      "inputHint": "SingleLine"
    },
    {
      "name": "notification",
      "label": {
        "en": "notification"
      },
      "required": true,
      "type": {
        "name": "String"
      },
      "inputHint": "MultiLine"
    },
    {
      "name": "status",
      "label": {
        "en": "status"
      },
      "required": false,
      "type": {
        "name": "String"
      },
      "inputHint": "SingleLine"
    }
  ]
}

Clarify 'authorization' status with Adyen

When notification module receives a notification with type 'Authorization', it creates a new transaction with type 'Authorization'. In this case, it should update Charge transaction instead as for Adyen, 'authorization' means charge.

Task: clarify the statement above with Adyen and update the modules accordingly.

Prevent calling Adyen multiple times

Define when to call Adyen and how to prevent extension module to call multiple times unnecessarily (e.g. when an unrelated field is changed on payment).

Ability to disable resource creation in extension and notification module

It would be good to be able to disable the automatic resource creation/updating that happens as part of the startup of the server for both the extension module and the notification module. I propose that an environment variable boolean flag is provided so that if users are managing these resources themselves (i.e. through terraform) then they have the ability to disable this functionality.

Consider passing an object instead of multiple arguments

as suggested by @emmenko #17 (comment)
For example:

function getAddTransactionUpdateAction ({ type, state, amount, currency }) { // object instead of 4 different params
  return {
    action: 'addTransaction',
    transaction: {
      type,
      amount: {
        currencyCode: currency,
        centAmount: amount
      },
      state
    }
  }
}

getAddTransactionUpdateAction({ type: 'bla', state: 'bla', amount: 'bla', currency: 'bla' })

A benefit of this approach is that one doesn't need to presume the order of arguments. They just have to be in the object.

Log JSON payload if a JSON parsing error occured

Right now if this line fails
https://github.com/commercetools/commercetools-adyen-integration/blob/a6959d906ab6cc5050b872daefb6de40f88cb071/notification/src/api/notification/notification.controller.js#L17

we will log it like this:

err: {
 message:  "Unexpected number in JSON at position 652"    
 name:  "SyntaxError"    
 stack:  "SyntaxError: Unexpected number in JSON at position 652
  at JSON.parse (<anonymous>)
  at handleNotification (/app/src/api/notification/notification.controller.js:16:38)
  at process._tickCallback (internal/process/next_tick.js:68:7)"    
}

It's impossible to identify what was exactly wrong with the payload that it failed to parse.
We should catch the JSON parsing separately and in this case log the payload too.

Implement KCP payment method

First, create a request to Adyen:

POST https://checkout-test.adyen.com/v40/payments

{
  "amount":{
    "currency":"KRW",
    "value":1000000
  },
  "reference":"123",
  "paymentMethod":{
    "type":"kcp_creditcard"
  
  },
  "returnUrl":"https://your-company.com/checkout/",
  "merchantAccount":"CommercetoolsGmbHDE775"
}

Redirect user to the URL in the response.

backend_connection_closed_before_data_sent_to_client errors from Google Load balancer

After serving a socket Node.js (starting from version 8) by default waits 5 seconds after the last response before it destroys the socket.

It might happen that a Load Balancer will try to reuse the socket but Node.js will destroy it because it hits the keeping alive timeout.

For more details (a case with Google Load Balancer):
https://amoss.me/2019/01/debugging-http-502-errors-on-google-kubernetes-engine/

Google recommendation on the value of this param for Google Load Balancer:
https://cloud.google.com/load-balancing/docs/https/#timeouts_and_retries

Investigate if there's SVS endpoint to check for gift card amount

For paying by SVS, Adyen expects gift card number and gift card amount provided in the request.

How to get the amount:
When shopper types his card, check against your database and you get the amount. Then you send this amount and card number to Adyen.

Right now this checking should be done in the shop and then shop saves to custom fields the gift card number and the amount. Later this could be changed to be done by the adyen integration so shop will save only the gift card number to payment. In order to do this, we need to communicate with SVS to see if there's an option.

Extension incompatible with /me/payments endpoint

When trying to use this extension alongside the /me/payments endpoint in order to create and process a payment, the extension throws an error due to being unable to specify an interfaceId from the My Payments version of the endpoint. Did some quick testing and removed the interfaceId validation from the extension and generated a random UUID instead and then the payment processes fine. What would need to be done in order to get this working properly with the my payment endpoint? It seems like you'd want to be able to specify the interfaceId from the client side in order to get the benefit of de-duplicating payments.

Group payment handlers classes

Check if the implementation of payment handlers classes could be grouped into one class. Right now there are not many differences between them.

Remove legacy hostnames

Description

To improve the developer experience and easen our support and training burden all existing references to *.sphere.io and .commercetools.co host names should be removed in favor of not defaulting to a specific region (a common complaint of US and AWS customers is that EU is defaulted everywhere) or, if needed for backwards compatibility, be replaced with the new *.europe-west1.gcp.commercetools.com notation.

Expected Behavior

full text search over the repository for ".sphere.io" and ".commercetools.co" should yield zero results

Context

https://docs.commercetools.com/release-notes#releases-2020-02-03-aws-and-new-hostnames

Add 3ds credit card payment

See: https://docs.adyen.com/developers/payment-methods/cards-with-3d-secure

Q: what will happen in case if I don’t do Complete payment? Will I receive the money later or not? https://docs.adyen.com/developers/payment-methods/cards-with-3d-secure#step4completepayment
A: Nothing will happened. We won't send request to the issuing bank and they won't authorize the payment nor hold money

Q: will I see anything in the payment list if I don’t do Complete payment? https://ca-test.adyen.com/ca/ca/payments/showList.shtml
A: it will be like an open offer on our side which is in Offer list, not Payment list. If you don’t do Complete Payment for 3DS, there will be no payment displayed in the payment list.

Q: how long after I receive the redirect can I make the Complete payment step?
A: not sure about it, but from my understanding there is no validity time. And if you don't send this request nothing will happen. We will send you notification to your sever with the status.

Remove adyen-cse-js

Remove dependency https://github.com/Adyen/adyen-cse-web from package.json as now it's deprecated.
In order to be able to remove it, tests needs to be rewritten as this module has been used to generate credit card numbers without the need for UI.

Improve error handling

Right now we return only throw new Error('Payment is not supported.'). When there's an error in a payment, we should validate and then reject the payment with meaningful message to end user.

createdAt on addInterfaceInteraction action is empty

We got this error in a notification module where createdAt={}. This returns error from the platform:

{
  "code": 502,
  "statusCode": 502,
  "status": 502,
  "message": "'500' is not an expected status code.",
  "originalRequest": {
    "uri": "/our-demo-project/payments/9ff06372-4812-4293-916b-01c58864c056",
    "method": "POST",
    "body": {
      "version": 101,
      "actions": [
        {
          "action": "addInterfaceInteraction",
          "type": {
            "key": "ctp-adyen-integration-interaction-notification",
            "typeId": "type"
          },
          "fields": {
            "createdAt": {},
            "status": "AUTHORISATION",
            "notification": "{\"NotificationRequestItem\":{\"additionalData\":{\"expiryDate\":\"10/2020\",\"authCode\":\"39697\",\"cardSummary\":\"1142\"},\"amount\":{\"currency\":\"EUR\",\"value\":495},\"eventCode\":\"AUTHORISATION\",\"eventDate\":\"2019-07-03T19:19:30+02:00\",\"merchantAccountCode\":\"CommercetoolsGmbHDE775\",\"merchantReference\":\"paymentReferenceId\",\"operations\":[\"CANCEL\",\"CAPTURE\",\"REFUND\"],\"paymentMethod\":\"visa\",\"pspReference\":\"853562174370815K\",\"reason\":\"39697:1142:10/2020\",\"success\":\"true\"}}"
          }
        }
      ]
    },
    "headers": {
      "Accept": "application/json",
      "Content-Type": "application/json",
      "Authorization": [
        "Bearer ********"
      ]
    }
  },
  "retryCount": 0,
  "headers": {
    "server": [
      "nginx"
    ],
    "date": [
      "Fri, 05 Jul 2019 22:04:19 GMT"
    ],
    "content-type": [
      "application/json; charset=utf-8"
    ],
    "content-length": [
      "337"
    ],
    "x-http-status-caused-by-extension": [
      "true"
    ],
    "server-timing": [
      "projects;dur=74"
    ],
    "x-correlation-id": [
      "projects-c055bbda-12ee-45d2-9b53-09e9f02fc4a4"
    ],
    "x-served-by": [
      "api-gce-bf772e57.sphere.prod.commercetools.de"
    ],
    "x-served-config": [
      "sphere-projects-ws-1.0"
    ],
    "access-control-allow-origin": [
      "*"
    ],
    "access-control-allow-headers": [
      "Accept, Authorization, Content-Type, Origin, User-Agent"
    ],
    "access-control-allow-methods": [
      "GET, POST, DELETE, OPTIONS"
    ],
    "access-control-max-age": [
      "299"
    ],
    "via": [
      "1.1 google"
    ],
    "alt-svc": [
      "clear"
    ],
    "connection": [
      "close"
    ]
  },
  "body": {
    "statusCode": 502,
    "message": "'500' is not an expected status code.",
    "errors": [
      {
        "code": "ExtensionBadResponse",
        "message": "'500' is not an expected status code.",
        "extensionErrors": [],
        "extensionBody": "",
        "extensionStatusCode": 500,
        "extensionId": "42ffdeb9-70c7-4630-b033-3de4b91886f2",
        "extensionKey": "ctp-adyen-integration-payment-extension"
      }
    ]
  },
  "name": "HttpError",
  "stack": "HttpError: '500' is not an expected status code.\\n    at createError (/app/node_modules/@commercetools/sdk-middleware-http/dist/commercetools-sdk-middleware-http.cjs.js:236:10)\\n    at /app/node_modules/@commercetools/sdk-middleware-http/dist/commercetools-sdk-middleware-http.cjs.js:341:25\\n    at <anonymous>\\n    at process._tickCallback (internal/process/next_tick.js:189:7)"
}

The complete log:

{
  "insertId": "sb6tfrf832tku",
  "jsonPayload": {
    "hostname": "xxx",
    "adyenRequestBody": "{\"live\":\"false\",\"notificationItems\":[{\"NotificationRequestItem\":{\"additionalData\":{\"expiryDate\":\"10\\/2020\",\"authCode\":\"39697\",\"cardSummary\":\"1142\"},\"amount\":{\"currency\":\"EUR\",\"value\":495},\"eventCode\":\"AUTHORISATION\",\"eventDate\":\"2019-07-03T19:19:30+02:00\",\"merchantAccountCode\":\"CommercetoolsGmbHDE775\",\"merchantReference\":\"paymentReferenceId\",\"operations\":[\"CANCEL\",\"CAPTURE\",\"REFUND\"],\"paymentMethod\":\"visa\",\"pspReference\":\"853562174370815K\",\"reason\":\"39697:1142:10\\/2020\",\"success\":\"true\"}}]}",
    "level": 50,
    "name": "ctp-adyen-integration-notifications",
    "v": 0,
    "err": {
      "message": "Unexpected error during updating a payment with ID: 9ff06372-4812-4293-916b-01c58864c056. Exiting. Error: {\"code\":502,\"statusCode\":502,\"status\":502,\"message\":\"'500' is not an expected status code.\",\"originalRequest\":{\"uri\":\"/our-demo-project/payments/9ff06372-4812-4293-916b-01c58864c056\",\"method\":\"POST\",\"body\":{\"version\":101,\"actions\":[{\"action\":\"addInterfaceInteraction\",\"type\":{\"key\":\"ctp-adyen-integration-interaction-notification\",\"typeId\":\"type\"},\"fields\":{\"createdAt\":{},\"status\":\"AUTHORISATION\",\"notification\":\"{\\\"NotificationRequestItem\\\":{\\\"additionalData\\\":{\\\"expiryDate\\\":\\\"10/2020\\\",\\\"authCode\\\":\\\"39697\\\",\\\"cardSummary\\\":\\\"1142\\\"},\\\"amount\\\":{\\\"currency\\\":\\\"EUR\\\",\\\"value\\\":495},\\\"eventCode\\\":\\\"AUTHORISATION\\\",\\\"eventDate\\\":\\\"2019-07-03T19:19:30+02:00\\\",\\\"merchantAccountCode\\\":\\\"CommercetoolsGmbHDE775\\\",\\\"merchantReference\\\":\\\"paymentReferenceId\\\",\\\"operations\\\":[\\\"CANCEL\\\",\\\"CAPTURE\\\",\\\"REFUND\\\"],\\\"paymentMethod\\\":\\\"visa\\\",\\\"pspReference\\\":\\\"853562174370815K\\\",\\\"reason\\\":\\\"39697:1142:10/2020\\\",\\\"success\\\":\\\"true\\\"}}\"}}]},\"headers\":{\"Accept\":\"application/json\",\"Content-Type\":\"application/json\",\"Authorization\":[\"Bearer ********\"]}},\"retryCount\":0,\"headers\":{\"server\":[\"nginx\"],\"date\":[\"Fri, 05 Jul 2019 22:04:19 GMT\"],\"content-type\":[\"application/json; charset=utf-8\"],\"content-length\":[\"337\"],\"x-http-status-caused-by-extension\":[\"true\"],\"server-timing\":[\"projects;dur=74\"],\"x-correlation-id\":[\"projects-c055bbda-12ee-45d2-9b53-09e9f02fc4a4\"],\"x-served-by\":[\"api-gce-bf772e57.sphere.prod.commercetools.de\"],\"x-served-config\":[\"sphere-projects-ws-1.0\"],\"access-control-allow-origin\":[\"*\"],\"access-control-allow-headers\":[\"Accept, Authorization, Content-Type, Origin, User-Agent\"],\"access-control-allow-methods\":[\"GET, POST, DELETE, OPTIONS\"],\"access-control-max-age\":[\"299\"],\"via\":[\"1.1 google\"],\"alt-svc\":[\"clear\"],\"connection\":[\"close\"]},\"body\":{\"statusCode\":502,\"message\":\"'500' is not an expected status code.\",\"errors\":[{\"code\":\"ExtensionBadResponse\",\"message\":\"'500' is not an expected status code.\",\"extensionErrors\":[],\"extensionBody\":\"\",\"extensionStatusCode\":500,\"extensionId\":\"42ffdeb9-70c7-4630-b033-3de4b91886f2\",\"extensionKey\":\"ctp-adyen-integration-payment-extension\"}]},\"name\":\"HttpError\",\"stack\":\"HttpError: '500' is not an expected status code.\\n    at createError (/app/node_modules/@commercetools/sdk-middleware-http/dist/commercetools-sdk-middleware-http.cjs.js:236:10)\\n    at /app/node_modules/@commercetools/sdk-middleware-http/dist/commercetools-sdk-middleware-http.cjs.js:341:25\\n    at <anonymous>\\n    at process._tickCallback (internal/process/next_tick.js:189:7)\"}",
      "stack": "Error: Unexpected error during updating a payment with ID: 9ff06372-4812-4293-916b-01c58864c056. Exiting. Error: {\"code\":502,\"statusCode\":502,\"status\":502,\"message\":\"'500' is not an expected status code.\",\"originalRequest\":{\"uri\":\"/our-demo-project/payments/9ff06372-4812-4293-916b-01c58864c056\",\"method\":\"POST\",\"body\":{\"version\":101,\"actions\":[{\"action\":\"addInterfaceInteraction\",\"type\":{\"key\":\"ctp-adyen-integration-interaction-notification\",\"typeId\":\"type\"},\"fields\":{\"createdAt\":{},\"status\":\"AUTHORISATION\",\"notification\":\"{\\\"NotificationRequestItem\\\":{\\\"additionalData\\\":{\\\"expiryDate\\\":\\\"10/2020\\\",\\\"authCode\\\":\\\"39697\\\",\\\"cardSummary\\\":\\\"1142\\\"},\\\"amount\\\":{\\\"currency\\\":\\\"EUR\\\",\\\"value\\\":495},\\\"eventCode\\\":\\\"AUTHORISATION\\\",\\\"eventDate\\\":\\\"2019-07-03T19:19:30+02:00\\\",\\\"merchantAccountCode\\\":\\\"CommercetoolsGmbHDE775\\\",\\\"merchantReference\\\":\\\"paymentReferenceId\\\",\\\"operations\\\":[\\\"CANCEL\\\",\\\"CAPTURE\\\",\\\"REFUND\\\"],\\\"paymentMethod\\\":\\\"visa\\\",\\\"pspReference\\\":\\\"853562174370815K\\\",\\\"reason\\\":\\\"39697:1142:10/2020\\\",\\\"success\\\":\\\"true\\\"}}\"}}]},\"headers\":{\"Accept\":\"application/json\",\"Content-Type\":\"application/json\",\"Authorization\":[\"Bearer ********\"]}},\"retryCount\":0,\"headers\":{\"server\":[\"nginx\"],\"date\":[\"Fri, 05 Jul 2019 22:04:19 GMT\"],\"content-type\":[\"application/json; charset=utf-8\"],\"content-length\":[\"337\"],\"x-http-status-caused-by-extension\":[\"true\"],\"server-timing\":[\"projects;dur=74\"],\"x-correlation-id\":[\"projects-c055bbda-12ee-45d2-9b53-09e9f02fc4a4\"],\"x-served-by\":[\"api-gce-bf772e57.sphere.prod.commercetools.de\"],\"x-served-config\":[\"sphere-projects-ws-1.0\"],\"access-control-allow-origin\":[\"*\"],\"access-control-allow-headers\":[\"Accept, Authorization, Content-Type, Origin, User-Agent\"],\"access-control-allow-methods\":[\"GET, POST, DELETE, OPTIONS\"],\"access-control-max-age\":[\"299\"],\"via\":[\"1.1 google\"],\"alt-svc\":[\"clear\"],\"connection\":[\"close\"]},\"body\":{\"statusCode\":502,\"message\":\"'500' is not an expected status code.\",\"errors\":[{\"code\":\"ExtensionBadResponse\",\"message\":\"'500' is not an expected status code.\",\"extensionErrors\":[],\"extensionBody\":\"\",\"extensionStatusCode\":500,\"extensionId\":\"42ffdeb9-70c7-4630-b033-3de4b91886f2\",\"extensionKey\":\"ctp-adyen-integration-payment-extension\"}]},\"name\":\"HttpError\",\"stack\":\"HttpError: '500' is not an expected status code.\\n    at createError (/app/node_modules/@commercetools/sdk-middleware-http/dist/commercetools-sdk-middleware-http.cjs.js:236:10)\\n    at /app/node_modules/@commercetools/sdk-middleware-http/dist/commercetools-sdk-middleware-http.cjs.js:341:25\\n    at <anonymous>\\n    at process._tickCallback (internal/process/next_tick.js:189:7)\"}\n    at updatePaymentWithRepeater (/app/src/handler/notification/notification.handler.js:45:15)\n    at <anonymous>\n    at process._tickCallback (internal/process/next_tick.js:189:7)",
      "name": "Error"
    },
    "pid": 22,
    "msg": "Unexpected exception occurred."
  },
  "resource": {
    "type": "container",
    "labels": {
      "xxx": "xxx"
    }
  },
  "timestamp": "2019-07-05T22:04:19.627Z",
  "severity": "INFO",
  "labels": {
    "xxx": "xxx"
  },
  "logName": "xxx",
  "receiveTimestamp": "2019-07-05T22:04:32.033121670Z"
}

Implement credit card 3DS 2.0

Since September 2019 there will be only support for 3DS 2.0. Therefore we need to implement this feature.
Documentation: https://docs.adyen.com/developers/risk-management/3d-secure-2-0

If the credit card issuers are not supporting 2.0, there will be a threeDSFallbackPolicy. We can configure this behaviour per merchantAccount.
We can either:

  • do 3ds1 - we need to support it
  • go straight to authorization (possibly with free liability shift)
  • fail the transaction

Implement gift cards with SVS

Adyen documentation (notice: as on 20.2.2019, the examples are wrong): https://docs.adyen.com/developers/payment-methods/gift-cards-givex-and-svs

Example request for different type of gift card:

POST https://pal-test.adyen.com/pal/servlet/Payment/v40/authorise

{
  "amount":{
    "currency":"GBP",
    "value":0
  },
  "card":{
    "cvc":"1234",
    "expiryMonth":"12",
    "expiryYear":"2018",
    "holderName":"John Smith",
    "number":"6036283997595793321"
  },
  "reference":"asdfasdf",
  "deliveryDate":"2019-04-13T02:00:00+02:00",
  "merchantAccount":"CommercetoolsGmbHDE775",
  "selectedBrand":"givex"
}

In order to test SVS, SVS needs to be directly contacted.

Q: if the gift card value is lower than the payment, what happens in this case?
A: You will get refused. On the checkout page you can make auth only for one payment method.

Q: if gift card value is more than the paid amount, what happens to the rest of the value?
A: well, for sure you can redeem the rest in the next attempt

Q: how to make payment partially with gift card and partially with credit card?
A: When the customer selects product on your side and he wants to redeem gift card and then pay the rest with credit card the flow will be next:

  1. Make an authorise call to /authorise endpoint and redeem the card.
  2. Adjust the amount on your page and show to the shopper credit card payment method (or any other methods)
  3. So it will be 2 different payments requests. And you need to have a logic on your side to handle it. It is not possible to make such request in one go.

Q: the amount here is the amount of the gift card?
A: it’s the amount customer wants to redeem from his gift card

Q: it’s a bit strange that the amount is input by user. Usually user has no idea what is the amount of gift card, so he inputs only the card number. So how do I create the gift card request?
A: So my understanding is next: you as a merchant create a contract with SVS or GIVEX and they issue the cards for you. So you know the balance and probably you will know all the numbers of these cards. So you know the amount by mask.

Running extension and notification module in AWS Lambda

Currently both the extension and notification module have to be run as an HTTP endpoint, however the commercetools platform provides the option to run API extensions on AWS Lambda. We would like to use this option if possible, however this would require some changes to the way the modules currently work. Is this something you are looking to eventually build for these modules? If not, would it be something you would be willing to accept a pull request for? If neither of these are an option we will likely end up building a wrapper around the module to call the internal HTTP endpoint, however we would prefer to have a more integrated solution.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.