Skip to content

Commit 18ffd03

Browse files
authored
Merge pull request #2 from james-ingold/payment-advice-code-fixes
Fixes paypal#11 43 is invalid for PaymentAdviceCode
2 parents 649924c + 4d66fa5 commit 18ffd03

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/Models/PaymentAdviceCode.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ class PaymentAdviceCode
2828

2929
public const ENUM_21 = '21';
3030

31-
private const _ALL_VALUES = [self::ENUM_01, self::ENUM_02, self::ENUM_03, self::ENUM_21];
31+
public const ENUM_43 = '43';
32+
33+
private const _ALL_VALUES = [self::ENUM_01, self::ENUM_02, self::ENUM_03, self::ENUM_21, self::ENUM_43];
3234

3335
/**
3436
* Ensures that all the given values are present in this Enum.

src/Models/ProcessorResponse.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,12 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false)
141141
$json['response_code'] = ProcessorResponseCode::checkValue($this->responseCode);
142142
}
143143
if (isset($this->paymentAdviceCode)) {
144-
$json['payment_advice_code'] = PaymentAdviceCode::checkValue($this->paymentAdviceCode);
144+
try {
145+
$json['payment_advice_code'] = PaymentAdviceCode::checkValue($this->paymentAdviceCode);
146+
} catch (Exception $e) {
147+
// If the payment advice code is not recognized, just pass it through as-is
148+
$json['payment_advice_code'] = $this->paymentAdviceCode;
149+
}
145150
}
146151

147152
return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;

0 commit comments

Comments
 (0)