本文整理汇总了PHP中Invoice::getUserId方法的典型用法代码示例。如果您正苦于以下问题:PHP Invoice::getUserId方法的具体用法?PHP Invoice::getUserId怎么用?PHP Invoice::getUserId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Invoice
的用法示例。
在下文中一共展示了Invoice::getUserId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _process
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
{
include_once dirname(__FILE__) . '/SOPGClassicMerchantClient.php';
$client = new SOPGClassicMerchantClient($this->getConfig('testing') ? self::TEST_API_URL : self::LIVE_API_URL);
$mtid = $invoice->public_id;
//$this->generateMtid();
// SEE par.2
if ($invoice->first_total > 1000) {
throw new InvalidArgumentException('The maximum amount value of dispositions is 1000.00');
}
// see par.2
$request = array($this->getConfig('login'), $this->getConfig('password'), $mtid, null, sprintf('%.2f', $invoice->first_total), $invoice->currency, urlencode($this->getReturnUrl()), urlencode($this->getPluginUrl('cancelpaysafecart') . "?id=" . $invoice->getSecureId('CANCEL')), $invoice->getUserId(), urlencode($this->getPluginUrl()), null);
$this->logRequest($request);
$response = call_user_func_array(array($client, 'createDisposition'), $request);
$this->logResponse(get_object_vars($response));
if ($response->resultCode != 0 || $response->errorCode != 0) {
// SEE par.4
$result->setErrorMessages(array('Transaction could not be initiated due to connection problems.'));
//$result->setErrorMessages(array('Error during request to paysafecard server'));
// see par.4
return;
}
$a = new Am_Paysystem_Action_Redirect($this->getConfig('testing') ? self::TEST_REDIRECT_URL : self::LIVE_REDIRECT_URL);
$a->mid = $response->mid;
$a->mtid = $mtid;
$a->amount = sprintf('%.2f', $invoice->first_total);
$a->currency = $invoice->currency;
$result->setAction($a);
}
示例2: calculateStartDate
public function calculateStartDate($paymentDate, Invoice $invoice)
{
if ($paymentDate instanceof DateTime) {
$paymentDate = $paymentDate->format('Y-m-d');
}
$ret = array();
$setting = $this->getStartDate();
$callArgs = array();
if (in_array(self::SD_PRODUCT, $setting)) {
$callArgs['product_id'] = $this->product_id;
}
if (in_array(self::SD_GROUP, $setting)) {
$callArgs['renewal_group'] = $this->renewal_group;
}
if (in_array(self::SD_PAYMENT, $setting)) {
$ret[] = $paymentDate;
}
if (in_array(self::SD_FIXED, $setting) && $this->start_date_fixed) {
$ret[] = $this->start_date_fixed;
}
if (count($callArgs)) {
$callArgs['user_id'] = $invoice->getUserId();
$ret[] = $this->getDi()->accessTable->getLastExpire($callArgs);
}
$ret = array_filter($ret);
if (!$ret) {
$ret[] = $this->getDi()->sqlDate;
}
return max($ret);
}
示例3: calculateStartDate
public function calculateStartDate($paymentDate, Invoice $invoice)
{
if ($paymentDate instanceof DateTime) {
$paymentDate = $paymentDate->format('Y-m-d');
}
$ret = array();
$setting = $this->getStartDate();
$callArgs = array();
if (in_array(self::SD_PRODUCT, $setting)) {
$callArgs['product_id'] = $this->product_id;
}
if (in_array(self::SD_GROUP, $setting)) {
$callArgs['renewal_group'] = $this->renewal_group;
}
if (in_array(self::SD_PAYMENT, $setting)) {
$ret[] = $paymentDate;
}
if (in_array(self::SD_FIXED, $setting) && $this->start_date_fixed) {
$ret[] = $this->start_date_fixed;
}
if (count($callArgs)) {
$callArgs['user_id'] = $invoice->getUserId();
$ret[] = $this->getDi()->accessTable->getLastExpire($callArgs);
}
foreach (array(self::SD_WEEKDAY_SUN, self::SD_WEEKDAY_MON, self::SD_WEEKDAY_TUE, self::SD_WEEKDAY_WED, self::SD_WEEKDAY_THU, self::SD_WEEKDAY_FRI, self::SD_WEEKDAY_SAT) as $sd) {
if (in_array($sd, $setting)) {
preg_match('/w([0-6])/i', $sd, $matches);
$need = $matches[1];
/* @var $date DateTime */
$date = $this->getDi()->dateTime;
$now = $date->format('w');
$diff = (7 + $need - $now) % 7;
$date->modify("+{$diff} days");
$ret[] = $date->format('Y-m-d');
}
}
foreach (array(self::SD_MONTH_1, self::SD_MONTH_15) as $sd) {
if (in_array($sd, $setting)) {
preg_match('/m([0-6]+)/i', $sd, $matches);
$need = $matches[1];
/* @var $date DateTime */
$date = $this->getDi()->dateTime;
$now = $date->format('d');
$m = $now < $need ? 0 : 1;
$date->modify("+{$m} months");
$ret[] = $date->format('Y-m-' . sprintf('%02d', $need));
}
}
$ret = array_filter($ret);
if (!$ret) {
$ret[] = $this->getDi()->sqlDate;
}
return max($ret);
}
示例4: _process
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
{
$vars = array('x_version' => '3.1', 'x_login' => $this->getConfig('login'), 'x_test_request' => $this->getTestRequestStatus(), 'x_show_form' => 'PAYMENT_FORM', 'x_amount' => $price = sprintf('%.2f', $invoice->first_total), 'x_receipt_link_url' => $this->getPluginUrl('thanks'), 'x_relay_url' => $this->getPluginUrl('thanks'), 'x_relay_response' => 'TRUE', 'x_cancel_url' => $this->getCancelUrl(), 'x_invoice_num' => $invoice->public_id, 'x_cust_id' => $invoice->getUserId(), 'x_description' => $invoice->getLineDescription(), 'x_fp_sequence' => $invoice->public_id, 'x_fp_timestamp' => $tstamp = time(), 'x_address' => $invoice->getStreet(), 'x_city' => $invoice->getCity(), 'x_country' => $invoice->getCountry(), 'x_state' => $invoice->getState(), 'x_zip' => $invoice->getZip(), 'x_email' => $invoice->getEmail(), 'x_first_name' => $invoice->getFirstName(), 'x_last_name' => $invoice->getLastName(), 'x_fp_hash' => hash_hmac('md5', $this->getConfig('login') . "^" . $invoice->public_id . "^" . $tstamp . "^" . $price . "^", $this->getConfig('tkey')));
$action = new Am_Paysystem_Action_Redirect($this->getRedirectUrl() . "?" . http_build_query($vars, '', '&'));
$result->setAction($action);
}