本文整理汇总了PHP中Am_Paysystem_Result::setErrorMessages方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Paysystem_Result::setErrorMessages方法的具体用法?PHP Am_Paysystem_Result::setErrorMessages怎么用?PHP Am_Paysystem_Result::setErrorMessages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Am_Paysystem_Result
的用法示例。
在下文中一共展示了Am_Paysystem_Result::setErrorMessages方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _process
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
{
$vars = $this->getConfig();
$vars['Amount'] = $invoice->first_total;
$vars['Currency'] = $invoice->currency;
$vars['ReturnUrl'] = $this->getPluginUrl('thanks');
$vars['CancelUrl'] = $this->getCancelUrl();
$vars['MerchantInvoice'] = $invoice->public_id;
$vars['MerchantReference'] = $invoice->public_id;
$vars['CustomerFirstName'] = $invoice->getFirstName();
$vars['CustomerLastName'] = $invoice->getLastName();
$vars['CustomerAddress'] = $invoice->getStreet();
$vars['CustomerCity'] = $invoice->getCity();
$vars['CustomerState'] = $invoice->getState();
$vars['InvoiceDescription'] = $invoice->getLineDescription();
$vars['CustomerCountry'] = $invoice->getCountry();
$vars['CustomerPhone'] = $invoice->getPhone();
$vars['CustomerEmail'] = $invoice->getEmail();
$r = new Am_HttpRequest($this->getUrl() . '?' . http_build_query($vars, '', '&'));
$response = $r->send()->getBody();
if (!$response) {
$this->getDi()->errorLogTable->log('Plugin eWAY: Got empty response from API server');
$result->setErrorMessages(array(___("An error occurred while handling your payment.")));
return;
}
$xml = simplexml_load_string($response);
if (!empty($xml->Error)) {
$this->getDi()->errorLogTable->log('Plugin eWAY: Got error from API: ' . (string) $xml->Error);
$result->setErrorMessages(array(___("An error occurred while handling your payment.")));
return;
}
$action = new Am_Paysystem_Action_Redirect($xml->URI);
$result->setAction($action);
}
示例2: validateResponseStatus
public function validateResponseStatus(Am_Paysystem_Result $result)
{
if ($this->response->getStatus() != 200) {
$result->setErrorMessages(array("Received invalid response from payment server: " . $this->response->getStatus()));
return false;
}
return true;
}
示例3: _doBill
public function _doBill(Invoice $invoice, $doFirst, CcRecord $cc, Am_Paysystem_Result $result)
{
$token = $invoice->getUser()->data()->get(self::TOKEN);
if (!$token) {
return $result->setErrorMessages(array(___('Payment failed')));
}
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 {
$tr = new Am_Paysystem_Transaction_Paymill($this, $invoice, $doFirst);
$tr->run($result);
}
}
示例4: _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);
}