diff --git a/app/Http/Controllers/PayPalController.php b/app/Http/Controllers/PayPalController.php index 1618841..c2cdf4b 100644 --- a/app/Http/Controllers/PayPalController.php +++ b/app/Http/Controllers/PayPalController.php @@ -72,7 +72,10 @@ public function completed($order_id, Request $request) ]); if ($response->isSuccessful()) { - $order->update(['transaction_id' => $response->getTransactionReference()]); + $order->update([ + 'transaction_id' => $response->getTransactionReference(), + 'payment_status' => Order::PAYMENT_COMPLETED, + ]); return redirect()->route('order.paypal', encrypt($order_id))->with([ 'message' => 'You recent payment is sucessful with reference code ' . $response->getTransactionReference(), diff --git a/app/Order.php b/app/Order.php index 42b81da..2e53ed0 100644 --- a/app/Order.php +++ b/app/Order.php @@ -6,6 +6,8 @@ class Order extends Model { + const PAYMENT_COMPLETED = 1; + const PAYMENT_PENDING = 0; /** * @var string */