Exemple #1
0
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Form(self::WINDOW_URL);
     $currency = $this->getCurrencyCode($invoice);
     /* Mandatory input parameters: */
     $formKeyValues = array();
     $formKeyValues['merchant'] = $this->getConfig('merchant');
     $formKeyValues['amount'] = intval($invoice->first_total * 100);
     $formKeyValues['currency'] = $currency;
     $formKeyValues['orderid'] = $invoice->public_id;
     $formKeyValues['acceptReturnUrl'] = $this->getReturnUrl($request);
     /* Optional input parameters: */
     $formKeyValues['cancelreturnurl'] = $this->getCancelUrl($request);
     $formKeyValues['callbackurl'] = $this->getPluginUrl('ipn');
     $formKeyValues['language'] = $this->getConfig('lang');
     $formKeyValues['addFee'] = 1;
     $formKeyValues['capturenow'] = 1;
     /* Invoice's parameters: */
     $formKeyValues['oiTypes'] = 'QUANTITY;DESCRIPTION;AMOUNT;ITEMID';
     $formKeyValues['oiNames'] = 'Items;Description;Amount;ItemId';
     $i = 0;
     foreach ($invoice->getItems() as $item) {
         $row_name = "oiRow" . ++$i;
         $formKeyValues[$row_name] = $item->qty . ";" . $item->item_title . ";" . intval($item->first_total * 100) . ";" . $item->item_id;
     }
     if ($this->getConfig('test')) {
         $formKeyValues['test'] = 1;
     }
     foreach ($formKeyValues as $k => $v) {
         $a->addParam($k, $v);
     }
     $a->addParam('MAC', $this->calculateMac($formKeyValues, $this->getConfig('hmackey')));
     $result->setAction($a);
 }
Exemple #2
0
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Form(self::URL);
     $data = array('ik_co_id' => $this->getConfig('co_id'), 'ik_pm_no' => $invoice->public_id, 'ik_cur' => $invoice->currency, 'ik_am' => $invoice->first_total, 'ik_am_ed' => 0, 'ik_desc' => $invoice->getLineDescription(), 'ik_usr' => $invoice->getUser()->email, 'ik_ia_u' => $this->getPluginUrl('ipn'), 'ik_suc_u' => $this->getReturnUrl(), 'ik_fal_u' => $this->getCancelUrl(), 'ik_x_invoice' => $invoice->public_id);
     $data['ik_sign'] = $this->sign($data);
     foreach ($data as $k => $v) {
         $a->addParam($k, $v);
     }
     $result->setAction($a);
 }
Exemple #3
0
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Form(self::URL);
     $params = array('jp_item_type' => 'cart', 'jp_item_name' => $invoice->getLineDescription(), 'order_id' => $invoice->public_id, 'jp_business' => $this->getConfig('business'), 'jp_payee' => $invoice->getEmail(), 'jp_shipping' => '', 'jp_amount_1' => $invoice->currency == 'KES' ? $invoice->first_total : $this->exchange($invoice->first_total), 'jp_amount_2' => 0, 'jp_amount_5' => $invoice->currency == 'USD' ? $invoice->first_total : 0, 'jp_rurl' => $this->getPluginUrl('thanks'), 'jp_furl' => $this->getCancelUrl(), 'jp_curl' => $this->getCancelUrl());
     $invoice->data()->set('jambopay-terms-KES', $params['jp_amount_1']);
     $invoice->data()->set('jambopay-terms-USD', $params['jp_amount_5']);
     $invoice->save();
     foreach ($params as $k => $v) {
         $a->addParam($k, $v);
     }
     $result->setAction($a);
 }
Exemple #4
0
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $user = $invoice->getUser();
     if ($this->getConfig('dynamic_pricing')) {
         $req = new Am_HttpRequest('http://srs.segpay.com/PricingHash/PricingHash.svc/GetDynamicTrans?value=' . $invoice->first_total, Am_HttpRequest::METHOD_GET);
         $res = $req->send();
         $action = new Am_Paysystem_Action_Redirect($this->getActionURL($invoice) . '&dynamictrans=' . strip_tags($res->getBody()));
         $action->amount = $invoice->first_total;
         $action->addParam('publicid', $invoice->public_id);
         $action->publicid = $invoice->public_id;
         $action->addParam('x-billname', $user->getName());
         $action->addParam('x-billemail', $user->email);
         $action->addParam('x-billaddr', $user->street);
         $action->addParam('x-billcity', $user->city);
         $action->addParam('x-billzip', $user->zip);
         $action->addParam('x-billcntry', $user->country);
         $action->addParam('x-billstate', $user->state);
         $action->addParam('x-auth-link', $this->getReturnUrl($request));
         $action->addParam('x-decl-link', $this->getCancelUrl($request));
     } else {
         $action = new Am_Paysystem_Action_Form($this->getActionURL($invoice));
         $action->addParam('x-billname', $user->getName());
         $action->addParam('x-billemail', $user->email);
         $action->addParam('x-billaddr', $user->street);
         $action->addParam('x-billcity', $user->city);
         $action->addParam('x-billzip', $user->zip);
         $action->addParam('x-billcntry', $user->country);
         $action->addParam('x-billstate', $user->state);
         $action->addParam('x-auth-link', $this->getReturnUrl($request));
         $action->addParam('x-decl-link', $this->getCancelUrl($request));
         $action->addParam('username', $invoice->getLogin());
         $action->addParam('publicid', $invoice->public_id);
     }
     $result->setAction($action);
 }