| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\utils\Alipay;
- use app\models\Goods;
- use app\models\Option;
- use app\constants\OptionSetting;
- use app\models\OrderDetail;
- use app\models\OrderUnion;
- use app\models\Store;
- use app\models\User;
- use app\utils\CurlHelper;
- use app\utils\OrderNo;
- use Symfony\Component\HttpFoundation\Response;
- use Yansongda\Pay\Exceptions\GatewayException;
- use Yansongda\Pay\Exceptions\InvalidConfigException;
- use Yansongda\Pay\Exceptions\InvalidSignException;
- use Yansongda\Pay\Pay;
- use Yansongda\Supports\Collection;
- use yii\base\BaseObject;
- use yii\helpers\Json;
- /**
- * Class Alipay 证书公钥模式
- * 支付宝支付相关操作
- * @package app\utils
- */
- class Alipay
- {
- const FLAG_REFUND = 'refund';
- const FLAG_NORMAL = 'wap';
- const FLAG_TRANSFER = 'transfer';
- private static $validFlag = [
- self::FLAG_NORMAL,
- self::FLAG_REFUND,
- self::FLAG_TRANSFER
- ];
- /**
- * @var \Yansongda\Pay\Gateways\Alipay
- */
- public static $alipay;
- public static $alipay_conf;
- public $mini_id;
- public $store_id;
- /**
- * @var string
- * 回调url
- */
- private static $notify_url = 'alipay/notify';
- public static $h5_url = 'order/order/order';
- /**
- * @param $return_url
- * @param $level
- * 获取支付宝实例
- */
- private function __construct($return_url = 'www.baidu.com', $type = 0, $store_id = 0)
- {
- $this->mini_id = get_mini_id();
- $this->store_id = $store_id = $store_id ?: get_store_id();
- if (\Yii::$app->prod_is_dandianpu() && !Store::hasIncoming($store_id) && self_mini() === false) {
- $alipay_config = Json::decode(Option::get('one_store_alipay_config', 0, 'saas', '')['value']);
- } else {
- $config_cache = \Yii::$app->cache->get('alipay_config_cache_' . $store_id);
- if ($config_cache) {
- $alipay_config = Json::decode($config_cache);
- } else {
- $alipay_config = Json::decode(Option::get(Option::OPTOPN_KEY, $store_id, 'alipay')['value']);
- }
- }
- $config = [
- 'app_id' => $alipay_config['app_id'],
- 'notify_url' => pay_notify_url(self::$notify_url),
- 'return_url' => $return_url,
- 'private_key' => $alipay_config['app_private_key'],
- 'log' => [ // optional
- 'file' => \Yii::$app->basePath . '/runtime/logs/alipay.log',
- 'level' => 'debug', // 建议生产环境等级调整为 info,开发环境为 debug
- 'type' => 'single', // optional, 可选 daily.
- 'max_file' => 30, // optional, 当 type 为 daily 时有效,默认 30 天
- ],
- 'ali_public_key' => $alipay_config['alipay_public_key']
- // 'app_cert_public_key' => \Yii::$app->basePath. '/utils/Alipay/CRT/app_cert_public_key.crt', // 应用公钥证书路径
- // 'ali_public_key' => \Yii::$app->basePath. '/utils/Alipay/CRT/alipay_cert_public_key.crt', // 支付宝公钥证书路径
- // 'alipay_root_cert' => \Yii::$app->basePath. '/utils/Alipay/CRT/alipay_root_cert.crt', // 支付宝根证书路径
- // 'mode' => 'dev' // optional,设置此参数,将进入沙箱模式
- ];
- if ($type) {
- $key = Option::ALIPAY_CONFIG_CERT;
- if (\Yii::$app->prod_is_dandianpu() && is_h5()){
- $key = OptionSetting::ALIPAY_PAY_DANDIANPUH5;
- if(!Store::hasIncoming($store_id, 'alipay', is_h5())){
- $store_id = 0;
- }
- }
- $config_cache = Option::get($key, $store_id, 'alipay')['value'];
- $config_cache = json_decode($config_cache, true);
- if (!empty($config_cache)) {
- $config = [
- 'app_id' => $config_cache['app_id'],
- 'notify_url' => pay_notify_url(self::$notify_url),
- 'return_url' => $return_url,
- 'log' => [ // optional
- 'file' => \Yii::$app->basePath . '/runtime/logs/alipay.log',
- 'level' => 'debug', // 建议生产环境等级调整为 info,开发环境为 debug
- 'type' => 'single', // optional, 可选 daily.
- 'max_file' => 30, // optional, 当 type 为 daily 时有效,默认 30 天
- ],
- 'private_key' => $config_cache['app_private_key'],
- 'app_cert_public_key' => $this->saveTempImage($config_cache['app_public_cert']), // 应用公钥证书路径
- 'ali_public_key' => $this->saveTempImage($config_cache['alipay_public_cert']), // 支付宝公钥证书路径
- 'alipay_root_cert' => $this->saveTempImage($config_cache['alipay_root_cert']), // 支付宝根证书路径
- ];
- }
- }
- self::$alipay = Pay::alipay($config);
- self::$alipay_conf = $config;
- }
- /**
- * 静态方法调用construct方法
- * @param $return_url
- */
- public static function init($return_url = '', $type = 0, $store_id = 0) {
- return new self($return_url, $type, $store_id);
- }
- //获取网络图片到临时目录
- public function saveTempImage($url)
- {
- if (strpos($url, 'http') === false) {
- $url = 'http:' . trim($url);
- }
- if (!is_dir(\Yii::$app->runtimePath . '/crt')) {
- mkdir(\Yii::$app->runtimePath . '/crt');
- }
- $save_path = \Yii::$app->runtimePath . '/crt/' . md5($url) . '.crt';
- CurlHelper::download($url, $save_path);
- return $save_path;
- }
- /**
- * app支付
- * @param $order
- * @param User $user
- * @param $subject
- * @param $balance_price
- * @param $return_url
- * @return Response | false | string | array
- */
- public static function app($order, $subject, $user, $type = '', $total_pay_price = 0,$balance_price = 0, $return_url = '') {
- self::init($return_url, 1);
- $order1 = $order;
- if($type === OrderNo::ORDER_UNION){
- $order = [
- 'body' => '订单合并支付',
- 'out_trade_no' => OrderNo::getOrderNo(OrderNo::ORDER_UNION),
- 'total_amount' => $balance_price > 0 ? $total_pay_price - $balance_price : $total_pay_price,
- 'subject' => count($order1) . '笔订单合并支付',
- ];
- $order_union = new OrderUnion();
- $order_union->store_id = get_store_id();
- $order_union->user_id = get_user()->id;
- $order_union->order_no = $order['out_trade_no'];
- $order_union->price = $order['total_amount'];
- $order_union->is_pay = 0;
- $order_union->created_at = time();
- $order_union->is_delete = 0;
- $order_id_list = [];
- foreach ($order1 as $value) {
- $order_id_list[] = $value->id;
- }
- $order_union->order_id_list = json_encode($order_id_list);
- if (!$order_union->save()) {
- foreach ($order_union->errors as $error) {
- return [
- 'code' => 1,
- 'msg' => $error
- ];
- }
- }
- }else{
- /** 逻辑开始 **/
- $order = [
- 'body' => $subject,
- 'out_trade_no' => $order->order_no,
- 'total_amount' => $balance_price > 0 ? ($order->pay_price - $balance_price) : $order->pay_price,
- 'subject' => $subject
- ];
- }
- try {
- $res = self::$alipay->app($order)->getContent();
- } catch (\Exception $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- }
- if($type === OrderNo::ORDER_UNION){
- foreach($order1 as $value){
- $value->order_union_id = $order_union->id;
- $value->save();
- }
- }
- return [
- 'code' => 0,
- 'msg' => 'success',
- 'data' => $res,
- 'res' => $res
- ];
- }
- /**
- * 订单查询
- * @param $order
- * @param $type 默认:wap: 普通订单,refund:退款订单,transfer: 转账订单
- * @return array | Collection
- */
- public static function find($order, $type = 'wap') {
- if (!in_array($type, self::$validFlag)) {
- return [
- 'code' => 1,
- 'msg' => 'Params are wrong'
- ];
- }
- self::init();
- /** 逻辑开始 **/
- $order = [
- 'out_trade_no' => $order->order_no,
- ];
- if ($type == self::FLAG_REFUND) {
- // 后端生成,唯一即可
- $order['out_request_no'] = $order->order_no;
- }
- try {
- $res = self::$alipay->find($order, $type);
- if ($res && $res->code === '10000' && $res->msg === 'Success') {
- return [
- 'code' => 0,
- 'msg' => 'success',
- 'data' => $res->toArray()
- ];
- }
- return [
- 'code' => $res->code,
- 'msg' => $res->msg,
- ];
- } catch (GatewayException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- } catch (InvalidSignException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- } catch (InvalidConfigException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- }
- }
- /**
- * wap支付
- * @param $order
- * @param $subject
- * @param $return_url
- * @return array
- */
- public static function wap($order, $subject, $return_url = '', $type = '', $total_pay_price = 0, $balance_price = 0, $payData = []) {
- if(!$return_url){
- $return_url = pay_return_url(self::$h5_url);
- }
- self::init($return_url, 1);
- $order1 = $order;
- if($type == OrderNo::ORDER_UNION){
- $order = [
- 'body' => '订单合并支付',
- 'out_trade_no' => OrderNo::getOrderNo(OrderNo::ORDER_UNION),
- 'total_amount' => $balance_price > 0 ? $total_pay_price - $balance_price : $total_pay_price,
- 'subject' => count($order1) . '笔订单合并支付',
- 'buyer_id' => get_user()->alipay_open_id
- ];
- $order_union = new OrderUnion();
- $order_union->store_id = get_store_id();
- $order_union->user_id = get_user()->id;
- $order_union->order_no = $order['out_trade_no'];
- $order_union->price = $order['total_amount'];
- $order_union->is_pay = 0;
- $order_union->created_at = time();
- $order_union->is_delete = 0;
- $order_id_list = [];
- foreach ($order1 as $value) {
- $order_id_list[] = $value->id;
- }
- $order_union->order_id_list = json_encode($order_id_list);
- if (!$order_union->save()) {
- foreach ($order_union->errors as $error) {
- return [
- 'code' => 1,
- 'msg' => $error
- ];
- }
- }
- }else{
- /** 逻辑开始 **/
- $order = [
- 'body' => $subject,
- 'out_trade_no' => $order->order_no,
- 'total_amount' => $order->pay_price,
- 'subject' => $subject,
- 'buyer_id' => get_user()->alipay_open_id
- ];
- }
- try {
- $res = self::$alipay->wap($order);
- if ($res->getStatusCode() == 40004 || $res->getStatusCode() == 'ACQ.CONTEXT_INCONSISTENT') {
- $order->order_no = OrderNo::getOrderNo(OrderNo::ORDER_MALL);
- $order->save();
- return self::wap($order, $subject, $return_url, $type, $total_pay_price, $balance_price, $payData);
- }
- if($type == OrderNo::ORDER_UNION){
- foreach($order1 as $value){
- $value->order_union_id = $order_union->id;
- $value->save();
- }
- }
- return [
- 'code' => 0,
- 'msg' => 'success',
- 'data' => $res->getContent()
- ];
- } catch (\Exception $e) {
- return [
- 'code' => 1,
- 'msg' => '支付失败'. $e->getMessage()
- ];
- }
- }
- /**
- * web支付
- * @param $order
- * @param $subject
- * @param $return_url
- * @return Response | false | string
- */
- public static function web($order, $subject, $return_url = '') {
- self::init($return_url);
- /** 逻辑开始 **/
- $order = [
- 'body' => $subject,
- 'out_trade_no' => $order->order_no,
- 'total_amount' => $order->pay_price,
- 'subject' => $subject,
- ];
- $res = self::$alipay->web($order)->send();
- return $res->getContent();
- }
- /**
- * 扫码支付
- * @param $order
- * @param $subject
- * @param $return_url
- * @return Collection | array
- */
- public static function scan($order, $subject, $return_url = '', $user_id = null) {
- self::init($return_url);
- /** 逻辑开始 **/
- $order = [
- 'body' => $subject,
- 'out_trade_no' => $order->order_no,
- 'total_amount' => $order->pay_price,
- 'subject' => $subject,
- 'buyer_id' => $user_id
- ];
- try {
- $res = self::$alipay->mini($order);
- if ($res && $res->code === '10000' && $res->msg === 'Success') {
- return [
- 'code' => 0,
- 'msg' => 'success',
- 'data' => $res->toArray()
- ];
- }
- return [
- 'code' => $res->code,
- 'msg' => $res->msg,
- ];
- } catch (GatewayException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- } catch (InvalidSignException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- } catch (InvalidConfigException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- }
- }
- /**
- * 扫码支付
- * @param $order
- * @param $subject 订单标题
- * @param $return_url
- * @return Collection | array
- */
- public static function scanNew($order, $subject, $return_url = '', $auth_code,$total_pay_price = 0,$balance_price = 0) {
- self::init($return_url);
- /** 逻辑开始 **/
- $order = [
- 'out_trade_no' => $order->order_no,//订单号
- 'total_amount' => $balance_price > 0 ? $total_pay_price - $balance_price : $total_pay_price,
- 'subject' => $subject,// 订单标题
- 'auth_code' => $auth_code,
- 'scene' => 'bar_code',
- ];
- try {
- $res = self::$alipay->pos($order);
- if ($res && $res->code === '10000' && $res->msg === 'Success') {
- return [
- 'code' => 0,
- 'msg' => 'success',
- 'data' => $res->toArray()
- ];
- }
- return [
- 'code' => $res->code,
- 'msg' => $res->msg,
- ];
- } catch (GatewayException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- } catch (InvalidSignException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- } catch (InvalidConfigException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- }
- }
- /**
- * 转账
- * @param $order
- * @param $mail
- * @param $return_url
- * @return Collection | array
- */
- public static function transfer($order, $mail, $return_url = '') {
- if (empty($mail)) {
- return [
- 'code' => 1,
- 'msg' => 'Params are wrong'
- ];
- }
- self::init($return_url, 1);
- /** 逻辑开始 **/
- $order = [
- 'out_biz_no' => $order->order_no,
- 'trans_amount' => floatval(sprintf("%.2f", $order->pay_price)),
- 'biz_scene' => 'DIRECT_TRANSFER',
- 'product_code' => 'TRANS_ACCOUNT_NO_PWD',
- 'order_title' => '佣金提现',
- 'payee_info' => [
- 'identity' => $mail,
- 'identity_type' => 'ALIPAY_LOGON_ID',
- 'name' => $order->name
- ],
- ];
- try {
- $res = self::$alipay->transfer($order);
- if ($res && $res->code === '10000' && $res->msg === 'Success') {
- return [
- 'code' => 0,
- 'msg' => 'success',
- 'data' => $res->toArray()
- ];
- }
- return [
- 'code' => $res->code,
- 'msg' => $res->msg,
- ];
- } catch (GatewayException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- } catch (InvalidSignException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- } catch (InvalidConfigException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- }
- }
- /**
- * 批量转账
- * @param $params
- * @return Collection | array
- */
- public static function batchTransfer($params) {
- self::init('');
- /** 逻辑开始 **/
- $order = [
- 'out_batch_no' => $params['out_batch_no'],
- 'product_code' => 'BATCH_API_TO_ACC_NO_PWD',
- 'biz_scene' => 'MESSAGE_BATCH_PAY',
- 'total_trans_amount' => $params['total_trans_amount'],
- 'total_count' => 1,
- 'trans_order_list' => [
- [
- 'out_biz_no' => $params['out_batch_no'],
- 'trans_amount' => $params['total_trans_amount'],
- 'payee_info' => [
- 'identity' => $params['account'],
- 'identity_type' => 'ALIPAY_LOGON_ID',
- 'name' => $params['name']
- ],
- 'remark' => $params['title']
- ],
- ],
- 'order_title' => $params['title'],
- 'remark' => '转账',
- ];
- try {
- $res = self::$alipay->batchtransfer($order);
- \Yii::error($res);
- if ($res && $res->code === '10000' && $res->msg === 'Success') {
- return [
- 'code' => 0,
- 'msg' => 'success',
- 'data' => $res->toArray()
- ];
- }
- return [
- 'code' => $res->code,
- 'msg' => $res->msg,
- ];
- } catch (GatewayException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- } catch (InvalidSignException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- } catch (InvalidConfigException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- }
- }
- /**
- * 退款
- * @param $order
- * @param $return_url
- * @param $refund_fee
- * @return Collection | array
- */
- public static function refund($order, $refund_fee, $return_url = '') {
- self::init($return_url, 1);
- /** 逻辑开始 **/
- $data = [
- 'out_trade_no' => $order->order_no,
- 'refund_amount' => $refund_fee,
- ];
- try {
- $res = self::$alipay->refund($data);
- if ($res && $res->code === '10000' && $res->msg === 'Success') {
- return [
- 'code' => 0,
- 'msg' => 'success',
- 'data' => $res->toArray()
- ];
- }
- return [
- 'code' => $res->code,
- 'msg' => $res->msg,
- ];
- } catch (GatewayException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- } catch (InvalidSignException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- } catch (InvalidConfigException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- }
- }
- /**
- * 小程序支付
- * @param $order
- * @param $subject
- * @param User $user
- * @param $return_url
- * @param $is_food
- * @return Collection | array
- */
- public static function mini($order, $subject, $user, $return_url = '', $type = '', $total_pay_price = 0, $balance_price = 0, $payData = []) {
- $self = self::init($return_url);
- if (!$order || ($type != OrderNo::ORDER_UNION && empty($subject)) || !$user) {
- return [
- 'code' => 1,
- 'msg' => '参数有误'
- ];
- }
- $order1 = $order;
- if ($type == OrderNo::ORDER_UNION) {
- $order = [
- 'body' => '订单合并支付',
- 'out_trade_no' => OrderNo::getOrderNo(OrderNo::ORDER_UNION),
- 'total_amount' => $balance_price > 0 ? $total_pay_price - $balance_price : $total_pay_price,
- 'subject' => count($order1) . '笔订单合并支付',
- 'buyer_id' => ($user->alipay_open_id ?? $user->ali_user_id)
- ];
- $order_union = new OrderUnion();
- $order_union->store_id = get_store_id();
- $order_union->user_id = get_user()->id;
- $order_union->order_no = $order['out_trade_no'];
- $order_union->price = $order['total_amount'];
- $order_union->is_pay = 0;
- $order_union->created_at = time();
- $order_union->is_delete = 0;
- $order_id_list = [];
- foreach ($order1 as $value) {
- $order_id_list[] = $value->id;
- }
- $order_union->order_id_list = json_encode($order_id_list);
- if (!$order_union->save()) {
- foreach ($order_union->errors as $error) {
- return [
- 'code' => 1,
- 'msg' => $error
- ];
- }
- }
- } else {
- try{
- $goods_detail = [];
- $details = OrderDetail::findAll(['order_id' => $order->id]);
- foreach ($details as $detail) {
- $goods = Goods::findOne($detail->goods_id);
- $goods_detail[] = [
- 'goods_id' => $goods->goods_no ,
- 'goods_name' => $detail->goods_name,
- 'quantity' => $detail->num,
- 'price' => $detail->total_price / $detail->num,
- ];
- }
- } catch (\Exception $e) {
- \Yii::error([__METHOD__, $order, $e]);
- }
- $order = [
- 'body' => $subject,
- 'out_trade_no' => $order->order_no,
- 'total_amount' => $balance_price > 0 ? ($order->pay_price - $balance_price) : $order->pay_price,
- 'subject' => $subject,
- 'buyer_id' => ($user->alipay_open_id ?? $user->ali_user_id)
- ];
- $goods_detail && $order['goods_detail'] = $goods_detail;
- }
- try {
-
- if($payData->ali_requireOrder && $payData->ali_sourceId){
- $form = new \app\modules\admin\models\AlipayThirdForm();
- $form->store_id = $self->store_id;
- $form->mini_id = $self->mini_id;
- $openOrder = $form->AlipayOpenMiniOrderCreate($order1, $order, $payData);
- if($openOrder['code'] != 0){
- return $openOrder;
- }
- $order['extend_params'] = [
- 'trade_component_order_id' => $openOrder['data'],
- ];
- foreach($openOrder['biz_content']['order_detail']['item_infos'] as $item){
- $order['goods_detail'][] = [
- 'goods_id' => $item['goods_id'],
- 'goods_name' => $item['goods_name'],
- 'quantity' => $item['item_cnt'],
- 'price' => $item['sale_price'],
- 'out_item_id' => $item['out_item_id'],
- 'out_sku_id' => $item['out_sku_id'],
- ];
- }
- }
- $order['product_code'] = 'JSAPI_PAY';
- $res = self::$alipay->mini($order);
- if ($res && $res->code === '10000' && $res->msg === 'Success') {
- return [
- 'code' => 0,
- 'msg' => 'success',
- 'data' => $res->toArray()
- ];
- }
- if ($type == OrderNo::ORDER_UNION) {
- foreach ($order1 as $value) {
- $value->order_union_id = $value->id;
- $value->save();
- }
- }
- return [
- 'code' => $res->code,
- 'msg' => $res->msg,
- ];
- } catch (GatewayException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- } catch (InvalidSignException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- } catch (InvalidConfigException $e) {
- return [
- 'code' => 1,
- 'msg' => $e->getMessage()
- ];
- }
- }
- }
|