/** * {@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; }
public function testDefaultType() { $payment = new Payment(); $this->assertSame(Payment::TYPE_NORMAL, $payment->getType()); }