Skip to content

Commit

Permalink
CR
Browse files Browse the repository at this point in the history
  • Loading branch information
witoszekdev committed Sep 18, 2024
1 parent 984acfc commit 5cb0c60
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 34 deletions.
18 changes: 12 additions & 6 deletions docs/developer/app-store/apps/adyen/architecture.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,34 @@ The app restricts Saleor API response time to 5 seconds for [`TransactionInitial

If such timeout happens, the created [`TransactionItem`](api-reference/payments/objects/transaction-item.mdx) will not have the metadata from Adyen on `additionalDetails` object, which includes payment method type, credit card brand, etc.

### Granted refunds vs manual refunds
### Refund with line items vs refund with manual amount

:::note
In Saleor Dashboard you can choose between two types of refunds that use different Saleor APIs:
- **"Refund with line items"** - creates [OrderGrantedRefund](/api-reference/orders/objects/order-granted-refund.mdx) and sends a refund to Adyen App using [`transactionRequestRefundForGrantedRefund`](/api-reference/payments/mutations/transaction-request-refund-for-granted-refund.mdx)
- **"Refund with manual amount"** - sends refund request to Adyen App using [`transactionRequestAction`](api-reference/payments/mutations/transaction-request-action.mdx)
:::

There are differences in how refunds are handled depending on whether a [`OrderGrantedRefund`](/api-reference/orders/objects/order-granted-refund.mdx) was created in Saleor and a refund via [`transactionRequestRefundForGrantedRefund`](api-reference/payments/mutations/transaction-request-refund-for-granted-refund.mdx) mutation was requested, or a "manual refund" sent via [`transactionRequestAction`](/api-reference/payments/mutations/transaction-request-action.mdx) mutation was requested. The differences are in how [`lineItems`](https://docs.adyen.com/api-explorer/Checkout/71/post/payments/_paymentPspReference_/refunds#request-lineItems.mdx) are reported to Adyen

#### Manual refund
#### Refund with manual amount

A manual refund is initiated using the [`transactionRequestAction`](/api-reference/payments/mutations/transaction-request-action.mdx) mutation.
This refund is initiated using the [`transactionRequestAction`](/api-reference/payments/mutations/transaction-request-action.mdx) mutation.

When a manual refund is requested, the app will send `lineItems` to Adyen if the `amount` is equal to or greater than the Order's total gross amount.
In other cases' app will not send `lineItems` to Adyen.

#### Granted refund
#### Refund with line items


<Badge
text="Added in Saleor 3.15"
class="badge badge--secondary margin-bottom--sm"
/>

A granted refund is initiated using the [`transactionRequestRefundForGrantedRefund`](/api-reference/payments/mutations/transaction-request-refund-for-granted-refund.mdx) mutation.
This refund is initiated using the [`transactionRequestRefundForGrantedRefund`](/api-reference/payments/mutations/transaction-request-refund-for-granted-refund.mdx) mutation.

When granted refund is requested, app will map `grantedRefund.lines.orderLines` to `lineItems` reported to Adyen. Additionally, if `grantedRefund.shippingCostIncluded` is set to true, the app will include a shipping line in the `lineItems` sent to Adyen.
When refund for granted refund is requested, app will map `grantedRefund.lines.orderLines` to `lineItems` reported to Adyen. Additionally, if `grantedRefund.shippingCostIncluded` is set to true, the app will include a shipping line in the `lineItems` sent to Adyen.

## TransactionItem metadata

Expand Down
68 changes: 40 additions & 28 deletions docs/developer/app-store/apps/adyen/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,46 @@ Adyen App uses Adyen [Checkout API v70](https://docs.adyen.com/api-explorer/#/Ch

If you want to self-host the Adyen app, reach out to [our team <Mail size={12}/>](mailto:[email protected]).

### Adyen notifications

:::caution
If notification event is not listed below it will be **ignored** by the app.
:::

:::info
Notifications for payments made without using Adyen app will be ignored. This happens because they do not have required `metadata` ([see more details](#receiving-notifications-for-transactions-not-started-in-adyen-app))
:::

App supports following notification events from Adyen:

- [`Authorisation`](https://docs.adyen.com/api-explorer/Webhooks/1/post/AUTHORISATION)
- [`AuthorisationAdjustment`](https://docs.adyen.com/api-explorer/Webhooks/1/post/AUTHORISATION_ADJUSTMENT)
- [`Cancellation`](https://docs.adyen.com/api-explorer/Webhooks/1/post/CANCELLATION)
- [`CancelOrRefund`](https://docs.adyen.com/api-explorer/Webhooks/1/post/CANCEL_OR_REFUND)
- [`Capture`](https://docs.adyen.com/api-explorer/Webhooks/1/post/CAPTURE)
- [`CaptureFailed`](https://docs.adyen.com/api-explorer/Webhooks/1/post/CAPTURE_FAILED)
- [`Expire`](https://docs.adyen.com/api-explorer/Webhooks/1/post/EXPIRE)
- [`OrderClosed`](https://docs.adyen.com/api-explorer/Webhooks/1/post/ORDER_CLOSED)
- [`Refund`](https://docs.adyen.com/api-explorer/Webhooks/1/post/REFUND)
- [`RefundFailed`](https://docs.adyen.com/api-explorer/Webhooks/1/post/REFUND_FAILED)
- [`RefundedReversed`](https://docs.adyen.com/api-explorer/Webhooks/1/post/REFUNDED_REVERSED)
- [`RefundWithData`](https://docs.adyen.com/api-explorer/Webhooks/1/post/REFUND_WITH_DATA)
- [`VoidPendingRefund`](https://docs.adyen.com/api-explorer/Webhooks/1/post/VOID_PENDING_REFUND)
- [`Chargeback`](https://docs.adyen.com/api-explorer/Webhooks/1/post/CHARGEBACK)
- [`SecondChargeback`](https://docs.adyen.com/api-explorer/Webhooks/1/post/SECOND_CHARGEBACK)
- [`ChargebackReversed`](https://docs.adyen.com/api-explorer/Webhooks/1/post/CHARGEBACK_REVERSED)

Following events will be mapped to `INFO` event in Saleor, it will not change amounts on `TransactionItem`:
- `HandledExternally`
- [`PostponedRefund`](https://docs.adyen.com/api-explorer/Webhooks/1/post/POSTPONED_REFUND)
- [`NotificationOfFraud`](https://docs.adyen.com/api-explorer/Webhooks/1/post/NOTIFICATION_OF_FRAUD)
- [`NotificationOfChargeback`](https://docs.adyen.com/api-explorer/Webhooks/1/post/NOTIFICATION_OF_CHARGEBACK)
- [`PrearbitrationLost`](https://docs.adyen.com/api-explorer/Webhooks/1/post/PREARBITRATION_LOST)
- [`PrearbitrationWon`](https://docs.adyen.com/api-explorer/Webhooks/1/post/PREARBITRATION_WON)
- [`RequestForInformation`](https://docs.adyen.com/api-explorer/Webhooks/1/post/REQUEST_FOR_INFORMATION)
- [`ManualReviewAccept`](https://docs.adyen.com/api-explorer/Webhooks/1/post/MANUAL_REVIEW_ACCEPT)
- [`ManualReviewReject`](https://docs.adyen.com/api-explorer/Webhooks/1/post/MANUAL_REVIEW_REJECT)

## Assumptions

- If Adyen doesn't respond to app request for [initialize transaction session](/developer/extending/webhooks/synchronous-events/transaction#initialize-transaction-session) or [process transaction session](/developer/extending/webhooks/synchronous-events/transaction#process-transaction-session) with `pspReference`:
Expand All @@ -59,34 +99,6 @@ If you want to self-host the Adyen app, reach out to [our team <Mail size={12}/>
- `AUTHORIZATION_FAILURE`
- [Webhook settings > Delayed Capture](#duplicated-chargedamount-in-saleor) is disabled in Adyen Dashboard
- Webhook in Adyen was created with all options (additional settings) described in [Saleor docs](./configuration.mdx#webhook-configuration)
- App supports following notification events from Adyen, other types of events will be ignored:
- [`Authorisation`](https://docs.adyen.com/api-explorer/Webhooks/1/post/AUTHORISATION)
- [`AuthorisationAdjustment`](https://docs.adyen.com/api-explorer/Webhooks/1/post/AUTHORISATION_ADJUSTMENT)
- [`Cancellation`](https://docs.adyen.com/api-explorer/Webhooks/1/post/CANCELLATION)
- [`CancelOrRefund`](https://docs.adyen.com/api-explorer/Webhooks/1/post/CANCEL_OR_REFUND)
- [`Capture`](https://docs.adyen.com/api-explorer/Webhooks/1/post/CAPTURE)
- [`CaptureFailed`](https://docs.adyen.com/api-explorer/Webhooks/1/post/CAPTURE_FAILED)
- [`Expire`](https://docs.adyen.com/api-explorer/Webhooks/1/post/EXPIRE)
- [`OrderClosed`](https://docs.adyen.com/api-explorer/Webhooks/1/post/ORDER_CLOSED)
- [`Refund`](https://docs.adyen.com/api-explorer/Webhooks/1/post/REFUND)
- [`RefundFailed`](https://docs.adyen.com/api-explorer/Webhooks/1/post/REFUND_FAILED)
- [`RefundedReversed`](https://docs.adyen.com/api-explorer/Webhooks/1/post/REFUNDED_REVERSED)
- [`RefundWithData`](https://docs.adyen.com/api-explorer/Webhooks/1/post/REFUND_WITH_DATA)
- [`VoidPendingRefund`](https://docs.adyen.com/api-explorer/Webhooks/1/post/VOID_PENDING_REFUND)
- [`Chargeback`](https://docs.adyen.com/api-explorer/Webhooks/1/post/CHARGEBACK)
- [`SecondChargeback`](https://docs.adyen.com/api-explorer/Webhooks/1/post/SECOND_CHARGEBACK)
- [`ChargebackReversed`](https://docs.adyen.com/api-explorer/Webhooks/1/post/CHARGEBACK_REVERSED)
- Following events will be mapped to `INFO` event in Saleor, it will not change amounts on `TransactionItem`:
- `HandledExternally`
- [`PostponedRefund`](https://docs.adyen.com/api-explorer/Webhooks/1/post/POSTPONED_REFUND)
- [`NotificationOfFraud`](https://docs.adyen.com/api-explorer/Webhooks/1/post/NOTIFICATION_OF_FRAUD)
- [`NotificationOfChargeback`](https://docs.adyen.com/api-explorer/Webhooks/1/post/NOTIFICATION_OF_CHARGEBACK)
- [`PrearbitrationLost`](https://docs.adyen.com/api-explorer/Webhooks/1/post/PREARBITRATION_LOST)
- [`PrearbitrationWon`](https://docs.adyen.com/api-explorer/Webhooks/1/post/PREARBITRATION_WON)
- [`RequestForInformation`](https://docs.adyen.com/api-explorer/Webhooks/1/post/REQUEST_FOR_INFORMATION)
- [`ManualReviewAccept`](https://docs.adyen.com/api-explorer/Webhooks/1/post/MANUAL_REVIEW_ACCEPT)
- [`ManualReviewReject`](https://docs.adyen.com/api-explorer/Webhooks/1/post/MANUAL_REVIEW_REJECT)
- Notifications from Adyen must include `metadata` set by the app, during payment. Payments made without using Adyen App that do not include this metadata will be ignored ([see more details](#receiving-notifications-for-transactions-not-started-in-adyen-app)).
- Before [user cancels a payment](./storefront.mdx#onordercancel), App will update `TransactionItem` in Saleor, so that it has either `REFUND_REQUEST` or `CANCEL_REQUEST` event. If update in Saleor fails, user won't be able to cancel payment. This prevents fraudulent orders from being created.

## Limitations & troubleshooting
Expand Down

0 comments on commit 5cb0c60

Please sign in to comment.