fix(payment): add /api/v1 prefix to PaymentClientService URLs
payment-service uses setGlobalPrefix('api/v1'), so all routes are
under /api/v1/orders, /api/v1/payments, etc. PaymentClientService
was calling /orders directly, resulting in 404:
Cannot POST /orders → 创建订单失败
Fixed all 7 endpoint URLs to include the /api/v1 prefix.
Same pattern as file-service fix (FILE_SERVICE_URL).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
6767215f83
commit
6609e50100
|
|
@ -73,7 +73,7 @@ export class PaymentClientService implements OnModuleInit {
|
|||
conversationId?: string;
|
||||
}): Promise<OrderInfo | null> {
|
||||
try {
|
||||
const response = await fetch(`${this.baseUrl}/orders`, {
|
||||
const response = await fetch(`${this.baseUrl}/api/v1/orders`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
|
@ -110,7 +110,7 @@ export class PaymentClientService implements OnModuleInit {
|
|||
method: string;
|
||||
}): Promise<PaymentResult | null> {
|
||||
try {
|
||||
const response = await fetch(`${this.baseUrl}/payments`, {
|
||||
const response = await fetch(`${this.baseUrl}/api/v1/payments`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
|
|
@ -143,7 +143,7 @@ export class PaymentClientService implements OnModuleInit {
|
|||
): Promise<{ status: string; paidAt?: string } | null> {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${this.baseUrl}/payments/${paymentId}/status`,
|
||||
`${this.baseUrl}/api/v1/payments/${paymentId}/status`,
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
|
|
@ -177,7 +177,7 @@ export class PaymentClientService implements OnModuleInit {
|
|||
} | null> {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${this.baseUrl}/orders/${orderId}/status`,
|
||||
`${this.baseUrl}/api/v1/orders/${orderId}/status`,
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
|
|
@ -205,7 +205,7 @@ export class PaymentClientService implements OnModuleInit {
|
|||
*/
|
||||
async getUserOrders(userId: string): Promise<OrderInfo[]> {
|
||||
try {
|
||||
const response = await fetch(`${this.baseUrl}/orders`, {
|
||||
const response = await fetch(`${this.baseUrl}/api/v1/orders`, {
|
||||
headers: { 'x-user-id': userId },
|
||||
});
|
||||
|
||||
|
|
@ -229,7 +229,7 @@ export class PaymentClientService implements OnModuleInit {
|
|||
*/
|
||||
async getOrderDetail(orderId: string): Promise<OrderInfo | null> {
|
||||
try {
|
||||
const response = await fetch(`${this.baseUrl}/orders/${orderId}`);
|
||||
const response = await fetch(`${this.baseUrl}/api/v1/orders/${orderId}`);
|
||||
|
||||
if (!response.ok) {
|
||||
console.error(
|
||||
|
|
@ -254,7 +254,7 @@ export class PaymentClientService implements OnModuleInit {
|
|||
): Promise<{ orderId: string; status: string } | null> {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${this.baseUrl}/orders/${orderId}/cancel`,
|
||||
`${this.baseUrl}/api/v1/orders/${orderId}/cancel`,
|
||||
{ method: 'POST' },
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue