浏览代码

修改clearpay

llp 3 天之前
父节点
当前提交
99cf45d232
共有 1 个文件被更改,包括 12 次插入1 次删除
  1. 12 1
      packages/Longyi/Pay/Afterpay/src/Payment/Clearpay.php

+ 12 - 1
packages/Longyi/Pay/Afterpay/src/Payment/Clearpay.php

@@ -117,7 +117,18 @@ class Clearpay extends Afterpay
             return $resultObject->token;
         }
     }
-
+    public function captureAndVerify($order, $transactionId)
+    {
+        if ($order->status != Order::STATUS_PENDING) {
+            return new \Exception('order status is error');
+        }
+        $additional = $order->payment->additional;
+        $token = $additional['gateway_order_id'];
+        if ($transactionId != $token) {
+            return new \Exception('order token is error');
+        }
+        return $this->capture($token);
+    }
     public function getCountryOptions(): array
     {
         return core()->countries()->map(function ($country) {