Skip to content

Instantly share code, notes, and snippets.

@unifysell-user
Last active April 9, 2019 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unifysell-user/7eea2dbe6f76fbc932462d2ea02719fb to your computer and use it in GitHub Desktop.
Save unifysell-user/7eea2dbe6f76fbc932462d2ea02719fb to your computer and use it in GitHub Desktop.
Komplex example
<?php
//insert product
$prodId = $productApi->postProduct([
'title' => 'Fancy Lamp',
'price' => '3.99 EUR',
'quantity' => 10
]);
//get orders
$orderList = $ordersApi->getOrders(['productId' => $prodId]);
$order = $orderList[0];
echo $order->getTitle();
# > 'Fancy Lamp'
echo $order->getPlatform();
# > 'eBay'
$order->getBuyer();
# > ...
//payment info
echo $order->getPayments()->isPayed();
# > true
echo $order->getPayments()->getPlatform();
# > PayPal
//request ship label
$ticketId = $shipmentApi->postShippingLabel(['order' => $order, 'shipmentProvider' => 'DHL']);
$shipmentLabels = $shipmentApi->getShippingLabels();
#insert product
prodId = productApi.postProduct({'title': 'Fancy Lamp', 'price': '3.99 EUR', 'quantity': 10})
#get orders
orderList = ordersApi.getOrders({'productId': prodId})
order = orderList[0]
print(order.getTitle())
print(order.getPlatform())
print(order.getBuyer())
# > Fancy Lamp
# > eBay
# > Buyer: {'name': 'Peter Parker', ...}
#payment info
payment = order.getPayment()
print(payment.isPayed())
print(payment.getPlatform())
# > true
# > PayPal
#request ship label
shipmentApi.createShippingLabel({'order': order, 'shipmentProvider': 'DHL'})
shipmentLabels = shipmentApi.getShippingLabels()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment