Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7674513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:45:15+00:00 2026-05-31T16:45:15+00:00

I have made my custom module in magento, in which I have set discount

  • 0

I have made my custom module in magento, in which I have set discount in dynamically.
I am using following code for this.
But when I have completed the payment procedure, the order status should be ‘processing‘ but instead of this order status become “Suspected Fraud“.

Please let me know what I have done wrong. Although discount added successfully in order information.

$order->setData('base_discount_amount', $discountAmt);

$order->setData('base_discount_canceled', $discountAmt);

$order->setData('base_discount_invoiced', $discountAmt);

$order->setData('base_discount_refunded', $discountAmt);

$order->setData('discount_description', 'Affliate Discount');

$order->setData('discount_amount', $discountAmt);

$order->setData('discount_canceled', $discountAmt);

$order->setData('discount_invoiced', $discountAmt);

$order->setData('discount_refunded', $discountAmt);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T16:45:16+00:00Added an answer on May 31, 2026 at 4:45 pm

    It’s not easy to tell from your question. This can depend on which Magento payment gateway / method you are using (Paypal, Authorize.net, Saved Card etc) as each can implement different methods for transaction authorization, capturing etc.

    Take a look at the default Mage_Sales_Model_Order_Payment class. This has several calls to a method called $this->getIsFraudDetected() when attempting to capture funds for a transaction and set the order status to Suspected Fraud if true like so:

    if ($this->getIsFraudDetected()) {
        $status = Mage_Sales_Model_Order::STATUS_FRAUD;
    }
    

    In the default Payment class the fraud flag is set in the registerCaptureNotification() method when the _isCaptureFinal() method returns false:

    if ($this->_isCaptureFinal($amount)) {
        $invoice = $order->prepareInvoice()->register();
        $order->addRelatedObject($invoice);
        $this->setCreatedInvoice($invoice);
    } else {
        $this->setIsFraudDetected(true);
        $this->_updateTotals(array('base_amount_paid_online' => $amount));
    }
    

    The _isCaptureFinal() methods returns false when the amount you are trying to capture does not equal exactly the remaining order balance.

    /**
     * Decide whether authorization transaction may close (if the amount to capture will cover entire order)
     * @param float $amountToCapture
     * @return bool
     */
    protected function _isCaptureFinal($amountToCapture)
    {
        $amountToCapture = $this->_formatAmount($amountToCapture, true);
        $orderGrandTotal = $this->_formatAmount($this->getOrder()->getBaseGrandTotal(), true);
        if ($orderGrandTotal == $this->_formatAmount($this->getBaseAmountPaid(), true) + $amountToCapture) {
            if (false !== $this->getShouldCloseParentTransaction()) {
                $this->setShouldCloseParentTransaction(true);
            }
            return true;
        }
        return false;
    }
    

    Check your totals (requested capture vs. outstanding balance) if using the default payment method or look at your payment methods implementation and use the above information to debug your code…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom module I made for Magento. From the admin, there is
I am using JSF and have made a custom servlet for loading images dynamically.
I have a custom module I made to show featured products on the homepage.
I have made a custom suface button according this example: <Button> <Button.Template> <ControlTemplate TargetType=Button>
I have images placed in following path res>drawable>Images>Currencies>[All images] I have made a custom
Using Drupal on a project which I made custom node types in using the
We have a dummy Python module ( fields.py ) with custom Django fields which
I have made a custom module and it works fine till I start working
I have dotnetnuke application and I made a custom login module. And everything works
Lets Suppose that I have made a custom authentication module that inherits IHttpModule class.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.