public function testCreateCardFromAttributes()
 {
     $card = PaymentCard::fromAttributes(array('last4' => '1234', 'country' => 'FR', 'exp_year' => 2022, 'exp_month' => 12, 'brand' => 'Visa'));
     $this->assertEquals('1234', $card->last4);
     $this->assertEquals('FR', $card->country);
     $this->assertEquals(2022, $card->exp_year);
     $this->assertEquals(12, $card->exp_month);
     $this->assertEquals('Visa', $card->brand);
 }
Beispiel #2
0
 /**
  * The factory method that constructs the API resource.
  *
  * @param   array $attributes the default attributes.
  *
  * @return  PaymentCard The new resource.
  */
 public static function fromAttributes(array $attributes)
 {
     $object = new PaymentCard();
     $object->initialize($attributes);
     return $object;
 }