Skip to content

Commit

Permalink
Add filter for merchant order reference.
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Jun 26, 2023
1 parent 701b834 commit 783900b
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 4 deletions.
31 changes: 28 additions & 3 deletions docs/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Argument | Type | Description
-------- | ---- | -----------
`$payment` | `\Pronamic\WordPress\Pay\Payments\Payment` | Payment.

Source: [./src/NotificationsController.php](../src/NotificationsController.php), [line 184](../src/NotificationsController.php#L184-L189)
Source: [./src/NotificationsController.php](../src/NotificationsController.php), [line 192](../src/NotificationsController.php#L192-L197)

## Filters

Expand All @@ -53,7 +53,32 @@ Version | Description
------- | -----------
`1.2.0` | Added.

Source: [./src/Gateway.php](../src/Gateway.php), [line 364](../src/Gateway.php#L364-L371)
Source: [./src/Gateway.php](../src/Gateway.php), [line 417](../src/Gateway.php#L417-L424)

### `pronamic_pay_adyen_merchant_order_reference`

*Filters the Adyen merchant order reference.*

This reference allows linking multiple transactions to each other
for reporting purposes (i.e. order auth-rate). The reference should
be unique per billing cycle. The same merchant order reference
should never be reused after the first authorised attempt. If used,
this field should be supplied for all incoming authorisations.

**Arguments**

Argument | Type | Description
-------- | ---- | -----------
`$merchant_order_reference` | `string` | Merchant order reference.
`$payment` | `\Pronamic\WordPress\Pay\Payments\Payment` | Payment.

**Changelog**

Version | Description
------- | -----------
`4.5.0` | Added.

Source: [./src/PaymentRequestHelper.php](../src/PaymentRequestHelper.php), [line 38](../src/PaymentRequestHelper.php#L38-L52)

### `pronamic_pay_adyen_payment_metadata`

Expand All @@ -74,7 +99,7 @@ Version | Description
------- | -----------
`1.1.1` | Added.

Source: [./src/PaymentRequestHelper.php](../src/PaymentRequestHelper.php), [line 231](../src/PaymentRequestHelper.php#L231-L241)
Source: [./src/PaymentRequestHelper.php](../src/PaymentRequestHelper.php), [line 249](../src/PaymentRequestHelper.php#L249-L259)


<p align="center"><a href="https://github.com/pronamic/wp-documentor"><img src="https://cdn.jsdelivr.net/gh/pronamic/wp-documentor@main/logos/pronamic-wp-documentor.svgo-min.svg" alt="Pronamic WordPress Documentor" width="32" height="32"></a><br><em>Generated by <a href="https://github.com/pronamic/wp-documentor">Pronamic WordPress Documentor</a> <code>1.2.0</code></em><p>
Expand Down
20 changes: 19 additions & 1 deletion src/PaymentRequestHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,25 @@ public static function complement( Payment $payment, AbstractPaymentRequest $req
* @link https://docs.adyen.com/api-explorer/#/CheckoutService/v68/post/payments__reqParam_merchantOrderReference
* @link https://docs.adyen.com/api-explorer/#/CheckoutService/v68/post/sessions__reqParam_merchantOrderReference
*/
$request->set_merchant_order_reference( $payment->format_string( $config->get_merchant_order_reference() ) );
$merchant_order_reference = $payment->format_string( $config->get_merchant_order_reference() );

/**
* Filters the Adyen merchant order reference.
*
* This reference allows linking multiple transactions to each other
* for reporting purposes (i.e. order auth-rate). The reference should
* be unique per billing cycle. The same merchant order reference
* should never be reused after the first authorised attempt. If used,
* this field should be supplied for all incoming authorisations.
*
* @param string $merchant_order_reference Merchant order reference.
* @param Payment $payment Payment.
* @link https://docs.adyen.com/api-explorer/Checkout/68/post/payments#request-merchantOrderReference
* @since 4.5.0 Added.
*/
$merchant_order_reference = apply_filters( 'pronamic_pay_adyen_merchant_order_reference', $merchant_order_reference, $payment );

$request->set_merchant_order_reference( $merchant_order_reference );

/**
* Country code.
Expand Down

0 comments on commit 783900b

Please sign in to comment.