|
|
@@ -228,6 +228,8 @@ class PayPlusLogic extends BaseApiLogic
|
|
|
$order->GiftsID,
|
|
|
$orderSn,
|
|
|
]);
|
|
|
+ } elseif ($this->isCompletedButNotSuccessfulPayment($post)) {
|
|
|
+ $body['remarks'] = $this->resolveNotifyErrorMessage($post);
|
|
|
} else {
|
|
|
return 'success';
|
|
|
}
|
|
|
@@ -272,6 +274,22 @@ class PayPlusLogic extends BaseApiLogic
|
|
|
return (int) ($data['order_status'] ?? 0) === 3;
|
|
|
}
|
|
|
|
|
|
+ public function isCompletedButNotSuccessfulPayment(array $post)
|
|
|
+ {
|
|
|
+ return ($post['event'] ?? '') === 'PAYMENT.CAPTURE.COMPLETED'
|
|
|
+ && !$this->isSuccessfulPayment($post);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function resolveNotifyErrorMessage(array $post)
|
|
|
+ {
|
|
|
+ $data = $post['data'] ?? [];
|
|
|
+
|
|
|
+ return $this->stringOrDefault(
|
|
|
+ $data['error_message'] ?? ($post['error_message'] ?? null),
|
|
|
+ json_encode($post, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
public function isFailedPayment(array $post)
|
|
|
{
|
|
|
$event = $post['event'] ?? '';
|