本文整理汇总了PHP中Varien_Object::getCcTransId方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Object::getCcTransId方法的具体用法?PHP Varien_Object::getCcTransId怎么用?PHP Varien_Object::getCcTransId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Object
的用法示例。
在下文中一共展示了Varien_Object::getCcTransId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _buildBasicRequest
/**
* Prepare base request
*
* @access public
* @return object which was set with all basic required information
*/
protected function _buildBasicRequest(Varien_Object $payment)
{
if (!$payment->getTender()) {
$payment->setTender(self::TENDER_CC);
}
$request = Mage::getModel('paygate/payflow_pro_request')->setUser($this->getConfigData('user'))->setVendor($this->getConfigData('vendor'))->setPartner($this->getConfigData('partner'))->setPwd($this->getConfigData('pwd'))->setTender($payment->getTender())->setTrxtype($payment->getTrxtype())->setVerbosity($this->getConfigData('verbosity'))->setRequestId($this->_generateRequestId())->setOrigid($payment->getCcTransId());
return $request;
}
示例2: refund
/**
* Refunds specified amount
*
* @param Varien_Object $payment
* @param decimal $amount
* @return Braintree_Payments_Model_Paymentmethod
*/
public function refund(Varien_Object $payment, $amount)
{
$transactionId = Mage::helper('braintree_payments')->clearTransactionId($payment->getRefundTransactionId());
try {
$transaction = Braintree_Transaction::find($transactionId);
$this->_debug($payment->getCcTransId());
$this->_debug($transaction);
if ($transaction->status === Braintree_Transaction::SUBMITTED_FOR_SETTLEMENT) {
if ($transaction->amount != $amount) {
Mage::throwException(Mage::helper('braintree_payments')->__('This refund is for a partial amount but the Transaction has not settled. ' . 'Please wait 24 hours before trying to issue a partial refund.'));
} else {
Mage::throwException(Mage::helper('braintree_payments')->__('The Transaction has not settled. ' . 'Please wait 24 hours before trying to issue a refund or use Void option.'));
}
}
if ($transaction->status === Braintree_Transaction::SETTLED || $transaction->status === Braintree_Transaction::SETTLING) {
$result = Braintree_Transaction::refund($transactionId, $amount);
} else {
$result = Braintree_Transaction::void($transactionId);
}
$this->_debug($result);
if ($result->success) {
$payment->setIsTransactionClosed(1);
} else {
Mage::throwException(Mage::helper('braintree_payments/error')->parseBraintreeError($result));
}
} catch (Exception $e) {
Mage::throwException(Mage::helper('braintree_payments')->__('There was an error refunding the transaction.') . ' ' . $e->getMessage());
}
return $this;
}
示例3: refund
/**
* refund the amount with transaction id
*
* @access public
* @param string $payment Varien_Object object
* @return Mage_Payment_Model_Abstract
*/
public function refund(Varien_Object $payment, $amount)
{
if ($payment->getCcTransId() && $payment->getAmount() > 0) {
$api = $this->getApi();
//we can refund the amount full or partial so it is good to set up as partial refund
$api->setTransactionId($payment->getCcTransId())->setRefundType(Mage_Paypal_Model_Api_Nvp::REFUND_TYPE_PARTIAL)->setAmount($amount);
if ($api->callRefundTransaction() !== false) {
$payment->setStatus('SUCCESS')->setCcTransId($api->getTransactionId());
} else {
$e = $api->getError();
$payment->setStatus('ERROR')->setStatusDescription($e['short_message'] . ': ' . $e['long_message']);
}
} else {
$payment->setStatus('ERROR');
$payment->setStatusDescription(Mage::helper('paypal')->__('Error in refunding the payment'));
}
}
示例4: capture
/**
* Capture payment abstract method
*
* @param Varien_Object $payment
* @param float $amount
*
* @return Mage_Payment_Model_Abstract
*/
public function capture(Varien_Object $payment, $amount)
{
if ($payment->getCcTransId() == null || $payment->getCcTransId() == '') {
//se não for a área administrativa e está sendo executado o método capture, então a ação é autorizar e capturar automaticamente
$this->authorize($payment, $amount);
return $this;
}
if (!$this->canCapture()) {
Mage::throwException(Mage::helper('payment')->__('Esse pedido não pode ser capturado.'));
}
$tid = $payment->getCcTransId();
$valor = number_format($amount, 2, '', '');
$debug = Mage::getStoreConfig('payment/apelidocielo/debug');
if ($debug) {
//Esse log só funciona se a opção Ativar log em Developer > Log no admin estiver marcada
mage::log("\r\n=========== Dados do pagamento sendo enviados para captura ==========\r\n ", null, 'oitoo_cielo.log');
}
$cielo = mage::getModel('apelidocielo/cielo');
$retornoCaptura = $cielo->setCaptura($tid, $valor);
if ($retornoCaptura->captura->codigo == 6) {
$payment->setAdditionalInformation('captura_codigo', (string) $retornoCaptura->captura->codigo);
$payment->setAdditionalInformation('captura_mensagem', (string) $retornoCaptura->captura->mensagem);
$payment->save();
//faz o log de sucesso
Mage::dispatchEvent('oitoo_cielo_log', array('quote_id' => (string) $payment->getOrder()->getQuoteId(), 'codigo' => (string) $retornoCaptura->captura->codigo, 'texto' => (string) $retornoCaptura->captura->mensagem, 'tid' => $retornoCaptura->tid));
return $this;
//a compra foi capturada.
} else {
if (isset($retornoCaptura->codigo)) {
Mage::throwException(Mage::helper('payment')->__('Erro num: ' . $retornoCaptura->codigo . ' - ' . $retornoCaptura->mensagem));
} else {
Mage::throwException(Mage::helper('payment')->__('Não foi possivel capturar a autorização pelo seguinte motivo: ' . $retornoCaptura->captura->codigo . ' - ' . $retornoCaptura->captura->mensagem));
}
}
return false;
}
示例5: _refund
/**
* @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
* @param $amount
* @return Hps_Securesubmit_Model_Payment
*/
protected function _refund(Varien_Object $payment, $amount)
{
$transactionId = $payment->getCcTransId();
$order = $payment->getOrder();
/* @var $order Mage_Sales_Model_Order */
$chargeService = $this->_getChargeService();
$cardHolder = $this->_getCardHolderData($order);
$details = $this->_getTxnDetailsData($order);
try {
$refundResponse = $chargeService->refundTransaction($amount, strtolower($order->getBaseCurrencyCode()), $transactionId, $cardHolder, $details);
$payment->setTransactionId($refundResponse->transactionId)->setParentTransactionId($transactionId)->setIsTransactionClosed(1)->setShouldCloseParentTransaction(1);
} catch (HpsException $e) {
$this->_debugChargeService($chargeService, $e);
$this->throwUserError($e->getMessage());
} catch (Exception $e) {
$this->_debugChargeService($chargeService, $e);
Mage::logException($e);
$this->throwUserError($e->getMessage());
}
$this->_debugChargeService($chargeService);
return $this;
}
示例6: capture
/**
* Capture payment
*
* @param Varien_Object $orderPayment
* @return Mage_Payment_Model_Abstract
*/
public function capture(Varien_Object $payment, $amount)
{
if ($payment->getCcTransId()) {
$api = $this->getApi()->setPaymentType(Mage_Paypal_Model_Api_Nvp::PAYMENT_TYPE_SALE)->setAmount($amount)->setBillingAddress($payment->getOrder()->getBillingAddress())->setPayment($payment);
$api->setAuthorizationId($payment->getCcTransId())->setCompleteType('NotComplete');
$result = $api->callDoCapture() !== false;
if ($result) {
$payment->setStatus('APPROVED');
//$payment->setCcTransId($api->getTransactionId());
$payment->setLastTransId($api->getTransactionId());
} else {
$e = $api->getError();
if (isset($e['short_message'])) {
$message = $e['short_message'];
} else {
$message = AO::helper('paypal')->__("Unknown PayPal API error: %s", $e['code']);
}
if (isset($e['long_message'])) {
$message .= ': ' . $e['long_message'];
}
AO::throwException($message);
}
} else {
$this->placeOrder($payment);
}
return $this;
}
示例7: void
public function void(Varien_Object $payment)
{
try {
$result = Braintree_Transaction::void($payment->getCcTransId());
if ($result->success) {
$payment->setIsTransactionClosed(1);
} else {
Mage::throwException($result->message);
}
} catch (Exception $e) {
Mage::throwException(sprintf('There was an error voiding the transaction. (%s)', $e->getMessage()));
}
return $this;
}
示例8: refund
public function refund(Varien_Object $payment, $amount)
{
if ($payment->getCcTransId() && $amount > 0) {
$api = $this->getApi()->setPayment($payment)->setAmount($amount);
if ($api->refund() !== false) {
$payment->setCcTransId($api->getTransactionId());
$payment->setStatus(self::STATUS_SUCCESS);
} else {
$e = $api->getError();
$payment->setStatus(self::STATUS_ERROR);
$payment->setStatusDescription($e['message']);
}
} else {
$payment->setStatus(self::STATUS_ERROR);
$payment->setStatusDescription(Mage::helper('paypalUk')->__('Error in refunding the payment'));
}
return $this;
}
示例9: capture
/**
* Process capturing of a payment
*
* @param Varien_Object $payment
* @param float $amount
*
* @return Mage_Payment_Model_Abstract|void
*/
public function capture(Varien_Object $payment, $amount)
{
// Has the payment already been authorized?
if ($payment->getCcTransId()) {
// Convert the capture amount to the correct currency
$captureAmount = $this->_getWrapper()->getCaptureAmount($payment->getOrder(), $amount);
// Has the authorization already been settled? Partial invoicing
if ($this->authorizationUsed($payment)) {
// Set the token as false
$token = false;
// Was the original payment created with a token?
if ($additionalInfoToken = $payment->getAdditionalInformation('token')) {
try {
// Init the environment
$this->_getWrapper()->init($payment->getOrder()->getStoreId());
// Attempt to find the token
Braintree_PaymentMethod::find($additionalInfoToken);
// Set the token if a success
$token = $additionalInfoToken;
} catch (Exception $e) {
$token = false;
}
}
// If we managed to find a token use that for the capture
if ($token) {
// Stop processing the rest of the method
// We pass $amount instead of $captureAmount as the authorize function contains the conversion
$this->_authorize($payment, $amount, true, $token);
return $this;
} else {
// Attempt to clone the transaction
$result = $this->_getWrapper()->init($payment->getOrder()->getStoreId())->cloneTransaction($payment->getLastTransId(), $captureAmount);
}
} else {
// Init the environment
$result = $this->_getWrapper()->init($payment->getOrder()->getStoreId())->submitForSettlement($payment->getCcTransId(), $captureAmount);
// Log the result
Gene_Braintree_Model_Debug::log(array('capture:submitForSettlement' => $result));
}
if ($result->success) {
$this->_processSuccessResult($payment, $result, $amount);
} else {
if ($result->errors->deepSize() > 0) {
// Clean up
Gene_Braintree_Model_Wrapper_Braintree::cleanUp();
Mage::throwException($this->_getWrapper()->parseErrors($result->errors->deepAll()));
} else {
// Clean up
Gene_Braintree_Model_Wrapper_Braintree::cleanUp();
Mage::throwException($result->transaction->processorSettlementResponseCode . ': ' . $result->transaction->processorSettlementResponseText);
}
}
} else {
// Otherwise we need to do an auth & capture at once
$this->_authorize($payment, $amount, true);
}
return $this;
}
示例10: _refundcall
protected function _refundcall(Varien_Object $payment)
{
if ($this->getDebug()) {
$writer = new Zend_Log_Writer_Stream($this->getLogPath());
$logger = new Zend_Log($writer);
$logger->info("entering _refundcall()");
}
$paywayAPI = new Qvalent_PayWayAPI();
if ($this->getDebug()) {
$logger->info("Qvalent_PayWayAPI created");
}
$init = "certificateFile=" . $this->getCertificate() . "&" . "caFile=" . $this->getCaFile() . "&" . "logDirectory=" . $this->getLogDir();
if ($this->getDebug()) {
$logger->info($init);
}
$paywayAPI->initialise($init);
if ($this->getDebug()) {
$logger->info("Qvalent_PayWayAPI initialised");
}
$orderNumber = $payment->getOrder()->getStoreId() . str_pad($payment->getOrder()->getQuoteId(), 9, '0', STR_PAD_LEFT);
if ($this->getDebug()) {
$logger->info(print_r($payment->getOrder()->getData(), true));
}
$params = array();
$params["order.type"] = "refund";
$params["customer.username"] = $this->getUsername();
$params["customer.password"] = $this->getPassword();
$params["customer.merchant"] = $this->getMerchantID();
$params["card.expiryYear"] = substr($payment->getCcExpYear(), 2, 2);
$params["card.expiryMonth"] = str_pad($payment->getCcExpMonth(), 2, '0', STR_PAD_LEFT);
$params["card.currency"] = $payment->getOrder()->getBaseCurrencyCode();
$params["order.amount"] = $this->getAmount() * 100;
$params["order.ECI"] = "SSL";
$params["customer.orderNumber"] = $payment->getCcTransId() . "R";
$params["customer.originalOrderNumber"] = $payment->getCcTransId();
if ($this->getDebug()) {
$logger->info("Params: " . print_r($params, true));
}
$requestText = $paywayAPI->formatRequestParameters($params);
$responseText = $paywayAPI->processCreditCard($requestText);
$result = $paywayAPI->parseResponseParameters($responseText);
if ($this->getDebug()) {
$logger->info("Result: " . print_r($result, true));
}
return $result;
}
示例11: _beforeProcessRequest
/**
* Called before the request is processed
*
* @param string $request
* @param mixed $options
* @param Varien_Object $payment
*/
protected function _beforeProcessRequest($request, &$options, Varien_Object $payment)
{
switch ($request) {
case 'capture':
$options['origTrxNumber'] = $payment->getCcTransId() ? $payment->getCcTransId() : $payment->getLastTransId();
break;
case 'refund':
$options['origTrxNumber'] = $payment->getRefundTransactionId();
break;
}
}
示例12: callApi
//.........这里部分代码省略.........
switch ($type) {
case 'authorize':
$payment->setTokenProfileId($tokenProfileId);
$payment->setTokenPaymentProfileId($tokenPaymentProfileId);
$response = $this->createAuthorize($amount, $tokenProfileId, $tokenPaymentProfileId, $orderId, $ccCCV);
break;
case 'capture':
$teoAuths = Mage::getModel('authorizenetcim/teoauths');
$authsCollection = $teoAuths->getCollection()->addFieldToFilter('order_id', $orderId);
if (count($authsCollection) > 1) {
$amountLeftToCapture = $amount;
foreach ($authsCollection as $auths) {
$teoAuths->load($auths->getId());
$teoAuthAmount = $teoAuths->getAuthorizationAmount();
$teoAuthAmountPaid = $teoAuths->getAmountPaid();
if ($amountLeftToCapture > 0) {
$amountLeftOnAuth = $teoAuthAmount - $teoAuthAmountPaid;
$authorizeTransactionId = $teoAuths->getAuthorizationNumber();
if ($amountLeftToCapture > $amountLeftOnAuth) {
$response = $this->createCapture($amountLeftOnAuth, $tokenProfileId, $tokenPaymentProfileId, $authorizeTransactionId);
$teoAuths->setAmountPaid($amountLeftOnAuth);
$teoAuths->save();
$amountLeftToCapture = $amountLeftToCapture - $amountLeftOnAuth;
} else {
$response = $this->createCapture($amountLeftToCapture, $tokenProfileId, $tokenPaymentProfileId, $authorizeTransactionId);
$teoAuths->setAmountPaid($amountLeftToCapture);
$teoAuths->save();
$amountLeftToCapture = 0;
}
}
}
} else {
//get authorize transaction id for capture
$authorizeTransactionId = $payment->getCcTransId();
$response = $this->createCapture($amount, $tokenProfileId, $tokenPaymentProfileId, $authorizeTransactionId);
}
break;
/**
* =================================================================
* BEGIN AAI HACK
*
* ADD SPECIFIC METHOD FOR PARTIAL AUTH/CAPTURE(S)
* =================================================================
*/
/**
* =================================================================
* BEGIN AAI HACK
*
* ADD SPECIFIC METHOD FOR PARTIAL AUTH/CAPTURE(S)
* =================================================================
*/
case 'partialcapture':
$teoAuth = $this->getTeoAuthorizationByOrderId($orderId);
$transId = $teoAuth->getData('authorization_number');
// Generate the XML for the API request and make a call to the API for a response
$response = $this->createPartialCapture($amount, $tokenProfileId, $tokenPaymentProfileId, $transId, $order);
break;
/**
* =================================================================
* END AAI HACK
*
* ADD SPECIFIC METHOD FOR PARTIAL AUTH/CAPTURE(S)
* =================================================================
*/
/**
* =================================================================
示例13: _prepareTxnDetails
/**
* Preapare basic paramters for transaction
*
* @param Varien_Object $payment
* @param decimal $amount
* @return array
*/
protected function _prepareTxnDetails(Varien_Object $payment, $amount)
{
if ($payment->getCcTransId()) {
$txnDetails = array('txn_type' => self::TRANSACTION_TYPE_CAPTURE, 'capture_transaction_id' => $payment->getCcTransId());
} else {
$billingAddress = $payment->getOrder()->getBillingAddress();
if ($payment->getOrder()->getCustomerEmail()) {
$customerEmail = $payment->getOrder()->getCustomerEmail();
} elseif ($billingAddress->getEmail()) {
$customerEmail = $billingAddress->getEmail();
} else {
$customerEmail = '';
}
$txnDetails = array('card_holder_name' => $payment->getCcOwner(), 'card_number' => $payment->getCcNumber(), 'card_type' => $this->_convertCcType($payment->getCcType()), 'card_expiry' => sprintf('%02d', $payment->getCcExpMonth()) . substr($payment->getCcExpYear(), 2, 2), 'card_csc' => $payment->getCcCid(), 'customer_email' => $customerEmail);
if ($this->getConfigData('payment_action') == self::ACTION_AUTHORIZE) {
$txnDetails['txn_type'] = self::TRANSACTION_TYPE_AUTHORISE;
} else {
$txnDetails['txn_type'] = self::TRANSACTION_TYPE_PURCHASE;
}
}
$accountId = $payment->getFlo2cashAccountId();
//if transaction type is authorize & capture or only authorize
if (is_null($accountId)) {
$accountId = $this->getAccountId();
}
$txnDetails = array_merge($txnDetails, array('merchant_reference' => $payment->getOrder()->getIncrementId(), 'paynz_account_id' => $accountId, 'amount' => sprintf('%.2f', $amount)));
return $txnDetails;
}
示例14: refund
/**
* refund.
*
* Processes a partial or whole refund on an existing transaction.
*
* @param Varien_Object $payment
* @param int/float $amount
*
* @return Mage_Payment_Model_Method_Cc $this. Failure will throw Mage::throwException('description')
*/
public function refund(Varien_Object $payment, $amount)
{
if ($this->getDebug()) {
$writer = new Zend_Log_Writer_Stream($this->getLogPath());
$logger = new Zend_Log($writer);
}
$bankRespID = $payment->getCcTransId();
if (!$bankRespID) {
Mage::throwException('Cannot issue a refund on this transaction: bank response id is missing.');
}
//Create the transaction object
$sxml = new securexml_transaction($this->getMode(NO_ANTIFRAUD), $this->getUsername(), $this->getPassword());
$transaction_id = $payment->getOrder()->getIncrementId();
if ($sxml->processRefund($amount, $transaction_id, $bankRespID)) {
$transaction_id = $sxml->getResult('transaction_id');
if ($this->getDebug()) {
$logger->info('Refund Approved. Response ID: ' . $transaction_id);
}
/* Don't reset $payment->CcTransId for refunds, so that more than one is possible. This means that the gateway response id ($transaction_id) is not stored here. If necessary, it can be recovered from the SecurePay Merchant Management Facility. http://securepay.com.au */
} else {
$error = $sxml->getError();
if ($this->getDebug()) {
$logger->info('Refund Declined. ' . $error);
}
Mage::throwException('' . $error);
}
return $this;
}
示例15: void
/**
* called if voiding a payment
*/
public function void(Varien_Object $payment)
{
$order = $payment->getOrder();
if (!empty($order)) {
$hash = array('litleTxnId' => $payment->getCcTransId());
$merchantData = $this->merchantData($payment);
$hash_in = array_merge($hash, $merchantData);
$litleRequest = new LitleOnlineRequest();
$litleResponse = $litleRequest->echeckVoidRequest($hash_in);
}
$this->processResponse($payment, $litleResponse);
}