mirror of
https://gitee.com/yansongda/pay.git
synced 2024-12-02 20:27:45 +08:00
delete
This commit is contained in:
parent
f8b7a377fb
commit
e04f73b727
20
LICENSE
20
LICENSE
@ -1,20 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 闫嵩达
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -1,19 +0,0 @@
|
||||
{
|
||||
"name": "yansongda/pay",
|
||||
"description": "专注 Alipay 和 WeChat 的支付扩展包",
|
||||
"authors": [
|
||||
{
|
||||
"name": "yansongda",
|
||||
"email": "me@yansongda.cn"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.5.9"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Yansongda\\pay\\": "src"
|
||||
}
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
<?php
|
||||
namespace Yansongda\Pay\Contracts;
|
||||
|
||||
/**
|
||||
* Interface GatewayInterface
|
||||
*/
|
||||
interface GatewayInterface
|
||||
{
|
||||
/**
|
||||
* 支付
|
||||
* @author JasonYan <me@yansongda.cn>
|
||||
* @version 2017-07-28
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function pay()
|
||||
|
||||
/**
|
||||
* 验证
|
||||
* @author JasonYan <me@yansongda.cn>
|
||||
* @version 2017-07-28
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function verify()
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yansongda\Pay\Exceptions;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Exception extends \Exception
|
||||
{
|
||||
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yansongda\Pay\Exceptions;
|
||||
|
||||
/**
|
||||
* GatewayException
|
||||
*/
|
||||
class GatewayException extends Exception
|
||||
{
|
||||
/**
|
||||
* [__construct description]
|
||||
* @author JasonYan <me@yansongda.cn>
|
||||
* @version 2017-07-28
|
||||
* @param [type] $message [description]
|
||||
* @param [type] $code [description]
|
||||
*/
|
||||
public function __construct($message, $code)
|
||||
{
|
||||
parent::__construct($message, intval($code));
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yansongda\Pay\Gateways\Alipay;
|
||||
|
||||
/**
|
||||
* 支付宝签名算法
|
||||
*/
|
||||
class Sign
|
||||
{
|
||||
|
||||
|
||||
public function getSignedString($string)
|
||||
{
|
||||
if($this->checkEmpty($this->rsaPrivateKeyFilePath)){
|
||||
$priKey=$this->rsaPrivateKey;
|
||||
$res = "-----BEGIN RSA PRIVATE KEY-----\n" .
|
||||
wordwrap($priKey, 64, "\n", true) .
|
||||
"\n-----END RSA PRIVATE KEY-----";
|
||||
}else {
|
||||
$priKey = file_get_contents($this->rsaPrivateKeyFilePath);
|
||||
$res = openssl_get_privatekey($priKey);
|
||||
}
|
||||
|
||||
($res) or die('您使用的私钥格式错误,请检查RSA私钥配置');
|
||||
|
||||
if ("RSA2" == $signType) {
|
||||
openssl_sign($data, $sign, $res, OPENSSL_ALGO_SHA256);
|
||||
} else {
|
||||
openssl_sign($data, $sign, $res);
|
||||
}
|
||||
|
||||
if(!$this->checkEmpty($this->rsaPrivateKeyFilePath)){
|
||||
openssl_free_key($res);
|
||||
}
|
||||
$sign = base64_encode($sign);
|
||||
return $sign;
|
||||
}
|
||||
|
||||
private function sortString()
|
||||
{
|
||||
# code...
|
||||
}
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yansongda\Pay\Gateways;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class AlipayGateway extends Gateway
|
||||
{
|
||||
const METHOD = 'alipay.trade.page.pay';
|
||||
|
||||
const FORMAT = 'JSON';
|
||||
|
||||
const CHARSET = 'utf-8';
|
||||
|
||||
const SIGN_TYPE = 'RSA2';
|
||||
|
||||
const TIMESTAMP = date('Y-m-d H:i:s');
|
||||
|
||||
const VERSION = '1.0';
|
||||
|
||||
/**
|
||||
* 支付
|
||||
* @author JasonYan <me@yansongda.cn>
|
||||
* @version 2017-07-28
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function pay()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看是否支付宝官方发出
|
||||
* @author JasonYan <me@yansongda.cn>
|
||||
* @version 2017-07-28
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function verify()
|
||||
{
|
||||
# code...
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务参数
|
||||
* @author JasonYan <me@yansongda.cn>
|
||||
* @version 2017-07-28
|
||||
* @return [type] [description]
|
||||
*/
|
||||
private function getBizContent()
|
||||
{
|
||||
# code...
|
||||
}
|
||||
|
||||
/**
|
||||
* 签名
|
||||
* @author JasonYan <me@yansongda.cn>
|
||||
* @version 2017-07-28
|
||||
* @return [type] [description]
|
||||
*/
|
||||
private function sign()
|
||||
{
|
||||
# code...
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
<?php
|
||||
namespace Yansongda\Pay\Gateways;
|
||||
|
||||
use Yansongda\Pay\Support\Config;
|
||||
use Yansongda\Pay\Contracts\GatewayInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class Gateway implements GatewayInterface
|
||||
{
|
||||
/**
|
||||
* [$config description]
|
||||
* @var [type]
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* [__construct description]
|
||||
* @author JasonYan <me@yansongda.cn>
|
||||
* @version 2017-07-28
|
||||
* @param array $config [description]
|
||||
*/
|
||||
public function __construct(array $config)
|
||||
{
|
||||
$this->config = new Config($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
* @author JasonYan <me@yansongda.cn>
|
||||
* @version 2017-07-28
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置配置
|
||||
* @author JasonYan <me@yansongda.cn>
|
||||
* @version 2017-07-28
|
||||
* @param Config $config [description]
|
||||
*/
|
||||
public function setConfig(Config $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
return $this;
|
||||
}
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yansongda\Pay\Gateways;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class WechatGateway extends Gateway
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* 支付
|
||||
* @author JasonYan <me@yansongda.cn>
|
||||
* @version 2017-07-28
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function pay()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看是否支付宝官方发出
|
||||
* @author JasonYan <me@yansongda.cn>
|
||||
* @version 2017-07-28
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function verify()
|
||||
{
|
||||
# code...
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务参数
|
||||
* @author JasonYan <me@yansongda.cn>
|
||||
* @version 2017-07-28
|
||||
* @return [type] [description]
|
||||
*/
|
||||
private function getBizContent()
|
||||
{
|
||||
# code...
|
||||
}
|
||||
|
||||
/**
|
||||
* 签名
|
||||
* @author JasonYan <me@yansongda.cn>
|
||||
* @version 2017-07-28
|
||||
* @return [type] [description]
|
||||
*/
|
||||
private function sign()
|
||||
{
|
||||
# code...
|
||||
}
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yansongda\Pay\Support;
|
||||
|
||||
use ArrayAccess;
|
||||
|
||||
/**
|
||||
* Class Config.
|
||||
*/
|
||||
class Config implements ArrayAccess
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Config constructor.
|
||||
*
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct(array $config = [])
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* get a config
|
||||
* @author JasonYan <me@yansongda.cn>
|
||||
* @version 2017-07-28
|
||||
* @param [type] $key [description]
|
||||
* @param [type] $default [description]
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function get($key, $default = null)
|
||||
{
|
||||
if (is_null($key)) {
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
if (isset($this->config[$key])) {
|
||||
return $this->config[$key];
|
||||
}
|
||||
|
||||
foreach (explode('.', $key) as $segment) {
|
||||
if (! array_key_exists($segment, $this->config)) {
|
||||
return $default;
|
||||
}
|
||||
return $this->config[$segment];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
12
src/pay.php
12
src/pay.php
@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yansongda\Pay;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Pay
|
||||
{
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user