/** * @test * @dataProvider validMerchantProvider */ public function it_must_create_an_instance_of_customer($merchantId, $merchantKey) { $cielo = new Cielo($merchantId, $merchantKey); $cielo->setCustomer('John F. Doe'); $this->assertInstanceOf(Customer::class, $cielo->getCustomer()); $this->assertEquals('John F. Doe', $cielo->getCustomer()->getName()); }
/** * Performs a new transaction. * * @param Cielo $cielo * * @return stdClass */ public function performTransaction(Cielo $cielo) { $headers = ['MerchantId' => $cielo->getMerchantId(), 'MerchantKey' => $cielo->getMerchantKey(), 'RequestId' => $this->requestId]; $json = ['MerchantOrderId' => Uuid::uuid1(), 'Customer' => $cielo->getCustomer()->toArray(), 'Payment' => $cielo->getPaymentMethod()->toArray()]; $res = $this->perform->post('/1/sales', compact('headers', 'json')); return json_decode($res->getBody()->getContents()); }