public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result) { $a = new Am_Paysystem_Action_Form(self::LIVE_URL); $u = $invoice->getUser(); $a->intInstID = $this->config['installation_id']; $a->strCartID = $invoice->public_id; $a->strCurrency = $invoice->currency; $a->strDesc = $invoice->getLineDescription(); $a->strEmail = $u->email; $a->strCardHolder = $u->getName(); $a->strAddress = $u->street; $a->strCity = $u->city; $a->strState = $u->state; $a->strCountry = $u->country; $a->strPostcode = $u->zip; $a->intTestMode = $this->getConfig('testing') ? '1' : ''; $a->fltAmount = sprintf('%.3f', $invoice->first_total); //recurring if (!is_null($invoice->second_period)) { $a->intRecurs = '1'; $a->intCancelAfter = substr($invoice->rebill_times, 3); $a->fltSchAmount1 = sprintf('%.3f', $invoice->second_total); $a->strSchPeriod1 = $this->metacharge_get_period($invoice->first_period); $a->fltSchAmount = sprintf('%.3f', $invoice->first_total); $a->strSchPeriod = $this->metacharge_get_period($invoice->second_period); } $a->filterEmpty(); $result->setAction($a); }
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); }
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); }
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); }
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result) { $action = new Am_Paysystem_Action_Form(); $action->setUrl('https://www.cashu.com/cgi-bin/pcashu.cgi'); $action->merchant_id = $this->getConfig('merchant_id'); $action->amount = $invoice->first_total; $action->currency = $invoice->currency; $action->language = 'en'; $action->display_text = $invoice->getLineDescription(); $action->token = md5(strtolower($action->merchant_id . ":" . sprintf("%.2f", $action->amount) . ":" . $action->currency . ":") . $this->getConfig('secret')); $action->txt1 = $invoice->getLineDescription(); $action->txt2 = $invoice->public_id; $action->test_mode = $this->getConfig('testing'); $result->setAction($action); }
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result) { $u = $invoice->getUser(); $a = new Am_Paysystem_Action_Form($this->getConfig('testing') ? self::TEST_URL : self::LIVE_URL); $a->VPSProtocol = '3.00'; $a->TxType = 'PAYMENT'; $a->Vendor = $this->getConfig('login'); $vars = array('VendorTxCode=' . $invoice->public_id, 'Amount=' . $invoice->first_total, 'Currency=' . $invoice->currency, 'Description=' . $invoice->getLineDescription(), 'SuccessURL=' . $this->getPluginUrl('thanks'), 'FailureURL=' . $this->getCancelUrl(), 'CustomerEmail=' . $u->email, 'VendorEmail=' . $this->getDi()->config->get('admin_email'), 'CustomerName=' . $u->name_f . ' ' . $u->name_l); // New mandatory fields for 3.00 protocol // All mandatory fields must contain a value, apart from the BillingPostcode/DeliveryPostCode. $surname = $u->name_l != '' ? $u->name_l : 'Surname'; $firstname = $u->name_f != '' ? $u->name_f : 'Firstname'; $address = $u->street != '' ? $u->street : 'Address'; $city = $u->city != '' ? $u->city : 'City'; $country = $u->country != '' ? $u->country : 'US'; $state = $u->state != '' ? $u->state : 'AL'; $zip = $u->zip != '' ? $u->zip : '12345'; $vars[] = 'BillingSurname=' . $surname; $vars[] = 'BillingFirstnames=' . $firstname; $vars[] = 'BillingAddress1=' . $address; $vars[] = 'BillingCity=' . $city; $vars[] = 'BillingPostCode=' . $zip; $vars[] = 'BillingCountry=' . $country; $vars[] = 'DeliverySurname=' . $surname; $vars[] = 'DeliveryFirstnames=' . $firstname; $vars[] = 'DeliveryAddress1=' . $address; $vars[] = 'DeliveryCity=' . $city; $vars[] = 'DeliveryPostCode=' . $zip; $vars[] = 'DeliveryCountry=' . $country; if ($country == 'US') { //becomes mandatory when the BillingCountry/DeliveryCountry is set to US $vars[] = 'BillingState=' . $state; $vars[] = 'DeliveryState=' . $state; } /* * Important – if your business is classed as Financial Institution (Merchant code – 6012) * there are 4 additional fields that will need to be included with the transaction post from your system. * FIRecipientAcctNumber * FIRecipientSurname * FIRecipientPostcode * FIRecipientDoB */ //$a->Crypt = base64_encode($this->sagepay_simple_xor(implode('&',$vars), $this->getConfig('pass'))); $a->Crypt = self::encryptAes(implode('&', $vars), $this->getConfig('pass')); $a->filterEmpty(); $result->setAction($a); }
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("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(); $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); }
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result) { $a = new Am_Paysystem_Action_Form(); $a->setUrl('https://merchant.wmtransfer.com/lmi/payment.asp'); $a->LMI_PAYEE_PURSE = $this->getConfig('purse'); $a->LMI_PAYMENT_AMOUNT = $invoice->first_total; $a->LMI_PAYMENT_NO = $invoice->invoice_id; $a->AMEMBER_ID = $invoice->public_id; $a->LMI_PAYMENT_DESC_BASE64 = base64_encode($invoice->getLineDescription()); //$a->LMI_MODE = $this->getConfig('testing') ? 1 : 0; $a->LMI_SIM_MODE = 2; $a->LMI_RESULT_URL = $this->getPluginUrl('ipn'); $a->LMI_SUCCESS_URL = $this->getPluginUrl('thanks'); $a->LMI_SUCCESS_METHOD = 1; // post to thanks $a->LMI_FAIL_URL = $this->getCancelUrl(); $a->LMI_FAIL_METHOD = 1; // $a->LMI_PAYMER_EMAIL = $invoice->getEmail(); $result->setAction($a); }
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result) { $u = $invoice->getUser(); $a = new Am_Paysystem_Action_Form(self::LIVE_URL); $a->account_id = $this->getConfig('account_id'); $a->return_url = $this->getPluginUrl('thanks') . '?DR={DR}'; $a->mode = $this->getConfig('mode'); $a->reference_no = $invoice->public_id; $a->amount = $invoice->first_total; $a->description = $invoice->getLineDescription(); $a->name = $u->name_f . ' ' . $u->name_l; $a->address = $u->street; $a->city = $u->city; $a->state = $u->state; $a->postal_code = $u->zip; $a->country = $u->country; $a->phone = $u->phone; $a->email = $u->email; $a->secure_hash = md5($this->getConfig('secret', "ebskey") . "|" . $a->account_id . "|" . $a->amount . "|" . $a->reference_no . "|" . $a->return_url . "|" . $a->mode); $a->filterEmpty(); $result->setAction($a); }
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result) { $a = new Am_Paysystem_Action_Form(self::URL); $vars = array('MERCHANT' => $this->getConfig('merchant'), 'ORDER_REF' => $invoice->public_id, 'ORDER_DATE' => $invoice->tm_added); foreach ($invoice->getItems() as $item) { $vars['ORDER_PNAME[]'] = $item->item_title; $vars['ORDER_PCODE[]'] = $item->item_id; $vars['ORDER_PRICE[]'] = $item->first_price; $vars['ORDER_QTY[]'] = $item->qty; $vars['ORDER_VAT[]'] = $item->first_tax; } $vars['ORDER_SHIPPING'] = 0; $vars['PRICES_CURRENCY'] = strtoupper($invoice->currency); $vars['DISCOUNT'] = $invoice->first_discount; foreach ($vars as $k => $v) { $a->__set($k, $v); } $a->__set('ORDER_HASH', $this->calculateHash($vars)); $a->__set('BILL_FNAME', $invoice->getFirstName()); $a->__set('BILL_LNAME', $invoice->getLastName()); $a->__set('BILL_EMAIL', $invoice->getEmail()); $a->__set('BILL_PHONE', $invoice->getPhone()); $a->__set('BILL_ADDRESS', $invoice->getStreet()); $a->__set('BILL_ZIPCODE', $invoice->getZip()); $a->__set('BILL_CITY', $invoice->getCity()); $a->__set('BILL_STATE', $invoice->getState()); $a->__set('BILL_COUNTRYCODE', $invoice->getCountry()); $a->__set('LANGUAGE', $this->getConfig('language', 'ro')); if ($this->getConfig('testing')) { $a->__set('TESTORDER', 'TRUE'); } $result->setAction($a); }
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result) { $user = $invoice->getUser(); $a = new Am_Paysystem_Action_Form(self::LIVE_URL); $a->Merchant = $this->getConfig('merchant_id'); $a->Site = $this->getConfig('site_id'); $a->DirectTransfer = 'true'; $a->Amount = $invoice->first_total; $a->Currency = $invoice->currency; $a->TransRef = $invoice->public_id; $a->Product = $invoice->getLineDescription(); $a->PaymentType = 'cup'; $a->AttemptMode = '1'; $a->TestTrans = $this->getConfig('testing') ? '1' : '0'; $a->__set("customer[email]", $user->email); $a->__set("customer[first_name]", $user->name_f); $a->__set("customer[last_name]", $user->name_l); $a->__set("customer[address1]", $user->street); $a->__set("customer[address2]", $user->street2); $a->__set("customer[city]", $user->city); $a->__set("customer[state]", $user->state); $a->__set("customer[postcode]", $user->postcode); $a->__set("customer[country]", $user->country); $a->__set("customer[phone]", $user->phone); $a->ReturnUrlFailure = $this->getCancelUrl(); $a->ReturnUrlSuccess = $this->getPluginUrl('thanks'); $result->setAction($a); }
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result) { $periods = array('y' => 'years', 'm' => 'months', 'd' => 'days', 'fixed' => 'years'); $u = $invoice->getUser(); $a = new Am_Paysystem_Action_Form(self::LIVE_URL); $a->language = $this->getDi()->app->getDefaultLocale(); $order = array(); $a->__set('order[shop_id]', $this->getConfig('shop_id')); $a->__set('order[currency]', $invoice->currency); $a->__set('order[email]', $u->email); $a->__set('order[success_url]', $this->getReturnUrl($request)); $a->__set('order[cancel_url]', $this->getCancelUrl($request)); $a->__set('order[fail_url]', $this->getCancelUrl($request)); $a->__set('order[notification_url]', $this->getPluginUrl('ipn')); $a->__set('order[billing_address_attributes][first_name]', $u->name_f); $a->__set('order[billing_address_attributes][last_name]', $u->name_l); $a->__set('order[billing_address_attributes][address]', $u->street); $a->__set('order[billing_address_attributes][country]', $u->country); $a->__set('order[billing_address_attributes][city]', $u->city); $a->__set('order[billing_address_attributes][zip]', $u->zip); $a->__set('order[billing_address_attributes][state]', $u->state); $a->__set('order[billing_address_attributes][zip]', $u->zip); //recurring if (!is_null($invoice->second_period)) { $a->__set('order[subscription_attributes][description]', $invoice->getLineDescription()); $a->__set('order[subscription_attributes][trial_amount]', $invoice->first_total * 100); $first_period = new Am_Period($invoice->first_period); $a->__set('order[subscription_attributes][trial_interval_unit]', $periods[$first_period->getUnit()]); $a->__set('order[subscription_attributes][trial_interval]', $first_period->getCount() == Am_Period::MAX_SQL_DATE ? '25' : $first_period->getCount()); $a->__set('order[subscription_attributes][amount]', $invoice->second_total * 100); $second_period = new Am_Period($invoice->second_period); $a->__set('order[subscription_attributes][interval_unit]', $periods[$second_period->getUnit()]); $a->__set('order[subscription_attributes][interval]', $second_period->getCount() == Am_Period::MAX_SQL_DATE ? '25' : $second_period->getCount()); if ($invoice->rebill_times) { $a->__set('order[subscription_attributes][rebill_limit]', $invoice->rebill_times); } } else { $a->__set('order[line_items_attributes][][name]', $invoice->getLineDescription()); $a->__set('order[line_items_attributes][][amount]', $invoice->first_total * 100); $a->__set('order[line_items_attributes][][quantity]', 1); $a->__set('order[tax_amount]', $invoice->first_tax * 100); } $a->__set('order[tracking_params_attributes][][name]', 'invoice_id'); $a->__set('order[tracking_params_attributes][][value]', $invoice->public_id); $a->filterEmpty(); $a->__set('order[signature]', hash('sha256', $sha = $a->__get('order[subscription_attributes][trial_amount]') . $a->__get('order[line_items_attributes][][amount]') . $a->__get('order[cancel_url]') . $a->__get('order[currency]') . $a->__get('order[email]') . $a->__get('order[fail_url]') . $a->__get('order[success_url]') . $invoice->public_id . $a->__get('order[subscription_attributes][amount]') . $a->__get('order[subscription_attributes][description]') . $a->__get('order[subscription_attributes][interval]') . $a->__get('order[subscription_attributes][interval_unit]') . $a->__get('order[subscription_attributes][rebill_limit]') . $a->__get('order[subscription_attributes][trial_amount]') . $a->__get('order[subscription_attributes][trial_interval]') . $a->__get('order[subscription_attributes][trial_interval_unit]') . $this->getConfig('secret_key'))); $result->setAction($a); }
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result) { $a = new Am_Paysystem_Action_Form(self::URL); $vars = array('MERCHANT' => $this->getConfig('email'), 'COUNTRY_ID' => $this->getConfig('country'), 'PAYMENT_METHOD_AVAILABLE' => 'all', 'TRANSACTION_ID' => $invoice->public_id); $i = '1'; foreach ($invoice->getItems() as $item) { //Creating new format without dot for $item->first_price $price = str_replace('.', '', $item->first_total); $vars['ITEM_NAME_' . $i] = $item->item_title; $vars['ITEM_CODE_' . $i] = $item->item_id; $vars['ITEM_AMMOUNT_' . $i] = $price; $vars['ITEM_QUANTITY_' . $i] = $item->qty; $vars['ITEM_CURRENCY_' . $i] = $item->currency; $i++; } $vars['CURRENCY'] = strtoupper($invoice->currency); foreach ($vars as $k => $v) { $a->__set($k, $v); } $a->__set('BUYER_FNAME', $invoice->getFirstName()); $a->__set('BUYER_LNAME', $invoice->getLastName()); $a->__set('BUYER_EMAIL', $invoice->getEmail()); $a->__set('BUYER_PHONE', $invoice->getPhone()); $a->__set('BUYER_STREET', $invoice->getStreet()); $a->__set('BUYER_STATE', $invoice->getState()); $a->__set('BUYER_CITY', $invoice->getCity()); $a->__set('BUYER_COUNTRY', $invoice->getCountry()); $a->__set('BUYER_ZIP_CODE', $invoice->getZip()); $a->__set('BUYER_CITY', $invoice->getCity()); $a->__set('BUYER_STATE', $invoice->getState()); $a->__set('LANGUAGE', $this->getConfig('language', 'es')); $result->setAction($a); }
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result) { $a = new Am_Paysystem_Action_Form($this->getConfig('testing') ? self::TEST_URL : self::LIVE_URL); $a->vendor_name = $this->getConfig('vendor_name'); $a->payment_alert = $this->getDi()->config->get('admin_email'); $a->__set($invoice->getLineDescription(), $invoice->first_total); $a->payment_reference = $invoice->public_id; $a->receipt_address = $invoice->getEmail(); if (floatval($invoice->first_tax) > 0) { $a->gst_rate = $invoice->tax_rate; $a->gst_added = 'true'; } $if = array(); $a->__set($if[] = 'E-Mail', $invoice->getEmail()); $a->__set($if[] = 'Country', $this->getCountry($invoice)); $a->__set($if[] = 'Name', $invoice->getName()); $a->__set($if[] = 'Street/PO Box', $invoice->getStreet()); $a->__set($if[] = 'City', $invoice->getCity()); $a->__set($if[] = 'State', $this->getState($invoice)); $a->__set($if[] = 'Post Code', $invoice->getZip()); $a->__set($if[] = 'Telephone Number', $invoice->getPhone()); $a->information_fields = implode(',', $if); $a->return_link_url = $this->getReturnUrl(); $a->reply_url = $this->getPluginUrl('ipn') . '?invoice=' . $invoice->public_id; $a->reply_link_url = $this->getPluginUrl('ipn') . '?invoice=' . $invoice->public_id; $result->setAction($a); }
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); }