Skip to content

Instantly share code, notes, and snippets.

@jsqu99
Created April 18, 2014 16:32
Show Gist options
  • Select an option

  • Save jsqu99/11052950 to your computer and use it in GitHub Desktop.

Select an option

Save jsqu99/11052950 to your computer and use it in GitHub Desktop.

Revisions

  1. jsqu99 created this gist Apr 18, 2014.
    89 changes: 89 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,89 @@
    data = {"_identifier" => spree_order.number,
    "_entityName" => "Order",
    "salesTransaction" => true,
    "transactionDocument" => "466AF4B0136A4A3F9F84129711DA8BD3",
    "transactionDocument$_identifier" => "Standard Order",
    "orderDate" => spree_order.completed_at,
    "currency$_identifier" => spree_order.currency,
    "summedLineAmount" => spree_order.item_total.to_f,
    "grandTotalAmount" => spree_order.total.to_f,
    "documentType" => "466AF4B0136A4A3F9F84129711DA8BD3",
    "documentType$_identifier" => "Standard Order",
    "active" => true,
    "salesTransaction" => true,
    "documentStatus" => "CO",
    "documentAction" => "--",
    "processNow" => false,
    "processed" => true,
    "documentType" => "466AF4B0136A4A3F9F84129711DA8BD3",
    "documentType$_identifier" => "Standard Order",
    "transactionDocument" => "466AF4B0136A4A3F9F84129711DA8BD3",
    "transactionDocument$_identifier" => "Standard Order",
    "description" => nil,
    "delivered" => false,
    "reinvoice" => false,
    "print" => false,
    "selected" => false,
    "salesRepresentative" => nil,
    "datePrinted" => nil,
    "printDiscount" => false,
    "formOfPayment" => "P",
    "invoiceTerms" => "D",
    "deliveryTerms" => "A",
    "freightCostRule" => "I",
    "freightAmount" => 0,
    "deliveryMethod" => "P",
    "shippingCompany" => nil,
    "charge" => nil,
    "chargeAmount" => 0,
    "priority" => "5",
    "salesCampaign" => nil,
    "project" => nil,
    "activity" => nil,
    "posted" => "N",
    "copyFrom" => false,
    "dropShipPartner" => nil,
    "dropShipLocation" => nil,
    "dropShipContact" => nil,
    "selfService" => false,
    "trxOrganization" => nil,
    "stDimension" => nil,
    "ndDimension" => nil,
    "deliveryNotes" => nil,
    "incoterms" => nil,
    "iNCOTERMSDescription" => nil,
    "generateTemplate" => false,
    "deliveryLocation" => nil,
    "copyFromPO" => false,
    "fINPaymentPriority" => nil,
    "pickFromShipment" => false,
    "receiveMaterials" => false,
    "createInvoice" => false,
    "returnReason" => nil,
    "addOrphanLine" => false,
    "asset" => nil,
    "calculatePromotions" => false,
    "costcenter" => nil,
    "createOrder" => false,
    "rejectReason" => nil,
    "validUntil" => nil,
    "quotation" => nil,
    "reservationStatus" => nil,
    "createPOLines" => false,
    "cashVAT" => false
    }

    OpenbravoSyncher.put(OpenbravoSyncher::REST_APP_PATH + "Order", {:body => { :data => data }.to_json, :basic_auth => {:username => 'Openbravo', :password => 'openbravo'}})


    => {
    "response" => {
    "status" => -1,
    "error" => {
    "message" => "Document posted/processed",
    "messageType" => "Error",
    "title" => ""
    },
    "totalRows" => 0
    }
    }