main #61
|
|
@ -244,7 +244,7 @@ export class ShopyyAdapter implements ISiteAdapter {
|
||||||
fullname: billing.name || `${item.firstname} ${item.lastname}`.trim(),
|
fullname: billing.name || `${item.firstname} ${item.lastname}`.trim(),
|
||||||
company: billing.company || '',
|
company: billing.company || '',
|
||||||
email: item.customer_email || item.email || '',
|
email: item.customer_email || item.email || '',
|
||||||
phone: billing.phone || (item as any).telephone || '',
|
phone: billing.phone || item.telephone || '',
|
||||||
address_1: billing.address1 || item.payment_address || '',
|
address_1: billing.address1 || item.payment_address || '',
|
||||||
address_2: billing.address2 || '',
|
address_2: billing.address2 || '',
|
||||||
city: billing.city || item.payment_city || '',
|
city: billing.city || item.payment_city || '',
|
||||||
|
|
@ -275,7 +275,7 @@ export class ShopyyAdapter implements ISiteAdapter {
|
||||||
state: shipping.province || item.shipping_zone || '',
|
state: shipping.province || item.shipping_zone || '',
|
||||||
postcode: shipping.zip || item.shipping_postcode || '',
|
postcode: shipping.zip || item.shipping_postcode || '',
|
||||||
method_title: item.payment_method || '',
|
method_title: item.payment_method || '',
|
||||||
phone: shipping.phone || (item as any).telephone || '',
|
phone: shipping.phone || item.telephone || '',
|
||||||
country:
|
country:
|
||||||
shipping.country_name ||
|
shipping.country_name ||
|
||||||
shipping.country_code ||
|
shipping.country_code ||
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ export class FreightwavesService {
|
||||||
private async sendRequest<T>(url: string, data: any): Promise<FreightwavesResponse<T>> {
|
private async sendRequest<T>(url: string, data: any): Promise<FreightwavesResponse<T>> {
|
||||||
try {
|
try {
|
||||||
// 设置请求头 - 使用太平洋时间 (America/Los_Angeles)
|
// 设置请求头 - 使用太平洋时间 (America/Los_Angeles)
|
||||||
const date = dayjs().tz('America/Los_Angeles').format('YYYY-mm-dd HH:mm:ss');
|
const date = dayjs().tz('America/Los_Angeles').format('YYYY-MM-DD HH:mm:ss');
|
||||||
const headers = {
|
const headers = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'requestDate': date,
|
'requestDate': date,
|
||||||
|
|
@ -180,11 +180,11 @@ export class FreightwavesService {
|
||||||
};
|
};
|
||||||
|
|
||||||
// 记录请求前的详细信息
|
// 记录请求前的详细信息
|
||||||
this.log(`Sending request to: ${this.config.apiBaseUrl}${url}`, {
|
console.log(`Sending request to: ${this.config.apiBaseUrl}${url}`,JSON.stringify({
|
||||||
headers,
|
headers,
|
||||||
data
|
data
|
||||||
});
|
}))
|
||||||
|
console.log('Request data:', `${this.config.apiBaseUrl}${url}`, data,headers);
|
||||||
|
zhuotianyuan marked this conversation as resolved
Outdated
|
|||||||
// 发送请求 - 临时禁用SSL证书验证以解决UNABLE_TO_VERIFY_LEAF_SIGNATURE错误
|
// 发送请求 - 临时禁用SSL证书验证以解决UNABLE_TO_VERIFY_LEAF_SIGNATURE错误
|
||||||
const response = await axios.post<FreightwavesResponse<T>>(
|
const response = await axios.post<FreightwavesResponse<T>>(
|
||||||
`${this.config.apiBaseUrl}${url}`,
|
`${this.config.apiBaseUrl}${url}`,
|
||||||
|
|
@ -267,7 +267,7 @@ export class FreightwavesService {
|
||||||
partner: this.config.partner,
|
partner: this.config.partner,
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await this.sendRequest<CreateOrderResponseData>('/shipService/order/createOrder?apipost_id=0422aa', requestData);
|
const response = await this.sendRequest<CreateOrderResponseData>('shipService/order/rateTry', requestData);
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -325,13 +325,13 @@ export class FreightwavesService {
|
||||||
// 设置必要的配置
|
// 设置必要的配置
|
||||||
this.setConfig({
|
this.setConfig({
|
||||||
appSecret: 'gELCHguGmdTLo!zfihfM91hae8G@9Sz23Mh6pHrt',
|
appSecret: 'gELCHguGmdTLo!zfihfM91hae8G@9Sz23Mh6pHrt',
|
||||||
apiBaseUrl: 'https://tms.freightwaves.ca',
|
apiBaseUrl: 'http://tms.freightwaves.ca:8901/',
|
||||||
partner: '25072621035200000060'
|
partner: '25072621035200000060'
|
||||||
});
|
});
|
||||||
|
|
||||||
// 准备测试数据
|
// 准备测试数据
|
||||||
const testParams: Omit<CreateOrderRequest, 'partner'> = {
|
const testParams: Omit<CreateOrderRequest, 'partner'> = {
|
||||||
shipCompany: 'DHL',
|
shipCompany: '',
|
||||||
partnerOrderNumber: `test-order-${Date.now()}`,
|
partnerOrderNumber: `test-order-${Date.now()}`,
|
||||||
warehouseId: '25072621035200000060',
|
warehouseId: '25072621035200000060',
|
||||||
shipper: {
|
shipper: {
|
||||||
|
|
@ -423,7 +423,7 @@ export class FreightwavesService {
|
||||||
// 设置必要的配置
|
// 设置必要的配置
|
||||||
this.setConfig({
|
this.setConfig({
|
||||||
appSecret: 'gELCHguGmdTLo!zfihfM91hae8G@9Sz23Mh6pHrt',
|
appSecret: 'gELCHguGmdTLo!zfihfM91hae8G@9Sz23Mh6pHrt',
|
||||||
apiBaseUrl: 'https://tms.freightwaves.ca',
|
apiBaseUrl: 'http://freightwaves.ca:8901/shipService/order/rateTry',
|
||||||
partner: '25072621035200000060'
|
partner: '25072621035200000060'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2529,7 +2529,7 @@ export class OrderService {
|
||||||
const boxCount = items.reduce((total, item) => total + item.quantity, 0);
|
const boxCount = items.reduce((total, item) => total + item.quantity, 0);
|
||||||
|
|
||||||
// 构建订单内容
|
// 构建订单内容
|
||||||
const orderContent = items.map(item => `${item.name} (${item.sku || ''}) x ${item.quantity}`).join('; ');
|
const orderContent = items.map(item => `${item.name} x ${item.quantity}`).join('; ');
|
||||||
|
|
||||||
// 构建姓名地址
|
// 构建姓名地址
|
||||||
const shipping = order.shipping;
|
const shipping = order.shipping;
|
||||||
|
|
@ -2561,7 +2561,7 @@ export class OrderService {
|
||||||
'姓名地址': nameAddress,
|
'姓名地址': nameAddress,
|
||||||
'邮箱': order.customer_email || '',
|
'邮箱': order.customer_email || '',
|
||||||
'号码': phone,
|
'号码': phone,
|
||||||
'订单内容': this.removeLastParenthesesContent(orderContent),
|
'订单内容': orderContent,
|
||||||
'盒数': boxCount,
|
'盒数': boxCount,
|
||||||
'换盒数': exchangeBoxCount,
|
'换盒数': exchangeBoxCount,
|
||||||
'换货内容': exchangeContent,
|
'换货内容': exchangeContent,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ async function testFreightwavesService() {
|
||||||
|
|
||||||
// Call the test method
|
// Call the test method
|
||||||
console.log('Starting test for createOrder method...');
|
console.log('Starting test for createOrder method...');
|
||||||
const result = await service.testQueryOrder();
|
const result = await service.testCreateOrder();
|
||||||
|
|
||||||
console.log('Test completed successfully!');
|
console.log('Test completed successfully!');
|
||||||
console.log('Result:', result);
|
console.log('Result:', result);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
删除这些调试时候的日志