Skip to content

Commit

Permalink
subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
TMuthulakshmi committed Dec 30, 2022
1 parent b632b83 commit 438517f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 21 deletions.
40 changes: 23 additions & 17 deletions app/Controllers/Api/Myaccount/Currentreservation/Index.php
Expand Up @@ -51,23 +51,25 @@ public function index()
$result = [];
foreach ($bookings as $data) {
$result[] =[
'id' => $data['id'],
'firstname' => $data['firstname'],
'lastname' => $data['lastname'],
'mobile' => $data['mobile'],
'check_in' => $data['check_in'],
'check_out' => $data['check_out'],
'amount' => $data['amount'],
'special_notice' => $data['special_notice'],
'usertype' => $data['usertype'],
'paymentmethod_name' => $data['paymentmethod_name'],
'created_at' => $data['created_at'],
'status' => $data['status'],
'eventname' => $data['eventname'],
'barn' => $data['barnstall'],
'rvstall' => ($data['rvbarnstall']!='') ? $data['rvbarnstall']: [],
'feed' => ($data['feed']!='') ? $data['feed']: [],
'shaving' => ($data['shaving']!='') ? $data['shaving']: [],
'id' => $data['id'],
'firstname' => $data['firstname'],
'lastname' => $data['lastname'],
'mobile' => $data['mobile'],
'check_in' => $data['check_in'],
'check_out' => $data['check_out'],
'amount' => $data['amount'],
'special_notice' => $data['special_notice'],
'usertype' => $data['usertype'],
'paymentmethod_name' => $data['paymentmethod_name'],
'stripe_paymentintent_id' => $data['stripe_paymentintent_id'],
'paymentid' => $data['paymentid'],
'created_at' => $data['created_at'],
'status' => $data['status'],
'eventname' => $data['eventname'],
'barn' => $data['barnstall'],
'rvstall' => ($data['rvbarnstall']!='') ? $data['rvbarnstall']: [],
'feed' => ($data['feed']!='') ? $data['feed']: [],
'shaving' => ($data['shaving']!='') ? $data['shaving']: [],
];
}
$json = ['1', count($result).' Record Found.', $result];
Expand Down Expand Up @@ -287,4 +289,8 @@ public function cancelsubscription(){

die;
}

public function updatedstall(){

}
}
15 changes: 11 additions & 4 deletions app/Controllers/Api/Myaccount/Subscription/Index.php
Expand Up @@ -6,14 +6,16 @@
use App\Models\Users;
use App\Models\Plan;
use App\Models\Payments;
use App\Models\Stripe;

class Index extends BaseController
{
public function __construct()
{
$this->users = new Users();
$this->plan = new Plan();
$this->payments = new Payments();
$this->users = new Users();
$this->plan = new Plan();
$this->payments = new Payments();
$this->stripe = new Stripe();
}

public function index()
Expand All @@ -36,7 +38,12 @@ public function index()
$users = getUserDetails($post['user_id']);
$data['plans'] = $this->plan->getPlan('all', ['plan'], ['type' => [$users['type']]]);
$data['subscriptions'] = $this->payments->getPayments('row', ['payment', 'plan'], ['ninstatus' => ['0'], 'id' => $users['subscription_id']]);
$data['userdetail'] = $users;

$customerid = $this->stripe->customer($users['id'], $users['name'], $users['email'], $users['stripe_customer_id']);

$tot = ($data['subscriptions']['amount'] * 100);
$piid = $this->stripe->createPaymentIntents($customerid, $tot , $transactionfee=0, $accountid='');
$data['client_secret'] = $piid['client_secret'];
if($data){
$json = ['1', count($data), $data];
}else{
Expand Down

0 comments on commit 438517f

Please sign in to comment.