From 66d3903a5009ada8f6c2d1c57507d8297ec9888e Mon Sep 17 00:00:00 2001 From: sriramv Date: Mon, 5 Jun 2023 12:25:34 +0530 Subject: [PATCH] payment_function:GWM --- app/Controllers/PaymentController.php | 36 +++++++++++++++++++-------- app/Views/payment.php | 33 +++++++++++++----------- 2 files changed, 44 insertions(+), 25 deletions(-) diff --git a/app/Controllers/PaymentController.php b/app/Controllers/PaymentController.php index db2f1ff..13eba6a 100644 --- a/app/Controllers/PaymentController.php +++ b/app/Controllers/PaymentController.php @@ -17,6 +17,7 @@ use App\Models\Cart_model; use App\Models\Credits_usage_tracking_model; use App\Models\Rule_model; use App\Models\Cart_token_model; + class PaymentController extends BaseController { @@ -214,10 +215,6 @@ class PaymentController extends BaseController $data = json_encode($response->getResult()); $result = json_decode( $data ,true); - - - - $TrancactionId = $result['payment']['id']; $payment_order_id = $result['payment']['order_id']; $TrancactionData['member_id'] = session()->get('logged_user'); @@ -262,13 +259,32 @@ class PaymentController extends BaseController - public function payment_success( $order_id = null) + public function payment_success( $transaction_id = null) { - if( $order_id != null) - $memberCredits = $this->creditsModel->where('order_id', $order_id )->where('member_id', session()->get('logged_user'))->findAll(); - echo '
';
-    print_r($memberCredits);
-                 echo '
'; + if( $transaction_id != null) + $data['memberCredits'] = $this->creditsModel->where('transaction_id', $transaction_id )->where('member_id', session()->get('logged_user'))->findAll(); + $Subtotal = 0; + foreach ($data['memberCredits'] as $ele) { + $Subtotal = $Subtotal + $ele['cost']; + } + $data['TransactionData'] = $this->TransactionModel->where('transaction_id', $transaction_id )->where('member_id', session()->get('logged_user'))->findAll(); + $data['transaction_id'] = $transaction_id; + $timestamp = strtotime($data['TransactionData'][0]['created_at']); + $data['formattedDate'] = date('l, F j, Y', $timestamp); + $data['Subtotal'] = $Subtotal; + $data['gst'] = $this->RuleModel->select('value')->where('rule_key', 3 )->get()->getRow()->value; + $data['pst'] = $this->RuleModel->select('value')->where('rule_key', 4 )->get()->getRow()->value; + $data['card_brand'] = json_decode($data['TransactionData'][0]['transaction'] , true)['payment']['card_details']['card']['card_brand']; + $data['last_4'] = json_decode($data['TransactionData'][0]['transaction'] , true)['payment']['card_details']['card']['last_4']; + // echo '
';
+        // print_r($data);
+        // echo '
'; + + + + + + echo view('payment',$data); } diff --git a/app/Views/payment.php b/app/Views/payment.php index c0fd9dd..667a7d2 100644 --- a/app/Views/payment.php +++ b/app/Views/payment.php @@ -40,15 +40,15 @@
Transactions ID
-
V2SwTL5GN1Ha61R7OHSCiBOv1YUZY
+
Transactions Date
-
Friday, September 8, 2023
+
Payment Method
-
Visa card ending with 7413
+
card ending with
@@ -56,24 +56,27 @@
Your Order
-
+
+
/assets/member_images/cart-icon.png" alt="" width="70" height="70">
-
Evo Pack 1
-
24 Credits
-
20+4 Credits Extra*
-
1 Credit at $22.90
+
+
Credits
+
+
-
$1100.00
+
$
+
@@ -83,7 +86,7 @@
Subtotal
-
$1100.00
+
$
@@ -93,19 +96,19 @@
-
PST(7%)
+
PST(%)
-
$77.00
+
$
-
GST(5%)
+
GST(%)
-
$55.00
+
$
@@ -114,7 +117,7 @@
Total
-
$1232.00
+
$