Payee

NAME

App::Moneymoor::Gateway::Payee - SQL gateway for payees.

SYNOPSIS


use App::Moneymoor::Gateway::Payee;

my $gw = App::Moneymoor::Gateway::Payee.new(:$db);

my $tesco = $gw.find-or-create('Tesco');    # insert or fetch
my $again = $gw.find-or-create('  Tesco  ');
say $again.id == $tesco.id;                 # True — names are trimmed

my @all = $gw.find-all;                     # ordered by name
$gw.rename($tesco.id, 'Tesco Express');
$gw.delete($tesco.id);                      # transactions keep their
                                            # amounts, lose the name

DESCRIPTION

Payees are names. They carry no budgeting semantics and the engine never reads them; they exist so a transaction list can be grouped and searched by counterparty.

find-or-create is the method to reach for when attaching a payee to a transaction: names are unique, and doing "look it up, insert if missing" in the caller invites two code paths that disagree about trimming. Names are trimmed before comparison and storage, so 'Tesco' and ' Tesco ' are the same payee.

Deleting a payee nulls the reference on its transactions (ON DELETE SET NULL). Losing a name is an annoyance; losing a transaction would be a corrupted budget.

ATTRIBUTES

  • db — required App::Moneymoor::DB.

METHODS

  • find-all(-- Array)> — ordered by name.

  • find-by-id(Int:D -- Model::Payee)> — type object when absent.

  • find-by-name(Str:D -- Model::Payee)>

  • create(Str:D $name -- Model::Payee)> — Failure on a duplicate or empty name.

  • find-or-create(Str:D $name -- Model::Payee)>

  • rename(Int:D $id, Str:D $name)

  • delete(Int:D $id)

  • usage-count(Int:D $id -- Int)> — how many transactions point at it.

App::Moneymoor v0.4.2

YNAB-style envelope budgeting: a derivation engine

Authors

  • Matt Doughty

License

Artistic-2.0

Dependencies

DBIish:ver<0.6.7>:auth<zef:raku-community-modules>Notcurses::Native:ver<0.6.5+>:auth<zef:apogee>Selkie:ver<0.16.0+>:auth<zef:apogee>JSON::Fast:ver<0.19>:auth<cpan:TIMOTIMO>MacOS::NativeLib:ver<0.0.6>:auth<zef:lizmat>

Test Dependencies

Provides

  • App::Moneymoor
  • App::Moneymoor::Config
  • App::Moneymoor::DB
  • App::Moneymoor::Gateway::Account
  • App::Moneymoor::Gateway::Assignment
  • App::Moneymoor::Gateway::Category
  • App::Moneymoor::Gateway::Payee
  • App::Moneymoor::Gateway::Transaction
  • App::Moneymoor::Handlers::Boot
  • App::Moneymoor::Model::Account
  • App::Moneymoor::Model::Assignment
  • App::Moneymoor::Model::Category
  • App::Moneymoor::Model::CategoryGroup
  • App::Moneymoor::Model::Payee
  • App::Moneymoor::Model::Split
  • App::Moneymoor::Model::Transaction
  • App::Moneymoor::Screen::Accounts
  • App::Moneymoor::Screen::Budget
  • App::Moneymoor::Screen::Login
  • App::Moneymoor::Screen::Main
  • App::Moneymoor::Screen::Main::Keybinds
  • App::Moneymoor::Screen::Main::Modals
  • App::Moneymoor::Screen::Main::Subscriptions
  • App::Moneymoor::Screen::Reports
  • App::Moneymoor::Service::Budget
  • App::Moneymoor::Service::Icons
  • App::Moneymoor::Service::Target
  • App::Moneymoor::Service::Workspace
  • App::Moneymoor::StoreHandlers
  • App::Moneymoor::Theme
  • App::Moneymoor::Theme::Catppuccin
  • App::Moneymoor::Theme::Dracula
  • App::Moneymoor::Theme::Everforest
  • App::Moneymoor::Theme::Gruvbox
  • App::Moneymoor::Theme::Kanagawa
  • App::Moneymoor::Theme::Monokai
  • App::Moneymoor::Theme::Nord
  • App::Moneymoor::Theme::OneDark
  • App::Moneymoor::Theme::RosePine
  • App::Moneymoor::Theme::Solarized
  • App::Moneymoor::Theme::TokyoNight
  • App::Moneymoor::Themes
  • App::Moneymoor::UI
  • App::Moneymoor::Util::Money
  • App::Moneymoor::Util::Period
  • App::Moneymoor::View::BudgetRow
  • App::Moneymoor::View::EmptyState
  • App::Moneymoor::View::HintBar
  • App::Moneymoor::View::InspectorPane
  • App::Moneymoor::View::ModalChrome
  • App::Moneymoor::View::RegisterRow
  • App::Moneymoor::View::ReportRow
  • App::Moneymoor::Widget::BannerBar
  • App::Moneymoor::Widget::BootProgressModal

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.