@monada-ai/monada-cargofive-integration 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -50,8 +50,12 @@ function Server({ apiKey, serverUri = PRODUCTION_URI, uuidv4 = _uuidv4, now = _n
50
50
  include_imo_charges: false,
51
51
  cargo_details: products.map(p => productToCargoDetails({ product: p })).join(','),
52
52
  departure_date: new Date(dateBegin).toISOString().split('T')[0],
53
+ }
53
54
 
55
+ if (verbose) {
56
+ console.log('[CargoFive] Rates request:', `${baseUrl}/v1/public/rates?${new URLSearchParams(params).toString()}`);
54
57
  }
58
+
55
59
  // Try to search rates by origin/destination
56
60
  const { data: ratesResponse } = await axios.get(
57
61
  `${baseUrl}/v1/public/rates?${new URLSearchParams(params).toString()}`,
@@ -182,8 +186,8 @@ function convertCargofiveRateToMonadaRate({ rate, sourcePort, destinationPort, p
182
186
  cargofiveRate: rate,
183
187
  },
184
188
  product: {
185
- id: productId,
186
189
  ...monadaProduct,
190
+ id: productId,
187
191
  },
188
192
  offer: {
189
193
  validFrom: productPrice.valid_from || null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monada-ai/monada-cargofive-integration",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "All that is needed to integrate CargoFive into monada (server & client code)",
5
5
  "main": "./dist/",
6
6
  "publishConfig": {
@@ -50,8 +50,12 @@ function Server({ apiKey, serverUri = PRODUCTION_URI, uuidv4 = _uuidv4, now = _n
50
50
  include_imo_charges: false,
51
51
  cargo_details: products.map(p => productToCargoDetails({ product: p })).join(','),
52
52
  departure_date: new Date(dateBegin).toISOString().split('T')[0],
53
+ }
53
54
 
55
+ if (verbose) {
56
+ console.log('[CargoFive] Rates request:', `${baseUrl}/v1/public/rates?${new URLSearchParams(params).toString()}`);
54
57
  }
58
+
55
59
  // Try to search rates by origin/destination
56
60
  const { data: ratesResponse } = await axios.get(
57
61
  `${baseUrl}/v1/public/rates?${new URLSearchParams(params).toString()}`,
@@ -182,8 +186,8 @@ function convertCargofiveRateToMonadaRate({ rate, sourcePort, destinationPort, p
182
186
  cargofiveRate: rate,
183
187
  },
184
188
  product: {
185
- id: productId,
186
189
  ...monadaProduct,
190
+ id: productId,
187
191
  },
188
192
  offer: {
189
193
  validFrom: productPrice.valid_from || null,
@@ -13,34 +13,6 @@ function uuidv4() { return '' + id++ };
13
13
  // Increase jest timeout to 10 seconds
14
14
  jest.setTimeout(120000);
15
15
 
16
- // Mock CargoFive API responses
17
- const CARGOFIVE_CONTRACTS_RESPONSE = {
18
- data: [
19
- {
20
- id: 1,
21
- supplier: { name: 'Test Supplier', code: 'TEST' },
22
- validFrom: '2024-01-01',
23
- validUntil: '2024-12-31',
24
- type: 'Contract'
25
- }
26
- ]
27
- };
28
-
29
- const CARGOFIVE_CHARGES_RESPONSE = {
30
- data: [
31
- {
32
- contract_id: 1,
33
- surcharge: {
34
- name: 'Ocean Freight',
35
- application: 'Freight',
36
- amount: 1000,
37
- currency: 'USD',
38
- unit: 'CTR'
39
- }
40
- }
41
- ]
42
- };
43
-
44
16
  const mockServer = setupServer(
45
17
  http.get('http://localhost:9999/api/v1/public/rates', ({ request }) => {
46
18
  if (request.headers.get('x-api-key') !== 'TEST_API_KEY') {