Skip to content

Commit

Permalink
Tweak: set due date to match order paid date for paid orders
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmigf committed Dec 31, 2024
1 parent 495fec3 commit 5522e6e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ubl/Handlers/Common/DueDateHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
class DueDateHandler extends UblHandler {

public function handle( $data, $options = array() ) {
$due_date_timestamp = is_callable( array( $this->document->order_document, 'get_due_date' ) ) ? $this->document->order_document->get_due_date() : 0;

if ( $this->document->order_document->is_paid() ) {
$due_date_timestamp = $this->document->order_document->get_date_paid()->getTimestamp();
} else {
$due_date_timestamp = is_callable( array( $this->document->order_document, 'get_due_date' ) ) ? $this->document->order_document->get_due_date() : 0;
}

if ( ! empty( $due_date_timestamp ) ) {
$dueDate = array(
'name' => 'cbc:DueDate',
Expand Down

0 comments on commit 5522e6e

Please sign in to comment.