本文整理汇总了PHP中Invoice::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Invoice::getUser方法的具体用法?PHP Invoice::getUser怎么用?PHP Invoice::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Invoice
的用法示例。
在下文中一共展示了Invoice::getUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _process
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
{
$u = $invoice->getUser();
$domain = $this->getConfig('testing') ? Am_Paysystem_Xfers::SANDBOX_DOMAIN : Am_Paysystem_Xfers::LIVE_DOMAIN;
$a = new Am_Paysystem_Action_Form('https://' . $domain . '/api/v2/payments');
$a->api_key = $this->getConfig('api_key');
$a->order_id = $invoice->public_id;
$a->cancel_url = $this->getCancelUrl();
$a->return_url = $this->getReturnUrl();
$a->notify_url = $this->getPluginUrl('ipn');
if ($invoice->first_tax) {
$a->tax = $invoice->first_tax;
}
/* @var $item InvoiceItem */
$i = 1;
foreach ($invoice->getItems() as $item) {
$a->{'item_name_' . $i} = $item->item_title;
$a->{'item_description_' . $i} = $item->item_description;
$a->{'item_quantity_' . $i} = $item->qty;
$a->{'item_price_' . $i} = $item->first_price;
$i++;
}
$a->total_amount = $invoice->first_total;
$a->currency = $invoice->currency;
$a->user_email = $invoice->getUser()->email;
$a->signature = sha1($a->api_key . $this->getConfig('api_secret') . $a->order_id . $a->total_amount . $a->currency);
$result->setAction($a);
}
示例2: _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);
}
}
示例3: _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);
}
示例4: createForm
public function createForm()
{
$form = $this->plugin->createForm($this->_request->getActionName(), $this->invoice);
$form->setDataSources(array($this->_request, new HTML_QuickForm2_DataSource_Array($form->getDefaultValues($this->invoice->getUser()))));
$form->addHidden(Am_Controller::ACTION_KEY)->setValue($this->_request->getActionName());
$form->addHidden('id')->setValue($this->getFiltered('id'));
return $form;
}
示例5: _process
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
{
$vars = array('amount' => $invoice->first_total, 'currency' => $invoice->currency, 'shop_reference_card' => $this->getConfig('shop_reference'), 'shop_reference_transfer' => $this->getConfig('shop_reference'), 'shop_name' => $this->getConfig('shop_name'), 'transaction_description' => $invoice->getLineDescription(), 'order_id' => $invoice->public_id, 'return_address' => $this->getPluginUrl('status-return-' . $invoice->public_id), 'success_url' => $this->getPluginUrl('status-ok-' . $invoice->public_id), 'failure_url' => $this->getPluginUrl('status-fail-' . $invoice->public_id), 'customer_first_name' => $invoice->getUser()->name_f, 'customer_second_name' => $invoice->getUser()->name_l, 'customer_email' => $invoice->getUser()->email);
$this->getDi()->errorLogTable->log('paymento-request: [' . print_r($vars, true) . ']');
$action = new Am_Paysystem_Action_Form($this->getPaymentUrl());
foreach ($vars as $key => $value) {
$action->{$key} = $value;
}
$result->setAction($action);
}
示例6: _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']);
}
}
示例7: _doBill
public function _doBill(Invoice $invoice, $doFirst, CcRecord $cc, Am_Paysystem_Result $result)
{
$user = $invoice->getUser();
if ($cc->user_id != $user->pk()) {
throw new Am_Exception_Paysystem("Assertion failed: cc.user_id != user.user_id");
}
// will be stored only if cc# or expiration changed
$this->storeCreditCard($cc, $result);
if (!$result->isSuccess()) {
return;
}
$user->refresh();
// we have both profile id and payment id, run the necessary transaction now if amount > 0
$result->reset();
if ($doFirst && doubleval($invoice->first_total) <= 0) {
// free trial
$tr = new Am_Paysystem_Transaction_Free($this);
$tr->setInvoice($invoice);
$tr->process();
$result->setSuccess($tr);
} else {
$request = array($this->getConfig('key'), $this->getConfig('testing'), $user->data()->get(self::CUSTOMER_VAULT_ID), null, $this->getConfig('project'), '', '', '', $doFirst ? intval($invoice->first_total * 100) : intval($invoice->second_total * 100), $invoice->currency, $invoice->getLineDescription(), $invoice->getLineDescription(), $user->remote_addr ? $user->remote_addr : $_SERVER['REMOTE_ADDR']);
$tr = new Am_Paysystem_Transaction_MicropaymentDbtSale($this, $invoice, $request, $doFirst);
$tr->run($result);
}
}
示例8: _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);
}
示例9: _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);
}
示例10: _process
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
{
$a = new Am_Paysystem_Action_Redirect($this->getUrl());
$params = array('PSPID' => $this->getConfig('pspid'), 'ORDERID' => $invoice->public_id, 'AMOUNT' => $invoice->first_total * 100, 'CURRENCY' => $invoice->currency, 'LANGUAGE' => 'en_US', 'CN' => $invoice->getUser()->getName(), 'EMAIL' => $invoice->getUser()->email, 'COM' => $invoice->getLineDescription(), 'ACCEPTURL' => $this->getReturnUrl(), 'DECLINEURL' => $this->getCancelUrl(), 'CANCELURL' => $this->getCancelUrl(), 'EXCEPTIONURL' => $this->getCancelUrl());
ksort($params, SORT_STRING);
$s = '';
foreach ($params as $k => $v) {
$s .= $k . '=' . $v . $this->getConfig('shain');
}
$params['SHASIGN'] = sha1($s);
foreach ($params as $k => $v) {
$a->{$k} = $v;
}
$this->logRequest($a);
$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: _doBill
public function _doBill(Invoice $invoice, $doFirst, CcRecord $cc, Am_Paysystem_Result $result)
{
$user = $invoice->getUser();
if ($cc->user_id != $user->pk()) {
throw new Am_Exception_Paysystem("Assertion failed: cc.user_id != user.user_id");
}
// will be stored only if cc# or expiration changed
$this->storeCreditCard($cc, $result);
if (!$result->isSuccess()) {
return;
}
$user->refresh();
// we have both profile id and payment id, run the necessary transaction now if amount > 0
$result->reset();
if ($doFirst && !$invoice->first_total) {
// free trial
$tr = new Am_Paysystem_Transaction_Free($this);
$tr->setInvoice($invoice);
$tr->process();
$result->setSuccess($tr);
} else {
$tr = new Am_Paysystem_Transaction_Securepaycomau_Payment($this, $invoice, $doFirst);
$tr->run($result);
}
}
示例13: _doBill
public function _doBill(Invoice $invoice, $doFirst, CcRecord $cc, Am_Paysystem_Result $result)
{
$xml = new SimpleXMLElement('<ewaygateway></ewaygateway>');
$xml->ewayCustomerID = $this->getConfig('customer_id');
$xml->ewayTotalAmount = $doFirst ? $invoice->first_total * 100 : $invoice->second_total * 100;
$xml->ewayCustomerFirstName = $cc->cc_name_f;
$xml->ewayCustomerLastName = $cc->cc_name_l;
$xml->ewayCustomerEmail = $invoice->getUser()->email;
$xml->ewayCustomerAddress = $cc->cc_street;
$xml->ewayCustomerPostcode = $cc->cc_zip;
$xml->ewayCustomerInvoiceDescription = $invoice->getLineDescription();
$xml->ewayCustomerInvoiceRef = $invoice->public_id;
$xml->ewayCardHoldersName = sprintf('%s %s', $cc->cc_name_f, $cc->cc_name_l);
$xml->ewayCardNumber = $cc->cc_number;
$xml->ewayCardExpiryMonth = $cc->getExpire('%1$02d');
$xml->ewayCardExpiryYear = $cc->getExpire('%2$02d');
$xml->ewayTrxnNumber = $invoice->public_id;
$xml->ewayOption1 = '';
$xml->ewayOption2 = '';
$xml->ewayOption3 = '';
$xml->ewayCVN = $cc->getCvv();
$request = new Am_HttpRequest($this->getGateway(), Am_HttpRequest::METHOD_POST);
$request->setBody($xml->asXML());
$request->setHeader('Content-type', 'text/xml');
$tr = new Am_Paysystem_Transaction_CreditCard_Eway($this, $invoice, $request, $doFirst);
$tr->run($result);
}
示例14: _process
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->pay_to_email = $this->getConfig('business');
$a->pay_from_email = $u->email;
$a->transaction_id = $invoice->public_id;
$a->amount = $invoice->first_total;
$a->currency = $invoice->currency;
$a->language = $u->lang;
$a->return_url = $this->getReturnUrl();
$a->cancel_url = $this->getCancelUrl();
$a->status_url = $this->getPluginUrl('ipn');
$a->detail1_text = $invoice->getLineDescription();
$a->firstname = $u->name_f;
$a->lastname = $u->name_l;
$a->address = $u->street;
$a->postal_code = $u->zip;
$a->city = $u->city;
$a->state = $u->state;
$a->country = $u->country;
if ($invoice->second_total > 0) {
$a->rec_amount = $invoice->second_total;
$periods = array('m' => 'month', 'y' => 'year', 'd' => 'day');
$second_period = new Am_Period($invoice->second_period);
$a->rec_cycle = $periods[$second_period->getUnit()];
$a->rec_period = $second_period->getCount();
$a->rec_start_date = date('Y/m/d', strtotime($invoice->calculateRebillDate(1)));
$a->rec_status_url = $this->getPluginUrl('ipn');
}
$result->setAction($a);
}
示例15: _process
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);
}