Skip to content

Commit

Permalink
feat: apt methods
Browse files Browse the repository at this point in the history
  • Loading branch information
myxiaoao committed Apr 16, 2024
1 parent 7bbc8f4 commit 4ad0217
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.1, 8.2]
stability: [prefer-lowest, prefer-stable]
os: [ ubuntu-latest, windows-latest ]
php: [ 8.1, 8.2 ]
stability: [ prefer-lowest, prefer-stable ]

name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}

Expand Down
38 changes: 38 additions & 0 deletions src/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,42 @@ public function sendOrderRefundRequest(

return $this->client->sendRequest('fund/ledger/api/order/refund', $data);
}

/**
* 5.4 分账回退结果查询
*
* @throws GuzzleException
* @throws JsonException
*/
public function sendOrderRefundQueryRequest(
string $mchId,
?string $outReturnNo = null,
?string $returnNo = null,
): array {
$data = $this->client->filterNullValues([
'mch_id' => $mchId,
'return_no' => $returnNo,
'out_return_no' => $outReturnNo,
]);

return $this->client->sendRequest('fund/ledger/api/order/refund/query', $data);
}

/**
* 5.5 交易订单查询
*
* @throws GuzzleException
* @throws JsonException
*/
public function sendOrderTransQueryRequest(
string $mchId,
string $transactionId
): array {
$data = $this->client->filterNullValues([
'mch_id' => $mchId,
'transaction_id' => $transactionId,
]);

return $this->client->sendRequest('fund/ledger/api/order/trans/query', $data);
}
}
6 changes: 6 additions & 0 deletions tests/ApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@
$response = $api->sendOrderSplitQueryRequest(mchId: '849584358120018', orderNo: '61106708379852213248');
expect($response['ret_msg'])->toBe('OK');
});

it('test order trans query', function () {
$api = new Api(PUBLIC_KEY, PRIVATE_KEY, ORG_CODE, true);
$response = $api->sendOrderTransQueryRequest(mchId: '849584358120018', transactionId: '451095914701560505958427');
expect($response['ret_msg'])->toBe('OK');
});

0 comments on commit 4ad0217

Please sign in to comment.