本文整理汇总了PHP中Varien_Object::getParentTransactionId方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Object::getParentTransactionId方法的具体用法?PHP Varien_Object::getParentTransactionId怎么用?PHP Varien_Object::getParentTransactionId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Object
的用法示例。
在下文中一共展示了Varien_Object::getParentTransactionId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getParentTransactionId
/**
* Get payflow transaction id from parent transaction
*
* @param Varien_Object $payment
* @return string
*/
protected function _getParentTransactionId(Varien_Object $payment)
{
if ($payment->getParentTransactionId()) {
return $payment->getTransaction($payment->getParentTransactionId())->getAdditionalInformation(Mage_PaypalUk_Model_Pro::TRANSPORT_PAYFLOW_TXN_ID);
}
return $payment->getParentTransactionId();
}
示例2: refund
public function refund(Varien_Object $payment, $amount)
{
$transactionId = $payment->getParentTransactionId();
try {
Stripe_Charge::retrieve($transactionId)->refund();
} catch (Exception $e) {
$this->debugData($e->getMessage());
Mage::throwException(Mage::helper('paygate')->__('Payment refunding error.'));
}
$payment->setTransactionId($transactionId . '-' . Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND)->setParentTransactionId($transactionId)->setIsTransactionClosed(1)->setShouldCloseParentTransaction(1);
return $this;
}
示例3: refund
public function refund(Varien_Object $payment, $amount)
{
$pagarme = Mage::getModel('pagarme/api');
$transaction = $pagarme->refund($payment->getPagarmeTransactionId());
if ($transaction->getErrors()) {
$messages = array();
foreach ($transaction->getErrors() as $error) {
$messages[] = $error->getMessage() . '.';
}
Mage::throwException(implode("\n", $messages));
}
$payment->setTransactionId($payment->getPagarmeTransactionId() . '-' . Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND)->setParentTransactionId($payment->getParentTransactionId())->setIsTransactionClosed(1)->setShouldCloseParentTransaction(1)->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, array('status' => $transaction->getStatus()));
return $this;
}
示例4: refund
public function refund(Varien_Object $payment, $amount)
{
$payment instanceof Mage_Sales_Model_Order_Payment;
$order = $payment->getOrder();
$store = $order->getStore();
$serviceId = Mage::getStoreConfig('pay_payment/general/serviceid', $store);
$apiToken = Mage::getStoreConfig('pay_payment/general/apitoken', $store);
//todo: Doe iets met de api
$parentTransactionId = $payment->getParentTransactionId();
$apiRefund = Mage::helper('pay_payment/api_refund');
$apiRefund instanceof Pay_Payment_Helper_Api_Refund;
$apiRefund->setApiToken($apiToken);
$apiRefund->setServiceId($serviceId);
$apiRefund->setTransactionId($parentTransactionId);
$amount = (int) round($amount * 100);
$apiRefund->setAmount($amount);
$apiRefund->doRequest();
// die($parentTransactionId);
return $this;
}
示例5: refund
public function refund(Varien_Object $payment, $amount)
{
$order = $payment->getOrder();
$store = $order->getStore();
$serviceId = Mage::getStoreConfig('pay_payment/general/serviceid', $store);
$apiToken = Mage::getStoreConfig('pay_payment/general/apitoken', $store);
$useBackupApi = Mage::getStoreConfig('pay_payment/general/use_backup_api', $store);
$backupApiUrl = Mage::getStoreConfig('pay_payment/general/backup_api_url', $store);
if ($useBackupApi == 1) {
Pay_Payment_Helper_Api::_setBackupApiUrl($backupApiUrl);
}
$parentTransactionId = $payment->getParentTransactionId();
$apiRefund = Mage::helper('pay_payment/api_refund');
$apiRefund instanceof Pay_Payment_Helper_Api_Refund;
$apiRefund->setApiToken($apiToken);
$apiRefund->setServiceId($serviceId);
$apiRefund->setTransactionId($parentTransactionId);
$amount = (int) round($amount * 100);
$apiRefund->setAmount($amount);
$apiRefund->doRequest();
return $this;
}
示例6: capture
/**
* Capture payment
*
* @param Mage_Sales_Model_Order_Payment $payment
* @return Mage_Paypal_Model_Payflowpro
*/
public function capture(Varien_Object $payment, $amount)
{
if ($payment->getParentTransactionId()) {
$request = $this->_buildBasicRequest($payment);
$request->setTrxtype(self::TRXTYPE_DELAYED_CAPTURE);
$request->setOrigid($payment->getParentTransactionId());
} else {
$request = $this->_buildPlaceRequest($payment, $amount);
$request->setTrxtype(self::TRXTYPE_SALE);
}
$response = $this->_postRequest($request);
$this->_processErrors($response);
switch ($response->getResultCode()) {
case self::RESPONSE_CODE_APPROVED:
$payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0);
break;
case self::RESPONSE_CODE_FRAUDSERVICE_FILTER:
$payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0);
$payment->setIsTransactionPending(true);
$payment->setIsFraudDetected(true);
break;
}
return $this;
}
示例7: void
/**
* Void payment
*
* @param Varien_Object $invoicePayment
* @return Mage_Payment_Model_Abstract
*/
public function void(Varien_Object $payment)
{
//parent::void($payment);
if ($authTransactionId = $payment->getParentTransactionId()) {
$request = $this->_getApiRequest();
$request->setData('transaction_id', $authTransactionId);
$this->_getApi()->doVoid($request);
} else {
Mage::throwException(Mage::helper('enterprise_pbridge')->__('Authorization transaction is required to void.'));
}
return $this->_getApi()->getResponse();
}
示例8: void
/**
* Void the payment through gateway
*
* @param Varien_Object $payment
* @return Mage_Paygate_Model_Authorizenet
* @throws Mage_Core_Exception
*/
public function void(Varien_Object $payment)
{
if ($payment->getParentTransactionId()) {
$data = $this->_prepareData();
$data['ordertype'] = "VOID";
$data["oid"] = $payment->getParentTransactionId();
$merchantinfo = array();
$merchantinfo['configfile'] = $data['storenumber'];
$merchantinfo['keyfile'] = $data['key'];
$data = array_merge($data, $merchantinfo);
$result = $this->_postRequest($data);
if (is_array($result) && count($result) > 0) {
if (array_key_exists("r_approved", $result)) {
if ($result["r_approved"] != "APPROVED") {
Mage::throwException("Gateway error : {" . (string) $result["r_error"] . "}");
} else {
$payment->setStatus(self::STATUS_SUCCESS);
return $this;
}
} else {
Mage::throwException("No approval found");
}
} else {
Mage::throwException("No response found");
}
}
$payment->setStatus(self::STATUS_ERROR);
Mage::throwException('Invalid transaction ID.');
}
示例9: void
/**
* Void payment
*
* @param Varien_Object $payment
* @return Mage_Payment_Model_Abstract
*/
public function void(Varien_Object $payment)
{
//parent::void($payment);
if ($authTransactionId = $payment->getParentTransactionId()) {
$request = $this->_getApiRequest();
$this->_setAdditionalRequestParameters($request, $payment);
$request->addData(array('transaction_id' => $authTransactionId, 'amount' => $payment->getOrder()->getBaseTotalDue()));
$this->_getApi()->doVoid($request);
} else {
Mage::throwException(Mage::helper('enterprise_pbridge')->__('Authorization transaction is required to void.'));
}
return $this->_getApi()->getResponse();
}
示例10: _prepareTxnDetails
/**
* Preapare basic paramters for transaction
*
* @param Varien_Object $payment
* @param decimal $amount
* @return array
*/
protected function _prepareTxnDetails(Varien_Object $payment, $amount)
{
if ($payment->getParentTransactionId()) {
$txnDetails = array('txn_type' => self::TRANSACTION_TYPE_CAPTURE, 'capture_transaction_id' => $payment->getParentTransactionId());
} 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;
}
示例11: void
/**
* Void the payment through gateway
*
* @param Varien_Object $payment
* @return Mage_Paygate_Model_Authorizenet
* @throws Mage_Core_Exception
*/
public function void(Varien_Object $payment)
{
if ($payment->getParentTransactionId()) {
$payment->setAnetTransType(self::REQUEST_TYPE_VOID);
$request = $this->_buildRequest($payment);
$request->setXTransId($payment->getParentTransactionId());
$result = $this->_postRequest($request);
if ($result->getResponseCode() == self::RESPONSE_CODE_APPROVED) {
$payment->setStatus(self::STATUS_SUCCESS);
return $this;
}
$payment->setStatus(self::STATUS_ERROR);
Mage::throwException($this->_wrapGatewayError($result->getResponseReasonText()));
}
$payment->setStatus(self::STATUS_ERROR);
Mage::throwException(Mage::helper('paygate')->__('Invalid transaction ID.'));
}
示例12: refund
public function refund(Varien_Object $payment, $amount)
{
$payment->setAmount($amount);
$payment->setOpcode(self::OPCODE_REFUND);
$this->setTransactionId($payment->getParentTransactionId());
$request = $this->_buildRequest($payment);
$result = $this->_postRequest($request);
$payment->setStatus(self::STATUS_APPROVED)->setTransactionId($result->getTransaction())->setIsTransactionClosed(1);
return $this;
}
示例13: cancel
public function cancel(Varien_Object $payment)
{
$session = Mage::getSingleton('adminhtml/session');
if (Mage::app()->getRequest()->getActionName() == 'save') {
$order = $payment->getOrder();
$_totalDatas = $order->getData();
$childOrder = Mage::getModel('sales/order')->loadByIncrementId($_totalDatas['relation_child_real_id']);
if ($childOrder->getBaseGrandTotal() <= $order->getBaseGrandTotal()) {
$childPayment = $childOrder->getPayment();
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$write->query('update epay_order_status set orderid = "' . $_totalDatas['relation_child_real_id'] . '" WHERE orderid = "' . $order->getIncrementId() . '"');
$transactionId = $payment->getParentTransactionId();
$childPayment->setTransactionId($transactionId)->setIsTransactionClosed(0);
$transaction = $childPayment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH);
$transaction->setAdditionalInformation("Transaction ID", $transactionId);
$transaction->save();
} else {
$session->addError("The transaction could not be moved because the amount of the edited order exceeds the transaction amount - Go to the ePay administration to handle the payment manually.");
}
return;
}
//
// Verify if remote interface is enabled
//
if ((int) $this->getConfigData('remoteinterface', $payment->getOrder() ? $payment->getOrder()->getStoreId() : null) != 1) {
$this->addOrderComment($payment->getOrder(), Mage::helper('epay')->__('EPAY_LABEL_75'));
return;
}
try {
//
// Read info directly from the database
//
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
$row = $read->fetchRow("select * from epay_order_status where orderid = '" . $payment->getOrder()->getIncrementId() . "'");
if ($row["status"] == '1') {
$tid = $row["tid"];
$param = array('merchantnumber' => $this->getConfigData('merchantnumber', $payment->getOrder() ? $payment->getOrder()->getStoreId() : null), 'transactionid' => $tid, 'group' => '', 'epayresponse' => 0, 'pwd' => $this->getConfigData('remoteinterfacepassword', $payment->getOrder() ? $payment->getOrder()->getStoreId() : null));
$client = new SoapClient('https://ssl.ditonlinebetalingssystem.dk/remote/payment.asmx?WSDL');
$result = $client->delete($param);
if ($result->deleteResult == 1) {
//
// Success - transaction deleted!
//
$this->addOrderComment($payment->getOrder(), "Transaction deleted with transaction id: " . $tid);
$payment->getOrder()->save();
} else {
if ($result->epayresponse != -1) {
if ($result->epayresponse == -1002) {
$this->addOrderComment($payment->getOrder(), "Transaction could not be deleted by ePay: " . $result->epayresponse . ". Forretningsnummeret findes ikke.");
throw new Exception("Transaction could not be deleted by ePay: " . $result->epayresponse . ". Forretningsnummeret findes ikke.");
} elseif ($result->epayresponse == -1003 || $result->epayresponse == -1006) {
$this->addOrderComment($payment->getOrder(), "Transaction could not be captured by ePay: " . $result->epayresponse . ". Der er ikke adgang til denne funktion (API / Remote Interface).");
throw new Exception("Transaction could not be deleted by ePay: " . $result->epayresponse . ". Der er ikke adgang til denne funktion (API / Remote Interface).");
} else {
$this->addOrderComment($payment->getOrder(), 'Transaction could not be deleted by ePay: ' . $result->epayresponse . '. ' . $this->getEpayErrorText($result->epayresponse));
throw new Exception('Transaction could not be deleted by ePay: ' . $result->epayresponse . '. ' . $this->getEpayErrorText($result->epayresponse));
}
} else {
throw new Exception('Unknown response from ePay: ' . $result->epayresponse);
}
}
} elseif ($row["status"] == '0') {
//
// Do nothing - the order is to be canceled without any communication to ePay
//
} else {
//
// Somehow the order was not found - this must be an error!
//
throw new Exception("Order not found - please check the epay_order_status table!");
}
} catch (Exception $e) {
$session->addException($e, $e->getMessage() . " - Go to the ePay administration to credit the payment manually.");
}
}
示例14: void
/**
* void
*
* @access public
* @param string $payment Varien_Object object
* @return Mage_Payment_Model_Abstract
*/
public function void(Varien_Object $payment)
{
$error = false;
if ($payment->getParentTransactionId()) {
$payment->setTrxtype(self::TRXTYPE_DELAYED_VOID);
$payment->setTransactionId($payment->getParentTransactionId());
$request = $this->_buildBasicRequest($payment);
$result = $this->_postRequest($request);
if ($result->getResultCode() == self::RESPONSE_CODE_APPROVED) {
$payment->setStatus(self::STATUS_SUCCESS);
$payment->setCcTransId($result->getPnref());
$payment->setTransactionId($result->getPnref());
} else {
$payment->setStatus(self::STATUS_ERROR);
$error = $result->getRespmsg();
}
} else {
$payment->setStatus(self::STATUS_ERROR);
$error = Mage::helper('paypal')->__('Invalid transaction ID.');
}
if ($error !== false) {
Mage::throwException($error);
}
return $this;
}
示例15: void
/**
* Void previously *authorized* payment.
*
* @param Varien_Object $payment
* @return Mage_Payment_Model_Abstract
*/
public function void(Varien_Object $payment)
{
list($transactionId, ) = explode('-', $payment->getParentTransactionId());
$parameters = array('transactionId' => $transactionId);
$result = $this->_apiCall('CancelTransaction', $parameters);
$payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, array_merge($result, $parameters));
return $this;
}