This file contains 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 Spree | |
class Calculator::Bogo < Calculator | |
preference :number_to_buy, :integer, :default => 1 | |
preference :number_to_get, :integer, :default => 1 | |
def self.description | |
"Buy One Get One" | |
end | |
def compute(order) |
This file contains 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
const { S3 } = require("aws-sdk"); | |
const axios = require("axios").default; | |
exports.handler = async (event: any) => { | |
console.log(event); | |
const s3 = new S3(); | |
// Retrieve the operation context object from event. This has info to where the WriteGetObjectResponse request | |
// should be delivered and a presigned URL in `inputS3Url` where we can download the requested object from. | |
// The `userRequest` object has information related to the user which made this `GetObject` request to S3OL. |
This file contains 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
namespace :spree do | |
desc "Export Products to CSV File" | |
task :export_products => :environment do | |
require 'fastercsv' | |
products = Product.find(:all) | |
puts "Exporting to #{RAILS_ROOT}/products.csv" | |
FasterCSV.open("#{RAILS_ROOT}/products.csv", "w") do |csv| | |
csv << ["id", "name", "description","sku", "master_price" ] |
This file contains 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
p = Spree::Promotion.create(event_name: "spree.checkout.coupon_code_added", name: "Free Shipping", code: "FREESHIPBD") | |
p.promotion_actions << Spree::Promotion::Actions::CreateAdjustment.create() | |
pa = p.promotion_actions.first | |
pa.calculator = Spree::Calculator::FreeShipping.new |
This file contains 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
{ | |
"message_id": "88af1dc5fe53543f1200f517", | |
"message": "ctl:shipment:confirmation:poll", | |
"payload": { | |
"parameters": [ | |
{ | |
"name": "ctl.last_confirmation_shipment", | |
"value": "H00000000001" | |
}, | |
{ |
This file contains 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
{ | |
"name": "vpd", | |
"display": "VPD Endpoint", | |
"description": "Shipping integration with VPD", | |
"help": "http://guides.spreecommerce.com/integration/vpd_integration.html", | |
"icon_url": "vpd.png", | |
"services": [ | |
{ | |
"name": "shipments", | |
"path": "/service/spree_order.p", |
This file contains 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
'notifications' => [ | |
{ | |
'level' => 'info', | |
'subject' => 'product exists' , | |
'description' => 'product exists in the database' | |
} | |
] |
This file contains 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
object @address | |
attributes *address_attributes | |
child(:country) do |address| | |
attributes *country_attributes | |
end | |
child(:state) do |address| | |
attributes *state_attributes | |
end |
This file contains 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
{ | |
"message": "order:new", | |
"payload": { | |
"order": { | |
"channel": "Amazon", | |
"email": "test1@test.com", | |
"currency": "USD", | |
"line_items": [ | |
{ | |
"price": 19.99, |
NewerOlder