本文整理汇总了PHP中Am_Paysystem_Result::setSuccess方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Paysystem_Result::setSuccess方法的具体用法?PHP Am_Paysystem_Result::setSuccess怎么用?PHP Am_Paysystem_Result::setSuccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Am_Paysystem_Result
的用法示例。
在下文中一共展示了Am_Paysystem_Result::setSuccess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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_Stripe($this, $invoice, $doFirst);
$tr->run($result);
}
}
示例2: _doTheBill
public function _doTheBill(Invoice $invoice, $doFirst, CcRecord $cc, Am_Paysystem_Result $result)
{
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 {
//fix for previously not saved payment profile
if (!$invoice->getUser()->data()->get(Am_Paysystem_AuthorizeCim::PAYMENT_PROFILE_KEY)) {
$this->loadLastProfile($invoice);
}
$tr = new Am_Paysystem_Transaction_AuthorizeCim_CreateCustomerProfileTransaction($this, $invoice, $doFirst);
$tr->run($result);
}
}
示例3: _doBill
public function _doBill(Invoice $invoice, $doFirst, CcRecord $cc, Am_Paysystem_Result $result)
{
if ($doFirst && !(double) $invoice->first_total) {
// free trial
$tr = new Am_Paysystem_Transaction_Free($this);
$tr->setInvoice($invoice);
$tr->process();
$result->setSuccess($tr);
} else {
$request = $this->createHttpRequest();
$request->addPostParameter(array('vendor_name' => $this->getConfig('account_name'), 'vendor_password' => $this->getConfig('account_pass'), 'card_number' => $cc->cc_number, 'card_type' => 'AUTO', 'card_expiry' => $cc->getExpire(), 'card_holder' => sprintf('%s %s', $cc->cc_name_f, $cc->cc_name_l), 'payment_amount' => ($doFirst ? $invoice->first_total : $invoice->second_total) * 100, 'payment_reference' => $invoice->public_id));
$request->setMethod(Am_HttpRequest::METHOD_POST);
$request->setUrl($this->getConfig('testing') ? self::SANDBOX_URL : self::LIVE_URL);
$transaction = new Am_Paysystem_Transaction_DirectOne($this, $invoice, $request, $doFirst);
$transaction->run($result);
}
}
示例4: _doBill
public function _doBill(Invoice $invoice, $doFirst, EcheckRecord $echeck, Am_Paysystem_Result $result)
{
if ($doFirst && !(double) $invoice->first_total) {
// free trial
$tr = new Am_Paysystem_Transaction_Free($this);
$tr->setInvoice($invoice);
$tr->process();
$result->setSuccess($tr);
} else {
$user = $invoice->getUser();
$ps = new stdclass();
$ps->x_Invoice_Num = $invoice->public_id;
$ps->x_Cust_ID = $invoice->user_id;
$ps->x_Description = $invoice->getLineDescription();
$ps->x_First_Name = $echeck->cc_name_f;
$ps->x_Last_Name = $echeck->cc_name_l;
$ps->x_Address = $echeck->cc_street;
$ps->x_City = $echeck->cc_city;
$ps->x_State = $echeck->cc_state;
$ps->x_Country = $echeck->cc_country;
$ps->x_Zip = $echeck->cc_zip;
$ps->x_Tax = $doFirst ? $invoice->first_tax : $invoice->second_tax;
$ps->x_Email = $user->email;
$ps->x_Phone = $echeck->cc_phone;
$ps->x_Amount = $doFirst ? $invoice->first_total : $invoice->second_total;
$ps->x_Currency_Code = $invoice->currency;
$ps->x_Type = 'AUTH_CAPTURE';
$ps->x_Customer_IP = $user->remote_addr ? $user->remote_addr : $_SERVER['REMOTE_ADDR'];
$ps->x_Relay_Response = 'FALSE';
$ps->x_Delim_Data = 'TRUE';
$ps->x_bank_acct_num = $echeck->echeck_ban;
$ps->x_bank_aba_code = $echeck->echeck_aba;
$ps->x_bank_acct_type = $echeck->echeck_type;
$ps->x_bank_name = $echeck->check_bank_name;
$ps->x_bank_acct_name = $echeck->echeck_account_name;
$ps->x_echeck_type = 'WEB';
$ps->x_recurring_billing = $invoice->rebill_times ? 'TRUE' : 'FALSE';
$request = $this->_sendRequest($this->createHttpRequest());
$request->addPostParameter((array) $ps);
$transaction = new Am_Paysystem_Transaction_AuthorizeEcheck_Payment($this, $invoice, $request, $doFirst);
$transaction->run($result);
}
}
示例5: _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);
}
}
示例6: processRefund
public function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount)
{
$request = $this->createHttpRequest();
$ps = new stdclass();
$ps->type = 'rfnd';
$ps->reason = 'ticket.type.refund.8';
$ps->comment = 'refund request for aMember user (' . $payment->getUser()->login . ')';
if (doubleval($amount) == doubleval($payment->amount)) {
$ps->refundType = 'FULL';
} else {
$ps->refundType = 'PARTIAL_AMOUNT';
$ps->refundAmount = $amount;
}
$get_params = http_build_query((array) $ps, '', '&');
$request->setUrl($s = 'https://api.clickbank.com/rest/1.3/tickets/' . $payment->receipt_id . "?{$get_params}");
$request->setHeader(array('Content-Length' => '0', 'Accept' => 'application/xml', 'Authorization' => $this->getConfig('dev_key') . ':' . $this->getConfig('clerk_key')));
$request->setMethod(Am_HttpRequest::METHOD_POST);
$this->logRequest($request);
$request->setMethod('POST');
$response = $request->send();
$this->logResponse($response);
if ($response->getStatus() != 200 && $response->getBody() != 'Refund ticket already open') {
throw new Am_Exception_InputError("An error occurred during refund request");
}
$trans = new Am_Paysystem_Transaction_Manual($this);
$trans->setAmount($amount);
$trans->setReceiptId($payment->receipt_id . '-clickbank-refund');
$result->setSuccess($trans);
}
示例7: processRefund
public function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount)
{
$request = new Am_HttpRequest(self::REFUND_URL, Am_HttpRequest::METHOD_POST);
$vars = array('MerchantId' => $this->getConfig('merchant_id'), 'TransactionId' => $payment->receipt_id, 'Amount' => $amount, 'ContentType' => 'text');
$vars['SecurityKey'] = $this->getRefundSecurityKey($vars);
foreach ($vars as $k => $v) {
$request->addPostParameter($k, $v);
}
$this->logRequest($request);
$response = $request->send();
$this->logResponse($response);
if ($response->getStatus() != 200) {
throw new Am_Exception_InputError("An error occurred during refund request");
}
parse_str($response->getBody(), $parsed);
if ($parsed['Result'] != 'Ok') {
throw new Am_Exception_InputError("An error occurred during refund request: " . $parsed['Message']);
}
$trans = new Am_Paysystem_Transaction_Manual($this);
$trans->setAmount($amount);
$trans->setReceiptId($parsed['TransactionId'] . '-refund');
$result->setSuccess($trans);
}
示例8: cancelAction
public function cancelAction(Invoice $invoice, $actionName, Am_Paysystem_Result $result)
{
$this->invoice = $invoice;
list($payment) = $invoice->getPaymentRecords();
$params = array('key' => $this->getConfig('key'), 'ref' => $payment->receipt_id, 'uid' => $payment->user_id, 'type' => 2);
$params['sign'] = $this->calculateSignature($params, $this->getConfig('secret'));
$requst = new Am_HttpRequest(self::URL_TICKET, Am_HttpRequest::METHOD_POST);
$requst->addPostParameter($params);
$log = $this->logRequest($requst);
$responce = $requst->send();
$log->add($responce);
if ($responce->getStatus() != 200) {
$result->setFailed('Incorrect HTTP response status: ' . $responce->getStatus());
return;
}
$res = Am_Controller::decodeJson($responce->getBody());
if ($res['result'] == 1) {
$invoice->setCancelled();
$result->setSuccess();
return;
}
$result->setFailed($res['errors']);
}
示例9: storeEcheck
/**
* Function can be overrided to change behaviour
*/
public function storeEcheck(EcheckRecord $echeck, Am_Paysystem_Result $result)
{
if ($this->storesCcInfo()) {
$echeck->replace();
$result->setSuccess();
}
return $this;
}
示例10: validate
public function validate(Am_Paysystem_Result $result)
{
if ($this->params['failure_code']) {
$result->setFailed($this->params['failure_message']);
} else {
$result->setSuccess();
}
}
示例11: processRefund
function processRefund(InvoicePayment $payment, Am_Paysystem_Result $result, $amount)
{
$request = new Am_HttpRequest("https://" . $this->getConfig('login') . ":" . $this->getConfig('password') . "@payment.architrade.com/cgi-adm/refund.cgi");
$invoice = $payment->getInvoice();
$currency = $this->getCurrencyCode($invoice);
$post_params = new stdclass();
$post_params->merchant = $this->getConfig('merchant');
$post_params->amount = $amount * 100;
$count = $this->getDi()->db->selectCol("SELECT COUNT(*) FROM ?_invoice_payment\n WHERE invoice_id=?d AND dattm < ?\n ", $payment->invoice_id, $payment->dattm);
$post_params->orderId = $invoice->public_id . "-" . sprintf("%03d", array_shift($count));
$post_params->transact = $invoice->data()->get(self::TICKET);
$post_params->textreply = 'true';
$post_params->currency = $currency;
$post_params->md5key = md5($s2 = $this->getConfig('key2') . md5($s1 = $this->getConfig('key1') . "merchant=" . $this->getConfig('merchant') . "&orderid=" . $invoice->public_id . "&transact=" . $invoice->data()->get(self::TICKET) . "&amount=" . $amount));
$request->addPostParameter((array) $post_params);
$response = $request->send();
$response = $this->parseResponse($response->getBody());
if ($response['result'] === 0) {
$trans = new Am_Paysystem_Transaction_Manual($this);
$trans->setAmount($amount);
$trans->setReceiptId($payment->receipt_id . '-dibs-refund');
$result->setSuccess($trans);
} else {
$result->setFailed(array('Error Processing Refund!'));
}
}
示例12: cancelAction
function cancelAction(Invoice $invoice, $actionName, Am_Paysystem_Result $result)
{
if (!$this->getConfig('datalink_user') || !$this->getConfig('datalink_pass')) {
$this->getDi()->errorLogTable->log("ccBill plugin error: Datalink is not configured!");
return;
}
//https://datalink.ccbill.com/utils/subscriptionManagement.cgi?clientSubacc=&usingSubacc=0005&subscriptionId=1071776966&username=ccbill12&password=test123&returnXML=1&action=cancelSubscription&clientAccnum=923590
$payments = $invoice->getPaymentRecords();
$subscriptionId = $payments[0]->transaction_id;
$vars = array('clientAccnum' => $this->getConfig('account'), 'clientSubacc' => $this->getConfig('subaccount_id'), 'usingSubacc' => $this->getConfig('subaccount_id'), 'returnXML' => 1, 'action' => 'cancelSubscription', 'subscriptionId' => $subscriptionId, 'username' => $this->getConfig('datalink_user'), 'password' => $this->getConfig('datalink_pass'));
$r = new Am_HttpRequest($requestString = self::DATALINK_SUBSCR_MANAGEMENT . '?' . http_build_query($vars, '', '&'));
$response = $r->send();
if (!$response) {
$this->getDi()->errorLogTable->log('ccBill Subscription Management error: Unable to contact datalink server');
throw new Am_Exception_InternalError('ccBill Subscription Management error: Unable to contact datalink server');
}
$resp = $response->getBody();
// Log datalink requests;
$this->getDi()->errorLogTable->log(sprintf("ccBill SMS debug:\n%s\n%s", $requestString, $resp));
$xml = simplexml_load_string($resp);
if ((string) $xml != "1") {
throw new Am_Exception_InternalError('ccBill Subscription Management error: Incorrect response received while attempting to cancel subscription!');
}
$result->setSuccess();
}
示例13: storeCreditCard
/**
* Function can be overrided to change behaviour
*/
public function storeCreditCard(CcRecord $cc, Am_Paysystem_Result $result)
{
if ($this->storesCcInfo()) {
$cc->replace();
$result->setSuccess();
}
return $this;
}
示例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!'));
}
}
示例15: run
public function run(Am_Paysystem_Result $result)
{
$subscriptionid = $this->invoice->data()->get(Am_Paysystem_Epay::SUBSCRIPTIONID);
$req = $this->plugin->APIRequest('subscription', 'authorize', $vars = array('merchantnumber' => $this->plugin->getConfig('id'), 'subscriptionid' => $subscriptionid, 'orderid' => $this->invoice->public_id . "-" . $this->invoice->getPaymentsCount(), 'amount' => $this->invoice->second_total * 100, 'currency' => Am_Currency::getNumericCode($this->invoice->currency), 'instantcapture' => 1, 'description' => 'Recurring payment for invoice ' . $this->invoice->public_id, 'email' => $this->invoice->getEmail(), 'ipaddress' => $this->invoice->getUser()->remote_addr));
$log = $this->getInvoiceLog();
$log->add(print_r($vars, true));
$this->ret = $this->plugin->getResponseXML($req);
$log->add(print_r($this->ret, true));
if ($this->ret->authorizeResponse->authorizeResult != 'true') {
$result->setFailed(___("Payment failed") . ":" . $this->plugin->getEpayError($this->ret->authorizeResponse->epayresponse));
} else {
$result->setSuccess($this);
$this->processValidated();
}
}