| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- namespace SixShop\Lakala\Service;
- use PHPUnit\Framework\TestCase;
- use SixShop\Lakala\Dto\LocationInfo;
- use SixShop\Lakala\OpenAPISDK\V3\Model\TradePreorderWechaAccBusiFields;
- use SixShop\Lakala\OpenAPISDK\V3\Model\TradePreorderWechaDetail;
- use SixShop\Lakala\OpenAPISDK\V3\Model\TradePreorderWechaGoodsDetail;
- use SixShop\Payment\Enum\NumberBizEnum;
- class TransactionServiceTest extends TestCase
- {
- private TransactionService $transactionService;
- protected function setUp(): void
- {
- $this->transactionService = app(TransactionService::class);
- }
- public function testPreOrder()
- {
- $totalAmount = 500;
- // 微信主扫场景 - 账户端业务信息
- $accBusiFields = new TradePreorderWechaAccBusiFields();
- $accBusiFields->setTimeoutExpress(15);
- $accBusiFields->setSubAppid('wx1308d811d01639eb');
- $accBusiFields->setUserId('oPuRO15wmxv3AwRyEznRfuDLehrk');
- $detail = new TradePreorderWechaDetail();
- $detail->setCostPrice($totalAmount);
- $detail->setReceiptId('');
- $goodsDetail = new TradePreorderWechaGoodsDetail();
- $goodsDetail->setGoodsId('3452234');
- $goodsDetail->setWxpayGoodsId('');
- $goodsDetail->setGoodsName('纯礼 脚臭粉*2+沐浴皂液*1+氨基酸洁面液*1+羊奶皂*6');
- $goodsDetail->setQuantity(1);
- $goodsDetail->setPrice($totalAmount);
- $detail->setGoodsDetail([$goodsDetail]);
- // $accBusiFields->setDetail($detail);
- $response = $this->transactionService->preOrder(
- outTradeNo: generate_number(NumberBizEnum::ORDER_PAY),
- totalAmount: $totalAmount,
- locationInfo: new LocationInfo(requestIP: '183.214.109.50'),
- subject: '测试订单',
- settleType: "1",
- remark: "纯礼 脚臭粉*2+沐浴皂液*1+氨基酸洁面液*1+羊奶皂*6",
- accBusiFields: $accBusiFields,
- );
- dump($response);
- }
- }
|