Jump to content

Negative payments no longer allowed with new Order page


pierre.custeau

Recommended Posts

Hi everyone,

 

A few of my customers would enter negative payments in case of partial refunds so that their reporting would line up with credit card merchant service reporting. This is no longer possible in the new Symfony based Order page and controller. 

I notice there is a negative check in /src/core/domain/order/payment/command/AddPaymentCommand.php: (assertAmountIsPositive)

 

    public function __construct(
        int $orderId,
        string $paymentDate,
        string $paymentMethod,
        string $paymentAmount,
        int $paymentCurrencyId,
        ?int $orderInvoiceId = null,
        ?string $transactionId = null
    ) {
        $amount = new DecimalNumber($paymentAmount);
        $this->assertAmountIsPositive($amount);
        $this->assertPaymentMethodIsGenericName($paymentMethod);

        $this->orderId = new OrderId($orderId);
        $this->paymentDate = new DateTimeImmutable($paymentDate);
        $this->paymentMethod = $paymentMethod;
        $this->paymentAmount = $amount;
        $this->paymentCurrencyId = new CurrencyId($paymentCurrencyId);
        $this->orderInvoiceId = $orderInvoiceId;
        $this->transactionId = $transactionId;

However commenting out this line does not prevent the negative rule and the payment is still failing. Any idea what/where else this verification can be done and how else I could re-enable negative payments?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...