Example #1
0
 public function it_should_perform_a_transaction()
 {
     $cielo = new Cielo('7cd24544-9887-4cfa-98ec-a824aa61bfc9', 'NJGQLYAJEBFQJDQIJEQBAWYOOICZGXQYLEQPXXRD', false);
     $paymentMethod = new CreditCardPayment(['cardNumber' => '0000000000000001', 'holder' => 'John F Doe', 'expirationDate' => '12/2016', 'securityCode' => '123', 'installments' => 10, 'amount' => 129.9]);
     $cielo->setCustomer('John F Doe')->setPaymentMethod($paymentMethod);
     $res = $cielo->performTransaction();
     $this->assertEquals('1', $res->Payment->Status);
 }
Example #2
0
 /**
  * Consult a transaction by the Payment ID.
  *
  * @param Cielo   $cielo
  * @param string  $paymentId
  *
  * @return stdClass
  */
 public function consultTransaction(Cielo $cielo, $paymentId)
 {
     $headers = ['Content-Type' => 'application/json', 'MerchantId' => $cielo->getMerchantId(), 'MerchantKey' => $cielo->getMerchantKey(), 'RequestId' => $this->requestId];
     $res = $this->consult->get('/1/sales/' . $paymentId, compact('headers'));
     return json_decode($res->getBody()->getContents());
 }