本文整理汇总了PHP中Am_Paysystem_Result类的典型用法代码示例。如果您正苦于以下问题:PHP Am_Paysystem_Result类的具体用法?PHP Am_Paysystem_Result怎么用?PHP Am_Paysystem_Result使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Am_Paysystem_Result类的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)
{
$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);
}
示例3: _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);
}
示例4: _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);
}
示例5: _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);
}
示例6: _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);
}
示例7: _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);
}
示例8: _process
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
{
if ($this->getConfig('instant') == 1) {
$a = new Am_Paysystem_Action_Redirect($this->getActionUrl($invoice));
} else {
$a = new Am_Paysystem_Action_Form("http://sites.fastspring.com/" . $this->getConfig('company') . "/api/order");
$a->operation = 'create';
$a->destination = 'checkout';
$i = 1;
foreach ($invoice->getItems() as $item) {
$path = "product_{$i}_path";
$quantity = "product_{$i}_quantity";
$a->{$path} = '/' . $item->getBillingPlanData('fastspring_product_id');
$a->{$quantity} = $item->qty;
$i++;
}
}
$a->contact_fname = $invoice->getFirstName();
$a->contact_lname = $invoice->getLastName();
//$a->contact_company = '';
$a->contact_email = $invoice->getEmail();
$a->contact_phone = $invoice->getPhone();
$a->referrer = $invoice->public_id;
if ($this->getConfig('testing')) {
$a->mode = 'test';
$a->member = 'new';
$a->sessionOption = 'new';
}
$coupon = $invoice->getCoupon()->code;
if ($coupon) {
$a->coupon = $coupon;
}
$result->setAction($a);
}
示例9: _process
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);
}
示例10: _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);
}
示例11: _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);
}
示例12: _process
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
{
if (!$this->getConfig('wallet_id')) {
throw new Am_Exception_Configuration("There is a configuration error in [okpay] plugin - no [wallet_id] Wallet ID or e-mail");
}
$a = new Am_Paysystem_Action_Redirect(self::URL);
$result->setAction($a);
# Payment config
$a->ok_receiver = $this->getConfig('wallet_id');
$a->ok_invoice = $invoice->getRandomizedId();
$a->ok_currency = strtoupper($invoice->currency);
$a->ok_item_1_name = $invoice->getLineDescription();
$a->ok_item_1_price = $invoice->first_total;
# Payer data
$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();
# IPN and Return URLs
$a->ok_ipn = $this->getPluginUrl('ipn');
$a->ok_return_success = $this->getReturnUrl();
$a->ok_return_fail = $this->getCancelUrl();
}
示例13: _process
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
{
$req = $this->createHttpRequest();
$req->setUrl(self::POST_URL);
$req->addPostParameter('Key', $this->getConfig('app_key'));
$req->addPostParameter('Secret', $this->getConfig('app_secret'));
$req->addPostParameter('DestinationId', $this->getConfig('destination_id'));
$req->addPostParameter('OrderId', $invoice->public_id);
$req->addPostParameter('Amount', $invoice->first_total);
$req->addPostParameter('Test', $this->getConfig('testing') ? 'true' : 'false');
$req->addPostParameter('Redirect', $this->getPluginUrl('thanks') . '?id=' . $invoice->getSecureId('THANKS'));
$req->addPostParameter('Name', $this->getDi()->config->get('site_title'));
$req->addPostParameter('Description', $invoice->getLineDescription());
$req->addPostParameter('Callback', $this->getPluginUrl('ipn'));
$this->logRequest($req);
$req->setMethod(Am_HttpRequest::METHOD_POST);
$response = $req->send();
$this->logResponse($response);
$resp = $response->getBody();
if (strstr($resp, "Invalid+application+credentials")) {
$result->setFailed("Invalid Application Credentials.");
return;
} elseif (strstr($resp, "error")) {
$result->setFailed("Invalid Response From Dwolla's server.");
return;
}
$i = strpos($resp, "checkout/");
$checkout_id = substr($resp, $i + 9, 36);
$a = new Am_Paysystem_Action_Redirect(self::REDIRECT_URL . $checkout_id);
$result->setAction($a);
}
示例14: _process
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
{
//recurring
if (!is_null($invoice->second_period)) {
if ($invoice->first_total != $invoice->second_total) {
throw new Am_Exception_InputError(___('Wepay does not support trial periods!'));
}
list($period, $end_time) = $this->getPeriod($invoice);
$mode = 'preapproval';
$params = array('account_id' => $this->getConfig('account_id'), 'amount' => $invoice->second_total, 'short_description' => $invoice->getLineDescription(), 'redirect_uri' => $this->getReturnUrl(), 'callback_uri' => $this->getPluginUrl('ipn'), 'reference_id' => $invoice->public_id, 'frequency' => 1, 'end_time' => $end_time, 'auto_recur' => 'true', 'period' => $period, 'fee_payer' => $this->getConfig('fee_payer'));
} else {
$mode = 'checkout';
$params = array('account_id' => $this->getConfig('account_id'), 'amount' => $invoice->first_total, 'short_description' => $invoice->getLineDescription(), 'type' => 'GOODS', 'redirect_uri' => $this->getPluginUrl('thanks'), 'reference_id' => $invoice->public_id, 'fee_payer' => $this->getConfig('fee_payer'));
}
$params = array_filter($params);
$req = new Am_HttpRequest($this->getUrl() . "/{$mode}/create", Am_HttpRequest::METHOD_POST);
$req->setBody(json_encode($params));
$req->setHeader("Content-Type", "application/json");
$req->setHeader("Authorization", "Bearer " . $this->getConfig('token'));
$res = $req->send();
$arr = json_decode($res->getBody(), true);
if ($res->getStatus() != 200) {
$this->getDi()->errorLogTable->log("WEPAY API ERROR : {$arr['error_code']} - {$arr['error_description']}");
throw new Am_Exception_InputError(___('Error happened during payment process. '));
}
if (!empty($arr['error_description'])) {
throw new Am_Exception_InputError($arr['error_description']);
}
$a = new Am_Paysystem_Action_Redirect(!empty($arr['checkout_uri']) ? $arr['checkout_uri'] : $arr['preapproval_uri']);
$result->setAction($a);
}
示例15: _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);
}
}