public function __construct(ChargeResponse $chargeResponse)
 {
     $this->entity = $chargeResponse;
     $this->entityDTO = new ChargeResponseDTO();
     $this->entityDTO->externalId = $this->entity->getExternalId();
     $this->entityDTO->amount = $this->entity->getAmount();
     $this->entityDTO->last4 = $this->entity->getLast4();
     $this->entityDTO->brand = $this->entity->getBrand();
     $this->entityDTO->currency = $this->entity->getCurrency();
     $this->entityDTO->description = $this->entity->getDescription();
     $this->entityDTO->created = $this->entity->getCreated();
 }
 public function testLoadValidatorMetadata()
 {
     $chargeResponse = new ChargeResponse();
     $chargeResponse->setExternalId(str_pad('x', 256, 'x'));
     $chargeResponse->setAmount(2147483648);
     $chargeResponse->setLast4('xxxx');
     $chargeResponse->setBrand('12345678901234567');
     $chargeResponse->setCurrency('xxxx');
     $chargeResponse->setDescription(str_pad('x', 256, 'x'));
     $chargeResponse->setCreated(-1);
     $errors = $this->getValidationErrors($chargeResponse);
     $this->assertSame(7, sizeof($errors));
     $this->assertSame('externalId', $errors->get(0)->getPropertyPath());
     $this->assertSame('created', $errors->get(1)->getPropertyPath());
     $this->assertSame('last4', $errors->get(2)->getPropertyPath());
     $this->assertSame('brand', $errors->get(3)->getPropertyPath());
     $this->assertSame('amount', $errors->get(4)->getPropertyPath());
     $this->assertSame('currency', $errors->get(5)->getPropertyPath());
     $this->assertSame('description', $errors->get(6)->getPropertyPath());
 }
Example #3
0
 public function getChargeResponse()
 {
     $chargeResponse = new ChargeResponse();
     $chargeResponse->setExternalId('ch_xxxxxxxxxxxxxx');
     $chargeResponse->setAmount(2000);
     $chargeResponse->setLast4('4242');
     $chargeResponse->setBrand('Visa');
     $chargeResponse->setCurrency('usd');
     $chargeResponse->setDescription('*****@*****.**');
     $chargeResponse->setCreated(1420656887);
     return $chargeResponse;
 }
Example #4
0
 public function __construct(ChargeResponse $chargeResponse)
 {
     parent::__construct();
     $this->amount = $chargeResponse->getAmount();
     $this->chargeResponse = $chargeResponse;
 }