本文整理汇总了PHP中Am_Paysystem_Result::setAction方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Paysystem_Result::setAction方法的具体用法?PHP Am_Paysystem_Result::setAction怎么用?PHP Am_Paysystem_Result::setAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Am_Paysystem_Result
的用法示例。
在下文中一共展示了Am_Paysystem_Result::setAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _process
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
{
$m = $this->getConfig('methods');
if (@count($m) == 1) {
$a = new Am_Paysystem_Action_Form(self::URL . $m[0] . '/event/');
} else {
$a = new Am_Paysystem_Action_HtmlTemplate_Micropayment($this->getDir(), 'micropayment-confirm.phtml');
$methods = array();
if (@count($m)) {
$a->url = self::URL . $m[0] . '/event/';
foreach ($m as $title) {
$methods[self::URL . $title . '/event/'] = $this->getConfig($title . '.title');
}
} else {
foreach ($this->getConfig() as $k => $v) {
if (is_array($v) && !empty($v['title'])) {
$methods[self::URL . $k . '/event/'] = $v['title'];
}
}
$a->url = array_shift(array_keys($methods));
}
$a->methods = $methods;
}
$a->project = $this->getConfig('project');
$a->amount = $invoice->first_total * 100;
$a->freepaymentid = $invoice->public_id;
$a->seal = md5("project={$a->project}&amount={$a->amount}&freepaymentid={$a->freepaymentid}" . $this->getConfig('key'));
$result->setAction($a);
}
示例2: _process
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);
$result->setAction($a);
$u = $invoice->getUser();
$vars = array();
$vars['PSPID'] = $this->config['pspid'];
$vars['ORDERID'] = $invoice->public_id;
$vars['AMOUNT'] = $invoice->first_total * 100;
$vars['CURRENCY'] = $invoice->currency;
$vars['LANGUAGE'] = 'en_US';
$vars['CN'] = $u->getName();
$vars['EMAIL'] = $u->email;
$vars['OWNERZIP'] = $u->zip;
$vars['OWNERADDRESS'] = $u->street;
$vars['OWNERCTY'] = $u->city;
$vars['COM'] = $invoice->getLineDescription();
$vars['HOMEURL'] = $this->getReturnUrl();
$vars['ACCEPTURL'] = $this->getPluginUrl('thanks');
$vars['DECLINEURL'] = $this->getCancelUrl();
$vars['CANCELURL'] = $this->getCancelUrl();
$vars = array_filter($vars);
ksort($vars);
foreach ($vars as $k => $v) {
$sha .= "{$k}={$v}" . $this->config['sha_in'];
$a->addParam($k, $v);
}
$a->SHASIGN = sha1($sha);
$result->setAction($a);
}
示例3: _process
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);
}
}
示例4: _process
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
{
$user = $invoice->getUser();
$a = new Am_Paysystem_Action_Redirect($this->getConfig('testing') ? self::SANDBOX_URL : self::LIVE_URL);
$result->setAction($a);
$a->StoreKey = $this->getConfig('storekey');
$a->CustomerRefNo = $invoice->public_id;
$a->PaymentType = '';
$a->CardAction = '0';
$a->OrderID = $invoice->invoice_id;
$a->UserID = $invoice->getLogin();
$a->Email = $invoice->getEmail();
$a->CustomerIP = $user->remote_addr ? $user->remote_addr : $_SERVER['REMOTE_ADDR'];
$a->Bname = $invoice->getFirstName() . ' ' . $invoice->getLastName();
$a->Baddress1 = $user->street;
$a->Bcity = $user->city;
$a->Bpostalcode = $user->zip;
$a->Bcountry = $user->country;
$a->Sname = $invoice->getFirstName() . ' ' . $invoice->getLastName();
$a->Saddress1 = $user->street;
$a->Scity = $user->city;
$a->Spostalcode = $user->zip;
$a->Scountry = $user->country;
$a->SubTotal = $invoice->first_total - $invoice->first_tax;
$a->Tax1 = $invoice->first_tax;
$a->ThanksURL = $this->getPluginUrl("thanks");
$result->setAction($a);
}
示例5: _process
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);
}
示例6: _process
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
{
$req = new Am_HttpRequest(sprintf('https://gateway-japa.americanexpress.com/api/rest/version/23/merchant/%s/session', $this->getConfig('merchant')), Am_HttpRequest::METHOD_POST);
$req->setAuth('merchant.' . $this->getConfig('merchant'), $this->getConfig('password'));
$req->setBody(Am_Controller::getJson(array('apiOperation' => 'CREATE_PAYMENT_PAGE_SESSION', 'order' => array('id' => $invoice->public_id, 'amount' => $invoice->first_total, 'currency' => $invoice->currency), 'paymentPage' => array('cancelUrl' => $this->getCancelUrl(), 'returnUrl' => $this->getPluginUrl('thanks')))));
$this->logRequest($req);
$res = $req->send();
$this->logResponse($res);
if ($res->getStatus() != 201) {
$result->setFailed(sprintf('Incorrect Responce Status From Paysystem [%s]', $res->getStatus()));
return;
}
$msg = Am_Controller::decodeJson($res->getBody());
if ($msg['result'] == 'ERROR') {
$result->setFailed($msg['error']['explanation']);
return;
}
$invoice->data()->set(self::DATA_KEY, $msg['successIndicator'])->update();
$a = new Am_Paysystem_Action_Redirect(self::URL);
$a->{'merchant'} = $this->getConfig('merchant');
$a->{'order.description'} = $invoice->getLineDescription();
$a->{'paymentPage.merchant.name'} = $this->getDi()->config->get('site_title');
$a->{'session.id'} = $msg['session']['id'];
$this->logRequest($a);
$result->setAction($a);
}
示例7: _process
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);
}
示例8: _doBill
public function _doBill(Invoice $invoice, $doFirst, CcRecord $cc, Am_Paysystem_Result $result)
{
if (!$doFirst) {
throw new Am_Exception_InternalError('Cannot to run rebill from aMember');
}
$post = array('approvedPage' => $this->getReturnUrl(), 'declinedPage' => $this->getCancelUrl(), 'errorPage' => $this->getCancelUrl(), 'merchant_id' => $this->getConfig('merchant_id'), 'trnOrderNumber' => $invoice->public_id, 'trnAmount' => $invoice->first_total, 'ordEmailAddress' => $invoice->getUser()->email, 'ordName' => $invoice->getUser()->getName(), 'trnComments' => $invoice->getLineDescription());
if ($invoice->second_total > 0) {
if ($invoice->first_total != $invoice->second_total) {
throw new Am_Exception_InternalError('First price must be the same second price');
}
if ($invoice->first_period != $invoice->second_period) {
throw new Am_Exception_InternalError('First period must be the same second period');
}
list($period, $period_unit) = self::parsePeriod($invoice->first_period);
$post['trnRecurring'] = 1;
$post['rbBillingPeriod'] = $period_unit;
$post['rbBillingIncrement'] = $period;
}
$post['trnCardOwner'] = $cc->cc_name_f . " " . $cc->cc_name_l;
$post['trnCardNumber'] = $cc->cc_number;
$post['trnExpMonth'] = substr($cc->cc_expire, 0, 2);
$post['trnExpYear'] = substr($cc->cc_expire, 2);
$post['ordAddress1'] = $cc->cc_street;
$post['ordCity'] = $cc->cc_city;
$post['ordCountry'] = $cc->cc_country;
$post['ordProvince'] = $cc->cc_state;
$post['ordPostalCode'] = $cc->cc_zip;
$post['ordPhoneNumber'] = $cc->cc_phone;
$action = new Am_Paysystem_Action_Form(self::URL_PT);
foreach ($post as $k => $v) {
$action->{$k} = $v;
}
$result->setAction($action);
}
示例9: _process
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
{
$items = $invoice->getItems();
if (count($items) > 1) {
$exc = new Am_Exception_InternalError("It's impossible purchase " . count($items) . " products at one invoice with Selz-plugin");
$this->getDi()->errorLogTable->logException($exc);
throw $exc;
}
$item = $items[0];
$bp = $this->getDi()->billingPlanTable->load($item->billing_plan_id);
$sharedLink = $bp->data()->get(self::SHARED_LINK_FIELD);
if (!$sharedLink) {
$exc = new Am_Exception_InternalError("Product #{$item->item_id} has no shared link");
$this->getDi()->errorLogTable->logException($exc);
throw $exc;
}
if ($this->getConfig('payment_way', 'redirect') == 'redirect') {
$a = new Am_Paysystem_Action_Redirect($sharedLink);
} else {
$a = new Am_Paysystem_Action_HtmlTemplate_Selz($this->getDir(), 'selz.phtml');
$a->link = $sharedLink;
$a->inv = $invoice->public_id;
$a->thanks = $this->getReturnUrl();
$a->ipn = $this->getPluginUrl('ipn');
$a->way = $this->getConfig('payment_way');
}
$result->setAction($a);
}
示例10: _process
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);
}
示例11: _process
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);
}
示例12: _process
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);
}
示例13: _process
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
{
$u = $invoice->getUser();
$request = $this->createHttpRequest();
$vars = array('VPSProtocol' => '2.23', 'TxType' => 'PAYMENT', 'Vendor' => $this->getConfig('login'), 'VendorTxCode' => $invoice->public_id . '-AMEMBER', 'Amount' => number_format($invoice->first_total, 2, '.', ''), 'Currency' => $invoice->currency ? $invoice->currency : 'USD', 'Description' => $invoice->getLineDescription(), 'NotificationURL' => $this->getPluginUrl('ipn'), 'SuccessURL' => $this->getReturnUrl(), 'RedirectionURL' => $this->getReturnUrl(), 'BillingFirstnames' => $u->name_f, 'BillingSurname' => $u->name_l, 'BillingAddress1' => $u->street, 'BillingCity' => $u->city, 'BillingPostCode' => $u->zip, 'BillingCountry' => $u->country, 'DeliveryFirstnames' => $u->name_f, 'DeliverySurname' => $u->name_l, 'DeliveryAddress1' => $u->street, 'DeliveryCity' => $u->city, 'DeliveryPostCode' => $u->zip, 'DeliveryCountry' => $u->country, 'CustomerEMail' => $u->email, 'Profile' => 'NORMAL');
if ($u->country == 'US') {
$vars['BillingState'] = $u->state;
$vars['DeliveryState'] = $u->state;
}
$request->addPostParameter($vars);
$request->setUrl($this->getConfig('testing') ? self::TEST_URL : self::LIVE_URL);
$request->setMethod(Am_HttpRequest::METHOD_POST);
$this->logRequest($request);
$response = $request->send();
$this->logResponse($response);
if (!$response->getBody()) {
throw new Am_Exception_InputError("An error occurred while payment request");
}
$res = array();
foreach (split(PHP_EOL, $response->getBody()) as $line) {
list($l, $r) = explode('=', $line, 2);
$res[trim($l)] = trim($r);
}
if ($res['Status'] == 'OK') {
$invoice->data()->set('sagepay_securitykey', $res['SecurityKey']);
$invoice->update();
$a = new Am_Paysystem_Action_Form($res['NextURL']);
$result->setAction($a);
} else {
throw new Am_Exception_InputError($res['StatusDetail']);
}
}
示例14: _process
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);
}
示例15: _process
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
{
$a = new Am_Paysystem_Action_Redirect(self::URL);
$result->setAction($a);
$a->ok_receiver = $this->getConfig('wallet_id');
$a->ok_invoice = $invoice->public_id;
$a->ok_currency = strtoupper($invoice->currency);
if (!(double) $invoice->second_total) {
$a->ok_kind = 'payment';
$a->ok_item_1_name = $invoice->getLineDescription();
$a->ok_item_1_price = $invoice->first_total;
} else {
$a->ok_kind = 'subscription';
$a->ok_s_title = $invoice->getLineDescription();
if ($invoice->first_total != $invoice->second_total || $invoice->first_period != $invoice->second_period) {
$p = new Am_Period($invoice->first_period);
$a->ok_s_trial_price = $invoice->first_total;
$a->ok_s_trial_cycle = sprintf('%d %s', $p->getCount(), strtoupper($p->getUnit()));
}
$p = new Am_Period($invoice->second_period);
$a->ok_s_regular_price = $invoice->second_total;
$a->ok_s_regular_cycle = sprintf('%d %s', $p->getCount(), strtoupper($p->getUnit()));
$a->ok_s_regular_count = $invoice->rebill_times == IProduct::RECURRING_REBILLS ? 0 : $invoice->rebill_times;
}
$a->ok_payer_first_name = $invoice->getFirstName();
$a->ok_payer_last_name = $invoice->getLastName();
$a->ok_payer_street = $invoice->getStreet();
$a->ok_payer_city = $invoice->getCity();
$a->ok_payer_state = $invoice->getState();
$a->ok_payer_zip = $invoice->getZip();
$a->ok_payer_country = $invoice->getCountry();
$a->ok_ipn = $this->getPluginUrl('ipn');
$a->ok_return_success = $this->getReturnUrl();
$a->ok_return_fail = $this->getCancelUrl();
}