예제 #1
0
 /**
  * @test
  * @dataProvider validMerchantProvider
  */
 public function it_must_create_an_instance_of_payment($merchantId, $merchantKey)
 {
     $cielo = new Cielo($merchantId, $merchantKey);
     $creditCardPaymentMethod = new CreditCardPayment(['cardNumber' => '0000000000000001', 'holder' => 'John F Doe', 'expirationDate' => '12/2016', 'securityCode' => '123', 'installments' => 10, 'amount' => 129.9]);
     $cielo->setPaymentMethod($creditCardPaymentMethod);
     $this->assertInstanceOf(Payment::class, $cielo->getPaymentMethod());
     $this->assertEquals('CreditCard', $cielo->getPaymentMethod()->getPaymentType());
 }
예제 #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());
 }