custom/plugins/SwagMarkets/src/Resources/app/administration/src/service/bf-ebay.service.js
/**
     * Store ebay shipping and methods matching data into erp systems
     * @param bfSalesChannelService
     * @param salesChannel
     * @param onSave
     * @returns {Promise<boolean|*>}
     */
Store ebay shipping and methods matching data into erp systems
@param bfSalesChannelService
@param salesChannel
@param onSave
@returns {Promise}
Store ebay shipping and methods matching data into erp systems @param bfSalesChannelService @param salesChannel @param onSave @returns { Promise }
async storeErpSystemMatchingData(bfSalesChannelService, salesChannel, onSave = false) {
        let config = await bfSalesChannelService.getBfConfigSwagMarketsSystem(),
            salesChannelType = await bfSalesChannelService.getSalesChannelType(),
            shippingMethodId = 44,
            salesChannelShippingData = salesChannel.shippingMethods.get(salesChannel.shippingMethodId),
            shopId = await this.getShopId();
        if ((config.payment_methods_is_set === true && config.shipping_methods_is_set === true
            && onSave === false) || salesChannelType !== 'ebay' || shopId.length === 0) {
            return false;
        }
        return this.httpClient.put(
            this.apiUrl + 'erpSystems/store-matching',
            {
                shopId: shopId,
                erpSystemsMatchingShippingMethodsData: [{
                    "shippingMethodsId": shippingMethodId,
                    "erpShippingMethodsCode": salesChannelShippingData.name + " ##" + salesChannelShippingData.id + "##"
                }],
                erpSystemsMatchingPaymentMethodsData: salesChannel.ebayPaymentMethods
            }, {headers: await this.getHeaders()}
        ).then(() => {
            bfSalesChannelService.updateBfConfigSwagMarketsSystem({
                shops: {[salesChannelType]: {payment_methods_is_set: true, shipping_methods_is_set: true, payment_methods_matching: salesChannel.ebayPaymentMethods}}
            });
        });
    }
async storeErpSystemMatchingData ( bfSalesChannelService , salesChannel , onSave = false ) { let config = await bfSalesChannelService . getBfConfigSwagMarketsSystem ( ) , salesChannelType = await bfSalesChannelService . getSalesChannelType ( ) , shippingMethodId = 44 , salesChannelShippingData = salesChannel . shippingMethods . get ( salesChannel . shippingMethodId ) , shopId = await this . getShopId ( ) ; if ( ( config . payment_methods_is_set === true && config . shipping_methods_is_set === true && onSave === false ) || salesChannelType !== 'ebay' || shopId . length === 0 ) { return false ; } return this . httpClient . put ( this . apiUrl + 'erpSystems/store-matching' , { shopId : shopId , erpSystemsMatchingShippingMethodsData : [ { "shippingMethodsId" : shippingMethodId , "erpShippingMethodsCode" : salesChannelShippingData . name + " ##" + salesChannelShippingData . id + "##" } ] , erpSystemsMatchingPaymentMethodsData : salesChannel . ebayPaymentMethods } , { headers : await this . getHeaders ( ) } ) . then ( ( ) => { bfSalesChannelService . updateBfConfigSwagMarketsSystem ( { shops : { [ salesChannelType ] : { payment_methods_is_set : true , shipping_methods_is_set : true , payment_methods_matching : salesChannel . ebayPaymentMethods } } } ) ; } ) ; }
Store ebay shipping and methods matching data into erp systems
 @param bfSalesChannelService
 @param salesChannel
 @param onSave
 @returns {Promise<boolean|*>}
Store ebay shipping and methods matching data into erp systems @param bfSalesChannelService @param salesChannel @param onSave @returns { Promise<boolean| * > }