コード例 #1
0
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Redirect($this->getConfig('testing') ? self::TEST_URL : self::URL);
     $a->instId = $this->getConfig('installation_id');
     $a->cartId = $invoice->public_id;
     $a->currency = $invoice->currency;
     $a->desc = $invoice->getLineDescription();
     $a->email = $invoice->getEmail();
     $a->name = $invoice->getName();
     $a->address = $invoice->getStreet();
     $a->city = $invoice->getCity();
     $a->state = $invoice->getState();
     $a->postcode = $invoice->getZip();
     //$a->MC_callback = preg_replace('|^https?://|', '', $this->getPluginUrl('ipn'));
     $a->amount = $invoice->first_total;
     if ($this->getConfig('testing')) {
         $a->testMode = 100;
         $a->name = 'CAPTURE';
     }
     if ($invoice->rebill_times) {
         if ($invoice->rebill_times != IProduct::RECURRING_REBILLS) {
             $a->noOfPayments = $invoice->rebill_times;
         }
         $a->futurePayType = 'regular';
         list($c, $u) = $this->period2Wp($invoice->second_period);
         $a->intervalUnit = $u;
         $a->intervalMult = $c;
         $a->normalAmount = $invoice->second_total;
         $a->option = 0;
         list($c, $u) = $this->period2Wp($invoice->first_period);
         $a->startDelayMult = $c;
         $a->startDelayUnit = $u;
     }
     $result->setAction($a);
 }
コード例 #2
0
 /**
  * Drop invoice
  * invoices shuld not be dropped, only drafts
  *
  * @param void
  * @return null
  */
 function delete()
 {
     if ($this->active_invoice->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if (!$this->active_invoice->canDelete($this->logged_user)) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     if ($this->request->isSubmitted()) {
         db_begin_work();
         $delete = $this->active_invoice->delete();
         if ($delete && !is_error($delete)) {
             db_commit();
             flash_success(':invoice has been deleted', array('invoice' => $this->active_invoice->getName()));
         } else {
             db_rollback();
             flash_error('Failed to delete :invoice', array('invoice' => $this->active_invoice->getName()));
         }
         // if
         $this->redirectTo('invoices');
     } else {
         $this->httpError(HTTP_ERR_BAD_REQUEST);
     }
     // if
 }
コード例 #3
0
ファイル: paypoint.php プロジェクト: grlf/eyedock
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Redirect(self::URL);
     $a->merchant = $this->getConfig('merchant');
     $a->trans_id = $invoice->public_id;
     $a->amount = $invoice->first_total;
     $a->callback = $this->getPluginUrl('thanks');
     $a->digest = $this->calculateDigest($a);
     $a->bill_addr_1 = $invoice->getStreet();
     $a->bill_city = $invoice->getCity();
     $a->bill_country = $invoice->getCountry();
     $a->bill_email = $invoice->getEmail();
     $a->bill_name = $invoice->getName();
     $a->bill_post_code = $invoice->getZip();
     $a->bill_state = $invoice->getState();
     $a->bill_tel = $invoice->getPhone();
     $a->currency = $invoice->currency;
     $a->options = "cb_post=true,md_flds=trans_id:amount:callback";
     if ($invoice->rebill_times) {
         // Recurring payment;
         $a->repeat = sprintf("%s/%s/%s:%s", gmdate('Ymd', strtotime($invoice->calculateRebillDate(1))), $this->getPeriod($invoice->second_period), $invoice->rebill_times == IProduct::RECURRING_REBILLS ? '-1' : $invoice->rebill_times, $invoice->second_total);
         $a->repeat_callback = $a->callback;
     }
     if ($this->getConfig('testing')) {
         $a->test_status = 'true';
     }
     $result->setAction($a);
 }
コード例 #4
0
ファイル: epoch.php プロジェクト: alexanderTsig/arabic
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Form(self::URL);
     $a->co_code = $this->getConfig('co_code');
     $a->pi_code = $invoice->getItem(0)->getBillingPlanData('epoch_product_id');
     if ($site_subcat = $invoice->getItem(0)->getBillingPlanData('epoch_site_subcat')) {
         $a->site_subcat = $site_subcat;
     }
     $a->reseller = 'a';
     $a->zip = $invoice->getZip();
     $a->email = $invoice->getEmail();
     $a->country = $invoice->getCountry();
     $a->no_userpass = self::YES;
     $a->name = $invoice->getName();
     $a->street = $invoice->getStreet();
     $a->phone = $invoice->getPhone();
     $a->city = $invoice->getCity();
     $a->state = $invoice->getState();
     $a->pi_returnurl = $this->getPluginUrl("thanks");
     $a->response_post = self::YES;
     $a->x_payment_id = $invoice->public_id;
     if ($this->getConfig('ach_form') == self::YES) {
         $a->ach_form = self::YES;
     }
     $result->setAction($a);
 }
コード例 #5
0
ファイル: PaypalApiRequest.php プロジェクト: grlf/eyedock
 function setShippingAddress(Invoice $invoice)
 {
     $this->addPostParameter('SHIPTONAME', $invoice->getName());
     $this->addPostParameter('SHIPTOSTREET', $invoice->getStreet());
     $this->addPostParameter('SHIPTOCITY', $invoice->getCity());
     $this->addPostParameter('SHIPTOSTATE', $invoice->getState());
     $this->addPostParameter('SHIPTOZIP', $invoice->getZip());
     $this->addPostParameter('SHIPTOCOUNTRY', $invoice->getCountry());
     $this->addPostParameter('SHIPTOPHONENUM', $invoice->getPhone());
 }
コード例 #6
0
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Redirect($this->url);
     $a->link = sprintf('%s/%d/%s', $this->getConfig('account'), $this->invoice->getItem(0)->getBillingPlanData('clickbank_product_id'), $this->invoice->getLineDescription());
     $a->seed = $invoice->public_id;
     $a->name = $invoice->getName();
     $a->email = $invoice->getEmail();
     $a->country = $invoice->getCountry();
     $a->zipcode = $invoice->getZip();
     $a->filterEmpty();
     $result->setAction($a);
 }
コード例 #7
0
ファイル: multicards.php プロジェクト: grlf/eyedock
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Form(self::URL);
     $a->deferred_entry = 1;
     $a->mer_id = $this->getConfig('mer_id');
     $a->num_items = 1;
     $a->mer_url_idx = $this->getConfig('page_id');
     $a->item1_desc = $invoice->getLineDescription();
     $a->item1_price = $invoice->first_total;
     $a->item1_qty = 1;
     $a->user1 = $invoice->public_id;
     $a->user2 = $invoice->user_id;
     $a->cust_name = $invoice->getName();
     $a->cust_email = $invoice->getEmail();
     $a->card_name = $invoice->getName();
     $a->cust_address1 = $invoice->getStreet();
     $a->cust_city = $invoice->getCity();
     $a->cust_country = $invoice->getCountry();
     $a->cust_state = $invoice->getState();
     $a->cust_zip = $invoice->getZip();
     $result->setAction($a);
 }
コード例 #8
0
 /**
  * Render invoice PDF
  *
  * @param void
  * @return null
  */
 function pdf()
 {
     if ($this->active_invoice->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if ($this->active_invoice->getStatus() == INVOICE_STATUS_DRAFT) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     require_once INVOICING_MODULE_PATH . '/models/InvoicePdf.class.php';
     InvoicePDF::download($this->active_invoice, lang('#:invoice_id.pdf', array('invoice_id' => $this->active_invoice->getName())));
     die;
 }
コード例 #9
0
ファイル: Serializer.php プロジェクト: tomaj/invoice-client
 public function encodeInvoice(Invoice $invoice)
 {
     $data = ['id' => $invoice->getId(), 'number' => $invoice->getNumber(), 'name' => $invoice->getName(), 'created' => $invoice->getCreated(), 'delivered' => $invoice->getDelivered(), 'due' => $invoice->getDue(), 'status' => $invoice->getStatus(), 'variable_symbol' => $invoice->getVariableSymbol(), 'constant_symbol' => $invoice->getConstantSymbol(), 'description' => $invoice->getDescription(), 'items' => $this->encodeItems($invoice->getItems()), 'price' => $invoice->getPrice(), 'price_total' => $invoice->getPriceTotal(), 'currency' => $invoice->getCurrency()];
     if ($invoice->getClient()) {
         $data['client'] = $this->encodeClient($invoice->getClient());
     }
     if ($invoice->getShippingAddress()) {
         $data['shipping_address'] = $this->encodeAddress($invoice->getShippingAddress());
     }
     if ($invoice->getDiscount() && $invoice->getDiscount()->getType() != 'none') {
         $data['discount'] = ['type' => $invoice->getDiscount()->getType(), 'value' => $invoice->getDiscount()->getValue()];
     }
     return json_encode(['invoice' => $data]);
 }
コード例 #10
0
ファイル: internet-secure.php プロジェクト: irovast/eyedock
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Redirect(self::URL);
     $a->MerchantNumber = $this->getConfig('merchant_id');
     $a->Products = sprintf("%s::1::999::%s::", $invoice->first_total, $invoice->getLineDescription());
     $a->ReturnCGI = $this->getPluginUrl('thanks');
     $a->xxxName = $invoice->getName();
     $a->xxxAddress = $invoice->getStreet();
     $a->xxxCity = $invoice->getCity();
     $a->xxxProvince = $invoice->getState();
     $a->xxxCountry = $invoice->getCountry();
     $a->xxxPostal = $invoice->getZip();
     $a->xxxEmail = $invoice->getEmail();
     $a->xxxVar1 = $invoice->public_id;
     if ($this->getConfig('testing')) {
         $a->Products .= '{TEST}';
     }
     $result->setAction($a);
 }
コード例 #11
0
ファイル: ccnow.php プロジェクト: alexanderTsig/arabic
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Form(self::URL_LIVE);
     $result->setAction($a);
     $sequence = rand(1, 1000);
     $vars = array('x_version' => '1.0', 'x_login' => $this->getConfig('login'), 'x_invoice_num' => $invoice->public_id, 'x_method' => $this->getConfig('testmode') ? 'TEST' : 'NONE', 'x_name' => $invoice->getName(), 'x_address' => $invoice->getStreet(), 'x_address2' => $invoice->getStreet2(), 'x_city' => $invoice->getCity(), 'x_country' => $invoice->getCountry(), 'x_state' => $invoice->getState(), 'x_zip' => $invoice->getZip(), 'x_email' => $invoice->getEmail(), 'x_currency_code' => $invoice->currency, 'x_amount' => $price = sprintf('%.2f', $invoice->first_total), 'x_tax_amount' => $tprice = sprintf('%.2f', $invoice->first_tax), 'x_fp_sequence' => $sequence, 'x_fp_arg_list' => 'x_login^x_fp_arg_list^x_fp_sequence^x_amount^x_currency_code', 'x_fp_hash' => '', 'x_fp_hash' => md5($q = $this->getConfig('login') . "^x_login^x_fp_arg_list^x_fp_sequence^x_amount^x_currency_code^" . $sequence . "^" . $price . "^" . $invoice->currency . "^" . $this->getConfig('key')));
     foreach ($invoice->getItems() as $kk => $item) {
         $k = $kk + 1;
         $vars['x_product_sku_' . $k] = $item->item_id;
         $vars['x_product_title_' . $k] = $item->item_title;
         $vars['x_product_quantity_' . $k] = $item->qty;
         $vars['x_product_unitprice_' . $k] = $item->first_total;
         $vars['x_product_url_' . $k] = ROOT_URL;
     }
     foreach ($vars as $k => $v) {
         $a->addParam($k, $v);
     }
     $result->setAction($a);
 }
コード例 #12
0
ファイル: payflow-link.php プロジェクト: grlf/eyedock
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Redirect(self::URL);
     $a->LOGIN = $this->getConfig('login');
     $a->PARTNER = $this->getConfig('partner');
     $a->AMOUNT = sprintf('%.2f', $invoice->first_total);
     $a->TYPE = 'S';
     $a->INVOICE = $invoice->public_id;
     $a->DESCRIPTION = $invoice->getLineDescription();
     $a->NAME = $invoice->getName();
     $a->ADDRESS = $invoice->getStreet();
     $a->CITY = $invoice->getCity();
     $a->STATE = $invoice->getState();
     $a->COUNTRY = $invoice->getCountry();
     $a->ZIP = $invoice->getZip();
     $a->EMAIL = $invoice->getEmail();
     $a->PHONE = $invoice->getPhone();
     $result->setAction($a);
 }
コード例 #13
0
 /**
  * Generate invoice
  * 
  * @param void
  * @return void
  */
 function generate()
 {
     if (!instance_of($this->invoice, 'Invoice')) {
         new Error('Invoice object is not specified', true);
     }
     // if
     $this->SetTitle($this->invoice->getName(), true);
     $this->SetAuthor('activeCollab (http://www.activecollab.com/)');
     $this->SetAutoPageBreak(true, 20);
     $this->AddPage($this->paper_orientation, $this->paper_format);
     $this->SetFont('', '', 12);
     $rgb = $this->convertHTMLColorToDec($this->getBorderColor());
     $this->SetDrawColor($rgb['R'], $rgb['G'], $rgb['B']);
     $rgb = $this->convertHTMLColorToDec($this->getBackgroundColor());
     $this->SetFillColor($rgb['R'], $rgb['G'], $rgb['B']);
     $this->tMargin = 15;
     // draw invoice header
     $this->drawInvoiceHeaderBlock();
     // draw horizontal line
     $this->drawWhiteSpace(5);
     $this->drawHorizontalLine();
     // draw invoice details
     $this->drawWhiteSpace(10);
     $this->drawInvoiceDetailsBlock();
     // draw items table
     $this->drawWhiteSpace(20);
     $this->drawItemsTableHeader();
     $this->drawItemsTableRows();
     // draw invoice totals
     $this->drawWhiteSpace(10);
     $this->drawInvoiceTotals();
     // draw invoice note
     $this->drawWhiteSpace(10);
     $this->drawInvoiceNote();
     $this->AliasNbPages();
 }
コード例 #14
0
ファイル: molpay.php プロジェクト: grlf/eyedock
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     /*
     Payment Method - Identity
     
      * Credit Payment
     Visa & Mastercard (default) - index.php
     Mobile Money                - mobilemoney.php
     Ezeelink                    - ezeelink.php
     
      * Debit Payment
     Maybank2u Fund Transfer - maybank2u.php
     MEPS FPX                - fpx.php
     CIMB Clicks             - cimb.php
     RHB Online              - rhb.php
     Hong Leong Bank Online  - hlb.php
     Mepscash Online         - mepscash.php
     Webcash                 - webcash.php
     */
     $Payment_Method = '';
     $url = sprintf($this->url, $this->getConfig('merchant_id'), $Payment_Method);
     $a = new Am_Paysystem_Action_Redirect($url);
     $a->amount = $invoice->first_total;
     $a->orderid = $invoice->public_id;
     $a->bill_name = utf8_encode($invoice->getName());
     //UTF-8 encoding is recommended for Chinese contents
     $a->bill_email = $invoice->getEmail();
     $a->bill_mobile = $invoice->getPhone();
     $a->cur = $invoice->getCurrency();
     $a->bill_desc = utf8_encode($invoice->getLineDescription());
     //UTF-8 encoding is recommended for Chinese contents
     $a->returnurl = $this->getPluginUrl('thanks');
     $a->vcode = md5($invoice->first_total . $this->getConfig('merchant_id') . $invoice->public_id . $this->getConfig('verify_key'));
     $a->filterEmpty();
     $result->setAction($a);
 }