本文整理汇总了PHP中Mage_Payment_Model_Info类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Payment_Model_Info类的具体用法?PHP Mage_Payment_Model_Info怎么用?PHP Mage_Payment_Model_Info使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Payment_Model_Info类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testGetTokenInfo
public function testGetTokenInfo()
{
$payment = new Varien_Object();
$payment->setCcCid('789');
$vaultCard = new Varien_Object();
$vaultCard->setCcType('VI');
$vaultCard->setLast4('1234');
$vaultCard->setType('VI');
$vaultCard->setExpirationMonth('12');
$vaultCard->setExpirationYear('2050');
$vaultCard->setToken('1111222233331234');
$litle = new Litle_CreditCard_Model_PaymentLogic();
$modelPalorusVault = $this->getMock('Litle_Palorus_Model_Vault');
$modelPalorusVault->expects($this->any())->method('load')->with($this->equalTo(50))->will($this->returnValue($vaultCard));
$litle->setModelPalorusVault($modelPalorusVault);
$info = new Mage_Payment_Model_Info();
$info->setAdditionalInformation('cc_vaulted', 50);
$arr = array('info_instance' => $info);
$litle->addData($arr);
$tokenInfo = $litle->getTokenInfo($payment);
$this->assertEquals('1234', $payment->getCcLast4());
$this->assertEquals('VI', $payment->getCcType());
$this->assertEquals('789', $tokenInfo['cardValidationNum']);
$this->assertEquals('VI', $tokenInfo['type']);
$this->assertEquals('1111222233331234', $tokenInfo['litleToken']);
$this->assertEquals('1250', $tokenInfo['expDate']);
}
开发者ID:nengineer,项目名称:litle-integration-magento,代码行数:27,代码来源:PaymentLogicTest.php
示例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');
}
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:13,代码来源:Payment.php
示例3: testGetInfoBlock
public function testGetInfoBlock()
{
$block = new Mage_Payment_Helper_Data();
$paymentInfo = new Mage_Payment_Model_Info();
$paymentInfo->setMethod('checkmo');
$result = $block->getInfoBlock($paymentInfo);
$this->assertInstanceOf('Mage_Payment_Block_Info_Checkmo', $result);
}
开发者ID:nemphys,项目名称:magento2,代码行数:8,代码来源:DataTest.php
示例4: isPaymentCancelRegistered
/**
*
* @param Mage_Payment_Model_Info $payment
* @return bool
*/
public function isPaymentCancelRegistered(Mage_Payment_Model_Info $payment)
{
$value = $this->registry(self::KEY_PAYMENT_CANCEL . $payment->getId());
if (empty($value) or !$value) {
return false;
} else {
return true;
}
}
开发者ID:kirchbergerknorr,项目名称:payone-magento,代码行数:14,代码来源:Registry.php
示例5: _place
/**
* Send request with new payment to gateway
*
* @param Mage_Payment_Model_Info $payment
* @param decimal $amount
* @param string $requestType
* @return Mage_Paygate_Model_Authorizenet
* @throws Mage_Core_Exception
*/
protected function _place($payment, $amount, $requestType)
{
$payment->setAnetTransType($requestType);
$payment->setAmount($amount);
$request = $this->_buildRequest($payment);
$result = $this->_postRequest($request);
switch ($requestType) {
case self::REQUEST_TYPE_AUTH_ONLY:
$newTransactionType = Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH;
$defaultExceptionMessage = Mage::helper('paygate')->__('Payment authorization error.');
break;
case self::REQUEST_TYPE_AUTH_CAPTURE:
$newTransactionType = Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE;
$defaultExceptionMessage = Mage::helper('paygate')->__('Payment capturing error.');
break;
}
switch ($result->getResponseCode()) {
case self::RESPONSE_CODE_APPROVED:
$this->getCardsStorage($payment)->flushCards();
$card = $this->_registerCard($result, $payment);
$this->_addTransaction($payment, $card->getLastTransId(), $newTransactionType, array('is_transaction_closed' => 0), array($this->_realTransactionIdKey => $card->getLastTransId()), Mage::helper('paygate')->getTransactionMessage($payment, $requestType, $card->getLastTransId(), $card, $amount));
if ($requestType == self::REQUEST_TYPE_AUTH_CAPTURE) {
$card->setCapturedAmount($card->getProcessedAmount());
$this->getCardsStorage($payment)->updateCard($card);
}
return $this;
case self::RESPONSE_CODE_HELD:
if ($result->getResponseReasonCode() == self::RESPONSE_REASON_CODE_PENDING_REVIEW_AUTHORIZED || $result->getResponseReasonCode() == self::RESPONSE_REASON_CODE_PENDING_REVIEW) {
$card = $this->_registerCard($result, $payment);
$this->_addTransaction($payment, $card->getLastTransId(), $newTransactionType, array('is_transaction_closed' => 0), array($this->_realTransactionIdKey => $card->getLastTransId(), $this->_isTransactionFraud => true), Mage::helper('paygate')->getTransactionMessage($payment, $requestType, $card->getLastTransId(), $card, $amount));
if ($requestType == self::REQUEST_TYPE_AUTH_CAPTURE) {
$card->setCapturedAmount($card->getProcessedAmount());
$this->getCardsStorage()->updateCard($card);
}
$payment->setIsTransactionPending(true)->setIsFraudDetected(true);
return $this;
}
if ($result->getResponseReasonCode() == self::RESPONSE_REASON_CODE_PARTIAL_APPROVE) {
$checksum = $this->_generateChecksum($request, $this->_partialAuthorizationChecksumDataKeys);
$this->_getSession()->setData($this->_partialAuthorizationChecksumSessionKey, $checksum);
if ($this->_processPartialAuthorizationResponse($result, $payment)) {
return $this;
}
}
Mage::throwException($defaultExceptionMessage);
case self::RESPONSE_CODE_DECLINED:
case self::RESPONSE_CODE_ERROR:
Mage::throwException($this->_wrapGatewayError($result->getResponseReasonText()));
default:
Mage::throwException($defaultExceptionMessage);
}
return $this;
}
开发者ID:Jonathonbyrd,项目名称:Optimized-Magento-1.9.x,代码行数:62,代码来源:Savedcard.php
示例6: testSetInfoTemplate
public function testSetInfoTemplate()
{
$block = $this->getMock('Mage_Payment_Block_Info_ContainerAbstract', array('getChildBlock', 'getPaymentInfo'));
$paymentInfo = new Mage_Payment_Model_Info();
$methodInstance = new Mage_Payment_Model_Method_Checkmo();
$paymentInfo->setMethodInstance($methodInstance);
$block->expects($this->atLeastOnce())->method('getPaymentInfo')->will($this->returnValue($paymentInfo));
$childBlock = new Mage_Core_Block_Template();
$block->expects($this->atLeastOnce())->method('getChildBlock')->with('payment.info.checkmo')->will($this->returnValue($childBlock));
$template = 'any_template.phtml';
$this->assertNotEquals($template, $childBlock->getTemplate());
$block->setInfoTemplate('checkmo', $template);
$this->assertEquals($template, $childBlock->getTemplate());
}
开发者ID:nemphys,项目名称:magento2,代码行数:14,代码来源:ContainerAbstractTest.php
示例7: testGetChildPdfAsArray
/**
* @magentoConfigFixture current_store payment/banktransfer/title Bank Method Title
* @magentoConfigFixture current_store payment/checkmo/title Checkmo Title Of The Method
*/
public function testGetChildPdfAsArray()
{
$block = new Mage_Payment_Block_Info();
$layout = new Mage_Core_Model_Layout();
$layout->addBlock($block, 'block');
$paymentInfoBank = new Mage_Payment_Model_Info();
$paymentInfoBank->setMethodInstance(new Mage_Payment_Model_Method_Banktransfer());
$childBank = $layout->addBlock('Mage_Payment_Block_Info_Instructions', 'child.one', 'block');
$childBank->setInfo($paymentInfoBank)->setArea('adminhtml');
$nonExpectedHtml = 'non-expected html';
$childHtml = $layout->addBlock('Mage_Core_Block_Text', 'child.html', 'block');
$childHtml->setText($nonExpectedHtml);
$paymentInfoCheckmo = new Mage_Payment_Model_Info();
$paymentInfoCheckmo->setMethodInstance(new Mage_Payment_Model_Method_Checkmo());
$childCheckmo = $layout->addBlock('Mage_Payment_Block_Info_Checkmo', 'child.just.another', 'block');
$childCheckmo->setInfo($paymentInfoCheckmo)->setArea('adminhtml');
$pdfArray = $block->getChildPdfAsArray();
$this->assertInternalType('array', $pdfArray);
$this->assertCount(2, $pdfArray);
$text = implode('', $pdfArray);
$this->assertContains('Bank Method Title', $text);
$this->assertContains('Checkmo Title Of The Method', $text);
$this->assertNotContains($nonExpectedHtml, $text);
}
开发者ID:nemphys,项目名称:magento2,代码行数:28,代码来源:InfoTest.php
示例8: _formatPrice
/**
* Format price with currency sign
* @param Mage_Payment_Model_Info $payment
* @param float $amount
* @return string
*/
protected function _formatPrice($payment, $amount)
{
return $payment->getOrder()->getBaseCurrency()->formatTxt($amount);
}
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:10,代码来源:Data.php
示例9: 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
}
开发者ID:payfort,项目名称:magento,代码行数:84,代码来源:Paymentmethod.php
示例10: 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;
}
开发者ID:roshu1980,项目名称:add-computers,代码行数:14,代码来源:Cc.php
示例11: _buildFormUrlRequest
/**
* Returns request object with needed data for API request to PayPal to get form URL.
*
* @param Mage_Payment_Model_Info $payment
* @return Mage_Paypal_Model_Hostedpro_Request
*/
protected function _buildFormUrlRequest(Mage_Payment_Model_Info $payment)
{
$request = $this->_buildBasicRequest()->setOrder($payment->getOrder())->setPaymentMethod($this);
return $request;
}
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:11,代码来源:Hostedpro.php
示例12: _validateExpirationDate
/**
* Validate the card expiration date.
* @param Mage_Payment_Model_Info $info
* @return self
*/
protected function _validateExpirationDate(Mage_Payment_Model_Info $info)
{
if (!$this->_validateExpDate($info->getCcExpYear(), $info->getCcExpMonth())) {
throw Mage::exception('EbayEnterprise_CreditCard', $this->_helper->__(self::INVALID_EXPIRATION_DATE));
}
return $this;
}
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:12,代码来源:Ccpayment.php
示例13: importPaymentInfo
/**
* Get transaction status from gateway response array and change payment status to appropriate
*
* @param Varien_Object $from
* @param Mage_Payment_Model_Info $to
* @return Enterprise_Pbridge_Model_Payment_Method_Authorizenet
*/
public function importPaymentInfo(Varien_Object $from, Mage_Payment_Model_Info $to)
{
$approvedTransactionStatuses = array(self::TRANSACTION_STATUS_AUTHORIZED_PENDING_PAYMENT, self::TRANSACTION_STATUS_CAPTURED_PENDING_SETTLEMENT);
$transactionStatus = $from->getTransactionStatus();
if (in_array($transactionStatus, $approvedTransactionStatuses)) {
$to->setIsTransactionApproved(true);
} elseif (in_array($transactionStatus, array(self::TRANSACTION_STATUS_VOIDED, self::TRANSACTION_STATUS_DECLINED))) {
$to->setIsTransactionDenied(true);
}
return $this;
}
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:18,代码来源:Authorizenet.php
示例14: denyPayment
/**
* Deny payment
* @param Mage_Payment_Model_Info $payment
* @return mixed
*/
public function denyPayment(Mage_Payment_Model_Info $payment)
{
$transactionId = $payment->getLastTransId();
if (!$transactionId) {
return false;
}
$request = $this->_getApiRequest();
$this->_setAdditionalRequestParameters($request, $payment);
$request->setData('transaction_id', $transactionId)->setData('order_id', $payment->getOrder()->getIncrementId());
$api = $this->_getApi()->doDeny($request);
$this->_importResultToPayment($payment, $api->getResponse());
$apiResponse = $api->getResponse();
return $apiResponse;
}
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:19,代码来源:Pbridge.php
示例15: 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);
}
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:12,代码来源:Express.php
示例16: _processFailureMultitransactionAction
/**
* Process exceptions for gateway action with a lot of transactions
*
* @param Mage_Payment_Model_Info $payment
* @param string $messages
* @param bool $isSuccessfulTransactions
*/
protected function _processFailureMultitransactionAction($payment, $messages, $isSuccessfulTransactions)
{
if ($isSuccessfulTransactions) {
$messages[] = Mage::helper('paygate')->__('Gateway actions are locked because the gateway cannot complete one or more of the transactions. Please log in to your Authorize.Net account to manually resolve the issue(s).');
/**
* If there is successful transactions we can not to cancel order but
* have to save information about processed transactions in order`s comments and disable
* opportunity to voiding\capturing\refunding in future. Current order and payment will not be saved because we have to
* load new order object and set information into this object.
*/
$currentOrderId = $payment->getOrder()->getId();
$copyOrder = Mage::getModel('sales/order')->load($currentOrderId);
$copyOrder->getPayment()->setAdditionalInformation($this->_isGatewayActionsLockedKey, 1);
foreach ($messages as $message) {
$copyOrder->addStatusHistoryComment($message);
}
$copyOrder->save();
}
Mage::throwException(Mage::helper('paygate')->convertMessagesToMessage($messages));
}
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:27,代码来源:Authorizenet.php
示例17: setAliasToPayment
/**
* saves the alias and if given the cvc to the payment information
*
* @param Mage_Payment_Model_Info $payment - the payment which should be updated
* @param array $aliasData - the data we will update
* @param boolean $userIsRegistering - is registering method in checkout
* @param boolean $paymentSave - is it necessary to save the payment afterwards
*/
public function setAliasToPayment(Mage_Payment_Model_Info $payment, array $aliasData, $userIsRegistering = false, $paymentSave = false)
{
if (array_key_exists('alias', $aliasData) && 0 < strlen(trim($aliasData['alias']))) {
$payment->setAdditionalInformation('alias', trim($aliasData['alias']));
$payment->setAdditionalInformation('userIsRegistering', $userIsRegistering);
if (array_key_exists('CVC', $aliasData)) {
$payment->setAdditionalInformation('cvc', $aliasData['CVC']);
$this->setCardHolderToAlias($payment->getQuote(), $aliasData);
}
$payment->setDataChanges(true);
if ($paymentSave === true) {
$payment->save();
}
} else {
Mage::helper('ops/data')->log('did not save alias due to empty alias');
Mage::helper('ops/data')->log($aliasData);
}
}
开发者ID:roshu1980,项目名称:add-computers,代码行数:26,代码来源:Alias.php
示例18: getInfoBlock
/**
* Retrieve payment information block
*
* @param Mage_Payment_Model_Info $info
* @return Mage_Core_Block_Template
*/
public function getInfoBlock(Mage_Payment_Model_Info $info)
{
$blockType = $info->getMethodInstance()->getInfoBlockType();
$layout = $this->getLayout() ?: Mage::app()->getLayout();
$block = $layout->createBlock($blockType);
$block->setInfo($info);
return $block;
}
开发者ID:nemphys,项目名称:magento2,代码行数:14,代码来源:Data.php
示例19: getInfoBlock
/**
* Retrieve payment information block
*
* @param Mage_Payment_Model_Info $info
* @return Mage_Core_Block_Template
*/
public function getInfoBlock(Mage_Payment_Model_Info $info)
{
$blockType = $info->getMethodInstance()->getInfoBlockType();
if ($this->getLayout()) {
$block = $this->getLayout()->createBlock($blockType);
} else {
$className = Mage::getConfig()->getBlockClassName($blockType);
$block = new $className();
}
$block->setInfo($info);
return $block;
}
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:18,代码来源:Data.php
示例20: _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;
}
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:34,代码来源:Info.php
注:本文中的Mage_Payment_Model_Info类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论