| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace mall\controllers;
- use bizMall\shop\classes\ShopClass;
- use common\components\util;
- use Yii;
- use common\components\lakala\Lakala;
- class TestController extends BaseController
- {
- public $guestAccess = ['trade-query'];
- //收银台订单查询 ssh 20231026
- public function actionTradeQuery()
- {
- $shopId = 1;
- $shop = ShopClass::getById($shopId, true);
- if (empty($shop)) {
- util::fail('没有找到订单');
- }
- $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
- $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
- $params = [
- 'appid' => 'OP00002119',
- 'serial_no' => '018b08cfddbd',
- 'merchant_no' => $shop->lklSjNo,
- 'term_no' => $shop->lklScanTermNo,
- 'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
- 'lklCertificatePath' => $lklCertificatePath,
- ];
- $laResource = new Lakala($params);
- $orderSn = 'KD26449727';
- $cashParams = [
- 'out_order_no' => $orderSn,
- ];
- $response = $laResource->cashierQuery($cashParams);
- if (isset($response['code']) == false || $response['code'] != '000000') {
- util::fail('支付失败了');
- }
- print_r($response);
- }
- }
|