mirror of
http://124.126.16.154:8888/singularity/hdk-pay.git
synced 2026-01-15 03:35:06 +08:00
feat(product): 增加 EMA 产品查询功能
- 移除了未使用的 ProductItem 引用 - 修改了 findEmaProduct 方法的参数,从 currentVersion 改为 uid - 更新了 findEmaProduct 方法的实现,使用 uid 参数进行查询 - 重构了 RechargeProduct 对象的构建方式,提高了代码可读性 - 更新了单元测试,增加了 EMA 产品查询的测试用例
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
* Created on 2025/8/18
|
||||
*/
|
||||
|
||||
use Pest\Expectation;
|
||||
use Singularity\HDK\Pay\Domain\Product\Aggregate\Entities\ProductItem;
|
||||
use Singularity\HDK\Pay\Domain\Product\Aggregate\RechargeProduct;
|
||||
use Singularity\HDK\Pay\Infrastructure\Repository\ProductRepo;
|
||||
@@ -18,9 +19,28 @@ it('should can query LuxPoint products', function () {
|
||||
$repo = make(ProductRepo::class);
|
||||
|
||||
$products = $repo->findLuxPointProduct();
|
||||
var_dump($products);
|
||||
expect($products)
|
||||
->toBeInstanceOf(RechargeProduct::class)
|
||||
->and($products->getOneTime())->toBeInstanceOf(ProductItem::class)
|
||||
->and($products->getPackages())->each->toBeInstanceOf(ProductItem::class);
|
||||
});
|
||||
|
||||
it('should can query EMA products', function () {
|
||||
$repo = make(ProductRepo::class);
|
||||
|
||||
$uid = 'cn3321';
|
||||
$products = $repo->findEmaProduct($uid);
|
||||
expect($products)
|
||||
->toBeInstanceOf(RechargeProduct::class)
|
||||
->when(
|
||||
$products->getOneTime() !== null,
|
||||
fn(Expectation $expectation) => $expectation
|
||||
->and($products->getOneTime())->toBeInstanceOf(ProductItem::class),
|
||||
)
|
||||
->when(
|
||||
$products->getRenew() !== null,
|
||||
fn(Expectation $expectation) => $expectation
|
||||
->and($products->getRenew())->toBeInstanceOf(ProductItem::class),
|
||||
)
|
||||
->and($products->getPlans())->each->toBeInstanceOf(ProductItem::class);
|
||||
})->only();
|
||||
|
||||
Reference in New Issue
Block a user