Commit 3b1c58cf by yeran

feat: update

1 parent 50ae069b
{ {
"name": "ldy/payment", "name": "ldy/payment",
"type": "library", "type": "library",
"version": "3.6.4", "version": "3.6.5",
"description": "支付宝支付、微信支付、招商一网通支付、通联支付、米付支付、利楚扫呗、富友支付、联拓付、易生支付、银盛支付、微诺付、汇收钱 php SDK。", "description": "支付宝支付、微信支付、招商一网通支付、通联支付、米付支付、利楚扫呗、富友支付、联拓付、易生支付、银盛支付、微诺付、汇收钱 php SDK。",
"keywords": ["alipay", "weixin", "支付宝支付", "微信支付","通联支付", "集成支付接口SDK", "招商一网通", "一网通", "利楚扫呗", "富友支付","微诺付","汇收钱"], "keywords": ["alipay", "weixin", "支付宝支付", "微信支付","通联支付", "集成支付接口SDK", "招商一网通", "一网通", "利楚扫呗", "富友支付","微诺付","汇收钱"],
"homepage": "", "homepage": "",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/** /**
* wap网站支付 * wap网站支付
* Created by PhpStorm. * Created by PhpStorm.
* *
* Date: 2017/4/30 * Date: 2017/4/30
* Time: 上午11:31 * Time: 上午11:31
*/ */
...@@ -18,15 +18,12 @@ $aliConfig = require_once __DIR__ . '/../aliconfig.php'; ...@@ -18,15 +18,12 @@ $aliConfig = require_once __DIR__ . '/../aliconfig.php';
// 订单信息 // 订单信息
$orderNo = time() . rand(1000, 9999); $orderNo = time() . rand(1000, 9999);
$payData = [ $payData = [
'body' => 'ali wap pay',
'subject' => '测试支付宝手机网站支付', 'subject' => '测试支付宝手机网站支付',
'order_no' => $orderNo, 'order_no' => $orderNo,
'timeout_express' => time() + 600,// 表示必须 600s 内付款 'timeout_express' => time() + 600,// 表示必须 600s 内付款
'amount' => '0.01',// 单位为元 ,最小为0.01 'amount' => '0.01',// 单位为元 ,最小为0.01
'return_param' => 'tata',// 一定不要传入汉字,只能是 字母 数字组合 'return_param' => 'tata',// 一定不要传入汉字,只能是 字母 数字组合
'client_ip' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1',// 客户地址 'client_ip' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1',// 客户地址
'goods_type' => '1',
'store_id' => '',
]; ];
try { try {
...@@ -36,4 +33,4 @@ try { ...@@ -36,4 +33,4 @@ try {
exit; exit;
} }
header('Location:' . $url); header('Location:' . $url);
\ No newline at end of file
...@@ -19,6 +19,12 @@ ...@@ -19,6 +19,12 @@
* 登录密码 111111 * 登录密码 111111
* 支付密码 111111 * 支付密码 111111
*/ */
//aop->appId = 'your app_id';
//$aop->rsaPrivateKey = '请填写开发者私钥去头去尾去回车,一行字符串';
//$aop->alipayrsaPublicKey='请填写支付宝公钥,一行字符串';
//$aop->apiVersion = '1.0';
//$aop->signType = 'RSA2';
//$aop->postCharset='GBK';
return [ return [
'use_sandbox' => true,// 是否使用沙盒模式 'use_sandbox' => true,// 是否使用沙盒模式
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/** /**
* 微信wap支付 * 微信wap支付
* Created by PhpStorm. * Created by PhpStorm.
* *
* Date: 2017/4/30 * Date: 2017/4/30
* Time: 下午3:40 * Time: 下午3:40
*/ */
...@@ -20,19 +20,20 @@ $wxConfig = require_once __DIR__ . '/../wxconfig.php'; ...@@ -20,19 +20,20 @@ $wxConfig = require_once __DIR__ . '/../wxconfig.php';
$orderNo = time() . rand(1000, 9999); $orderNo = time() . rand(1000, 9999);
// 订单信息 // 订单信息
$payData = [ $payData = [
'body' => 'test body', 'body' => 'test body',
'subject' => 'test subject', 'subject' => 'test subject',
'order_no' => $orderNo, 'order_no' => $orderNo,
'timeout_express' => time() + 600,// 表示必须 600s 内付款 'timeout_express' => time() + 600,// 表示必须 600s 内付款
'amount' => '3.01',// 微信沙箱模式,需要金额固定为3.01 'amount' => '3.01',// 微信沙箱模式,需要金额固定为3.01
'return_param' => '123', 'return_param' => '123',
'client_ip' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1',// 客户地址 'client_ip' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1',// 客户地址
//{"h5_info": {"type":"Wap","wap_url": "https://pay.qq.com","wap_name": "腾讯充值"}} //{"h5_info": {"type":"Wap","wap_url": "https://pay.qq.com","wap_name": "腾讯充值"}}
'scene_info' => [ 'scene_info' => [
'type' => 'Wap',// IOS Android Wap 腾讯建议 IOS ANDROID 采用app支付 'payer_client_ip' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1',// 客户地址,
'wap_url' => 'helei112g.github.io',//自己的 wap 地址 'h5_info' => [
'wap_name' => '测试充值', 'type' => 'Wap' //// IOS Android Wap 腾讯建议 IOS ANDROID 采用app支付
]
], ],
]; ];
...@@ -43,4 +44,4 @@ try { ...@@ -43,4 +44,4 @@ try {
exit; exit;
} }
echo $url; echo $url;
\ No newline at end of file
...@@ -24,7 +24,7 @@ use Payment\Utils\ArrayUtil; ...@@ -24,7 +24,7 @@ use Payment\Utils\ArrayUtil;
* @property string $amount * @property string $amount
* @property string $goods_type * @property string $goods_type
* @property string $return_param * @property string $return_param
* @property string $store_id 商户门店编号 * @property string $store_id 商户门店编号
* *
* @package Payment\Common\Ali\Data\Charge * @package Payment\Common\Ali\Data\Charge
* *
...@@ -40,18 +40,18 @@ abstract class ChargeBaseData extends AliBaseData ...@@ -40,18 +40,18 @@ abstract class ChargeBaseData extends AliBaseData
{ {
$signData = [ $signData = [
// 公共参数 // 公共参数
'app_id' => $this->appId, 'app_id' => $this->appId,
'method' => $this->method, 'method' => $this->method,
'format' => $this->format, 'format' => $this->format,
'return_url' => $this->returnUrl, 'return_url' => $this->returnUrl,
'charset' => $this->charset, 'charset' => $this->charset,
'sign_type' => $this->signType, 'sign_type' => $this->signType,
'timestamp' => $this->timestamp, 'timestamp' => $this->timestamp,
'version' => $this->version, 'version' => $this->version,
'notify_url' => $this->notifyUrl, 'notify_url' => $this->notifyUrl,
// 业务参数 // 业务参数
'biz_content' => $this->getBizContent(), 'biz_content' => $this->getBizContent(),
]; ];
// 移除数组中的空值 // 移除数组中的空值
...@@ -96,16 +96,18 @@ abstract class ChargeBaseData extends AliBaseData ...@@ -96,16 +96,18 @@ abstract class ChargeBaseData extends AliBaseData
} }
// 检查商品类型 // 检查商品类型
if (empty($goodsType)) {// 默认为实物类商品 // if (empty($goodsType)) {// 默认为实物类商品
$this->goods_type = 1; // $this->goods_type = 1;
} elseif (! in_array($goodsType, [0 ,1])) { // } elseif (! in_array($goodsType, [0 ,1])) {
throw new PayException('商品类型可取值为:0-虚拟类商品 1-实物类商品'); // throw new PayException('商品类型可取值为:0-虚拟类商品 1-实物类商品');
} // }
// 返回参数进行urlencode编码 // 返回参数进行urlencode编码
if (! empty($passBack) && ! is_string($passBack)) { if (!empty($passBack)) {
throw new PayException('回传参数必须是字符串'); if (!is_string($passBack)) {
throw new PayException('回传参数必须是字符串');
}
$this->return_param = urlencode($passBack);
} }
$this->return_param = urlencode($passBack);
} }
} }
...@@ -20,24 +20,23 @@ class WapChargeData extends ChargeBaseData ...@@ -20,24 +20,23 @@ class WapChargeData extends ChargeBaseData
protected function getBizContent() protected function getBizContent()
{ {
$content = [ $content = [
'body' => strval($this->body), 'body' => strval($this->body),
'subject' => strval($this->subject), 'subject' => strval($this->subject),
'out_trade_no' => strval($this->order_no), 'out_trade_no' => strval($this->order_no),
'total_amount' => strval($this->amount), 'total_amount' => strval($this->amount),
'seller_id' => $this->partner, // 'seller_id' => $this->partner,
// 销售产品码,商家和支付宝签约的产品码,为固定值QUICK_WAP_PAY // 销售产品码,商家和支付宝签约的产品码,为固定值QUICK_WAP_PAY
'product_code' => 'QUICK_WAP_PAY', 'product_code' => 'QUICK_WAP_PAY',
'goods_type' => $this->goods_type, // 'goods_type' => $this->goods_type,
'passback_params' => $this->return_param, 'passback_params' => $this->return_param,
'disable_pay_channels' => $this->limitPay, // 'disable_pay_channels' => $this->limitPay,
'store_id' => $this->store_id, 'store_id' => $this->store_id,
]; ];
$timeExpire = $this->timeout_express; $timeExpire = $this->timeout_express;
if (! empty($timeExpire)) { if (!empty($timeExpire)) {
$express = floor(($timeExpire - strtotime($this->timestamp)) / 60); $content['time_expire'] = date('Y-m-d H:i:s', $timeExpire * 60 + time());
$express && $content['timeout_express'] = $express . 'm';// 超时时间 统一使用分钟计算
} }
$content = ArrayUtil::paraFilter($content);// 过滤掉空值,下面不用在检查是否为空 $content = ArrayUtil::paraFilter($content);// 过滤掉空值,下面不用在检查是否为空
......
<?php <?php
/** /**
* Created by PhpStorm. * Created by PhpStorm.
* *
* Date: 2017/3/6 * Date: 2017/3/6
* Time: 下午5:45 * Time: 下午5:45
*/ */
...@@ -41,27 +41,33 @@ class WapChargeData extends ChargeBaseData ...@@ -41,27 +41,33 @@ class WapChargeData extends ChargeBaseData
'appid' => trim($this->appId), 'appid' => trim($this->appId),
'mch_id' => trim($this->mchId), 'mch_id' => trim($this->mchId),
'nonce_str' => $this->nonceStr, 'nonce_str' => $this->nonceStr,
'sign_type' => $this->signType,
'fee_type' => $this->feeType,
'notify_url' => $this->notifyUrl, 'notify_url' => $this->notifyUrl,
'trade_type' => $this->tradeType, //设置APP支付 'amount' => $this->amount,
'limit_pay' => $this->limitPay, // 指定不使用信用卡 'out_trade_no' => trim($this->order_no),
'description' => trim($this->subject),
'time_expire' => $this->timeout_express,
'attach' => trim($this->return_param),
'scene_info' => json_encode($sceneInfo),
// 'sign_type' => $this->signType,
// 'fee_type' => $this->feeType,
// 'trade_type' => $this->tradeType, //设置APP支付
// 'limit_pay' => $this->limitPay, // 指定不使用信用卡
// 业务数据 // 业务数据
'device_info' => $this->terminal_id, // 'device_info' => $this->terminal_id,
'body' => trim($this->subject),
//'detail' => json_encode($this->body, JSON_UNESCAPED_UNICODE); //'detail' => json_encode($this->body, JSON_UNESCAPED_UNICODE);
'attach' => trim($this->return_param),
'out_trade_no' => trim($this->order_no),
'total_fee' => $this->amount,
'spbill_create_ip' => trim($this->client_ip),
'time_start' => $this->timeStart,
'time_expire' => $this->timeout_express,
'scene_info' => json_encode($sceneInfo),
// 'spbill_create_ip' => trim($this->client_ip),
// 'time_start' => $this->timeStart,
]; ];
// 移除数组中的空值 // 移除数组中的空值
$this->retData = ArrayUtil::paraFilter($signData); $this->retData = ArrayUtil::paraFilter($signData);
} }
} }
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!