当前位置: 首页>>代码示例>>PHP>>正文


PHP Am_Paysystem_Result::setFailed方法代码示例

本文整理汇总了PHP中Am_Paysystem_Result::setFailed方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Paysystem_Result::setFailed方法的具体用法?PHP Am_Paysystem_Result::setFailed怎么用?PHP Am_Paysystem_Result::setFailed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Am_Paysystem_Result的用法示例。


在下文中一共展示了Am_Paysystem_Result::setFailed方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _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);
 }
开发者ID:grlf,项目名称:eyedock,代码行数:26,代码来源:amex-hpp.php

示例2: _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);
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:31,代码来源:dwolla.php

示例3: run

 public function run(Am_Paysystem_Result $result)
 {
     $this->result = $result;
     $log = $this->getInvoiceLog();
     $log->add($this->request);
     $this->response = $this->request->send();
     $log->add($this->response);
     $this->validateResponseStatus($this->result);
     if ($this->result->isFailure()) {
         return;
     }
     try {
         $this->parseResponse();
         // validate function must set success status
         $this->validate();
         if ($this->result->isSuccess()) {
             $this->processValidated();
         }
     } catch (Exception $e) {
         if ($e instanceof PHPUnit_Framework_Error) {
             throw $e;
         }
         if ($e instanceof PHPUnit_Framework_Asser) {
             throw $e;
         }
         if (!$result->isFailure()) {
             $result->setFailed(___("Payment failed"));
         }
         $log->add($e);
     }
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:31,代码来源:CreditCard.php

示例4: _doBill

 public function _doBill(Invoice $invoice, $doFirst, CcRecord $cc, Am_Paysystem_Result $result)
 {
     if ($this->getConfig('set_failed')) {
         $result->setFailed('Transaction declined.');
     } elseif ($cc->cc_number != '4111111111111111') {
         $result->setFailed("Please use CC# 4111-1111-1111-1111 for successful payments with demo plugin");
     } elseif ($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_CcDemo($this, $invoice, null, $doFirst);
         $result->setSuccess($tr);
         $tr->processValidated();
     }
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:18,代码来源:cc-demo.php

示例5: _doBill

 public function _doBill(Invoice $invoice, $doFirst, CcRecord $cc, Am_Paysystem_Result $result)
 {
     if ($cc->cc_number != '4111111111111111') {
         $result->setFailed("Please use CC# 4111-1111-1111-1111 for successful payments with demo plugin");
     } else {
         $tr = new Am_Paysystem_Transaction_CcDemo($this, $invoice, null, $doFirst);
         $result->setSuccess($tr);
         $tr->processValidated();
     }
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:10,代码来源:cc-demo.php

示例6: _doBill

 public function _doBill(Invoice $invoice, $doFirst, CcRecord $cc, Am_Paysystem_Result $result)
 {
     $client = new SoapClient(self::WSDL);
     $user = $invoice->getUser();
     if ($cc) {
         $data = array('customer_firstname' => $user->name_f ? $user->name_f : $cc->cc_name_f, 'customer_lastname' => $user->name_l ? $user->name_l : $cc->cc_name_l, 'customer_email' => $user->email, 'holder_firstname' => $cc->cc_name_f, 'holder_lastname' => $cc->cc_name_l, 'pan' => $cc->cc_number, 'digit' => $cc->getCvv(), 'exp' => $cc->getExpire('%02d-20%02d'));
         $data = base64_encode(serialize($data));
         $param = array($this->getConfig('apiKey'), $data);
         $request = new SoapRequestWrapperComenpay($client, 'AddCustomerData', $param);
         $t = new Am_Paysystem_Transaction_CreditCard_Comenpay_AddCustomerData($this, $invoice, $request, $user);
         $r = new Am_Paysystem_Result();
         $t->run($r);
         if ($r->isFailure()) {
             $result->setFailed($r->getErrorMessages());
             return;
         }
     }
     if (!$user->data()->get(self::COMENPAY_CARD_TOKEN)) {
         $result->setFailed('Can not process payment: customer has not associated CC');
         return;
     }
     if ($doFirst && !(double) $invoice->first_total) {
         //free trial
         $t = new Am_Paysystem_Transaction_Free($this);
         $t->setInvoice($invoice);
         $t->process();
         $result->setSuccess();
     } else {
         $payment = null;
         @(list($payment) = $invoice->getPaymentRecords());
         $data = array('paccount_id' => $this->getConfig('paccount_id'), 'type' => $payment ? 'REBILL' : 'BILL', 'transaction_ip' => $user->last_ip, 'amount_cnts' => 100 * ($doFirst ? $invoice->first_total : $invoice->second_total), 'client_reference' => $invoice->public_id, 'client_customer_id' => $user->pk(), 'affiliate_id' => 0, 'site_url' => $this->getDi()->config->get('site_url'), 'member_login' => $user->login, 'support_url' => $this->getDi()->config->get('site_url'), 'support_tel' => 'N/A', 'support_email' => $this->getDi()->config->get('admin_email'), 'customer_lang' => 'en', 'customer_useragent' => $user->last_user_agent, 'billing_invoicing_id' => 0, 'billing_description' => $invoice->getLineDescription(), 'billing_preauth_duration' => 0, 'billing_rebill_period' => 0, 'billing_rebill_duration' => 0, 'billing_rebill_price_cnts' => 100 * $invoice->second_total);
         if ($payment) {
             $data['billing_initial_transaction_id'] = $payment->receipt_id;
         }
         $param = array($this->getConfig('apiKey'), $user->data()->get(self::COMENPAY_CARD_TOKEN), $user->data()->get(self::COMENPAY_CARD_KEY), $data);
         $request = new SoapRequestWrapperComenpay($client, 'Transaction', $param);
         $t = new Am_Paysystem_Transaction_CreditCard_Comenpay_Transaction($this, $invoice, $request, $doFirst);
         $t->run($result);
     }
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:40,代码来源:comenpay.php

示例7: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $user = $invoice->getUser();
     $req = new Am_HttpRequest($this->host() . 'trnRegister', Am_HttpRequest::METHOD_POST);
     $vars = array('p24_merchant_id' => $this->getConfig('merchant_id'), 'p24_pos_id' => $this->getConfig('pos_id'), 'p24_session_id' => $invoice->public_id, 'p24_amount' => $invoice->first_total * 100, 'p24_currency' => $invoice->currency, 'p24_description' => $invoice->getLineDescription(), 'p24_email' => $user->email, 'p24_country' => $user->country, 'p24_url_return' => $this->getReturnUrl(), 'p24_url_status' => $this->getPluginUrl('ipn'), 'p24_time_limit' => 5, 'p24_encoding' => 'UTF-8', 'p24_api_version' => '3.2');
     $vars['p24_sign'] = $this->sign(array($vars['p24_session_id'], $vars['p24_pos_id'], $vars['p24_amount'], $vars['p24_currency']));
     $req->addPostParameter($vars);
     $this->logRequest($req);
     $resp = $req->send();
     $this->logResponse($resp);
     if ($resp->getStatus() != 200) {
         $result->setFailed('Incorrect HTTP response status: ' . $resp->getStatus());
         return;
     }
     parse_str($resp->getBody(), $params);
     if ($params['error']) {
         $result->setFailed(explode('&', $params['errorMessage']));
         return;
     }
     $a = new Am_Paysystem_Action_Redirect($this->host() . 'trnRequest/' . $params['token']);
     $result->setAction($a);
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:22,代码来源:przelewy24.php

示例8: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $user = $invoice->getUser();
     if (!$user->data()->get(self::DATA_KEY)) {
         //create user
         $req = new Am_HttpRequest($this->url(), Am_HttpRequest::METHOD_POST);
         $req->addPostParameter(array('fn' => 'eWallet_RegisterUser', 'MerchantGUID' => $this->getConfig('MerchantGUID'), 'MerchantPassword' => $this->getConfig('MerchantPassword'), 'UserName' => $user->login, 'FirstName' => $user->name_f, 'LastName' => $user->name_l, 'EmailAddress' => $user->email, 'DateOfBirth' => '1/1/1900'));
         $this->logRequest($req);
         $resp = $req->send();
         $this->logResponse($resp);
         if ($resp->getStatus() != 200) {
             $result->setFailed('Incorrect HTTP response status: ' . $resp->getStatus());
             return;
         }
         parse_str($resp->getBody(), $tmp);
         parse_str($tmp['response'], $params);
         if ($params['m_Code'] != 'NO_ERROR') {
             $result->setFailed($params['m_Text']);
             return;
         }
         $user->data()->set(self::DATA_KEY, $params['TransactionRefID'])->update();
     }
     //create invoice
     $req = new Am_HttpRequest($this->url(), Am_HttpRequest::METHOD_POST);
     $arrItems = array('Amount' => $invoice->first_total, 'CurrencyCode' => $invoice->currency, 'ItemDescription' => $invoice->getLineDescription(), 'MerchantReferenceID' => $invoice->public_id, 'UserReturnURL' => $this->getReturnUrl(), 'MustComplete' => 'false', 'IsSubscription' => 'false');
     $req->addPostParameter(array('fn' => 'eWallet_AddCheckoutItems', 'MerchantGUID' => $this->getConfig('MerchantGUID'), 'MerchantPassword' => $this->getConfig('MerchantPassword'), 'UserName' => $user->login, 'arrItems' => sprintf('[%s]', http_build_query($arrItems)), 'AutoChargeAccount' => 'false'));
     $this->logRequest($req);
     $resp = $req->send();
     $this->logResponse($resp);
     if ($resp->getStatus() != 200) {
         $result->setFailed('Incorrect HTTP response status: ' . $resp->getStatus());
         return;
     }
     parse_str($resp->getBody(), $tmp);
     parse_str($tmp['response'], $params);
     if ($params['m_Code'] != 'NO_ERROR') {
         $result->setFailed($params['m_Text']);
         return;
     }
     //login and redirect
     $req = new Am_HttpRequest($this->url(), Am_HttpRequest::METHOD_POST);
     $req->addPostParameter(array('fn' => 'eWallet_RequestUserAutoLogin', 'MerchantGUID' => $this->getConfig('MerchantGUID'), 'MerchantPassword' => $this->getConfig('MerchantPassword'), 'UserName' => $user->login));
     $this->logRequest($req);
     $resp = $req->send();
     $this->logResponse($resp);
     if ($resp->getStatus() != 200) {
         $result->setFailed('Incorrect HTTP response status: ' . $resp->getStatus());
         return;
     }
     parse_str($resp->getBody(), $tmp);
     parse_str($tmp['responset'], $params);
     if ($params['m_Code'] != 'NO_ERROR') {
         $result->setFailed($params['m_Text']);
         return;
     }
     $a = new Am_Paysystem_Action_Redirect($this->urlLogin());
     $a->secKey = $params['m_ProcessorTransactionRefNumber'];
     $result->setAction($a);
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:59,代码来源:i-payout.php

示例9: _doBill

 public function _doBill(Invoice $invoice, $doFirst, CcRecord $cc, Am_Paysystem_Result $result)
 {
     $addCc = true;
     // if it is a first charge, or user have valid CC info in file, we should use cc_info instead of reference transaction.
     // This is necessary when data was imported from amember v3 for example
     if ($doFirst || !empty($cc->cc_number) && $cc->cc_number != '0000000000000000') {
         if ($doFirst && doubleval($invoice->first_total) == 0) {
             $tr = new Am_Paysystem_Payflow_Transaction_Authorization($this, $invoice, $doFirst, $cc);
         } else {
             $tr = new Am_Paysystem_Payflow_Transaction_Sale($this, $invoice, $doFirst, $cc);
         }
     } else {
         $user = $invoice->getUser();
         $profileId = $user->data()->get(self::USER_PROFILE_KEY);
         if (!$profileId) {
             return $result->setFailed(array("No saved reference transaction for customer"));
         }
         $tr = new Am_Paysystem_Payflow_Transaction_Sale($this, $invoice, $doFirst, null, $profileId);
     }
     $tr->run($result);
 }
开发者ID:grlf,项目名称:eyedock,代码行数:21,代码来源:payflow.php

示例10: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $u = $invoice->getUser();
     $msp = $this->createMSP();
     $msp->merchant['notification_url'] = $this->getPluginUrl('ipn');
     $msp->merchant['cancel_url'] = $this->getCancelUrl();
     $msp->merchant['redirect_url'] = $this->getReturnUrl();
     $msp->customer['locale'] = 'en';
     $msp->customer['firstname'] = $u->name_f;
     $msp->customer['lastname'] = $u->name_l;
     $msp->customer['zipcode'] = $u->zip;
     $msp->customer['city'] = $u->city;
     $msp->customer['country'] = $u->country;
     $msp->customer['email'] = $u->email;
     $msp->parseCustomerAddress($member['street']);
     /*
      * Transaction Details
      */
     $msp->transaction['id'] = $invoice->public_id;
     // generally the shop's order ID is used here
     $msp->transaction['currency'] = $invoice->currency;
     $msp->transaction['amount'] = $invoice->first_total * 100;
     // cents
     $msp->transaction['description'] = $invoice->getLineDescription();
     $out = '';
     foreach ($invoice->getItems() as $item) {
         $out .= sprintf('<li>%s</li>', htmlspecialchars($item->item_title));
     }
     $msp->transaction['items'] = sprintf('<br/><ul>%s</ul>', $out);
     $url = $msp->startTransaction();
     if ($msp->error) {
         $result->setFailed(___('Error happened during payment process. ') . ' (' . $msp->error_code . ": " . $msp->error . ')');
         return;
     }
     $a = new Am_Paysystem_Action_Redirect($url);
     $result->setAction($a);
 }
开发者ID:grlf,项目名称:eyedock,代码行数:37,代码来源:multisafepay.php

示例11: storeCreditCard

 public function storeCreditCard(CcRecord $cc, Am_Paysystem_Result $result)
 {
     $profiles = array();
     //Find all profiles which should be updated.
     foreach ($this->getDi()->db->selectPage($total, "\n            SELECT d.value, i.invoice_id \n            FROM ?_data d LEFT JOIN ?_invoice i \n            ON d.`table` = 'invoice' AND d.`key` = ? AND  d.id = i.invoice_id \n            WHERE i.user_id = ? AND i.status = ?", self::PAYPAL_PROFILE_ID, $cc->user_id, Invoice::RECURRING_ACTIVE) as $profile) {
         $profiles[$profile['value']] = $profile['invoice_id'];
     }
     $failures = array();
     foreach ($profiles as $profile_id => $invoice_id) {
         $request = new Am_Paysystem_PaypalApiRequest($this);
         $request->setCc($invoice = $this->getDi()->invoiceTable->load($invoice_id), $cc);
         $request->addPostParameter('METHOD', 'UpdateRecurringPaymentsProfile');
         $request->addPostParameter('PROFILEID', $profile_id);
         $request->addPostParameter('NOTE', 'Update CC info, customer IP: ' . Zend_Controller_Front::getInstance()->getRequest()->getHttpHost());
         $log = Am_Di::getInstance()->invoiceLogRecord;
         $log->title = "updateRecurringPaymentsProfile";
         $log->paysys_id = $this->getId();
         $res = $request->sendRequest($log);
         $log->setInvoice($invoice);
         $log->update();
         if ($res['ACK'] != 'Success') {
             $failures[] = sprintf('CC info was not updated for profile: %s. Got error from paypal: %s', $profile_id, $res['L_SHORTMESSAGE0']);
         }
     }
     if (count($failures)) {
         $result->setFailed($failures);
     } else {
         $result->setSuccess();
     }
 }
开发者ID:grlf,项目名称:eyedock,代码行数:30,代码来源:paypal-pro.php

示例12: validate

 protected function validate(Am_Paysystem_Result $result)
 {
     if ($this->params['data']['response_code'] != 20000) {
         $result->setFailed(array(___('Refund Failed')));
         return;
     }
     $result->setSuccess();
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:8,代码来源:paymill-dd.php

示例13: validate

 public function validate(Am_Paysystem_Result $result)
 {
     if ($this->params['failure_code']) {
         $result->setFailed($this->params['failure_message']);
     } else {
         $result->setSuccess();
     }
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:8,代码来源:omise.php

示例14: processRefund

 function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount)
 {
     list(, $trans_id) = split("-", $payment->receipt_id);
     try {
         $r = new Am_HttpRequest($this->getAPIURL(self::API_REFUND, array('TRANSACTION_ID' => $trans_id, 'MERCHANT_ID' => $this->getConfig("merchant_id"), 'ZombaioGWPass' => $this->getConfig("password"), 'Refund_Type' => 1)));
         $response = $r->send();
     } catch (Exception $e) {
         $this->getDi()->errorLogTable->logException($e);
     }
     if ($response && $response->getBody() == 1) {
         $trans = new Am_Paysystem_Transaction_Manual($this);
         $trans->setAmount($amount);
         $trans->setReceiptId($payment->receipt_id . '-zombaio-refund');
         $result->setSuccess($trans);
     } else {
         $result->setFailed(array('Error Processing Refund!'));
     }
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:18,代码来源:zombaio.php

示例15: run

 public function run(Am_Paysystem_Result $result)
 {
     $request = $this->plugin->createHttpRequest();
     $paymentsCount = $this->invoice->getPaymentsCount() + 1;
     $vars = array('VPSProtocol' => '3.0', 'TxType' => 'REPEAT', 'Vendor' => $this->getPlugin()->getConfig('login'), 'VendorTxCode' => $this->invoice->public_id . '-AMEMBER-' . $paymentsCount, 'Amount' => number_format($this->invoice->second_total, 2, '.', ''), 'Currency' => $this->invoice->currency ? $this->invoice->currency : 'USD', 'Description' => $this->invoice->getLineDescription(), 'RelatedVPSTxId' => $this->invoice->data()->get('sagepay_vpstxid'), 'RelatedVendorTxCode' => $this->invoice->data()->get('sagepay_vendortxcode'), 'RelatedSecurityKey' => $this->invoice->data()->get('sagepay_securitykey'), 'RelatedTxAuthNo' => $this->invoice->data()->get('sagepay_txauthno'));
     $request->addPostParameter($vars);
     $request->setUrl($this->plugin->getConfig('testing') ? Am_Paysystem_Sagepay::REPEAT_TEST_URL : Am_Paysystem_Sagepay::REPEAT_LIVE_URL);
     $request->setMethod(Am_HttpRequest::METHOD_POST);
     $this->plugin->logRequest($request);
     $response = $request->send();
     $this->plugin->logResponse($response);
     if (!$response->getBody()) {
         $result->setFailed(___("Payment failed") . ":" . ___("Empty response from Sagepay server"));
     } else {
         $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') {
             $this->ret = $res;
             $result->setSuccess($this);
             $this->processValidated();
         } else {
             $result->setFailed(___("Payment failed") . ":" . $res['StatusDetail']);
         }
     }
 }
开发者ID:grlf,项目名称:eyedock,代码行数:28,代码来源:sagepay.php


注:本文中的Am_Paysystem_Result::setFailed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。