/** * @return Order */ private function getRobinOrder() { $createdAt = Carbon::createFromFormat("Y-m-d", "2013-04-21", new DateTimeZone("Europe/Amsterdam")); $listView = ListView::make("ORD123", $createdAt, "Shipped"); $detailsView = new DetailsView(); $orderDetails = OrderDetails::make($createdAt, "Shipped", "Paid", "Shipped"); $detailsView->addDetails($orderDetails); return Order::make("ORD1234", "*****@*****.**", $createdAt, 12.5, "https://seoshop.webshopapp.com/backoffice/sales-orders/edit?id=7846544", $listView, $detailsView); }
public function testSendOrdersToRobin() { $this->markTestSkipped("This test hits the network, turn it on when you need to fully test the whole package"); $seoShop = $this->getSeoshop(); $robin = $this->getRobin(); $orders = $seoShop->orders(['page' => 1, 'limit' => 1]); $robinOrders = new Orders(); foreach ($orders as $order) { $createdAt = $order->createdAt; $listView = ListView::make($order->number, $createdAt, $order->status); $detailsView = DetailViewMaker::makeDetailViews($order); $robinOrders->push(Order::make($order->number, $order->email, $createdAt, $order->priceIncl, $order->getEditUrl(), $listView, $detailsView)); } $result = $robin->orders($robinOrders); $this->assertEquals(201, $result->getStatusCode()); }
/** * @param $json * @return \Psr\Http\Message\ResponseInterface */ public function orders($json) { $order = $this->order->makeFromArray($json); $createdAt = $order->createdAt; $listView = ListView::make($order->number, $createdAt, $order->status); $orders = Orders::make([\Robin\Api\Models\Order::make($order->number, $order->email, $createdAt, $order->priceIncl, $order->getEditUrl(), $listView, DetailViewMaker::makeDetailViews($order))]); return $this->robin->orders($orders); }