Merchant Service - rettersoft/rbs-docs GitHub Wiki

Rbs Merchant Service

Actions

Internal Actions:

rbs.merchant.request.REMOVE_PRICE

Input: Item

Item {
    variantGroupId: string //required
    itemId: string //required
}

Output: No Content

rbs.merchant.request.PUT_PRICE

  • If you want to send the merchant id, you should pass in token claims with 'merchantId' attribute.
Input: MerchantVariantModel

MerchantVariantModel {
    variantGroupId: string //required
    itemId: string //required
    priceTags: PriceTagItem[]
}

PriceTagItem {
    zone?: string //optional
    segment?: string //optional
    campaignId?: string //optional
    suggested?: number //required
    discounted?: number //required
    extraData?: any // optional
}

Output: Response

Response {
    projectId:      string;
    variantGroupId: string;
    itemId:         string;
    merchantId:     string;
    priceTags:      PriceTag[];
    hash:           string;
    updateToken:    string;
    createdAt:      Date;
    updatedAt:      Date;
}

PriceTag {
    campaignId: string;
    segment:    string;
    zone:       string;
    discounted?: number;
    suggested?:  number;
}

rbs.merchant.get.MERCHANT_VARIANTS

  • Query project merchant variants
Input: Params {
    variantGroupId: string, // required
    itemId?: string,  // optional
    merchantId?: string  // optional
}

Output: Item[]

Item {
    projectId:      string;
    variantGroupId: string;
    itemId:         string;
    merchantId:     string;
    priceTags:      PriceTag[];
    hash:           string;
    updateToken:    string;
    createdAt:      Date;
    updatedAt:      Date;
}

PriceTag {
    discounted?: number;
    normal:     number;
    zone:       string;
    campaignId: string;
    segment?:    string;
    extraData?:     any;
}

Example Inputs:

{
    variantGroupId: "default_variant_group_id"
}

{
    variantGroupId: "default_variant_group_id",
    itemId: "default_item_id"
}

{
    variantGroupId: "default_variant_group_id",
    itemId: "default_item_id",
    merchantId: "default_merchant"
}

rbs.merchant.request.EXPORT

  • Export data set
  • Get from storage service with file id
  • File ttl is 5 minute
Input: No Input

Output: Item

Item {
    fileId: string // Ex: "a84cf58d-51b5-451a-b1a1-8a346ebba360"
}

rbs.merchant.request.IMPORT

  • Import data set
  • Supports only XLSX files
Input: {
    data: string // base64 encoded xlsx file
}

Output: Item

Item {
    failedRows: Array<number>, // failed xlsx items rows
    "totalSkipped": number, // ignored items (no changes)
    "totalProcessed": number, // total processed items
    "total": number // total items in the imported xlsx file
}

rbs.merchant.request.GET_PROJECT_CONFIG

  • Get specific project config
Input: No Input

Output: Item

Item {
    segments:    string[];
    zones:       string[];
    updateToken: string; // !!! for update this config
    createdAt:   Date;
    updatedAt:   Date;
}

rbs.merchant.request.UPDATE_PROJECT_CONFIG

  • Update specific project config with update token
  • Fails on invalid update token
Input: {
    config: Config;
    updateToken: string; // newest update token
}

Config {
    segments:    string[];
    zones:       string[];
}

Output: Item

Item {
    segments:    string[];
    zones:       string[];
    updateToken: string; // !!! for update this config
    createdAt:   Date;
    updatedAt:   Date;
}

External Actions:

rbs.integration.get.FILE_NAMES

  • Return file names array
Input: No Input

Output: Item

Item : Array<String>

rbs.price.event.UPDATED

  • Price update handler
Payload : PriceEventUpdateRemoveObject

PriceEventUpdateRemoveObject {
    divider?: number // optional
    variantGroupId: string
    itemId: string
    merchantId: string
    segmentId: string
    zoneId: string
    campaignId: string
    price: {
        normal: number,
        discounted: number
    },
    lastUpdate: number //Timestamp in milliseconds
    extraData?: any;
}

rbs.price.event.REMOVED


rbs.price.request.GET


⚠️ **GitHub.com Fallback** ⚠️