/**
  * {@inheritdoc}
  */
 public function handleRequest(Config $config)
 {
     $parameters = parent::handleRequest($config);
     // If payment is of type boleto, lets unset it
     if ($this->payment->getType() === Payment::TYPE_BOLETO) {
         unset($parameters['ep_type']);
     }
     $parameters = array_merge($parameters, array('ep_rec' => 'yes', 'ep_rec_freq' => $this->payment->getFrequency()));
     if ($this->returnUrl) {
         $parameters['ep_rec_url'] = $this->returnUrl;
     }
     return $parameters;
 }
 public function testMotoPayment()
 {
     $payment = new Payment();
     $payment->setType(Payment::TYPE_MOTO);
     $payment->setValue(10);
     $payment->setKey('key');
     $request = new CreatePayment($payment);
     $params = $request->handleRequest($this->getConfig());
     $this->assertTrue(is_array($params));
     $this->assertCount(9, $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('moto', $params['ep_type']);
     $this->assertSame('10', $params['t_value']);
     $this->assertSame('key', $params['t_key']);
 }