Package 

Class BsLogCheckoutEvent.Builder


  • 
    public final class BsLogCheckoutEvent.Builder
    
                        

    BsLogCheckoutEvent is required to log checkout event for orders. You can trigger this event when the order has been placed or unable to place. you need to provide orderId in both cases. If you don't have the orderId in case of not being successful then you can pass cartId for that order.

    • Method Detail

      • init

         final <ERROR CLASS> init(Context context)

        init is required to pass context to the SDK method and log the event. if not provided, it will throw an exception on runtime.

      • setOrderId

         final <ERROR CLASS> setOrderId(String order_id)

        setOrderId is required to log the orderId for the order being successful or failed to place. In case of not having any orderId for failed cases you can pass the cartId or a corresponding value that can be used to track in the catalog about the order placement details.

      • setCartId

         final <ERROR CLASS> setCartId(String cart_id)

        setCartId can be used to log the cartId the event is logged for. It is recommended to include the unique cartId for the cart items so that they can be tracked.

      • isSuccessful

         final <ERROR CLASS> isSuccessful(Boolean is_successful)

        isSuccessful is required to log the successful placement of the order. False in case of order placement is not successful.

      • setPrice

         final <ERROR CLASS> setPrice(Float price)

        setPrice is required to log the total price of the order being logged. Price format should be in accordance to the currency selected.

      • setCurrency

         final <ERROR CLASS> setCurrency(String currency)

        setCurrency is required to log the currency for for the order logged. Currency should be in ISO 4217 format. For Ease, SDK provides the enums to log the currency so that it would be easy to log. You can also use the string function to provide the currency. Below is the function for the logging currency using String. Remember to use the same strings as provided in the enums or else the event will be discarded.

      • addItem

         final <ERROR CLASS> addItem(ItemModel itemModel)

        addItem can be used to add the item being orders in to the checkout list. This log can be used to add one item to the log at a time. Order item should be in a valid format. With elements of the orderObject as: ItemModel(itemID, price, currency, stock_status, quantity, promoId) Promo Id can be an empty string or no value at all if the item does not have a promo offer that is obtained by the user. You can add multiple addOrder functions to one checkout event to include all the items in the order.

      • addItem

         final <ERROR CLASS> addItem(String itemJsonString)

        setItem can be used to pass the whole item as a Json String object as well. You can use the POJO ItemModel to parse the data int he required format and pass that to this function as a string to log the event. You can use Gson to convert the object to string but SDK will parse the Json string back to POJO so pass it in the log. This method should be used with caution and is suitable for react native bridge.

      • addItemList

         final <ERROR CLASS> )>addItemList(<ERROR CLASS><ItemModel> itemList)

        addItemList can be used to add the whole list to the log at once, the format should be ArrayList<ItemModel> to log the event successfully. Order item should be in a valid format. With elements of the orderObject as: ItemModel(itemID, price, currency, stock_status, quantity, promoId) Promo Id can be an empty string or no value at all if the item does not have a promo offer that is obtained by the user. You should use only one addItemList with checkout event or else the list will only save the later one.

      • addItemList

         final <ERROR CLASS> addItemList(String itemListString)

        addItemList can be used to add the whole list to the log at once, the format should be ArrayList<ItemModel> to log the event successfully. But the input param is of type string , this is special use case for react native logs where list can be passed as Json string and can be used to log the event. Order item should be in a valid format. With elements of the orderObject as: ItemModel(itemID, price, currency, stock_status, quantity, promoId) Promo Id can be an empty string or no value at all if the item does not have a promo offer that is obtained by the user. You should use only one addItemList with checkout event or else the list will only save the later one.

      • setMeta

         final <ERROR CLASS> setMeta(Object meta)

        You can pass any type of value in setMeta. It is for developer and partners to log additional information with the log that they find would be helpful for logging and providing more context to the log. Default value for the meta is null.

      • updateImmediately

         final <ERROR CLASS> updateImmediately(Boolean update_immediately)

        updateImmediately is responsible for updating the values ot the backend immediately. By default this is set to false or whatever the developer has set in the SDK initialisation block. This differs the time for which the logs will be logged, if true, the SDK will log the content instantly and if false it will wait till the end of user session which is whenever the app goes into background.

      • build

         final <ERROR CLASS> build()

        build will validate all of the values provided and if passes will call the track function and queue the events based on it's updateImmediately value and also on the user's network resources.