diff --git a/src/adapter/shopyy.adapter.ts b/src/adapter/shopyy.adapter.ts index 1e1af3b..6b373c9 100644 --- a/src/adapter/shopyy.adapter.ts +++ b/src/adapter/shopyy.adapter.ts @@ -244,7 +244,7 @@ export class ShopyyAdapter implements ISiteAdapter { fullname: billing.name || `${item.firstname} ${item.lastname}`.trim(), company: billing.company || '', 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_2: billing.address2 || '', city: billing.city || item.payment_city || '', @@ -275,7 +275,7 @@ export class ShopyyAdapter implements ISiteAdapter { state: shipping.province || item.shipping_zone || '', postcode: shipping.zip || item.shipping_postcode || '', method_title: item.payment_method || '', - phone: shipping.phone || (item as any).telephone || '', + phone: shipping.phone || item.telephone || '', country: shipping.country_name || shipping.country_code || diff --git a/src/service/freightwaves.service.ts b/src/service/freightwaves.service.ts index 10900ef..dfb0ef6 100644 --- a/src/service/freightwaves.service.ts +++ b/src/service/freightwaves.service.ts @@ -172,7 +172,7 @@ export class FreightwavesService { private async sendRequest(url: string, data: any): Promise> { try { // 设置请求头 - 使用太平洋时间 (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 = { 'Content-Type': 'application/json', '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, data - }); - + })) + console.log('Request data:', `${this.config.apiBaseUrl}${url}`, data,headers); // 发送请求 - 临时禁用SSL证书验证以解决UNABLE_TO_VERIFY_LEAF_SIGNATURE错误 const response = await axios.post>( `${this.config.apiBaseUrl}${url}`, @@ -267,7 +267,7 @@ export class FreightwavesService { partner: this.config.partner, }; - const response = await this.sendRequest('/shipService/order/createOrder?apipost_id=0422aa', requestData); + const response = await this.sendRequest('shipService/order/rateTry', requestData); return response.data; } @@ -325,13 +325,13 @@ export class FreightwavesService { // 设置必要的配置 this.setConfig({ appSecret: 'gELCHguGmdTLo!zfihfM91hae8G@9Sz23Mh6pHrt', - apiBaseUrl: 'https://tms.freightwaves.ca', + apiBaseUrl: 'http://tms.freightwaves.ca:8901/', partner: '25072621035200000060' }); // 准备测试数据 const testParams: Omit = { - shipCompany: 'DHL', + shipCompany: '', partnerOrderNumber: `test-order-${Date.now()}`, warehouseId: '25072621035200000060', shipper: { @@ -423,7 +423,7 @@ export class FreightwavesService { // 设置必要的配置 this.setConfig({ appSecret: 'gELCHguGmdTLo!zfihfM91hae8G@9Sz23Mh6pHrt', - apiBaseUrl: 'https://tms.freightwaves.ca', + apiBaseUrl: 'http://freightwaves.ca:8901/shipService/order/rateTry', partner: '25072621035200000060' }); diff --git a/src/service/order.service.ts b/src/service/order.service.ts index adc6b0a..dc363da 100644 --- a/src/service/order.service.ts +++ b/src/service/order.service.ts @@ -2529,7 +2529,7 @@ export class OrderService { 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; @@ -2561,7 +2561,7 @@ export class OrderService { '姓名地址': nameAddress, '邮箱': order.customer_email || '', '号码': phone, - '订单内容': this.removeLastParenthesesContent(orderContent), + '订单内容': orderContent, '盒数': boxCount, '换盒数': exchangeBoxCount, '换货内容': exchangeContent, diff --git a/test-freightwaves.js b/test-freightwaves.js index c41c661..9236bcf 100644 --- a/test-freightwaves.js +++ b/test-freightwaves.js @@ -9,7 +9,7 @@ async function testFreightwavesService() { // Call the test 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('Result:', result);