本文整理汇总了PHP中Mage_Payment_Model_Info::getAdditionalInformation方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Payment_Model_Info::getAdditionalInformation方法的具体用法?PHP Mage_Payment_Model_Info::getAdditionalInformation怎么用?PHP Mage_Payment_Model_Info::getAdditionalInformation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Payment_Model_Info
的用法示例。
在下文中一共展示了Mage_Payment_Model_Info::getAdditionalInformation方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPayment
/**
* Set payment instance for storing credit card information and partial authorizations
*
* @param Mage_Payment_Model_Info $payment
* @return Mage_Paygate_Model_Authorizenet_Cards
*/
public function setPayment(Mage_Payment_Model_Info $payment)
{
$this->_payment = $payment;
$paymentCardsInformation = $this->_payment->getAdditionalInformation(self::CARDS_NAMESPACE);
if ($paymentCardsInformation) {
$this->_cards = $paymentCardsInformation;
}
return $this;
}
示例2: _getAccountUniqueId
/**
* Get the encrypted card number or the ROM PAN
* @param Mage_Payment_Model_Info $payment
* @return string
*/
protected function _getAccountUniqueId(Mage_Payment_Model_Info $payment)
{
$encCardNumber = $payment->getCcNumberEnc();
if ($encCardNumber) {
return $payment->decrypt($encCardNumber);
}
return $payment->getAdditionalInformation('pan');
}
示例3: submitRecurringProfile
/**
* Submit RP to the gateway
*
* @param Mage_Payment_Model_Recurring_Profile $profile
* @param Mage_Payment_Model_Info $paymentInfo
*/
public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile, Mage_Payment_Model_Info $paymentInfo)
{
$token = $paymentInfo->getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_TOKEN);
$profile->setToken($token);
$this->_pro->submitRecurringProfile($profile, $paymentInfo);
}
示例4: _isGatewayActionsLocked
/**
* If gateway actions are locked return true
*
* @param Mage_Payment_Model_Info $payment
* @return bool
*/
protected function _isGatewayActionsLocked($payment)
{
return $payment->getAdditionalInformation($this->_isGatewayActionsLockedKey);
}
示例5: collectPayment
public function collectPayment(\Mage_Payment_Model_Info $payment, $amount, $capture = true)
{
$Currency = Mage::app()->getStore()->getBaseCurrencyCode();
require_once MAGENTO_ROOT . '/lib/Start/autoload.php';
# At the top of your PHP file
$token = isset($_POST['payfortToken']) ? $_POST['payfortToken'] : false;
$email = isset($_POST['payfortEmail']) ? $_POST['payfortEmail'] : false;
if (!$token || !$email) {
//this block will be executed if the order was authorized earlier and now trying to capture amount
$token_array = $payment->getAdditionalInformation('token');
$token = $token_array['token'];
$email = $token_array['email'];
}
if (!$token || !$email) {
Mage::throwException('Invalid Token');
}
$currency = !isset($Currency) ? 'AED' : $Currency;
if (file_exists(MAGENTO_ROOT . '/data/currencies.json')) {
$currency_json_data = json_decode(file_get_contents(MAGENTO_ROOT . '/data/currencies.json'), 1);
$currency_multiplier = $currency_json_data[$currency];
} else {
$currency_multiplier = 100;
}
$amount_in_cents = $amount * $currency_multiplier;
$order = $payment->getOrder();
$order_items_array_full = array();
foreach ($order->getAllVisibleItems() as $value) {
$order_items_array['title'] = $value->getName();
$order_items_array['amount'] = round($value->getPrice(), 2) * $currency_multiplier;
$order_items_array['quantity'] = $value->getQtyOrdered();
array_push($order_items_array_full, $order_items_array);
}
$shipping_amount = $order->getShippingAmount();
$shipping_amount = $shipping_amount * $currency_multiplier;
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
$customer = Mage::getSingleton('customer/session')->getCustomer();
$username = $customer->getName();
$registered_at = date(DATE_ISO8601, strtotime($customer->getCreatedAt()));
} else {
$username = "Guest";
$registered_at = date(DATE_ISO8601, strtotime(date("Y-m-d H:i:s")));
}
$billing_data = $order->getBillingAddress()->getData();
if (is_object($order->getShippingAddress())) {
$shipping_data = $order->getShippingAddress()->getData();
$shipping_address = array("first_name" => $shipping_data['firstname'], "last_name" => $shipping_data['lastname'], "country" => $shipping_data['country_id'], "city" => $shipping_data['city'], "address" => $shipping_data['customer_address'], "phone" => $shipping_data['telephone'], "postcode" => $shipping_data['postcode']);
} else {
$shipping_address = array();
}
$billing_address = array("first_name" => $billing_data['firstname'], "last_name" => $billing_data['lastname'], "country" => $billing_data['country_id'], "city" => $billing_data['city'], "address" => $billing_data['customer_address'], "phone" => $billing_data['telephone'], "postcode" => $billing_data['postcode']);
$shopping_cart_array = array('user_name' => $username, 'registered_at' => $registered_at, 'items' => $order_items_array_full, 'billing_address' => $billing_address, 'shipping_address' => $shipping_address);
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$charge_args = array('description' => "Magento charge for " . $email, 'card' => $token, 'currency' => $currency, 'email' => $email, 'ip' => $_SERVER['REMOTE_ADDR'], 'amount' => $amount_in_cents, 'capture' => $capture, 'shipping_amount' => $shipping_amount, 'shopping_cart' => $shopping_cart_array, 'metadata' => array('reference_id' => $orderId));
$ver = new Mage();
$version = $ver->getVersion();
$userAgent = 'Magento ' . $version . ' / Start Plugin ' . self::PLUGIN_VERSION;
Start::setUserAgent($userAgent);
$method = $payment->getMethodInstance();
if ($method->getConfigData('test_mode') == 1) {
Start::setApiKey($method->getConfigData('test_secret_key'));
} else {
Start::setApiKey($method->getConfigData('live_secret_key'));
}
try {
// Charge the token
$charge = Start_Charge::create($charge_args);
//need to process charge as success or failed
$payment->setTransactionId($charge["id"]);
if ($capture) {
$payment->setIsTransactionClosed(1);
} else {
$payment->setIsTransactionClosed(0);
}
} catch (Start_Error $e) {
$error_code = $e->getErrorCode();
if ($error_code === "card_declined") {
$errorMsg = 'Charge was declined. Please, contact you bank for more information or use a different card.';
} else {
$errorMsg = $e->getMessage();
}
throw new Mage_Payment_Model_Info_Exception($errorMsg);
}
//need to process charge as success or failed
}
示例6: _importPaymentInformation
/**
* Map payment information from IPN to payment object
* Returns true if there were changes in information
*
* @param Mage_Payment_Model_Info $payment
* @return bool
*/
protected function _importPaymentInformation(Mage_Payment_Model_Info $payment)
{
$was = $payment->getAdditionalInformation();
$from = array();
foreach (array(Mage_Paypal_Model_Info::PAYER_ID, 'payer_email' => Mage_Paypal_Model_Info::PAYER_EMAIL, Mage_Paypal_Model_Info::PAYER_STATUS, Mage_Paypal_Model_Info::ADDRESS_STATUS, Mage_Paypal_Model_Info::PROTECTION_EL) as $privateKey => $publicKey) {
if (is_int($privateKey)) {
$privateKey = $publicKey;
}
$value = $this->getIpnFormData($privateKey);
if ($value) {
$from[$publicKey] = $value;
}
}
// collect fraud filters
$fraudFilters = array();
for ($i = 1; $value = $this->getIpnFormData("fraud_management_pending_filters_{$i}"); $i++) {
$fraudFilters[] = $value;
}
if ($fraudFilters) {
$from[Mage_Paypal_Model_Info::FRAUD_FILTERS] = $fraudFilters;
}
Mage::getSingleton('paypal/info')->importToPayment($from, $payment);
return $was != $payment->getAdditionalInformation();
}
示例7: _getFullInfo
/**
* Render info item
*
* @param array $keys
* @param Mage_Payment_Model_Info $payment
* @param bool $labelValuesOnly
*/
protected function _getFullInfo(array $keys, Mage_Payment_Model_Info $payment, $labelValuesOnly)
{
$result = array();
foreach ($keys as $key) {
if (!isset($this->_paymentMapFull[$key])) {
$this->_paymentMapFull[$key] = array();
}
if (!isset($this->_paymentMapFull[$key]['label'])) {
if (!$payment->hasAdditionalInformation($key)) {
$this->_paymentMapFull[$key]['label'] = false;
$this->_paymentMapFull[$key]['value'] = false;
} else {
$value = $payment->getAdditionalInformation($key);
$this->_paymentMapFull[$key]['label'] = $this->_getLabel($key);
$this->_paymentMapFull[$key]['value'] = $this->_getValue($value, $key);
}
}
if (!empty($this->_paymentMapFull[$key]['value'])) {
if ($labelValuesOnly) {
$result[$this->_paymentMapFull[$key]['label']] = $this->_paymentMapFull[$key]['value'];
} else {
$result[$key] = $this->_paymentMapFull[$key];
}
}
}
return $result;
}
示例8: denyPayment
/**
* Enable payment deny when __VENDOR status == 0
*
* @param Mage_Payment_Model_Info $payment
* @return bool
*/
public function denyPayment(Mage_Payment_Model_Info $payment)
{
if ($payment->getAdditionalInformation('status') == Netresearch_OPS_Model_Payment_Abstract::OPS_INVALID) {
// returning true will automatically invoke the payment cancellation process
return true;
}
return false;
}
示例9: canReviewPayment
/**
* Whether this method can accept or deny payment
*
* @param Mage_Payment_Model_Info $payment
*
* @return bool
*/
public function canReviewPayment(Mage_Payment_Model_Info $payment)
{
$fraud_type = $payment->getAdditionalInformation('fraud_type');
$fraud_review = $payment->getAdditionalInformation('fraud_review');
return parent::canReviewPayment($payment) && ($fraud_type == 'challenged' && $fraud_review != 'allowed');
}
示例10: importPaymentInfo
/**
* Set card payment data from a quote or order payment instance.
*/
public function importPaymentInfo(Mage_Payment_Model_Info $payment)
{
if ($payment instanceof Mage_Payment_Model_Info) {
if ($payment->getAdditionalInformation('save') === 0) {
$this->setActive(0);
}
if ($payment->getCcType() != '') {
$this->setAdditional('cc_type', $payment->getCcType());
}
if ($payment->getCcLast4() != '') {
$this->setAdditional('cc_last4', $payment->getCcLast4());
}
if ($payment->getCcExpYear() > date('Y') || $payment->getCcExpYear() == date('Y') && $payment->getCcExpMonth() >= date('n')) {
$this->setAdditional('cc_exp_year', $payment->getCcExpYear())->setAdditional('cc_exp_month', $payment->getCcExpMonth())->setExpires(sprintf("%s-%s-%s 23:59:59", $payment->getCcExpYear(), $payment->getCcExpMonth(), date('t', strtotime($payment->getCcExpYear() . '-' . $payment->getCcExpMonth()))));
}
$this->setInfoInstance($payment);
if ($this->getMethodInstance()->hasInfoInstance() !== true) {
$this->getMethodInstance()->setInfoInstance($payment);
}
}
return $this;
}
示例11: fetchTransactionInfo
/**
* Fetch transaction details info
*
* @param Mage_Payment_Model_Info $payment
* @param string $transactionId
* @return array
*/
public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId)
{
/** @var Mage_Sales_Model_Order_Payment_Transaction $transaction */
$transaction = Mage::getModel('sales/order_payment_transaction')->load($transactionId, 'txn_id');
$checkout_transaction = $transaction->getOrder()->getPayment()->lookupTransaction(null, Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER);
$reconcile = $this->reconcile($checkout_transaction->getTxnId());
// Get the current details
$transaction_details = $payment->getAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);
// Try to extract transaction details from the Gateway response
if ($reconcile->unique_id == $transactionId) {
$transaction_details = $reconcile;
} else {
if ($reconcile->payment_transaction instanceof stdClass) {
if ($reconcile->payment_transaction->unique_id == $transactionId) {
$transaction_details = $reconcile->payment_transaction;
}
}
if ($reconcile->payment_transaction instanceof ArrayObject) {
foreach ($reconcile->payment_transaction as $payment_transaction) {
if ($payment_transaction->unique_id == $transactionId) {
$transaction_details = $payment_transaction;
}
}
}
}
// Remove the current details
$payment->unsAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);
// Set the default/updated transaction details
$payment->setAdditionalInformation(array(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $this->getHelper()->getArrayFromGatewayResponse($transaction_details)), null);
$payment->save();
return $payment->getAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);
}
示例12: fetchTransactionInfo
/**
* Fetch transaction details info
*
* @param Mage_Payment_Model_Info $payment
* @param string $transactionId
*
* @return array
*/
public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId)
{
$reconcile = $this->reconcile($transactionId);
// Remove the current details
$payment->unsAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);
// Set the default/updated transaction details
$payment->setAdditionalInformation(array(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $this->getHelper()->getArrayFromGatewayResponse($reconcile)), null);
$payment->save();
return $payment->getAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);
}