Shipment

Usage

import { mockServer, ShipmentApi } from 'geta-checkout';

const shipmentApi = new ShipmentApi(mockServer.shipmentServices);

shipmentApi.get()
    .then(shipment => console.log('There are', shipment.methods.length, 'methods available.'))

Properties

Name Type Description
methods Array Available shipment methods
selectedMethodId String Example home or null.

Methods

get()

→ shipment or Error

shipmentApi.get()
    .then(console.log)
    .catch(console.error);

set(shipmentId, data)

→ shipment or Error

Shipment methods

PostOffice

Name Type Description
id String postOffice
name String
description String
image Image
price Price
postOffices Array Example: [{id: '1', name: 'City Post Office'}]
selectedPostOfficeId String
selectValue String Example: 0
shipmentApi
    .set('postOffice', { selectedPostOfficeId: '1' })
    .then(console.log)
    .catch(console.error);

Home

Name Type Description
id String home
name String
description String
image Image
price Price
selectValue String Example: 1
shipmentApi
    .set('home')
    .then(console.log)
    .catch(console.error);

Store

Name Type Description
id String store
name String
description String
image Image
price Price Example: Free
stores Array Example: [{id: '1', name: 'City Store'}]
selectedStoreId Price
selectValue String Example: 2
shipmentApi
    .set('store', { selectedStoreId: '1' })
    .then(console.log)
    .catch(console.error);