From 39aa2d2083777817ee87e5924bae16af92934d74 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Sun, 14 Jul 2019 16:05:35 +0100 Subject: [PATCH] Fix meta transaction undef error --- lib/Pear/LocalLoop/Controller/Api/Transactions.pm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/Pear/LocalLoop/Controller/Api/Transactions.pm b/lib/Pear/LocalLoop/Controller/Api/Transactions.pm index 93d69f4..221eaf6 100644 --- a/lib/Pear/LocalLoop/Controller/Api/Transactions.pm +++ b/lib/Pear/LocalLoop/Controller/Api/Transactions.pm @@ -55,9 +55,16 @@ sub post_transaction_list_purchases { seller => $_->seller->name, value => $_->value / 100000, purchase_time => $c->format_iso_datetime($_->purchase_time), - net_value => $_->meta->net_value / 100000, - sales_tax_value => $_->meta->sales_tax_value / 100000, - gross_value => $_->meta->gross_value / 100000, + ( $_->meta ? ( + net_value => $_->meta->net_value / 100000, + sales_tax_value => $_->meta->sales_tax_value / 100000, + gross_value => $_->meta->gross_value / 100000, + ) : ( + net_value => undef, + sales_tax_value => undef, + gross_value => undef, + )), + }} $transactions->all );