Example #1
0
 /**
  * @Given the store allows paying :paymentMethodName
  */
 public function storeAllowsPaying($paymentMethodName)
 {
     $paymentMethod = $this->paymentMethodFactory->createNew();
     $paymentMethod->setCode('PM_' . $paymentMethodName);
     $paymentMethod->setName(ucfirst($paymentMethodName));
     $paymentMethod->setGateway($this->paymentMethodNameToGatewayConverter->convert($paymentMethodName));
     $paymentMethod->setDescription('Payment method');
     $channel = $this->sharedStorage->get('channel');
     $channel->addPaymentMethod($paymentMethod);
     $this->paymentMethodRepository->add($paymentMethod);
 }
Example #2
0
 /**
  * @param string $name
  * @param string $code
  *
  * @return PaymentMethodInterface
  */
 private function createPaymentMethodFromNameAndCode($name, $code)
 {
     /** @var PaymentMethodInterface $paymentMethod */
     $paymentMethod = $this->paymentMethodFactory->createNew();
     $paymentMethod->setName($name);
     $paymentMethod->setCode($code);
     $paymentMethod->setGateway($this->paymentMethodNameToGatewayConverter->convert($name));
     return $paymentMethod;
 }
Example #3
0
 /**
  * @param string $name
  * @param string $code
  * @param bool $addForCurrentChannel
  * @param string $description
  */
 private function createPaymentMethodFromNameAndCode($name, $code, $description = '', $addForCurrentChannel = true)
 {
     /** @var PaymentMethodInterface $paymentMethod */
     $paymentMethod = $this->paymentMethodFactory->createNew();
     $paymentMethod->setName(ucfirst($name));
     $paymentMethod->setCode($code);
     $paymentMethod->setGateway($this->paymentMethodNameToGatewayConverter->convert($name));
     $paymentMethod->setDescription($description);
     if ($addForCurrentChannel && $this->sharedStorage->has('channel')) {
         $channel = $this->sharedStorage->get('channel');
         $channel->addPaymentMethod($paymentMethod);
     }
     $this->sharedStorage->set('payment_method', $paymentMethod);
     $this->paymentMethodRepository->add($paymentMethod);
 }