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;
|
conversationId?: string;
|
||||||
}): Promise<OrderInfo | null> {
|
}): Promise<OrderInfo | null> {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${this.baseUrl}/orders`, {
|
const response = await fetch(`${this.baseUrl}/api/v1/orders`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
|
@ -110,7 +110,7 @@ export class PaymentClientService implements OnModuleInit {
|
||||||
method: string;
|
method: string;
|
||||||
}): Promise<PaymentResult | null> {
|
}): Promise<PaymentResult | null> {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${this.baseUrl}/payments`, {
|
const response = await fetch(`${this.baseUrl}/api/v1/payments`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|
@ -143,7 +143,7 @@ export class PaymentClientService implements OnModuleInit {
|
||||||
): Promise<{ status: string; paidAt?: string } | null> {
|
): Promise<{ status: string; paidAt?: string } | null> {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${this.baseUrl}/payments/${paymentId}/status`,
|
`${this.baseUrl}/api/v1/payments/${paymentId}/status`,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|
@ -177,7 +177,7 @@ export class PaymentClientService implements OnModuleInit {
|
||||||
} | null> {
|
} | null> {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${this.baseUrl}/orders/${orderId}/status`,
|
`${this.baseUrl}/api/v1/orders/${orderId}/status`,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|
@ -205,7 +205,7 @@ export class PaymentClientService implements OnModuleInit {
|
||||||
*/
|
*/
|
||||||
async getUserOrders(userId: string): Promise<OrderInfo[]> {
|
async getUserOrders(userId: string): Promise<OrderInfo[]> {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${this.baseUrl}/orders`, {
|
const response = await fetch(`${this.baseUrl}/api/v1/orders`, {
|
||||||
headers: { 'x-user-id': userId },
|
headers: { 'x-user-id': userId },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -229,7 +229,7 @@ export class PaymentClientService implements OnModuleInit {
|
||||||
*/
|
*/
|
||||||
async getOrderDetail(orderId: string): Promise<OrderInfo | null> {
|
async getOrderDetail(orderId: string): Promise<OrderInfo | null> {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${this.baseUrl}/orders/${orderId}`);
|
const response = await fetch(`${this.baseUrl}/api/v1/orders/${orderId}`);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error(
|
console.error(
|
||||||
|
|
@ -254,7 +254,7 @@ export class PaymentClientService implements OnModuleInit {
|
||||||
): Promise<{ orderId: string; status: string } | null> {
|
): Promise<{ orderId: string; status: string } | null> {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${this.baseUrl}/orders/${orderId}/cancel`,
|
`${this.baseUrl}/api/v1/orders/${orderId}/cancel`,
|
||||||
{ method: 'POST' },
|
{ method: 'POST' },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue