Line item with negative amount not processed properly

Created on 6 April 2020, over 4 years ago
Updated 30 April 2024, 7 months ago

While processing the order we came up with an issue related to negative line item. Not sure if the issue is because of this module or the payment gateway. This is the error user is getting whenever a promotion with negative unit price is send to the payment getway.

The 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:unitPrice' element is invalid - The value '-895.000000' is invalid according to its datatype 'Decimal' - The MinInclusive constraint failed.

Note : Tested this with both sandbox and live account.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇮🇳India ashutoshsngh

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States rhovland Oregon

    I don't think negative amounts are allowed. Besides the implication of a negative number in a payment system, the API simply does not allow it
    Go here:
    https://developer.authorize.net/api/reference/index.html#payment-transac...
    Click on "Request Field Description" below the API example and scroll to unitPrice

    You can also try editing the request JSON in the example to a negative number and hit send. You'll get an error response.

    So since authorize.net does not support negative numbers how is the module supposed to handle negative item prices?

    Should it set the price to 0? Which is the worst outcome? A transaction failure or line items not adding up? Are you trying to make payments for negative balance orders or is this negative line item a "discount"? Why not use adjustments for that?

  • 🇮🇳India mudassir5544

    Hi,

    I have the same issue.
    I am using the Line Item (Order Item) for discounts.

    REASON : In my client website It was needed to add discounts on only those order types whose field_category value matched with the Discount Product field_category value. Therefore we are using a separate product type for the discount purpose, where we are creating multiple discount products.
    And this requirement could not be achieved by the "Adjustments".

    QUESTION : Is there any way that we can tell the commerce_authnet to ignore the line item negative price. Since the Order total is positive it can be consider a valid price I think.

    Please help ASAP.

    Thankyou for the help!

  • Status changed to Active 7 months ago
Production build 0.71.5 2024