feat(chat): add support action cards and live entitlements
Docker Image / Build and Push Docker Image (push) Successful in 2m2s
Docker Image / Build and Push Docker Image (push) Successful in 2m2s
This commit is contained in:
@@ -9,6 +9,33 @@ import type { PaymentApi } from "@/data/services/api";
|
||||
import { Result } from "@/utils/result";
|
||||
|
||||
describe("PaymentRepository", () => {
|
||||
it("forwards chat action attribution only in the owned order request", async () => {
|
||||
const createOrder = vi.fn().mockResolvedValue({
|
||||
orderId: "pay_xxx",
|
||||
payParams: null,
|
||||
});
|
||||
const repository = new PaymentRepository({
|
||||
createOrder,
|
||||
} as unknown as PaymentApi);
|
||||
|
||||
const result = await repository.createOrder(
|
||||
"vip_monthly",
|
||||
"stripe",
|
||||
true,
|
||||
undefined,
|
||||
undefined,
|
||||
"019c8f8d-17d3-7a42-b1cc-b6927b1927d5",
|
||||
);
|
||||
|
||||
expect(createOrder).toHaveBeenCalledWith({
|
||||
planId: "vip_monthly",
|
||||
payChannel: "stripe",
|
||||
autoRenew: true,
|
||||
chatActionId: "019c8f8d-17d3-7a42-b1cc-b6927b1927d5",
|
||||
});
|
||||
expect(Result.isOk(result)).toBe(true);
|
||||
});
|
||||
|
||||
it("loads a character gift catalog without adapting product metadata", async () => {
|
||||
const catalog = GiftProductsResponseSchema.parse({
|
||||
characterId: "elio",
|
||||
|
||||
@@ -31,6 +31,7 @@ export interface IPaymentRepository {
|
||||
autoRenew: boolean,
|
||||
recipientCharacterId?: string,
|
||||
commercialOfferId?: string,
|
||||
chatActionId?: string,
|
||||
): Promise<Result<CreatePaymentOrderResponse>>;
|
||||
|
||||
/** 查询支付订单状态。 */
|
||||
|
||||
@@ -63,6 +63,7 @@ export class PaymentRepository implements IPaymentRepository {
|
||||
autoRenew: boolean,
|
||||
recipientCharacterId?: string,
|
||||
commercialOfferId?: string,
|
||||
chatActionId?: string,
|
||||
): Promise<Result<CreatePaymentOrderResponse>> {
|
||||
const request = CreatePaymentOrderRequestSchema.parse({
|
||||
planId,
|
||||
@@ -70,6 +71,7 @@ export class PaymentRepository implements IPaymentRepository {
|
||||
autoRenew,
|
||||
...(recipientCharacterId ? { recipientCharacterId } : {}),
|
||||
...(commercialOfferId ? { commercialOfferId } : {}),
|
||||
...(chatActionId ? { chatActionId } : {}),
|
||||
});
|
||||
return Result.wrap(() => this.api.createOrder(request));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user