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};
|
my $discount = $self->config->{discount};
|
||||||
if ( !defined $price
|
if ( !defined $price
|
||||||
|| !defined $discount
|
|| !defined $discount
|
||||||
|| $discount > 99
|
|
||||||
|| $discount < 0 )
|
|| $discount < 0 )
|
||||||
{
|
{
|
||||||
die
|
die
|
||||||
@ -110,6 +109,15 @@ sub get_url ($self) {
|
|||||||
id => $product_id,
|
id => $product_id,
|
||||||
}
|
}
|
||||||
)->result;
|
)->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(
|
$result = $ua->post(
|
||||||
'https://api.stripe.com/v1/prices' => {
|
'https://api.stripe.com/v1/prices' => {
|
||||||
Authorization => $authorization
|
Authorization => $authorization
|
||||||
@ -126,7 +134,6 @@ sub get_url ($self) {
|
|||||||
if ( !defined $price_id ) {
|
if ( !defined $price_id ) {
|
||||||
die 'Unable to get price';
|
die 'Unable to get price';
|
||||||
}
|
}
|
||||||
my $base_url = $self->config->{'base-url'} or die 'Base URL not configured';
|
|
||||||
$result = $ua->post(
|
$result = $ua->post(
|
||||||
'https://api.stripe.com/v1/payment_links' => {
|
'https://api.stripe.com/v1/payment_links' => {
|
||||||
Authorization => $authorization
|
Authorization => $authorization
|
||||||
|
Loading…
Reference in New Issue
Block a user