Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filter for merchant order reference #23

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
16 changes: 16 additions & 0 deletions src/PaymentRequestHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ public static function complement( Payment $payment, AbstractPaymentRequest $req
$merchant_order_reference = $payment->get_id();
}

/**
* 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 );

/**
Expand Down
Loading