public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result) { $user = $invoice->getUser(); $a = new Am_Paysystem_Action_Redirect(self::LIVE_URL); $a->sitereference = $this->getConfig('sitereference'); $a->currencyiso3a = $invoice->currency; $a->mainamount = $invoice->first_total; $a->version = 1; $a->billingstreet = $user->street; $a->billingtown = $user->city; $a->billingcounty = $user->country; $a->billingpostcode = $user->zip; $a->billingfirstname = $user->name_f; $a->billinglastname = $user->name_l; $a->billingemail = $user->email; $a->billingtelephone = $user->phone; $a->customerstreet = $user->street; $a->customertown = $user->city; $a->customercounty = $user->country; $a->customerpostcode = $user->zip; $a->customerfirstname = $user->name_f; $a->customerlastname = $user->name_l; $a->customeremail = $user->email; $a->customertelephone = $user->phone; $a->orderreference = $invoice->public_id; $a->filterEmpty(); $result->setAction($a); }
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::LIVE_URL); $vars = array('MrchLogin' => $this->getConfig('merchant_login'), 'OutSum' => $invoice->first_total, 'InvId' => $invoice->invoice_id, 'Desc' => $invoice->getLineDescription(), 'Culture' => $this->getConfig('language', 'en')); $vars['SignatureValue'] = $this->getSignature($vars, $this->getConfig('merchant_pass1')); foreach ($vars 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_Redirect(self::URL); $params = array('MERCHANT_ID' => $this->getConfig('merchant'), 'AMOUNT' => $invoice->first_total, 'ORDER_NUMBER' => $invoice->public_id, 'REFERENCE_NUMBER' => '', 'ORDER_DESCRIPTION' => $invoice->getLineDescription(), 'CURRENCY' => $invoice->currency, 'RETURN_ADDRESS' => $this->getReturnUrl(), 'CANCEL_ADDRESS' => $this->getCancelUrl(), 'PENDING_ADDRESS' => '', 'NOTIFY_ADDRESS' => $this->getPluginUrl('ipn'), 'TYPE' => 'S1', 'CULTURE' => '', 'PRESELECTED_METHOD' => '', 'MODE' => '1', 'VISIBLE_METHODS' => '', 'GROUP' => ''); $params['AUTHCODE'] = strtoupper(md5($this->getConfig('hash') . '|' . implode('|', $params))); foreach ($params 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_Redirect(self::URL); $params = array('m_shop' => $this->getConfig('id'), 'm_orderid' => $invoice->public_id, 'm_amount' => $invoice->first_total, 'm_curr' => $invoice->currency, 'm_desc' => base64_encode($invoice->getLineDescription())); $params['m_sign'] = $this->calculateSignature($params); $params['m_process'] = 'send'; foreach ($params 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_Redirect(self::URL); $vars = array('vpc_Version' => '1', 'vpc_Command' => 'pay', 'vpc_MerchTxnRef' => $invoice->public_id, 'vpc_AccessCode' => $this->getConfig('access_code'), 'vpc_Merchant' => $this->getConfig('merchant_id'), 'vpc_OrderInfo' => $invoice->public_id, 'vpc_Amount' => intval($invoice->first_total * 100), 'vpc_Locale' => 'en', 'vpc_ReturnURL' => $this->getPluginUrl('thanks')); $vars = array_filter($vars); ksort($vars); $vars['vpc_SecureHash'] = strtoupper(md5($h = $this->getConfig('secure_hash') . implode('', array_values($vars)))); foreach ($vars as $k => $v) { $a->__set($k, $v); } $result->setAction($a); }
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); }
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result) { $action = new Am_Paysystem_Action_Redirect($this->getURL($invoice)); $action->name = $invoice->getName(); $action->email = $invoice->getEmail(); $action->country = $invoice->getCountry(); $action->postal_zip = $invoice->getZip(); $action->__set('sku[]', $invoice->getItem(0)->getBillingPlanData('safecart_sku')); $action->payment_id = $invoice->public_id; $action->rbvar = 6; // I don't know what is it. Ported from v3 plugin $result->setAction($action); }
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); }
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result) { $a = new Am_Paysystem_Action_Redirect(self::URL_SUBSCRIPTION); $params = array('key' => $this->getConfig('key'), 'uid' => $invoice->getUser()->pk(), 'widget' => $this->getConfig('widget'), 'email' => $invoice->getUser()->email, 'amount' => $invoice->first_total, 'currencyCode' => $invoice->currency, 'ag_name' => $invoice->getLineDescription(), 'ag_external_id' => $invoice->public_id, 'ag_type' => $invoice->first_period == Am_Period::MAX_SQL_DATE ? self::TYPE_FIXED : self::TYPE_SUBSCRIPTION, 'ag_recurring' => $invoice->second_total > 0 ? 1 : 0, 'ag_trial' => $invoice->second_total > 0 && $invoice->first_total != $invoice->second_total ? 1 : 0, 'sign_version' => 2, 'success_url' => $this->getReturnUrl(), 'pingback_url' => $this->getPluginUrl('ipn')); if ($params['ag_type'] == self::TYPE_SUBSCRIPTION) { $period = new Am_Period($invoice->first_period); $params = array_merge($params, array('ag_period_length' => $period->getCount(), 'ag_period_type' => $this->trUnit($period->getUnit()))); } if ($params['ag_trial']) { $period = new Am_Period($invoice->second_period); $params = array_merge($params, array('ag_post_trial_period_length' => $period->getCount(), 'ag_post_trial_period_type' => $this->trUnit($period->getUnit()), 'ag_post_trial_external_id' => $invoice->public_id, 'post_trial_amount' => $invoice->second_total, 'post_trial_currencyCode' => $invoice->currency, 'ag_post_trial_name' => $invoice->getLineDescription(), 'hide_post_trial_good' => 1)); } $params['sign'] = $this->calculateSignature($params, $this->getConfig('secret')); foreach ($params as $k => $v) { $a->addParam($k, $v); } $result->setAction($a); }
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); }
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result) { $u = $invoice->getUser(); $a = new Am_Paysystem_Action_Redirect(self::LIVE_URL); $a->id = $this->getConfig('seller_id'); $a->amount = $invoice->first_total; $a->currency = $invoice->currency; $a->description = $invoice->getLineDescription(); $a->control = $invoice->public_id; $a->URL = $this->getReturnUrl(); $a->type = '0'; $a->lang = $this->getConfig('lang'); $a->URLC = $this->getPluginUrl('ipn'); $a->firstname = $u->name_f; $a->lastname = $u->name_l; $a->email = $u->email; $a->street = $u->street; $a->state = $u->state; $a->city = $u->city; $a->postcode = $u->zip; $a->country = $u->country; $a->filterEmpty(); $result->setAction($a); }
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); }
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); }
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result) { $u = $invoice->getUser(); if (!is_null($invoice->second_period)) { $a = new Am_Paysystem_Action_Redirect($url = ($this->getConfig('testing') ? self::SANDBOX_URL : self::LIVE_URL) . '/connect/subscriptions/new'); $coef = 1; if ($invoice->second_period == Am_Period::MAX_SQL_DATE) { $interval_unit = 'month'; $interval_length = 12 * (2037 - date('Y')); } else { $second_period = new Am_Period($invoice->second_period); switch ($second_period->getUnit()) { case 'd': $interval_unit = 'day'; break; case 'm': $interval_unit = 'month'; break; case 'y': $interval_unit = 'month'; $coef = 12; break; } $interval_length = $second_period->getCount(); } $first_period = new Am_Period($invoice->first_period); $start_at = new DateTime($first_period->addTo(date('Y-m-d')), new DateTimeZone('UTC')); $payment_details = array('amount' => $invoice->second_total, 'interval_length' => $interval_length * $coef, 'interval_unit' => $interval_unit, 'name' => $invoice->getLineDescription(), 'start_at' => $start_at->format('Y-m-d\\TH:i:s\\Z')); if ($invoice->rebill_times != IProduct::RECURRING_REBILLS) { $payment_details['interval_count'] = $invoice->rebill_times; } if (doubleval($invoice->first_total) > 0) { $payment_details['setup_fee'] = $invoice->first_total; } } else { $a = new Am_Paysystem_Action_Redirect($url = ($this->getConfig('testing') ? self::SANDBOX_URL : self::LIVE_URL) . '/connect/bills/new'); $payment_details = array('amount' => $invoice->first_total, 'name' => $invoice->getLineDescription()); } $user_details = array('first_name' => $u->name_f, 'last_name' => $u->name_l, 'email' => $u->email); $payment_details['merchant_id'] = $this->getConfig('merchant_id'); ksort($payment_details); ksort($user_details); if (is_null($invoice->second_period)) { foreach ($payment_details as $v => $k) { $a->__set("bill[{$v}]", $k); } foreach ($user_details as $v => $k) { $a->__set("bill[user][{$v}]", $k); } } $a->cancel_uri = $this->getCancelUrl(); $a->client_id = $this->getConfig('app_id'); $a->nonce = $this->generate_nonce(); $a->redirect_uri = $this->getDi()->config->get('root_url') . "/payment/gocardless/thanks"; $a->state = $invoice->public_id; if (!is_null($invoice->second_period)) { foreach ($payment_details as $v => $k) { $a->__set("subscription[{$v}]", $k); } foreach ($user_details as $v => $k) { $a->__set("subscription[user][{$v}]", $k); } } $date = new DateTime(null, new DateTimeZone('UTC')); $a->timestamp = $date->format('Y-m-d\\TH:i:s\\Z'); $url = parse_url($a->getUrl()); $a->signature = hash_hmac('sha256', $url['query'], $this->getConfig('app_secret')); $result->setAction($a); }
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); }
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); }