Beispiel #1
0
 public function testGettersSetters()
 {
     $customerInfo = new CustomerInfo();
     $payment = new Payment();
     $payment->setValue(1.23);
     $payment->setKey('secret');
     $payment->setMaxDate('2014-11-29');
     $payment->setCustomerInfo($customerInfo);
     $this->assertSame(1.23, $payment->getValue());
     $this->assertSame('secret', $payment->getKey());
     $this->assertSame('2014-11-29', $payment->getMaxDate());
     $this->assertSame($customerInfo, $payment->getCustomerInfo());
 }
 /**
  * {@inheritdoc}
  */
 public function handleRequest(Config $config)
 {
     $parameters = array('ep_cin' => $config->getCin(), 'ep_user' => $config->getUser(), 'ep_entity' => $config->getEntity(), 'ep_language' => $config->getLanguage(), 'ep_country' => $config->getCountry(), 'ep_ref_type' => 'auto', 't_value' => strval($this->payment->getValue()), 't_key' => $this->payment->getKey());
     if ($this->payment->getCustomerInfo() instanceof CustomerInfo) {
         $parameters = array_merge($parameters, $this->payment->getCustomerInfo()->toArray());
     }
     // Optional authentication code
     if ($config->getCode()) {
         $parameters['s_code'] = $config->getCode();
     }
     // Optional maximum date for payment acceptance
     if ($this->payment->getMaxDate()) {
         $parameters['o_max_date'] = $this->payment->getMaxDate();
         $parameters['ep_partner'] = $config->getUser();
     }
     switch ($this->payment->getType()) {
         case Payment::TYPE_BOLETO:
         case Payment::TYPE_MOTO:
             $parameters['ep_type'] = $this->payment->getType();
             break;
     }
     return $parameters;
 }