4.18.0 • Published 5 years ago

atlas-sdk-core v4.18.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

npm downloads MIT licensed Build Status David codecov Commitizen friendly semantic-release

Atlas JavaScript SDK Core

This SDK covers the functionality provided by team Atlas' (aka Distributed Commerce) APIs, namely, Checkout, Guest Checkout, and Catalog APIs.

Those APIs, and in turn this SDK, provide our partners a more streamlined access the Zalando shopping platform to enable our customers to purchase wherever they are.

The purpose of this project is to provide low-level calls to API backend and response models for Zalando Checkout, Guest Checkout, and Catalog APIs in order to allow easily integrate and run Zalando Сheckout in minutes using your own UI solution.

If you want to access the APIs directly we recommend that you take a look at their documentation.

We use Promises a lot :)

Installation

npm install --save atlas-sdk-core es6-promise

On install we're transpiling the code for your convenience. You have access to two files under a lib/ folder, one for using in node and another for browser usages.

Warning

Because we are using Promises you must bring your own ES6 Promise compatible polyfill, e.g. es6-promise.

Local Development

If you want to contribute, please, read our Contributing guidelines first.

In order to start SDK development simply run

npm run tdd

Check existing codebase tests for test examples.

Configuration and Usage

You need to configure Atlas JavaScript SDK Core first and use configured instance variable to interact with AtlasSDK.

In order to configure AtlasSDK manually provide an object with 2 mandatory parameters client_id and sales_channel:

import AtlasSDK from 'atlas-sdk-core';

AtlasSDK.configure({
  client_id: 'CLIENT_ID',
  sales_channel: 'SALES_CHANNEL',
  is_sandbox: true
}).then((sdk) => {
  // sdk instance is ready to use

  sdk.getArticle('AD112B0F6-A11').then((article) => {
    console.log(`Article name: ${article.name}`);
  });
}).catch((error) => {
  console.error(`${error}`);
});

Since we are using Promises you can benefit from await/async:

import AtlasSDK from 'atlas-sdk-core';

const sdk = await AtlasSDK.configure({
  client_id: 'CLIENT_ID',
  sales_channel: 'SALES_CHANNEL'
});
const article = await sdk.getArticle('AD112B0F6-A11');
console.log(`Article name: ${article.name}`);

API Reference

Modules

Classes

Constants

Functions

AtlasSDK

AtlasSDK is a global namespace.

Access: public

AtlasSDK.configure(options) ⇒ Promise.<AtlasSDKClient>

Configure AtlasSDK. This is the main entry point to use the AtlasSDK.

Kind: static method of AtlasSDK
Returns: Promise.<AtlasSDKClient> - a promise resolving with an AtlasSDKClient object
Access: public

ParamTypeDescription
optionsObjectAn object containing configiration data: {String} client_id Client Id of a partner {String} sales_channel Sales Channel assigned for a partner {boolean} is_sandbox Indicates sandbox mode (default false)

Example

const sdk = await AtlasSDK.configure({
  client_id: 'CLIENT_ID',
  sales_channel: 'SALES_CHANNEL',
  is_sandBox: true
});

AtlasSDKClient

AtlasSDK instance returned from AtlasSDK configure method.

Kind: global class

new AtlasSDKClient(config)

Creates an AtlasSDK instance from config provided by config-api

ParamTypeDescription
configObjectconfig from config-api

atlasSDKClient.getLocale() ⇒ String

Returns locale based on sales channel, e.g. 'de_DE'

Kind: instance method of AtlasSDKClient
Returns: String - locale

atlasSDKClient.getLanguage() ⇒ String

Returns language based on sales channel, e.g. 'de'

Kind: instance method of AtlasSDKClient
Returns: String - language

atlasSDKClient.getCountryCode() ⇒ String

Returns country code based on sales channel, e.g. 'DE'

Kind: instance method of AtlasSDKClient
Returns: String - country code

atlasSDKClient.getConfig() ⇒ Object

Returns configuration from config-api

Kind: instance method of AtlasSDKClient
Returns: Object - config

atlasSDKClient.getArticle(sku, options) ⇒ Article

Fetches an article based on a SKU.

Kind: instance method of AtlasSDKClient
Returns: Article - return Article object
Access: public

ParamTypeDescription
skuStringSKU of an article
optionsObjectConfiguration options: media: {String} cdn: 'mosaic01' or 'mosaic02' (default is 'mosaic01') {Array} image_resolutions: request media image with the different resolutions (default 'thumbnail', 'medium', 'large'): 'thumbnail' – width: 78px 'thumbnail_hd' – width: 76px 'small' – width: 135px 'small_hd' – width: 270px 'medium' – width: 300px, height: 400px 'medium_sd' – width: 480px 'medium_hd' – width: 600px, height: 800px 'large' – width: 1100px, height: 1100px 'large_hd' – height: 1650px For example { media: { cdn: 'mosaic02', image_resolutions: 'thumbnail', 'medium' } }

Example

const sdk = await AtlasSDK.configure({
  client_id: 'CLIENT_ID',
  sales_channel: 'SALES_CHANNEL',
  is_sandBox: true,
  lang: 'en'
});
const article = await sdk.getArticle('AD112B0F6-A11', {
   media: {
     image_resolutions: ['thumbnail', 'medium']
   }
});

atlasSDKClient.getArticles(skus, options) ⇒ Array.<Article>

Fetches multiple articles based on SKUs.

Kind: instance method of AtlasSDKClient
Returns: Array.<Article> - return Article[] object
Access: public

ParamTypeDescription
skusStringcomma separated SKUs of multiple articles
optionsObjectConfiguration options: media: {String} cdn: 'mosaic01' or 'mosaic02' (default is 'mosaic01') {Array} image_resolutions: request media image with the different resolutions (default 'thumbnail', 'medium', 'large'): 'thumbnail' – width: 78px 'thumbnail_hd' – width: 76px 'small' – width: 135px 'small_hd' – width: 270px 'medium' – width: 300px, height: 400px 'medium_sd' – width: 480px 'medium_hd' – width: 600px, height: 800px 'large' – width: 1100px, height: 1100px 'large_hd' – height: 1650px For example { media: { cdn: 'mosaic02', image_resolutions: 'thumbnail', 'medium' } }

Example

const sdk = await AtlasSDK.configure({
  client_id: 'CLIENT_ID',
  sales_channel: 'SALES_CHANNEL',
  is_sandBox: true,
  lang: 'en'
});
const articles = await sdk.getArticles('AD112B0F6-A11,SO254C009-K12', {
   media: {
     image_resolutions: ['thumbnail', 'medium']
   }
});

atlasSDKClient.getArticleFamilies(sku, options) ⇒ Array.<ArticleFamily>

Fetches article families based on SKU.

Kind: instance method of AtlasSDKClient
Returns: Array.<ArticleFamily> - return ArticleFamily[] object
Access: public

ParamTypeDescription
skuStringSKU of an article
optionsObjectConfiguration options: media: {String} cdn: 'mosaic01' or 'mosaic02' (default is 'mosaic01') {Array} image_resolutions: request media image with the different resolutions (default 'thumbnail', 'medium', 'large'): 'thumbnail' – width: 78px 'thumbnail_hd' – width: 76px 'small' – width: 135px 'small_hd' – width: 270px 'medium' – width: 300px, height: 400px 'medium_sd' – width: 480px 'medium_hd' – width: 600px, height: 800px 'large' – width: 1100px, height: 1100px 'large_hd' – height: 1650px For example { media: { cdn: 'mosaic02', image_resolutions: 'thumbnail', 'medium' } }

Example

const sdk = await AtlasSDK.configure({
  client_id: 'CLIENT_ID',
  sales_channel: 'SALES_CHANNEL',
  is_sandBox: true,
  lang: 'en'
});
const article = await sdk.getArticleFamilies('AD112B0F6-A11');

atlasSDKClient.getGuestCheckout(checkoutId, token) ⇒ GetCheckoutResponse

Returns the complete details of the checkout: guest checkout object GetCheckoutResponse created using createGuestCheckout. Parameters checkoutId, token should be fetched from redirect URL after payment.

Kind: instance method of AtlasSDKClient
Returns: GetCheckoutResponse - guest checkout object
Access: public

ParamTypeDescription
checkoutIdStringId of guest checkout object
tokenStringToken for checkout completion.

atlasSDKClient.createGuestOrder(checkoutId, token) ⇒ CreateOrderResponse

Creates an order for the guest chekout object based on checkoutId, token.

Kind: instance method of AtlasSDKClient
Returns: CreateOrderResponse - object with order information
Access: public

ParamTypeDescription
checkoutIdStringId of guest checkout object
tokenString

atlasSDKClient.getRecommendations(sku, options) ⇒ Array.<RecommendedArticle>

Fetches recommendations for an article based on a SKU.

Kind: instance method of AtlasSDKClient
Returns: Array.<RecommendedArticle> - return array of RecommendedArticle[] objects
Access: public

ParamTypeDescription
skuStringSKU of an article
optionsObjectConfiguration options: {String} reco_id: UUID for recommendations API {String} tracking_string: (Optional) The first time you call recommendations it's empty. The response will have it then and then you use it for every further call. {String} type: Defines what type of recommendations should be returned. Multiple reco_types can be requested at the same time. In the result there will be no duplicate recommendations. Available values : similar, cross_sell, add_on, more_of_the_same_brand, personalized, most_popular, tag_enabled {String} reco_location: (Optional) Defines which reco location should be used. If not specified, it falls back to the one defined in the config media: {String} cdn: 'mosaic01' or 'mosaic02' (default is 'mosaic01') {Array} image_resolutions: request media image with the different resolutions (default 'thumbnail', 'medium', 'large'): 'thumbnail' – width: 78px 'thumbnail_hd' – width: 76px 'small' – width: 135px 'small_hd' – width: 270px 'medium' – width: 300px, height: 400px 'medium_sd' – width: 480px 'medium_hd' – width: 600px, height: 800px 'large' – width: 1100px, height: 1100px 'large_hd' – height: 1650px {Object} filters: (Optional) receives filter type as key and its value can be {Array} or {String} (default is {}) For example { '-filter_gender': 'FEMALE', 'brand_code': 'AN1', 'N12', 'PU1', } For example { reco_id: 'UUUID', tracking_string: 'SOME_TRACKING_STRING', reco_location: 'some_reco_location', media: { cdn: 'mosaic02', image_resolutions: 'thumbnail', 'medium' }, filters: { '-filter_gender': 'FEMALE' 'brand_code': 'AN1', 'N12', 'PU1', } }

Example

const sdk = await AtlasSDK.configure({
  client_id: 'CLIENT_ID',
  sales_channel: 'SALES_CHANNEL',
  is_sandBox: true
});
const recos = await sdk.getRecommendations('AD112B0F6-A11', {
   reco_id: 'UUID',
   tracking_string: 'TRACK',
   media: {
     cdn: 'mosaic02',
     image_resolutions: ['thumbnail', 'medium']
   },
   filters: {
     '-filter_gender': 'FEMALE'
     'brand_code': ['AN1', 'N12', 'PU1'],
   }
});

atlasSDKClient.createGuestCheckout(json) ⇒ CreateOrderRedirectResponse

Creates guest checkout object with payload.

Kind: instance method of AtlasSDKClient
Returns: CreateOrderRedirectResponse - response containing redirectURL that should be used to go to the payment.
Access: public

ParamTypeDescription
jsonObjectJSON payload

atlasSDKClient.getCheckoutCustomer(token) ⇒ CheckoutCustomer

Returns customer object CheckoutCustomer. Parameters customer token needed to fetch customer object.

Kind: instance method of AtlasSDKClient
Returns: CheckoutCustomer - customer object
Access: public

ParamTypeDescription
tokenStringcustomer OAuth2 token

atlasSDKClient.getCheckoutAddresses(token) ⇒ CheckoutAddress

Returns customer addresses CheckoutAddress. Parameters customer token needed to fetch customer object.

Kind: instance method of AtlasSDKClient
Returns: CheckoutAddress - CheckoutAddress array
Access: public

ParamTypeDescription
tokenStringcustomer OAuth2 token

atlasSDKClient.getCheckoutCarts(token, headers) ⇒ CartsResponse

Returns a customer's cart(s)

Kind: instance method of AtlasSDKClient
Returns: CartsResponse - - carts

ParamTypeDescription
tokenString
headersObjectadditional headers that will override the default ones

atlasSDKClient.createCheckoutCart(json, token, options) ⇒ CartResponse

Creates Zalando customer cart

Kind: instance method of AtlasSDKClient
Returns: CartResponse - - customer cart

ParamTypeDescription
jsonCreateCartRequestcart to create
tokenStringcustomer OAuth2 token
optionsObjectadditional headers, rawResponse that will override the default ones

atlasSDKClient.getCheckoutCart(cartId, token) ⇒ CartResponse

Returns a cart by id

Kind: instance method of AtlasSDKClient
Returns: CartResponse - - cart

ParamTypeDescription
cartIdStringcart ID to get
tokenString

atlasSDKClient.putCheckoutcart(json, cartId, token, headers) ⇒ CartResponse

Updates existing cart by id

Kind: instance method of AtlasSDKClient
Returns: CartResponse - - updated cart

ParamTypeDescription
jsonCreateCartRequestcart object to update a cart with
cartIdStringid of the cart to be updated
tokenString
headersObjectadditional headers that will override the default ones

PickupPoint

Kind: global class

new PickupPoint(name, id, memberId)

ParamTypeDescription
nameStringname of the pick up point
idStringid of the pickup point
memberIdStringmember id of the pickpup point

AddressSchema

Baseclass for Address model

Kind: global class

new AddressSchema(email, gender, firstName, lastName, street, zip, city, countryCode, pickupPoint)

ParamTypeDescription
emailStringemail of a customer.
genderStringgender of the customer (FEMALE / MALE)
firstNameStringfirst name of the customer
lastNameStringlast name of the customer
streetStringstreet of the address
zipStringzip code of the address
cityStringcity of the address
countryCodeStringcountry of the address
pickupPointPickupPointpickup point of the address (Optional because only valid in shipping addresses)

CheckoutAddressSchema

Baseclass for CheckoutAddress model

Kind: global class

new CheckoutAddressSchema(customerNumber, email, gender, firstName, lastName, street, zip, city, countryCode, pickupPoint, defaultBilling, defaultShipping)

ParamTypeDescription
customerNumberStringcustomer number
emailStringemail of a customer.
genderStringgender of the customer (FEMALE / MALE)
firstNameStringfirst name of the customer
lastNameStringlast name of the customer
streetStringstreet of the address
zipStringzip code of the address
cityStringcity of the address
countryCodeStringcountry of the address
pickupPointPickupPointpickup point of the address (Optional because only valid in shipping addresses)
defaultBillingBooleanis this address the default billing address
defaultShippingBooleanis this address the default shipping address

NormalizedAddress

Baseclass for NormalizedAddress model

Kind: global class

new NormalizedAddress(street, zip, city, countryCode)

ParamTypeDescription
streetStringstreet of the address
zipStringzip code of the address
cityStringcity of the address
countryCodeStringcountry of the address

CheckedAddress

Baseclass for CheckedAddress model

Kind: global class

new CheckedAddress(status, normalizedAddress)

ParamTypeDescription
statusStringstatus of the address check
normalizedAddressNormalizedAddressthe normalized address

Brand

Class for Brand model.

Kind: global class

new Brand(name)

ParamTypeDescription
nameStringname of brand.

Partner

Class for Partner model.

Kind: global class

new Partner(id, name, detailURL)

ParamTypeDescription
idStringid of partner.
nameStringname of partner.
detailURLStringURL of partner.

PriceSchema

Class for Article Unit Price model.

Kind: global class

new PriceSchema(amount, currency)

ParamTypeDescription
amountnumberamount of price.
currencyStringcurrency of price.

Unit

Class for Article Unit model.

Kind: global class

new Unit(id, size, price, originalPrice, available, stock, partner, media)

ParamTypeDescription
idStringid of article.
sizeStringsize of article.
pricePriceprice of article.
originalPricePriceprice of article.
availablebooleanwhether the unit is available or not.
stocknumber
partnerPartner
mediaMedia

Attribute

Class for Article Unit Attribute model.

Kind: global class

new Attribute(name, category, subCategory, values)

ParamTypeDescription
nameStringname of attribute.
categoryStringcategory of attribute.
subCategoryStringsub-category of attribute.
valuesArray.<String>values of attribute.

EnrichmentAttribute

Class for Article Unit EnrichmentAttribute model.

Kind: global class

new EnrichmentAttribute(key, value)

ParamTypeDescription
keyStringname of enrichment attribute.
valueArray.<String>values of enrichment attribute.

TargetGroups

Class for TargetGroups model.

Kind: global class

new TargetGroups(gender, age, domain, ageRange)

ParamTypeDescription
genderArray.<String>The targeted gender group. Can be FEMALE or MALE. Unisex articles will have both.
ageArray.<String>The targeted age group. Current values are: ADULT, BABY, KID, TEEN
domainArray.<String>The target domain. Can be: DEFAULT, GREEN, LIFESTYLE, MATERNITY, PREMIUM, OVERSIZE, SPORTS
ageRangeArray.<String>Current values: Under 20, 20-29, 30-39, 40-49, Over 50

ArticleImage

Class for ArticleImage model.

Kind: global class

new ArticleImage(order, catalog, catalogHD, detail, detailHD, large, largeHD)

ParamTypeDescription
orderNumberorder number of image used for sorting.
catalogStringURL of catalog image.
catalogHDStringURL of HD catalog image.
detailStringURL of details image.
detailHDStringURL of HD details image.
largeStringURL of large image.
largeHDStringURL of HD large image.

Media

Class for Media model.

Kind: global class

new Media(images)

ParamTypeDescription
imagesArticleImagearray of images.

Item

Class for CartItem model

Kind: global class

new Item(sku, quantity)

ParamTypeDescription
skuStringSKU of item.
quantityNumberQuantity of item.

ItemWithPrice

Class for CartItem model

Kind: global class

new ItemWithPrice(sku, configSku, quantity, price)

ParamTypeDescription
skuStringSKU of item.
configSkuStringConfig SKU of the item.
quantityNumberQuantity of item.
pricePricepirce of the item

Payment

Class for Payment model

Kind: global class

new Payment(method, selectionPageUrl, metadata)

ParamTypeDescription
methodStringPayment Method type.
selectionPageUrlStringURL of the payment selection page.
metadataObjectMetadata for payment.

new Payment(selected, selectionPageUrl)

ParamTypeDescription
selectedSelectedPaymentthe selected payment.
selectionPageUrlStringURL of the payment selection page.

Delivery

Class for Delivery model'

Kind: global class

new Delivery(service, cost, earliest, latest, options)

ParamTypeDescription
serviceStringthe delivery service.
costPricethe delivery cost.
earliestStringDelivery earliest date.
latestStringDelivery latest date.
optionsArray.<String>the delivery options.

ReviewRatingDistribution

Class for ReviewRatingDistribution.

Kind: global class

new ReviewRatingDistribution(count)

ParamTypeDescription
level.String
countNumbercount of reviews distribution.

ReviewRating

Class for ReviewRating.

Kind: global class

new ReviewRating(average, distribution)

ParamTypeDescription
averageNumberaverage rating of Article reviews.
distributionReviewRatingDistributiondistribution of reviews.

ReviewRecommendations

Class for ReviewRecommendations.

Kind: global class

new ReviewRecommendations(total, positive)

ParamTypeDescription
totalNumbertotal number of Article reviews.
positiveNumbernumber of positive reviews.

ReviewSummary

Class for ReviewSummary.

Kind: global class

new ReviewSummary(total, rating, recommendations)

ParamTypeDescription
totalNumbertotal number of Article reviews.
ratingReviewRatingaverage rating of Article review.
recommendationsReviewRecommendationsrecommendations of Article review.

ReviewEntry

Class for ReviewEntry.

Kind: global class

new ReviewEntry(name, title, description, rating, recommends, created)

ParamTypeDescription
nameStringname of Article reviewer.
titleStringtitle of Article review.
descriptionStringdescription of Article review.
ratingNumberrating of Article review.
recommendsBooleanboolean if the reviewer recommends or not.
createdStringcreated timestamp of Article review.

Reviews

Class for Article Reviews.

Kind: global class

new Reviews(summary, entries)

ParamTypeDescription
summaryReviewSummarysummary of Article review.
entriesArray.<ReviewEntry>entries of Article review.

Image

Class for Image model.

Kind: global class

new Image(type, mediaCharacter, resolutions)

ParamTypeDescription
typeStringType of the media item, e.g. 'IMAGE', 'IMAGE_360'
mediaCharacterStringMedia Character descriptor with meta information about image, for example 'MODEL' image that indicates that this media item contains model image URL.
resolutionsObjectRequested resolutions of the media item.

Video

Class for Video model.

Kind: global class

new Video(type, mediaCharacter, url)

ParamTypeDescription
typeStringType of the media item, e.g. 'VIDEO', 'VIDEO_HD', 'VIDEO_THUMBNAIL', 'VIDEO_SMALL'
mediaCharacterStringMedia Character descriptor with meta information about video, for example 'MODEL' image that indicates that this media item contains model image URL.
urlStringAn absolute URL to the image

Article

Class for Article model

Kind: global class

new Article(id, name, color, silhouetteCode, supplierColor, productGroup, detailUrl, brand, units, images, videos, attributes, enrichmentAttributes, targetGroups, infos, review)

ParamTypeDescription
idStringid of the article.
nameStringname of the article.
colorStringcolor of the article.
silhouetteCodeStringsilhouette code of the article.
supplierColorStringcolor of the article from supplier.
productGroupStringproduct group of the article.
detailUrlStringproduct detail url of the article.
brandBrandbrand of the article.
unitsArray.<Unit>size, price and stock availability from the article.
imagesArray.<Image>Array of article images.
videosArray.<Video>Array of article videos.
attributesArray.<Attribute>characteristics of the article.
enrichmentAttributesArray.<EnrichmentAttributes>variable generic attributes.
targetGroupsTargetGroupsthe targeted groups of the article.
infosArray.<String>generic article description.
reviewArray.<Reviews>article reviews.

ArticleFamily

Class for ArticleFamily model

Kind: global class

new ArticleFamily(id, color, supplierColor, lowestPrice, images)

ParamTypeDescription
idStringid of the article.
colorStringcolor of the article.
supplierColorStringcolor of the article from supplier.
lowestPricePricelowestPrice of article.
imagesArray.<Image>Array of article images.

DiscountSchema

Class for Discount model

Kind: global class

new DiscountSchema(grossTotal, taxTotal)

ParamTypeDescription
grossTotalPricegross total of the discount.
taxTotalPricetax total of the discount.

CheckoutCouponDiscount

Class for Checkout Discount model

Kind: global class

new CheckoutCouponDiscount(remaining, gross, tax)

ParamTypeDescription
remainingPriceremaining amount.
grossPricegross total of the discount.
taxPricetax total of the discount.

DeliveryRequest

Class for Delivery Request model

Kind: global class

new DeliveryRequest(service)

ParamTypeDescription
serviceStringthe delivery service.

CreateCartRequest

Class for Cart Request model

Kind: global class

new CreateCartRequest(items)

ParamTypeDescription
itemsItemsa list of items.

SelectedPayment

Class for Selected Payment model

Kind: global class

new SelectedPayment(method, metadata, externalPayment)

ParamTypeDescription
methodStringPayment Method type.
metadataObjectMetadata for payment.
externalPaymentBooleanis an external payment provider used.

Payment

Class for Payment model

Kind: global class

new Payment(method, selectionPageUrl, metadata)

ParamTypeDescription
methodStringPayment Method type.
selectionPageUrlStringURL of the payment selection page.
metadataObjectMetadata for payment.

new Payment(selected, selectionPageUrl)

ParamTypeDescription
selectedSelectedPaymentthe selected payment.
selectionPageUrlStringURL of the payment selection page.

CheckoutCouponDetails

Class for Checkout Coupon Details model

Kind: global class

new CheckoutCouponDetails(coupon, warning, error, discount)

ParamTypeDescription
couponStringthe coupon.
warningStringwarnings regardings coupons.
errorStringerrors regardings coupons.
discountCheckoutCouponDiscountthe discount.

CartResponse

Class for Cart Response model

Kind: global class

new CartResponse(id, items, itemsOutOfStock, delivery, grossTotal, taxTotal, totalDiscount)

ParamTypeDescription
idStringthe response id.
itemsItemWithPricethe items with price.
itemsOutOfStockStringa list of items that are out of stock.
deliveryDeliverythe delivery information.
grossTotalPricethe gross total.
taxTotalPricethe tax total.
totalDiscountDiscountSchemathe total discount.

CartsResponse

Class for Carts Response model

Kind: global class

new CartsResponse(id, carts)

ParamTypeDescription
idStringthe response id.
cartsArray.<CartResponse>the requested carts.

CreateCheckoutRequest

Class for Checkout Request model

Kind: global class

new CreateCheckoutRequest(id, billingAddressId, billingAddress, shippingAddressId, shippingAddress, delivery, coupons)

ParamTypeDescription
idStringthe cart id.
billingAddressIdStringthe id of the billing address.
billingAddressAddressthe billing address.
shippingAddressIdStringthe id of the shipping address.
shippingAddressAddressthe shipping address.
deliveryDeliveryRequestthe desired delivery type.
couponsStringa coupon.

CheckoutResponse

Class for Checkout Response model

Kind: global class

new CheckoutResponse(id, customerNumber, cartId, billingAddress, shippingAddress, delivery, couponDetails, payment)

ParamTypeDescription
idStringthe response id.
customerNumberStringthe customer number.
cartIdStringthe id of the cart id.
billingAddressAddressthe billing address.
shippingAddressAddressthe shipping address.
deliveryDeliverythe delivery information.
couponDetailsCheckoutCouponDetailsthe coupon details.
paymentPaymentthe payment selection.

PutCheckoutRequest

Class for Put Checkout Request model

Kind: global class

new PutCheckoutRequest(billingAddressId, billingAddress, shippingAddressId, shippingAddress, delivery, coupons)

ParamTypeDescription
billingAddressIdStringthe id of the billing address.
billingAddressAddressthe billing address.
shippingAddressIdStringthe id of the shipping address.
shippingAddressAddressthe shipping address.
deliveryDeliveryRequestthe desired delivery type.
couponsStringa coupon.

CheckoutOrderRequest

Class for Checkout Order Request model

Kind: global class

new CheckoutOrderRequest(checkoutId)

ParamTypeDescription
checkoutIdStringthe id of the checkout.

SalesChannel

SalesChannel class struct

Kind: global class

new SalesChannel(source)

ParamTypeDescription
sourceObjectInitialisation object for SalesChannel

Recommendations

Recommendations class struct

Kind: global class

new Recommendations(source)

ParamTypeDescription
sourceObjectInitialisation object for Recommendations

Config

Config class struct

Kind: global class

new Config(source)

ParamTypeDescription
sourceObjectInitialisation object for Config

Example

const source = {
  catalog_api_url: 'https://catalog_api.com/api',
  checkout_api_url: 'https://checkout_api.com/api',
  oauth2_provider_url: 'https://oauth2_provider.com/api',
  sales_channel: {
    locale: 'de_DE',
    channel: '11111111-1111-1111-1111-111111111111',
    toc_url: 'https://m.zalando.de/agb/'
  },
  recommendations: {
    location: 'my_app_pdp',
    type: 'similar',
    channel: 'myapp'
  }
};

const config = new Config(source);

GuestCustomer

Class for Guest Customer model

Kind: global class

new GuestCustomer(email, subscribeNewsletter)

ParamTypeDescription
emailStringthe id of the billing address.
subscribeNewsletterBooleansubscribe to the newsletter.

CheckoutCustomer

Class for Guest Customer model

Kind: global class

new CheckoutCustomer(customerNumber, customerHash, gender, firstName, lastName, email)

ParamTypeDescription
customerNumberStringthe customer number.
customerHashStringthe customer hash.
genderStringthe gender.
firstNameStringthe first name.
lastNameStringthe last name.
emailStringthe email address.

Cart

Cart

Kind: global class

new Cart(items, itemsOutOfStock, grossTotal, taxTotal)

Class for Cart model

ParamTypeDescription
itemsArray.<Item>Array of CartItem.
itemsOutOfStockArray.<String>Array of simple SKUs for CartItems which are out of stock.
grossTotalPriceGross Total Price.
taxTotalPriceTax Total Price.

CreateOrderRequest

Class for CreateOrderRequest model

Kind: global class

new CreateOrderRequest(customer, billingAddress, shippingAddress, cart, payment)

ParamTypeDescription
customerCustomerCustomer object.
billingAddressAddressBilling GuestAddress of Order.
shippingAddressAddressShipping GuestAddress of Order.
cartCartCart of Order.
paymentPaymentPayment of Order.

CreateOrderResponse

Class for CreateOrderResponse model

Kind: global class

new CreateOrderResponse(orderNumber, customerNumber, billingAddress, shippingAddress, grossTotal, taxTotal, created, externalPaymentURL)

ParamTypeDescription
orderNumberStringOrder Number.
customerNumberStringCustomer Number.
billingAddressAddressBilling GuestAddress of Order.
shippingAddressAddressShipping GuestAddress of Order.
grossTotalPriceGross Total Price.
taxTotalPriceTax Total Price.
createdStringDate/Time when the order was created.
externalPaymentURLStringURL of Payment.

CreateOrderRedirectResponse

Class for CreateOrderRedirectResponse model

Kind: global class

new CreateOrderRedirectResponse(url)

ParamTypeDescription
urlStringRedirect URL.

GetCheckoutResponse

Class for GetCheckoutResponse model

Kind: global class

new GetCheckoutResponse(cart, billingAddress, shippingAddress, payment, delivery)

ParamTypeDescription
cartCartCart of Order.
billingAddressAddressBilling GuestAddress of Order.
shippingAddressAddressShipping GuestAddress of Order.
paymentPaymentPayment of Order.
deliveryDeliverythe delivery information.

OrderResponse

Class for Order Response model

Kind: global class

new OrderResponse(orderNumber, billingAddress, shippingAddress, grossTotal, taxTotal, created, externalPaymentURL)

ParamTypeDescription
orderNumberStringthe order number.
billingAddressAddressthe billing address.
shippingAddressAddressthe shipping address.
grossTotalPricegross total of the discount.
taxTotalPricetax total of the discount.
createdStringcreation date.
externalPaymentURLStringthe payment URL.

CheckoutApiOrderResponseSchema

Class for Checkout Order Response model

Kind: global class

new CheckoutApiOrderResponseSchema(customerNumber, orderNumber, billingAddress, shippingAddress, grossTotal, taxTotal, created, externalPaymentURL)

ParamTypeDescription
customerNumberStringthe customer number.
orderNumberStringthe order number.
billingAddressAddressthe billing address.
shippingAddressAddressthe shipping address.
grossTotalPricegross total of the discount.
taxTotalPricetax total of the discount.
createdStringcreation date.
externalPaymentURLStringthe payment URL.

CheckoutOrder

Class for Guest Customer model

Kind: global class

new CheckoutOrder(orderNumber, customerNumber, grossTotal, created, detailUrl)

ParamTypeDescription
orderNumberStringthe order number.
customerNumberStringthe customer number.
grossTotalPricegross total of the discount.
createdStringcreation date.
detailUrlStringthe details URL.

RecommendedArticle

Class for Recommended Article model

Kind: global class

new RecommendedArticle(id, tracking_string, name, lowestPrice, brand, images, videos, units)

ParamTypeDescription
idStringid of article.
tracking_stringStringthe tracking string to help with recommendations
nameStringname of article.
lowestPricePricelowestPrice of article.
brandBrandbrand of article.
imagesArray.<Image>Array of article images.
videosArray.<Video>Array of article videos.
unitsArray.<Unit>Array of article units.

configCache

A temporary fix to handle the current high load capacity

Kind: global constant

fetchEndpoint(endpoint) ⇒ Promise

Calls the given endpoint using fetch and intercepts the response via various operations

Kind: global function
Returns: Promise - Promise after resolving or rejecting the request.

ParamTypeDescription
endpointObjectendpoint object.

Contact

For any inquiry, please contact Team Atlas via team-atlas@zalando.de

LICENSE

The MIT License (MIT) Copyright © 2016 Zalando SE, https://tech.zalando.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

4.18.0

5 years ago

4.17.1

5 years ago

4.17.0

5 years ago

4.16.0

5 years ago

4.15.0

5 years ago

4.14.0

5 years ago

4.13.0

5 years ago

4.12.1

5 years ago

4.12.0

5 years ago

4.11.1

5 years ago

4.11.0

5 years ago

4.10.2

5 years ago

4.10.1

6 years ago

4.10.0

6 years ago

4.9.0

6 years ago

4.8.1

6 years ago

4.8.0

6 years ago

4.7.0

6 years ago

4.6.0

6 years ago

4.5.0

6 years ago

4.4.0

6 years ago

4.3.4

6 years ago

4.3.3

6 years ago

4.3.2

6 years ago

4.3.1

6 years ago

4.3.0

6 years ago

4.2.15

6 years ago

4.2.14

6 years ago

4.2.13

6 years ago

4.2.12

6 years ago

4.2.11

6 years ago

4.2.10

6 years ago

4.2.9

6 years ago

4.2.8

6 years ago

4.2.7

6 years ago

4.2.6

6 years ago

4.2.5

6 years ago

4.2.4

6 years ago

4.2.3

6 years ago

4.2.2

6 years ago

4.2.1

6 years ago

4.2.0

7 years ago

4.1.0

7 years ago

4.0.1

7 years ago

3.0.5

7 years ago

4.0.0

7 years ago

3.0.4

7 years ago

3.0.3

7 years ago

3.0.2

7 years ago

3.0.1

7 years ago

3.0.0

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.6.4

7 years ago

1.6.3

7 years ago

1.6.2

7 years ago

1.6.1

7 years ago

1.6.0

7 years ago

1.5.0

7 years ago

1.4.2

7 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago

1.0.0-alpha

7 years ago