|
|
@@ -178,39 +178,36 @@ class ShopController extends BaseController {
|
|
|
* @throws \yii\web\HttpException
|
|
|
*/
|
|
|
public function actionVerifyApproachOrder() {
|
|
|
- LoggerTool::notice(\Yii::$app->request->isPost);
|
|
|
if (\Yii::$app->request->isPost) {
|
|
|
- LoggerTool::notice(\Yii::$app->request->post());
|
|
|
- $request = json_decode(json_encode(\Yii::$app->request->post()), true);
|
|
|
- LoggerTool::notice($request);
|
|
|
+ $request = \Yii::$app->request->post();
|
|
|
// TODO:支付webhook回调日志
|
|
|
|
|
|
|
|
|
- $data = $request['data'];
|
|
|
- $status = $request['data']['status'] ?? 'false';
|
|
|
+ $data = $request->data;
|
|
|
+ $status = $request->data->status ?? 'false';
|
|
|
// 订单状态
|
|
|
$orderStatus = ($status == 'success') ? \Yii::$app->params['orderStatus']['paid']['value'] : \Yii::$app->params['orderStatus']['failPaid']['value'];
|
|
|
|
|
|
- $customFields = $request['data']['metadata']['custom_fields'] ?? [];
|
|
|
- $oderSn = $customFields[0]['value'] ?? '';
|
|
|
+ $customFields = $request->data->metadata->custom_fields ?? [];
|
|
|
+ $oderSn = $customFields[0]->value ?? '';
|
|
|
|
|
|
$formModel = new ApproachOrderForm();
|
|
|
$formModel['sn'] = $oderSn;
|
|
|
$formModel['status'] = $orderStatus;
|
|
|
$formModel['note'] = [
|
|
|
- 'id' => $data['id'],
|
|
|
- 'domain' => $data['domain'],
|
|
|
- 'status' => $data['status'],
|
|
|
- 'reference' => $data['reference'],
|
|
|
- 'amount' => $data['amount'],
|
|
|
- 'created_at' => $data['created_at'],
|
|
|
- 'paid_at' => $data['paid_at'],
|
|
|
- 'channel' => $data['channel'],
|
|
|
- 'currency' => $data['currency'],
|
|
|
- 'ip_address' => $data['ip_address'],
|
|
|
- 'metadata' => $data['metadata'],
|
|
|
- 'customer' => $data['customer'],
|
|
|
- 'email' => $data['customer']['email'],
|
|
|
+ 'id' => $data->id,
|
|
|
+ 'domain' => $data->domain,
|
|
|
+ 'status' => $data->status,
|
|
|
+ 'reference' => $data->reference,
|
|
|
+ 'amount' => $data->amount,
|
|
|
+ 'created_at' => $data->created_at,
|
|
|
+ 'paid_at' => $data->paid_at,
|
|
|
+ 'channel' => $data->channel,
|
|
|
+ 'currency' => $data->currency,
|
|
|
+ 'ip_address' => $data->ip_address,
|
|
|
+ 'metadata' => $data->metadata,
|
|
|
+ 'customer' => $data->customer,
|
|
|
+ 'email' => $data->customer->email ?? '',
|
|
|
];
|
|
|
|
|
|
if (parent::edit(ApproachOrderForm::class, 'PayStack pay Success', 'verifyPayStack', ['verifyPayStack'])) {
|