Skip to content

Commit

Permalink
Merge pull request #1099 from logeecom/master
Browse files Browse the repository at this point in the history
Update documentation with the correct links to external Adyen and commerce tools APIs
  • Loading branch information
brankologeecom authored Jul 17, 2023
2 parents 92629b9 + ad13352 commit c0fc16f
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Complete integration requires running both of the modules.

![Payment flow](./docs/images/payment-flow.svg)
1. Front end uses [Adyen Web Components](https://docs.adyen.com/checkout/supported-payment-methods) 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](./extension/docs/WebComponentsIntegrationGuide.md#step-3-get-available-payment-methods-optional). On user interaction, frontend web-component generates JSON payloads for [create payment sessions](https://docs.adyen.com/online-payments/web-components#create-payment-session) which has to be provided to commercetools payment as described [here](./extension/docs/WebComponentsIntegrationGuide.md#web-components-integration-guide).
2. With help of the [commercetools HTTP API Extensions](https://docs.commercetools.com/http-api-projects-api-extensions) provided data is sent to the Extension Module.
2. With help of the [commercetools HTTP API Extensions](https://docs.commercetools.com/api/projects/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](./extension/docs/WebComponentsIntegrationGuide.md#web-components-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.
Expand All @@ -44,7 +44,7 @@ Please follow the detailed guides below in order to integrate your front end wit
[![Docker Pulls](https://img.shields.io/docker/pulls/commercetools/commercetools-adyen-integration-extension)](https://hub.docker.com/r/commercetools/commercetools-adyen-integration-extension)

The extension module is a publicly exposed service that acts as a middleware between the commercetools platform and Adyen.
Once [commercetools HTTP API Extensions](https://docs.commercetools.com/http-api-projects-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.
Once [commercetools HTTP API Extensions](https://docs.commercetools.com/api/projects/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.

- Follow [Integration Guide](./extension/docs/WebComponentsIntegrationGuide.md) for information how to integrate your shop with this module.
- Follow [How to run](extension/docs/HowToRun.md) the extension module.
Expand Down
2 changes: 1 addition & 1 deletion extension/docs/CancelPayment.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ From this transaction, the `interactionId` field is being used as `originalRefer

#### Steps

To make a cancellation, [add a transaction](https://docs.commercetools.com/http-api-projects-payments#add-transaction)
To make a cancellation, [add a transaction](https://docs.commercetools.com/api/projects/payments#add-transaction)
with type `CancelAuthorization` and state `Initial` to the commercetools payment.

```json
Expand Down
2 changes: 1 addition & 1 deletion extension/docs/HowToRun.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Extension module requires 1 environment variable to start. This environment vari
| `other` | `logLevel` | The log level (`trace`, `debug`, `info`, `warn`, `error`, `fatal`). | `info` |
| `other` | `keepAliveTimeout` | Milliseconds to keep a socket alive after the last response ([Node.js docs](https://nodejs.org/dist/latest/docs/api/http.html#http_server_keepalivetimeout)). | Node.js default (5 seconds) |
| `other` | `generateIdempotencyKey` | If set to true, adyen-integration will generate the idempotency key for capture and refund requests. | false |
| `other` | `apiExtensionBaseUrl` | Publicly available URL of the Extension module. In case of any payment changes, [commercetools API extension](https://docs.commercetools.com/http-api-projects-api-extensions) will call this URL and pass the payment object in body. This attribute is used when calling `npm run setup-resources` | |
| `other` | `apiExtensionBaseUrl` | Publicly available URL of the Extension module. In case of any payment changes, [commercetools API extension](https://docs.commercetools.com/api/projects/api-extensions) will call this URL and pass the payment object in body. This attribute is used when calling `npm run setup-resources` | |

### External file configuration

Expand Down
2 changes: 1 addition & 1 deletion extension/docs/ManualCapture.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ By default, payments are captured immediately (or with [delay](https://docs.adye

### Make an API call to capture a payment:

To capture a payment manually, [add a transaction](https://docs.commercetools.com/http-api-projects-payments#add-transaction) with type `Charge` and state `Initial` to the commercetools payment.
To capture a payment manually, [add a transaction](https://docs.commercetools.com/api/projects/payments#add-transaction) with type `Charge` and state `Initial` to the commercetools payment.

```json
{
Expand Down
2 changes: 1 addition & 1 deletion extension/docs/Refund.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ From `Authorized` transaction, the `interactionId` field is being used as `origi

#### Steps

To make a (partial) refund, [add **at least one** transaction](https://docs.commercetools.com/http-api-projects-payments#add-transaction) with type `Refund` and state `Initial` to the commercetools payment.
To make a (partial) refund, [add **at least one** transaction](https://docs.commercetools.com/api/projects/payments#add-transaction) with type `Refund` and state `Initial` to the commercetools payment.
It is possible to add multiple `Refund` transactions and all of them will be processed in parallel.

```json
Expand Down
4 changes: 2 additions & 2 deletions extension/docs/UpdateAmountAndExtendAuthorisation.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ additionalData.authorisationType: PreAuth

<details>
<summary>
An example of payment [setCustomField](https://docs.commercetools.com/http-api-projects-payments#update-payment) action for `createSessionRequest` with additionalData field.
An example of payment [setCustomField](https://docs.commercetools.com/api/projects/payments#update-payment) action for `createSessionRequest` with additionalData field.
</summary>

```json
Expand Down Expand Up @@ -129,7 +129,7 @@ To update the amount, it is necessary to get `NotificationRequestItem` and obtai

#### 3. Amount updates request

To update the amount from the create session request, [set `amountUpdatesRequest` custom field](https://docs.commercetools.com/http-api-projects-payments#update-payment). This field should contain the fields as described in the Adyen documentation. Be aware that `amount` is the sum of the current amount + additional amount.
To update the amount from the create session request, [set `amountUpdatesRequest` custom field](https://docs.commercetools.com/api/projects/payments#update-payment). This field should contain the fields as described in the Adyen documentation. Be aware that `amount` is the sum of the current amount + additional amount.
Additionally, it must contain `paymentPspReference` field. `paymentPspReference` field contains `pspReference` from the pre-authorisation response (e.g. from `interactionInterface` field of created payment`). How such response could look like see [the previous point](#2-authorize-the-payment).

<details>
Expand Down
18 changes: 9 additions & 9 deletions extension/docs/WebComponentsIntegrationGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ Terms used in this guide:
- **Shopper** - a person that's using the shop.
- **Browser** - frontend part of the checkout UI (webshop).
- **Merchant server** - backend part of the checkout.
- **Extension module** - [extension module](https://github.com/commercetools/commercetools-adyen-integration#extension-module) configured as [commercetools HTTP API Extensions](https://docs.commercetools.com/http-api-projects-api-extensions) is handling checkout steps by intercepting payment modifications and communicating with Adyen API.
- **Extension module** - [extension module](https://github.com/commercetools/commercetools-adyen-integration#extension-module) configured as [commercetools HTTP API Extensions](https://docs.commercetools.com/api/projects/api-extensions) is handling checkout steps by intercepting payment modifications and communicating with Adyen API.
- **Notification module** - [notification module](https://github.com/commercetools/commercetools-adyen-integration#notification-module) processes asynchronous notifications from Adyen and stores payment state changes in commercetools payment object.

The following diagram shows checkout integration flow based on [Adyen Web Components](https://docs.adyen.com/online-payments/web-components/integrated-before-5-0-0).
The following diagram shows checkout integration flow based on [Adyen Web Components](https://docs.adyen.com/online-payments/build-your-integration?platform=Web&integration=Components&version=5.43.0#how-it-works).

![Flow](./adyen-checkout-flow-diagram.png)

Expand Down Expand Up @@ -75,14 +75,14 @@ Otherwise, the shopper might continue with further payment steps.

### Validate cart state

Check if [current cart has been ordered already](https://docs.commercetools.com/http-api-projects-carts#cartstate) (`Cart.cartState = Ordered`).
Check if [current cart has been ordered already](https://docs.commercetools.com/api/projects/carts#cartstate) (`Cart.cartState = Ordered`).
In this case, load order by ordered cart ID and show order confirmation page.
This might happen if the cart has been already ordered in a different tab (edge case)
or by an optional asynchronous process like [commercetools-payment-to-order-processor job](https://github.com/commercetools/commercetools-payment-to-order-processor).

### Recalculate cart

[Execute cart recalculate](https://docs.commercetools.com/http-api-projects-carts#recalculate) to ensure:
[Execute cart recalculate](https://docs.commercetools.com/api/projects/carts#recalculate) to ensure:

- Cart totals are always up-to-date
- Time-limited discounts are eventually removed from the cart (discounts are validated on re-calculate and order creation only).
Expand Down Expand Up @@ -142,7 +142,7 @@ Here's an example of how you would create a commercetools payment draft from scr
}
```

Create a [payment](https://docs.commercetools.com/http-api-projects-payments#create-a-payment) with commercetools API.
Create a [payment](https://docs.commercetools.com/api/projects/payments#create-payment) with commercetools API.

After successful payment creation always [add](https://docs.commercetools.com/api/projects/carts#add-payment) it to the appropriate cart.

Expand Down Expand Up @@ -260,7 +260,7 @@ After payment session is created successfully, you can obtain session ID and ses
**Preconditions**

- `createSessionRequest` must contain a unique payment `reference` value. The reference value cannot be duplicated in any commercetools payment and it's a required field by Adyen. The extension module uses the `reference` value to set the payment key in initial stage, later notification module uses it to look up corresponding payment after receiving notification for successful payment session creation. `Reference` may only contain alphanumeric characters, underscores and hyphens and must have a minimum length of 2 characters and a maximum length of 80 characters.
- `payment.amountPlanned` can not be changed if there is a `createSession` interface interaction present in the commercetools payment object. The `amount` value in `createSessionRequest` custom field must have the same value as `payment.amountPlanned`. This ensures eventual payment amount manipulations (i.e.: when [my-payments](https://docs.commercetools.com/http-api-projects-me-payments#my-payments) are used) for already initiated payment. In case `amountPlanned` needs to be changed and an existing commercetools payment resource with interface interaction of type `createSession` exists, please create a new commercetools payment instead of modifying the existing one.
- `payment.amountPlanned` can not be changed if there is a `createSession` interface interaction present in the commercetools payment object. The `amount` value in `createSessionRequest` custom field must have the same value as `payment.amountPlanned`. This ensures eventual payment amount manipulations (i.e.: when [my-payments](https://docs.commercetools.com/api/projects/me-payments#my-payments) are used) for already initiated payment. In case `amountPlanned` needs to be changed and an existing commercetools payment resource with interface interaction of type `createSession` exists, please create a new commercetools payment instead of modifying the existing one.

**Important**

Expand All @@ -282,7 +282,7 @@ Here's an example of the `createSessionRequest` custom field value for 3D Secure
}
```

An example of payment [setCustomField](https://docs.commercetools.com/http-api-projects-payments#update-payment) action with the prepared data above.
An example of payment [setCustomField](https://docs.commercetools.com/api/projects/payments#update-payment) action with the prepared data above.

```json
{
Expand Down Expand Up @@ -398,7 +398,7 @@ For some payment methods, it is necessary to provide [line item details](https:/

Extension module can generate the line item automatically, but you need to do following steps:

- The commercetools payment [referenced in the commercetools cart](https://docs.commercetools.com/http-api-projects-carts#add-payment).
- The commercetools payment [referenced in the commercetools cart](https://docs.commercetools.com/api/projects/carts#add-payment).
- Either `addCommercetoolsLineItems` property set to`true` within the `createSessionRequest` or `addCommercetoolsLineItems` flag set to `true` within your extension [configuration](./HowToRun.md#other-configurations).
> In case you would like to override the generation of the lineItems please provide within the `createSessionRequest` own `lineItems` data.
Expand Down Expand Up @@ -433,7 +433,7 @@ Here's an example of the `createSessionRequest` **WITHOUT** `lineItems` and `add
}
```

[Update commercetools payment](https://docs.commercetools.com/http-api-projects-payments#update-payment) with the request above.
[Update commercetools payment](https://docs.commercetools.com/api/projects/payments#update-payment) with the request above.

```json
{
Expand Down
2 changes: 1 addition & 1 deletion extension/src/api/payment/payment.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const logger = httpUtils.getLogger()
async function processRequest(request, response) {
if (request.method !== 'POST') {
// API extensions always calls this endpoint with POST, so if we got GET, we don't process further
// https://docs.commercetools.com/http-api-projects-api-extensions#input
// https://docs.commercetools.com/api/projects/api-extensions#input
logger.debug(
`Received non-POST request: ${request.method}. The request will not be processed...`
)
Expand Down
6 changes: 3 additions & 3 deletions notification/docs/IntegrationGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ As one notification module instance can receive notifications from multiple Adye

Each notification contains an `eventCode` that specifies which type of event triggered the notification.
Notification module maps this `eventCode` and `success` pair to
commercetools [transactionType](https://docs.commercetools.com/http-api-projects-payments#transactiontype)
and [transactionState](https://docs.commercetools.com/http-api-projects-payments#transactionstate).
commercetools [transactionType](https://docs.commercetools.com/api/projects/payments#transactiontype)
and [transactionState](https://docs.commercetools.com/api/projects/payments#transactionstate).

> All mappings can be found in the [adyen-events.json](./../resources/adyen-events.json) file.
Expand All @@ -108,7 +108,7 @@ If there is no transaction on the payment found,
the notification module will create a new transaction with the received `transactionType` and
`transactionState`. Otherwise, it will update the existing transaction with a new `transactionState`.

Received notification will be stored on the [interfaceInteraction](https://docs.commercetools.com/http-api-projects-payments#add-interfaceinteraction) of the payment.
Received notification will be stored on the [interfaceInteraction](https://docs.commercetools.com/api/projects/payments#add-interfaceinteraction) of the payment.
If the mapping for the received notification is not found then payment will be updated only with a new `interfaceInteraction`.
If payment is not found then the notification will be skipped from processing.

Expand Down

0 comments on commit c0fc16f

Please sign in to comment.