PATH:
home
/
lab2454c
/
sothebry.softkinesis.com
/
backups
/
core
/
app
/
Http
/
Controllers
/
NftGateway
/
Paypal
<?php namespace App\Http\Controllers\NftGateway\Paypal; use App\Models\Deposit; use App\Models\Bid; use App\Models\NftOrder; use App\Models\GeneralSetting; use App\Http\Controllers\Gateway\PaymentController; use App\Http\Controllers\Controller; class ProcessController extends Controller { public static function process($gatewayCurrency) { $basic = GeneralSetting::first(); $finalPrice = session()->get('finalPrice'); $paypalAcc = json_decode($gatewayCurrency->gateway_parameter); $val['cmd'] = '_xclick'; $val['business'] = trim($paypalAcc->paypal_email); $val['cbt'] = $basic->sitename; $val['currency_code'] = "$gatewayCurrency->currency"; $val['quantity'] = 1; $val['item_name'] = "Payment To $basic->sitename Account"; //$val['custom'] = "$deposit->trx"; $val['amount'] = round($finalPrice,2); $val['return'] = route(gatewayRedirectUrl(true)); $val['cancel_return'] = route(gatewayRedirectUrl()); $val['notify_url'] = route('nft-ipn.'.$gatewayCurrency->gateway_alias); $send['val'] = $val; $send['view'] = 'user.fashionNft.payment.redirect'; $send['method'] = 'post'; $send['url'] = 'https://www.sandbox.paypal.com/'; // use for sandbod text //$send['url'] = 'https://www.paypal.com/cgi-bin/webscr'; return json_encode($send); } public function ipn() { $raw_post_data = file_get_contents('php://input'); $raw_post_array = explode('&', $raw_post_data); $myPost = array(); foreach ($raw_post_array as $keyval) { $keyval = explode('=', $keyval); if (count($keyval) == 2) $myPost[$keyval[0]] = urldecode($keyval[1]); } $req = 'cmd=_notify-validate'; foreach ($myPost as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; $details[$key] = $value; } $paypalURL = "https://ipnpb.sandbox.paypal.com/cgi-bin/webscr?"; // use for sandbox text //$paypalURL = "https://ipnpb.paypal.com/cgi-bin/webscr?"; $callUrl = $paypalURL . $req; $verify = curlContent($callUrl); if ($verify == "VERIFIED") { $bid_id = session()->get('bid_id'); $bid = Bid::findOrFail($bid_id); $finalPrice = $bid->price + ($bid->price * (4/100)); $orderNumber = getTrx(); $order = new NftOrder(); $order->price = $finalPrice; $order->order_number = $orderNumber; $order->bid()->associate($bid); $order->user()->associate($bid->user); $order->fashionNft()->associate($bid->fashionNft); $order->status = 1; $order->save(); // if ($_POST['mc_gross'] == $deposit->final_amo && $deposit->status == '0') { // PaymentController::userDataUpdate($deposit->trx); // } } } }
[+]
..
[-] ProcessController.php
[edit]