1 min read

Sfcc SDK

The Poq SFCC SDK contains client of the SFCC OCAPI Shop API, Poq specific services to implement integration of Poq BFC with SFCC OCAPI and converters to implement BFC with OCAPI as a data source.

List of Features

The Poq SFCC SDK provides Contracts, Clients and Services that facilitates the integration of the Poq Platform with the SFCC OCAPI API. There are three root namespaces

Contains OCAPI Contracts & Clients to use Shop API.

Contains specific contracts, services, extensions and converters.

Contains converters from OCAPI Contract to Poq Contract.

Limitations

Implementation does not cover OCAPI Shop API on 100%. Future development should fill in gaps.

Extension Points

Future development will add implementations for missing endpoints. New services will be added to speed up development using Sfcc SDK.

How to develop on top of this solution

All three parts of Sfcc Sdk are structured in a similar way. Code is organized in them as follows:

  • Contract
  • Converters
  • Extensions
  • Interfaces
  • Services

Not all three parts have code in corresponding places. For example Adapter is does not have any Contract definitions since all contracts it uses are defined in Ocapi or Poq Sdk.

Here are simple examples how different parts of SDK could be used.

Example Client Usage

Creating basket for Guest user in OCAPI

var authInfo = new SfccAuthInfo() { };
var authRequest = new SfccAuthRequest()
{
Type = SfccAuthenticationRequestType.Guest
};
var client = new CustomerClient(sfccConfiguration);
var tokenResponse = await client.GetJwt<SfccCustomer>(authInfo, authRequest);
var client = new BasketClient(sfccConfiguration);
var basket = new SfccBasket()
{
CustomerInfo = new SfccCustomerInfo()
{
CustomerId = tokenResponse?.Customer?.CustomerId!
}
};
var response = await client.CreateBasketAsync(tokenResponse?.AuthInfo!, basket);

Example Service Usage

Transferring Cart items of guest user to Sfcc basket

var basketClient = new BasketClient(_sfccConfiguration);
var customerClient = new CustomerClient(_sfccConfiguration);
var sessionsClient = new SessionsClient(_sfccConfiguration);
var cartTransferService = new CartTransferService(basketClient, customerClient, sessionsClient);
var result = await cartTransferService.TransferCartToSfcc(
null,
new SfccAuthRequest() { Type = SfccAuthenticationRequestType.Guest },
new CartTransferRequest() { Items = new List<CartItemRequest>() { new CartItemRequest("sfcc_productId", 1) } });

Breaking Changes

No breaking changes, so far.