예제 #1
0
 /**
  * @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());
 }
예제 #2
0
 /**
  * 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());
 }