Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace App\Http\Controllers\Pay; use App\Exceptions\RuleValidationException; us..
Decoded Output download
<?php
namespace App\Http\Controllers\Pay;
use App\Exceptions\RuleValidationException;
use App\Http\Controllers\PayController;
use Illuminate\Http\Request;
use Yansongda\Pay\Pay;
class AlipayController extends PayController
{
/**
*
*
* @param string $payway
* @param string $orderSN
*/
public function gateway(string $payway, string $orderSN)
{
try {
//
$this->loadGateWay($orderSN, $payway);
$config = [
'app_id' => $this->payGateway->merchant_id,
'ali_public_key' => $this->payGateway->merchant_key,
'private_key' => $this->payGateway->merchant_pem,
'notify_url' => url($this->payGateway->pay_handleroute . '/notify_url'),
'return_url' => url('detail-order-sn', ['orderSN' => $this->order->order_sn]),
'http' => [ // optional
'timeout' => 10.0,
'connect_timeout' => 10.0,
],
];
$order = [
'out_trade_no' => $this->order->order_sn,
'total_amount' => (float)$this->order->actual_price,
'subject' => $this->order->order_sn
];
switch ($payway){
case 'zfbf2f':
case 'alipayscan':
try{
$result = Pay::alipay($config)->scan($order)->toArray();
$result['payname'] = $this->order->order_sn;
$result['actual_price'] = (float)$this->order->actual_price;
$result['orderid'] = $this->order->order_sn;
$result['jump_payuri'] = $result['qr_code'];
return $this->render('static_pages/qrpay', $result, __('dujiaoka.scan_qrcode_to_pay'));
} catch (\Exception $e) {
return $this->err(__('dujiaoka.prompt.abnormal_payment_channel') . $e->getMessage());
}
case 'aliweb':
try{
$result = Pay::alipay($config)->web($order);
return $result;
} catch (\Exception $e) {
return $this->err(__('dujiaoka.prompt.abnormal_payment_channel') . $e->getMessage());
}
case 'aliwap':
try{
$result = Pay::alipay($config)->wap($order);
return $result;
} catch (\Exception $e) {
return $this->err(__('dujiaoka.prompt.abnormal_payment_channel') . $e->getMessage());
}
}
} catch (RuleValidationException $exception) {
return $this->err($exception->getMessage());
}
}
/**
*
*/
public function notifyUrl(Request $request)
{
$orderSN = $request->input('out_trade_no');
$order = $this->orderService->detailOrderSN($orderSN);
if (!$order) {
return 'error';
}
$payGateway = $this->payService->detail($order->pay_id);
if (!$payGateway) {
return 'error';
}
if($payGateway->pay_handleroute != '/pay/alipay'){
return 'fail';
}
$config = [
'app_id' => $payGateway->merchant_id,
'ali_public_key' => $payGateway->merchant_key,
'private_key' => $payGateway->merchant_pem,
];
$pay = Pay::alipay($config);
try{
//
$result = $pay->verify();
if ($result->trade_status == 'TRADE_SUCCESS' || $result->trade_status == 'TRADE_FINISHED') {
$this->orderProcessService->completedOrder($result->out_trade_no, $result->total_amount, $result->trade_no);
}
return 'success';
} catch (\Exception $exception) {
return 'fail';
}
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace App\Http\Controllers\Pay;
use App\Exceptions\RuleValidationException;
use App\Http\Controllers\PayController;
use Illuminate\Http\Request;
use Yansongda\Pay\Pay;
class AlipayController extends PayController
{
/**
*
*
* @param string $payway
* @param string $orderSN
*/
public function gateway(string $payway, string $orderSN)
{
try {
//
$this->loadGateWay($orderSN, $payway);
$config = [
'app_id' => $this->payGateway->merchant_id,
'ali_public_key' => $this->payGateway->merchant_key,
'private_key' => $this->payGateway->merchant_pem,
'notify_url' => url($this->payGateway->pay_handleroute . '/notify_url'),
'return_url' => url('detail-order-sn', ['orderSN' => $this->order->order_sn]),
'http' => [ // optional
'timeout' => 10.0,
'connect_timeout' => 10.0,
],
];
$order = [
'out_trade_no' => $this->order->order_sn,
'total_amount' => (float)$this->order->actual_price,
'subject' => $this->order->order_sn
];
switch ($payway){
case 'zfbf2f':
case 'alipayscan':
try{
$result = Pay::alipay($config)->scan($order)->toArray();
$result['payname'] = $this->order->order_sn;
$result['actual_price'] = (float)$this->order->actual_price;
$result['orderid'] = $this->order->order_sn;
$result['jump_payuri'] = $result['qr_code'];
return $this->render('static_pages/qrpay', $result, __('dujiaoka.scan_qrcode_to_pay'));
} catch (\Exception $e) {
return $this->err(__('dujiaoka.prompt.abnormal_payment_channel') . $e->getMessage());
}
case 'aliweb':
try{
$result = Pay::alipay($config)->web($order);
return $result;
} catch (\Exception $e) {
return $this->err(__('dujiaoka.prompt.abnormal_payment_channel') . $e->getMessage());
}
case 'aliwap':
try{
$result = Pay::alipay($config)->wap($order);
return $result;
} catch (\Exception $e) {
return $this->err(__('dujiaoka.prompt.abnormal_payment_channel') . $e->getMessage());
}
}
} catch (RuleValidationException $exception) {
return $this->err($exception->getMessage());
}
}
/**
*
*/
public function notifyUrl(Request $request)
{
$orderSN = $request->input('out_trade_no');
$order = $this->orderService->detailOrderSN($orderSN);
if (!$order) {
return 'error';
}
$payGateway = $this->payService->detail($order->pay_id);
if (!$payGateway) {
return 'error';
}
if($payGateway->pay_handleroute != '/pay/alipay'){
return 'fail';
}
$config = [
'app_id' => $payGateway->merchant_id,
'ali_public_key' => $payGateway->merchant_key,
'private_key' => $payGateway->merchant_pem,
];
$pay = Pay::alipay($config);
try{
//
$result = $pay->verify();
if ($result->trade_status == 'TRADE_SUCCESS' || $result->trade_status == 'TRADE_FINISHED') {
$this->orderProcessService->completedOrder($result->out_trade_no, $result->total_amount, $result->trade_no);
}
return 'success';
} catch (\Exception $exception) {
return 'fail';
}
}
}
Function Calls
None |
Stats
MD5 | 0d7dac92a035103f8b4e342eb135f8ec |
Eval Count | 0 |
Decode Time | 111 ms |