1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PayumTW\Ecpay; |
4
|
|
|
|
5
|
|
|
use Payum\Core\GatewayFactory; |
6
|
|
|
use PayumTW\Ecpay\Action\SyncAction; |
7
|
|
|
use Payum\Core\Bridge\Spl\ArrayObject; |
8
|
|
|
use PayumTW\Ecpay\Action\CancelAction; |
9
|
|
|
use PayumTW\Ecpay\Action\NotifyAction; |
10
|
|
|
use PayumTW\Ecpay\Action\RefundAction; |
11
|
|
|
use PayumTW\Ecpay\Action\StatusLogisticsAction; |
12
|
|
|
use PayumTW\Ecpay\Action\CaptureLogisticsAction; |
13
|
|
|
use PayumTW\Ecpay\Action\Api\CreateTransactionAction; |
14
|
|
|
use PayumTW\Ecpay\Action\Api\GetTransactionDataAction; |
15
|
|
|
use PayumTW\Ecpay\Action\ConvertPaymentLogisticsAction; |
16
|
|
|
|
17
|
|
|
class EcpayLogisticsGatewayFactory extends GatewayFactory |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* {@inheritdoc} |
21
|
|
|
*/ |
22
|
1 |
|
protected function populateConfig(ArrayObject $config) |
23
|
|
|
{ |
24
|
1 |
|
$config->defaults([ |
25
|
1 |
|
'payum.factory_name' => 'ecpay_logistics', |
26
|
1 |
|
'payum.factory_title' => 'Ecpay Logistics', |
27
|
1 |
|
'payum.action.capture' => new CaptureLogisticsAction(), |
28
|
1 |
|
'payum.action.notify' => new NotifyAction(), |
29
|
1 |
|
'payum.action.refund' => new RefundAction(), |
30
|
1 |
|
'payum.action.cancel' => new CancelAction(), |
31
|
1 |
|
'payum.action.sync' => new SyncAction(), |
32
|
1 |
|
'payum.action.status' => new StatusLogisticsAction(), |
33
|
1 |
|
'payum.action.convert_payment' => new ConvertPaymentLogisticsAction(), |
34
|
|
|
|
35
|
1 |
|
'payum.action.api.create_transaction' => new CreateTransactionAction(), |
36
|
1 |
|
'payum.action.api.get_transaction_data' => new GetTransactionDataAction(), |
37
|
1 |
|
]); |
38
|
|
|
|
39
|
|
|
/* |
40
|
|
|
* 會員編號(MerchantID) 2000132(B2C)(Home) 2000933(C2C) |
41
|
|
|
* 登入廠商後台帳號/密碼 StageTest/test1234 LogisticsC2CTest/test1234 |
42
|
|
|
* 廠商後台測試環境 https://vendor-stage.ecpay.com.tw,此網站提供查詢測試的物流訂單相關資訊,也可執行物流訂單建立的功能。 |
43
|
|
|
* 物流介接的 HashKey 5294y06JbISpM5x9 XBERn1YOvpM9nfZc |
44
|
|
|
* 物流介接的 HashIV v77hoKGq4kWxNNIS h1ONHk4P4yqbl5LK |
45
|
|
|
*/ |
46
|
|
|
|
47
|
1 |
View Code Duplication |
if (false == $config['payum.api']) { |
48
|
1 |
|
$config['payum.default_options'] = [ |
49
|
1 |
|
'MerchantID' => '2000132', |
50
|
1 |
|
'HashKey' => '5294y06JbISpM5x9', |
51
|
1 |
|
'HashIV' => 'v77hoKGq4kWxNNIS', |
52
|
1 |
|
'sandbox' => true, |
53
|
|
|
]; |
54
|
|
|
|
55
|
1 |
|
$config->defaults($config['payum.default_options']); |
56
|
1 |
|
$config['payum.required_options'] = ['MerchantID', 'HashKey', 'HashIV']; |
57
|
|
|
|
58
|
1 |
|
$config['payum.api'] = function (ArrayObject $config) { |
59
|
1 |
|
$config->validateNotEmpty($config['payum.required_options']); |
60
|
|
|
|
61
|
1 |
|
return new EcpayLogisticsApi((array) $config, $config['payum.http_client'], $config['httplug.message_factory']); |
62
|
|
|
}; |
63
|
1 |
|
} |
64
|
1 |
|
} |
65
|
|
|
} |
66
|
|
|
|