From 2a30fb895c257cac9b8be49a65cbb4590c4185fd Mon Sep 17 00:00:00 2001 From: sriramv Date: Wed, 13 Sep 2023 19:16:31 +0530 Subject: [PATCH] payment:GWM --- app/Config/Routes.php | 1 + app/Controllers/PaymentController.php | 506 ++++------ app/Models/Packages_and_pricing_model.php | 2 +- app/Models/Transaction_model.php | 2 +- app/Views/cart.php | 2 +- app/Views/checkout.php | 2 + composer.json | 5 +- composer.lock | 1030 +++++++-------------- public/square-js/sq-payment-flow.js | 4 +- 9 files changed, 544 insertions(+), 1010 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index f06e2d7..fc16c84 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -63,6 +63,7 @@ $routes->get('/payment_failed/(:any)', 'PaymentController::payment_failed/$1'); $routes->post('/payment/(:any)', 'PaymentController::index/$1'); $routes->get('payment_form', 'PaymentController::payment_form'); $routes->post('processPayment', 'PaymentController::processPayment'); +$routes->get('createCreditPackCatalogObject', 'PaymentController::createCreditPackCatalogObject'); $routes->match(['get','post'],'/test','Test_controller::sendEmail'); diff --git a/app/Controllers/PaymentController.php b/app/Controllers/PaymentController.php index 57aabc3..4215bf8 100644 --- a/app/Controllers/PaymentController.php +++ b/app/Controllers/PaymentController.php @@ -7,43 +7,33 @@ namespace App\Controllers; use Square\SquareClient; - -use Square\Models\Money; - -use Square\Models\CreatePaymentRequest; - +use Square\Api\CatalogApi; +use Square\Model\CreateCatalogObjectRequest; +use Square\Model\CatalogObject; +use Square\Model\CatalogTax; +use Square\Model\Money; +use Square\Model\OrderLineItem; +use Square\Model\CreatePaymentRequest; use Square\Exceptions\ApiException; - +use Square\Api\Orders\CreateOrderRequest; +use Square\Api\OrdersApi; +use Square\Api\PaymentsApi; use Ramsey\Uuid\Uuid; - use App\Models\Transaction_model; - use App\Models\Member_model; - use App\Models\Dashboard_model; - use App\Models\Common_model; - use App\Models\Member_credits_model; - use App\Models\Packages_and_pricing_model; - use App\Models\Cart_model; - use App\Models\Credits_usage_tracking_model; - use App\Models\Rule_model; - use App\Models\Cart_token_model; - use App\Models\Member_address_model; - use App\Models\Zipcode_model; - use App\Models\Country_model; class PaymentController extends BaseController - { @@ -51,35 +41,20 @@ class PaymentController extends BaseController public function __construct() - { - $this->session = session(); - $this->MemberModel = new Member_model(); - $this->dModel = new Dashboard_model(); - $this->cModel = new Common_model(); - $this->creditsModel = new Member_credits_model(); - $this->PackagesModel = new Packages_and_pricing_model(); - $this->cartModel = new Cart_model(); - $this->CreditsUsageTrackingModel = new Credits_usage_tracking_model(); - $this->TransactionModel = new Transaction_model(); - $this->RuleModel = new Rule_model(); - $this->Cart_token_model = new Cart_token_model(); - $this->MemberAddressModel = new Member_address_model(); - $this->ZipcodeModel = new Zipcode_model(); - $this->CountryModel = new Country_model(); } @@ -89,12 +64,9 @@ class PaymentController extends BaseController public function index($token = null) - { if($this->request->getmethod() == 'post') - { - // echo $token;die(); if(!session()->has('logged_user')) { @@ -106,22 +78,14 @@ class PaymentController extends BaseController $this->session->set('token',$token); return redirect()->to(base_url()); - } - else{ - - $this->payment_form(); - } - } else { - - // echo $this->session->get('logged_user');die(); $this->payment_form(); @@ -140,9 +104,7 @@ class PaymentController extends BaseController public function payment_form() - { - // if(!session()->has('logged_user')) // { // return redirect()->to(base_url()); @@ -172,7 +134,6 @@ class PaymentController extends BaseController for($i=0;$i<$count;$i++) { $packageData = $this->PackagesModel->where('id',$CartData[$i]['pack_id'])->find(); - $packageData[0]['count'] = $CartData[$i]['count']; array_push($packageArray , $packageData[0]); @@ -225,6 +186,7 @@ class PaymentController extends BaseController $data['gst'] = $gst; $data['pst'] = $pst; $data['packageArray'] = $packageArray; + $data['EncodedArray'] = json_encode($packageArray); $data['country'] = $this->CountryModel->findAll(); $data['userdata'] = $this->MemberModel->where('id', session()->get('logged_user'))->find(); @@ -247,150 +209,123 @@ class PaymentController extends BaseController $output .= ''; } $data['zipcode'] = $output; - - + // echo '
';
+            // print_r($data);
+            // echo '
'; + // die(); echo view('checkout',$data); } else { return redirect()->to(base_url()."view/".md5(session()->get('logged_user'))); } } - - - - - public function processPayment() - - { +public function processPayment() +{ try { - - - if ($_SERVER['REQUEST_METHOD'] != 'POST') { - + if ($_SERVER['REQUEST_METHOD'] != 'POST') { error_log('Received a non-POST request'); - echo 'Request not allowed'; - http_response_code(405); - return; - } - include 'app/Libraries/LocationInfo.php'; $json = file_get_contents('php://input'); - $data = json_decode($json); - $gst = $this->RuleModel->select('value')->where('rule_key', 3 )->get()->getRow()->value; - $pst = $this->RuleModel->select('value')->where('rule_key', 4 )->get()->getRow()->value; - $token = $data->token; - $idempotencyKey = $data->idempotencyKey; - $amount = $data->amount; - - $order_id = $data->order_id; - + $order_id = $data->order_id; $add = $data->address; - + $EncodedArray = json_decode($data->EncodedArray,true); parse_str( $add, $address); - - - - - - - //print_r($add);die(); - - + + $Final_amount = round( ( $amount + (($amount * ($gst + $pst) ) / 100) ) , 2 ); $Final_amount = $Final_amount * 100; + $locationId = getenv('SQUARE_LOCATION_ID'); - $square_client = new SquareClient([ - 'accessToken' => getenv('SQUARE_ACCESS_TOKEN'), - 'environment' => getenv('ENVIRONMENT'), - 'userAgentDetail' => 'golf_evo', // Remove or replace this detail when building your own app - ]); - - - $payments_api = $square_client->getPaymentsApi(); - - - - // To learn more about splitting payments with additional recipients, - - // see the Payments API documentation on our [developer site] - - // (https://developer.squareup.com/docs/payments-api/overview). - - - - $money = new Money(); - - // Monetary amounts are specified in the smallest unit of the applicable currency. - - // This amount is in cents. It's also hard-coded for $1.00, which isn't very useful. - - $money->setAmount($Final_amount); - - - - // Set currency to the currency for the location - - $money->setCurrency($location_info->getCurrency()); - - - - //print_r($money); die(); - - try { + //create order for the payment + // $order_line_item = new \Square\Models\OrderLineItem('1'); + // $order_line_item->setCatalogObjectId('EVYRQAQXPNUJWLLMAAHDXUHI'); + // $order_line_item1 = new \Square\Models\OrderLineItem('2'); + // $order_line_item1->setCatalogObjectId('CMU64OVJDUL7YJAFGQI33IZM'); - // Every payment you process with the SDK must have a unique idempotency key. + // $line_items = [$order_line_item,$order_line_item1]; + $line_items = []; + foreach ($EncodedArray as $key => $row) + { + $order_line_item = ''; + $order = $order_line_item.$key; + + $order = new \Square\Models\OrderLineItem($row['count']); + $order->setCatalogObjectId($row['variation_id']); + array_push($line_items , $order); + } - // If you're unsure whether a particular payment succeeded, you can reattempt + $pricing_options = new \Square\Models\OrderPricingOptions(); + $pricing_options->setAutoApplyTaxes(true); + + $order = new \Square\Models\Order($locationId); + $order->setLineItems($line_items); + $order->setPricingOptions($pricing_options); + + $body = new \Square\Models\CreateOrderRequest(); + $body->setOrder($order); + $body->setIdempotencyKey($idempotencyKey); + + $order_api_response = $square_client->getOrdersApi()->createOrder($body); - // it with the same idempotency key without worrying about double charging + if ($order_api_response->isSuccess()) { - // the buyer. - $create_payment_request = new CreatePaymentRequest($token, $idempotencyKey, $money); + $Data['order'] = json_encode($order_api_response->getResult()); + $this->TransactionModel->where('member_id', session()->get('logged_user')) + ->where('order_id', $order_id ) + ->set($Data)->update(); - $create_payment_request->setLocationId($location_info->getId()); + $order_api_response_result = json_encode($order_api_response->getResult()); + $order_api_response_result = json_decode( $order_api_response_result ,true); + $orderIdFromSquare = $order_api_response_result['order']['id']; - - $response = $payments_api->createPayment($create_payment_request); - + // Create a payment for the order + $amount_money = new \Square\Models\Money(); + $amount_money->setAmount($Final_amount); + $amount_money->setCurrency($location_info->getCurrency()); + + $body = new \Square\Models\CreatePaymentRequest($token, $idempotencyKey,$amount_money); + $body->setOrderId($orderIdFromSquare); + $body->setReferenceId($order_id); + $body->setLocationId($locationId); + + $response = $square_client->getPaymentsApi()->createPayment($body); + if ($response->isSuccess()) { - - $data = json_encode($response->getResult()); - $result = json_decode( $data ,true); //Trancaction Table Data @@ -403,86 +338,62 @@ class PaymentController extends BaseController $TrancactionData['city'] = $address['city']; $TrancactionData['zip_code'] = $address['pincode']; if($address['country']=='Canada'){ $TrancactionData['state'] = $address['canada_state']; }else{ $TrancactionData['state'] = $address['state'];} - $TrancactionData['transaction_id'] = $result['payment']['id']; - $TrancactionData['payment_order_id'] = $result['payment']['order_id']; - $TrancactionData['transaction'] = json_encode($response->getResult()); - $update = $this->TransactionModel->where('member_id', session()->get('logged_user')) - ->where('order_id', $order_id ) - ->set($TrancactionData)->update(); if( $update) - { - - $this->creditsModel->where('order_id', $order_id )->where('member_id', session()->get('logged_user')) - - ->set(array( 'is_active' => 1 , 'transaction_id' => $result['payment']['id'] ))->update(); - + $this->creditsModel->where('order_id', $order_id )->where('member_id', session()->get('logged_user'))->set(array( 'is_active' => 1 , 'transaction_id' => $result['payment']['id'] ))->update(); $this->cartModel->where('order_id', $order_id )->delete(); - } - echo json_encode($response->getResult()); - - - } else { $data = json_encode($response->getErrors()); - $result = json_decode( $data ,true); - //Trancaction Table Data - $TrancactionData['status'] = 'Failed'; - - // $TrancactionData['member_id'] = session()->get('logged_user'); - $TrancactionData['first_name'] = $address['name']; - $TrancactionData['last_name'] = $address['last_name']; - $TrancactionData['address'] = $address['address']; - $TrancactionData['country'] = $address['country']; - $TrancactionData['city'] = $address['city']; - $TrancactionData['zip_code'] = $address['pincode']; - if($address['country']=='Canada'){ $TrancactionData['state'] = $address['canada_state']; }else{ $TrancactionData['state'] = $address['state'];} - + // $TrancactionData['member_id'] = session()->get('logged_user'); + $TrancactionData['first_name'] = $address['name']; + $TrancactionData['last_name'] = $address['last_name']; + $TrancactionData['address'] = $address['address']; + $TrancactionData['country'] = $address['country']; + $TrancactionData['city'] = $address['city']; + $TrancactionData['zip_code'] = $address['pincode']; + if($address['country']=='Canada'){ $TrancactionData['state'] = $address['canada_state']; }else{ $TrancactionData['state'] = $address['state'];} //$TrancactionData['order_id'] = $order_id; - $TrancactionData['transaction'] = json_encode($response->getErrors()); - $update = $this->TransactionModel->where('member_id', session()->get('logged_user')) - ->where('order_id', $order_id ) - ->set($TrancactionData)->update(); if( $update) - { - - - $this->creditsModel->where('order_id', $order_id )->delete(); - $this->cartModel->where('order_id', $order_id )->set(array('order_id'=>null))->update(); - } - echo json_encode(array('errors' => $response->getErrors())); - } + + + } else { + + $errors = $order_api_response->getErrors(); + + } + + } catch (ApiException $e) { echo json_encode(array('errors' => $e)); @@ -491,154 +402,73 @@ class PaymentController extends BaseController } catch (\Exception $e) { - // Handle exceptions - - - - // Example: Logging the exception - log_message('error', 'Exception: ' . $e->getMessage()); - - - // Example: Displaying a custom error message - echo 'An exception occurred: ' . $e->getMessage(); } catch (\Error $e) { - // Handle errors - - - - // Example: Logging the error - log_message('error', 'Error: ' . $e->getMessage()); - - - // Example: Displaying a custom error message - echo 'An error occurred: ' . $e->getMessage(); - } - } +} - - - public function payment_success( $local_order_id = null) - { -// $data['TransactionData'] = $this->TransactionModel->where('order_id', $local_order_id )->where('member_id', session()->get('logged_user'))->find(); -// $memberCredits = $this->creditsModel->where('order_id', $local_order_id ) -// ->where('member_id', session()->get('logged_user')) -// ->select('package_name') -// ->select('cost') -// ->selectSum('credit_points', 'credit_points') -// ->selectSum('cost', 'costSum') -// ->selectCount('package_name', 'pack_count') -// ->groupBy('package_name')->findAll(); -// $Subtotal = 0; -// foreach ($memberCredits as $key => $ele) { -// $Subtotal = $Subtotal + $ele['costSum']; -// } -// $data['memberCredits'] =$memberCredits; -// $data['order_id'] = $local_order_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 view('success_mail',$data); -// die(); - if( $local_order_id != null) - { $data['TransactionData'] = $this->TransactionModel->where('order_id', $local_order_id )->where('member_id', session()->get('logged_user'))->find(); - if($data['TransactionData']){ $memberCredits = $this->creditsModel->where('order_id', $local_order_id ) - ->where('member_id', session()->get('logged_user')) - ->select('package_name') - ->select('cost') - ->selectSum('credit_points', 'credit_points') - ->selectSum('cost', 'costSum') - ->selectCount('package_name', 'pack_count') - ->groupBy('package_name')->findAll(); if($data['TransactionData'][0]['is_mail_triggered'] == 0){ - $sendmail_controller = new Sendmail_controller(); - $mail = $sendmail_controller->index(session()->get('logged_user_email') , $local_order_id , 5); - if($mail == true){ - $this->TransactionModel->where('order_id', $local_order_id )->set(array('is_mail_triggered'=>1))->update(); - } $admin_email = $this->RuleModel->select('value')->where('rule_key', 10 )->get()->getRow()->value; $sendmail_controller->index($admin_email , $local_order_id , 5); + } - } - - - - $Subtotal = 0; - + $Subtotal = 0; foreach ($memberCredits as $key => $ele) { - $Subtotal = $Subtotal + $ele['costSum']; - } $data['memberCredits'] =$memberCredits; - - - $data['order_id'] = $local_order_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 view('payment',$data); }else{ - // echo 'invalid order_id'; return redirect()->to(base_url()); @@ -653,90 +483,148 @@ class PaymentController extends BaseController public function payment_failed( $local_order_id = null) - { - if( $local_order_id != null) - { - $data['TransactionData'] = $this->TransactionModel->where('order_id', $local_order_id )->where('member_id', session()->get('logged_user'))->find(); - if($data['TransactionData']){ $sendmail_controller = new Sendmail_controller(); - $mail = $sendmail_controller->index(session()->get('logged_user_email') , $local_order_id , 7); - $admin_email = $this->RuleModel->select('value')->where('rule_key', 10 )->get()->getRow()->value; $sendmail_controller->index($admin_email , $local_order_id , 7 ,'admin'); - $data['category'] = json_decode($data['TransactionData'][0]['transaction'] , true)[0]['category']; - $data['code'] = json_decode($data['TransactionData'][0]['transaction'] , true)[0]['code']; - $data['detail'] = json_decode($data['TransactionData'][0]['transaction'] , true)[0]['detail']; - $data['order_id'] = $data['TransactionData'][0]['order_id']; - $timestamp = strtotime($data['TransactionData'][0]['created_at']); - $data['formattedDate'] = date('l, F j, Y', $timestamp); - - echo view('payment_failed',$data); }else{ - // echo 'invalid order_id'; return redirect()->to(base_url()); - } - } - - } +public function createCreditPackCatalogObject() +{ + + include 'app/Libraries/LocationInfo.php'; + + + $gst = $this->RuleModel->select('value')->where('rule_key', 3 )->get()->getRow()->value; + $pst = $this->RuleModel->select('value')->where('rule_key', 4 )->get()->getRow()->value; + $idempotencyKey = $this->generateIdempotencyKey(); + $locationId = getenv('SQUARE_LOCATION_ID'); + + + // Initialize the Square Client + $square_client = new SquareClient([ + 'accessToken' => getenv('SQUARE_ACCESS_TOKEN'), + 'environment' => getenv('ENVIRONMENT'), + 'userAgentDetail' => 'golf_evo', // Replace with your app's user agent detail + ]); + + + + $money1 = new \Square\Models\Money(); + $money1->setAmount(550*100); + $money1->setCurrency($location_info->getCurrency()); + + $money2 = new \Square\Models\Money(); + $money2->setAmount(1000*100); + $money2->setCurrency($location_info->getCurrency()); + + + $item_variation_data = new \Square\Models\CatalogItemVariation(); + $item_variation_data->setItemId('#PaymentItems'); + $item_variation_data->setName('Evo Pack 1'); + $item_variation_data->setPricingType('FIXED_PRICING'); + $item_variation_data->setPriceMoney($money1); + + $catalog_object1 = new \Square\Models\CatalogObject('ITEM_VARIATION', '#creditPack1'); + $catalog_object1->setItemVariationData($item_variation_data); + + $item_variation_data2 = new \Square\Models\CatalogItemVariation(); + $item_variation_data2->setItemId('#PaymentItems'); + $item_variation_data2->setName('Evo Pack 2'); + $item_variation_data2->setPricingType('FIXED_PRICING'); + $item_variation_data2->setPriceMoney($money2); + + $catalog_object2 = new \Square\Models\CatalogObject('ITEM_VARIATION', '#creditPack2'); + $catalog_object2->setItemVariationData($item_variation_data2); + + + $variations = [$catalog_object1 , $catalog_object2]; + + $tax_data = new \Square\Models\CatalogTax(); + $tax_data->setName('GST/PST'); + $tax_data->setCalculationPhase('TAX_SUBTOTAL_PHASE'); + $tax_data->setInclusionType('ADDITIVE'); + $tax_data->setPercentage($gst + $pst); + + $catalog_object3 = new \Square\Models\CatalogObject('TAX', '#sales_tax'); + $catalog_object3->setTaxData($tax_data); + //echo json_encode($catalog_object3); + + $tax_ids = ['#sales_tax']; + $item_data = new \Square\Models\CatalogItem(); + $item_data->setName('Evo pack Items'); + $item_data->setTaxIds($tax_ids); + $item_data->setVariations($variations); + $item_data->setProductType('REGULAR'); + + $catalog_object = new \Square\Models\CatalogObject('ITEM', '#PaymentItems'); + $catalog_object->setItemData($item_data); + + + + $objects = [$catalog_object, $catalog_object3]; + $catalog_object_batch = new \Square\Models\CatalogObjectBatch($objects); + + $batches = [$catalog_object_batch]; + $body = new \Square\Models\BatchUpsertCatalogObjectsRequest($idempotencyKey, $batches); + + $api_response = $square_client->getCatalogApi()->batchUpsertCatalogObjects($body); + + if ($api_response->isSuccess()) { + $result = $api_response->getResult(); + echo json_encode($result); + } else { + $errors = $api_response->getErrors(); + echo json_encode($errors); + } + +} + +function generateIdempotencyKey($length = 32) { + // Define characters that can be used in the key + $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + // Get the total number of characters + $characterCount = strlen($characters); + // Initialize the idempotency key + $idempotencyKey = ''; + // Generate a random key of the specified length + for ($i = 0; $i < $length; $i++) { + $idempotencyKey .= $characters[random_int(0, $characterCount - 1)]; + } + return $idempotencyKey; +} + } -// $data['TransactionData'] = $this->TransactionModel->where('order_id', $code )->where('member_id', session()->get('logged_user'))->find(); -// $memberCredits = $this->creditsModel->where('order_id', $code ) -// ->where('member_id', session()->get('logged_user')) -// ->select('package_name') -// ->select('cost') -// ->selectSum('credit_points', 'credit_points') -// ->selectSum('cost', 'costSum') -// ->selectCount('package_name', 'pack_count') -// ->groupBy('package_name')->findAll(); -// $Subtotal = 0; -// foreach ($memberCredits as $key => $ele) { -// $Subtotal = $Subtotal + $ele['costSum']; -// } -// $data['memberCredits'] =$memberCredits; -// $data['order_id'] = $code; -// $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 view('success_mail',$data); - - - - diff --git a/app/Models/Packages_and_pricing_model.php b/app/Models/Packages_and_pricing_model.php index 624bc08..1e87b7f 100644 --- a/app/Models/Packages_and_pricing_model.php +++ b/app/Models/Packages_and_pricing_model.php @@ -7,7 +7,7 @@ class Packages_and_pricing_model extends Model protected $table = 'packages_and_pricing'; protected $primaryKey = 'id'; - protected $allowedFields = ['package_name','package_type', 'credit','cost','discription','offer_label', 'is_active']; + protected $allowedFields = ['package_name','package_type', 'credit','cost','discription','offer_label', 'is_active', 'catalog_object' , 'variation_id']; } \ No newline at end of file diff --git a/app/Models/Transaction_model.php b/app/Models/Transaction_model.php index 0ecc303..5cfd761 100644 --- a/app/Models/Transaction_model.php +++ b/app/Models/Transaction_model.php @@ -16,7 +16,7 @@ class Transaction_model extends Model - protected $allowedFields = ['status','member_id','transaction_id','payment_order_id','order_id','transaction','is_mail_triggered', 'first_name','last_name','address', 'city' , 'state' , 'zip_code' , 'country']; + protected $allowedFields = ['status','member_id','transaction_id','payment_order_id','order_id','transaction','is_mail_triggered', 'first_name','last_name','address', 'city' , 'state' , 'zip_code' , 'country', 'order']; diff --git a/app/Views/cart.php b/app/Views/cart.php index 2c55e08..da19669 100644 --- a/app/Views/cart.php +++ b/app/Views/cart.php @@ -55,7 +55,7 @@
- +
diff --git a/app/Views/checkout.php b/app/Views/checkout.php index a5c4e93..ea9667f 100644 --- a/app/Views/checkout.php +++ b/app/Views/checkout.php @@ -480,6 +480,8 @@ $web_payment_sdk_url = $_ENV["ENVIRONMENT"] === Environment::PRODUCTION ? "https + +
diff --git a/composer.json b/composer.json index 7e8634d..43e5ba8 100644 --- a/composer.json +++ b/composer.json @@ -6,12 +6,11 @@ "license": "MIT", "require": { "php": "^7.4 || ^8.0", - "codeigniter4/framework": "^4.0", + "codeigniter4/framework": "4.3.7", "daycry/cronjob": "^2.2", - "google/apiclient": "^2.15", "guzzlehttp/guzzle": "^7.7", "ramsey/uuid": "^4.2", - "square/square": "18.0.0.20220420" + "square/square": "20.1.0.20220720" }, "require-dev": { "fakerphp/faker": "^1.9", diff --git a/composer.lock b/composer.lock index f903a3c..5a95160 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6e8b2f75e98ca3380942cf3f26410005", + "content-hash": "21ef6d3f53725b4f5294c3e264659f23", "packages": [ { "name": "apimatic/jsonmapper", @@ -126,25 +126,26 @@ }, { "name": "brick/math", - "version": "0.11.0", + "version": "0.9.3", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478" + "reference": "ca57d18f028f84f777b2168cd1911b0dee2343ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/0ad82ce168c82ba30d1c01ec86116ab52f589478", - "reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478", + "url": "https://api.github.com/repos/brick/math/zipball/ca57d18f028f84f777b2168cd1911b0dee2343ae", + "reference": "ca57d18f028f84f777b2168cd1911b0dee2343ae", "shasum": "" }, "require": { - "php": "^8.0" + "ext-json": "*", + "php": "^7.1 || ^8.0" }, "require-dev": { "php-coveralls/php-coveralls": "^2.2", - "phpunit/phpunit": "^9.0", - "vimeo/psalm": "5.0.0" + "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.0", + "vimeo/psalm": "4.9.2" }, "type": "library", "autoload": { @@ -169,15 +170,19 @@ ], "support": { "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/0.11.0" + "source": "https://github.com/brick/math/tree/0.9.3" }, "funding": [ { "url": "https://github.com/BenMorel", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/brick/math", + "type": "tidelift" } ], - "time": "2023-01-15T23:15:59+00:00" + "time": "2021-08-15T20:50:18+00:00" }, { "name": "codeigniter4/framework", @@ -362,258 +367,24 @@ ], "time": "2023-08-10T19:36:49+00:00" }, - { - "name": "firebase/php-jwt", - "version": "v6.8.1", - "source": { - "type": "git", - "url": "https://github.com/firebase/php-jwt.git", - "reference": "5dbc8959427416b8ee09a100d7a8588c00fb2e26" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/5dbc8959427416b8ee09a100d7a8588c00fb2e26", - "reference": "5dbc8959427416b8ee09a100d7a8588c00fb2e26", - "shasum": "" - }, - "require": { - "php": "^7.4||^8.0" - }, - "require-dev": { - "guzzlehttp/guzzle": "^6.5||^7.4", - "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.5", - "psr/cache": "^1.0||^2.0", - "psr/http-client": "^1.0", - "psr/http-factory": "^1.0" - }, - "suggest": { - "ext-sodium": "Support EdDSA (Ed25519) signatures", - "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present" - }, - "type": "library", - "autoload": { - "psr-4": { - "Firebase\\JWT\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Neuman Vong", - "email": "neuman+pear@twilio.com", - "role": "Developer" - }, - { - "name": "Anant Narayanan", - "email": "anant@php.net", - "role": "Developer" - } - ], - "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", - "homepage": "https://github.com/firebase/php-jwt", - "keywords": [ - "jwt", - "php" - ], - "support": { - "issues": "https://github.com/firebase/php-jwt/issues", - "source": "https://github.com/firebase/php-jwt/tree/v6.8.1" - }, - "time": "2023-07-14T18:33:00+00:00" - }, - { - "name": "google/apiclient", - "version": "v2.15.0", - "source": { - "type": "git", - "url": "https://github.com/googleapis/google-api-php-client.git", - "reference": "49787fa30b8d8313146a61efbf77ed1fede723c2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/49787fa30b8d8313146a61efbf77ed1fede723c2", - "reference": "49787fa30b8d8313146a61efbf77ed1fede723c2", - "shasum": "" - }, - "require": { - "firebase/php-jwt": "~6.0", - "google/apiclient-services": "~0.200", - "google/auth": "^1.28", - "guzzlehttp/guzzle": "~6.5||~7.0", - "guzzlehttp/psr7": "^1.8.4||^2.2.1", - "monolog/monolog": "^2.9||^3.0", - "php": "^7.4|^8.0", - "phpseclib/phpseclib": "^3.0.2" - }, - "require-dev": { - "cache/filesystem-adapter": "^1.1", - "composer/composer": "^1.10.22", - "phpcompatibility/php-compatibility": "^9.2", - "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.5", - "squizlabs/php_codesniffer": "^3.0", - "symfony/css-selector": "~2.1", - "symfony/dom-crawler": "~2.1" - }, - "suggest": { - "cache/filesystem-adapter": "For caching certs and tokens (using Google\\Client::setCache)" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.x-dev" - } - }, - "autoload": { - "files": [ - "src/aliases.php" - ], - "psr-4": { - "Google\\": "src/" - }, - "classmap": [ - "src/aliases.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "description": "Client library for Google APIs", - "homepage": "http://developers.google.com/api-client-library/php", - "keywords": [ - "google" - ], - "support": { - "issues": "https://github.com/googleapis/google-api-php-client/issues", - "source": "https://github.com/googleapis/google-api-php-client/tree/v2.15.0" - }, - "time": "2023-05-18T13:51:33+00:00" - }, - { - "name": "google/apiclient-services", - "version": "v0.312.0", - "source": { - "type": "git", - "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "45d47fed73b28254c511882bc743b1690a99558d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/45d47fed73b28254c511882bc743b1690a99558d", - "reference": "45d47fed73b28254c511882bc743b1690a99558d", - "shasum": "" - }, - "require": { - "php": "^7.4||^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7||^8.5.13" - }, - "type": "library", - "autoload": { - "files": [ - "autoload.php" - ], - "psr-4": { - "Google\\Service\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "description": "Client library for Google APIs", - "homepage": "http://developers.google.com/api-client-library/php", - "keywords": [ - "google" - ], - "support": { - "issues": "https://github.com/googleapis/google-api-php-client-services/issues", - "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.312.0" - }, - "time": "2023-08-14T00:56:12+00:00" - }, - { - "name": "google/auth", - "version": "v1.28.0", - "source": { - "type": "git", - "url": "https://github.com/googleapis/google-auth-library-php.git", - "reference": "07f7f6305f1b7df32b2acf6e101c1225c839c7ac" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/07f7f6305f1b7df32b2acf6e101c1225c839c7ac", - "reference": "07f7f6305f1b7df32b2acf6e101c1225c839c7ac", - "shasum": "" - }, - "require": { - "firebase/php-jwt": "^6.0", - "guzzlehttp/guzzle": "^6.2.1|^7.0", - "guzzlehttp/psr7": "^2.4.5", - "php": "^7.4||^8.0", - "psr/cache": "^1.0||^2.0||^3.0", - "psr/http-message": "^1.1||^2.0" - }, - "require-dev": { - "guzzlehttp/promises": "^1.3", - "kelvinmo/simplejwt": "0.7.0", - "phpseclib/phpseclib": "^3.0", - "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.0.0", - "sebastian/comparator": ">=1.2.3", - "squizlabs/php_codesniffer": "^3.5" - }, - "suggest": { - "phpseclib/phpseclib": "May be used in place of OpenSSL for signing strings or for token management. Please require version ^2." - }, - "type": "library", - "autoload": { - "psr-4": { - "Google\\Auth\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "description": "Google Auth Library for PHP", - "homepage": "http://github.com/google/google-auth-library-php", - "keywords": [ - "Authentication", - "google", - "oauth2" - ], - "support": { - "docs": "https://googleapis.github.io/google-auth-library-php/main/", - "issues": "https://github.com/googleapis/google-auth-library-php/issues", - "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.28.0" - }, - "time": "2023-05-11T21:58:18+00:00" - }, { "name": "guzzlehttp/guzzle", - "version": "7.7.0", + "version": "7.8.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "fb7566caccf22d74d1ab270de3551f72a58399f5" + "reference": "1110f66a6530a40fe7aea0378fe608ee2b2248f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/fb7566caccf22d74d1ab270de3551f72a58399f5", - "reference": "fb7566caccf22d74d1ab270de3551f72a58399f5", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/1110f66a6530a40fe7aea0378fe608ee2b2248f9", + "reference": "1110f66a6530a40fe7aea0378fe608ee2b2248f9", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.5.3 || ^2.0", - "guzzlehttp/psr7": "^1.9.1 || ^2.4.5", + "guzzlehttp/promises": "^1.5.3 || ^2.0.1", + "guzzlehttp/psr7": "^1.9.1 || ^2.5.1", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -704,7 +475,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.7.0" + "source": "https://github.com/guzzle/guzzle/tree/7.8.0" }, "funding": [ { @@ -720,7 +491,7 @@ "type": "tidelift" } ], - "time": "2023-05-21T14:04:53+00:00" + "time": "2023-08-27T10:20:53+00:00" }, { "name": "guzzlehttp/promises", @@ -807,16 +578,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "2.6.0", + "version": "2.6.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "8bd7c33a0734ae1c5d074360512beb716bef3f77" + "reference": "be45764272e8873c72dbe3d2edcfdfcc3bc9f727" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/8bd7c33a0734ae1c5d074360512beb716bef3f77", - "reference": "8bd7c33a0734ae1c5d074360512beb716bef3f77", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/be45764272e8873c72dbe3d2edcfdfcc3bc9f727", + "reference": "be45764272e8873c72dbe3d2edcfdfcc3bc9f727", "shasum": "" }, "require": { @@ -903,7 +674,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.6.0" + "source": "https://github.com/guzzle/psr7/tree/2.6.1" }, "funding": [ { @@ -919,7 +690,7 @@ "type": "tidelift" } ], - "time": "2023-08-03T15:06:02+00:00" + "time": "2023-08-27T10:13:57+00:00" }, { "name": "laminas/laminas-escaper", @@ -983,384 +754,6 @@ ], "time": "2022-10-10T10:11:09+00:00" }, - { - "name": "monolog/monolog", - "version": "2.9.1", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/monolog.git", - "reference": "f259e2b15fb95494c83f52d3caad003bbf5ffaa1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f259e2b15fb95494c83f52d3caad003bbf5ffaa1", - "reference": "f259e2b15fb95494c83f52d3caad003bbf5ffaa1", - "shasum": "" - }, - "require": { - "php": ">=7.2", - "psr/log": "^1.0.1 || ^2.0 || ^3.0" - }, - "provide": { - "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0" - }, - "require-dev": { - "aws/aws-sdk-php": "^2.4.9 || ^3.0", - "doctrine/couchdb": "~1.0@dev", - "elasticsearch/elasticsearch": "^7 || ^8", - "ext-json": "*", - "graylog2/gelf-php": "^1.4.2 || ^2@dev", - "guzzlehttp/guzzle": "^7.4", - "guzzlehttp/psr7": "^2.2", - "mongodb/mongodb": "^1.8", - "php-amqplib/php-amqplib": "~2.4 || ^3", - "phpspec/prophecy": "^1.15", - "phpstan/phpstan": "^0.12.91", - "phpunit/phpunit": "^8.5.14", - "predis/predis": "^1.1 || ^2.0", - "rollbar/rollbar": "^1.3 || ^2 || ^3", - "ruflin/elastica": "^7", - "swiftmailer/swiftmailer": "^5.3|^6.0", - "symfony/mailer": "^5.4 || ^6", - "symfony/mime": "^5.4 || ^6" - }, - "suggest": { - "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", - "doctrine/couchdb": "Allow sending log messages to a CouchDB server", - "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", - "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", - "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler", - "ext-mbstring": "Allow to work properly with unicode symbols", - "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", - "ext-openssl": "Required to send log messages using SSL", - "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)", - "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", - "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", - "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", - "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Monolog\\": "src/Monolog" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "https://seld.be" - } - ], - "description": "Sends your logs to files, sockets, inboxes, databases and various web services", - "homepage": "https://github.com/Seldaek/monolog", - "keywords": [ - "log", - "logging", - "psr-3" - ], - "support": { - "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/2.9.1" - }, - "funding": [ - { - "url": "https://github.com/Seldaek", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", - "type": "tidelift" - } - ], - "time": "2023-02-06T13:44:46+00:00" - }, - { - "name": "paragonie/constant_time_encoding", - "version": "v2.6.3", - "source": { - "type": "git", - "url": "https://github.com/paragonie/constant_time_encoding.git", - "reference": "58c3f47f650c94ec05a151692652a868995d2938" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/58c3f47f650c94ec05a151692652a868995d2938", - "reference": "58c3f47f650c94ec05a151692652a868995d2938", - "shasum": "" - }, - "require": { - "php": "^7|^8" - }, - "require-dev": { - "phpunit/phpunit": "^6|^7|^8|^9", - "vimeo/psalm": "^1|^2|^3|^4" - }, - "type": "library", - "autoload": { - "psr-4": { - "ParagonIE\\ConstantTime\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com", - "role": "Maintainer" - }, - { - "name": "Steve 'Sc00bz' Thomas", - "email": "steve@tobtu.com", - "homepage": "https://www.tobtu.com", - "role": "Original Developer" - } - ], - "description": "Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)", - "keywords": [ - "base16", - "base32", - "base32_decode", - "base32_encode", - "base64", - "base64_decode", - "base64_encode", - "bin2hex", - "encoding", - "hex", - "hex2bin", - "rfc4648" - ], - "support": { - "email": "info@paragonie.com", - "issues": "https://github.com/paragonie/constant_time_encoding/issues", - "source": "https://github.com/paragonie/constant_time_encoding" - }, - "time": "2022-06-14T06:56:20+00:00" - }, - { - "name": "paragonie/random_compat", - "version": "v9.99.100", - "source": { - "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", - "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", - "shasum": "" - }, - "require": { - "php": ">= 7" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*", - "vimeo/psalm": "^1" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "type": "library", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "polyfill", - "pseudorandom", - "random" - ], - "support": { - "email": "info@paragonie.com", - "issues": "https://github.com/paragonie/random_compat/issues", - "source": "https://github.com/paragonie/random_compat" - }, - "time": "2020-10-15T08:29:30+00:00" - }, - { - "name": "phpseclib/phpseclib", - "version": "3.0.21", - "source": { - "type": "git", - "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "4580645d3fc05c189024eb3b834c6c1e4f0f30a1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/4580645d3fc05c189024eb3b834c6c1e4f0f30a1", - "reference": "4580645d3fc05c189024eb3b834c6c1e4f0f30a1", - "shasum": "" - }, - "require": { - "paragonie/constant_time_encoding": "^1|^2", - "paragonie/random_compat": "^1.4|^2.0|^9.99.99", - "php": ">=5.6.1" - }, - "require-dev": { - "phpunit/phpunit": "*" - }, - "suggest": { - "ext-dom": "Install the DOM extension to load XML formatted public keys.", - "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", - "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", - "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", - "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." - }, - "type": "library", - "autoload": { - "files": [ - "phpseclib/bootstrap.php" - ], - "psr-4": { - "phpseclib3\\": "phpseclib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jim Wigginton", - "email": "terrafrost@php.net", - "role": "Lead Developer" - }, - { - "name": "Patrick Monnerat", - "email": "pm@datasphere.ch", - "role": "Developer" - }, - { - "name": "Andreas Fischer", - "email": "bantu@phpbb.com", - "role": "Developer" - }, - { - "name": "Hans-Jürgen Petrich", - "email": "petrich@tronic-media.com", - "role": "Developer" - }, - { - "name": "Graham Campbell", - "email": "graham@alt-three.com", - "role": "Developer" - } - ], - "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.", - "homepage": "http://phpseclib.sourceforge.net", - "keywords": [ - "BigInteger", - "aes", - "asn.1", - "asn1", - "blowfish", - "crypto", - "cryptography", - "encryption", - "rsa", - "security", - "sftp", - "signature", - "signing", - "ssh", - "twofish", - "x.509", - "x509" - ], - "support": { - "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.21" - }, - "funding": [ - { - "url": "https://github.com/terrafrost", - "type": "github" - }, - { - "url": "https://www.patreon.com/phpseclib", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpseclib/phpseclib", - "type": "tidelift" - } - ], - "time": "2023-07-09T15:24:48+00:00" - }, - { - "name": "psr/cache", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/cache.git", - "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", - "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", - "shasum": "" - }, - "require": { - "php": ">=8.0.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Cache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for caching libraries", - "keywords": [ - "cache", - "psr", - "psr-6" - ], - "support": { - "source": "https://github.com/php-fig/cache/tree/3.0.0" - }, - "time": "2021-02-03T23:26:27+00:00" - }, { "name": "psr/http-client", "version": "1.0.2", @@ -1617,20 +1010,21 @@ }, { "name": "ramsey/collection", - "version": "2.0.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/ramsey/collection.git", - "reference": "a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5" + "reference": "ad7475d1c9e70b190ecffc58f2d989416af339b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/collection/zipball/a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5", - "reference": "a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5", + "url": "https://api.github.com/repos/ramsey/collection/zipball/ad7475d1c9e70b190ecffc58f2d989416af339b4", + "reference": "ad7475d1c9e70b190ecffc58f2d989416af339b4", "shasum": "" }, "require": { - "php": "^8.1" + "php": "^7.4 || ^8.0", + "symfony/polyfill-php81": "^1.23" }, "require-dev": { "captainhook/plugin-composer": "^5.3", @@ -1690,7 +1084,7 @@ ], "support": { "issues": "https://github.com/ramsey/collection/issues", - "source": "https://github.com/ramsey/collection/tree/2.0.0" + "source": "https://github.com/ramsey/collection/tree/1.3.0" }, "funding": [ { @@ -1702,27 +1096,29 @@ "type": "tidelift" } ], - "time": "2022-12-31T21:50:55+00:00" + "time": "2022-12-27T19:12:24+00:00" }, { "name": "ramsey/uuid", - "version": "4.7.4", + "version": "4.2.3", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "60a4c63ab724854332900504274f6150ff26d286" + "reference": "fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/60a4c63ab724854332900504274f6150ff26d286", - "reference": "60a4c63ab724854332900504274f6150ff26d286", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df", + "reference": "fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df", "shasum": "" }, "require": { - "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11", + "brick/math": "^0.8 || ^0.9", "ext-json": "*", - "php": "^8.0", - "ramsey/collection": "^1.2 || ^2.0" + "php": "^7.2 || ^8.0", + "ramsey/collection": "^1.0", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-php80": "^1.14" }, "replace": { "rhumsaa/uuid": "self.version" @@ -1734,23 +1130,24 @@ "doctrine/annotations": "^1.8", "ergebnis/composer-normalize": "^2.15", "mockery/mockery": "^1.3", + "moontoast/math": "^1.1", "paragonie/random-lib": "^2", "php-mock/php-mock": "^2.2", "php-mock/php-mock-mockery": "^1.3", "php-parallel-lint/php-parallel-lint": "^1.1", "phpbench/phpbench": "^1.0", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.8", - "phpstan/phpstan-mockery": "^1.1", - "phpstan/phpstan-phpunit": "^1.1", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-mockery": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", "phpunit/phpunit": "^8.5 || ^9", - "ramsey/composer-repl": "^1.4", - "slevomat/coding-standard": "^8.4", + "slevomat/coding-standard": "^7.0", "squizlabs/php_codesniffer": "^3.5", "vimeo/psalm": "^4.9" }, "suggest": { "ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.", + "ext-ctype": "Enables faster processing of character classification using ctype functions.", "ext-gmp": "Enables faster math with arbitrary-precision integers using GMP.", "ext-uuid": "Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.", "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", @@ -1758,6 +1155,9 @@ }, "type": "library", "extra": { + "branch-alias": { + "dev-main": "4.x-dev" + }, "captainhook": { "force-install": true } @@ -1782,7 +1182,7 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.7.4" + "source": "https://github.com/ramsey/uuid/tree/4.2.3" }, "funding": [ { @@ -1794,25 +1194,25 @@ "type": "tidelift" } ], - "time": "2023-04-15T23:01:58+00:00" + "time": "2021-09-25T23:10:38+00:00" }, { "name": "square/square", - "version": "18.0.0.20220420", + "version": "20.1.0.20220720", "source": { "type": "git", "url": "https://github.com/square/square-php-sdk.git", - "reference": "f1ee0948a0d3a573a9506c6dd0108ca955d4b07f" + "reference": "9a2bf04c6b5f1ce37d0dd48270bb6ec7ea5a27f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/square/square-php-sdk/zipball/f1ee0948a0d3a573a9506c6dd0108ca955d4b07f", - "reference": "f1ee0948a0d3a573a9506c6dd0108ca955d4b07f", + "url": "https://api.github.com/repos/square/square-php-sdk/zipball/9a2bf04c6b5f1ce37d0dd48270bb6ec7ea5a27f2", + "reference": "9a2bf04c6b5f1ce37d0dd48270bb6ec7ea5a27f2", "shasum": "" }, "require": { - "apimatic/jsonmapper": "^3.0.0", - "apimatic/unirest-php": "^2.2.2", + "apimatic/jsonmapper": "^3.0.4", + "apimatic/unirest-php": "^2.3.0", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", @@ -1849,31 +1249,31 @@ ], "support": { "issues": "https://github.com/square/square-php-sdk/issues", - "source": "https://github.com/square/square-php-sdk/tree/18.0.0.20220420" + "source": "https://github.com/square/square-php-sdk/tree/20.1.0.20220720" }, - "time": "2022-04-19T22:29:34+00:00" + "time": "2022-07-21T00:50:49+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.3.0", + "version": "v2.5.2", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -1902,7 +1302,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" }, "funding": [ { @@ -1918,7 +1318,251 @@ "type": "tidelift" } ], - "time": "2023-05-23T14:45:45+00:00" + "time": "2022-01-02T09:53:40+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" + }, + { + "name": "symfony/polyfill-php81", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "7581cd600fa9fd681b797d00b02f068e2f13263b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/7581cd600fa9fd681b797d00b02f068e2f13263b", + "reference": "7581cd600fa9fd681b797d00b02f068e2f13263b", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" }, { "name": "webmozart/assert", @@ -1982,30 +1626,30 @@ "packages-dev": [ { "name": "doctrine/instantiator", - "version": "2.0.0", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", "shasum": "" }, "require": { - "php": "^8.1" + "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^11", + "doctrine/coding-standard": "^9 || ^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^1.2", - "phpstan/phpstan": "^1.9.4", - "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5.27", - "vimeo/psalm": "^5.4" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.30 || ^5.4" }, "type": "library", "autoload": { @@ -2032,7 +1676,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/2.0.0" + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" }, "funding": [ { @@ -2048,7 +1692,7 @@ "type": "tidelift" } ], - "time": "2022-12-30T00:23:10+00:00" + "time": "2022-12-30T00:15:36+00:00" }, { "name": "fakerphp/faker", @@ -2716,16 +2360,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.10", + "version": "9.6.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a6d351645c3fe5a30f5e86be6577d946af65a328" + "reference": "810500e92855eba8a7a5319ae913be2da6f957b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a6d351645c3fe5a30f5e86be6577d946af65a328", - "reference": "a6d351645c3fe5a30f5e86be6577d946af65a328", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/810500e92855eba8a7a5319ae913be2da6f957b0", + "reference": "810500e92855eba8a7a5319ae913be2da6f957b0", "shasum": "" }, "require": { @@ -2799,7 +2443,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.10" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.11" }, "funding": [ { @@ -2815,7 +2459,7 @@ "type": "tidelift" } ], - "time": "2023-07-10T04:04:23+00:00" + "time": "2023-08-19T07:10:56+00:00" }, { "name": "psr/container", diff --git a/public/square-js/sq-payment-flow.js b/public/square-js/sq-payment-flow.js index 93364d8..03c44f7 100644 --- a/public/square-js/sq-payment-flow.js +++ b/public/square-js/sq-payment-flow.js @@ -76,6 +76,8 @@ window.createPayment = async function(token) { order_id : document.getElementById('order_id').value, + EncodedArray : document.getElementById('EncodedArray').value, + address : address }); @@ -111,8 +113,6 @@ window.createPayment = async function(token) { const data = await response.json(); - - if (data.errors && data.errors.length > 0) {