Add starting price.

This commit is contained in:
Sergiotarxz 2024-11-12 23:48:58 +01:00
parent ebb2fd6cff
commit ef43cfc335

View File

@ -17,12 +17,13 @@ use MakeThemPay::DB;
sub price($self) { sub price($self) {
my $uuid = $self->param('uuid'); my $uuid = $self->param('uuid');
my ( $price, $discount ); my ( $price, $discount, $starting_price );
eval { $self->_insert_license( $uuid, 0 ); }; eval { $self->_insert_license( $uuid, 0 ); };
if ($@) { if ($@) {
warn $@; warn $@;
} }
eval { ( $price, $discount ) = $self->_get_real_price; }; eval { ( $price, $discount, $starting_price ) = $self->_get_real_price; };
say $starting_price;
if ($@) { if ($@) {
warn $@; warn $@;
$self->res->code(500); $self->res->code(500);
@ -33,6 +34,7 @@ sub price($self) {
json => { json => {
price => $price, price => $price,
discount => $discount, discount => $discount,
starting_price => $starting_price,
} }
); );
} }
@ -52,7 +54,7 @@ sub _get_real_price($self) {
if ( !wantarray ) { if ( !wantarray ) {
return $discounted_price; return $discounted_price;
} }
return ( $discounted_price, $discount ); return ( $discounted_price, $discount, $price );
} }
sub get_paid($self) { sub get_paid($self) {