Skip to content

Commit ccbed20

Browse files
Send redirect subtype for Riverty installments
ISSUE: CR-SET-45
1 parent 668be42 commit ccbed20

1 file changed

Lines changed: 23 additions & 8 deletions

File tree

src/Handlers/RivertyPaymentTrait.php

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@
3232
trait RivertyPaymentTrait
3333
{
3434
/**
35-
* Adds the Riverty profile tracking session id as device fingerprint. Profile tracking needs
36-
* both the shop id and the Experian subdomain, and the id only exists once the storefront has
37-
* rendered the tracking tag, so headless channels and gift card partials send nothing.
35+
* Forces the redirect flow for Riverty installments and adds the Riverty profile tracking
36+
* session id as device fingerprint. Profile tracking needs both the shop id and the Experian
37+
* subdomain, and the id only exists once the storefront has rendered the tracking tag, so
38+
* headless channels and gift card partials send nothing.
3839
*
3940
* @param SalesChannelContext $salesChannelContext
4041
* @param AsyncPaymentTransactionStruct $transaction
@@ -64,11 +65,25 @@ protected function getAdyenPaymentRequest(
6465

6566
$paymentMethodType = $stateData['paymentMethod']['type'] ?? static::getPaymentMethodCode();
6667

67-
if ($paymentMethodType !== static::getPaymentMethodCode()
68-
|| !$this->rivertyFingerprintParamsProvider->isProfileTrackingEnabled(
69-
$salesChannelContext->getSalesChannelId()
70-
)
71-
) {
68+
// Partial gift card payments keep their own payment method type, nothing Riverty specific applies.
69+
if ($paymentMethodType !== static::getPaymentMethodCode()) {
70+
return $paymentRequest;
71+
}
72+
73+
// Installments is the only Riverty txvariant Adyen rejects without an explicit redirect
74+
// flow, and the only one without an Adyen Web component to set the subtype itself - the
75+
// plain redirect component it falls back to sends none.
76+
if (static::class === RivertyInstallmentsPaymentMethodHandler::class) {
77+
$rivertyPaymentMethod = $paymentRequest->getPaymentMethod();
78+
79+
if (!is_null($rivertyPaymentMethod)) {
80+
$rivertyPaymentMethod->setSubtype('redirect');
81+
}
82+
}
83+
84+
if (!$this->rivertyFingerprintParamsProvider->isProfileTrackingEnabled(
85+
$salesChannelContext->getSalesChannelId()
86+
)) {
7287
return $paymentRequest;
7388
}
7489

0 commit comments

Comments
 (0)