✨ feat(api): Add CheckoutOrder request and response types, and update user purchase request parameters
This commit is contained in:
parent
d10ecc9fdf
commit
dddc21c686
44
CHANGELOG.md
44
CHANGELOG.md
@ -1,48 +1,44 @@
|
|||||||
<a name="readme-top"></a>
|
<a name="readme-top"></a>
|
||||||
|
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
# [1.0.0-beta.28](https://github.com/perfect-panel/ppanel-web/compare/v1.0.0-beta.27...v1.0.0-beta.28) (2025-03-13)
|
# [1.0.0-beta.28](https://github.com/perfect-panel/ppanel-web/compare/v1.0.0-beta.27...v1.0.0-beta.28) (2025-03-13)
|
||||||
|
|
||||||
|
|
||||||
### ✨ Features
|
### ✨ Features
|
||||||
|
|
||||||
* **input**: Add minimum value constraint and enhance number handling in EnhancedInput ([94822d9](https://github.com/perfect-panel/ppanel-web/commit/94822d9))
|
- **input**: Add minimum value constraint and enhance number handling in EnhancedInput ([94822d9](https://github.com/perfect-panel/ppanel-web/commit/94822d9))
|
||||||
|
|
||||||
# [1.0.0-beta.27](https://github.com/perfect-panel/ppanel-web/compare/v1.0.0-beta.26...v1.0.0-beta.27) (2025-03-13)
|
# [1.0.0-beta.27](https://github.com/perfect-panel/ppanel-web/compare/v1.0.0-beta.26...v1.0.0-beta.27) (2025-03-13)
|
||||||
|
|
||||||
|
|
||||||
### ♻ Code Refactoring
|
### ♻ Code Refactoring
|
||||||
|
|
||||||
* **payment**: Reconstruct the payment page ([7109472](https://github.com/perfect-panel/ppanel-web/commit/7109472))
|
- **payment**: Reconstruct the payment page ([7109472](https://github.com/perfect-panel/ppanel-web/commit/7109472))
|
||||||
* Enhance user navigation dropdown ui and styling ([d2732e6](https://github.com/perfect-panel/ppanel-web/commit/d2732e6))
|
- Enhance user navigation dropdown ui and styling ([d2732e6](https://github.com/perfect-panel/ppanel-web/commit/d2732e6))
|
||||||
|
|
||||||
|
|
||||||
### ✨ Features
|
### ✨ Features
|
||||||
|
|
||||||
* **cdn**: Add CDN URL configuration and update related references ([0c90733](https://github.com/perfect-panel/ppanel-web/commit/0c90733))
|
- **cdn**: Add CDN URL configuration and update related references ([0c90733](https://github.com/perfect-panel/ppanel-web/commit/0c90733))
|
||||||
* **payment**: Add bank card payment ([7fa3a57](https://github.com/perfect-panel/ppanel-web/commit/7fa3a57))
|
- **payment**: Add bank card payment ([7fa3a57](https://github.com/perfect-panel/ppanel-web/commit/7fa3a57))
|
||||||
* **subscription**: Improve layout and organization of subscription detail tabs ([e4630f8](https://github.com/perfect-panel/ppanel-web/commit/e4630f8))
|
- **subscription**: Improve layout and organization of subscription detail tabs ([e4630f8](https://github.com/perfect-panel/ppanel-web/commit/e4630f8))
|
||||||
* **subscription**: Refactor subscription handling and update imports for better organization ([2215c7f](https://github.com/perfect-panel/ppanel-web/commit/2215c7f))
|
- **subscription**: Refactor subscription handling and update imports for better organization ([2215c7f](https://github.com/perfect-panel/ppanel-web/commit/2215c7f))
|
||||||
|
|
||||||
|
|
||||||
### 🎫 Chores
|
### 🎫 Chores
|
||||||
|
|
||||||
* **merge**: Bump version to 1.0.0-beta.26 and update changelog ([3222016](https://github.com/perfect-panel/ppanel-web/commit/3222016))
|
- **merge**: Bump version to 1.0.0-beta.26 and update changelog ([3222016](https://github.com/perfect-panel/ppanel-web/commit/3222016))
|
||||||
|
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
* **affiliate**: Update user identifier ([35f92c9](https://github.com/perfect-panel/ppanel-web/commit/35f92c9))
|
- **affiliate**: Update user identifier ([35f92c9](https://github.com/perfect-panel/ppanel-web/commit/35f92c9))
|
||||||
* **changelog**: Update change log style ([cfa3fc0](https://github.com/perfect-panel/ppanel-web/commit/cfa3fc0))
|
- **changelog**: Update change log style ([cfa3fc0](https://github.com/perfect-panel/ppanel-web/commit/cfa3fc0))
|
||||||
* **payment**: Add notification URL field to payment management interface ([5c710e1](https://github.com/perfect-panel/ppanel-web/commit/5c710e1))
|
- **payment**: Add notification URL field to payment management interface ([5c710e1](https://github.com/perfect-panel/ppanel-web/commit/5c710e1))
|
||||||
* **payment**: Fix payment related type definitions and update payment method references ([c3138a8](https://github.com/perfect-panel/ppanel-web/commit/c3138a8))
|
- **payment**: Fix payment related type definitions and update payment method references ([c3138a8](https://github.com/perfect-panel/ppanel-web/commit/c3138a8))
|
||||||
* **payment**: Refactor purchaseCheckout usage and remove redundant code ([a5e2079](https://github.com/perfect-panel/ppanel-web/commit/a5e2079))
|
- **payment**: Refactor purchaseCheckout usage and remove redundant code ([a5e2079](https://github.com/perfect-panel/ppanel-web/commit/a5e2079))
|
||||||
* **payment**: Update checkout type from 'link' to 'url' for consistency ([136a1ab](https://github.com/perfect-panel/ppanel-web/commit/136a1ab))
|
- **payment**: Update checkout type from 'link' to 'url' for consistency ([136a1ab](https://github.com/perfect-panel/ppanel-web/commit/136a1ab))
|
||||||
* **payment**: Update payment information ([70d6a38](https://github.com/perfect-panel/ppanel-web/commit/70d6a38))
|
- **payment**: Update payment information ([70d6a38](https://github.com/perfect-panel/ppanel-web/commit/70d6a38))
|
||||||
* **payment**: Update payment method update logic to include row data ([6752420](https://github.com/perfect-panel/ppanel-web/commit/6752420))
|
- **payment**: Update payment method update logic to include row data ([6752420](https://github.com/perfect-panel/ppanel-web/commit/6752420))
|
||||||
* **purchasing**: Update payment type to lowercase and add optional chaining for discounts ([c06ea49](https://github.com/perfect-panel/ppanel-web/commit/c06ea49))
|
- **purchasing**: Update payment type to lowercase and add optional chaining for discounts ([c06ea49](https://github.com/perfect-panel/ppanel-web/commit/c06ea49))
|
||||||
* **ui**: Improve dashboard layout and enhance button functionality; open checkout URLs in a new tab ([fc0da76](https://github.com/perfect-panel/ppanel-web/commit/fc0da76))
|
- **ui**: Improve dashboard layout and enhance button functionality; open checkout URLs in a new tab ([fc0da76](https://github.com/perfect-panel/ppanel-web/commit/fc0da76))
|
||||||
* **ui**: Multiple display bugs ([f5d8fd3](https://github.com/perfect-panel/ppanel-web/commit/f5d8fd3))
|
- **ui**: Multiple display bugs ([f5d8fd3](https://github.com/perfect-panel/ppanel-web/commit/f5d8fd3))
|
||||||
|
|
||||||
<a name="readme-top"></a>
|
<a name="readme-top"></a>
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
||||||
// API 更新时间:
|
// API 更新时间:
|
||||||
// API 唯一标识:
|
// API 唯一标识:
|
||||||
import * as ads from './ads';
|
import * as ads from './ads';
|
||||||
|
|||||||
16
apps/admin/services/admin/typings.d.ts
vendored
16
apps/admin/services/admin/typings.d.ts
vendored
@ -116,6 +116,17 @@ declare namespace API {
|
|||||||
ids: number[];
|
ids: number[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type CheckoutOrderRequest = {
|
||||||
|
orderNo: string;
|
||||||
|
returnUrl?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type CheckoutOrderResponse = {
|
||||||
|
type: string;
|
||||||
|
checkout_url?: string;
|
||||||
|
stripe?: StripePayment;
|
||||||
|
};
|
||||||
|
|
||||||
type CloseOrderRequest = {
|
type CloseOrderRequest = {
|
||||||
orderNo: string;
|
orderNo: string;
|
||||||
};
|
};
|
||||||
@ -1097,6 +1108,11 @@ declare namespace API {
|
|||||||
total: number;
|
total: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type QueryUserAffiliateListRequest = {
|
||||||
|
page: number;
|
||||||
|
size: number;
|
||||||
|
};
|
||||||
|
|
||||||
type QueryUserAffiliateListResponse = {
|
type QueryUserAffiliateListResponse = {
|
||||||
list: UserAffiliate[];
|
list: UserAffiliate[];
|
||||||
total: number;
|
total: number;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
||||||
// API 更新时间:
|
// API 更新时间:
|
||||||
// API 唯一标识:
|
// API 唯一标识:
|
||||||
import * as auth from './auth';
|
import * as auth from './auth';
|
||||||
|
|||||||
16
apps/admin/services/common/typings.d.ts
vendored
16
apps/admin/services/common/typings.d.ts
vendored
@ -94,6 +94,17 @@ declare namespace API {
|
|||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type CheckoutOrderRequest = {
|
||||||
|
orderNo: string;
|
||||||
|
returnUrl?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type CheckoutOrderResponse = {
|
||||||
|
type: string;
|
||||||
|
checkout_url?: string;
|
||||||
|
stripe?: StripePayment;
|
||||||
|
};
|
||||||
|
|
||||||
type CheckUserParams = {
|
type CheckUserParams = {
|
||||||
email: string;
|
email: string;
|
||||||
};
|
};
|
||||||
@ -496,6 +507,11 @@ declare namespace API {
|
|||||||
total: number;
|
total: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type QueryUserAffiliateListRequest = {
|
||||||
|
page: number;
|
||||||
|
size: number;
|
||||||
|
};
|
||||||
|
|
||||||
type QueryUserAffiliateListResponse = {
|
type QueryUserAffiliateListResponse = {
|
||||||
list: UserAffiliate[];
|
list: UserAffiliate[];
|
||||||
total: number;
|
total: number;
|
||||||
|
|||||||
@ -27,7 +27,7 @@ export default function Content({ subscription }: { subscription?: API.Subscribe
|
|||||||
subscribe_id: 0,
|
subscribe_id: 0,
|
||||||
payment: -1,
|
payment: -1,
|
||||||
coupon: '',
|
coupon: '',
|
||||||
platform: 'email',
|
auth_type: 'email',
|
||||||
identifier: '',
|
identifier: '',
|
||||||
password: '',
|
password: '',
|
||||||
});
|
});
|
||||||
@ -70,12 +70,15 @@ export default function Content({ subscription }: { subscription?: API.Subscribe
|
|||||||
startTransition(async () => {
|
startTransition(async () => {
|
||||||
try {
|
try {
|
||||||
const { data } = await purchase(params);
|
const { data } = await purchase(params);
|
||||||
console.log(data);
|
const { order_no } = data.data!;
|
||||||
const { order_no, check_url, type } = data.data!;
|
|
||||||
if (order_no) {
|
if (order_no) {
|
||||||
if (type === 'link') {
|
localStorage.setItem(
|
||||||
window.location.href = check_url!;
|
order_no,
|
||||||
}
|
JSON.stringify({
|
||||||
|
auth_type: params.auth_type,
|
||||||
|
identifier: params.identifier,
|
||||||
|
}),
|
||||||
|
);
|
||||||
router.push(`/purchasing/order?order_no=${order_no}`);
|
router.push(`/purchasing/order?order_no=${order_no}`);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@ -37,7 +37,10 @@ export default function Page() {
|
|||||||
enabled: enabled,
|
enabled: enabled,
|
||||||
queryKey: ['queryPurchaseOrder', orderNo],
|
queryKey: ['queryPurchaseOrder', orderNo],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const { data } = await queryPurchaseOrder({ order_no: orderNo! });
|
if (!orderNo) return;
|
||||||
|
const params = localStorage.getItem(orderNo);
|
||||||
|
const authParams = params ? JSON.parse(params) : {};
|
||||||
|
const { data } = await queryPurchaseOrder({ order_no: orderNo!, ...authParams });
|
||||||
if (data?.data?.status !== 1) {
|
if (data?.data?.status !== 1) {
|
||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
if (data?.data?.token) {
|
if (data?.data?.token) {
|
||||||
|
|||||||
@ -22,10 +22,11 @@ const PaymentMethods: React.FC<PaymentMethodsProps> = ({ value, onChange, balanc
|
|||||||
queryKey: ['getAvailablePaymentMethods', { balance }],
|
queryKey: ['getAvailablePaymentMethods', { balance }],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const { data } = await getAvailablePaymentMethods();
|
const { data } = await getAvailablePaymentMethods();
|
||||||
const methods = data.data?.list || [];
|
const list = data.data?.list || [];
|
||||||
if (!value && methods[0]?.id) onChange(methods[0]?.id);
|
const methods = balance ? list : list.filter((item) => item.id !== -1);
|
||||||
if (balance) return methods;
|
const defaultMethod = methods.find((item) => item.id)?.id;
|
||||||
return methods.filter((item) => item.id !== -1);
|
if (defaultMethod) onChange(defaultMethod);
|
||||||
|
return methods;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
||||||
// API 更新时间:
|
// API 更新时间:
|
||||||
// API 唯一标识:
|
// API 唯一标识:
|
||||||
import * as auth from './auth';
|
import * as auth from './auth';
|
||||||
|
|||||||
16
apps/user/services/common/typings.d.ts
vendored
16
apps/user/services/common/typings.d.ts
vendored
@ -94,6 +94,17 @@ declare namespace API {
|
|||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type CheckoutOrderRequest = {
|
||||||
|
orderNo: string;
|
||||||
|
returnUrl?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type CheckoutOrderResponse = {
|
||||||
|
type: string;
|
||||||
|
checkout_url?: string;
|
||||||
|
stripe?: StripePayment;
|
||||||
|
};
|
||||||
|
|
||||||
type CheckUserParams = {
|
type CheckUserParams = {
|
||||||
email: string;
|
email: string;
|
||||||
};
|
};
|
||||||
@ -496,6 +507,11 @@ declare namespace API {
|
|||||||
total: number;
|
total: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type QueryUserAffiliateListRequest = {
|
||||||
|
page: number;
|
||||||
|
size: number;
|
||||||
|
};
|
||||||
|
|
||||||
type QueryUserAffiliateListResponse = {
|
type QueryUserAffiliateListResponse = {
|
||||||
list: UserAffiliate[];
|
list: UserAffiliate[];
|
||||||
total: number;
|
total: number;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
||||||
// API 更新时间:
|
// API 更新时间:
|
||||||
// API 唯一标识:
|
// API 唯一标识:
|
||||||
import * as announcement from './announcement';
|
import * as announcement from './announcement';
|
||||||
|
|||||||
6
apps/user/services/user/typings.d.ts
vendored
6
apps/user/services/user/typings.d.ts
vendored
@ -438,8 +438,8 @@ declare namespace API {
|
|||||||
};
|
};
|
||||||
|
|
||||||
type PortalPurchaseRequest = {
|
type PortalPurchaseRequest = {
|
||||||
|
auth_type: string;
|
||||||
identifier: string;
|
identifier: string;
|
||||||
platform: string;
|
|
||||||
password?: string;
|
password?: string;
|
||||||
payment: number;
|
payment: number;
|
||||||
subscribe_id: number;
|
subscribe_id: number;
|
||||||
@ -572,10 +572,14 @@ declare namespace API {
|
|||||||
};
|
};
|
||||||
|
|
||||||
type QueryPurchaseOrderParams = {
|
type QueryPurchaseOrderParams = {
|
||||||
|
auth_type: string;
|
||||||
|
identifier: string;
|
||||||
order_no: string;
|
order_no: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type QueryPurchaseOrderRequest = {
|
type QueryPurchaseOrderRequest = {
|
||||||
|
auth_type: string;
|
||||||
|
identifier: string;
|
||||||
order_no: string;
|
order_no: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user