Skip to content

Commit

Permalink
fix airwallex
Browse files Browse the repository at this point in the history
  • Loading branch information
xxl4 committed Jul 17, 2024
1 parent 731c968 commit e247074
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ public function webhook(Request $request)

if ($status === 'SUCCEEDED' && $input['name']==='payment_intent.succeeded') {
// $amount = $transactionData->data->object->amount;
$amount = $input['data']['object']['amount'] * 100;
$amount = round($input['data']['object']['amount'] * 100);
$orderAmount = round($order->base_grand_total * 100);
if ($amount === $orderAmount) { // 核对价格是否一样的情况。
//var_dump($amount, $orderAmount);
if ($amount == $orderAmount) { // check if the amount is matched
if ($order->status === 'pending') {
$order->status = 'processing';
$order->save();
Expand Down Expand Up @@ -126,6 +127,9 @@ public function webhook(Request $request)
),
]);

}else{
Log::info("airwallex notification received for order id:" . $transactionId . " amount not matched");
return response("Order not found ".$amount."---".$orderAmount, 400);
}
} else {
$this->webhookProcess($input['name'], $input); // process other webhook events
Expand Down

0 comments on commit e247074

Please sign in to comment.