Example #1
0
 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);
 }
Example #2
0
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     if (count($invoice->getItems()) > 1) {
         throw new Am_Exception_InternalError('Only one product at invoice is allowed');
     }
     $bp = $this->getDi()->billingPlanTable->load($invoice->getItem(0)->billing_plan_id);
     if (!($campaignId = $bp->data()->get(self::JP_CAMPAIGN_ID))) {
         throw new Am_Exception_InternalError("Product #{$invoice->getItem(0)->item_id} cannot be paid by junglepay - has no Campaign ID");
     }
     $a = new Am_Paysystem_Action_HtmlTemplate_Junglepay($this->getDir(), 'payment-junglepay-iframe.phtml');
     $a->wkey = $campaignId;
     $a->refererId = $invoice->public_id;
     $result->setAction($a);
 }
Example #3
0
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $product = $this->getDi()->productTable->load($invoice->getItem(0)->item_id);
     $billers = json_decode($product->data()->getBlob('sliiing_billers'), true);
     if (!@count($billers['options'])) {
         $this->getDi()->errorLogTable->log("SLIING ERROR : please add billers for product #" . $product->pk());
         throw new Am_Exception_InputError('An error occurred while payment request');
     } elseif (count($billers['options']) == 1) {
         //redirect
         $aff = '0';
         $lin = '0';
         $refe_url = '0';
         $ip = '0';
         $keyword = '0';
         if (isset($_COOKIE['MID'])) {
             $mid = base64_decode($_COOKIE['MID']);
             list($aff, $lin, $refe_url, $ip, $keyword) = explode('|', $mid);
         }
         $datas = base64_encode("{$aff}|{$lin}|{$refe_url}|{$ip}|{$keyword}");
         $url = $billers['options'][0];
         $url = str_replace('$datas', $datas, $url);
         $a = new Am_Paysystem_Action_Redirect($url);
         $a->x_invoice_id = $invoice->public_id;
         $a->username = $invoice->getUser()->login;
         $a->email = urlencode($invoice->getUser()->email);
         $result->setAction($a);
     } else {
         //show form
         $a = new Am_Paysystem_Action_HtmlTemplate_Sliiing($this->getDir(), 'sliiing-confirm.phtml');
         $a->action = $this->getPluginUrl('confirm');
         $a->billers = $billers;
         $a->invoice = $invoice;
         $result->setAction($a);
     }
 }
Example #4
0
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Redirect(self::URL);
     $a->products = current(array_filter(array($invoice->getItem(0)->getBillingPlanData('paypro_product_id'), $this->getConfig('product_id'))));
     $id = $this->invoice->getSecureId("THANKS");
     $desc = array();
     foreach ($invoice->getItems() as $it) {
         if ($it->first_total > 0) {
             $desc[] = $it->item_title;
         }
     }
     $desc = implode(',', $desc);
     $desc .= ". (invoice: {$id})";
     $name = $invoice->getLineDescription();
     $hash = "price={$invoice->first_total}-{$invoice->currency}^^^name={$name}^^^desc={$desc}";
     $a->hash = base64_encode($this->getHash($hash));
     $a->CustomField1 = $invoice->public_id;
     $a->firstname = $invoice->getFirstName();
     $a->Lastname = $invoice->getLastName();
     $a->Email = $invoice->getEmail();
     $a->Address = $invoice->getStreet();
     $a->City = $invoice->getCity();
     $a->Country = $invoice->getCountry() == 'GB' ? 'united kingdom' : $invoice->getCountry();
     $a->State = $invoice->getState();
     $a->Zipcode = $invoice->getZip();
     $a->Phone = $invoice->getPhone();
     //$a->lnk = $this->getCancelUrl();
     $result->setAction($a);
 }
Example #5
0
 function getActionUrl(Invoice $invoice)
 {
     $url = "http://sites.fastspring.com/%s/product/%s";
     if ($this->getConfig('instant') == 1) {
         $url = "https://sites.fastspring.com/%s/instant/%s";
     }
     return sprintf($url, $this->getConfig('company'), $invoice->getItem(0)->getBillingPlanData('fastspring_product_id'));
 }
Example #6
0
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Redirect($this->getConfig('testing') ? self::SANDBOX_URL : self::LIVE_URL);
     $a->merchant_id = $this->getConfig('merchant_id');
     $a->merchant_site_id = $this->getConfig('merchant_site_id');
     $a->currency = $invoice->currency;
     $a->version = '3.0.0';
     $a->merchant_unique_id = $invoice->public_id;
     $a->first_name = $invoice->getFirstName();
     $a->last_name = $invoice->getLastName();
     $a->email = $invoice->getEmail();
     $a->address1 = $invoice->getStreet();
     $a->address2 = $invoice->getStreet1();
     $a->city = $invoice->getCity();
     $a->country = $invoice->getCountry();
     $a->state = $invoice->getState();
     $a->zip = $invoice->getZip();
     $a->phone1 = $invoice->getPhone();
     $a->time_stamp = date("Y-m-d.h:i:s");
     if ($invoice->rebill_times && ($gate2shop_id = $invoice->getItem(0)->getBillingPlanData('gate2shop_id')) && ($gate2shop_template_id = $invoice->getItem(0)->getBillingPlanData('gate2shop_template_id'))) {
         $a->productId = $invoice->getItem(0)->item_id;
         $a->rebillingProductId = $gate2shop_id;
         $a->rebillingTemplateId = $gate2shop_template_id;
         if ($invoice->rebill_times) {
             $a->isRebilling = 'true';
         }
         $a->checksum = md5($this->getConfig('secret_key') . $this->getConfig('merchant_id') . $gate2shop_id . $gate2shop_template_id . $a->time_stamp);
     } else {
         $a->total_amount = $invoice->first_total;
         $a->discount = $invoice->first_discount;
         $a->total_tax = $invoice->first_tax;
         $a->numberofitems = count($invoice->getItems());
         for ($i = 0; $i < $a->numberofitems; $i++) {
             $item = $invoice->getItem($i);
             $a->addParam('item_name_' . ($i + 1), $item->item_title);
             $a->addParam('item_number_' . ($i + 1), $i + 1);
             $a->addParam('item_amount_' . ($i + 1), $item->first_price);
             $a->addParam('item_discount_' . ($i + 1), $item->first_discount);
             $a->addParam('item_quantity_' . ($i + 1), $item->qty);
         }
         $a->checksum = $this->calculateOutgoingHash($a, $invoice);
     }
     $a->filterEmpty();
     $result->setAction($a);
 }
Example #7
0
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $user = $invoice->getUser();
     $subaccount_id = $invoice->getItem(0)->getBillingPlanData("ccbill_subaccount_id") ? $invoice->getItem(0)->getBillingPlanData("ccbill_subaccount_id") : $this->getConfig('subaccount_id');
     $a = new Am_Paysystem_Action_Redirect(self::URL);
     $a->clientAccnum = $this->getConfig('account');
     $a->clientSubacc = $subaccount_id;
     $a->formName = $invoice->getItem(0)->getBillingPlanData("ccbill_form_id");
     $a->username = $user->login;
     $a->email = $invoice->getEmail();
     $a->customer_fname = $invoice->getFirstName();
     $a->customer_lname = $invoice->getLastName();
     $a->address1 = $invoice->getStreet();
     $a->city = $invoice->getCity();
     $a->state = $invoice->getState();
     $a->zipcode = $invoice->getZip();
     $a->country = $invoice->getCountry();
     $a->phone_number = $invoice->getPhone();
     $a->payment_id = $invoice->public_id;
     $a->customVar1 = $invoice->public_id;
     $a->invoice = $invoice->getSecureId("THANKS");
     $a->referer = $invoice->getUser()->aff_id;
     if ($this->getConfig('dynamic_pricing')) {
         $a->formPrice = $invoice->first_total;
         $a->formPeriod = $this->getDays($invoice->first_period);
         $a->currencyCode = $invoice->currency;
         if ($invoice->rebill_times) {
             if ($invoice->rebill_times == IProduct::RECURRING_REBILLS) {
                 $invoice->rebill_times = 99;
             }
             $a->formRecurringPrice = $invoice->second_total;
             $a->formRecurringPeriod = $this->getDays($invoice->second_period);
             $a->formRebills = $invoice->rebill_times;
             $a->formDigest = md5($s = $invoice->first_total . $this->getDays($invoice->first_period) . $invoice->second_total . $this->getDays($invoice->second_period) . $invoice->rebill_times . $invoice->currency . $this->getConfig('salt'));
         } else {
             $a->formDigest = md5($s = $invoice->first_total . $this->getDays($invoice->first_period) . $invoice->currency . $this->getConfig('salt'));
         }
     } else {
         $a->subscriptionTypeId = $invoice->getItem(0)->getBillingPlanData("ccbill_product_id");
         $a->allowedTypes = $invoice->getItem(0)->getBillingPlanData("ccbill_product_id");
         $a->allowedCurrencies = $this->currency_codes[$invoice->currency];
     }
     $result->setAction($a);
 }
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Redirect(self::URL);
     $result->setAction($a);
     $a->MerchantID = $this->config['merchant_id'];
     $a->ProductID = $invoice->getItem(0)->getBillingPlanData('1shoppingcart_id');
     $a->AMemberID = $invoice->invoice_id;
     $a->PostBackURL = $this->getDi()->config->get('root_url') . "/payment/1shoppingcart/ipn";
     $a->filterEmpty();
     $result->setAction($a);
 }
Example #9
0
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $user = $invoice->getUser();
     $subaccount_id = $invoice->getItem(0)->getBillingPlanData("ecsuite_subaccount_id") ? $invoice->getItem(0)->getBillingPlanData("ecsuite_subaccount_id") : $this->getConfig('subaccount_id');
     $a = new Am_Paysystem_Action_Redirect(self::URL);
     $a->clientAccnum = $this->getConfig('account');
     $a->clientSubacc = $subaccount_id;
     $a->subscriptionTypeId = $invoice->getItem(0)->getBillingPlanData("ecsuite_product_id");
     $a->allowedTypes = $invoice->getItem(0)->getBillingPlanData("ecsuite_product_id");
     $a->username = $user->login;
     $a->email = $invoice->getEmail();
     $a->customer_fname = $invoice->getFirstName();
     $a->customer_lname = $invoice->getLastName();
     $a->address1 = $invoice->getStreet();
     $a->city = $invoice->getCity();
     $a->state = $invoice->getState();
     $a->zipcode = $invoice->getZip();
     $a->country = $invoice->getCountry();
     $a->phone_number = $invoice->getPhone();
     $a->payment_id = $invoice->public_id;
     $a->formName = $invoice->getItem(0)->getBillingPlanData("ecsuite_form_id");
     $a->customVar1 = $invoice->public_id;
     $result->setAction($a);
 }
Example #10
0
 function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Redirect('https://clickbetter.com/pay/' . $invoice->getItem(0)->getBillingPlanData('clickbetter_prod_item'));
     $result->setAction($a);
     $a->api = 'yes';
     $a->custom1 = $invoice->public_id;
     $a->first_name = $invoice->getFirstName();
     $a->last_name = $invoice->getLastName();
     $a->email = $invoice->getEmail();
     $a->city = $invoice->getCity();
     $a->address = $invoice->getStreet();
     $a->phone_no = $invoice->getPhone();
     $a->country = $invoice->getCountry();
     $a->zip = $invoice->getZip();
 }
Example #11
0
 function getURL(Invoice $invoice)
 {
     /* 
      *	Added to fix long username problem.
      *	If username is over 15 characters we truncate it to 15 characters
      *	This helps resolve issue we had with safecart URL versus the IPN validation
      *	return sprintf("https://safecart.com/%s/%s/", $this->getConfig("username"), $invoice->getItem(0)->getBillingPlanData('safecart_product'));
      */
     if (strlen($this->getConfig("username")) > 15) {
         $username = substr($this->getConfig("username"), 0, 15);
     } else {
         $username = $this->getConfig("username");
     }
     return sprintf("https://safecart.com/%s/%s/", $username, $invoice->getItem(0)->getBillingPlanData('safecart_product'));
 }
Example #12
0
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     if ($this->getConfig('dynamic_pricing')) {
         $a = new Am_Paysystem_Action_Redirect(self::DYNAMIC_URL);
         $a->version = 1;
         $a->shopID = $this->getConfig('site_id');
         $a->priceAmount = $invoice->first_total;
         $a->priceCurrency = $invoice->currency;
         $a->description = $invoice->getLineDescription();
         $a->referenceID = $invoice->public_id;
         $a->signature = sha1($q = $this->getConfig('secret') . ":description=" . $invoice->getLineDescription() . ":priceAmount=" . $invoice->first_total . ":priceCurrency=" . $invoice->currency . ":referenceID=" . $invoice->public_id . ":shopID=" . $this->getConfig('site_id') . ":version=1");
     } else {
         $a = new Am_Paysystem_Action_Redirect(self::URL);
         $a->verotel_id = $this->getConfig('merchant_id');
         $a->verotel_product = $invoice->getItem(0)->getBillingPlanData("verotel_id") ? $invoice->getItem(0)->getBillingPlanData("verotel_id") : $this->getConfig('site_id');
         $a->verotel_website = $invoice->getItem(0)->getBillingPlanData("verotel_id") ? $invoice->getItem(0)->getBillingPlanData("verotel_id") : $this->getConfig('site_id');
         $a->verotel_usercode = $invoice->getLogin();
         $a->verotel_passcode = 'FromSignupForm';
         //$invoice->getUser()->getPlaintextPass();
         $a->verotel_custom1 = $invoice->public_id;
     }
     $a->filterEmpty();
     $result->setAction($a);
 }
Example #13
0
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Redirect($this->getConfig('testing') == self::MODE_SANDBOX ? self::TESTING_URL : self::URL);
     $a->contract_id = $invoice->getItem(0)->getBillingPlanData("plimus_contract_id");
     $a->custom1 = $invoice->public_id;
     $a->member_id = $invoice->user_id;
     $a->currency = strtoupper($invoice->currency);
     $a->firstName = $invoice->getFirstName();
     $a->lastName = $invoice->getLastName();
     $a->email = $invoice->getEmail();
     if ($this->getConfig('testing') == self::MODE_TEST) {
         $a->testMode = Y;
     }
     $a->filterEmpty();
     $result->setAction($a);
 }
Example #14
0
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Form($this->getConfig('testing') == self::MODE_SANDBOX ? self::TESTING_URL : self::URL);
     $a->contractId = $invoice->getItem(0)->getBillingPlanData("bluesnap_contract_id");
     $a->custom1 = $invoice->public_id;
     $a->member_id = $invoice->user_id;
     $a->currency = strtoupper($invoice->currency);
     $a->firstName = $invoice->getFirstName();
     $a->lastName = $invoice->getLastName();
     $a->email = $invoice->getEmail();
     $a->overridePrice = sprintf("%.2f", $invoice->first_total);
     $a->overrideRecurringPrice = sprintf("%.2f", $invoice->second_total);
     if ($this->getConfig('testing') == self::MODE_TEST) {
         $a->testMode = Y;
     }
     $a->filterEmpty();
     $result->setAction($a);
 }
Example #15
0
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Redirect(self::URL);
     $a->con = 'my_cart';
     $a->met = 'addToCart';
     $a->pid = $invoice->getItem(0)->getBillingPlanData('premiumwebcart_id');
     $a->pquantity = 1;
     $a->clearcart = 1;
     $a->action = 2;
     $a->fname = $invoice->getFirstName();
     $a->lname = $invoice->getLastName();
     $a->email = $invoice->getEmail();
     $a->baddress1 = $invoice->getStreet();
     $a->bcity = $invoice->getCity();
     $a->bzip = $invoice->getZip();
     $a->bstate = $invoice->getState();
     $a->bcountry = $invoice->getCountry();
     $a->custom1 = $invoice->public_id;
     $result->setAction($a);
 }
Example #16
0
 function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_HtmlTemplate_NetDebits($this->getDir(), 'payment-netdebit-redirect.phtml');
     $a->SID = $this->getConfig('SID');
     $a->PID = $this->getConfig('PID');
     $a->CON = $this->getConfig('CON');
     $a->VAR1 = $invoice->public_id;
     $a->ZAH = 2;
     $item = $invoice->getItem(0);
     $product_id = $item->item_id;
     $product = array_shift($this->getDi()->productTable->findByProductId($product_id));
     $a->POS = $product->data()->get(self::RATES);
     $a->KUN = $invoice->getUser()->data()->get(self::KNR) ? 1 : 0;
     $a->KNR = $invoice->getUser()->data()->get(self::KNR) ? $invoice->getUser()->data()->get(self::KNR) : '';
     if ($this->getConfig('testing')) {
         $a->F = 9090;
     } else {
         $a->F = 1000;
     }
     $result->setAction($a);
 }
Example #17
0
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     if (!($product = $invoice->getItem(0)->tryLoadProduct())) {
         throw new Am_Exception_InternalError("Product is not loaded from item");
     }
     if (!($zos = $product->data()->get(self::MONELIB_ZOS_FIELD))) {
         throw new Am_Exception_InternalError("This product is not assigned to Monelib Zone of Sale ID");
     }
     if (!($pos = $product->data()->get(self::MONELIB_POS_FIELD))) {
         throw new Am_Exception_InternalError("This product is not assigned to Monelib Point of Sale ID");
     }
     $a = new Am_Paysystem_Action_HtmlTemplate_Monelib($this->getDir(), 'monelib.phtml');
     $a->ext_frm_pos = $pos;
     $a->ext_frm_tpldiz = 'std_' . $this->getConfig('lang');
     $a->ext_frm_data0 = $invoice->public_id;
     $a->ext_frm_data1 = $zos;
     $a->action = $this->getUrl(self::URL_PURCHASE);
     $a->url_thanks = $this->getReturnUrl();
     if ($this->getConfig('use_image')) {
         $a->src = $this->getRootUrl() . "/application/default/plugins/payment/monelib/public/buyCode_" . $this->getConfig('lang') . ".png";
     }
     $result->setAction($a);
 }
Example #18
0
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $item = $invoice->getItem(0);
     $action = new Am_Paysystem_Action_Redirect(sprintf('http://%s/order/%s', $this->getConfig('domain'), $item->getBillingPlanData('justclick_id')));
     $result->setAction($action);
 }
Example #19
0
 public function getActionURL(Invoice $invoice)
 {
     return sprintf(self::URL . '?x-eticketid=%s:%s', $invoice->getItem(0)->getBillingPlanData('segpay_package_id') ? $invoice->getItem(0)->getBillingPlanData('segpay_package_id') : $this->getConfig('package_id'), $invoice->getItem(0)->getBillingPlanData('segpay_price_point_id'));
 }
Example #20
0
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $u = $invoice->getUser();
     $a = new Am_Paysystem_Action_Redirect(self::API_URL);
     /*
      */
     $params = array('aid' => $this->getConfig('aid'), 'portalid' => $this->getConfig('portalid'), 'mode' => $this->getConfig('testing') ? 'test' : 'live', 'encoding' => 'UTF-8', 'clearingtype' => 'cc', 'reference' => $invoice->public_id, 'customerid' => $invoice->user_id, 'invoiceid' => $invoice->public_id, 'param' => $invoice->public_id, 'successurl' => $this->getReturnUrl(), 'backurl' => $this->getCancelUrl());
     //Parameter („createaccess“)
     $first_period = new Am_Period($invoice->first_period);
     $params['request'] = 'createaccess';
     $params['productid'] = $invoice->getItem(0)->getBillingPlanData('payone_product_id');
     // + + N..7 ID for the offer
     $params['amount_trail'] = $invoice->first_total * 100;
     // - + N..6 Total price of all items during the initial term. Must equal the sum (quantity * price) of all items for the initial term (in the smallest currency unit, e.g. Cent).
     $params['period_unit_trail'] = strtoupper($first_period->getUnit());
     // - + Default Time unit for initial term, possible values: Y: Value in years M: Value in months D: Value in days
     $params['period_length_trail'] = $first_period->getCount();
     // - + N..4 Duration of the initial term. Can only be used in combination with period_unit_trail.
     $params['id_trail'] = $invoice->getItem(0)->billing_plan_id;
     // + + AN..100 Item number (initial term)
     $params['no_trail'] = 1;
     // + + N..5 Quantity (initial term)
     $params['pr_trail'] = $invoice->first_total * 100;
     // + + N..7 Unit price of the item in smallest currency unit (initial term)
     $params['de_trail'] = $invoice->getItem(0)->item_description;
     // + + AN..255 Description (initial term)
     $params['ti_trail'] = $invoice->getItem(0)->item_title;
     // + + AN..100 Title (initial term)
     //$params['va_trail']              = ''; // - + N..4 VAT rate (% or bp) (initial term) value < 100 = percent value > 99 = basis points
     if ($invoice->second_total > 0) {
         $second_period = new Am_Period($invoice->second_period);
         $params['amount_recurring'] = $invoice->second_total * 100;
         // - + N..6 Total price of all items during the subsequent term. Must equal the sum (quantity * price) of all items for the subsequent term (in the smallest currency unit, e.g. Cent).
         $params['period_unit_recurring'] = strtoupper($second_period->getUnit());
         // - + Default Time unit for subsequent term, possible values: Y: Value in years M: Value in months D: Value in days N: only if no subsequent term
         $params['period_length_recurring'] = $second_period->getCount();
         // - + N..4 Duration of the subsequent term. Can only be used in combination with period_unit_recurring.
         $params['id_recurring'] = $invoice->getItem(0)->billing_plan_id;
         // - + AN..100 Item number (subsequent term)
         $params['no_recurring'] = 1;
         // - + N..5 Quantity (subsequent term)
         $params['pr_recurring'] = $invoice->second_total * 100;
         // - + N..7 Unit price of the item in smallest currency unit (subsequent term)
         $params['de_recurring'] = $invoice->getItem(0)->item_description;
         // - + AN..255 Description (subsequent term)
         $params['ti_recurring'] = $invoice->getItem(0)->item_title;
         // - + AN..100 Title (subsequent term)
         //$params['va_recurring']          = ''; // - + N..4 VAT rate (% or bp) (subsequent term) value < 100 = percent value > 99 = basis points
         /////
     }
     /*
     //Parameter ( „pre-/authorization“ )
     $params['request']  = 'authorization';
     $params['amount']   = $invoice->first_total * 100;
     $params['currency'] = $invoice->currency;
     $params['it']    = 'goods';                     //For BSV: Item type
     $params['id']    = '';                          //Your item no.
     $params['pr']    = $invoice->first_total * 100; //Price in Cent
     $params['no']    = 1;                           //Quantity
     $params['de']    = '';                          //Item description
     //$params['va']  = '';                        //VAT (optional)
     /////
     */
     ksort($params);
     $a->hash = strtolower(md5(implode('', $params) . $this->getConfig('secret_key')));
     //Hash value (see chapter 3.1.4)
     //Parameter ( personal data )
     $params['firstname'] = $u->name_f;
     //AN..50 First name
     $params['lastname'] = $u->name_l;
     //AN..50 Surname
     //$params['company']       = '';        //AN..50 Company
     $params['street'] = $u->street;
     //AN..50 Street
     $params['zip'] = $u->zip;
     //AN..10 Postcode
     $params['city'] = $u->city;
     //AN..50 City
     $params['country'] = $u->country;
     //Default Country (ISO 3166)
     $params['email'] = $u->email;
     //AN..50 Email address
     $params['language'] = 'en';
     //Language indicator (ISO 639)
     //If the language is not transferred, the browser
     //language will be used. For a non-supported
     //language, English will be used.
     /////
     foreach ($params as $k => $v) {
         $a->addParam($k, $v);
     }
     $result->setAction($a);
 }
Example #21
0
 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     require_once dirname(__FILE__) . '/mapi/mapi_package.php';
     $OrderTitle = 'Order on ' . $this->getDi()->config->get('site_title');
     $OrderInfo = $invoice->getLineDescription();
     $OrderCategory = $this->getConfig('order_category');
     $params = new HIPAY_MAPI_PaymentParams();
     $params->setLogin($this->getConfig('account_id'), $this->getConfig('merchant_password'));
     $params->setAccounts($this->getConfig('account_id'));
     $params->setLocale('en_GB');
     // The payment interface will be in International French by default
     $params->setRating('ALL');
     // '+16' - The order content is intended for people at least 16 years old.
     $params->setMedia('WEB');
     // The interface will be the Web interface
     if (!$invoice->rebill_times) {
         $params->setPaymentMethod(HIPAY_MAPI_METHOD_SIMPLE);
     } else {
         $params->setPaymentMethod(HIPAY_MAPI_METHOD_MULTI);
     }
     // It is a Recurring payment
     $params->setCaptureDay(HIPAY_MAPI_CAPTURE_IMMEDIATE);
     // The capture take place immediately
     $params->setCurrency($invoice->currency);
     $params->setIdForMerchant('aMember invoice #' . $invoice->public_id);
     // The merchant-selected identifier for this order
     $params->setMerchantDatas('invoice_id', $invoice->public_id);
     //Data element of type key=value declared and will be returned to the merchant after the payment in the notification data feed [C].
     $site_id = $this->invoice->getItem(0)->getBillingPlanData('hipay_site_id');
     if (!$site_id) {
         $site_id = $this->getConfig('site_id');
     }
     // use default value
     $params->setMerchantSiteId($site_id);
     // This order relates to the web site which the merchant declared in the Hipay platform.
     $params->setURLOk($this->getReturnUrl());
     // If the payment is accepted, the user will be redirected to this page
     $params->setUrlNok($this->getCancelUrl());
     // If the payment is refused, the user will be redirected to this page
     $params->setUrlCancel($this->getCancelUrl());
     // If the user cancels the payment, he will be redirected to this page
     $params->setUrlAck($this->getPluginUrl('ipn'));
     // The merchant's site will be notified of the result of the payment by a call to the script
     $t = $params->check();
     if (!$t) {
         throw new Am_Exception_Paysystem_TransactionInvalid('An error occurred while creating the paymentParams object');
     }
     if ($invoice->tax_rate && $invoice->tax_title) {
         $tax = new HIPAY_MAPI_Tax();
         $tax->setTaxName($invoice->tax_title);
         $percentage = true;
         //$invoice->tax_type == 1;
         $tax->setTaxVal($invoice->tax_rate, $percentage);
         $t = $tax->check();
         if (!$t) {
             throw new Am_Exception_Paysystem_TransactionInvalid('An error occurred while creating a tax object');
         }
     }
     $item1 = new HIPAY_MAPI_Product();
     $item1->setName($invoice->getItem(0)->item_title);
     $item1->setCategory($OrderCategory);
     $item1->setquantity(1);
     $item1->setPrice($invoice->first_total);
     if (isset($tax)) {
         $item1->setTax(array($tax));
     }
     //$item1->setInfo('Simmons, Dan – ISBN 0575076380');
     //$item1->setRef('JV005');
     $t = $item1->check();
     if (!$t) {
         throw new Am_Exception_Paysystem_TransactionInvalid('An error occurred while creating a product object');
     }
     $order = new HIPAY_MAPI_Order();
     $order->setOrderTitle($OrderTitle);
     // Order title and information
     $order->setOrderInfo($OrderInfo);
     $order->setOrderCategory($OrderCategory);
     // The order category is 3 (Books)
     if ($invoice->hasShipping()) {
         $order->setShipping($invoice->first_shipping, isset($tax) ? array($tax) : array());
     }
     // The shipping costs are 1.50 Euros excluding taxes, and $tax1 is applied
     //$order->setInsurance(2,array($tax3,$tax1)); // The insurance costs are 2 Euros excluding taxes, and $tax1 and $tax3 are applied
     //$order->setFixedCost(2.25,array($tax3)); // The fixed costs are 2.25 Euros excluding taxes, and $tax3 is applied to this amount
     //$order->setAffiliate(array($aff1,$aff2)); // This order has two affiliates, $aff1 and $aff2
     $t = $order->check();
     if (!$t) {
         throw new Am_Exception_Paysystem_TransactionInvalid('An error occurred while creating a product object');
     }
     if (!$invoice->rebill_times) {
         try {
             $payment = new HIPAY_MAPI_SimplePayment($params, $order, array($item1));
         } catch (Exception $e) {
             throw new Am_Exception_Paysystem_TransactionInvalid($e->getMessage());
         }
     } else {
         // First payment: The payment will be made in 1 hour, in the amount of 5 Euros, excluding taxes plus tax $tax1.
         $ins1 = new HIPAY_MAPI_Installment();
         if ($invoice->first_total > 0) {
             $price = $invoice->first_total;
             $paymentDelay = '0H';
         } else {
             $price = $invoice->second_total;
             $paymentDelay = $this->getPeriod($invoice->first_period);
         }
         $ins1->setPrice($price);
         if (isset($tax)) {
             $ins1->setTax(array($tax));
         }
         $ins1->setFirst(true, $paymentDelay);
         $t = $ins1->check();
         if (!$t) {
             throw new Am_Exception_Paysystem_TransactionInvalid('An error occurred while creating an instalment object');
         }
         // Subsequent payments: The payments will be made every 30 days in the amount of 12.5 Euros excluding taxes, plus tax of $tax2.0.
         $ins2 = new HIPAY_MAPI_Installment();
         $ins2->setPrice($invoice->second_total);
         if (isset($tax)) {
             $ins2->setTax(array($tax));
         }
         $paymentDelay = $this->getPeriod($invoice->second_period);
         $ins2->setFirst(false, $paymentDelay);
         $t = $ins2->check();
         if (!$t) {
             throw new Am_Exception_Paysystem_TransactionInvalid('An error occurred while creating an instalment object');
         }
         // Initial order
         $orderins1 = new HIPAY_MAPI_Order();
         $orderins1->setOrderTitle($OrderTitle);
         // Title and information on this payment
         $orderins1->setOrderInfo($OrderInfo);
         //1 free hour
         $orderins1->setOrderCategory($OrderCategory);
         // The order category is 3 (Books)
         $t = $orderins1->check();
         if (!$t) {
             throw new Am_Exception_Paysystem_TransactionInvalid('An error occurred while creating an order object');
         }
         // Subsequent orders
         $orderins2 = new HIPAY_MAPI_Order();
         $orderins2->setOrderTitle($OrderTitle);
         // Title and information on this payment
         $orderins2->setOrderInfo($OrderInfo);
         //only 12 euros 50 monthly !
         $orderins2->setOrderCategory($OrderCategory);
         // The order category is 3 (Books)
         $t = $orderins2->check();
         if (!$t) {
             throw new Am_Exception_Paysystem_TransactionInvalid('An error occurred while creating an order object');
         }
         try {
             $payment = new HIPAY_MAPI_MultiplePayment($params, $orderins1, $ins1, $orderins2, $ins2);
         } catch (Exception $e) {
             throw new Am_Exception_Paysystem_TransactionInvalid($e->getMessage());
         }
     }
     $xmlTx = $payment->getXML();
     $output = HIPAY_MAPI_SEND_XML::sendXML($xmlTx, $this->getConfig('testing') ? self::TEST_URL : self::URL);
     $r = HIPAY_MAPI_COMM_XML::analyzeResponseXML($output, $url, $err_msg);
     if ($r === true && !$err_msg) {
         // The internet user is sent to the URL indicated by the Hipay platform
         $a = new Am_Paysystem_Action_Redirect($url);
         $result->setAction($a);
     } else {
         throw new Am_Exception_Paysystem_TransactionInvalid($err_msg);
     }
 }
Example #22
0
 public function getActionURL(Invoice $invoice)
 {
     return sprintf("https://secure.zombaio.com/?%d.%d.%s", $this->getConfig('site_id'), $invoice->getItem(0)->getBillingPlanData('zombaio_pricing_id'), $this->getConfig('lang', 'ZOM'));
 }