Add $order->getPaidFullTime() method

Created on 27 November 2024, 6 months ago

Problem/Motivation

Commerce orders provide several helpful date-retrieving methods like

$order->getCreatedTime()
$order->getChangedTime()
$order->getPlacedTime()
$oder->getCompletedTime();

The only logical missing piece here is the time when the order was paid in full: $order->getPaidFullTime()

For reports and synchronizations with ERP and maybe other cases, it would be super helpful to have that method.

Orders already also have
$order->isPaid()
method, but no way to retrieve the timestamp when it was paid in full. You need to check the different payments.

Expected behaviour:
$order->getPaidFullTime() returns the timestamp when the order was (last) paid in full. Whenever $order->isPaid() returns false, it should behave like the other methods mentioned above, maybe return NULL.

Steps to reproduce

Try getting the timestamp when the order was paid in full. You can easily check that it has been fully paid by $order->isPaid() but can't easily get the timestamp like for the other cases.

Proposed resolution

Discuss
Implement
Write tests
Release

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Feature request
Status

Active

Version

3.0

Component

Payment

Created by

🇩🇪Germany Anybody Porta Westfalica

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

Merge Requests

Comments & Activities

  • Issue created by @Anybody
  • 🇩🇪Germany Anybody Porta Westfalica
  • First commit to issue fork.
  • 🇩🇪Germany Grevil

    Something along these lines should suffice. I am unsure, whether "commerce_order.order.paid" is the correct event to use. But I couldn't find a better.

  • Pipeline finished with Canceled
    18 days ago
    Total: 209s
    #499038
  • 🇩🇪Germany Anybody Porta Westfalica

    Thanks @grevil. I'm not sure if we should track the point in time, when the order was paid in full as an additional base field or instead should calculate it based on the tracked payments (IF $order->isPaid() is true).

    Let's wait for maintainers feedback on how they'd say it's best.

    Which way ever we go, we need to ensure that the information is always consistent, for example if a payment was refunded afterwards.

  • Pipeline finished with Failed
    18 days ago
    Total: 607s
    #499039
Production build 0.71.5 2024