コード例 #1
0
ファイル: Cash.php プロジェクト: miteshchavada/clubmaster
    public function onPaymentMethodGet(\Club\ShopBundle\Event\FilterPaymentMethodEvent $event)
    {
        $name = 'Cash';
        $controller = $this->container->getParameter('club_payment_cash.controller');
        $online_payment = false;
        $credentials = $event->getCredentials();
        if (isset($credentials['online_payment']) && $credentials['online_payment'] != $online_payment) {
            return;
        }
        $method = $this->em->getRepository('ClubShopBundle:PaymentMethod')->findOneBy(array('controller' => $controller));
        if (!$method) {
            $method = new \Club\ShopBundle\Entity\PaymentMethod();
            $method->setPaymentMethodName($name);
            $method->setController($controller);
            $method->setSuccessPage(<<<EOF
<h2>Thank you</h2>
<p>Your order has been successful completed.</p>
<p>We will complete your order as soon as we receive the payment.</p>
EOF
);
            $method->setErrorPage(<<<EOF
<h2>Sorry</h2>
  <p>Your order has not been completed.</p>
  <p>There was a problem with the payment.</p>
EOF
);
            $this->em->persist($method);
            $this->em->flush();
        }
        $event->addMethod($method);
    }
コード例 #2
0
 public function load($manager)
 {
     $payment = new \Club\ShopBundle\Entity\PaymentMethod();
     $payment->setPaymentMethodName('Cash');
     $payment->setPage('<h2>Thank you</h2><p>Your order has been successful completed.</p><p>We will complete your order as soon as we receive the payment.</p>');
     $manager->persist($payment);
     $manager->flush();
 }