Skip to content

Commit 68d4382

Browse files
committed
CS-137 Look for duplicate payment profiles even if you reach maximum profile limit
Normally if a duplicate payment profile exists, Authorize.net will return Error code E00039. But if the customer has the maximum number of payment profiles (10), then AUthorize.net will return E00042. So whenever we receive E00042 we need to check the existing payment profile list to see if there is a duplicate profile.
1 parent 90329a3 commit 68d4382

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Message/CIMCreateCardRequest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,13 @@ public function createPaymentProfile(CIMCreateCardResponse $createCardResponse)
202202

203203
$getProfileResponse = $this->makeGetProfileRequest($parameters);
204204

205+
// Check if there is a pre-existing profile for the given card numbers.
206+
$otherErrorCodes = ['E00039', 'E00042']; // For these error codes we should check for duplicate payment profiles
205207
if (!$createPaymentProfileResponse->isSuccessful() &&
206-
$createPaymentProfileResponse->getReasonCode() == 'E00039'
208+
in_array($createPaymentProfileResponse->getReasonCode(), $otherErrorCodes)
207209
) {
208-
// Found a duplicate payment profile existing for the same card data. Force update is turned on,
209-
// So find matching payment profile id from the customer profile and update it.
210+
// There is a possibility of a duplicate payment profile, so find matching payment profile id
211+
// from the customer profile and update it.
210212
$card = $this->getCard();
211213
$last4 = substr($card->getNumber(), -4);
212214

0 commit comments

Comments
 (0)