Adding the option to get the program for free in when
configured to do so.
This commit is contained in:
parent
ef43cfc335
commit
c500bef7f4
@ -44,7 +44,6 @@ sub _get_real_price($self) {
|
||||
my $discount = $self->config->{discount};
|
||||
if ( !defined $price
|
||||
|| !defined $discount
|
||||
|| $discount > 99
|
||||
|| $discount < 0 )
|
||||
{
|
||||
die
|
||||
@ -110,6 +109,15 @@ sub get_url ($self) {
|
||||
id => $product_id,
|
||||
}
|
||||
)->result;
|
||||
my $base_url = $self->config->{'base-url'} or die 'Base URL not configured';
|
||||
if (int($self->_get_real_price) == 0) {
|
||||
$self->render(
|
||||
json => {
|
||||
url => $base_url.'/set_paid/'.$uuid,
|
||||
}
|
||||
);
|
||||
return;
|
||||
}
|
||||
$result = $ua->post(
|
||||
'https://api.stripe.com/v1/prices' => {
|
||||
Authorization => $authorization
|
||||
@ -126,7 +134,6 @@ sub get_url ($self) {
|
||||
if ( !defined $price_id ) {
|
||||
die 'Unable to get price';
|
||||
}
|
||||
my $base_url = $self->config->{'base-url'} or die 'Base URL not configured';
|
||||
$result = $ua->post(
|
||||
'https://api.stripe.com/v1/payment_links' => {
|
||||
Authorization => $authorization
|
||||
|
Loading…
Reference in New Issue
Block a user