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
To design a proper architecture to sincronize product stocks between a Jumpseller store and a ERP (or any similar system), consider: | |
1. Define a storage system (a MySQL, SQLite or even a plain-text file works perfectly) to hold at least two columns: jumpseller_product_id and erp_id | |
2. Record each part of IDs, jumpseller_product_id and erp_id, using Jumpseller GET /products endpoint, like: | |
jumpseller_product_id, erp_id | |
123456, adidas-red-43 | |
123457, adidas-red-44 | |
123458, adidas-red-45 | |
3. Once the matching of all products from Jumpseller Store and the ERP system is done, | |
4. You can start work on keeping stock updated, by adding a third column: synced_at, like: |
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
public function dataJumpseller(Request $data) | |
{ | |
$secretKey = "secreto_jumpseller"; | |
$params = array( "x_account_id" => "223504", "x_amount" => "123.0", "x_currency" => "EUR", "x_reference" => "1001", , x_result: "completed", x_timestamp: '2014-03-24T12:15:41Z', "x_message" => "\\nProducto:\\n1 x Energise EDT 125 ML: 29.500 EUR\\nImpuesto: €6.785,00" ); | |
$keys = array_keys($params); | |
sort($keys); | |
$toSign = ""; |
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
Arica y Parinacota: { | |
'8261387': Arica: { "googleKey":"Arica", "v":"15101" }, | |
'8261252': Camarones: { "googleKey":"Camarones", "v":"15102" }, | |
'8261463': Putre: { "googleKey":"Putre", "v":"15201" }, | |
'8261451': General Lagos: { "googleKey":"General Lagos", "v":"15202" }, | |
} | |
Tarapacá: | |
'8261207': Iquique: { "googleKey":"Iquique", "v":"01101" }, | |
'8261202': Alto Hospicio: { "googleKey":"Alto Hospicio", "v":"01107" }, | |
'8261350': Pozo Almonte: { "googleKey":"Pozo Almonte", "v":"01401" }, |
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
curl -X POST -d '{ "order": {"status": "Paid", "products": [{ "id": 4803531,"variant_id": 9072280, "qty": 1}], "customer": {"id": 1609949}}}' "http://api.jumpseller.com/v1/orders.json?login=XXX&authtoken=XXX" -H "Content-Type:application/json" |
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
// editar webhook | |
$data = array("event" => "order_paid", | |
"url" => "https://conexiondes.facto.cl/conector_jumpseller.php?user=$user&password=$pass", | |
); | |
$data_hook = json_encode(array("hook" => $data)); | |
$url = "https://api.jumpseller.com/v1/hooks/".$id.".json"; | |
$ch = curl_init(); |
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
store = Store.find_by(code: "XXX") | |
store.products.all.each do |product| | |
p "product id: #{product.id} SKU duplicated from #{store.products.where(sku: product.sku).map(&:id)}" if store.products.where(sku: product.sku).size >= 2 | |
p "product id: #{product.id} name duplicated from #{store.products.where(name: product.name).map(&:id)}" if store.products.where(name: product.name).size >= 2 | |
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
# at heroku console | |
heroku ps:exec -a jumpseller-apps -d worker.1 --ssh | |
# then | |
curl 'https://api.ipify.org' |
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
$response_params = array( | |
"x_account_id" => $this->params['chave_api'], | |
"x_amount" => $this->params['valor'], | |
"x_currency" => "EUR", | |
"x_reference" => $this->params['identificador'], | |
"x_result" => "completed", | |
"x_timestamp" => date('Y-m-d') . 'T' . date('H:i:s') . 'Z', | |
"x_message" => "Pagamento realizado com sucesso" | |
); | |
// $response_params['x_signature'] = $this->generateSignature($response_params); |
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
function payment_cost_order_product_id(cart_json){ | |
var id = null; | |
$.each(cart_json.products, function( i, order_product ){ | |
if(order_product.product_id == '287177'){ // product for adding payment cost. | |
id = order_product.id; | |
} | |
}); | |
return id; // return order_product.id if found | |
} |
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
require 'net/http' | |
HOST = 'http://b2b.correos.cl/ServicioAdmisionCEPExterno/cch/ws/enviosCEP/externo/implementacion/ServicioExternoAdmisionCEP.asmx?WSDL' | |
def post_xml xml_string | |
uri = URI.parse HOST | |
request = Net::HTTP::Post.new uri.path | |
request.body = xml_string | |
request.content_type = 'text/xml' | |
response = Net::HTTP.new(uri.host, uri.port).start { |http| http.request request } |
NewerOlder