This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = function(context, callback) { | |
| var rates = context.response.body.rates; | |
| for(var i = 0; i < rates.length; i++) { | |
| console.info(rates[i]); | |
| for(var j = 0; j < rates[i].shippingRates.length; j++) { | |
| console.info("\t\t" + rates[i].shippingRates[j].content.name); | |
| console.info("\t\t" + rates[i].shippingRates[j].amount); | |
| } | |
| } | |
| callback(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = function(context, callback) { | |
| console.info(context.response.body.rates[0]); | |
| console.info(context.response.body.rates[0].shippingRates[0]); | |
| console.info(context.response.body.rates[0].shippingRates[0].amount); | |
| callback(); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = function(context, callback) { | |
| var rates = context.response.body.rates; | |
| var shippingRate; | |
| try{ | |
| for(var i = 0; i < rates.length; i++) { | |
| for(var j = 0; j < rates[i].shippingRates.length; j++) { | |
| shippingRate = context.response.body.rates[i].shippingRates[j].amount; | |
| context.response.body.rates[i].shippingRates[j].amount = Math.floor((shippingRate + (context.response.body.rates[i].shippingRates[j].amount * 0.25))); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = function(context, callback) { | |
| try { | |
| var firstShippingRatePrice = context.response.body.rates[0].shippingRates[0].amount; | |
| context.response.body.rates[0].shippingRates[0].amount = Math.floor(firstShippingRatePrice + (firstShippingRatePrice * 0.25)); | |
| } catch(err) { | |
| console.error(err); | |
| } | |
| callback(); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "actions": [ | |
| { | |
| "actionId": "http.commerce.catalog.storefront.shipping.requestRates.after", | |
| "contexts": [ | |
| { | |
| "customFunctions": [ | |
| { | |
| "applicationKey": "Grobelny.CleanSlateArcApp.1.0.0.Release", | |
| "functionId": "http.commerce.catalog.storefront.shipping.requestRates.after", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| grunt.registerTask('delActionDomain', 'Deleting the specified action domain...', function(actionDomainName) { | |
| //Load the Yeoman file as a variable | |
| var yoFile = grunt.file.readJSON('./.yo-rc.json'); | |
| //Always delete dist folder and functions.json -- grunt build will recreate these files using manifests | |
| grunt.file.delete('./assets/dist'); | |
| grunt.file.delete('./assets/functions.json'); | |
| if(actionDomainName) { | |
| //Delete domain folder | |
| grunt.file.delete('./assets/src/domains/' + actionDomainName); | |
| //Retrieve each action listed in the Yeoman file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * This is a scaffold for unit tests for the custom function for | |
| * `embedded.commerce.carts.addItem.before`. | |
| * Modify the test conditions below. You may: | |
| * - add special assertions for code actions from Simulator.assert | |
| * - create a mock context with Simulator.context() and modify it | |
| * - use and modify mock Mozu business objects from Simulator.fixtures | |
| */ | |
| 'use strict'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var order = orderResource.GetOrderAsync(orderId).Result; | |
| var digitalPackageResource = new Mozu.Api.Resources.Commerce.Orders.DigitalPackageResource(_apiContext); | |
| var digitalPackageItem = new Mozu.Api.Contracts.CommerceRuntime.Fulfillment.DigitalPackageItem() | |
| { | |
| ProductCode = order.Items[0].Product.ProductCode, | |
| Quantity = order.Items[0].Quantity | |
| }; | |
| var digitalPackage = new Mozu.Api.Contracts.CommerceRuntime.Fulfillment.DigitalPackage() |