Version Notes
Built-in code versioning compatible with Magento 1.3 and 1.4.
Compatible with the following versions:
1.3.2.4
1.3.3.0
1.4.1.0
1.4.1.1
Secure URL link fix for SSL certified stores.
Template fix base/default for version 1.4
Payment module error fixed
Download this release
Release Info
| Developer | Magento Core Team |
| Extension | Cardsave_Cardsaveonlinepayments |
| Version | 1.9.1 |
| Comparing to | |
| See all releases | |
Code changes from version 1.9.0 to 1.9.1
- app/code/local/Cardsave/Sales/Model/Order/Payment.php +0 -1084
- package.xml +6 -5
app/code/local/Cardsave/Sales/Model/Order/Payment.php
CHANGED
|
@@ -399,1088 +399,4 @@ class Cardsave_Sales_Model_Order_Payment extends Mage_Sales_Model_Order_Payment
|
|
| 399 |
return $this;
|
| 400 |
}
|
| 401 |
}
|
| 402 |
-
|
| 403 |
-
/**
|
| 404 |
-
* Actions for payment when it triggered review state
|
| 405 |
-
*
|
| 406 |
-
* @var string
|
| 407 |
-
*/
|
| 408 |
-
const REVIEW_ACTION_ACCEPT = 'accept';
|
| 409 |
-
const REVIEW_ACTION_DENY = 'deny';
|
| 410 |
-
const REVIEW_ACTION_UPDATE = 'update';
|
| 411 |
-
|
| 412 |
-
/**
|
| 413 |
-
* Order model object
|
| 414 |
-
*
|
| 415 |
-
* @var Mage_Sales_Model_Order
|
| 416 |
-
*/
|
| 417 |
-
protected $_order;
|
| 418 |
-
|
| 419 |
-
/**
|
| 420 |
-
* Billing agreement instance that may be created during payment processing
|
| 421 |
-
*
|
| 422 |
-
* @var Mage_Sales_Model_Billing_Agreement
|
| 423 |
-
*/
|
| 424 |
-
protected $_billingAgreement = null;
|
| 425 |
-
|
| 426 |
-
/**
|
| 427 |
-
* Whether can void
|
| 428 |
-
* @var string
|
| 429 |
-
*/
|
| 430 |
-
protected $_canVoidLookup = null;
|
| 431 |
-
|
| 432 |
-
/**
|
| 433 |
-
* Transactions registry to spare resource calls
|
| 434 |
-
* array(txn_id => sales/order_payment_transaction)
|
| 435 |
-
* @var array
|
| 436 |
-
*/
|
| 437 |
-
protected $_transactionsLookup = array();
|
| 438 |
-
|
| 439 |
-
protected $_eventPrefix = 'sales_order_payment';
|
| 440 |
-
protected $_eventObject = 'payment';
|
| 441 |
-
|
| 442 |
-
/**
|
| 443 |
-
* Transaction addditional information container
|
| 444 |
-
*
|
| 445 |
-
* @var array
|
| 446 |
-
*/
|
| 447 |
-
protected $_transactionAdditionalInfo = array();
|
| 448 |
-
|
| 449 |
-
/**
|
| 450 |
-
* Initialize resource model
|
| 451 |
-
*/
|
| 452 |
-
protected function _construct()
|
| 453 |
-
{
|
| 454 |
-
$this->_init('sales/order_payment');
|
| 455 |
-
}
|
| 456 |
-
|
| 457 |
-
/**
|
| 458 |
-
* Declare order model object
|
| 459 |
-
*
|
| 460 |
-
* @param Mage_Sales_Model_Order $order
|
| 461 |
-
* @return Mage_Sales_Model_Order_Payment
|
| 462 |
-
*/
|
| 463 |
-
public function setOrder(Mage_Sales_Model_Order $order)
|
| 464 |
-
{
|
| 465 |
-
$this->_order = $order;
|
| 466 |
-
return $this;
|
| 467 |
-
}
|
| 468 |
-
|
| 469 |
-
/**
|
| 470 |
-
* Retrieve order model object
|
| 471 |
-
*
|
| 472 |
-
* @return Mage_Sales_Model_Order
|
| 473 |
-
*/
|
| 474 |
-
public function getOrder()
|
| 475 |
-
{
|
| 476 |
-
return $this->_order;
|
| 477 |
-
}
|
| 478 |
-
|
| 479 |
-
/**
|
| 480 |
-
* Check order payment capture action availability
|
| 481 |
-
*
|
| 482 |
-
* @return bool
|
| 483 |
-
*/
|
| 484 |
-
public function canCapture()
|
| 485 |
-
{
|
| 486 |
-
if (!$this->getMethodInstance()->canCapture()) {
|
| 487 |
-
return false;
|
| 488 |
-
}
|
| 489 |
-
// Check Authoriztion transaction state
|
| 490 |
-
$authTransaction = $this->getAuthorizationTransaction();
|
| 491 |
-
if ($authTransaction && $authTransaction->getIsClosed()) {
|
| 492 |
-
return false;
|
| 493 |
-
}
|
| 494 |
-
return true;
|
| 495 |
-
}
|
| 496 |
-
|
| 497 |
-
public function canRefund()
|
| 498 |
-
{
|
| 499 |
-
return $this->getMethodInstance()->canRefund();
|
| 500 |
-
}
|
| 501 |
-
|
| 502 |
-
public function canRefundPartialPerInvoice()
|
| 503 |
-
{
|
| 504 |
-
return $this->getMethodInstance()->canRefundPartialPerInvoice();
|
| 505 |
-
}
|
| 506 |
-
|
| 507 |
-
public function canCapturePartial()
|
| 508 |
-
{
|
| 509 |
-
return $this->getMethodInstance()->canCapturePartial();
|
| 510 |
-
}
|
| 511 |
-
|
| 512 |
-
/**
|
| 513 |
-
* Process a capture notification from a payment gateway for specified amount
|
| 514 |
-
* Creates an invoice automatically if the amount covers the order base grand total completely
|
| 515 |
-
* Updates transactions hierarchy, if required
|
| 516 |
-
* Prevents transaction double processing
|
| 517 |
-
* Updates payment totals, updates order status and adds proper comments
|
| 518 |
-
*
|
| 519 |
-
* TODO: eliminate logic duplication with capture()
|
| 520 |
-
*
|
| 521 |
-
* @param float $amount
|
| 522 |
-
* @return Mage_Sales_Model_Order_Payment
|
| 523 |
-
*/
|
| 524 |
-
public function registerCaptureNotification($amount)
|
| 525 |
-
{
|
| 526 |
-
$this->_generateTransactionId(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE,
|
| 527 |
-
$this->getAuthorizationTransaction()
|
| 528 |
-
);
|
| 529 |
-
|
| 530 |
-
$order = $this->getOrder();
|
| 531 |
-
$amount = (float)$amount;
|
| 532 |
-
$invoice = $this->_getInvoiceForTransactionId($this->getTransactionId());
|
| 533 |
-
|
| 534 |
-
// register new capture
|
| 535 |
-
if (!$invoice) {
|
| 536 |
-
if ($this->_isCaptureFinal($amount)) {
|
| 537 |
-
$invoice = $order->prepareInvoice()->register();
|
| 538 |
-
$order->addRelatedObject($invoice);
|
| 539 |
-
$this->setCreatedInvoice($invoice);
|
| 540 |
-
} else {
|
| 541 |
-
$this->_updateTotals(array('base_amount_paid_online' => $amount));
|
| 542 |
-
}
|
| 543 |
-
}
|
| 544 |
-
|
| 545 |
-
$status = true;
|
| 546 |
-
if ($this->getIsTransactionPending()) {
|
| 547 |
-
$message = Mage::helper('sales')->__('Capturing amount of %s is pending approval on gateway.', $this->_formatPrice($amount));
|
| 548 |
-
$state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
|
| 549 |
-
if ($this->getIsFraudDetected()) {
|
| 550 |
-
$status = 'fraud';
|
| 551 |
-
}
|
| 552 |
-
} else {
|
| 553 |
-
$message = Mage::helper('sales')->__('Registered notification about captured amount of %s.', $this->_formatPrice($amount));
|
| 554 |
-
$state = Mage_Sales_Model_Order::STATE_PROCESSING;
|
| 555 |
-
// register capture for an existing invoice
|
| 556 |
-
if ($invoice && Mage_Sales_Model_Order_Invoice::STATE_OPEN == $invoice->getState()) {
|
| 557 |
-
$invoice->pay();
|
| 558 |
-
$this->_updateTotals(array('base_amount_paid_online' => $amount));
|
| 559 |
-
$order->addRelatedObject($invoice);
|
| 560 |
-
}
|
| 561 |
-
}
|
| 562 |
-
|
| 563 |
-
$transaction = $this->_addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, $invoice, true);
|
| 564 |
-
$message = $this->_prependMessage($message);
|
| 565 |
-
$message = $this->_appendTransactionToMessage($transaction, $message);
|
| 566 |
-
$order->setState($state, $status, $message);
|
| 567 |
-
return $this;
|
| 568 |
-
}
|
| 569 |
-
|
| 570 |
-
/**
|
| 571 |
-
* Process authorization notification
|
| 572 |
-
*
|
| 573 |
-
* @see self::_authorize()
|
| 574 |
-
* @param float $amount
|
| 575 |
-
* @return Mage_Sales_Model_Order_Payment
|
| 576 |
-
*/
|
| 577 |
-
public function registerAuthorizationNotification($amount)
|
| 578 |
-
{
|
| 579 |
-
return ($this->_isTransactionExists()) ? $this : $this->_authorize(false, $amount);
|
| 580 |
-
}
|
| 581 |
-
|
| 582 |
-
/**
|
| 583 |
-
* Register payment fact: update self totals from the invoice
|
| 584 |
-
*
|
| 585 |
-
* @param Mage_Sales_Model_Order_Invoice $invoice
|
| 586 |
-
* @return Mage_Sales_Model_Order_Payment
|
| 587 |
-
*/
|
| 588 |
-
public function pay($invoice)
|
| 589 |
-
{
|
| 590 |
-
$this->_updateTotals(array(
|
| 591 |
-
'amount_paid' => $invoice->getGrandTotal(),
|
| 592 |
-
'base_amount_paid' => $invoice->getBaseGrandTotal(),
|
| 593 |
-
'shipping_captured' => $invoice->getShippingAmount(),
|
| 594 |
-
'base_shipping_captured' => $invoice->getBaseShippingAmount(),
|
| 595 |
-
));
|
| 596 |
-
Mage::dispatchEvent('sales_order_payment_pay', array('payment' => $this, 'invoice' => $invoice));
|
| 597 |
-
return $this;
|
| 598 |
-
}
|
| 599 |
-
|
| 600 |
-
/**
|
| 601 |
-
* Cancel specified invoice: update self totals from it
|
| 602 |
-
*
|
| 603 |
-
* @param Mage_Sales_Model_Order_Invoice $invoice
|
| 604 |
-
* @return Mage_Sales_Model_Order_Payment
|
| 605 |
-
*/
|
| 606 |
-
public function cancelInvoice($invoice)
|
| 607 |
-
{
|
| 608 |
-
$this->_updateTotals(array(
|
| 609 |
-
'amount_paid' => -1 * $invoice->getGrandTotal(),
|
| 610 |
-
'base_amount_paid' => -1 * $invoice->getBaseGrandTotal(),
|
| 611 |
-
'shipping_captured' => -1 * $invoice->getShippingAmount(),
|
| 612 |
-
'base_shipping_captured' => -1 * $invoice->getBaseShippingAmount(),
|
| 613 |
-
));
|
| 614 |
-
Mage::dispatchEvent('sales_order_payment_cancel_invoice', array('payment' => $this, 'invoice' => $invoice));
|
| 615 |
-
return $this;
|
| 616 |
-
}
|
| 617 |
-
|
| 618 |
-
/**
|
| 619 |
-
* Create new invoice with maximum qty for invoice for each item
|
| 620 |
-
* register this invoice and capture
|
| 621 |
-
*
|
| 622 |
-
* @return Mage_Sales_Model_Order_Invoice
|
| 623 |
-
*/
|
| 624 |
-
protected function _invoice()
|
| 625 |
-
{
|
| 626 |
-
$invoice = $this->getOrder()->prepareInvoice();
|
| 627 |
-
|
| 628 |
-
$invoice->register();
|
| 629 |
-
if ($this->getMethodInstance()->canCapture()) {
|
| 630 |
-
$invoice->capture();
|
| 631 |
-
}
|
| 632 |
-
|
| 633 |
-
$this->getOrder()->addRelatedObject($invoice);
|
| 634 |
-
return $invoice;
|
| 635 |
-
}
|
| 636 |
-
|
| 637 |
-
/**
|
| 638 |
-
* Check order payment void availability
|
| 639 |
-
*
|
| 640 |
-
* @return bool
|
| 641 |
-
*/
|
| 642 |
-
public function canVoid(Varien_Object $document)
|
| 643 |
-
{
|
| 644 |
-
if (null === $this->_canVoidLookup) {
|
| 645 |
-
$this->_canVoidLookup = (bool)$this->getMethodInstance()->canVoid($document);
|
| 646 |
-
if ($this->_canVoidLookup) {
|
| 647 |
-
$authTransaction = $this->getAuthorizationTransaction();
|
| 648 |
-
$this->_canVoidLookup = (bool)$authTransaction && !(int)$authTransaction->getIsClosed();
|
| 649 |
-
}
|
| 650 |
-
}
|
| 651 |
-
return $this->_canVoidLookup;
|
| 652 |
-
}
|
| 653 |
-
|
| 654 |
-
/**
|
| 655 |
-
* Void payment online
|
| 656 |
-
*
|
| 657 |
-
* @see self::_void()
|
| 658 |
-
* @param Varien_Object $document
|
| 659 |
-
* @return Mage_Sales_Model_Order_Payment
|
| 660 |
-
*/
|
| 661 |
-
public function void(Varien_Object $document)
|
| 662 |
-
{
|
| 663 |
-
$this->_void(true);
|
| 664 |
-
Mage::dispatchEvent('sales_order_payment_void', array('payment' => $this, 'invoice' => $document));
|
| 665 |
-
return $this;
|
| 666 |
-
}
|
| 667 |
-
|
| 668 |
-
/**
|
| 669 |
-
* Process void notification
|
| 670 |
-
*
|
| 671 |
-
* @see self::_void()
|
| 672 |
-
* @param float $amount
|
| 673 |
-
* @return Mage_Sales_Model_Payment
|
| 674 |
-
*/
|
| 675 |
-
public function registerVoidNotification($amount = null)
|
| 676 |
-
{
|
| 677 |
-
if (!$this->hasMessage()) {
|
| 678 |
-
$this->setMessage(Mage::helper('sales')->__('Registered a Void notification.'));
|
| 679 |
-
}
|
| 680 |
-
return $this->_void(false, $amount);
|
| 681 |
-
}
|
| 682 |
-
|
| 683 |
-
/**
|
| 684 |
-
* Refund payment online or offline, depending on whether there is invoice set in the creditmemo instance
|
| 685 |
-
* Updates transactions hierarchy, if required
|
| 686 |
-
* Updates payment totals, updates order status and adds proper comments
|
| 687 |
-
*
|
| 688 |
-
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
|
| 689 |
-
* @return Mage_Sales_Model_Order_Payment
|
| 690 |
-
*/
|
| 691 |
-
public function refund($creditmemo)
|
| 692 |
-
{
|
| 693 |
-
$baseAmountToRefund = $this->_formatAmount($creditmemo->getBaseGrandTotal());
|
| 694 |
-
$order = $this->getOrder();
|
| 695 |
-
|
| 696 |
-
$this->_generateTransactionId(Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND);
|
| 697 |
-
|
| 698 |
-
// call refund from gateway if required
|
| 699 |
-
$isOnline = false;
|
| 700 |
-
$gateway = $this->getMethodInstance();
|
| 701 |
-
$invoice = null;
|
| 702 |
-
if ($gateway->canRefund() && $creditmemo->getDoTransaction()) {
|
| 703 |
-
$this->setCreditmemo($creditmemo);
|
| 704 |
-
$invoice = $creditmemo->getInvoice();
|
| 705 |
-
if ($invoice) {
|
| 706 |
-
$isOnline = true;
|
| 707 |
-
$captureTxn = $this->_lookupTransaction($invoice->getTransactionId());
|
| 708 |
-
if ($captureTxn) {
|
| 709 |
-
$this->setParentTransactionId($captureTxn->getTxnId());
|
| 710 |
-
}
|
| 711 |
-
$this->setShouldCloseParentTransaction(true); // TODO: implement multiple refunds per capture
|
| 712 |
-
try {
|
| 713 |
-
$gateway->setStore($this->getOrder()->getStoreId())
|
| 714 |
-
->processBeforeRefund($invoice, $this)
|
| 715 |
-
->refund($this, $baseAmountToRefund)
|
| 716 |
-
->processCreditmemo($creditmemo, $this)
|
| 717 |
-
;
|
| 718 |
-
} catch (Mage_Core_Exception $e) {
|
| 719 |
-
if (!$captureTxn) {
|
| 720 |
-
$e->setMessage(' ' . Mage::helper('sales')->__('If the invoice was created offline, try creating an offline creditmemo.'), true);
|
| 721 |
-
}
|
| 722 |
-
throw $e;
|
| 723 |
-
}
|
| 724 |
-
}
|
| 725 |
-
}
|
| 726 |
-
|
| 727 |
-
// update self totals from creditmemo
|
| 728 |
-
$this->_updateTotals(array(
|
| 729 |
-
'amount_refunded' => $creditmemo->getGrandTotal(),
|
| 730 |
-
'base_amount_refunded' => $baseAmountToRefund,
|
| 731 |
-
'base_amount_refunded_online' => $isOnline ? $baseAmountToRefund : null,
|
| 732 |
-
'shipping_refunded' => $creditmemo->getShippingAmount(),
|
| 733 |
-
'base_shipping_refunded' => $creditmemo->getBaseShippingAmount(),
|
| 734 |
-
));
|
| 735 |
-
|
| 736 |
-
// update transactions and order state
|
| 737 |
-
$transaction = $this->_addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND, $creditmemo, $isOnline);
|
| 738 |
-
if ($invoice) {
|
| 739 |
-
$message = Mage::helper('sales')->__('Refunded amount of %s online.', $this->_formatPrice($baseAmountToRefund));
|
| 740 |
-
} else {
|
| 741 |
-
$message = $this->hasMessage() ? $this->getMessage()
|
| 742 |
-
: Mage::helper('sales')->__('Refunded amount of %s offline.', $this->_formatPrice($baseAmountToRefund));
|
| 743 |
-
}
|
| 744 |
-
$message = $message = $this->_prependMessage($message);
|
| 745 |
-
$message = $this->_appendTransactionToMessage($transaction, $message);
|
| 746 |
-
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, $message);
|
| 747 |
-
|
| 748 |
-
Mage::dispatchEvent('sales_order_payment_refund', array('payment' => $this, 'creditmemo' => $creditmemo));
|
| 749 |
-
return $this;
|
| 750 |
-
}
|
| 751 |
-
|
| 752 |
-
/**
|
| 753 |
-
* Process payment refund notification
|
| 754 |
-
* Updates transactions hierarchy, if required
|
| 755 |
-
* Prevents transaction double processing
|
| 756 |
-
* Updates payment totals, updates order status and adds proper comments
|
| 757 |
-
* TODO: potentially a full capture can be refunded. In this case if there was only one invoice for that transaction
|
| 758 |
-
* then we should create a creditmemo from invoice and also refund it offline
|
| 759 |
-
* TODO: implement logic of chargebacks reimbursements (via negative amount)
|
| 760 |
-
*
|
| 761 |
-
* @param float $amount
|
| 762 |
-
* @return Mage_Sales_Model_Order_Payment
|
| 763 |
-
*/
|
| 764 |
-
public function registerRefundNotification($amount)
|
| 765 |
-
{
|
| 766 |
-
$this->_generateTransactionId(Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND,
|
| 767 |
-
$this->_lookupTransaction($this->getParentTransactionId())
|
| 768 |
-
);
|
| 769 |
-
if ($this->_isTransactionExists()) {
|
| 770 |
-
return $this;
|
| 771 |
-
}
|
| 772 |
-
$order = $this->getOrder();
|
| 773 |
-
|
| 774 |
-
// create an offline creditmemo (from order), if the entire grand total of order is covered by this refund
|
| 775 |
-
$creditmemo = null;
|
| 776 |
-
if ($amount == $order->getBaseGrandTotal()) {
|
| 777 |
-
/*
|
| 778 |
-
$creditmemo = $order->prepareCreditmemo()->register()->refund();
|
| 779 |
-
$this->_updateTotals(array(
|
| 780 |
-
'amount_refunded' => $creditmemo->getGrandTotal(),
|
| 781 |
-
'shipping_refunded' => $creditmemo->getShippingRefunded(),
|
| 782 |
-
'base_shipping_refunded' => $creditmemo->getBaseShippingRefunded()
|
| 783 |
-
));
|
| 784 |
-
$order->addRelatedObject($creditmemo);
|
| 785 |
-
$this->setCreatedCreditmemo($creditmemo);
|
| 786 |
-
*/
|
| 787 |
-
}
|
| 788 |
-
$this->_updateTotals(array('base_amount_refunded_online' => $amount));
|
| 789 |
-
|
| 790 |
-
// update transactions and order state
|
| 791 |
-
$transaction = $this->_addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND, $creditmemo);
|
| 792 |
-
$message = $this->_prependMessage(
|
| 793 |
-
Mage::helper('sales')->__('Registered notification about refunded amount of %s.', $this->_formatPrice($amount))
|
| 794 |
-
);
|
| 795 |
-
$message = $this->_appendTransactionToMessage($transaction, $message);
|
| 796 |
-
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, $message);
|
| 797 |
-
return $this;
|
| 798 |
-
}
|
| 799 |
-
|
| 800 |
-
/**
|
| 801 |
-
* Cancel a creditmemo: substract its totals from the payment
|
| 802 |
-
*
|
| 803 |
-
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
|
| 804 |
-
* @return Mage_Sales_Model_Order_Payment
|
| 805 |
-
*/
|
| 806 |
-
public function cancelCreditmemo($creditmemo)
|
| 807 |
-
{
|
| 808 |
-
$this->_updateTotals(array(
|
| 809 |
-
'amount_refunded' => -1 * $creditmemo->getGrandTotal(),
|
| 810 |
-
'base_amount_refunded' => -1 * $creditmemo->getBaseGrandTotal(),
|
| 811 |
-
'shipping_refunded' => -1 * $creditmemo->getShippingAmount(),
|
| 812 |
-
'base_shipping_refunded' => -1 * $creditmemo->getBaseShippingAmount()
|
| 813 |
-
));
|
| 814 |
-
Mage::dispatchEvent('sales_order_payment_cancel_creditmemo',
|
| 815 |
-
array('payment' => $this, 'creditmemo' => $creditmemo)
|
| 816 |
-
);
|
| 817 |
-
return $this;
|
| 818 |
-
}
|
| 819 |
-
|
| 820 |
-
/**
|
| 821 |
-
* Order cancellation hook for payment method instance
|
| 822 |
-
* Adds void transaction if needed
|
| 823 |
-
* @return Mage_Sales_Model_Order_Payment
|
| 824 |
-
*/
|
| 825 |
-
public function cancel()
|
| 826 |
-
{
|
| 827 |
-
$isOnline = true;
|
| 828 |
-
if (!$this->canVoid(new Varien_Object())) {
|
| 829 |
-
$isOnline = false;
|
| 830 |
-
}
|
| 831 |
-
|
| 832 |
-
if (!$this->hasMessage()) {
|
| 833 |
-
$this->setMessage($isOnline ? Mage::helper('sales')->__('Canceled order online.')
|
| 834 |
-
: Mage::helper('sales')->__('Canceled order offline.')
|
| 835 |
-
);
|
| 836 |
-
}
|
| 837 |
-
|
| 838 |
-
if ($isOnline) {
|
| 839 |
-
$this->_void($isOnline, null, 'cancel');
|
| 840 |
-
}
|
| 841 |
-
|
| 842 |
-
Mage::dispatchEvent('sales_order_payment_cancel', array('payment' => $this));
|
| 843 |
-
|
| 844 |
-
return $this;
|
| 845 |
-
}
|
| 846 |
-
|
| 847 |
-
/**
|
| 848 |
-
* Check order payment review availability
|
| 849 |
-
*
|
| 850 |
-
* @return bool
|
| 851 |
-
*/
|
| 852 |
-
public function canReviewPayment()
|
| 853 |
-
{
|
| 854 |
-
return (bool)$this->getMethodInstance()->canReviewPayment($this);
|
| 855 |
-
}
|
| 856 |
-
|
| 857 |
-
public function canFetchTransactionInfo()
|
| 858 |
-
{
|
| 859 |
-
return (bool)$this->getMethodInstance()->canFetchTransactionInfo();
|
| 860 |
-
}
|
| 861 |
-
|
| 862 |
-
/**
|
| 863 |
-
* Accept online a payment that is in review state
|
| 864 |
-
*
|
| 865 |
-
* @return Mage_Sales_Model_Order_Payment
|
| 866 |
-
*/
|
| 867 |
-
public function accept()
|
| 868 |
-
{
|
| 869 |
-
$this->registerPaymentReviewAction(self::REVIEW_ACTION_ACCEPT, true);
|
| 870 |
-
return $this;
|
| 871 |
-
}
|
| 872 |
-
|
| 873 |
-
/**
|
| 874 |
-
* Accept order with payment method instance
|
| 875 |
-
*
|
| 876 |
-
* @return Mage_Sales_Model_Order_Payment
|
| 877 |
-
*/
|
| 878 |
-
public function deny()
|
| 879 |
-
{
|
| 880 |
-
$this->registerPaymentReviewAction(self::REVIEW_ACTION_DENY, true);
|
| 881 |
-
return $this;
|
| 882 |
-
}
|
| 883 |
-
|
| 884 |
-
/**
|
| 885 |
-
* Perform the payment review action: either initiated by merchant or by a notification
|
| 886 |
-
*
|
| 887 |
-
* Sets order to processing state and optionally approves invoice or cancels the order
|
| 888 |
-
*
|
| 889 |
-
* @param string $action
|
| 890 |
-
* @param bool $isOnline
|
| 891 |
-
* @return Mage_Sales_Model_Order_Payment
|
| 892 |
-
*/
|
| 893 |
-
public function registerPaymentReviewAction($action, $isOnline)
|
| 894 |
-
{
|
| 895 |
-
$order = $this->getOrder();
|
| 896 |
-
|
| 897 |
-
$transactionId = $isOnline ? $this->getLastTransId() : $this->getTransactionId();
|
| 898 |
-
if (!$this->_lookupTransaction($transactionId)) {
|
| 899 |
-
Mage::throwException(Mage::helper('sales')->__('No valid transaction found for this payment review.'));
|
| 900 |
-
}
|
| 901 |
-
$invoice = $this->_getInvoiceForTransactionId($transactionId);
|
| 902 |
-
|
| 903 |
-
// invoke the payment method to determine what to do with the transaction
|
| 904 |
-
$result = null; $message = null;
|
| 905 |
-
switch ($action) {
|
| 906 |
-
case self::REVIEW_ACTION_ACCEPT:
|
| 907 |
-
if ($isOnline) {
|
| 908 |
-
if ($this->getMethodInstance()->setStore($order->getStoreId())->acceptPayment($this)) {
|
| 909 |
-
$result = true;
|
| 910 |
-
$message = Mage::helper('sales')->__('Approved the payment online.');
|
| 911 |
-
} else {
|
| 912 |
-
$result = -1;
|
| 913 |
-
$message = Mage::helper('sales')->__('There is no need to approve this payment.');
|
| 914 |
-
}
|
| 915 |
-
} else {
|
| 916 |
-
$result = (bool)$this->getNotificationResult() ? true : -1;
|
| 917 |
-
$message = Mage::helper('sales')->__('Registered notification about approved payment.');
|
| 918 |
-
}
|
| 919 |
-
break;
|
| 920 |
-
case self::REVIEW_ACTION_DENY:
|
| 921 |
-
if ($isOnline) {
|
| 922 |
-
if ($this->getMethodInstance()->setStore($order->getStoreId())->denyPayment($this)) {
|
| 923 |
-
$result = false;
|
| 924 |
-
$message = Mage::helper('sales')->__('Denied the payment online.');
|
| 925 |
-
} else {
|
| 926 |
-
$result = -1;
|
| 927 |
-
$message = Mage::helper('sales')->__('There is no need to deny this payment.');
|
| 928 |
-
}
|
| 929 |
-
} else {
|
| 930 |
-
$result = (bool)$this->getNotificationResult() ? false : -1;
|
| 931 |
-
$message = Mage::helper('sales')->__('Registered notification about denied payment.');
|
| 932 |
-
}
|
| 933 |
-
break;
|
| 934 |
-
case self::REVIEW_ACTION_UPDATE:
|
| 935 |
-
if ($isOnline) {
|
| 936 |
-
$this->getMethodInstance()->setStore($order->getStoreId())->fetchTransactionInfo($this, $transactionId);
|
| 937 |
-
} else {
|
| 938 |
-
// notification mechanism is responsible to update the payment object first
|
| 939 |
-
}
|
| 940 |
-
if ($this->getIsTransactionApproved()) {
|
| 941 |
-
$result = true;
|
| 942 |
-
$message = Mage::helper('sales')->__('Registered update about approved payment.');
|
| 943 |
-
} elseif ($this->getIsTransactionDenied()) {
|
| 944 |
-
$result = false;
|
| 945 |
-
$message = Mage::helper('sales')->__('Registered update about approved payment.');
|
| 946 |
-
} else {
|
| 947 |
-
$result = -1;
|
| 948 |
-
$message = Mage::helper('sales')->__('There is no update for the payment.');
|
| 949 |
-
}
|
| 950 |
-
break;
|
| 951 |
-
default:
|
| 952 |
-
throw new Exception('Not implemented.');
|
| 953 |
-
}
|
| 954 |
-
$message = $this->_prependMessage($message);
|
| 955 |
-
$message = $this->_appendTransactionToMessage($transactionId, $message);
|
| 956 |
-
|
| 957 |
-
// process payment in case of positive or negative result, or add a comment
|
| 958 |
-
if (-1 === $result) { // switch won't work with such $result!
|
| 959 |
-
$order->addStatusHistoryComment($message);
|
| 960 |
-
} elseif (true === $result) {
|
| 961 |
-
if ($invoice) {
|
| 962 |
-
$invoice->pay();
|
| 963 |
-
$this->_updateTotals(array('base_amount_paid_online' => $invoice->getBaseGrandTotal()));
|
| 964 |
-
$order->addRelatedObject($invoice);
|
| 965 |
-
}
|
| 966 |
-
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, $message);
|
| 967 |
-
} elseif (false === $result) {
|
| 968 |
-
if ($invoice) {
|
| 969 |
-
$invoice->cancel();
|
| 970 |
-
$order->addRelatedObject($invoice);
|
| 971 |
-
}
|
| 972 |
-
$order->registerCancellation($message, false);
|
| 973 |
-
}
|
| 974 |
-
return $this;
|
| 975 |
-
}
|
| 976 |
-
|
| 977 |
-
/**
|
| 978 |
-
* Authorize payment either online or offline (process auth notification)
|
| 979 |
-
* Updates transactions hierarchy, if required
|
| 980 |
-
* Prevents transaction double processing
|
| 981 |
-
* Updates payment totals, updates order status and adds proper comments
|
| 982 |
-
*
|
| 983 |
-
* @param bool $isOnline
|
| 984 |
-
* @param float $amount
|
| 985 |
-
* @return Mage_Sales_Model_Order_Payment
|
| 986 |
-
*/
|
| 987 |
-
protected function _authorize($isOnline, $amount)
|
| 988 |
-
{
|
| 989 |
-
// update totals
|
| 990 |
-
$amount = $this->_formatAmount($amount, true);
|
| 991 |
-
$this->setBaseAmountAuthorized($amount);
|
| 992 |
-
|
| 993 |
-
// do authorization
|
| 994 |
-
$order = $this->getOrder();
|
| 995 |
-
$state = Mage_Sales_Model_Order::STATE_PROCESSING;
|
| 996 |
-
$status = true;
|
| 997 |
-
if ($isOnline) {
|
| 998 |
-
|
| 999 |
-
// invoke authorization on gateway
|
| 1000 |
-
$this->getMethodInstance()->setStore($order->getStoreId())->authorize($this, $amount);
|
| 1001 |
-
|
| 1002 |
-
// similar logic of "payment review" order as in capturing
|
| 1003 |
-
if ($this->getIsTransactionPending()) {
|
| 1004 |
-
$message = Mage::helper('sales')->__('Authorizing amount of %s is pending approval on gateway.', $this->_formatPrice($amount));
|
| 1005 |
-
$state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
|
| 1006 |
-
if ($this->getIsFraudDetected()) {
|
| 1007 |
-
$status = 'fraud';
|
| 1008 |
-
}
|
| 1009 |
-
} else {
|
| 1010 |
-
$message = Mage::helper('sales')->__('Authorized amount of %s.', $this->_formatPrice($amount));
|
| 1011 |
-
}
|
| 1012 |
-
} else {
|
| 1013 |
-
$message = Mage::helper('sales')->__('Registered notification about authorized amount of %s.', $this->_formatPrice($amount));
|
| 1014 |
-
}
|
| 1015 |
-
|
| 1016 |
-
// update transactions, order state and add comments
|
| 1017 |
-
$transaction = $this->_addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH);
|
| 1018 |
-
if ($order->isNominal()) {
|
| 1019 |
-
$message = $this->_prependMessage(Mage::helper('sales')->__('Nominal order registered.'));
|
| 1020 |
-
} else {
|
| 1021 |
-
$message = $this->_prependMessage($message);
|
| 1022 |
-
$message = $this->_appendTransactionToMessage($transaction, $message);
|
| 1023 |
-
}
|
| 1024 |
-
$order->setState($state, $status, $message);
|
| 1025 |
-
|
| 1026 |
-
return $this;
|
| 1027 |
-
}
|
| 1028 |
-
|
| 1029 |
-
/**
|
| 1030 |
-
* Public access to _authorize method
|
| 1031 |
-
* @param bool $isOnline
|
| 1032 |
-
* @param float $amount
|
| 1033 |
-
*/
|
| 1034 |
-
public function authorize($isOnline, $amount)
|
| 1035 |
-
{
|
| 1036 |
-
return $this->_authorize($isOnline, $amount);
|
| 1037 |
-
}
|
| 1038 |
-
|
| 1039 |
-
/**
|
| 1040 |
-
* Void payment either online or offline (process void notification)
|
| 1041 |
-
* NOTE: that in some cases authorization can be voided after a capture. In such case it makes sense to use
|
| 1042 |
-
* the amount void amount, for informational purposes.
|
| 1043 |
-
* Updates payment totals, updates order status and adds proper comments
|
| 1044 |
-
*
|
| 1045 |
-
* @param bool $isOnline
|
| 1046 |
-
* @param float $amount
|
| 1047 |
-
* @param string $gatewayCallback
|
| 1048 |
-
* @return Mage_Sales_Model_Order_Payment
|
| 1049 |
-
*/
|
| 1050 |
-
protected function _void($isOnline, $amount = null, $gatewayCallback = 'void')
|
| 1051 |
-
{
|
| 1052 |
-
$order = $this->getOrder();
|
| 1053 |
-
$authTransaction = $this->getAuthorizationTransaction();
|
| 1054 |
-
$this->_generateTransactionId(Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID, $authTransaction);
|
| 1055 |
-
$this->setShouldCloseParentTransaction(true);
|
| 1056 |
-
|
| 1057 |
-
// attempt to void
|
| 1058 |
-
if ($isOnline) {
|
| 1059 |
-
$this->getMethodInstance()->setStore($order->getStoreId())->$gatewayCallback($this);
|
| 1060 |
-
}
|
| 1061 |
-
if ($this->_isTransactionExists()) {
|
| 1062 |
-
return $this;
|
| 1063 |
-
}
|
| 1064 |
-
|
| 1065 |
-
// if the authorization was untouched, we may assume voided amount = order grand total
|
| 1066 |
-
// but only if the payment auth amount equals to order grand total
|
| 1067 |
-
if ($authTransaction && ($order->getBaseGrandTotal() == $this->getBaseAmountAuthorized())
|
| 1068 |
-
&& (0 == $this->getBaseAmountCanceled())) {
|
| 1069 |
-
if ($authTransaction->canVoidAuthorizationCompletely()) {
|
| 1070 |
-
$amount = (float)$order->getBaseGrandTotal();
|
| 1071 |
-
}
|
| 1072 |
-
}
|
| 1073 |
-
|
| 1074 |
-
if ($amount) {
|
| 1075 |
-
$amount = $this->_formatAmount($amount);
|
| 1076 |
-
}
|
| 1077 |
-
|
| 1078 |
-
// update transactions, order state and add comments
|
| 1079 |
-
$transaction = $this->_addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID);
|
| 1080 |
-
$message = $this->hasMessage() ? $this->getMessage() : Mage::helper('sales')->__('Voided authorization.');
|
| 1081 |
-
$message = $this->_prependMessage($message);
|
| 1082 |
-
if ($amount) {
|
| 1083 |
-
$message .= ' ' . Mage::helper('sales')->__('Amount: %s.', $this->_formatPrice($amount));
|
| 1084 |
-
}
|
| 1085 |
-
$message = $this->_appendTransactionToMessage($transaction, $message);
|
| 1086 |
-
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, $message);
|
| 1087 |
-
return $this;
|
| 1088 |
-
}
|
| 1089 |
-
|
| 1090 |
-
// /**
|
| 1091 |
-
// * TODO: implement this
|
| 1092 |
-
// * @param Mage_Sales_Model_Order_Invoice $invoice
|
| 1093 |
-
// * @return Mage_Sales_Model_Order_Payment
|
| 1094 |
-
// */
|
| 1095 |
-
// public function cancelCapture($invoice = null)
|
| 1096 |
-
// {
|
| 1097 |
-
// }
|
| 1098 |
-
|
| 1099 |
-
/**
|
| 1100 |
-
* Create transaction, prepare its insertion into hierarchy and add its information to payment and comments
|
| 1101 |
-
*
|
| 1102 |
-
* To add transactions and related information, the following information should be set to payment before processing:
|
| 1103 |
-
* - transaction_id
|
| 1104 |
-
* - is_transaction_closed (optional) - whether transaction should be closed or open (closed by default)
|
| 1105 |
-
* - parent_transaction_id (optional)
|
| 1106 |
-
* - should_close_parent_transaction (optional) - whether to close parent transaction (closed by default)
|
| 1107 |
-
*
|
| 1108 |
-
* If the sales document is specified, it will be linked to the transaction as related for future usage.
|
| 1109 |
-
* Currently transaction ID is set into the sales object
|
| 1110 |
-
* This method writes the added transaction ID into last_trans_id field of the payment object
|
| 1111 |
-
*
|
| 1112 |
-
* To make sure transaction object won't cause trouble before saving, use $failsafe = true
|
| 1113 |
-
*
|
| 1114 |
-
* @param string $type
|
| 1115 |
-
* @param Mage_Sales_Model_Abstract $salesDocument
|
| 1116 |
-
* @param bool $failsafe
|
| 1117 |
-
* @return null|Mage_Sales_Model_Order_Payment_Transaction
|
| 1118 |
-
*/
|
| 1119 |
-
protected function _addTransaction($type, $salesDocument = null, $failsafe = false)
|
| 1120 |
-
{
|
| 1121 |
-
// look for set transaction ids
|
| 1122 |
-
$transactionId = $this->getTransactionId();
|
| 1123 |
-
if (null !== $transactionId) {
|
| 1124 |
-
// set transaction parameters
|
| 1125 |
-
$transaction = false;
|
| 1126 |
-
if ($this->getOrder()->getId()) {
|
| 1127 |
-
$transaction = $this->_lookupTransaction($transactionId);
|
| 1128 |
-
}
|
| 1129 |
-
if (!$transaction) {
|
| 1130 |
-
$transaction = Mage::getModel('sales/order_payment_transaction')->setTxnId($transactionId);
|
| 1131 |
-
}
|
| 1132 |
-
$transaction
|
| 1133 |
-
->setOrderPaymentObject($this)
|
| 1134 |
-
->setTxnType($type)
|
| 1135 |
-
->isFailsafe($failsafe);
|
| 1136 |
-
|
| 1137 |
-
if ($this->hasIsTransactionClosed()) {
|
| 1138 |
-
$transaction->setIsClosed((int)$this->getIsTransactionClosed());
|
| 1139 |
-
}
|
| 1140 |
-
|
| 1141 |
-
//set transaction addition information
|
| 1142 |
-
if ($this->_transactionAdditionalInfo) {
|
| 1143 |
-
foreach ($this->_transactionAdditionalInfo as $key => $value) {
|
| 1144 |
-
$transaction->setAdditionalInformation($key, $value);
|
| 1145 |
-
}
|
| 1146 |
-
}
|
| 1147 |
-
|
| 1148 |
-
// link with sales entities
|
| 1149 |
-
$this->setLastTransId($transactionId);
|
| 1150 |
-
$this->setCreatedTransaction($transaction);
|
| 1151 |
-
$this->getOrder()->addRelatedObject($transaction);
|
| 1152 |
-
if ($salesDocument && $salesDocument instanceof Mage_Sales_Model_Abstract) {
|
| 1153 |
-
$salesDocument->setTransactionId($transactionId);
|
| 1154 |
-
// TODO: linking transaction with the sales document
|
| 1155 |
-
}
|
| 1156 |
-
|
| 1157 |
-
// link with parent transaction
|
| 1158 |
-
$parentTransactionId = $this->getParentTransactionId();
|
| 1159 |
-
|
| 1160 |
-
if ($parentTransactionId) {
|
| 1161 |
-
$transaction->setParentTxnId($parentTransactionId);
|
| 1162 |
-
if ($this->getShouldCloseParentTransaction()) {
|
| 1163 |
-
$parentTransaction = $this->_lookupTransaction($parentTransactionId);
|
| 1164 |
-
if ($parentTransaction) {
|
| 1165 |
-
$parentTransaction->isFailsafe($failsafe)->close(false);
|
| 1166 |
-
$this->getOrder()->addRelatedObject($parentTransaction);
|
| 1167 |
-
}
|
| 1168 |
-
}
|
| 1169 |
-
}
|
| 1170 |
-
return $transaction;
|
| 1171 |
-
}
|
| 1172 |
-
}
|
| 1173 |
-
|
| 1174 |
-
/**
|
| 1175 |
-
* Public acces to _addTransaction method
|
| 1176 |
-
*
|
| 1177 |
-
* @param string $type
|
| 1178 |
-
* @param Mage_Sales_Model_Abstract $salesDocument
|
| 1179 |
-
* @param bool $failsafe
|
| 1180 |
-
* @return null|Mage_Sales_Model_Order_Payment_Transaction
|
| 1181 |
-
*/
|
| 1182 |
-
public function addTransaction($type, $salesDocument = null, $failsafe = false)
|
| 1183 |
-
{
|
| 1184 |
-
return $this->_addTransaction($type, $salesDocument, $failsafe);
|
| 1185 |
-
}
|
| 1186 |
-
|
| 1187 |
-
/**
|
| 1188 |
-
* Import details data of specified transaction
|
| 1189 |
-
*
|
| 1190 |
-
* @param Mage_Sales_Model_Order_Payment_Transaction $transactionTo
|
| 1191 |
-
* @return Mage_Sales_Model_Order_Payment
|
| 1192 |
-
*/
|
| 1193 |
-
public function importTransactionInfo(Mage_Sales_Model_Order_Payment_Transaction $transactionTo)
|
| 1194 |
-
{
|
| 1195 |
-
$data = $this->getMethodInstance()
|
| 1196 |
-
->setStore($this->getOrder()->getStoreId())
|
| 1197 |
-
->fetchTransactionInfo($this, $transactionTo->getTxnId());
|
| 1198 |
-
if ($data) {
|
| 1199 |
-
$transactionTo->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $data);
|
| 1200 |
-
}
|
| 1201 |
-
return $this;
|
| 1202 |
-
}
|
| 1203 |
-
|
| 1204 |
-
/**
|
| 1205 |
-
* Get the billing agreement, if any
|
| 1206 |
-
*
|
| 1207 |
-
* @return Mage_Sales_Model_Billing_Agreement|null
|
| 1208 |
-
*/
|
| 1209 |
-
public function getBillingAgreement()
|
| 1210 |
-
{
|
| 1211 |
-
return $this->_billingAgreement;
|
| 1212 |
-
}
|
| 1213 |
-
|
| 1214 |
-
/**
|
| 1215 |
-
* Totals updater utility method
|
| 1216 |
-
* Updates self totals by keys in data array('key' => $delta)
|
| 1217 |
-
*
|
| 1218 |
-
* @param array $data
|
| 1219 |
-
*/
|
| 1220 |
-
protected function _updateTotals($data)
|
| 1221 |
-
{
|
| 1222 |
-
foreach ($data as $key => $amount) {
|
| 1223 |
-
if (null !== $amount) {
|
| 1224 |
-
$was = $this->getDataUsingMethod($key);
|
| 1225 |
-
$this->setDataUsingMethod($key, $was + $amount);
|
| 1226 |
-
}
|
| 1227 |
-
}
|
| 1228 |
-
}
|
| 1229 |
-
|
| 1230 |
-
/**
|
| 1231 |
-
* Prevent double processing of the same transaction by a payment notification
|
| 1232 |
-
* Uses either specified txn_id or the transaction id that was set before
|
| 1233 |
-
*
|
| 1234 |
-
* @deprecated after 1.4.0.1
|
| 1235 |
-
* @param string $txnId
|
| 1236 |
-
* @throws Mage_Core_Exception
|
| 1237 |
-
*/
|
| 1238 |
-
protected function _avoidDoubleTransactionProcessing($txnId = null)
|
| 1239 |
-
{
|
| 1240 |
-
if ($this->_isTransactionExists($txnId)) {
|
| 1241 |
-
Mage::throwException(
|
| 1242 |
-
Mage::helper('sales')->__('Transaction "%s" was already processed.', $txnId)
|
| 1243 |
-
);
|
| 1244 |
-
}
|
| 1245 |
-
}
|
| 1246 |
-
|
| 1247 |
-
/**
|
| 1248 |
-
* Check transaction existence by specified transaction id
|
| 1249 |
-
*
|
| 1250 |
-
* @param string $txnId
|
| 1251 |
-
* @return boolean
|
| 1252 |
-
*/
|
| 1253 |
-
protected function _isTransactionExists($txnId = null)
|
| 1254 |
-
{
|
| 1255 |
-
if (null === $txnId) {
|
| 1256 |
-
$txnId = $this->getTransactionId();
|
| 1257 |
-
}
|
| 1258 |
-
return $txnId && $this->_lookupTransaction($txnId);
|
| 1259 |
-
}
|
| 1260 |
-
|
| 1261 |
-
/**
|
| 1262 |
-
* Append transaction ID (if any) message to the specified message
|
| 1263 |
-
*
|
| 1264 |
-
* @param Mage_Sales_Model_Order_Payment_Transaction|null $transaction
|
| 1265 |
-
* @param string $message
|
| 1266 |
-
* @return string
|
| 1267 |
-
*/
|
| 1268 |
-
protected function _appendTransactionToMessage($transaction, $message)
|
| 1269 |
-
{
|
| 1270 |
-
if ($transaction) {
|
| 1271 |
-
$txnId = is_object($transaction) ? $transaction->getTxnId() : $transaction;
|
| 1272 |
-
$message .= ' ' . Mage::helper('sales')->__('Transaction ID: "%s".', $txnId);
|
| 1273 |
-
}
|
| 1274 |
-
return $message;
|
| 1275 |
-
}
|
| 1276 |
-
|
| 1277 |
-
/**
|
| 1278 |
-
* Prepend a "prepared_message" that may be set to the payment instance before, to the specified message
|
| 1279 |
-
* Prepends value to the specified string or to the comment of specified order status history item instance
|
| 1280 |
-
*
|
| 1281 |
-
* @param string|Mage_Sales_Model_Order_Status_History $messagePrependTo
|
| 1282 |
-
* @return string|Mage_Sales_Model_Order_Status_History
|
| 1283 |
-
*/
|
| 1284 |
-
protected function _prependMessage($messagePrependTo)
|
| 1285 |
-
{
|
| 1286 |
-
$preparedMessage = $this->getPreparedMessage();
|
| 1287 |
-
if ($preparedMessage) {
|
| 1288 |
-
if (is_string($preparedMessage)) {
|
| 1289 |
-
return $preparedMessage . ' ' . $messagePrependTo;
|
| 1290 |
-
}
|
| 1291 |
-
elseif (is_object($preparedMessage) && ($preparedMessage instanceof Mage_Sales_Model_Order_Status_History)) {
|
| 1292 |
-
$comment = $preparedMessage->getComment() . ' ' . $messagePrependTo;
|
| 1293 |
-
$preparedMessage->setComment($comment);
|
| 1294 |
-
return $comment;
|
| 1295 |
-
}
|
| 1296 |
-
}
|
| 1297 |
-
return $messagePrependTo;
|
| 1298 |
-
}
|
| 1299 |
-
|
| 1300 |
-
/**
|
| 1301 |
-
* Round up and cast specified amount to float or string
|
| 1302 |
-
*
|
| 1303 |
-
* @param string|float $amount
|
| 1304 |
-
* @param bool $asFloat
|
| 1305 |
-
* @return string|float
|
| 1306 |
-
*/
|
| 1307 |
-
protected function _formatAmount($amount, $asFloat = false)
|
| 1308 |
-
{
|
| 1309 |
-
$amount = sprintf('%.2F', $amount); // "f" depends on locale, "F" doesn't
|
| 1310 |
-
return $asFloat ? (float)$amount : $amount;
|
| 1311 |
-
}
|
| 1312 |
-
|
| 1313 |
-
/**
|
| 1314 |
-
* Format price with currency sign
|
| 1315 |
-
* @param float $amount
|
| 1316 |
-
* @return string
|
| 1317 |
-
*/
|
| 1318 |
-
protected function _formatPrice($amount)
|
| 1319 |
-
{
|
| 1320 |
-
return $this->getOrder()->getBaseCurrency()->formatTxt($amount);
|
| 1321 |
-
}
|
| 1322 |
-
|
| 1323 |
-
/**
|
| 1324 |
-
* Find one transaction by ID or type
|
| 1325 |
-
* @param string $txnId
|
| 1326 |
-
* @param string $txnType
|
| 1327 |
-
* @return Mage_Sales_Model_Order_Payment_Transaction|false
|
| 1328 |
-
*/
|
| 1329 |
-
protected function _lookupTransaction($txnId, $txnType = false)
|
| 1330 |
-
{
|
| 1331 |
-
if (!$txnId) {
|
| 1332 |
-
if ($txnType && $this->getId()) {
|
| 1333 |
-
$collection = Mage::getModel('sales/order_payment_transaction')->getCollection()
|
| 1334 |
-
->setOrderFilter($this->getOrder())
|
| 1335 |
-
->addPaymentIdFilter($this->getId())
|
| 1336 |
-
->addTxnTypeFilter($txnType);
|
| 1337 |
-
foreach ($collection as $txn) {
|
| 1338 |
-
$txn->setOrderPaymentObject($this);
|
| 1339 |
-
$this->_transactionsLookup[$txn->getTxnId()] = $txn;
|
| 1340 |
-
return $txn;
|
| 1341 |
-
}
|
| 1342 |
-
}
|
| 1343 |
-
return false;
|
| 1344 |
-
}
|
| 1345 |
-
if (isset($this->_transactionsLookup[$txnId])) {
|
| 1346 |
-
return $this->_transactionsLookup[$txnId];
|
| 1347 |
-
}
|
| 1348 |
-
$txn = Mage::getModel('sales/order_payment_transaction')
|
| 1349 |
-
->setOrderPaymentObject($this)
|
| 1350 |
-
->loadByTxnId($txnId);
|
| 1351 |
-
if ($txn->getId()) {
|
| 1352 |
-
$this->_transactionsLookup[$txnId] = $txn;
|
| 1353 |
-
} else {
|
| 1354 |
-
$this->_transactionsLookup[$txnId] = false;
|
| 1355 |
-
}
|
| 1356 |
-
return $this->_transactionsLookup[$txnId];
|
| 1357 |
-
}
|
| 1358 |
-
|
| 1359 |
-
/**
|
| 1360 |
-
* Lookup an authorization transaction using parent transaction id, if set
|
| 1361 |
-
* @return Mage_Sales_Model_Order_Payment_Transaction|false
|
| 1362 |
-
*/
|
| 1363 |
-
public function getAuthorizationTransaction()
|
| 1364 |
-
{
|
| 1365 |
-
if ($this->getParentTransactionId()) {
|
| 1366 |
-
$txn = $this->_lookupTransaction($this->getParentTransactionId());
|
| 1367 |
-
} else {
|
| 1368 |
-
$txn = false;
|
| 1369 |
-
}
|
| 1370 |
-
|
| 1371 |
-
if (!$txn) {
|
| 1372 |
-
$txn = $this->_lookupTransaction(false, Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH);
|
| 1373 |
-
}
|
| 1374 |
-
return $txn;
|
| 1375 |
-
}
|
| 1376 |
-
|
| 1377 |
-
/**
|
| 1378 |
-
* Lookup the transaction by id
|
| 1379 |
-
* @param string $transactionId
|
| 1380 |
-
* @return Mage_Sales_Model_Order_Payment_Transaction|false
|
| 1381 |
-
*/
|
| 1382 |
-
public function getTransaction($transactionId)
|
| 1383 |
-
{
|
| 1384 |
-
return $this->_lookupTransaction($transactionId);
|
| 1385 |
-
}
|
| 1386 |
-
|
| 1387 |
-
/**
|
| 1388 |
-
* Update transaction ids for further processing
|
| 1389 |
-
* If no transactions were set before invoking, may generate an "offline" transaction id
|
| 1390 |
-
*
|
| 1391 |
-
* @param string $type
|
| 1392 |
-
* @param Mage_Sales_Model_Order_Payment_Transaction $transactionBasedOn
|
| 1393 |
-
*/
|
| 1394 |
-
protected function _generateTransactionId($type, $transactionBasedOn = false)
|
| 1395 |
-
{
|
| 1396 |
-
if (!$this->getParentTransactionId() && !$this->getTransactionId() && $transactionBasedOn) {
|
| 1397 |
-
$this->setParentTransactionId($transactionBasedOn->getTxnId());
|
| 1398 |
-
}
|
| 1399 |
-
// generate transaction id for an offline action or payment method that didn't set it
|
| 1400 |
-
if (($parentTxnId = $this->getParentTransactionId()) && !$this->getTransactionId()) {
|
| 1401 |
-
$this->setTransactionId("{$parentTxnId}-{$type}");
|
| 1402 |
-
}
|
| 1403 |
-
}
|
| 1404 |
-
|
| 1405 |
-
/**
|
| 1406 |
-
* Decide whether authorization transaction may close (if the amount to capture will cover entire order)
|
| 1407 |
-
* @param float $amountToCapture
|
| 1408 |
-
* @return bool
|
| 1409 |
-
*/
|
| 1410 |
-
protected function _isCaptureFinal($amountToCapture)
|
| 1411 |
-
{
|
| 1412 |
-
$orderGrandTotal = sprintf('%.4F', $this->getOrder()->getBaseGrandTotal());
|
| 1413 |
-
if ($orderGrandTotal == sprintf('%.4F', ($this->getBaseAmountPaidOnline() + $amountToCapture))) {
|
| 1414 |
-
if (false !== $this->getShouldCloseParentTransaction()) {
|
| 1415 |
-
$this->setShouldCloseParentTransaction(true);
|
| 1416 |
-
}
|
| 1417 |
-
return true;
|
| 1418 |
-
}
|
| 1419 |
-
return false;
|
| 1420 |
-
}
|
| 1421 |
-
|
| 1422 |
-
/**
|
| 1423 |
-
* Before object save manipulations
|
| 1424 |
-
*
|
| 1425 |
-
* @return Mage_Sales_Model_Order_Payment
|
| 1426 |
-
*/
|
| 1427 |
-
protected function _beforeSave()
|
| 1428 |
-
{
|
| 1429 |
-
parent::_beforeSave();
|
| 1430 |
-
|
| 1431 |
-
if (!$this->getParentId() && $this->getOrder()) {
|
| 1432 |
-
$this->setParentId($this->getOrder()->getId());
|
| 1433 |
-
}
|
| 1434 |
-
|
| 1435 |
-
return $this;
|
| 1436 |
-
}
|
| 1437 |
-
|
| 1438 |
-
/**
|
| 1439 |
-
* Generate billing agreement object if there is billing agreement data
|
| 1440 |
-
* Adds it to order as related object
|
| 1441 |
-
*/
|
| 1442 |
-
protected function _createBillingAgreement()
|
| 1443 |
-
{
|
| 1444 |
-
if ($this->getBillingAgreementData()) {
|
| 1445 |
-
$order = $this->getOrder();
|
| 1446 |
-
$agreement = Mage::getModel('sales/billing_agreement')->importOrderPayment($this);
|
| 1447 |
-
if ($agreement->isValid()) {
|
| 1448 |
-
$message = Mage::helper('sales')->__('Created billing agreement #%s.', $agreement->getReferenceId());
|
| 1449 |
-
$order->addRelatedObject($agreement);
|
| 1450 |
-
$this->_billingAgreement = $agreement;
|
| 1451 |
-
} else {
|
| 1452 |
-
$message = Mage::helper('sales')->__('Failed to create billing agreement for this order.');
|
| 1453 |
-
}
|
| 1454 |
-
$comment = $order->addStatusHistoryComment($message);
|
| 1455 |
-
$order->addRelatedObject($comment);
|
| 1456 |
-
}
|
| 1457 |
-
}
|
| 1458 |
-
|
| 1459 |
-
/**
|
| 1460 |
-
* Additionnal transaction info setter
|
| 1461 |
-
*
|
| 1462 |
-
* @param sting $key
|
| 1463 |
-
* @param string $value
|
| 1464 |
-
*/
|
| 1465 |
-
public function setTransactionAdditionalInfo($key, $value)
|
| 1466 |
-
{
|
| 1467 |
-
$this->_transactionAdditionalInfo[$key] = $value;
|
| 1468 |
-
}
|
| 1469 |
-
|
| 1470 |
-
/**
|
| 1471 |
-
* Return invoice model for transaction
|
| 1472 |
-
*
|
| 1473 |
-
* @param string $transactionId
|
| 1474 |
-
* @return Mage_Sales_Model_Order_Invoice
|
| 1475 |
-
*/
|
| 1476 |
-
protected function _getInvoiceForTransactionId($transactionId)
|
| 1477 |
-
{
|
| 1478 |
-
foreach ($this->getOrder()->getInvoiceCollection() as $invoice) {
|
| 1479 |
-
if ($invoice->getTransactionId() == $transactionId) {
|
| 1480 |
-
$invoice->load($invoice->getId()); // to make sure all data will properly load (maybe not required)
|
| 1481 |
-
return $invoice;
|
| 1482 |
-
}
|
| 1483 |
-
}
|
| 1484 |
-
return false;
|
| 1485 |
-
}
|
| 1486 |
}
|
| 399 |
return $this;
|
| 400 |
}
|
| 401 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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ardsave_Cardsaveonlinepayments</name>
|
| 4 |
-
<version>1.9.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -15,11 +15,12 @@ Compatible with the following versions:
|
|
| 15 |
1.4.1.0
|
| 16 |
1.4.1.1
|
| 17 |
Secure URL link fix for SSL certified stores.
|
| 18 |
-
Template fix base/default for version 1.4
|
|
|
|
| 19 |
<authors><author><name>cardsave.support</name><user>auto-converted</user><email>integrationsupport@cardsaveonlinepayments.com</email></author></authors>
|
| 20 |
-
<date>2011-01-
|
| 21 |
-
<time>
|
| 22 |
-
<contents><target name="magedesign"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="2b0b8a72c9f4a6d2ab9f0ea020c8f2ed"/><file name="info.phtml" hash="935e10cad0632d558b2db1913cb80a2a"/></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="2b0b8a72c9f4a6d2ab9f0ea020c8f2ed"/><file name="info.phtml" hash="935e10cad0632d558b2db1913cb80a2a"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="206c8703ef4d160dfc6c739c128ab47b"/><file name="info.phtml" hash="7256464904bbad66a821dea898d657a6"/></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="206c8703ef4d160dfc6c739c128ab47b"/><file name="info.phtml" hash="7256464904bbad66a821dea898d657a6"/></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Cardsave"><dir name="Cardsaveonlinepayments"><dir name="Block"><file name="Error.php" hash="660d3cbde48910ef271df9e05130a6d7"/><file name="Form.php" hash="ea5b3817c9607a94f4685d53d0b18569"/><file name="Info.php" hash="57a4bfec1a1c769de063be2b922f4a97"/><file name="Redirect.php" hash="b5a1f7af807dc9a41ec5b9db5c74e87e"/><file name="Threedsecure.php" hash="9d75776f34c5acaf6ea265f35f302c69"/></dir><dir name="controllers"><file name="PaymentController.php" hash="ea696459baa33fc027bea217e99ced08"/></dir><dir name="etc"><file name="config.xml" hash="14507a95509d6366272555a05ba110c9"/><file name="system.xml" hash="4d0eab1c1a11d3e2078802499ad49f1e"/></dir><dir name="Helper"><file name="Data.php" hash="e024ec0479d1e8e7efcf4751b05194d6"/></dir><dir name="Model"><dir name="Common"><dir name="ThePaymentGateway"><file name="PaymentSystem.php" hash="e4d4df170c21b7e3571b3ba1205ca979"/><file name="SOAP.php" hash="a0e5474dce51dc90ba4d37b5de3cdd84"/><file name="TPG_Common.php" hash="d86997c977cfd55b8ab577a514ab149c"/></dir><file name="GlobalErrors.php" hash="04d277d4a763efa508bf36d29c7dc8c4"/><file name="ISOCountries.php" hash="78dc558da68ca9a6ef44898a3980ecf2"/><file name="ISOCurrencies.php" hash="a32bc47b2d9896c293ecdcbf847144f9"/><file name="PaymentFormHelper.php" hash="41e22f61e8b71b8e8b6ca78b90da44e5"/></dir><dir name="Source"><file name="HashMethod.php" hash="997928579b69d21ae9eebec698c715c6"/><file name="OrderStatus.php" hash="4c44f8ba1652f20d934aa200ed4c8d00"/><file name="PaymentAction.php" hash="fa94be37c18bbb2f6301bdad1db3698d"/><file name="PaymentMode.php" hash="ea8af602bd09d54a123af64bc4b680d0"/><file name="ResultDeliveryMethod.php" hash="afb838319df715e604173d6aa143feab"/></dir><file name="Direct.php" hash="5b13a75e6f163241eda84f35326d5e18"/><file name="Request.php" hash="370f028086d13ae1df470e93a67dea66"/></dir></dir><dir name="Checkout"><dir name="Block"><dir name="Onepage"><dir name="Payment"><file name="Methods.php" hash="695d628564f6e1e0c85e3821699e6b45"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="9dbd58b6b32491d65e5c7d5850aa3420"/></dir><dir name="Model"><dir name="Type"><file name="Onepage.php" hash="63e21d5d5a681e30067c8a20390bb141"/></dir></dir></dir><dir name="Sales"><dir name="etc"><file name="config.xml" hash="7b59887dda2117c9843b582a4721ade2"/></dir><dir name="Model"><dir name="Order"><file name="Invoice.php" hash="9be99f3fbe1c4fe98fb110d3daa8afe6"/><file name="Payment.php" hash="
|
| 23 |
<compatible/>
|
| 24 |
<dependencies/>
|
| 25 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Cardsave_Cardsaveonlinepayments</name>
|
| 4 |
+
<version>1.9.1</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
| 15 |
1.4.1.0
|
| 16 |
1.4.1.1
|
| 17 |
Secure URL link fix for SSL certified stores.
|
| 18 |
+
Template fix base/default for version 1.4
|
| 19 |
+
Payment module error fixed</notes>
|
| 20 |
<authors><author><name>cardsave.support</name><user>auto-converted</user><email>integrationsupport@cardsaveonlinepayments.com</email></author></authors>
|
| 21 |
+
<date>2011-01-27</date>
|
| 22 |
+
<time>09:58:03</time>
|
| 23 |
+
<contents><target name="magedesign"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="2b0b8a72c9f4a6d2ab9f0ea020c8f2ed"/><file name="info.phtml" hash="935e10cad0632d558b2db1913cb80a2a"/></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="2b0b8a72c9f4a6d2ab9f0ea020c8f2ed"/><file name="info.phtml" hash="935e10cad0632d558b2db1913cb80a2a"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="206c8703ef4d160dfc6c739c128ab47b"/><file name="info.phtml" hash="7256464904bbad66a821dea898d657a6"/></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="206c8703ef4d160dfc6c739c128ab47b"/><file name="info.phtml" hash="7256464904bbad66a821dea898d657a6"/></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Cardsave"><dir name="Cardsaveonlinepayments"><dir name="Block"><file name="Error.php" hash="660d3cbde48910ef271df9e05130a6d7"/><file name="Form.php" hash="ea5b3817c9607a94f4685d53d0b18569"/><file name="Info.php" hash="57a4bfec1a1c769de063be2b922f4a97"/><file name="Redirect.php" hash="b5a1f7af807dc9a41ec5b9db5c74e87e"/><file name="Threedsecure.php" hash="9d75776f34c5acaf6ea265f35f302c69"/></dir><dir name="controllers"><file name="PaymentController.php" hash="ea696459baa33fc027bea217e99ced08"/></dir><dir name="etc"><file name="config.xml" hash="14507a95509d6366272555a05ba110c9"/><file name="system.xml" hash="4d0eab1c1a11d3e2078802499ad49f1e"/></dir><dir name="Helper"><file name="Data.php" hash="e024ec0479d1e8e7efcf4751b05194d6"/></dir><dir name="Model"><dir name="Common"><dir name="ThePaymentGateway"><file name="PaymentSystem.php" hash="e4d4df170c21b7e3571b3ba1205ca979"/><file name="SOAP.php" hash="a0e5474dce51dc90ba4d37b5de3cdd84"/><file name="TPG_Common.php" hash="d86997c977cfd55b8ab577a514ab149c"/></dir><file name="GlobalErrors.php" hash="04d277d4a763efa508bf36d29c7dc8c4"/><file name="ISOCountries.php" hash="78dc558da68ca9a6ef44898a3980ecf2"/><file name="ISOCurrencies.php" hash="a32bc47b2d9896c293ecdcbf847144f9"/><file name="PaymentFormHelper.php" hash="41e22f61e8b71b8e8b6ca78b90da44e5"/></dir><dir name="Source"><file name="HashMethod.php" hash="997928579b69d21ae9eebec698c715c6"/><file name="OrderStatus.php" hash="4c44f8ba1652f20d934aa200ed4c8d00"/><file name="PaymentAction.php" hash="fa94be37c18bbb2f6301bdad1db3698d"/><file name="PaymentMode.php" hash="ea8af602bd09d54a123af64bc4b680d0"/><file name="ResultDeliveryMethod.php" hash="afb838319df715e604173d6aa143feab"/></dir><file name="Direct.php" hash="5b13a75e6f163241eda84f35326d5e18"/><file name="Request.php" hash="370f028086d13ae1df470e93a67dea66"/></dir></dir><dir name="Checkout"><dir name="Block"><dir name="Onepage"><dir name="Payment"><file name="Methods.php" hash="695d628564f6e1e0c85e3821699e6b45"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="9dbd58b6b32491d65e5c7d5850aa3420"/></dir><dir name="Model"><dir name="Type"><file name="Onepage.php" hash="63e21d5d5a681e30067c8a20390bb141"/></dir></dir></dir><dir name="Sales"><dir name="etc"><file name="config.xml" hash="7b59887dda2117c9843b582a4721ade2"/></dir><dir name="Model"><dir name="Order"><file name="Invoice.php" hash="9be99f3fbe1c4fe98fb110d3daa8afe6"/><file name="Payment.php" hash="47ec8447f8560d7bbea56cba7e013575"/></dir><dir name="Service"><file name="Quote.php" hash="61670788275b93098bc8da9f27344e4b"/></dir><file name="Order.php" hash="9ffa9e06b0d5d8d2d810ab50017e81fa"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><file name="cardsave_online.jpg" hash="abb239c81edb9ae8df8cf891e914e2aa"/></dir></dir></dir><dir name="default"><dir name="default"><dir name="images"><file name="cardsave_online.jpg" hash="abb239c81edb9ae8df8cf891e914e2aa"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cardsave_All.xml" hash="e1d59fd8c4d4b5d87607f43fecf47e59"/></dir></target></contents>
|
| 24 |
<compatible/>
|
| 25 |
<dependencies/>
|
| 26 |
</package>
|
