1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?php
- namespace app\api\controller;
- use app\common\controller\Api;
- require_once '../vendor/autoload.php';
- class Demo extends Api
- {
-
-
-
-
-
- protected $noNeedLogin = ['test', 'test1'];
-
- protected $noNeedRight = ['test2'];
-
- public function test()
- {
- $apiKey = '096a06e94fb1e0a8b015485bb76ef5dd63c167679297e07331a687327bd8b12e';
- $salt = 'LNrFYxOiGhtdHAuJiqqy3wOl1nVwyJn5dfOYkLquFx8j2J6bm2nsplTnpkYuKyo5';
- $hitPayClient = new \HitPay\Client($apiKey, false);
- try {
- $request = new \HitPay\Request\CreatePayment();
- $request->setAmount(66)
- ->setCurrency('SGD');
- $result = $hitPayClient->createPayment($request);
- print_r($result);
- $data = $hitPayClient->getPaymentStatus($result->getId());
- print_r($data);
- $data = $hitPayClient->deletePaymentRequest($data->getId());
- print_r($data);
- } catch (\Exception $e) {
- print_r($e->getMessage());
- }
- }
-
- public function test1()
- {
- $this->success('返回成功', ['action' => 'test1']);
- }
-
- public function test2()
- {
- $this->success('返回成功', ['action' => 'test2']);
- }
-
- public function test3()
- {
- $this->success('返回成功', ['action' => 'test3']);
- }
- }
|