| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- declare(strict_types=1);
- namespace SixShop\Lakala\Service;
- use SixShop\Lakala\Config;
- use SixShop\Lakala\Enum\UploadFileType;
- use SixShop\Lakala\OpenAPISDK\V2\Api\V2LakalaApi;
- use SixShop\Lakala\OpenAPISDK\V2\Model\V2ModelRequest;
- class MMSService
- {
- private V2LakalaApi $v2LakalaApi;
- public function __construct(Config $config)
- {
- $this->v2LakalaApi = new V2LakalaApi($config->getV2Config());
- }
- /**
- * 卡BIN查询
- *
- * @param string $orderNo 订单编号(便于后续跟踪排查问题及核对报文) 14位年月日时(24小时制)分秒+8位的随机数(不重复)如:2021020112000012345678
- * @param string $cardNo 银行卡号
- * @param string $orgCode 机构代码
- * @param string $version 接口版本号 默认1.0
- * @return void
- */
- public function cardBin(string $orderNo, string $cardNo,string $orgCode = '1', string $version = '1.0')
- {
- $request = new V2ModelRequest();
- $request->setReqData([
- 'version' => $version,
- 'orderNo' => $orderNo,
- 'orgCode' => $orgCode,
- 'cardNo' => $cardNo,
- ]);
- $response = $this->v2LakalaApi->tradeApi('/api/v2/mms/openApi/cardBin', $request);
- if ($response->getRespData()) {
- print_r($response->getRespData());
- } else {
- print_r($response);
- }
- echo $response->getRetCode();
- # 响应头信息
- print_r($response->getHeaders());
- # 响应原文
- echo $response->getOriginalText();
- }
- public function uploadFile(string $orderNo, UploadFileType $attType, string $attExtName, string $data, string $orgCode = '1', string $version = '1.0')
- {
- $request = new V2ModelRequest();
- $attContext = base64_encode($data);
- $request->setReqData([
- 'attContext' => $attContext,
- 'attType' => $attType->value,
- 'attExtName' => $attExtName,
- 'orderNo' => $orderNo,
- 'orgCode' => $orgCode,
- 'version' => $version,
- ]);
- $response = $this->v2LakalaApi->tradeApi('/api/v2/mms/openApi/uploadFile', $request);
- print_r($response);
- echo $response->getRetCode();
- # 响应头信息
- print_r($response->getHeaders());
- # 响应原文
- echo $response->getOriginalText();
- }
- }
|