Add purge method to Shop::Credit, tests.
This commit is contained in:
parent
229a4080a8
commit
7f0657927d
3 changed files with 162 additions and 1 deletions
|
|
@ -35,7 +35,8 @@ readonly userId => my %userId;
|
|||
|
||||
=head2 adjust ( amount, [ comment ] )
|
||||
|
||||
Adjusts the amount of credit this user has by a specified amount.
|
||||
Adjusts the amount of credit this user has by a specified amount. Returns 0 if the current user is Visitor.
|
||||
Otherwise, returns the amount set.
|
||||
|
||||
=head3 amount
|
||||
|
||||
|
|
@ -154,6 +155,20 @@ sub new {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 purge ( )
|
||||
|
||||
Removes all shop credit for the current user.
|
||||
|
||||
=cut
|
||||
|
||||
sub purge {
|
||||
my ($self) = @_;
|
||||
$self->session->db->write("delete from shopCredit where userId = ?",[$self->userId]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 session ()
|
||||
|
||||
Returns a reference to the current session.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue