Created
July 27, 2016 09:39
-
-
Save anonymous/c9494292757e49ab80a150ab9b9613d3 to your computer and use it in GitHub Desktop.
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
<?php | |
// we suppose that sellsyconnect, sellsytools and boot files are created.. | |
/*******Code to create client*******/ | |
//We configure parameters for new client | |
$create_client_request = array ( | |
'method' => 'Client.create', | |
'params' => array( | |
'third' => array( | |
'name' => {{name}}, | |
'ident' => {{ident}}, | |
'type' => {{type}}, | |
'email' => {{email}}, | |
'tel' => {{tel}}, | |
'fax' => {{fax}}, | |
'mobile' => {{mobile}}, | |
'joinDate' => {{joinDate}}, | |
'web' => {{web}}, | |
'siret' => {{siret}}, | |
'siren' => {{siren}}, | |
'vat' => {{vat}}, | |
'rcs' => {{rcs}}, | |
'apenaf' => {{apenaf}}, | |
'capital' => {{capital}}, | |
'tags' => {{tags}}, | |
'accountingcode' => {{accountingcode}}, | |
'auxcode' => {{auxcode}}, | |
'stickyNote' => {{stickyNote}}, | |
'rateCategory' => {{rateCategory}}, | |
'massmailingUnsubscribed' => {{massmailingUnsubscribed}}, | |
'massmailingUnsubscribedSMS' => {{massmailingUnsubscribedSMS}}, | |
'facebook' => {{facebook}}, | |
'viadeo' => {{viadeo}}, | |
'twitter' => {{twitter}}, | |
'linkedin' => {{linkedin}}, | |
), | |
'contact' => array( | |
'name' => {{name}}, | |
'forename' => {{forename}}, | |
'email' => {{email}}, | |
'tel' => {{tel}}, | |
'fax' => {{fax}}, | |
'mobile' => {{mobile}}, | |
'web' => {{web}}, | |
'position' => {{position}}, | |
'civil' => {{civil}}, | |
'birthdate' => {{birthdate}}, | |
'stickyNote' => {{stickyNote}} | |
), | |
'address' => array( | |
'name' => {{name}}, | |
'part1' => {{part1}}, | |
'part2' => {{part2}}, | |
'part3' => {{part3}}, | |
'part4' => {{part4}}, | |
'zip' => {{zip}}, | |
'town' => {{town}}, | |
'countrycode' => {{countrycode}} | |
) | |
) | |
); | |
//We send request to sellsy to create the new client | |
sellsyConnect_curl::load()->requestApi($create_client_request); | |
/*******Code to create new purchase*******/ | |
//We configure parameters for new Purchase | |
$create_purchase_request = array( | |
'method' => 'Purchase.create', | |
'params' => array( | |
'purchase' => array( | |
'ident' => {{ident}}, | |
'parentid' => {{parentid}}, | |
'thirdid' => {{thirdID}}, | |
'externalident' => {{externalident}}, | |
'displayedDate' => {{displayedDate}}, | |
'currency' => {{currencyID}}, | |
'doctype' => {{doctype}}, | |
'subject' => {{subject}}, | |
'notes' => {{notes}}, | |
'doclayout' => {{doclayout}}, | |
'useEcotaxe' => {{useEcotaxe}} | |
), | |
'rows' => array( | |
0 => array( | |
# Common for all line types # | |
'type' => {{row_type}}, | |
'id' => {{row_id}}, | |
'parentid' => {{row_parentid}}, | |
# Applicable for next row types : ‘once‘, ‘item‘, ‘shipping‘ et ‘packaging‘ # | |
'qt' => {{row_qt}}, | |
'discountUnit' => {{row_discountUnit}}, | |
'discount' => {{row_discount}}, | |
'unitAmount' => {{row_unitAmount}}, | |
'taxid' => {{row_taxID}}, | |
'isOption' => {{row_isOption}}, | |
'accountingCode' => {{row_accountingCodeID}}, | |
# Applicable for ‘once‘ and ‘item‘ row types # | |
'name' => {{row_name}}, | |
'notes' => {{row_notes}}, | |
'unit' => {{row_unit}}, | |
# Applicable for ‘item‘ row type # | |
'linkedid' => {{row_linkedid}}, | |
'declid' => {{row_declid}}, | |
'whid' => {{row_whid}}, | |
'barcode' => {{row_barcode}}, | |
'serial' => {{row_serial}}, | |
# Applicable for ‘title‘ row type # | |
'title' => {{row_title}}, | |
# Applicable for ‘comment‘ row type # | |
'comment' => {{row_comment}}, | |
# Applicable for ‘shipping‘ row type # | |
'shipping' => {{row_shipping}}, | |
# Applicable for ‘packaging‘ row type # | |
'packaging' => {{row_packaging}} | |
) | |
), | |
'payments' => array( | |
0 => array( | |
'mediumid' => {{paymediumID}}, | |
'date' => {{payDate}}, | |
'amount' => {{payAmount}}, | |
'ident' => {{payIdent}}, | |
'currency' => {{payCurrencyID}} | |
) | |
), | |
'paydate' => array( | |
'custom' => {{custom}} | |
) | |
) | |
); | |
$response = sellsyConnect::load()->requestApi($create_purchase_request); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment