Exemplo n.º 1
0
 function purchase(IOrder $order, StandardWebInterface $web)
 {
     $options = array();
     $options['itemCode'] = $order->getItem();
     $options['notificationURL'] = $web->payment_build_url('ipn');
     $options['redirectURL'] = $web->payment_build_url('success');
     $pos_data = implode('|', array($order->getName(), $order->getItem()));
     $invoice = $this->bitPay->createInvoice($order->getId(), $order->getAmmount(), $pos_data, $options);
     return new Redirect($invoice->url);
 }
Exemplo n.º 2
0
 function purchase(IOrder $order, StandardWebInterface $web)
 {
     $this->client->add_field('ap_returnurl', $web->payment_build_url('success'));
     $this->client->add_field('ap_cancelurl', $web->payment_build_url('cancel'));
     $this->client->add_field('notify_url', $web->payment_build_url('ipn'));
     if ($order->getName()) {
         $this->client->add_field('ap_itemname', $order->getName());
     }
     $this->client->add_field('ap_amount', $order->getAmmount());
     if ($order->getItem()) {
         $this->client->add_field('ap_itemcode', $order->getItem());
     }
     $this->client->add_field('apc_1', $_SERVER['REMOTE_ADDR']);
     $this->client->submit();
 }
Exemplo n.º 3
0
 function purchase(IOrder $order, StandardWebInterface $web)
 {
     $this->client->add_field('return', $web->payment_build_url('success'));
     $this->client->add_field('cancel_return', $web->payment_build_url('cancel'));
     if ($order->getName()) {
         $this->client->add_field('item_name', $order->getName());
     }
     $this->client->add_field('amount', $order->getAmmount());
     if ($order->getItem()) {
         $this->client->add_field('item_number', $order->getItem());
     }
     $this->client->add_field('custom', $_SERVER['REMOTE_ADDR']);
     //todo iterate extra
     $this->client->add_field('noshipping', 1);
     $this->client->submit_paypal_post();
 }
Exemplo n.º 4
0
 function payment_action(IPaymentModule $system, StandardWebInterface $web)
 {
     $action = $web->payment_get_action();
     switch ($action) {
         case 'ipn':
             try {
                 $msg = $system->ipn();
             } catch (\Exception $ex) {
                 $msg = new IPNErrorMessage($ex->getMessage());
             }
             if ($msg) {
                 return $this->payment_handle($msg);
             }
             return 'ipn_error';
         case 'success':
         case 'cancel':
             return $action;
         default:
             return new FileNotFound();
     }
 }