public static function transformToArray(CustomerObject $customerObject) { $customer = ["Nombre" => $customerObject->getName(), "Direcc" => $customerObject->getAddress(), "Telefo" => $customerObject->getPhone(), "Pais" => $customerObject->getCountry(), "Departamento" => $customerObject->getDepart(), "Ciudad" => $customerObject->getCity(), "Correo" => $customerObject->getEmail(), "IdClieRapiOcho" => $customerObject->getIdDocument(), "TipoDocu" => $customerObject->getTypeDocument()]; return $customer; }
public function test_buy_ticket_should_work() { $customer = new Customer(); $customer->setAddress("aaaa")->setCity("Bogotá")->setCountry("Colombia")->setDepart("Algo")->setEmail("*****@*****.**")->setPhone("99999999")->setIdDocument("99999")->setTypeDocument(Customer::DOCUMENT_CC)->setName("Name Test"); $payment = new Payment(); $payment->setTotal(55000)->setPaymentCode(Payment::PAYMENT_TYPE_CREDIT)->setBankCode(Payment::PAYMENT_VISA); $ticket = new Ticket(); $ticket->setPrice(55000)->setCustomer($customer)->setDiscount(0)->setFrom("001")->setTo("002")->setSeat(2)->setIdPrice("65855")->setId(uniqid()); $orderBuilder = new BuilderOrder(); $order = $orderBuilder->addPayment($payment)->addTicket($ticket)->create("001", "002", "023", "65855", 55000); $expected = (object) ["RealizarVentaTiquetesResult" => (object) ["EjecucionExitosa" => true, "MensajeValidacion" => null, "IdVenta" => "12345"]]; $this->soapFake->shouldReceive("RealizarVentaTiquetes")->andReturn($expected); $result = $this->client->buyTicket($order, $customer); $this->assertEquals($expected->RealizarVentaTiquetesResult->IdVenta, $result->IdVenta); }