Skip to content

Commit

Permalink
Fix date type in create payment intent response schema (#7534)
Browse files Browse the repository at this point in the history
Co-authored-by: Dan Paun <[email protected]>
  • Loading branch information
dpaun1985 and Dan Paun authored Oct 26, 2023
1 parent ea53700 commit bb99f81
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions changelog/fix-date-type
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Format the display of created date for payment intent instead of timestamp.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function get_item_schema() {
'context' => [ 'view' ],
],
'created' => [
'description' => __( 'Timestamp for when the payment intent was created.', 'woocommerce-payments' ),
'description' => __( 'The date when the payment intent was created.', 'woocommerce-payments' ),
'type' => 'string',
'context' => [ 'view' ],
],
Expand Down Expand Up @@ -325,7 +325,7 @@ public function prepare_item_for_response( $item, $request ) {
$prepared_item['id'] = $item->get_id();
$prepared_item['amount'] = $item->get_amount();
$prepared_item['currency'] = $item->get_currency();
$prepared_item['created'] = $item->get_created()->getTimestamp();
$prepared_item['created'] = $item->get_created()->format( 'Y-m-d H:i:s' );
$prepared_item['customer'] = $item->get_customer_id();
$prepared_item['payment_method'] = $item->get_payment_method_id();
$prepared_item['status'] = $item->get_status();
Expand Down

0 comments on commit bb99f81

Please sign in to comment.