Skip to content

Commit 8660f3d

Browse files
committed
update readme
1 parent e61cc3b commit 8660f3d

File tree

1 file changed

+35
-3
lines changed

1 file changed

+35
-3
lines changed

README.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,25 @@ require_once '/path/to/global-open-sdk-php/init.php';
3030
#### 1 Important note
3131
The SDK mainly shows how to access the alipay gateway, which cannot guarantee the performance and stability.
3232

33-
#### 2 The demo code for create order
33+
#### 2 The demo code for create payment
3434
```
35+
use Request\pay\AlipayPayRequest;
36+
use Client\DefaultAlipayClient;
37+
use Model\Amount;
38+
use Model\Buyer;
39+
use Model\Env;
40+
use Model\Merchant;
41+
use Model\Order;
42+
use Model\OsType;
43+
use Model\PaymentFactor;
44+
use Model\PaymentMethod;
45+
use Model\PresentmentMode;
46+
use Model\ProductCodeType;
47+
use Model\SettlementStrategy;
48+
use Model\Store;
49+
use Model\TerminalType;
50+
use Model\WalletPaymentMethodType;
51+
3552
$request = new AlipayPayRequest();
3653
$paymentRequestId = 'PR_' . round(microtime(true) * 1000);
3754
$order = new Order();
@@ -98,12 +115,27 @@ The execute method contains the HTTP request to the gateway.
98115
If you're concerned about HTTP invocation performance, you can implement HTTP invocation yourself.
99116

100117
```
101-
class YourAlipayClient extends BaseAlipayClient{
118+
class YourAlipayClient extends \Client\BaseAlipayClient{
119+
120+
function __construct()
121+
{
122+
$a = func_get_args();
123+
$i = func_num_args() - 2;
124+
if (method_exists($this, $f = '__construct' . $i)) {
125+
call_user_func_array(array($this, $f), $a);
126+
}
127+
}
102128
103-
function __construct($gatewayUrl, $merchantPrivateKey, $alipayPublicKey) {
129+
function __construct1($gatewayUrl, $merchantPrivateKey, $alipayPublicKey)
130+
{
104131
parent::__construct($gatewayUrl, $merchantPrivateKey, $alipayPublicKey);
105132
}
106133
134+
function __construct2($gatewayUrl, $merchantPrivateKey, $alipayPublicKey, $clientId)
135+
{
136+
parent::__construct($gatewayUrl, $merchantPrivateKey, $alipayPublicKey, $clientId);
137+
}
138+
107139
protected function buildCustomHeader(){
108140
return null;
109141
}

0 commit comments

Comments
 (0)