Example #1
0
 public function testChargeToken()
 {
     $payment_token = Iugu_PaymentToken::create(array("method" => "credit_card", "data" => array("number" => "4111111111111111", "verification_value" => "123", "first_name" => "Joao", "last_name" => "Silva", "month" => "12", "year" => date("Y"))));
     $this->assertNotNull($payment_token);
     $this->assertTrue(count($payment_token["errors"]) == 0);
     $charge = Iugu_Charge::create(array("token" => $payment_token, "email" => "*****@*****.**", "items" => array(array("description" => "Item Teste", "quantity" => "1", "price_cents" => "1000"))));
     $this->assertNotNull($charge);
     $this->assertTrue(count($charge["errors"]) == 0);
     $this->assertTrue($charge->invoice()->items_total_cents == 1000);
     $this->assertNotNull($charge->invoice());
 }
Example #2
0
 public function testCreateEmptyPaymentToken()
 {
     $payment_token = Iugu_PaymentToken::create();
     $this->assertNotNull($payment_token);
     $this->assertTrue(count($payment_token["errors"]) > 0);
 }
Example #3
0
 public function testCreateEmptyPaymentMethods()
 {
     $payment_method = Iugu_PaymentToken::create();
     $this->assertNotNull($payment_method);
     $this->assertTrue(count($payment_method["errors"]) > 0);
 }