@@ -1,4 +1,5 @@ | |||
<?php | |||
use addons\config\AliPayConfig; | |||
return array ( | |||
0 => | |||
@@ -38,12 +39,12 @@ return array ( | |||
), | |||
'value' => | |||
array ( | |||
'app_id' => '2021002128652345', | |||
'notify_url' => 'http://internalsales.iicn.co/addons/unishop/pay/notify/type/alipay', | |||
'return_url' => 'http://internalsales.iicn.co/h5/#/pages/order/order?state=0', | |||
'ali_public_key' => 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIjTYv298yvVONMTr/u2szr1iblKq/9dnd8psvKiJEs6KChLA2kpbUmzwPTN+uLqrn5V5YOi7nr/kOE+59fXZ/YKFyH3nPdqoHzvuBCwsaB73ArXR7wByclLgY/C2qOCHWGUi96WTkgUHbx36/ba9hd7v1uZ+SZtUj77E4cX8MgQFJ9v+UAzuwiF+9m7WOQE25JHgQMEIkFA8u9ZuPYnZ8TvwRYKCiDioZi47as2a1n6xBFkSKYYanwYPPw8TCbXcIANjzOZ0cGLdBiL3aG6uPCczNnPDKyO7mkI4JRqYT2XBNLPEVm11eSjeCeoqWsaOCeUVJR3r9Cb76yyqpIXCwIDAQAB', | |||
'private_key' => 'MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCVYKvDfnORWwGReyj/+tbG6HTz0qnEtZQ1Xh+JFPsQzWS90p8bogKk9eqyTux1C3XLVthLmAQ7tuFQnHY9Yn8egen3CVnPmO6Ui+PXvXGXPdRHlkQDorBYJPrW0yWfrPKMvQRKoFTxHj7CyrHK+VI+u+ls8jw73leRXImCUv2tOlUQC8EwQY9Ytsc3sGZiQOavYJ2CfMeBIQtWM5ARPg/67M9l8I84zOkQgJmC7aHfi9DEcz1PbEYpZ5m+9fmVSatPsNSN7ceFwQ0EDPa/p5X9EpPfs+SoGlNu84tgorGUzdr3HjEPNybYN7LJlOGDnVfMqmayMU6drkX+2hrXeprzAgMBAAECggEAO8R4NTotJ2WQVRNALlvA/8kWslAB2VEFwe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gYoaY/lP97aTmKO+7ZAeNWSN0KLLFEMF8fGIRG7V6TARg+saGdCn/AeZucm5ARWfR6MElDhKyjlKWNZoIyzQyGEZclGKzI=', | |||
'log' => '1', | |||
'app_id' => AliPayConfig::getByName('ali_app_id'), | |||
'notify_url' => AliPayConfig::getByName('ali_notify_url'), | |||
'return_url' => AliPayConfig::getByName('ali_return_url'), | |||
'ali_public_key' => AliPayConfig::getByName('ali_public_key'), | |||
'private_key' => AliPayConfig::getByName('ali_private_key'), | |||
'log' => '1', | |||
), | |||
'rule' => 'required', | |||
'msg' => '', | |||
@@ -2,6 +2,7 @@ | |||
namespace Yansongda\Pay\Gateways\Alipay; | |||
use addons\config\AliPayConfig; | |||
use Yansongda\Pay\Contracts\GatewayInterface; | |||
use Yansongda\Pay\Exceptions\GatewayException; | |||
use Yansongda\Pay\Exceptions\InvalidArgumentException; | |||
@@ -53,8 +54,8 @@ abstract class Alipay implements GatewayInterface | |||
'charset' => 'UTF-8', | |||
'sign_type' => 'RSA2', | |||
'version' => '1.0', | |||
'notify_url' => \addons\unishop\model\Config::getByName('ali_notify_url')['value'], | |||
'return_url' => \addons\unishop\model\Config::getByName('ali_return_url')['value'], | |||
'notify_url' => AliPayConfig::getByName('ali_notify_url'), | |||
'return_url' => AliPayConfig::getByName('ali_return_url'), | |||
'timestamp' => date('Y-m-d H:i:s'), | |||
'sign' => '', | |||
'biz_content' => '', | |||
@@ -17,7 +17,8 @@ | |||
namespace addons\nzf; | |||
use addons\unishop\model\Config; | |||
use addons\config\AliPayConfig; | |||
class AliPay | |||
{ | |||
@@ -162,7 +163,7 @@ class AliPay | |||
private static function getSysParams() | |||
{ | |||
//组装系统参数 | |||
$sysParams["app_id"] = Config::getByName('ali_app_id')['value']; | |||
$sysParams["app_id"] = AliPayConfig::getByName('ali_app_id'); | |||
$sysParams["version"] = '1.0'; | |||
$sysParams["format"] = 'json'; | |||
$sysParams["sign_type"] = 'RSA2'; | |||
@@ -170,8 +171,8 @@ class AliPay | |||
$sysParams["timestamp"] = date("Y-m-d H:i:s"); | |||
$sysParams["alipay_sdk"] = 'alipay-sdk-php-20160411'; | |||
$sysParams["prod_code"] = ''; | |||
$sysParams["notify_url"] = Config::getByName('ali_notify_url')['value']; | |||
$sysParams["return_url"] = Config::getByName('ali_return_url')['value']; | |||
$sysParams["notify_url"] = AliPayConfig::getByName('ali_notify_url'); | |||
$sysParams["return_url"] = AliPayConfig::getByName('ali_return_url'); | |||
$sysParams["charset"] = "utf-8"; | |||
return $sysParams; | |||
} | |||
@@ -212,7 +213,7 @@ class AliPay | |||
unset($params['sign']); | |||
} | |||
$content = self::getSignContent($params); | |||
$priKey = Config::getByName('ali_private_key')['value']; | |||
$priKey = AliPayConfig::getByName('ali_private_key'); | |||
// $res = "-----BEGIN RSA PRIVATE KEY-----\n" . | |||
// wordwrap($priKey, 64, "\n", true) . | |||
// "\n-----END RSA PRIVATE KEY-----"; | |||
@@ -9,6 +9,7 @@ | |||
namespace addons\unishop\controller; | |||
use addons\config\AliPayConfig; | |||
use addons\epay\library\Service; | |||
use addons\nzf\AliPay; | |||
use addons\unishop\extend\Ali; | |||
@@ -103,8 +104,8 @@ class Pay extends Base | |||
'orderid' => $order->out_trade_no, | |||
'type' => "wechat", | |||
'title' => $body, | |||
'notifyurl' => Config::getByName('notify_url')['value'], | |||
'returnurl' => Config::getByName('ali_return_url')['value'], | |||
'notifyurl' => AliPayConfig::getByName('notify_url'), | |||
'returnurl' => AliPayConfig::getByName('ali_return_url'), | |||
'trade_type' => $trade_type, | |||
]; | |||
@@ -229,8 +230,8 @@ class Pay extends Base | |||
'orderid' => $order->out_trade_no, | |||
'type' => "alipay", | |||
'title' => $body, | |||
'notifyurl' => Config::getByName('ali_notify_url')['value'], | |||
'returnurl' => Config::getByName('ali_return_url')['value'], | |||
'notify_url' => AliPayConfig::getByName('ali_notify_url'), | |||
'return_url' => AliPayConfig::getByName('ali_return_url'), | |||
'method' => "wap", | |||
]; | |||
@@ -10,7 +10,7 @@ | |||
namespace addons\unishop\extend; | |||
use addons\unishop\model\Config; | |||
use addons\config\AliPayConfig; | |||
use Yansongda\Pay\Pay; | |||
class Ali | |||
@@ -18,12 +18,12 @@ class Ali | |||
public static function initAliPay() | |||
{ | |||
$config = [ | |||
'app_id' => Config::getByName('ali_app_id')['value'], | |||
'notify_url' => Config::getByName('ali_notify_url')['value'], | |||
'return_url' => Config::getByName('ali_return_url')['value'], | |||
'ali_public_key' => Config::getByName('ali_public_key')['value'], | |||
'app_id' => AliPayConfig::getByName('ali_app_id'), | |||
'notify_url' => AliPayConfig::getByName('ali_notify_url'), | |||
'return_url' => AliPayConfig::getByName('ali_return_url'), | |||
'ali_public_key' => AliPayConfig::getByName('ali_public_key'), | |||
// 加密方式: **RSA2** | |||
'private_key' => Config::getByName('ali_private_key')['value'], | |||
'private_key' => AliPayConfig::getByName('ali_private_key'), | |||
// 'log' => [ // optional | |||
// 'file' => './logs/alipay.log', | |||
// 'level' => 'info', // 建议生产环境等级调整为 info,开发环境为 debug | |||
@@ -38,7 +38,7 @@ class Ali | |||
//'mode' => 'dev', // optional,设置此参数,将进入沙箱模式 | |||
]; | |||
if (Config::getByName('ali_sandbox')['value'] == 1) { | |||
if (AliPayConfig::getByName('ali_sandbox') == 1) { | |||
$config['mode'] = 'dev'; | |||
} | |||