From d5e03cc9e3ac1ac4a25662941f0409aeee8c0f97 Mon Sep 17 00:00:00 2001 From: Finn Date: Wed, 14 Mar 2018 17:55:24 +0000 Subject: [PATCH] amended api for recurring transaction list --- lib/Pear/LocalLoop/Controller/Api/Transactions.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/Pear/LocalLoop/Controller/Api/Transactions.pm b/lib/Pear/LocalLoop/Controller/Api/Transactions.pm index 9273c2d..8f4f2d0 100644 --- a/lib/Pear/LocalLoop/Controller/Api/Transactions.pm +++ b/lib/Pear/LocalLoop/Controller/Api/Transactions.pm @@ -45,12 +45,13 @@ sub post_transaction_list_purchases { my @recurring_transaction_list = ( map {{ + id => $_->id, seller => $_->seller->name, value => $_->value / 100000, start_time => $c->format_iso_datetime($_->start_time), last_updated => $c->format_iso_datetime($_->last_updated), essential => $_->essential, - category => $_->category->category->name, + category => ( defined $_->category ? $_->category->name : 'Uncategorised' ), recurring_period => $_->recurring_period, }} $recurring_transactions->all ); @@ -63,4 +64,16 @@ sub post_transaction_list_purchases { }); } +sub update_recurring { + my $c = shift; + + my $user = $c->stash->{api_user}; + + my $validation = $c->validation; + + $validation->input( $c->stash->{api_json} ); + #TODO check that user matches seller on database before updating for that id + +} + 1;