|
|
@@ -20,6 +20,7 @@ use SixShop\Wechat\Facade\WechatUser;
|
|
|
use SixShop\WechatPay\Trait\ApiTrait;
|
|
|
use SixShop\WechatPay\Trait\PaymentParamsTrait;
|
|
|
use think\facade\Event;
|
|
|
+use function SixShop\Core\throw_logic_exception;
|
|
|
|
|
|
class PaymentProvider implements PaymentProviderInterface
|
|
|
{
|
|
|
@@ -97,11 +98,13 @@ class PaymentProvider implements PaymentProviderInterface
|
|
|
throw $e;
|
|
|
}
|
|
|
$payment->payment_result = $paymentResult;
|
|
|
- $payment->transaction_id = $paymentResult->transaction_id;
|
|
|
if ($paymentResult->trade_state === 'SUCCESS') {
|
|
|
+ $payment->transaction_id = $paymentResult->transaction_id;
|
|
|
$payment->status = PaymentStatusEnum::SUCCESS;
|
|
|
$payment->save();
|
|
|
Event::trigger(new PaymentSuccessEvent($payment['order_sn'], self::PAYMENT_TYPE, $payment->toArray(), $payment->biz_type));
|
|
|
+ } else {
|
|
|
+ throw_logic_exception($paymentResult->trade_state_desc);
|
|
|
}
|
|
|
}
|
|
|
|