public function testCustomerModelCanBeCreated() { $since = Carbon::createFromFormat("Y-m-d", "2013-04-21", new DateTimeZone("Europe/Amsterdam")); $panel = new Panel(); $panel->make("5", "1150"); $robinCustomer = Customer::make("*****@*****.**", $since, 5, "€1150,-", $panel); $this->assertInstanceOf(Customer::class, $robinCustomer); $this->assertEquals("2013-04-21", $robinCustomer->customerSince); }
public function testSendCustomersToRobin() { $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(); $customers = $seoShop->customers(['page' => 1, 'limit' => 1]); $robinCustomers = new Customers(); foreach ($customers as $customer) { $date = $customer->createdAt; $robinCustomers->push(Customer::make($customer->email, $date, $customer->orders->count, $customer->orders->totalSpendFormatted(), Panel::make($customer->orders->count, $customer->orders->totalSpendFormatted()))); } $result = $robin->customers($robinCustomers); $this->assertEquals("201", $result->getStatusCode()); }
/** * @param Customer $customer * @return \Robin\Api\Models\Customer */ private function makeRobinCustomer(Customer $customer) { $createdAt = $customer->createdAt; $panelView = Panel::make($customer->orders->count, $customer->orders->total); return \Robin\Api\Models\Customer::make($customer->email, $createdAt, $customer->orders->count, $customer->orders->totalSpendFormatted(), $panelView); }