Exemplo n.º 1
0
 public function testToArray()
 {
     $customerInfo = new CustomerInfo();
     $customerInfo->setName('John Doe')->setDescription('Payment #1')->setObservation('test')->setMobile('800600600')->setEmail('*****@*****.**');
     $marshall = $customerInfo->toArray();
     $this->assertTrue(is_array($marshall));
     $this->assertCount(5, array_values($marshall));
     $this->assertEquals('John Doe', $customerInfo->getName());
     $this->assertEquals('John Doe', $marshall['o_name']);
     $this->assertEquals('Payment #1', $customerInfo->getDescription());
     $this->assertEquals('Payment #1', $marshall['o_description']);
     $this->assertEquals('test', $customerInfo->getObservation());
     $this->assertEquals('test', $marshall['o_obs']);
     $this->assertEquals('800600600', $customerInfo->getMobile());
     $this->assertEquals('800600600', $marshall['o_mobile']);
     $this->assertEquals('*****@*****.**', $customerInfo->getEmail());
     $this->assertEquals('*****@*****.**', $marshall['o_email']);
 }
 public function testCustomerInfo()
 {
     $customerInfo = new CustomerInfo();
     $customerInfo->setName('John Doe')->setDescription('Payment #1')->setObservation('test')->setMobile('800600600')->setEmail('*****@*****.**');
     $payment = new RecurringPayment();
     $payment->setValue(10);
     $payment->setFrequency(RecurringPayment::DAILY);
     $payment->setKey('key');
     $payment->setCustomerInfo($customerInfo);
     $request = new CreateRecurringPayment($payment);
     $params = $request->handleRequest($this->getConfig());
     $this->assertTrue(is_array($params));
     $this->assertCount(15, $params);
     $this->assertSame('cin', $params['ep_cin']);
     $this->assertSame('user', $params['ep_user']);
     $this->assertSame('entity', $params['ep_entity']);
     $this->assertSame('language', $params['ep_language']);
     $this->assertSame('country', $params['ep_country']);
     $this->assertSame('auto', $params['ep_ref_type']);
     $this->assertSame('10', $params['t_value']);
     $this->assertSame('key', $params['t_key']);
     $this->assertSame('yes', $params['ep_rec']);
     $this->assertSame('1D', $params['ep_rec_freq']);
     $this->assertSame('John Doe', $params['o_name']);
     $this->assertSame('Payment #1', $params['o_description']);
     $this->assertSame('test', $params['o_obs']);
     $this->assertSame('800600600', $params['o_mobile']);
     $this->assertSame('*****@*****.**', $params['o_email']);
 }