Class: SalesforceConnector

connectors/sfcc.SalesforceConnector(client)

A connector for the Salesforce Commerce Cloud API.

Constructor

new SalesforceConnector(client)

Parameters:
Name Type Description
client ShopApi.ApiClient
Implements:
  • module:connectors/interfaces.CommerceConnector
  • module:connectors/interfaces.ParserHooks
Source:

Methods

(static) fromConfig(config) → {module:sfcc.SalesforceConnector}

Given a configuration in the form of a plain object, this method returns a new SalesforceConnector instance.

Parameters:
Name Type Description
config Object

https://github.com/mobify/commercecloud-ocapi-client/blob/develop/src/ApiClient.js#L44

Source:
Returns:

The new SalesforceConnector instance.

Type
module:sfcc.SalesforceConnector

addCartItem()

Source:

addCouponEntry()

Source:

createCart()

Source:

createOrder(cart, opts) → {Promise.<module:types.Order>}

Create a new order using a given cart. This command will trigger the appropriate OCAPI order authorization hooks. If orders placed through this command aren't progressing from the created status, it's possible that your API hooks haven't been set up. Please consult your Saleforce professional.

Parameters:
Name Type Description
cart module:types.Cart

The customer's cart.

opts Object
Source:
Returns:

.

Type
Promise.<module:types.Order>

deleteCart()

Source:

getCart()

Source:

getCategories()

Source:

getCategory()

Source:

getCustomer()

Source:

getDefaultHeaders()

Source:

getOrder()

Source:

getOrders()

Source:

getPaymentMethods()

Source:

getProduct()

Source:

getProducts()

Source:

getShippingMethods()

Source:

getStore()

Source:

login()

Source:

logout()

Source:

parseCart()

Parse a cart

Source:

parseCartItem()

Parse a cart item

Source:

parseCategories(categories) → {Array.<module:types.Category>}

Takes an array of OCAPI Category objects and parses it into an commerce-integrations Category type.

Parameters:
Name Type Description
categories Array.<Object>

an array of OCAPI Category document

Source:
Returns:
Type
Array.<module:types.Category>

parseCouponEntry()

Parse a coupon item

Source:

parseCustomer(data) → {Promise.<module:types.Customer>}

Takes a OCAPI Customer object and parses it into a commerce-integrations Customer type.

Parameters:
Name Type Description
data Object

a OCAPI Customer document

Source:
Returns:
Type
Promise.<module:types.Customer>

parseCustomerInformation()

Parse customer information

Source:

parseGetStore(data) → {Promise.<module:types.Store>}

Takes a OCAPI Store object and parses it into a commerce-integrations Store type.

Parameters:
Name Type Description
data Object

a OCAPI Store document

Source:
Returns:
Type
Promise.<module:types.Store>

parseImage(imageUrl, attributes) → {Promise.<module:types.Image>}

Takes an image url and its attributes and return an commerce-integrations Image type.

Parameters:
Name Type Description
imageUrl string
attributes Object

additional attributes of an image

Source:
Returns:
Type
Promise.<module:types.Image>

parseOrder()

Source:

parseOrderAddress()

Parse an order address

Source:

parsePayment()

Parse a payment.

Source:

parsePaymentMethod()

Parse a payment method

Source:

parseProduct(data) → {Promise.<module:types.Product>}

Takes a OCAPI Product object and parses it into a commerce-integrations Product type.

Parameters:
Name Type Description
data Object

a OCAPI Product document

Source:
Returns:
Type
Promise.<module:types.Product>

parseSearchProducts(data) → {Promise.<module:types.ProductSearch>}

Takes a OCAPI ProductSearchResult object and parses it into a commerce-integrations ProductSearch type.

Parameters:
Name Type Description
data Object

a OCAPI ProductSearchResult document

Source:
Returns:
Type
Promise.<module:types.ProductSearch>

parseShippingMethod()

Parse a shipping method

Source:

refreshSession()

Source:

registerCustomer(data) → {Promise.<module:types/Customer>}

Register a new customer account and login.

Parameters:
Name Type Description
data module:types/CustomerRegistration
Source:
Returns:
Type
Promise.<module:types/Customer>

removeCartItem()

Source:

removeCouponEntry()

Source:

searchProducts()

Source:

searchStores()

Source:

setBillingAddress()

Source:

setCustomerInformation()

Source:

setDefaultHeaders()

Source:

setPayment()

Source:

setShippingAddress()

Source:

setShippingMethod()

Source:

transformSearchStoreParams()

This function will take product search request as we use them in the commerce-integrations and output them into a format usable by the specific connector (ocapi).

Source:

updateCartItem()

Source: