Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Suggested answer

facing an issue while completing the payment for a return order

(2) ShareShare
ReportReport
Posted on by 28

I'm facing an issue while completing the payment for a return order. The system is throwing the following exception:

"Not more than 0.00 can be reversed."

"The refund invoice total 522.58 is greater than the total refundable amount 493.00."

 

Could you please help me understand and resolve this?
public void createCallCenterReturnPayment(SalesId _returnsalesId,SalesId _origSalesTable)
{
MCRCustPaymTable mcrCustPaymTable,origMcrCustPaymTable;
SalesTable returnSalesTableBuf = SalesTable::find(_returnsalesId);
SalesTable origSalesTableBuf = SalesTable::find(_origSalesTable);
RetailChannelTable retailChannelTable;

select firstonly retailChannelTable
where retailChannelTable.RecId == returnSalesTableBuf.RetailChannelTable;

if(retailChannelTable.ChannelType == RetailChannelType::MCRCallCenter)
{
MCRCustPaymStatus mcrCustPaymStatus = MCRCustPaymStatus::NotSubmitted;

SalesTotals salesTotals = salesTotals::construct(returnSalesTableBuf,SalesUpdate::All);
Total totalAmount = salesTotals.totalAmount();
//Total totalAmount1 = salesTotals.totalAmount() - salesTotals.totalMarkup() - salesTotals.totalTaxAmount();

select firstonly origMcrCustPaymTable
where origMcrCustPaymTable.RefTableId == origSalesTableBuf.TableId
&& origMcrCustPaymTable.RefRecId == origSalesTableBuf.RecId;

try
{
ttsbegin;
mcrCustPaymTable.clear();
mcrCustPaymTable.Channel = returnSalesTableBuf.retailSalesTable().RetailChannel;
mcrCustPaymTable.CurrencyCode = returnSalesTableBuf.CurrencyCode;
mcrCustPaymTable.TenderTypeId = "2";
mcrCustPaymTable.RefTableId = returnSalesTableBuf.TableId;
mcrCustPaymTable.RefRecId = returnSalesTableBuf.RecId;
mcrCustPaymTable.CustAccount = returnSalesTableBuf.CustAccount;
mcrCustPaymTable.OrigRefundRecID = origMcrCustPaymTable.RecId;
mcrCustPaymTable.Status = mcrCustPaymStatus;
mcrCustPaymTable.CustPaymType = MCRCustPaymType::RefundCheck;

switch (mcrCustPaymStatus)
{
case MCRCustPaymStatus::NotSubmitted:
case MCRCustPaymStatus::Authorized:

mcrCustPaymTable.Amount = CurrencyExchange::round(totalAmount, returnSalesTableBuf.CurrencyCode);
break;
}

mcrCustPaymTable.insert();
ttscommit;

MCRSalesOrderTotals mcrSalesOrderTotals = new MCRSalesOrderTotals(returnSalesTableBuf, true);
//complete
MCREndOrder::endOrder(returnSalesTableBuf.SalesId, true, mcrSalesOrderTotals, false);

}
catch
{
Error("@BASIS_SOCancellation:NewLabel1");
}
}
}

Categories:
  • Suggested answer
    Ramesh Kumar Profile Picture
    3,501 on at
    facing an issue while completing the payment for a return order
    I agree with what Jones mentioned — it's difficult to understand the issue without access to the environment. You’ll need to collaborate with a developer to investigate further.
     
    Thanks
    Ramesh
     
    If this was helpful, please check the "Does this answer your question?" box and mark it as verified.
  • Jonas "Jones" Melgaard Profile Picture
    3,512 Super User 2025 Season 1 on at
    facing an issue while completing the payment for a return order
     
    My advice is to debug this, it's difficult to troubleshoot without having access to your application.
    If you are unsure where to place your breakpoint, start by placing it in info.add.
     
    Have you tried to debug it?
  • Suggested answer
    Holly Huffman Profile Picture
    5,917 on at
    facing an issue while completing the payment for a return order
    Good morning, afternoon, or evening depending on your location!
     
    Based on the error message, the issue seems to be related to the refund amount exceeding the refundable limit. Here are some steps to troubleshoot --
    Possible Causes & Solutions:
    1. Mismatch Between Refundable Amount and Invoice Total:
      • The system is preventing a refund greater than the allowable amount. Verify the original transaction details to ensure the refund amount aligns with the expected refundable value.
    2. Check Refund Calculation Logic:
      • In your code, totalAmount is being used to determine the refund. Ensure that the calculation correctly considers discounts, taxes, and adjustments.
      • You might need to subtract markup and tax amounts explicitly to avoid exceeding the refundable limit.
    3. Validate Payment Table Entries:
      • Ensure that OrigRefundRecID correctly references the original payment record. If the system is unable to match the refund to the correct transaction, it may trigger this error.
    4. Review Currency Rounding:
      • The rounding logic in CurrencyExchange::round(totalAmount, returnSalesTableBuf.CurrencyCode) might be causing a slight discrepancy. Try manually verifying the rounded values before inserting the payment record.
    5. Check System Configuration for Refund Limits:
      • Some configurations in Dynamics 365 Finance and Operations enforce refund limits. Check if there are any restrictions set in the Accounts Payable or Retail Payment Setup modules.
    Next Steps:
    • Try adjusting the refund calculation to ensure it does not exceed the refundable amount.
    • If the issue persists, check the transaction history for discrepancies in the original purchase and refund records.
    • If needed, manually adjust the refund amount to match the allowable limit before processing the payment.
     
    Hope this is helpful :)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,261 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,017 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans