Commit a766a4f3 by 赵凯(PHP)

update

1 parent 3585361b
Showing with 1322 additions and 32 deletions
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
<?php
date_default_timezone_set('Asia/Shanghai');
require_once __DIR__.'/../../autoload.php';
//require_once __DIR__.'/common.php';
use Payment\Common\PayException;
use Payment\Client\Charge;
use Payment\Config;
$config = [
'channelid' => '860010010210008',
'key' => 'fkdkldvkij5dfd24dl24dk2dddflaaf2',
'merid' => '880210010215460',
'termid' => '10006468',
];
$payData = [
'tradetrace' => '11620210303155407146230',
'oritradetrace' => '2019062017085196425851101914',
];
try{
$ret = \Payment\Client\Cancel::run(Config::YS_CHARGE, $config, $payData);
}catch(PayException $e){
exit($e->errorMessage());
}
echo json_encode($ret, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
<?php
date_default_timezone_set('Asia/Shanghai');
require_once __DIR__.'/../../autoload.php';
//require_once __DIR__.'/common.php';
use Payment\Common\PayException;
use Payment\Client\Charge;
use Payment\Config;
$config = [
'channelid' => '860010010210008',
'key' => 'fkdkldvkij5dfd24dl24dk2dddflaaf2',
'merid' => '880210010215460',
'termid' => '10006468',
];
$payData = [
// 'tradetrace' => '11620210304155042147189',
'tradetrace' => '2019062017085196425851101914',
// 'oritradetrace' => '2019062017085196425851101914',
];
try{
$ret = \Payment\Client\Close::run(Config::YS_CHARGE, $config, $payData);
}catch(PayException $e){
exit($e->errorMessage());
}
echo json_encode($ret, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
<?php
date_default_timezone_set('Asia/Shanghai');
require_once __DIR__.'/../../autoload.php';
//require_once __DIR__.'/common.php';
use Payment\Common\PayException;
use Payment\Client\Charge;
use Payment\Config;
$config = [
'channelid' => '860010010210008',
'key' => 'fkdkldvkij5dfd24dl24dk2dddflaaf2',
'merid' => '880210010215460',
'termid' => '10006468'
];
$payData = [
'notifyurl' => 'https://www.test.com/test/test.t',
'tradetrace' => '2019062017085196425851101915',
// 'openid' =>'oDqg_5Za0tc23LhTkUR6PfFZ8O2g',
'openid' =>'ohWpr5L1oy5SK4LMyoazVG4BJVGY',
'tradeamt'=>1
];
// $payData = [
// "out_trade_no" => "2019062017085196425851101915",
// "total_fee" => 1,
// "body" => 'hello 你好呀',
// "extra_param" => '',
// 'open_id' => "oDqg_5Za0tc23LhTkUR6PfFZ8O2g"
// ];
try{
$ret = Charge::run(Config::YS_CHANNEL_LITE, $config, $payData);
}catch(PayException $e){
exit($e->errorMessage());
}
echo json_encode($ret, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
<?php
date_default_timezone_set('Asia/Shanghai');
require_once __DIR__.'/../../autoload.php';
//require_once __DIR__.'/common.php';
use Payment\Common\PayException;
use Payment\Client\Charge;
use Payment\Config;
$config = [
'partner_id' => '826791873720039',
'seller_id' => 'QRY210802574454',
'seller_name' => '铜川市耀州区青丝坊发型设计室',
'business_code' => '3010002',
];
$payData = [
// 'method'=>'ysepay.online.weixin.pay',
'notify_url' => 'http://www.test.com/test/test.t',
'out_trade_no' =>'2019062017085196425851101912',
'shopdate' =>date('Ymd'),
'timestamp' =>date('Y-m-d H:i:s',time()),
'subject' =>'乐店云支付测试',
'total_amount' => 0.01,
'timeout_express' => '9h',
'sub_openid' => 'ohWpr5HtNcnMC94YBd6i9pqNU07Y',
'appid' => 'wxe48ea18f1edba2c7',
'extra_common_param' => '123123123213', //公用回传参数
];
try{
$ret = Charge::run(Config::YSE_CHANNEL_PUB, $config, $payData);
}catch(PayException $e){
exit($e->errorMessage());
}
echo json_encode($ret, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
<?php
date_default_timezone_set('Asia/Shanghai');
require_once __DIR__.'/../../autoload.php';
//require_once __DIR__.'/common.php';
use Payment\Common\PayException;
use Payment\Client\Query;
use Payment\Config;
$config = [
'partner_id' => '826791873720039',
'seller_id' => '826791873720039',
'seller_name' => '西安汇集信电子技术有限公司',
'business_code' => '3010002',
];
$payData = [
// 'method'=>'ysepay.online.weixin.pay',
'out_trade_no' =>'2019062017085196425851101912',
'shopdate' =>date('Ymd'),
'timestamp' =>date('Y-m-d H:i:s',time()),
];
try{
$ret = Query::run(Config::YSE_QUERY, $config, $payData);
}catch(PayException $e){
exit($e->errorMessage());
}
echo json_encode($ret, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
<?php
date_default_timezone_set('Asia/Shanghai');
require_once __DIR__.'/../../autoload.php';
//require_once __DIR__.'/common.php';
use Payment\Common\PayException;
use Payment\Client\Refund;
use Payment\Config;
$config = [
'partner_id' => '826791873720039',
'seller_id' => '826791873720039',
'seller_name' => '西安汇集信电子技术有限公司',
'business_code' => '3010002',
];
$payData = [
// 'method'=>'ysepay.online.trade.refund',
'out_trade_no' =>'2019062017085196425851101912',
'shopdate' =>'20210810',
'refund_amount' => 0.01,
'refund_reason' => '测试退款',
'out_request_no' => 'out_request_no',
];
try{
$ret = Refund::run(Config::YSE_REFUND, $config, $payData);
}catch(PayException $e){
exit($e->errorMessage());
}
echo json_encode($ret, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
......@@ -11,14 +11,17 @@ use Payment\Client\Charge;
use Payment\Config;
$config = [
'channelid' => '860010010210008',
'key' => 'fkdkldvkij5dfd24dl24dk2dddflaaf2',
'merid' => '880210010215460',
'termid' => '10006468',
'channelid' => 'D01X00000800856',
'key' => 'lldilrd58lr0o1204l3a32ji5ladavf5',
'merid' => '531000008882415',
'termid' => 'W0725858',
];
// {"sign":"5A21EDDAA1092578740FF5CFE4B12F27","wxopenid":"ohWpr5DmiDNk0tOh7eJ2NKEaOfjQ","wxtimeend":"20210814114050","tradetrace":"2021081411404288702697100565","clearamt":"1680","wxtransactionid":"4200001236202108145338315235","acctype":"U","payamt":"1680","wtorderid":"11620210814114046400091"}
$payData = [
'tradetrace' => '11620210303155407146230',
'oritradetrace' => '2019062017085196425851101914',
'tradetrace' => '11620210814155733791279',
'oritradetrace' => '2021081415572994384657101545',
];
......
File mode changed
File mode changed
......@@ -11,10 +11,10 @@ use Payment\Client\Charge;
use Payment\Config;
$config = [
'channelid' => '860010010210008',
'key' => 'fkdkldvkij5dfd24dl24dk2dddflaaf2',
'merid' => '880210010215460',
'termid' => '10006468',
'channelid' => 'D01X00000800856',
'key' => 'lldilrd58lr0o1204l3a32ji5ladavf5',
'merid' => '531000009218530',
'termid' => 'W0810460',
];
$payData = [
'notifyurl' => 'https://www.test.com/test/test.t',
......
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
<?php
namespace Payment\Charge\YSE;
use Payment\Common\BaseData;
use Payment\Common\YSEConfig;
use Payment\Common\YSEpay\Data\Cancel\CancelData;
use Payment\Common\YSEpay\YSEBaseStrategy;
class YSECancel extends YSEBaseStrategy{
/**
* 获取支付对应的数据完成类
*
* @return BaseData
*/
public function getBuildDataClass(){
// TODO: Implement getBuildDataClass() method.
return CancelData::class;
}
protected function getReqUrl($url = null){
return parent::getReqUrl($url ?? YSEConfig::REQUEST_URL); // TODO: Change the autogenerated stub
}
}
<?php
namespace Payment\Charge\YSE;
use Payment\Common\BaseData;
use Payment\Common\YSEConfig;
use Payment\Common\YSEpay\Data\Cancel\CloseData;
use Payment\Common\YSEpay\YSEBaseStrategy;
class YSEClose extends YSEBaseStrategy{
/**
* 获取支付对应的数据完成类
*
* @return BaseData
*/
public function getBuildDataClass(){
// TODO: Implement getBuildDataClass() method.
return CloseData::class;
}
protected function getReqUrl($url = null){
return parent::getReqUrl($url ?? YSEConfig::REQUEST_URL); // TODO: Change the autogenerated stub
}
}
<?php
namespace Payment\Charge\YSE;
use Payment\Common\BaseData;
use Payment\Common\YSEConfig;
use Payment\Common\YSEpay\Data\Charge\NatChargeData;
use Payment\Common\YSEpay\YSEBaseStrategy;
class YSENatCharge extends YSEBaseStrategy{
/**
* 获取支付对应的数据完成类
*
* @return BaseData
*/
public function getBuildDataClass(){
// TODO: Implement getBuildDataClass() method.
return NatChargeData::class;
}
protected function getReqUrl($url = null){
return parent::getReqUrl($url ?? YSEConfig::SCANPAY_URL); // TODO: Change the autogenerated stub
}
}
<?php
namespace Payment\Charge\YSE;
use Payment\Common\BaseData;
use Payment\Common\YSEConfig;
use Payment\Common\YSEpay\Data\Charge\PubChargeData;
use Payment\Common\YSEpay\YSEBaseStrategy;
class YSEPubCharge extends YSEBaseStrategy{
/**
* 获取支付对应的数据完成类
*
* @return BaseData
*/
public function getBuildDataClass(){
// TODO: Implement getBuildDataClass() method.
return PubChargeData::class;
}
protected function getReqUrl($url = null){
return parent::getReqUrl($url ?? YSEConfig::REQUEST_URL); // TODO: Change the autogenerated stub
}
}
<?php
namespace Payment\Charge\YSE;
use Payment\Common\BaseData;
use Payment\Common\YSEConfig;
use Payment\Common\YSEpay\Data\Charge\ScanChargeData;
use Payment\Common\YSEpay\YSEBaseStrategy;
class YSEScanCharge extends YSEBaseStrategy{
/**
* 获取支付对应的数据完成类
*
* @return BaseData
*/
public function getBuildDataClass(){
// TODO: Implement getBuildDataClass() method.
return ScanChargeData::class;
}
protected function getReqUrl($url = null){
return parent::getReqUrl($url??YSEConfig::SCANPAY_URL); // TODO: Change the autogenerated stub
}
}
......@@ -43,6 +43,8 @@ use Payment\Charge\Wx\WxWapCharge;
use Payment\Charge\YS\YSNatCharge;
use Payment\Charge\YS\YSPubCharge;
use Payment\Charge\YS\YSScanCharge;
use Payment\Charge\YSE\YSEPubCharge;
use Payment\Common\BaseStrategy;
use Payment\Common\PayException;
......@@ -204,6 +206,11 @@ class ChargeContext
case Config::YS_CHANNEL_NATIVE: //主扫
$this->channel = new YSNatCharge($config);
break;
case Config::YSE_CHANNEL_PUB:
case Config::YSE_CHANNEL_LITE: //小程序、公众号
$this->channel = new YSEPubCharge($config);
break;
default:
throw new PayException('当前支持:支付宝、微信、招商一网通、通联支付、米付支付、扫呗支付、富友支付、联拓富、易生支付。');
}
......
......@@ -60,6 +60,10 @@ class Charge
Config::YS_CHANNEL_SCAN,
Config::YS_CHANNEL_NATIVE,
// Config::YS_CHANNEL_BAR
//盛银支付
Config::YSE_CHANNEL_PUB,
Config::YSE_CHANNEL_LITE,
];
/**
......
File mode changed
......@@ -33,6 +33,8 @@ class Notify
Config::LTF_CHARGE, //联拓富
Config::YS_CHARGE, //易生
Config::YSE_CHARGE, //银盛
];
/**
......
......@@ -47,6 +47,8 @@ class Query
Config::LTF_REFUND,
Config::YS_QUERY,//易生
Config::YSE_QUERY,//易生
];
/**
......
......@@ -39,6 +39,8 @@ class Refund
Config::LTF_REFUND,
Config::YS_REFUND,//易生支付
Config::YSE_REFUND,//银盛支付
];
/**
......
File mode changed
......@@ -63,6 +63,8 @@ abstract class BaseData
$this->channel = Config::LTF_PAY;
} elseif ($config instanceof YSConfig) {
$this->channel = Config::YS_PAY;
}elseif ($config instanceof YSEConfig) {
$this->channel = Config::YSE_PAY;
}elseif ($config instanceof SwThreeConfig) {
$this->channel = Config::SW_T_PAY;
}
......@@ -169,6 +171,12 @@ abstract class BaseData
$signStr = ArrayUtil::createLinkstring($values);
$this->makeSign($signStr);
break;
case Config::YSE_PAY:
$values = ArrayUtil::removeKeys($data, ['sign']);
$values = ArrayUtil::arraySort($values);
$signStr = ArrayUtil::createLinkstring($values);
$this->makeSign($signStr);
break;
default:
$values = ArrayUtil::removeKeys($data, ['sign']);
$values = ArrayUtil::arraySort($values);
......
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
......@@ -7,9 +7,9 @@ use Payment\Utils\StrUtil;
final class YSConfig extends ConfigInterface{
public const REQUEST_URL = 'https://notify-test.eycard.cn:7443/WorthTech_Access_AppPaySystemV2/apppayacc';
public const REQUEST_URL = 'https://open.eycard.cn:8443/WorthTech_Access_AppPaySystemV2/apppayacc';
public $request_url = 'https://notify-test.eycard.cn:7443/WorthTech_Access_AppPaySystemV2/apppayacc';
public $request_url = 'https://open.eycard.cn:8443/WorthTech_Access_AppPaySystemV2/apppayacc';
public $signType = 'MD5';
......
<?php
namespace Payment\Common;
use Payment\Utils\ArrayUtil;
use Payment\Utils\StrUtil;
final class YSEConfig extends ConfigInterface{
public const REQUEST_URL = 'https://qrcode.ysepay.com/gateway.do';
public const REFUND_URL = 'https://openapi.ysepay.com/gateway.do';
public const QUERY_URL = 'https://search.ysepay.com/gateway.do';
public $sign; //签名
public $sign_type = 'RSA';
public $partner_id;//商户号
public $business_code;//业务代码
public $seller_id;//收款方银盛支付用户号
public $seller_name;//收款方银盛支付客户名
public $charset = 'UTF-8'; //编码格式
public $version = '3.0'; //调用的接口版本
public $notify_url; //银盛支付服务器主动通知商户服务器里指定的页面 http 路径。
public $biz_content; //JSON 格式,具体包含的内容参见各个接口的业务参数描述
/**
* FuConfig constructor.
* @param array $config
* @throws PayException
*/
public function __construct(array $config)
{
try {
$this->initConfig($config);
} catch (PayException $e) {
throw $e;
}
}
/**
* 初始化配置文件参数
* @param array $config
* @throws PayException
*/
/**
* 初始化配置文件参数
* @param array $config
* @throws PayException
*/
private function initConfig(array $config)
{
$config = ArrayUtil::paraFilter($config);
if (key_exists('partner_id', $config) && !empty($config['partner_id'])) $this->partner_id = $config['partner_id'];else throw new PayException('必须提供商户号标识');
if (key_exists('seller_id', $config) && !empty($config['seller_id'])) $this->seller_id = $config['seller_id'];else throw new PayException('必须提供收款方银盛支付用户号');
if (key_exists('seller_name', $config) && !empty($config['seller_name'])) $this->seller_name = $config['seller_name'];else throw new PayException('必须提供收款方银盛支付客户名');
if (key_exists('business_code', $config) && !empty($config['business_code'])) $this->business_code = $config['business_code'];else throw new PayException('必须提供业务代码');
}
}
<?php
namespace Payment\Common\YSEpay\Data\Cancel;
use Payment\Common\YSEpay\Data\YSEBaseData;
use Payment\Common\PayException;
use Payment\Utils\ArrayUtil;
class CancelData extends YSEBaseData{
/**
* 构建用于支付的签名相关数据
*
* @return array
*/
protected function buildData(){
// TODO: Implement buildData() method.
$this->certainSignData = [
'channelid' => $this->channelid, //渠道编号
'opt' => $this->opt ?? "cancel", //操作类型(“cancel”)
'merid' => $this->merid, //商戶编号
'termid' => $this->termid, //终端编号
'tradetrace' => $this->tradetrace, //原交易流水(建议使用易生流水号查询:wtorderid)
// 'oritradetrace' => $this->oritradetrace, //原交易流水; 与 oriwtorderid 字段可以二选一上送,如果都上送,以 本节点为准。
// 'oriwtorderid' => $this->oriwtorderid, //原交易的系统订单号;与 oritradetrace 字段可以二选一上送,如果都 上送,以 oritradetrace 节点为准
];
$signData = array_merge($this->certainSignData, []);
if(isset($this->version)){
$signData['version'] = $this->version; //填写的值为 2 时,交易成功后返回优惠信息
}
if(isset($this->oritradetrace)){
$signData['oritradetrace'] = $this->oritradetrace; //退货金额,以分为单位,不大于原交易金额与已成功退货金额之差
}else{
if(isset($this->oriwtorderid)){
$signData['oriwtorderid'] = $this->oriwtorderid; //退货金额,以分为单位,不大于原交易金额与已成功退货金额之差
}
}
$this->retData = ArrayUtil::paraFilter($signData);
}
/**
* 检查传入的参数. $reqData是否正确.
*
* @return mixed
* @throws PayException
*/
protected function checkDataParam(){
// TODO: Implement checkDataParam() method.
parent::checkDataParam();
}
}
<?php
namespace Payment\Common\YSEpay\Data\Cancel;
use Payment\Common\YSEpay\Data\YSEBaseData;
use Payment\Common\PayException;
use Payment\Utils\ArrayUtil;
class CloseData extends YSEBaseData{
/**
* 构建用于支付的签名相关数据
*
* @return array
*/
protected function buildData(){
// TODO: Implement buildData() method.
$this->certainSignData = [
'channelid' => $this->channelid, //渠道编号
'opt' => $this->opt ?? "close", //操作类型(“close”)
'merid' => $this->merid, //商戶编号
'termid' => $this->termid, //终端编号
'tradetrace' => $this->tradetrace, //原交易流水(建议使用易生流水号查询:wtorderid)
];
$signData = array_merge($this->certainSignData, []);
$this->retData = ArrayUtil::paraFilter($signData);
}
/**
* 检查传入的参数. $reqData是否正确.
*
* @return mixed
* @throws PayException
*/
protected function checkDataParam(){
// TODO: Implement checkDataParam() method.
parent::checkDataParam();
}
}
<?php
namespace Payment\Common\YSEpay\Data\Charge;
use Payment\Common\YSEpay\Data\YSEBaseData;
use Payment\Common\PayException;
use Payment\Config;
abstract class ChargeBaseData extends YSEBaseData{
/**
* 检查传入的参数. $reqData是否正确.
*
* @return mixed
* @throws \Payment\Common\PayException
*/
protected function checkDataParam(){
// TODO: Implement checkDataParam() method.
// 检查金额不能低于0.01
if ($this->total_amount < 0.01) {
throw new PayException('支付金额不能低于 ' . Config::PAY_MIN_FEE . ' 元');
}
}
}
<?php
namespace Payment\Common\YSEpay\Data\Charge;
use Payment\Common\PayException;
use Payment\Utils\ArrayUtil;
class NatChargeData extends ChargeBaseData{
/**
* 构建用于支付的签名相关数据
*
* @return void
*/
protected function buildData(){
// TODO: Implement buildData() method.
$this->certainSignData = [
'channelid' => $this->channelid, //渠道编号
'opt' => $this->opt ?? "apPreOrder", //操作类型(“apPreOrder”:支付宝;“upPreOrder”:银联)
'merid' => $this->merid, //商戶编号
'termid' => $this->termid, //终端编号
'tradetrace' => $this->tradetrace, //商户订单号(控制在 50 位长度以内,确保在请求接口的系统中全局 唯一;可以包含数字与字母;不能包含其他特殊字符)
'tradeamt' => $this->tradeamt, //交易金额(单位:分)
'tradetype' => $this->tradetype ?? "NATIVE", //支付方式
'notifyurl' => $this->notifyurl, //客户端接收支付成功通知的地址
'body' => $this->body ?? "乐店云支付", //商品或支付单简要描述
];
$signData = array_merge($this->certainSignData, []);
if(isset($this->openid)){ //支付宝(买家支付宝用户ID),上送支付宝用户ID时,当前订单仅当前支付宝用户支付
$signData['openid'] = $this->openid;
}
if(isset($this->instalment)){ //支付宝花呗分期
$signData['instalment'] = $this->instalment;
}
if(isset($this->handingfee)){
$signData['handingfee'] = $this->handingfee; //手续费(以分为单位,第一位是 D 或 C,表示借、贷)
}
if(isset($this->version)){
$signData['version'] = $this->version; //填写的值为 2 时,交易成功后返回优惠信息
}
if(isset($this->identity)){
$signData['identity'] = $this->identity; //JSON 格式指定付款人信息(格式繁琐,不推荐使用)
}
if(isset($this->patnersettleflag)){
$signData['patnersettleflag'] = $this->patnersettleflag;//资金结算秒到标识(取值:1、2) 1:本次交易正常T1结算,2:本次交易秒到(前提条件:代理需开通白名单、商户需要开通秒到功能)
}
// 移除数组中的空值
$this->retData = ArrayUtil::paraFilter($signData);
}
protected function checkDataParam(){
parent::checkDataParam(); // TODO: Change the autogenerated stub
if(empty($this->notifyurl)){
throw new PayException('支付通知地址不能为空');
}
}
}
<?php
namespace Payment\Common\YSEpay\Data\Charge;
use Payment\Common\PayException;
use Payment\Utils\ArrayUtil;
class PubChargeData extends ChargeBaseData{
/**
* 构建用于支付的签名相关数据
*
* @return void
*/
protected function buildData(){
// TODO: Implement buildData() method.
$this->certainSignData = [
'partner_id' => $this->partner_id,
'method' => $this->method ?? 'ysepay.online.weixin.pay',
'charset' => $this->charset ?? 'utf-8',
'sign_type' => $this->sign_type ?? 'RSA',
'notify_url' => $this->notify_url,
'timestamp' => $this->timestamp ?? date('Y-m-d H:i:s',time()),
'version' => $this->version ?? "3.0",
];
$signData = array_merge($this->certainSignData, []);
$biz_content = [
'out_trade_no' =>$this->out_trade_no,
'shopdate' =>$this->shopdate ?? date('Ymd'),
'subject' =>$this->subject,
'total_amount' =>$this->total_amount,
'seller_id' => $this->seller_id,
'seller_name' => $this->seller_name,
'timeout_express' => $this->timeout_express,
'business_code' => $this->business_code,
'sub_openid' => $this->sub_openid,
'appid' => $this->appid,
'is_minipg' => $this->is_minipg ?? '2', //小程序支付,值为 1,表示小程序支付;不传或值为 2,表示公众账号内支付
'extra_common_param' => $this->extra_common_param ?? '', //公用回传参数
];
$signData['biz_content'] = json_encode(ArrayUtil::paraFilter(ArrayUtil::arraySort($biz_content)),JSON_UNESCAPED_UNICODE);
// 移除数组中的空值
$this->retData = ArrayUtil::paraFilter($signData);
}
protected function checkDataParam(){
parent::checkDataParam(); // TODO: Change the autogenerated stub
if(empty($this->notify_url)){
throw new PayException('支付通知地址不能为空');
}
if(empty($this->sub_openid)){
throw new PayException('用户OPENID 不能为空');
}
if(empty($this->appid)){
throw new PayException('小程序appid 不能为空');
}
}
}
<?php
namespace Payment\Common\YSEpay\Data\Charge;
use Payment\Common\YSpay\Data\YSBaseData;
use Payment\Common\PayException;
use Payment\Utils\ArrayUtil;
class ScanChargeData extends YSEBaseData{
/**
* 构建用于支付的签名相关数据
*
* @return void
*/
protected function buildData(){
// TODO: Implement buildData() method.
$this->certainSignData = [
'channelid' => $this->channelid, //渠道编号
'opt' => $this->opt ?? "scanPay", //操作类型(“scanPay”)
'merid' => $this->merid, //商戶编号
'termid' => $this->termid, //终端编号
'tradetrace' => $this->tradetrace, //商户订单号(控制在 50 位长度以内,确保在请求接口的系统中全局 唯一;可以包含数字与字母;不能包含其他特殊字符)
'tradeamt' => $this->tradeamt, //交易金额(单位:分)
'authcode' => $this->authcode, //扫码支付授权码,设备读取用户微信、支付宝、银联钱包中的条码或 者二维码信息
'body' => $this->body ?? "乐店云支付", //商品或支付单简要描述
];
$signData = array_merge($this->certainSignData, []);
if(isset($this->maintradetype)){ //刷脸类型填写(faceScanPay)
$signData['maintradetype'] = $this->maintradetype;
}
if(isset($this->instalment)){ //支付宝花呗分期
$signData['instalment'] = $this->instalment;
}
if(isset($this->handingfee)){
$signData['handingfee'] = $this->handingfee; //手续费(以分为单位,第一位是 D 或 C,表示借、贷)
}
if(isset($this->version)){
$signData['version'] = $this->version; //填写的值为 2 时,交易成功后返回优惠信息
}
if(isset($this->identity)){
$signData['identity'] = $this->identity; //JSON 格式指定付款人信息(格式繁琐,不推荐使用)
}
if(isset($this->patnersettleflag)){
$signData['patnersettleflag'] = $this->patnersettleflag;//资金结算秒到标识(取值:1、2) 1:本次交易正常T1结算,2:本次交易秒到(前提条件:代理需开通白名单、商户需要开通秒到功能)
}
// 移除数组中的空值
$this->retData = ArrayUtil::paraFilter($signData);
}
protected function checkDataParam(){
parent::checkDataParam(); // TODO: Change the autogenerated stub
if(empty($this->notifyUrl)){
throw new PayException('支付通知地址不能为空');
}
}
}
<?php
namespace Payment\Common\YSEpay\Data\Query;
use Payment\Common\YSEpay\Data\YSEBaseData;
use Payment\Common\PayException;
use Payment\Utils\ArrayUtil;
class ChargeQueryData extends YSEBaseData{
/**
* 构建用于支付的签名相关数据
*
* @return array
*/
protected function buildData(){
// TODO: Implement buildData() method.
$this->certainSignData = [
'partner_id' => $this->partner_id,
'method' => $this->method ?? 'ysepay.online.trade.query',
'charset' => $this->charset ?? 'utf-8',
'sign_type' => $this->sign_type ?? 'RSA',
'notify_url' => $this->notify_url,
'timestamp' => $this->timestamp ?? date('Y-m-d H:i:s',time()),
'version' => $this->version ?? "3.0",
];
$signData = array_merge($this->certainSignData, []);
$biz_content = [
'out_trade_no' =>$this->out_trade_no,
'shopdate' =>$this->shopdate ?? date('Ymd'),
'trade_no' =>$this->trade_no ?? '',
];
$signData['biz_content'] = json_encode(ArrayUtil::paraFilter($biz_content),JSON_UNESCAPED_UNICODE);
// 移除数组中的空值
$this->retData = ArrayUtil::paraFilter($signData);
}
/**
* 检查传入的参数. $reqData是否正确.
*
* @return mixed
* @throws PayException
*/
protected function checkDataParam(){
// TODO: Implement checkDataParam() method.
parent::checkDataParam();
}
}
<?php
namespace Payment\Common\YSEpay\Data;
use Payment\Common\PayException;
use Payment\Utils\ArrayUtil;
class RefundData extends YSEBaseData{
/**
* 构建用于支付的签名相关数据
*
* @return array
*/
protected function buildData(){
// TODO: Implement buildData() method.
$this->certainSignData = [
'partner_id' => $this->partner_id,
'method' => $this->method ?? 'ysepay.online.trade.refund',
'charset' => $this->charset ?? 'utf-8',
'sign_type' => $this->sign_type ?? 'RSA',
'notify_url' => $this->notify_url ?? '',
'timestamp' => $this->timestamp ?? date('Y-m-d H:i:s',time()),
'version' => $this->version ?? "3.0",
];
$signData = array_merge($this->certainSignData, []);
$biz_content = [
'out_trade_no' =>$this->out_trade_no,
'shopdate' =>$this->shopdate ?? date('Ymd'),
'trade_no' =>$this->trade_no ?? '',
'refund_amount' =>$this->refund_amount, //单位:元
'refund_reason' => $this->refund_reason,
'out_request_no' => $this->out_request_no
];
$signData['biz_content'] = json_encode(ArrayUtil::paraFilter($biz_content));
// 移除数组中的空值
$this->retData = ArrayUtil::paraFilter($signData);
}
/**
* 检查传入的参数. $reqData是否正确.
*
* @return mixed
* @throws PayException
*/
protected function checkDataParam(){
// TODO: Implement checkDataParam() method.
parent::checkDataParam();
}
}
<?php
namespace Payment\Common\YSEpay\Data;
use Payment\Common\BaseData;
use Payment\Common\PayException;
abstract class YSEBaseData extends BaseData{
//测试
protected $privateKey = "MIIEpAIBAAKCAQEAtuZdH/xV/r1fhTz1znGYRrYXorZMJH60QUNFY4j050i6nBjagqfjg/DRSj57IT7+nPTf9cqP7+NMS694OlIhI9YiJ2+JcvfpJSDsXk7AyEO3KbvjYPZWKU7d7i6pNGNPXW73EGdEuyD3/DMV1GZZpKIlZN6/O3SiPSepAngyklia+69xBXGugqoWiEsT8UbtJ4YmlUB5rTH9pxCBRi91dZ+4X6aNlcD0gTNWsC4tutpTSkDPl2MkmdKU5yt5KdZJT1hlh/orIfCrlRYrpGrO9eS400zrLv/VH37vGOVKpMSMK44BULAIOJjEzYCu8sKzxz4wqebnAHWFfOFeIOR+iQIDAQABAoIBAHJYGqhAjVKw+eLGdbYW9mhetvAWoAvA2thiQiM0IEfoBCJKt3EvnOGD0JRl83yZcXyW6t0zQkFrDOvUS4nKhsVsvfWBmaCytKNtrdhXy9Zn3z7MJB8eYkd48u5RZZ9G5vs2wGcU6LdEqUSWe3NKeYifhllFmLCG/lbVUKgmlRdAFxv3esFooEso1uSGwgB7f0HJLH10jT1kSUyfAvG35mJ8oYBuN0Hrbgyepo5H7qh3l7YSOAB9yHtTe5GMUPFoexuTGjdun85ydX7YQOO6QjDYTrVfLIQvoGGP/z0IXr13W+jpBpsN3ctvtCoCJgWxKjYk2CRbxdCvE118HtReyPECgYEA3koVhF9cXksqyf6QMb+0yRvKK8Czq4EXjzwVFAX2iZ6OUdLcT73PcuQvVJW+8U0i3awoQPxBye+IoNtWc9UV6vYJ+ELhNIv49evwwc4P7WnRTmC4W8HDvoGuwCM/Xd0ci4fd0ziWSGlAiSheNUfUGWUAyKc/Ksx0/HrmrySwgdcCgYEA0qMQeQCJHmhgOGKn+Sqp3Eip675GaL1msTFSdDghxwLPseVw2D9YpronGmPsJMINiHoE+Y7F0yxGqUL93kgfCZ+Sa7RcEsVW7pxjkmaLB6qmuba/osZoXzARaMlDeu1B0uawDuC2v3oV1HbvCka90WWeqdvKyUvjt+P3W4gTtp8CgYB1jpJwjgoIaBI5/yF83dibHtI9b0zVn5C5FFpFW531S+AST8Rpe4VRSnHpdsQjUtrkhp5HN+EHDWGhSD4hRgiwWOwO2jfFlVzVmbCangJ4WSTzIV1+USvW/ThQrpNdbYkiFXlvshZwNxGFN88SuGjoAS138FMMrFIWEF0dNPcPwwKBgQDO1bS9PRtoMpIZjDbpY018tBW3GhbFjwaiBI609NGmPEp6o5TVpA6HWdBAB9LAnZTwaPEtpVb4cEfKua/Ub/maV4lOHcMz43fjwsm73tmy443oW11+l1mx7t+Jh+itcwDp+gDz+xE4oMeC5G8CJkkKr8DHhr5wQAcScdZZmRvSfQKBgQClcdT5nTzxj3W45YWP9GEeZtUkE4VnT6ZHU5KInbZhNEbxNcEg69Ve6pviadyTjSBetB/Z2OPQPeE7LIlYHmPLjDHCPDqb6D++/6zL8qxlORf2oScKaEQFLnkqR+M2uZxe/D+HABHxAbbOTdJYK6kiokhPLEMAGc//dW6e2a+EqA==";
protected $pubKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtuZdH/xV/r1fhTz1znGYRrYXorZMJH60QUNFY4j050i6nBjagqfjg/DRSj57IT7+nPTf9cqP7+NMS694OlIhI9YiJ2+JcvfpJSDsXk7AyEO3KbvjYPZWKU7d7i6pNGNPXW73EGdEuyD3/DMV1GZZpKIlZN6/O3SiPSepAngyklia+69xBXGugqoWiEsT8UbtJ4YmlUB5rTH9pxCBRi91dZ+4X6aNlcD0gTNWsC4tutpTSkDPl2MkmdKU5yt5KdZJT1hlh/orIfCrlRYrpGrO9eS400zrLv/VH37vGOVKpMSMK44BULAIOJjEzYCu8sKzxz4wqebnAHWFfOFeIOR+iQIDAQAB";
/**
* 签名算法实现 便于后期扩展微信不同的加密方式
*
* @param string $signStr
* @return string
*/
protected function makeSign($signStr){
switch ($this->signType) {
case 'MD5':
$sign = strtoupper(md5($signStr));
break;
case 'RSA':
$sign = $this->genSign($signStr,$this->privateKey);
break;
default:
$sign = '';
}
$this->retData['sign'] = $sign;
return $sign;
// TODO: Implement makeSign() method.
}
//生成 sha1WithRSA 签名
protected function genSign($toSign, $privateKey){
$privateKey = "-----BEGIN RSA PRIVATE KEY-----\n" .
wordwrap($privateKey, 64, "\n", true) .
"\n-----END RSA PRIVATE KEY-----";
$key = openssl_get_privatekey($privateKey);
openssl_sign($toSign, $signature, $key);
openssl_free_key($key);
$sign = base64_encode($signature);
return $sign;
}
//校验 sha1WithRSA 签名
protected function verifySign($data, $sign, $pubKey){
$sign = base64_decode($sign);
$pubKey = "-----BEGIN PUBLIC KEY-----\n" .
wordwrap($pubKey, 64, "\n", true) .
"\n-----END PUBLIC KEY-----";
$key = openssl_pkey_get_public($pubKey);
$result = openssl_verify($data, $sign, $key, OPENSSL_ALGO_SHA1) === 1;
return $result;
}
protected function checkDataParam(){
// TODO: Implement checkDataParam() method.
// 检查订单号是否合法
if (empty($this->out_trade_no) || mb_strlen($this->out_trade_no) > 64) {
throw new PayException('商户系统的订单号不能为空且长度不能超过64位');
}
if (empty($this->partner_id) || empty($this->business_code)) {
throw new PayException('必须提供商户号与业务代码');
}
}
}
<?php
namespace Payment\Common\YSEpay;
use Payment\Common\BaseData;
use Payment\Common\BaseStrategy;
use Payment\Common\YSEConfig;
use Payment\Common\PayException;
use Payment\Utils\ArrayUtil;
use Payment\Utils\Curl;
abstract class YSEBaseStrategy implements BaseStrategy
{
protected $config;
/**
* 支付数据
* @var BaseData $reqData
*/
protected $reqData;
/**
* FuBaseStrategy constructor.
* @param array $config
* @throws PayException
*/
public function __construct(array $config)
{
/* 设置内部字符编码为 UTF-8 */
mb_internal_encoding("UTF-8");
try {
$this->config = new YSEConfig($config);
} catch (PayException $e) {
throw $e;
}
}
/**
* 发送完了请求
* @param $body
* @return mixed
* @throws \Payment\Common\PayException
*/
protected function sendReq($body)
{
$url = $this->getReqUrl();
if (is_null($url)) {
throw new PayException('目前不支持该接口。请联系开发者添加');
}
$method = str_replace('.','_',$body['method']).'_response';
$body['biz_content'] = urlencode($body['biz_content']);
$body['sign'] = urlencode($body['sign']);
$body = ArrayUtil::arraySort($body);
$body = ArrayUtil::createLinkstring($body,false);
$responseTxt = $this->curlPost($body, $url);
// 格式化为数组
$retData = (json_decode($responseTxt, true));
if ($retData[$method]['code'] != '10000') {
throw new PayException('支付平台返回错误提示:' . $retData[$method]['sub_msg']);
}
return $retData[$method];
}
protected function curlPost($body, $url)
{
$curl = new Curl();
return $curl->set([
'CURLOPT_HEADER' => 0
])->request($url,$body);
}
/**
* 处理具体的业务
*
* @param array $data
* @return mixed
* @throws \Payment\Common\PayException
*/
public function handle(array $data)
{
// TODO: Implement handle() method.
$buildClass = $this->getBuildDataClass();
try {
$this->reqData = new $buildClass($this->config, $data);
} catch (PayException $e) {
throw $e;
}
$this->reqData->setSign();
$body = $this->reqData->getData();
$ret = $this->sendReq($body);
// 检查返回的数据是否被篡改
$flag = true;
if (!$flag) {
throw new PayException('返回数据被篡改。请检查网络是否安全!');
}
return $this->retData($ret);
}
/**
* 获取请求地址
* @param null $url
* @return string
*/
protected function getReqUrl($url = null)
{
if (isset($this->config->base_url) && !empty($this->config->base_url)) {
$_pre = $this->config->base_url;
} else {
$_pre = YSEConfig::REQUEST_URL;
}
return $_pre;
}
/**
* 处理微信的返回值并返回给客户端
* @param array $ret
* @return mixed
*
*/
protected function retData(array $ret)
{
return $ret;
}
/**
* 检查微信返回的数据是否被篡改过
*
* @param array $retData
* @return boolean
* @throws \Exception
*/
protected function verifySign(array $retData)
{
$retSign = $retData['sign'];
$values = ArrayUtil::removeKeys($retData, ['sign']);
$values = ArrayUtil::paraFilter($values);
$values = ArrayUtil::arraySort($values);
$signStr = ArrayUtil::createLinkstring($values);
$signStr = str_replace(' ', '', $signStr);
$signStr .= '&key=' . $this->config->key;
switch ($this->config->signType) {
case 'MD5':
$sign = md5($signStr);
break;
case 'HMAC-SHA256':
$sign = hash_hmac('sha256', $signStr, $this->config->key);
break;
default:
$sign = '';
}
// echo $retSign;echo"<br>";
// echo strtoupper($sign);die;
return strtoupper($sign) === $retSign;
}
}
......@@ -24,16 +24,14 @@ class PubChargeData extends ChargeBaseData{
'tradetype' => $this->tradetype ?? "JSAPI", //支付方式
'notifyurl' => $this->notifyurl, //客户端接收支付成功通知的地址
'openid' => $this->openid, //支付宝(买家支付宝用户ID);微信(用户在商户sub_appid下的唯一标识)
'body' => $this->body ?? "乐店云支付", //商品或支付单简要描述
'body' => $this->body ?? "乐店云支付", //商品或支付单简要描述
'version' => 2, //填写的值为 2 时,交易成功后返回优惠信息
];
$signData = array_merge($this->certainSignData, []);
if(isset($this->handingfee)){
$signData['handingfee'] = $this->handingfee; //手续费(以分为单位,第一位是 D 或 C,表示借、贷)
}
if(isset($this->version)){
$signData['version'] = $this->version; //填写的值为 2 时,交易成功后返回优惠信息
}
if(isset($this->identity)){
$signData['identity'] = $this->identity; //JSON 格式指定付款人信息(格式繁琐,不推荐使用)
}
......
......@@ -55,10 +55,10 @@ abstract class YSBaseStrategy implements BaseStrategy
if ($responseTxt['error']) {
throw new PayException('网络发生错误,请稍后再试curl返回码:' . $responseTxt['message']);
}
// 格式化为数组
$retData = (json_decode($responseTxt['body'], true));
if ($retData['resultcode'] != '00') {
// print_r($retData);die;
if ($retData['resultcode'] != '00' && $retData['resultcode'] != 'W6') {
throw new PayException('支付平台返回错误提示:' . $retData['returnmsg']);
}
return $retData;
......@@ -92,9 +92,9 @@ abstract class YSBaseStrategy implements BaseStrategy
$this->reqData->setSign();
$body = $this->reqData->getData();
echo "<pre>";
var_dump(json_encode($body));
echo "</pre>";
// echo "<pre>";
// var_dump(json_encode($body));
// echo "</pre>";
$ret = $this->sendReq($body);
// 检查返回的数据是否被篡改
......
......@@ -34,6 +34,8 @@ final class Config{
const YS_PAY = 'yspay'; //易生支付
const YSE_PAY = 'ysepay'; //盛银支付
const SW_T_PAY = 'swpay_t'; //扫呗支付(3.0)
//========================= 金额问题设置 =======================//
......@@ -246,4 +248,17 @@ final class Config{
const YS_REFUND = 'ys_refund';// 退款
const YS_CANCEL = 'ys_cancel';// 交易撤销,只能撤销当天的交易,全额退款,实时返回退款结果
//=======================银盛支付 相关接口===================//
//支付常量
const YSE_CHARGE = 'yse_charge';// 统一下单
const YSE_REFUND = 'yse_refund';// 退款
const YSE_QUERY = 'yse_query';// 订单查询
const YSE_CHANNEL_PUB = 'yse_pub'; // 公众号支付
const YSE_CHANNEL_LITE = 'yse_lite';// 小程序支付
}
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
<?php
namespace Payment\Notify;
use Payment\Common\YSEConfig;
use Payment\Common\PayException;
use Payment\Config;
use Payment\Utils\ArrayUtil;
class YSENotify extends NotifyStrategy{
/**
* SwNotify constructor.
*
* @param array $config
* @throws PayException
*/
public function __construct(array $config){
parent::__construct($config);
try{
$this->config = new YSEConfig($config);
}catch(PayException $e){
throw $e;
}
}
/**
* 获取移除通知的数据 并进行简单处理(如:格式化为数组)
* 如果获取数据失败,返回false
*
* @return array|false
*/
public function getNotifyData(){
$params = array();
//支持直接读取input流
// $data = @file_get_contents('php://input');
$data = $_POST;
if(!empty($data)){
// $inputArray = json_decode($data, true);
$params = array_merge($params, $data);
}
if(count($params) < 1){//如果参数为空,则不进行处理
return false;
}
return $params;
// TODO: Implement getNotifyData() method.
}
/**
* 检查异步通知的数据是否合法
* 如果检查失败,返回false
*
* @param array $data 由 $this->getNotifyData() 返回的数据
* @return boolean
* @throws \Exception
*/
public function checkNotifyData(array $data){
return $this->verifySign($data);
}
/**
* 检查数据是否被篡改过
*
* @param array $retData
* @return bool
* @throws \Exception
*/
protected function verifySign(array $retData){
$retSign = $retData['sign'];//先不验证加密s
return true;
$data = ArrayUtil::removeKeys($retData, ['sign']);
$values = [
'return_code' => $data['code'],
'return_msg' => $data['msg'],
'out_trade_no' => $data['outTradeNo'],
'transaction_id' => $data['transactionId'],
'pay_type' => $data['payType'],
'total_fee' => $data['totalAmount'],
'user_id' => $data['buyerId'],
'out_transaction_id' => $data['outTransactionId'],
];
$values = ArrayUtil::paraFilter($values);
// $values = ArrayUtil::arraySort($values);
$signStr = ArrayUtil::createLinkstring($values);
switch($this->config->signType){
case 'MD5':
$sign = md5($signStr);
break;
default:
$sign = '';
}
return strtoupper($sign) === strtoupper($retSign);
}
/**
* 向客户端返回必要的数据
*
* @param array $data
* @return void
*/
protected function getRetData(array $data){
// TODO: Implement getRetData() method.
$retData = [
'sign' => $data['sign'],
'notify_type' => $data['notify_type'],
'notify_time' => $data['notify_time'],
'out_trade_no' => $data['out_trade_no'],
'total_amount' => $data['total_amount'] ?? 0,
'trade_no' => $data['trade_no'] ?? '',
'trade_status' => $data['trade_status'],
];
return $retData;
}
/**
* 根据返回结果,回答支付机构。是否回调通知成功
*
* @param boolean $flag 每次返回的bool值
* @param string $msg 通知信息,错误原因
* @return mixed
*/
protected function replyNotify($flag, $msg = 'OK'){
if (! $flag) {
return 'FAIL';
}
return 'SUCCESS';
}
}
......@@ -32,15 +32,12 @@ class YSNotify extends NotifyStrategy{
*/
public function getNotifyData(){
$params = array();
//支持直接读取input流
$data = @file_get_contents('php://input');
if(!empty($data)){
// $inputArray = json_decode($data, true);
parse_str($data,$inputArray);
$inputArray = json_decode($data, true);
$params = array_merge($params, $inputArray);
}
if(count($params) < 1){//如果参数为空,则不进行处理
return false;
}
......@@ -69,7 +66,7 @@ class YSNotify extends NotifyStrategy{
* @throws \Exception
*/
protected function verifySign(array $retData){
$retSign = $retData['sign'];//先不验证加密
$retSign = $retData['sign'];//先不验证加密s
return true;
$data = ArrayUtil::removeKeys($retData, ['sign']);
......@@ -113,7 +110,8 @@ class YSNotify extends NotifyStrategy{
'wxtransactionid' => $data['wxtransactionid'],
'wxtimeend' => $data['wxtimeend'] ?? '',
'wxopenid' => $data['wxopenid'] ?? '',
'channel' => Config::YS_CHARGE
'channel' => Config::YS_CHARGE,
'sign' => $data['sign']
];
if(isset($data['clearamt'])){
$retData['clearamt'] = $data['clearamt'];
......@@ -132,12 +130,9 @@ class YSNotify extends NotifyStrategy{
* @return mixed
*/
protected function replyNotify($flag, $msg = 'OK'){
$return_code ='00';
if (! $flag) {
$return_code ='01';
return 'FAIL';
}
return [
'resultcode' => $return_code
];
return 'SUCCESS';
}
}
......@@ -20,6 +20,7 @@ use Payment\Notify\TLNotify;
use Payment\Notify\WxNotify;
use Payment\Common\PayException;
use Payment\Notify\YSNotify;
use Payment\Notify\YSENotify;
class NotifyContext
{
......@@ -73,6 +74,9 @@ class NotifyContext
case Config::YS_CHARGE:
$this->notify = new YSNotify($config);
break;
case Config::YSE_CHARGE:
$this->notify = new YSENotify($config);
break;
default:
throw new PayException('当前仅支持:ALI_CHARGE WX_CHARGE CMB_CHARGE TL_CHARGE MI_CHARGE SW_CHARGE FU_CHARGE');
}
......
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
<?php
namespace Payment\Query\YSE;
use Payment\Common\YSEConfig;
use Payment\Common\YSEpay\Data\Query\ChargeQueryData;
use Payment\Common\YSEpay\YSEBaseStrategy;
class YSEChargeQuery extends YSEBaseStrategy{
public function getBuildDataClass(){
return ChargeQueryData::class;
}
/**
* 返回
* @param null $url
* @return string
*/
public function getReqUrl($url = null){
return parent::getReqUrl($url ?? YSEConfig::QUERY_URL); // TODO: Change the autogenerated stub
}
}
<?php
namespace Payment\Query\YS;
use Payment\Common\YSConfig;
use Payment\Common\YSpay\Data\Query\RefundQueryData;
use Payment\Common\YSpay\YSBaseStrategy;
class YSRefundQuery extends YSBaseStrategy{
public function getBuildDataClass(){
return RefundQueryData::class;
}
public function getReqUrl($url = null){
return parent::getReqUrl($url ?? YSConfig::REQUEST_URL); // TODO: Change the autogenerated stub
}
}
......@@ -28,6 +28,7 @@ use Payment\Query\Wx\WxPayBankQuery;
use Payment\Query\Wx\WxRefundQuery;
use Payment\Query\Wx\WxTransferQuery;
use Payment\Query\YS\YSChargeQuery;
use Payment\Query\YSE\YSEChargeQuery;
class QueryContext
{
......@@ -109,6 +110,9 @@ class QueryContext
case Config::YS_QUERY://易生支付
$this->query = new YSChargeQuery($config);
break;
case Config::YSE_QUERY://银盛支付
$this->query = new YSEChargeQuery($config);
break;
default:
throw new PayException('当前仅支持:ALI_CHARGE ALI_REFUND WX_CHARGE WX_REFUND WX_TRANSFER WX_PAY_BANK CMB_CHARGE CMB_REFUND TLPAY MI_QUERY SW_QUERY FU_CHARGE FU_REFUND');
}
......
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
<?php
namespace Payment\Refund;
use Payment\Common\YSEConfig;
use Payment\Common\YSEpay\Data\RefundData;
use Payment\Common\YSEpay\YSEBaseStrategy;
class YSERefund extends YSEBaseStrategy{
public function getBuildDataClass(){
return RefundData::class;
}
public function getReqUrl($url = null){
return parent::getReqUrl($url ?? YSEConfig::REFUND_URL); // TODO: Change the autogenerated stub
}
}
File mode changed
......@@ -20,6 +20,7 @@ use Payment\Refund\SwThreeRefund;
use Payment\Refund\TLRefund;
use Payment\Refund\WxRefund;
use Payment\Refund\YSRefund;
use Payment\Refund\YSERefund;
class RefundContext
{
......@@ -73,6 +74,9 @@ class RefundContext
case Config::YS_REFUND:
$this->refund = new YSRefund($config);
break;
case Config::YSE_REFUND:
$this->refund = new YSERefund($config);
break;
default:
throw new PayException('当前仅支持:ALI WEIXIN CMB TL MI SW FU');
}
......
File mode changed
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!