forked from yansongda/pay
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request yansongda#289 from iwzh/master
支付宝支付服务商模式
- Loading branch information
Showing
8 changed files
with
110 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace Yansongda\Pay\Gateways\Alipay; | ||
|
||
use Yansongda\Pay\Contracts\GatewayInterface; | ||
use Yansongda\Pay\Exceptions\InvalidArgumentException; | ||
use Yansongda\Supports\Collection; | ||
|
||
abstract class Gateway implements GatewayInterface | ||
{ | ||
/** | ||
* Mode. | ||
* | ||
* @var string | ||
*/ | ||
protected $mode; | ||
|
||
/** | ||
* Bootstrap. | ||
* | ||
* @author yansongda <[email protected]> | ||
* | ||
* @throws InvalidArgumentException | ||
*/ | ||
public function __construct() | ||
{ | ||
$this->mode = Support::getInstance()->mode; | ||
} | ||
|
||
/** | ||
* Pay an order. | ||
* | ||
* @author yansongda <[email protected]> | ||
* | ||
* @param string $endpoint | ||
* @param array $payload | ||
* | ||
* @return Collection | ||
*/ | ||
abstract public function pay($endpoint, array $payload); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
use Yansongda\Pay\Events; | ||
use Yansongda\Pay\Exceptions\GatewayException; | ||
use Yansongda\Pay\Exceptions\InvalidArgumentException; | ||
use Yansongda\Pay\Exceptions\InvalidConfigException; | ||
use Yansongda\Pay\Exceptions\InvalidSignException; | ||
use Yansongda\Pay\Gateways\Alipay; | ||
|
@@ -23,6 +24,7 @@ | |
* @property array http http options | ||
* @property string mode current mode | ||
* @property array log log options | ||
* @property string pid ali pid | ||
*/ | ||
class Support | ||
{ | ||
|
@@ -96,6 +98,24 @@ public static function create(Config $config) | |
return self::$instance; | ||
} | ||
|
||
/** | ||
* getInstance. | ||
* | ||
* @author yansongda <[email protected]> | ||
* | ||
* @throws InvalidArgumentException | ||
* | ||
* @return Support | ||
*/ | ||
public static function getInstance() | ||
{ | ||
if (is_null(self::$instance)) { | ||
throw new InvalidArgumentException('You Should [Create] First Before Using'); | ||
} | ||
|
||
return self::$instance; | ||
} | ||
|
||
/** | ||
* clear. | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters