Compare commits

...

5 Commits

Author SHA1 Message Date
李东云
2a40b3b219 chore(release): 1.5.3 2025-09-04 11:30:35 +08:00
李东云
86f375b18a refactor(PointLogRepo): 优化 getList 方法参数类型
- 将 $type 参数类型从 string 改为 PointType 枚举
- 使用 isset 和 null 合并条件表达式简化代码
2025-09-04 11:30:30 +08:00
李东云
8a70e35de7 refactor(invoice): 重构发票创建流程和积分日志接口
- 移除 CreateInvoiceCmd 中的 uid 字段
- 更新 InvoiceRepo 中的 create 方法,移除 URL 中的 uid
- 修改 PointLogRepo 中的 getList 方法,增加 type 参数并更新 API 调用
- 更新相关测试文件以适应这些变更
2025-09-04 11:28:26 +08:00
李东云
06a198714e chore(release): 1.5.2 2025-09-02 10:25:01 +08:00
李东云
c2358ae19b fix(AccountBalanceRepo): 修复积分余额过期时间解析
- 在 PointsBalance 类中,将 expiredAt 字段的类型从字符串改为 Carbon 对象
- 优化了对 expiredAt 字段的处理逻辑,增加了空值判断
2025-09-02 10:24:48 +08:00
8 changed files with 26 additions and 10 deletions

View File

@@ -1,4 +1,19 @@
# 版本更新日志
### [1.5.3](http://124.126.16.154:8888/singularity/hdk-pay/compare/v1.5.2...v1.5.3) (2025-09-04)
### ♻️ Code Refactoring | 代码重构
* **invoice:** 重构发票创建流程和积分日志接口 ([8a70e35](http://124.126.16.154:8888/singularity/hdk-pay/commit/8a70e35de72d269bbbd0b5e05c3fa4bccdf1878c))
* **PointLogRepo:** 优化 getList 方法参数类型 ([86f375b](http://124.126.16.154:8888/singularity/hdk-pay/commit/86f375b18a0c3213e405b6fcaec20224979dd991))
### [1.5.2](http://124.126.16.154:8888/singularity/hdk-pay/compare/v1.5.1...v1.5.2) (2025-09-02)
### 🐛 Bug Fixes | Bug 修复
* **AccountBalanceRepo:** 修复积分余额过期时间解析 ([c2358ae](http://124.126.16.154:8888/singularity/hdk-pay/commit/c2358ae19b072dc0f84a76949ce748f9ce15da4f))
### [1.5.1](http://124.126.16.154:8888/singularity/hdk-pay/compare/v1.5.0...v1.5.1) (2025-09-01)

View File

@@ -70,5 +70,5 @@
"url": "https://mirrors.aliyun.com/composer/"
}
},
"version": "1.5.1"
"version": "1.5.3"
}

View File

@@ -13,7 +13,6 @@ namespace Singularity\HDK\Pay\Application\Command;
final readonly class CreateInvoiceCmd {
public function __construct(
public string $uid,
public string $caseId,
public bool $setFreqInvAddr,
public string $receiver,

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Singularity\HDK\Pay\Infrastructure\Repository;
use Carbon\Carbon;
use Hyperf\Codec\Json;
use Singularity\HDK\Pay\Domain\Account\Aggregate\Account\AccountBalance;
use Singularity\HDK\Pay\Domain\Account\Aggregate\Account\PointsBalance;
@@ -41,7 +42,7 @@ final class AccountBalanceRepo extends AbstractRepo implements AccountRepoInterf
cost: $pointBalance['cost'],
amount: $pointBalance['amount'],
version: $pointBalance['version'],
expiredAt: $pointBalance['expired_at'],
expiredAt: isset($pointBalance['expired_at']) ? new Carbon($pointBalance['expired_at']): null,
),
array: $result['point_balance'],
),
@@ -63,7 +64,7 @@ final class AccountBalanceRepo extends AbstractRepo implements AccountRepoInterf
cost: $result['cost'],
amount: $result['amount'],
version: $result['version'],
expiredAt: $result['expired_at'],
expiredAt: isset($result['expired_at']) ? new Carbon($result['expired_at']): null,
);
}
}

View File

@@ -22,7 +22,7 @@ final class InvoiceRepo extends AbstractRepo implements InvoiceRepoInterface
public function create(CreateInvoiceCmd $cmd): Invoice
{
$response = $this->requestService->requestPost(
url: "/rpc/v2/account/$cmd->uid/logs/points/$cmd->caseId/invoices",
url: "/rpc/v2/account/logs/points/$cmd->caseId/invoices",
data: [
'set_freq_addr' => $cmd->setFreqInvAddr,
'receiver' => $cmd->receiver,

View File

@@ -14,13 +14,15 @@ namespace Singularity\HDK\Pay\Infrastructure\Repository;
use Carbon\Carbon;
use Hyperf\Codec\Json;
use Singularity\HDK\Pay\Domain\Account\Aggregate\PointLog\PointLog;
use Singularity\HDK\Pay\Domain\Account\Enum\PointType;
use Singularity\HDK\Pay\Domain\Account\Repository\PointLogRepoInterface;
final class PointLogRepo extends AbstractRepo implements PointLogRepoInterface
{
public function getList(string $uid): array
public function getList(string $uid, ?PointType $type = null): array
{
$response = $this->requestService->requestGet(url: "/rpc/v2/account/$uid/logs/points");
$type = isset($type) ? $type->value: 'all';
$response = $this->requestService->requestGet(url: "/rpc/v2/account/$uid/balance/$type/logs");
$content = $response->getBody()->getContents();
$result = Json::decode($content);

View File

@@ -19,7 +19,6 @@ it('should can create invoice', function () {
$invoice = $repo->create(
new CreateInvoiceCmd(
uid: '61dbe752d4caa',
caseId: '68affb136c01d',
setFreqInvAddr: true,
receiver: "dongyun.li@luxcreo.ai",

View File

@@ -29,7 +29,7 @@ test('能够正常创建 Stripe 订单', function () {
service: 1
);
expect($order)->toBeInstanceOf(Order::class);
});
})->skip();
test('能够正常获取 Stripe 配置信息', function () {
/** @var StripeRpc $service */
@@ -40,4 +40,4 @@ test('能够正常获取 Stripe 配置信息', function () {
->toBeInstanceOf(StripeConfiguration::class)
->toHaveKeys(['id', 'pk'])
->and($configures->resolve())->toBeArray();
});
})->skip();