Constructor
new HybrisConnector()
- Implements:
- module:connectors/interfaces.CommerceConnector
- module:connectors/interfaces.ParserHooks
- Source:
Methods
addCartItem()
- Source:
addCouponEntry()
- Source:
createCart()
- Source:
createOrder()
- Source:
deleteCart()
- Source:
getAuthentications() → {Object}
Get current authentications object, which can be used to save/restore auth state, eg. for server-side usage.
- Source:
Returns:
- Type
- Object
getCart()
- Source:
getCategories()
- Source:
getCategory()
- Source:
getCustomer()
- Source:
getDefaultHeaders()
- Source:
getOrder()
- Source:
getOrders()
- Source:
getPaymentMethods(cart, opts) → {Promise.<Array.module:types.PaymentMethod>}
Get the available payment methods for the cart
Parameters:
| Name | Type | Description |
|---|---|---|
cart |
module:types.Cart | The customer's cart. |
opts |
Object |
- Source:
Returns:
Hybris only supports payments by credit card attained from their cardtypes endpoint so this command will return only one payment method with the id 'CREDIT_CARD', name 'Credit Card' and all of it's valid credit card types.
- Type
- Promise.<Array.module:types.PaymentMethod>
getProduct()
- Source:
getProducts()
- Source:
getShippingMethods()
- Source:
getStore()
- Source:
login()
- Source:
logout()
- Source:
parseCart()
- Source:
parseCartItem()
- Source:
parseCategory(categories) → {Promise.<module:types.Category>}
Takes an OCAPI Category objects and parses it into an commerce-integrations Category type.
Parameters:
| Name | Type | Description |
|---|---|---|
categories |
Array.<Object> | an OCAPI Category document |
- Source:
Returns:
- Type
- Promise.<module:types.Category>
parseCouponEntry()
Parse a coupon item
- Source:
parseCustomer()
- Source:
parseGetStore(data) → {Promise.<module:types.Store>}
Takes a OCCAPI PointOfService object and parses it into a commerce-integrations Store type.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Object | a OCCAPI PointOfService document |
- Source:
Returns:
- Type
- Promise.<module:types.Store>
parseOpeningHours(hours) → {Promise.<module:types.Store.hours>}
Takes a OCCAPI WeekdayOpeningDay object and parses it into a commerce-integrations Store.hours type.
Parameters:
| Name | Type | Description |
|---|---|---|
hours |
Object | a OCCAPI WeekdayOpneningDay document |
- Source:
Returns:
- Type
- Promise.<module:types.Store.hours>
parseOrder()
- Source:
parseOrderAddress()
- Source:
parsePayment()
- Source:
parsePaymentMethod()
- Source:
parseShippingMethod()
- Source:
refreshSession()
- Source:
registerCustomer(data) → {Promise.<module:types/Customer>}
Register a new customer account and login.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
module:types/HybrisCustomerRegistration |
- Source:
Returns:
- Type
- Promise.<module:types/Customer>
removeCartItem()
- Source:
removeCouponEntry()
- Source:
searchProducts()
- Source:
searchStores()
- Source:
setAuthentications(authentications)
Set the current authentications object, as returned from getAuthentications. Use to save/restore auth state, eg. for server-side usage.
Parameters:
| Name | Type | Description |
|---|---|---|
authentications |
Object |
- Source:
setBillingAddress(cart, billingAddress, opts) → {Promise.<module:types.Cart>}
Set the billing address on the cart.
Parameters:
| Name | Type | Description |
|---|---|---|
cart |
module:types.Cart | The cart to update the billing address for. |
billingAddress |
module:types.OrderAddress | The new or modified address. |
opts |
Object |
- Source:
Returns:
Billing Address model : this order address needs to have a titleCode defined. The default titleCodes are: ['mr', 'ms', 'miss', 'mrs', 'dr', 'rev'] But these may change depending on your backend, please refer to your backend instance to confirm valid titleCodes.
If the billing address is set before adding a payment, the billing address will not yet be saved in the hybris instance. Instead, the billing address will be saved in the hybris instance upon setting a payment.
- Type
- Promise.<module:types.Cart>
setCustomerInformation(cart, customerInformation, opts) → {Promise.<module:types.Cart>}
Set the customer information.
Parameters:
| Name | Type | Description |
|---|---|---|
cart |
module:types.Cart | The customer's cart. |
customerInformation |
module:types.CustomerInformation | The new or modified customer information. |
opts |
Object |
- Source:
Returns:
Email can be set for a guest user but not a registered user.
- Type
- Promise.<module:types.Cart>
setDefaultHeaders()
- Source:
setPayment(cart, payment, opts) → {Promise.<module:types.Cart>}
Add a supported payment type to the cart
Parameters:
| Name | Type | Description |
|---|---|---|
cart |
module:types.Cart | The cart to add the payment to. |
payment |
module:types.Payment | The payment to add. |
opts |
Object |
- Source:
Returns:
Need to set a billing address before setting a payment. Must call setCustomerInformation() to add an email before setting payment for an anonymous user. cart.paymentDetails.number will be returned as undefined and set as a masked number in cart.paymentDetails.maskedNumber.
- Type
- Promise.<module:types.Cart>
setShippingAddress(cart, shippingMethod, opts) → {Promise.<module:types.Cart>}
Set the shipping method for the cart.
Parameters:
| Name | Type | Description |
|---|---|---|
cart |
module:types.Cart | The cart to set the shipping method for. |
shippingMethod |
module:types.ShippingMethod | The shipping method to set. |
opts |
Object |
- Source:
Returns:
Must call setCustomerInformation() to add an email before setting payment for a guest user.
- Type
- Promise.<module:types.Cart>
setShippingMethod()
- Source:
transformCartItem()
Transform a cartItem into hybris' model OrderEntryOCC.
- Source:
transformOrderAddress()
Transform an orderAddress into hybris' models: billingAddress or shippingAddress
- Source:
transformPayment()
Transform a payment into hybris' model paymentDetail.
- Source:
transformShippingMethod()
Transform a shippingMethod into hybris' model deliveryMethod.
- Source:
updateCartItem()
- Source: