0.0.9 • Published 9 months ago

visit-lib-api-wrapper-v3 v0.0.9

Weekly downloads
-
License
-
Repository
-
Last release
9 months ago

visit-lib-api-wrapper-v3

Project setup

install
npm install visit-lib-api-wrapper-v3

import
import ProductService from "../../../node_modules/visit-lib-api-wrapper-v3/src/services/ProductService"
import OrderService from "../../../node_modules/visit-lib-api-wrapper-v3/src/services/OrderService"
import BookingsService from "../../../node_modules/visit-lib-api-wrapper-v3/src/services/BookingsService"

*** imported ***
import OrderBookingService from "../../../node_modules/visit-lib-api-wrapper-v3/src/services/OrderBookingService"

fetch data
await ProductService.getProducts({after: 'Put Date', until: 'Put Date', language: 'en', apikey: 'Put Your ApiKey Here'})
this will return customize product list.

calculate price
pass product slots in comma separately
ProductService.calculatePrice([
    {productCode: '', tourId: '', articleCode: '', quantity:[{name: 'ADULT', value: 0}, {name: 'CHILD2', value: 0}, {name: 'CHILD1', value: 0}]},
    {productCode: '', tourId: '', articleCode: '', quantity:[{name: 'ADULT', value: 0}, {name: 'CHILD2', value: 0}, {name: 'CHILD1', value: 0}]}
    ])
this will return total price of that product

ProductService.js

methods
getProducts: return the product list.
calculatePrice: return the total price for product.

OrderBookingService.js

3 main function Create, Update, Delete -> BookingRequest

Create Booking Request:
OrderBookingService.createOrderBookingRequest({language: 'en', apikey: '9AC4296C21B68B3FE8899D4E15D19A8A', quoteId: quoteId, orderId: orderId, body: body})
* mandatory quoteId, body
optional orderId

body Format As Follows :

{
"articles": [
    {
      "productSlotIndex": 1,
      "articleCode": "A40-999-252-002",
      "categoryCode": "ADULT",
      "quantity": 3,
      "complementValues": [
      ],
      "cookie": "null"
    }
  ],
  "participants": [
  ],
  "complementsValues": [
  ],
  "cookie": "null"
}
Get Booking Request:
OrderBookingService.getBookingRequest({bookingId: bookingId, apikey: '9AC4296C21B68B3FE8899D4E15D19A8A'})
* mandatory bookingId
Delete Booking Request:
OrderBookingService.deleteBookingRequest({bookingId: bookingId, apikey: '9AC4296C21B68B3FE8899D4E15D19A8A'})
* mandatory bookingId
Get Price Request:
ProductService.findQuoteAndPrice({productCode: productCode, articles: articels, quotes: quotes, prices: prices})
* mandatory all fields,

productCode
article should be formatted following manner

[{"articleCode":"A40-999-252-002","tourId":"5b5ec9ab1fbc3614c836cc8a:1-1","priceLevel":null,"prices":[]},{"articleCode":"A30-999-231-002","tourId":"5b5ec98f1fbc3614c836c9d7:1-1","priceLevel":null,"prices":[]}]

* if there is a article that without tours, you can simpily input tourId as null

for quotes and prices can get it from getProduct API.
Get Price Request:
For all product search query pass site_id that replace apiKey
Update Customer Information:
OrderService.updateCustomerInfo({site_id: this.inputSiteId, orderId: orderId, customer: customer})

Customer Format:
{
  "type": "company",
  "customerNumber": "string",
  "firstName": "string",
  "lastName": "string",
  "phone": "string",
  "mobile": "string",
  "email": "string",
  "address": {
    "city": "string",
    "state": "string",
    "country": "string",
    "countryCode": "string",
    "streetAddress1": "string",
    "streetAddress2": "string",
    "streetAddress3": "string",
    "postalCode": "string"
  },
  "company": "string",
  "department": "string"
}
0.0.9

9 months ago

0.0.8

10 months ago

0.0.7

12 months ago

0.0.6

12 months ago

0.0.3

1 year ago

0.0.5

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago