Committing the new Ecommerce system
This commit is contained in:
parent
1847a18ec7
commit
5676bf9585
16 changed files with 2576 additions and 0 deletions
18
lib/WebGUI/Commerce.pm
Normal file
18
lib/WebGUI/Commerce.pm
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package WebGUI::Commerce;
|
||||
|
||||
use strict;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub setCommerceSetting {
|
||||
my ($entry);
|
||||
$entry = shift;
|
||||
WebGUI::SQL->write("delete from commerceSettings where ".
|
||||
"namespace=".quote($entry->{namespace})." and ".
|
||||
"type=".quote($entry->{type})." and fieldName=".quote($entry->{fieldName}));
|
||||
WebGUI::SQL->write("insert into commerceSettings (namespace, type, fieldName, fieldValue) values ".
|
||||
"(".quote($entry->{namespace}).",".quote($entry->{type}).",".quote($entry->{fieldName}).",".quote($entry->{fieldValue}).")");
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
61
lib/WebGUI/Commerce/Item/Subscription.pm
Normal file
61
lib/WebGUI/Commerce/Item/Subscription.pm
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
package WebGUI::Commerce::Item::Subscription;
|
||||
|
||||
use strict;
|
||||
#use WebGUI::SQL;
|
||||
use WebGUI::Subscription;
|
||||
|
||||
#our @ISA = qw(WebGUI::Commerce::Item);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub description {
|
||||
return $_[0]->{_subscription}->get('description');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub duration {
|
||||
$_[0]->{_subscription}->get('duration');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub handler {
|
||||
$_[0]->{_subscription}->apply;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub id {
|
||||
return $_[0]->{_subscription}->get('subscriptionId');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub isRecurring {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub name {
|
||||
return $_[0]->{_subscription}->get('name');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub new {
|
||||
my ($class, $subscriptionId, $type, $subscription);
|
||||
$class = shift;
|
||||
$subscriptionId = shift;
|
||||
$type = shift;
|
||||
|
||||
$subscription = WebGUI::Subscription->new($subscriptionId);
|
||||
bless {_subscription => $subscription, _subscriptionId => $subscriptionId}, $class;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub price {
|
||||
return $_[0]->{_subscription}->get('price');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub type {
|
||||
return 'Subscription';
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
418
lib/WebGUI/Commerce/Payment/PayFlowPro.pm
Normal file
418
lib/WebGUI/Commerce/Payment/PayFlowPro.pm
Normal file
|
|
@ -0,0 +1,418 @@
|
|||
package WebGUI::Commerce::Payment::PayFlowPro;
|
||||
|
||||
use strict;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::Commerce::Payment;
|
||||
use Tie::IxHash;
|
||||
use PFProAPI qw( pfpro );
|
||||
use WebGUI::International;
|
||||
|
||||
our @ISA = qw(WebGUI::Commerce::Payment);
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub cancelRecurringPayment {
|
||||
my ($self, $recurring);
|
||||
$self = shift;
|
||||
$recurring = shift;
|
||||
|
||||
if ($recurring) {
|
||||
$self->{_type} = 'R';
|
||||
$self->{_recurring} = 1;
|
||||
$self->{_transactionParams} = {
|
||||
ORIGPROFILEID => $recurring->{id},
|
||||
ACTION => 'C',
|
||||
};
|
||||
}
|
||||
|
||||
return $self->submit;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub connectionError {
|
||||
my ($self, $resultCode);
|
||||
$self = shift;
|
||||
|
||||
$resultCode = $self->resultCode;
|
||||
return $self->resultMessage if ($resultCode < 0);
|
||||
return undef;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub checkoutForm {
|
||||
my ($self, $u, $f, %months, %years, $i18n);
|
||||
$self = shift;
|
||||
|
||||
$i18n = WebGUI::International->new('CommercePaymentPayFlowPro');
|
||||
|
||||
$u = WebGUI::User->new($session{user}{userId});
|
||||
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->text(
|
||||
-name => 'name',
|
||||
-label => $i18n->get('name'),
|
||||
-value => $session{form}{name} || $u->profileField('firstName').' '.$u->profileField('lastName')
|
||||
);
|
||||
$f->text(
|
||||
-name => 'address',
|
||||
-label => $i18n->get('address'),
|
||||
-value => $session{form}{address} || $u->profileField('homeAddress')
|
||||
);
|
||||
$f->text(
|
||||
-name => 'city',
|
||||
-label => $i18n->get('city'),
|
||||
-value => $session{form}{city} || $u->profileField('homeCity')
|
||||
);
|
||||
$f->text(
|
||||
-name => 'state',
|
||||
-label => $i18n->get('state'),
|
||||
-value => $session{form}{state} || $u->profileField('homeState')
|
||||
);
|
||||
$f->zipcode(
|
||||
-name => 'zipcode',
|
||||
-label => $i18n->get('zipcode'),
|
||||
-value => $session{form}{zipcode} || $u->profileField('homeZip')
|
||||
);
|
||||
$f->email(
|
||||
-name => 'email',
|
||||
-label => $i18n->get('email'),
|
||||
-value => $session{form}{email} || $u->profileField('email')
|
||||
);
|
||||
$f->text(
|
||||
-name => 'cardNumber',
|
||||
-label => $i18n->get('cardNumber'),
|
||||
-value => $session{form}{cardNumber}
|
||||
);
|
||||
tie %months, "Tie::IxHash";
|
||||
%months = map {sprintf('%02d',$_) => sprintf('%02d',$_)} 1..12;
|
||||
tie %years, "Tie::IxHash";
|
||||
%years = map {substr($_,2,2) => $_} 2004..2099;
|
||||
$f->readOnly(
|
||||
-label => $i18n->get('expiration date'),
|
||||
-value =>
|
||||
WebGUI::Form::selectList({name => 'expMonth', options => \%months, value => [$session{form}{expMonth}]}).
|
||||
" / ".
|
||||
WebGUI::Form::selectList({name => 'expYear', options => \%years, value => [$session{form}{expYear}]})
|
||||
);
|
||||
$f->integer(
|
||||
-name => 'cvv2',
|
||||
-label => $i18n->get('cvv2'),
|
||||
-value => $session{form}{cvv2}
|
||||
);
|
||||
|
||||
return $f->printRowsOnly;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub configurationForm {
|
||||
my ($self, $f, $i18n);
|
||||
$self = shift;
|
||||
$i18n = WebGUI::International->new('CommercePaymentPayFlowPro');
|
||||
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->text(
|
||||
-name => $self->prepend('vendor'),
|
||||
-label => $i18n->get('vendor'),
|
||||
-value => $self->get('vendor')
|
||||
);
|
||||
$f->text(
|
||||
-name => $self->prepend('partner'),
|
||||
-label => $i18n->get('partner'),
|
||||
-value => $self->get('partner')
|
||||
);
|
||||
$f->text(
|
||||
-name => $self->prepend('username'),
|
||||
-label => $i18n->get('username'),
|
||||
-value => $self->get('username')
|
||||
);
|
||||
$f->text(
|
||||
-name => $self->prepend('password'),
|
||||
-label => $i18n->get('password'),
|
||||
-value => $self->get('password')
|
||||
);
|
||||
$f->yesNo(
|
||||
-name => $self->prepend('testModeEnabled'),
|
||||
-label => $i18n->get('test mode'),
|
||||
-value => $self->get('testModeEnabled'),
|
||||
-subText=> $i18n->get('testModeEnabled')
|
||||
);
|
||||
|
||||
return $f->printRowsOnly;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub confirmTransaction {
|
||||
# This function should never be called with site side payment gateways!
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub init {
|
||||
my ($class, $self);
|
||||
$class = shift;
|
||||
|
||||
$self = $class->SUPER::init('PayFlowPro');
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub gatewayId {
|
||||
my $self = shift;
|
||||
|
||||
return $self->{_response}->{PROFILEID} if $self->{_recurring};
|
||||
return $self->{_response}->{PNREF};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getRecurringPaymentStatus {
|
||||
my ($self, $term, $recurringId, $response, %paymentHistory);
|
||||
$self = shift;
|
||||
$recurringId = shift;
|
||||
$term = shift;
|
||||
|
||||
if ($recurringId) {
|
||||
$self->{_type} = 'R';
|
||||
$self->{_recurring} = 1;
|
||||
$self->{_transactionParams} = {
|
||||
ORIGPROFILEID => $recurringId,
|
||||
PAYMENTHISTORY => 'Y',
|
||||
ACTION => 'I',
|
||||
};
|
||||
}
|
||||
|
||||
$self->submit;
|
||||
|
||||
$response = $self->{_response};
|
||||
|
||||
# Process the response
|
||||
if ($term) {
|
||||
return undef unless (defined $response->{'P_RESULT'.$term});
|
||||
return {
|
||||
resultCode => $response->{'P_RESULT'.$term},
|
||||
gatewayId => $response->{'P_PNREF'.$term},
|
||||
transferState => $response->{'P_TRANSTATE'.$term},
|
||||
transferDate => $response->{'P_TRANSTIME'.$term},
|
||||
amount => $response->{'P_AMOUNT'.$term},
|
||||
};
|
||||
}
|
||||
|
||||
$term = 1;
|
||||
while (defined $response->{'P_RESULT'.$term}) {
|
||||
$paymentHistory{$term} = {
|
||||
resultCode => $response->{'P_RESULT'.$term},
|
||||
gatewayId => $response->{'P_PNREF'.$term},
|
||||
transferState => $response->{'P_TRANSTATE'.$term},
|
||||
transferDate => $response->{'P_TRANSTIME'.$term},
|
||||
amount => $response->{'P_AMT'.$term},
|
||||
};
|
||||
$term++;
|
||||
}
|
||||
|
||||
return \%paymentHistory;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub errorCode {
|
||||
my ($self, $resultCode);
|
||||
$self = shift;
|
||||
|
||||
$resultCode = $self->{_response}->{RESULT};
|
||||
return $self->{_response}->{TRXRESULT} if ($resultCode == 36 && $self->{_recurring} && $self->{_response}->{TRXRESULT});
|
||||
return $resultCode unless ($resultCode eq '0');
|
||||
return undef;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub name {
|
||||
return WebGUI::International::get('module name', "CommercePaymentPayFlowPro");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub namespace {
|
||||
my $self = shift;
|
||||
|
||||
return $self->{_namespace};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub normalTransaction {
|
||||
my ($self, $normal);
|
||||
$self = shift;
|
||||
$normal = shift;
|
||||
|
||||
if ($normal) {
|
||||
$self->{_type} = 'S';
|
||||
$self->{_recurring} = 0;
|
||||
$self->{_transactionParams} = {
|
||||
AMT => sprintf('%.2f', $normal->{amount}),
|
||||
COMMENT1 => $normal->{description},
|
||||
COMMENT2 => $normal->{invoiceNumber},
|
||||
ORGID => $normal->{id},
|
||||
};
|
||||
}
|
||||
|
||||
return $self->submit;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub recurringTransaction {
|
||||
my ($self, $recurring);
|
||||
$self = shift;
|
||||
$recurring = shift;
|
||||
|
||||
my %resolve = (
|
||||
Weekly => 'WEEK',
|
||||
BiWeekly => 'BIWK',
|
||||
FourWeekly => 'FRWK',
|
||||
Monthly => 'MONT',
|
||||
Quarterly => 'QTER',
|
||||
HalfYearly => 'SMYR',
|
||||
Yearly => 'YEAR',
|
||||
);
|
||||
|
||||
if ($recurring) {
|
||||
$self->{_type} = 'R';
|
||||
$self->{_recurring} = 1;
|
||||
$self->{_transactionParams} = {
|
||||
START => $recurring->{start} || WebGUI::DateTime::epochToHuman(WebGUI::DateTime::addToDate(time, 0, 0, 1), '%m%d%y'),
|
||||
AMT => sprintf('%.2f', $recurring->{amount}),
|
||||
TERM => $recurring->{term},
|
||||
PAYPERIOD => $resolve{$recurring->{payPeriod}},
|
||||
PROFILENAME => $recurring->{profilename},
|
||||
COMMENT1 => $recurring->{description},
|
||||
COMMENT2 => $recurring->{invoiceNumber},
|
||||
ORGID => $recurring->{id},
|
||||
ACTION => 'A',
|
||||
};
|
||||
$self->{_transactionParams}->{OPTIONALTRX} = 'A' if ($recurring->{checkCard});
|
||||
}
|
||||
|
||||
return $self->submit;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub resultCode {
|
||||
my $self = shift;
|
||||
|
||||
return $self->{_response}->{RESULT};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub resultMessage {
|
||||
my $self = shift;
|
||||
|
||||
return $self->{_response}->{RESPMSG};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub submit {
|
||||
my ($payflow, $self, $purchase, %properties, $expirationDate);
|
||||
$self = shift;
|
||||
$purchase = shift;
|
||||
|
||||
my $server = 'payflow.verisign.com';
|
||||
$server = 'test-payflow.verisign.com' if $self->get('testModeEnabled');
|
||||
my $port = 443;
|
||||
my %cardData = %{$self->{_cardData}} if $self->{_cardData};
|
||||
my %userData = %{$self->{_userData}} if $self->{_userData};
|
||||
my %specificTranasctionParams = %{$self->{_transactionParams}};
|
||||
my %baseParams = (
|
||||
USER => $self->get('username'),
|
||||
VENDOR => $self->get('vendor'),
|
||||
PARTNER => $self->get('partner'),
|
||||
PWD => $self->get('password'),
|
||||
|
||||
TRXTYPE => $self->{_type},
|
||||
TENDER => 'C',
|
||||
);
|
||||
|
||||
%properties = (%baseParams, %specificTranasctionParams, %userData, %cardData);
|
||||
|
||||
my ( $response, $resultstr ) = pfpro( \%properties, $server, $port );
|
||||
|
||||
$self->{_response} = $response;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub supports {
|
||||
return {
|
||||
single => 1,
|
||||
recurring => 1,
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub transactionCompleted {
|
||||
my ($self) = shift;
|
||||
return ($self->{_response}->{RESULT} eq '0');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub transactionError {
|
||||
my ($self, $resultCode);
|
||||
$self = shift;
|
||||
|
||||
$resultCode = $self->resultCode;
|
||||
return $self->{_response}->{TRXRESPMSG} if ($resultCode == 36 && $self->{_recurring} && $self->{_response}->{TRXRESULT});
|
||||
return $self->resultMessage if ($resultCode > 0);
|
||||
return undef;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub transactionPending {
|
||||
return ($_[0]->errorCode == 126);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub validateFormData {
|
||||
my ($self, @error, $i18n, $currentYear, $currentMonth);
|
||||
$self = shift;
|
||||
|
||||
$i18n = WebGUI::International->new('CommercePaymentPayFlowPro');
|
||||
|
||||
push (@error, $i18n->get('invalid name')) unless ($session{form}{name});
|
||||
push (@error, $i18n->get('invalid address')) unless ($session{form}{address});
|
||||
push (@error, $i18n->get('invalid city')) unless ($session{form}{city});
|
||||
push (@error, $i18n->get('invalid zip')) unless ($session{form}{zipcode});
|
||||
push (@error, $i18n->get('invalid email')) unless ($session{form}{email});
|
||||
|
||||
push (@error, $i18n->get('invalid card number')) unless ($session{form}{cardNumber} =~ /^\d+$/);
|
||||
push (@error, $i18n->get('invalid cvv2')) unless ($session{form}{cvv2} =~ /^\d+$/);
|
||||
|
||||
($currentYear, $currentMonth) = WebGUI::DateTime::localtime;
|
||||
$currentYear -= 2000;
|
||||
|
||||
# Check if expDate and expYear have sane values
|
||||
unless (($session{form}{expMonth} =~ /^(0[1-9]|1[0-2])$/) && ($session{form}{expYear} =~ /^\d\d$/)) {
|
||||
push (@error, $i18n->get('invalid expiration date'));
|
||||
} elsif (($session{form}{expYear} < $currentYear) ||
|
||||
(($session{form}{expYear} == $currentYear) && ($session{form}{expMonth} < $currentMonth))) {
|
||||
push (@error, $i18n->get('invalid expiration date'));
|
||||
}
|
||||
|
||||
unless (@error) {
|
||||
$self->{_cardData} = {
|
||||
ACCT => $session{form}{cardNumber},
|
||||
EXPDATE => $session{form}{expMonth}.$session{form}{expYear},
|
||||
CVV2 => $session{form}{cvv2},
|
||||
};
|
||||
|
||||
$self->{_userData} = {
|
||||
STREET => $session{form}{address},
|
||||
ZIP => $session{form}{zipcode},
|
||||
CITY => $session{form}{city},
|
||||
NAME => $session{form}{name},
|
||||
EMAIL => $session{form}{email},
|
||||
STATE => $session{form}{state},
|
||||
};
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return \@error;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
64
lib/WebGUI/Help/Commerce.pm
Normal file
64
lib/WebGUI/Help/Commerce.pm
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
package WebGUI::Help::Commerce;
|
||||
|
||||
our $HELP = {
|
||||
'commerce manage' => {
|
||||
title => 'help manage commerce title',
|
||||
body => 'help manage commerce body',
|
||||
related => [
|
||||
]
|
||||
},
|
||||
|
||||
'list pending transactions' => {
|
||||
title => 'help manage pending transactions title',
|
||||
body => 'help manage pending transactions body',
|
||||
related => [
|
||||
]
|
||||
},
|
||||
|
||||
'cancel template' => {
|
||||
title => 'help cancel checkout template title',
|
||||
body => 'help cancel checkout template body',
|
||||
related => [
|
||||
{
|
||||
tag => 'template language',
|
||||
namespace => 'WebGUI'
|
||||
},
|
||||
{
|
||||
tag => 'templates manage',
|
||||
namespace => 'WebGUI'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
'confirm template' => {
|
||||
title => 'help checkout confirm template title',
|
||||
body => 'help checkout confirm template body',
|
||||
related => [
|
||||
{
|
||||
tag => 'template language',
|
||||
namespace => 'WebGUI'
|
||||
},
|
||||
{
|
||||
tag => 'templates manage',
|
||||
namespace => 'WebGUI'
|
||||
}
|
||||
],
|
||||
},
|
||||
|
||||
'error template' => {
|
||||
title => 'help checkout error template title',
|
||||
body => 'help checkout error template body',
|
||||
related => [
|
||||
{
|
||||
tag => 'template language',
|
||||
namespace => 'WebGUI'
|
||||
},
|
||||
{
|
||||
tag => 'templates manage',
|
||||
namespace => 'WebGUI'
|
||||
}
|
||||
]
|
||||
},
|
||||
};
|
||||
|
||||
1;
|
||||
91
lib/WebGUI/Help/Subscription.pm
Normal file
91
lib/WebGUI/Help/Subscription.pm
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
package WebGUI::Help::Subscription;
|
||||
|
||||
our $HELP = {
|
||||
'subscription add/edit' => {
|
||||
title => 'help edit subscription title',
|
||||
body => 'help edit subscription body',
|
||||
related => [
|
||||
{
|
||||
tag => 'subscription manage',
|
||||
namespace => 'Subscription'
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
'subscription manage' => {
|
||||
title => 'help manage subscriptions title',
|
||||
body => 'help manage subscriptions body',
|
||||
related => [
|
||||
{
|
||||
tag => 'subscription add/edit',
|
||||
namespace => 'Subscription'
|
||||
},
|
||||
{
|
||||
tag => 'subscription codes manage',
|
||||
namespace => 'Subscription'
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
'subscription codes manage' => {
|
||||
title => 'help manage subscription codes title',
|
||||
body => 'help manage subscription codes body',
|
||||
related => [
|
||||
{
|
||||
tag => 'create batch',
|
||||
namespace => 'Subscription'
|
||||
},
|
||||
{
|
||||
tag => 'subscription manage',
|
||||
namespace => 'Subscription'
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
'create batch' => {
|
||||
title => 'help create batch title',
|
||||
body => 'help create batch body',
|
||||
related => [
|
||||
{
|
||||
tag => 'subscription codes manage',
|
||||
namespace => 'Subscription'
|
||||
},
|
||||
{
|
||||
tag => 'manage batch',
|
||||
namespace => 'Subscription'
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
'manage batch' => {
|
||||
title => 'help manage batch title',
|
||||
body => 'help manage batch body',
|
||||
related => [
|
||||
{
|
||||
tag => 'create batch',
|
||||
namespace => 'Subscription'
|
||||
},
|
||||
{
|
||||
tag => 'subscription codes manage',
|
||||
namespace => 'Subscription'
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
'redeem code' => {
|
||||
title => 'help redeem code template title',
|
||||
body => 'help redeem code template body',
|
||||
related => [
|
||||
{
|
||||
tag => 'template language',
|
||||
namespace => 'WebGUI'
|
||||
},
|
||||
{
|
||||
tag => 'templates manage',
|
||||
namespace => 'WebGUI'
|
||||
},
|
||||
]
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
22
lib/WebGUI/Help/TransactionLog.pm
Normal file
22
lib/WebGUI/Help/TransactionLog.pm
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
package WebGUI::Help::TransactionLog;
|
||||
|
||||
our $HELP = {
|
||||
'purchase history' => {
|
||||
title => 'help purchase history template title',
|
||||
body => 'help purchase history template body',
|
||||
related => [
|
||||
{
|
||||
tag => 'template language',
|
||||
namespace => 'WebGUI'
|
||||
},
|
||||
{
|
||||
tag => 'templates manage',
|
||||
namespace => 'WebGUI'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
||||
18
lib/WebGUI/Macro/SubscriptionItem.pm
Normal file
18
lib/WebGUI/Macro/SubscriptionItem.pm
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package WebGUI::Macro::SubscriptionItem;
|
||||
|
||||
use strict;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
|
||||
sub process {
|
||||
my ($subscriptionId, $templateId, %var);
|
||||
($subscriptionId, $templateId) = WebGUI::Macro::getParams(@_);
|
||||
|
||||
%var = WebGUI::SQL->quickHash('select * from subscription where subscriptionId='.quote($subscriptionId));
|
||||
|
||||
$var{url} = WebGUI::URL::page('op=purchaseSubscription&sid='.$subscriptionId);
|
||||
return WebGUI::Template::process($templateId || 1, 'Macro/SubscriptionItem', \%var);
|
||||
}
|
||||
|
||||
1;
|
||||
12
lib/WebGUI/Macro/SubscriptionItemPurchaseUrl.pm
Normal file
12
lib/WebGUI/Macro/SubscriptionItemPurchaseUrl.pm
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
package WebGUI::Macro::SubscriptionItemPurchaseUrl;
|
||||
|
||||
use strict;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::URL;
|
||||
|
||||
sub process {
|
||||
my ($subscriptionId) = WebGUI::Macro::getParams(@_);
|
||||
return WebGUI::URL::page('op=purchaseSubscriptionItem&sid='.$subscriptionId);
|
||||
}
|
||||
|
||||
1;
|
||||
356
lib/WebGUI/Operation/Commerce.pm
Normal file
356
lib/WebGUI/Operation/Commerce.pm
Normal file
|
|
@ -0,0 +1,356 @@
|
|||
package WebGUI::Operation::Commerce;
|
||||
|
||||
use strict;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::ErrorHandler;
|
||||
use WebGUI::Commerce::Transaction;
|
||||
use WebGUI::Commerce::ShoppingCart;
|
||||
use WebGUI::Commerce::Payment;
|
||||
use WebGUI::AdminConsole;
|
||||
use WebGUI::TabForm;
|
||||
use WebGUI::Style;
|
||||
use WebGUI::Commerce;
|
||||
use WebGUI::Operation;
|
||||
use WebGUI::URL;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Template;
|
||||
use WebGUI::HTTP;
|
||||
use WebGUI::Paginator;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _submenu {
|
||||
my $i18n = WebGUI::International->new("Commerce");
|
||||
|
||||
my $workarea = shift;
|
||||
my $title = shift;
|
||||
$title = $i18n->get($title) if ($title);
|
||||
my $help = shift;
|
||||
my $ac = WebGUI::AdminConsole->new("commerce");
|
||||
if ($help) {
|
||||
$ac->setHelp($help, 'Commerce');
|
||||
}
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=editCommerceSettings'), $i18n->get('manage commerce settings'));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=listPendingTransactions'), $i18n->get('pending transactions'));
|
||||
return $ac->render($workarea, $title);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_cancelTransaction {
|
||||
my ($transaction, %var);
|
||||
|
||||
$transaction = WebGUI::Commerce::Transaction->new($session{form}{tid});
|
||||
unless ($transaction->status eq 'Completed') {
|
||||
$transaction->cancelTransaction;
|
||||
}
|
||||
|
||||
$var{message} = WebGUI::International::get('checkout canceled message', 'Commerce');
|
||||
|
||||
return WebGUI::Template::process($session{setting}{commerceCheckoutCanceledTemplateId}, 'Commerce/CheckoutCanceled', \%var);
|
||||
}
|
||||
|
||||
# This operation is here for easier future extensions to the commerce system.
|
||||
#-------------------------------------------------------------------
|
||||
sub www_checkout {
|
||||
return WebGUI::Operation::execute('checkoutConfirm');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_checkoutConfirm {
|
||||
my ($plugin, $f, %var, $errors, $i18n, $shoppingCart, $normal, $recurring);
|
||||
$errors = shift;
|
||||
|
||||
$i18n = WebGUI::International->new('Commerce');
|
||||
|
||||
unless ($session{setting}{commercePaymentPlugin}) {
|
||||
$var{errorLoop} = [{message=>$i18n->get('no payment gateway')}];
|
||||
return WebGUI::Template::process($session{setting}{commerceConfirmCheckoutTemplateId}, 'Commerce/ConfirmCheckout', \%var);
|
||||
}
|
||||
|
||||
$var{errorLoop} = [ map {{message => $_}} @{$errors} ] if $errors;
|
||||
|
||||
# Put contents of cart in template vars
|
||||
$shoppingCart = WebGUI::Commerce::ShoppingCart->new;
|
||||
($normal, $recurring) = $shoppingCart->getItems;
|
||||
|
||||
$var{normalItemLoop} = $normal;
|
||||
$var{normalItems} = scalar(@$normal);
|
||||
$var{recurringLoop} = $recurring;
|
||||
$var{recurringItems} = scalar(@$recurring);
|
||||
|
||||
$plugin = WebGUI::Commerce::Payment->load($session{setting}{commercePaymentPlugin});
|
||||
|
||||
# If the user isn't logged in yet, let him do so or have him create an account
|
||||
if ($session{user}{userId} == 1) {
|
||||
WebGUI::Session::setScratch('redirectAfterLogin', WebGUI::URL::page('op=checkout'));
|
||||
return WebGUI::Operation::execute('displayLogin');
|
||||
}
|
||||
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden('op', 'checkoutSubmit');
|
||||
$f->raw($plugin->checkoutForm);
|
||||
$f->submit($i18n->get('pay button'));
|
||||
|
||||
$var{form} = $f->print;
|
||||
$var{title} = $i18n->get('checkout confirm title');
|
||||
|
||||
return WebGUI::Template::process($session{setting}{commerceConfirmCheckoutTemplateId}, 'Commerce/ConfirmCheckout', \%var);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_checkoutSubmit {
|
||||
my ($plugin, $shoppingCart, $transaction, $var, $amount, @cartItems, $i18n, @transactions,
|
||||
@normal, $currentPurchase, $checkoutError, @resultLoop, %param, $normal, $recurring, $formError);
|
||||
|
||||
$i18n = WebGUI::International->new('Commerce');
|
||||
|
||||
# check if user has already logged in
|
||||
if ($session{user}{userId} == 1) {
|
||||
WebGUI::Session::setScratch('redirectAfterLogin', WebGUI::URL::page('op=checkout'));
|
||||
return WebGUI::Operation::execute('displayLogin');
|
||||
}
|
||||
|
||||
$plugin = WebGUI::Commerce::Payment->load($session{setting}{commercePaymentPlugin});
|
||||
$shoppingCart = WebGUI::Commerce::ShoppingCart->new;
|
||||
($normal, $recurring) = $shoppingCart->getItems;
|
||||
|
||||
# Check if shoppingcart contains any items. If not the user probably clicked reload, so we redirect to the current page.
|
||||
unless (@$normal || @$recurring) {
|
||||
WebGUI::HTTP::setRedirect(WebGUI::URL::page);
|
||||
return '';
|
||||
}
|
||||
|
||||
# check submitted form params
|
||||
$formError = $plugin->validateFormData;
|
||||
return www_checkoutConfirm($formError) if ($formError);
|
||||
|
||||
# Combine all non recurring item in one transaction and combine with all recurring ones
|
||||
map {push(@transactions, {recurring => 1, items => [$_]})} @$recurring;
|
||||
push(@transactions, {recurring => 0, items => [@$normal]}) if (@$normal);
|
||||
|
||||
$shoppingCart->empty;
|
||||
|
||||
foreach $currentPurchase (@transactions) {
|
||||
$amount = 0;
|
||||
$var = {};
|
||||
|
||||
# Write transaction to the log with status pending
|
||||
$transaction = WebGUI::Commerce::Transaction->new('new');
|
||||
foreach (@{$currentPurchase->{items}}) {
|
||||
$transaction->addItem($_->{item}, $_->{quantity});
|
||||
$amount += ($_->{item}->price * $_->{quantity});
|
||||
$var->{purchaseDescription} .= $_->{quantity}.' x '.$_->{item}->name.'<br>';
|
||||
}
|
||||
$var->{purchaseAmount} = sprintf('%.2f', $amount);
|
||||
|
||||
# submit
|
||||
if ($currentPurchase->{recurring}) {
|
||||
$transaction->isRecurring(1);
|
||||
$plugin->recurringTransaction({
|
||||
amount => $amount,
|
||||
id => $transaction->transactionId,
|
||||
term => 0,
|
||||
payPeriod => $currentPurchase->{items}->[0]->{item}->duration,
|
||||
profilename => $currentPurchase->{items}->[0]->{item}->name,
|
||||
checkCard => 1,
|
||||
});
|
||||
} else {
|
||||
$plugin->normalTransaction({
|
||||
amount => $amount,
|
||||
id => $transaction->transactionId,
|
||||
});
|
||||
}
|
||||
|
||||
$transaction->gatewayId($plugin->gatewayId);
|
||||
$transaction->gateway($plugin->namespace);
|
||||
|
||||
# check transaction result
|
||||
unless ($plugin->connectionError) {
|
||||
unless ($plugin->transactionError) {
|
||||
$transaction->completeTransaction if ($plugin->transactionCompleted);
|
||||
$var->{status} = $i18n->get('ok');
|
||||
} elsif ($plugin->transactionPending) {
|
||||
$checkoutError = 1;
|
||||
$var->{status} = $i18n->get('pending');
|
||||
$var->{error} = $plugin->transactionError;
|
||||
$var->{errorCode} = $plugin->errorCode;
|
||||
} else {
|
||||
$checkoutError = 1;
|
||||
$var->{status} = $i18n->get('transaction error');
|
||||
$var->{error} = $plugin->transactionError;
|
||||
$var->{errorCode} = $plugin->errorCode;
|
||||
$transaction->delete;
|
||||
}
|
||||
} else {
|
||||
$checkoutError = 1;
|
||||
$var->{status} = $i18n->get('connection error');
|
||||
$var->{error} = $plugin->connectionError;
|
||||
$var->{errorCode} = $plugin->errorCode;
|
||||
$transaction->delete;
|
||||
}
|
||||
|
||||
push(@resultLoop, $var);
|
||||
}
|
||||
|
||||
$param{title} = $i18n->get('transaction error title');
|
||||
$param{statusExplanation} = $i18n->get('status codes information');
|
||||
$param{resultLoop} = \@resultLoop;
|
||||
|
||||
# If everythings ok show the purchase history
|
||||
return WebGUI::Operation::execute('viewPurchaseHistory') unless ($checkoutError);
|
||||
|
||||
# If an error has occurred show the template errorlog
|
||||
return WebGUI::Template::process($session{setting}{commerceTransactionErrorTemplateId}, 'Commerce/TransactionError', \%param);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_completePendingTransaction {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
WebGUI::Commerce::Transaction->new($session{form}{tid})->completeTransaction;
|
||||
|
||||
return WebGUI::Operation::execute('listPendingTransactions');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_confirmTransaction {
|
||||
my($plugin, %var);
|
||||
$plugin = WebGUI::Commerce::Payment->load($session{setting}{commercePaymentPlugin});
|
||||
|
||||
if ($plugin->confirmTransaction) {
|
||||
WebGUI::Commerce::Transaction->new($plugin->getTransactionId)->completeTransaction;
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editCommerceSettings {
|
||||
my (%tabs, $tabform, $jscript, $currentPlugin, $ac, $jscript, $i18n, $paymentPlugin);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
$i18n = WebGUI::International->new('Commerce');
|
||||
|
||||
tie %tabs, 'Tie::IxHash';
|
||||
%tabs = (
|
||||
general=>{label=>$i18n->get('general tab')},
|
||||
payment=>{label=>$i18n->get('payment tab')},
|
||||
);
|
||||
|
||||
$paymentPlugin = $session{setting}{commercePaymentPlugin} || $session{config}{paymentPlugins}->[0];
|
||||
|
||||
$tabform = WebGUI::TabForm->new(\%tabs);
|
||||
$tabform->hidden({name => 'op', value => 'editCommerceSettingsSave'});
|
||||
|
||||
# general
|
||||
$tabform->getTab('general')->template(
|
||||
-name => 'commerceConfirmCheckoutTemplateId',
|
||||
-label => $i18n->get('confirm checkout template'),
|
||||
-value => $session{setting}{commerceConfirmCheckoutTemplateId},
|
||||
-namespace => 'Commerce/ConfirmCheckout'
|
||||
);
|
||||
$tabform->getTab('general')->template(
|
||||
-name => 'commerceTransactionErrorTemplateId',
|
||||
-label => $i18n->get('transaction error template'),
|
||||
-value => $session{setting}{commerceTransactionPendingTemplateId},
|
||||
-namespace => 'Commerce/TransactionError'
|
||||
);
|
||||
$tabform->getTab('general')->template(
|
||||
-name => 'commerceCheckoutCanceledTemplateId',
|
||||
-label => $i18n->get('checkout canceled template'),
|
||||
-value => $session{setting}{commerceCheckoutCanceledTemplateId},
|
||||
-namespace => 'Commerce/CheckoutCanceled'
|
||||
);
|
||||
$tabform->getTab('general')->email(
|
||||
-name => 'commerceSendDailyReportTo',
|
||||
-label => $i18n->get('daily report email'),
|
||||
-value => $session{setting}{commerceSendDailyReportTo}
|
||||
);
|
||||
|
||||
# payment plugin
|
||||
$tabform->getTab('payment')->raw('<script language="JavaScript" > var activePayment="'.$paymentPlugin.'"; </script>');
|
||||
$tabform->getTab("payment")->selectList(
|
||||
-name => 'commercePaymentPlugin',
|
||||
-options => {map {$_ => $_} @{$session{config}{paymentPlugins}}},
|
||||
-label => $i18n->get('payment form'),
|
||||
-value => [$paymentPlugin],
|
||||
-extras => 'onChange="activePayment=operateHidden(this.options[this.selectedIndex].value,activePayment)"'
|
||||
);
|
||||
|
||||
$jscript = '<script language="JavaScript">';
|
||||
foreach (@{$session{config}{paymentPlugins}}) {
|
||||
$currentPlugin = WebGUI::Commerce::Payment->load($_);
|
||||
$tabform->getTab('payment')->raw('<tr id="'.$_.'"><td colspan="2" width="100%">'.
|
||||
'<table border=0 cellspacing=0 cellpadding=0 width="100%">'.
|
||||
$currentPlugin->configurationForm.'<tr><td width="304"> </td><td width="496"> </td></tr></table></td></tr>');
|
||||
$jscript .= "document.getElementById(\"$_\").style.display='".(($_ eq $paymentPlugin)?"":"none")."';";
|
||||
}
|
||||
$jscript .= '</script>';
|
||||
|
||||
$tabform->getTab('payment')->raw($jscript);
|
||||
$tabform->submit;
|
||||
|
||||
WebGUI::Style::setScript($session{config}{extrasURL}.'/swapLayers.js',{language=>"Javascript"});
|
||||
|
||||
return _submenu($tabform->print, 'edit commerce settings title', 'commerce manage');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editCommerceSettingsSave {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
foreach (keys(%{$session{form}})) {
|
||||
# Store the plugin confiuration data in a special table for security and the general settings in the
|
||||
# normal settings table for easy access.
|
||||
if (/~([^~]*)~([^~]*)~([^~]*)/) {
|
||||
WebGUI::Commerce::setCommerceSetting({
|
||||
type => $1,
|
||||
namespace => $2,
|
||||
fieldName => $3,
|
||||
fieldValue => $session{form}{$_}
|
||||
});
|
||||
} elsif ($_ ne 'op') {
|
||||
WebGUI::SQL->write('update settings set value='.quote($session{form}{$_}).' where name='.quote($_));
|
||||
}
|
||||
}
|
||||
|
||||
return WebGUI::Operation::execute('adminConsole');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listPendingTransactions {
|
||||
my ($p, $transactions, $output, $properties, $i18n);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
$i18n = WebGUI::International->new("Commerce");
|
||||
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listPendingTransactions'));
|
||||
$p->setDataByArrayRef(WebGUI::Commerce::Transaction->pendingTransactions);
|
||||
|
||||
$transactions = $p->getPageData;
|
||||
|
||||
$output = $p->getBarTraditional($session{form}{pn});
|
||||
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
||||
$output .= '<tr><th>'.$i18n->get('transactionId').'</th><th>'.$i18n->get('gateway').'</th>'.
|
||||
'<th>'.$i18n->get('gatewayId').'</th><th>'.$i18n->get('init date').'</th></tr>';
|
||||
foreach (@{$transactions}) {
|
||||
$properties = $_->get;
|
||||
$output .= '<tr>';
|
||||
$output .= '<td>'.$properties->{transactionId}.'</td>';
|
||||
$output .= '<td>'.$properties->{gatewayId}.'</td>';
|
||||
$output .= '<td>'.$properties->{gateway}.'</td>';
|
||||
$output .= '<td>'.WebGUI::DateTime::epochToHuman($properties->{initDate}).'</td>';
|
||||
$output .= '<td><a href="'.WebGUI::URL::page('op=completePendingTransaction&tid='.$properties->{transactionId}).'">'.$i18n->get('complete pending transaction').'</a></td>';
|
||||
$output .= '</tr>';
|
||||
}
|
||||
$output .= '</table>';
|
||||
$output .= $p->getBarTraditional($session{form}{pn});
|
||||
|
||||
_submenu($output, 'list pending transactions', 'list pending transactions');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_transactionComplete {
|
||||
return WebGUI::Operation::execute('viewPurchaseHistory');
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
413
lib/WebGUI/Operation/Subscription.pm
Normal file
413
lib/WebGUI/Operation/Subscription.pm
Normal file
|
|
@ -0,0 +1,413 @@
|
|||
package WebGUI::Operation::Subscription;
|
||||
|
||||
use strict;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::Id;
|
||||
use Tie::IxHash;
|
||||
use WebGUI::Paginator;
|
||||
use WebGUI::Icon;
|
||||
use WebGUI::FormProcessor;
|
||||
use WebGUI::Subscription;
|
||||
use WebGUI::Commerce::ShoppingCart;
|
||||
use WebGUI::AdminConsole;
|
||||
use WebGUI::Template;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::International;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _submenu {
|
||||
my $i18n = WebGUI::International->new("Subscription");
|
||||
|
||||
my $workarea = shift;
|
||||
my $title = shift;
|
||||
$title = $i18n->get($title) if ($title);
|
||||
my $help = shift;
|
||||
my $ac = WebGUI::AdminConsole->new("subscriptions");
|
||||
if ($help) {
|
||||
$ac->setHelp($help, 'Subscription');
|
||||
}
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=editSubscription&sid=new'), $i18n->get('add subscription'));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=createSubscriptionCodeBatch'), $i18n->get('generate batch'));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=listSubscriptionCodes'), $i18n->get('manage codes'));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=listSubscriptionCodeBatches'), $i18n->get('manage batches'));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=listSubscriptions'), 'Manage Subscriptions');
|
||||
return $ac->render($workarea, $title);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_createSubscriptionCodeBatch {
|
||||
my (%subscriptions, $f, $error, $errorMessage);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
$error = shift;
|
||||
my $i18n = WebGUI::International->new("Subscription");
|
||||
|
||||
$errorMessage = $i18n->get('create batch error').'<ul><li>'.join('</li><li>', @{$error}).'</li></ul>' if ($error);
|
||||
|
||||
tie %subscriptions, "Tie::IxHash";
|
||||
%subscriptions = WebGUI::SQL->buildHash("select subscriptionId, name from subscription where deleted != 1 order by name");
|
||||
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden('op', 'createSubscriptionCodeBatchSave');
|
||||
$f->integer(
|
||||
-name => 'noc',
|
||||
-label => $i18n->get('noc'),
|
||||
-value => $session{form}{noc} || 1
|
||||
);
|
||||
$f->interval(
|
||||
-name => 'expires',
|
||||
-label => $i18n->get('codes expire'),
|
||||
-value => $session{form}{expires}
|
||||
);
|
||||
$f->selectList(
|
||||
-name => 'subscriptionId',
|
||||
-label => $i18n->get('association'),
|
||||
-options=> \%subscriptions,
|
||||
-multiple=>1,
|
||||
-size => 5,
|
||||
-value => [ ($session{cgi}->param('subscriptionId'))]
|
||||
);
|
||||
$f->textarea(
|
||||
-name => 'description',
|
||||
-label => $i18n->get('batch description'),
|
||||
-value => $session{form}{description}
|
||||
);
|
||||
$f->submit;
|
||||
|
||||
return _submenu($errorMessage.$f->print, 'create batch menu', 'create batch');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_createSubscriptionCodeBatchSave {
|
||||
my ($numberOfCodes, $description, $expires, $batchId, @codeElements, $currentCode, $code, $i, @subscriptions,
|
||||
@error, $creationEpoch);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
my $i18n = WebGUI::International->new("Subscription");
|
||||
|
||||
$numberOfCodes = $session{form}{noc};
|
||||
$description = $session{form}{description};
|
||||
$expires = WebGUI::FormProcessor::interval('expires');
|
||||
$batchId = WebGUI::Id::generate;
|
||||
|
||||
push(@error, $i18n->get('no description error')) unless ($description);
|
||||
push(@error, $i18n->get('no association error')) unless ($session{form}{subscriptionId});
|
||||
return www_createSubscriptionCodeBatch(\@error) if (@error);
|
||||
|
||||
$creationEpoch = time();
|
||||
|
||||
WebGUI::SQL->write("insert into subscriptionCodeBatch (batchId, description) values (".
|
||||
quote($batchId).", ".quote($description).")");
|
||||
@codeElements = ('A'..'Z', 'a'..'z', 0..9, '-');
|
||||
|
||||
for ($currentCode=0; $currentCode < $numberOfCodes; $currentCode++) {
|
||||
$code = "";
|
||||
for ($i=0; $i < 64; $i++) {
|
||||
$code .= $codeElements[rand(63)];
|
||||
}
|
||||
|
||||
WebGUI::SQL->write("insert into subscriptionCode (batchId, code, status, dateCreated, dateUsed, expires, usedBy)".
|
||||
" values (".quote($batchId).",".quote($code).", 'Unused', ".quote($creationEpoch).", 0, ".quote($expires).", 0)");
|
||||
@subscriptions = $session{cgi}->param('subscriptionId');
|
||||
foreach (@subscriptions) {
|
||||
WebGUI::SQL->write("insert into subscriptionCodeSubscriptions (code, subscriptionId) values (".
|
||||
quote($code).", ".quote($_).")");
|
||||
}
|
||||
}
|
||||
|
||||
return www_listSubscriptionCodeBatches();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteSubscription {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
WebGUI::Subscription->new($session{form}{sid})->delete;
|
||||
return www_listSubscriptions();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteSubscriptionCodeBatch {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
WebGUI::SQL->write("delete from subscriptionCodeBatch where batchId=".quote($session{form}{bid}));
|
||||
WebGUI::SQL->write("delete from subscriptionCode where batchId=".quote($session{form}{bid}));
|
||||
|
||||
return www_listSubscriptionCodeBatches();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteSubscriptionCodes {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
if ($session{form}{selection} eq 'dc') {
|
||||
WebGUI::SQL->write("delete from subscriptionCode where dateCreated >= ".quote($session{form}{dcStart}).
|
||||
' and dateCreated <= '.quote($session{form}{dcStop}));
|
||||
} elsif ($session{form}{selection} eq 'du') {
|
||||
WebGUI::SQL->write("delete from subscriptionCode where dateUsed >= ".quote($session{form}{duStart}).
|
||||
' and dateUsed <= '.quote($session{form}{duStop}));
|
||||
}
|
||||
|
||||
return www_listSubscriptionCodes();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editSubscription {
|
||||
my ($properties, $subscriptionId, $durationInterval, $durationUnits, $f);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
my $i18n = WebGUI::International->new("Subscription");
|
||||
|
||||
unless ($session{form}{sid} eq 'new') {
|
||||
$properties = WebGUI::Subscription->new($session{form}{sid})->get;
|
||||
}
|
||||
|
||||
$subscriptionId = $session{form}{sid} || 'new';
|
||||
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden('op', 'editSubscriptionSave');
|
||||
$f->hidden('sid', $subscriptionId);
|
||||
$f->readOnly(
|
||||
-label => $i18n->get('subscriptionId'),
|
||||
-value => $subscriptionId
|
||||
);
|
||||
$f->text(
|
||||
-name => 'name',
|
||||
-label => $i18n->get('subscription name'),
|
||||
-value => $properties->{name}
|
||||
);
|
||||
$f->float(
|
||||
-name => 'price',
|
||||
-label => $i18n->get('subscription price'),
|
||||
-value => $properties->{price} || '0.00'
|
||||
);
|
||||
$f->textarea(
|
||||
-name => 'description',
|
||||
-label => $i18n->get('subscription description'),
|
||||
-value => $properties->{description}
|
||||
);
|
||||
$f->group(
|
||||
-name => 'subscriptionGroup',
|
||||
-label => $i18n->get('subscription group'),
|
||||
-value => [$properties->{subscriptionGroup} || 2]
|
||||
);
|
||||
$f->selectList(
|
||||
-name => 'duration',
|
||||
-label => $i18n->get('subscription duration'),
|
||||
-value => [$properties->{duration} || 'Monthly'],
|
||||
-options=> WebGUI::Commerce::Payment::recurringPeriodValues
|
||||
);
|
||||
$f->text(
|
||||
-name => 'executeOnSubscription',
|
||||
-label => $i18n->get('execute on subscription'),
|
||||
-value => $properties->{executeOnSubscription}
|
||||
);
|
||||
if ($session{setting}{useKarma}) {
|
||||
$f->integer(
|
||||
-name => 'karma',
|
||||
-label => $i18n->get('subscription karma'),
|
||||
-value => $properties->{karma} || 0
|
||||
);
|
||||
}
|
||||
$f->submit;
|
||||
|
||||
return _submenu($f->print, 'edit subscription title', 'subscription add/edit');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editSubscriptionSave {
|
||||
my (@relevantFields);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
@relevantFields = qw(subscriptionId name price description subscriptionGroup duration executeOnSubscription karma);
|
||||
WebGUI::Subscription->new($session{form}{sid})->set({map {$_ => $session{form}{$_}} @relevantFields});
|
||||
|
||||
return www_listSubscriptions();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listSubscriptionCodeBatches {
|
||||
my ($p, $batches, $output);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
my $i18n = WebGUI::International->new("Subscription");
|
||||
|
||||
$p = WebGUI::Paginator->new('op=listSubscriptionCodeBatches');
|
||||
$p->setDataByQuery("select * from subscriptionCodeBatch");
|
||||
|
||||
$batches = $p->getPageData;
|
||||
|
||||
$output = $p->getBarTraditional($session{form}{pn});
|
||||
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
||||
foreach (@{$batches}) {
|
||||
$output .= '<tr><td>';
|
||||
$output .= deleteIcon('op=deleteSubscriptionCodeBatch&bid='.$_->{batchId}, undef, $i18n->get('delete batch confirm'));
|
||||
$output .= '<td>'.$_->{description}.'</td>';
|
||||
$output .= '<td><a href="'.WebGUI::URL::page('op=listSubscriptionCodes&selection=b&bid='.$_->{batchId}).'">'.$i18n->get('list codes in batch').'</a></td>';
|
||||
$output .= '</tr>';
|
||||
}
|
||||
$output .= '</table>';
|
||||
$output .= $p->getBarTraditional($session{form}{pn});
|
||||
|
||||
return _submenu($output, 'Manage subscription code batches', 'manage batch');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listSubscriptionCodes {
|
||||
my ($p, $codes, $output, $where, $ops, $delete);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
my $i18n = WebGUI::International->new("Subscription");
|
||||
|
||||
my $dcStart = WebGUI::FormProcessor::date('dcStart');
|
||||
my $dcStop = WebGUI::FormProcessor::date('dcStop');
|
||||
my $duStart = WebGUI::FormProcessor::date('duStart');
|
||||
my $duStop = WebGUI::FormProcessor::date('duStop');
|
||||
my $batches = WebGUI::SQL->buildHashRef("select batchId, description from subscriptionCodeBatch");
|
||||
|
||||
$output .= $i18n->get('selection message');
|
||||
|
||||
$output .= WebGUI::Form::formHeader;
|
||||
$output .= WebGUI::Form::hidden({name=>'op', value=>'listSubscriptionCodes'});
|
||||
$output .= '<table>';
|
||||
$output .= '<td>'.WebGUI::Form::radio({name=>'selection', value => 'du', checked=>($session{form}{selection} eq 'du')}).'</td>';
|
||||
$output .= '<td align="left">'.$i18n->get('selection used').'</td>';
|
||||
$output .= '<td>'.WebGUI::Form::date({name=>'duStart', value=>$duStart}).' '.$i18n->get('and').' '.WebGUI::Form::date({name=>'duStop', value=>$duStop}).'</td>';
|
||||
$output .= '</tr><tr>';
|
||||
$output .= '<td>'.WebGUI::Form::radio({name=>'selection', value => 'dc', checked=>($session{form}{selection} eq 'dc')}).'</td>';
|
||||
$output .= '<td align="left">'.$i18n->get('selection created').'</td>';
|
||||
$output .= '<td>'.WebGUI::Form::date({name=>'dcStart', value=>$dcStart}).' '.$i18n->get('and').' '.WebGUI::Form::date({name=>'dcStop', value=>$dcStop}).'</td>';
|
||||
$output .= '</tr><tr>';
|
||||
$output .= '<td>'.WebGUI::Form::radio({name=>'selection', value => 'b', checked=>($session{form}{selection} eq 'b')}).'</td>';
|
||||
$output .= '<td align="left">'.$i18n->get('selection batch id').'</td>';
|
||||
$output .= '<td>'.WebGUI::Form::selectList({name => 'bid', value => [$session{form}{bid}], options => $batches});
|
||||
$output .= '</tr><tr>';
|
||||
$output .= '<td></td>';
|
||||
$output .= '<td>'.WebGUI::Form::submit({value=>$i18n->get('select')}).'</td>';
|
||||
$output .= '</tr>';
|
||||
$output .= '</table>';
|
||||
$output .= WebGUI::Form::formFooter;
|
||||
|
||||
if ($session{form}{selection} eq 'du') {
|
||||
$where = " and dateUsed >= ".quote($duStart)." and dateUsed <= ".quote($duStop);
|
||||
$ops = '&duStart='.$duStart.'&duStop='.$duStop.'&selection=du';
|
||||
$delete = '<a href="'.WebGUI::URL::page('op=deleteSubscriptionCodes'.$ops).'">'.$i18n->get('delete codes').'</a>';
|
||||
} elsif ($session{form}{selection} eq 'dc') {
|
||||
$where = " and dateCreated >= ".quote($dcStart)." and dateCreated <= ".quote($dcStop);
|
||||
$ops = '&dcStart='.$dcStart.'&dcStop='.$dcStop.'&selection=dc';
|
||||
$delete = '<a href="'.WebGUI::URL::page('op=deleteSubscriptionCodes'.$ops).'">'.$i18n->get('delete codes').'</a>';
|
||||
} elsif ($session{form}{selection} eq 'b') {
|
||||
$where = " and t1.batchId=".quote($session{form}{bid});
|
||||
$ops = '&bid='.$session{form}{bid}.'&selection=b';
|
||||
$delete = '<a href="'.WebGUI::URL::page('op=deleteSubscriptionBatch'.$ops).'">'.$i18n->get('delete codes').'</a>';
|
||||
}
|
||||
|
||||
$p = WebGUI::Paginator->new('op=listSubscriptionCodes'.$ops);
|
||||
$p->setDataByQuery("select t1.*, t2.* from subscriptionCode as t1, subscriptionCodeBatch as t2 where t1.batchId=t2.batchId ".$where);
|
||||
|
||||
$codes = $p->getPageData;
|
||||
|
||||
$output .= '<br>'.$delete.'<br>' if ($delete);
|
||||
$output .= $p->getBarTraditional($session{form}{pn});
|
||||
$output .= '<br>';
|
||||
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
||||
$output .= '<tr>';
|
||||
$output .= '<th>'.$i18n->get('batchId').'</th><th>'.$i18n->get('code').'</th><th>'.$i18n->get('creation date').
|
||||
'</th><th>'.$i18n->get('dateUsed').'</th><th>'.$i18n->get('status').'</th>'; $output .= '</tr>';
|
||||
foreach (@{$codes}) {
|
||||
$output .= '<tr>';
|
||||
$output .= '<td>'.$_->{batchId}.'</td>';
|
||||
$output .= '<td>'.$_->{code}.'</td>';
|
||||
$output .= '<td>'.WebGUI::DateTime::epochToHuman($_->{dateCreated}).'</td>';
|
||||
$output .= '<td>';
|
||||
$output .= WebGUI::DateTime::epochToHuman($_->{dateUsed}) if ($_->{dateUsed});
|
||||
$output .= '</td>';
|
||||
$output .= '<td>'.$_->{status}.'</td>';
|
||||
$output .= '</tr>';
|
||||
}
|
||||
$output .= '</table>';
|
||||
$output .= $p->getBarTraditional($session{form}{pn});
|
||||
|
||||
return _submenu($output, 'listSubscriptionCodes title', 'subscription codes manage');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listSubscriptions {
|
||||
my ($p, $subscriptions, $output);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
my $i18n = WebGUI::International->new("Subscription");
|
||||
|
||||
$p = WebGUI::Paginator->new('op=listSubscriptions');
|
||||
$p->setDataByQuery('select subscriptionId, name from subscription where deleted != 1');
|
||||
$subscriptions = $p->getPageData;
|
||||
|
||||
$output = $p->getBarTraditional($session{form}{pn});
|
||||
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
||||
foreach (@{$subscriptions}) {
|
||||
$output .= '<tr>';
|
||||
$output .= '<td>'.editIcon('op=editSubscription&sid='.$_->{subscriptionId});
|
||||
$output .= deleteIcon('op=deleteSubscription&sid='.$_->{subscriptionId}, undef, $i18n->get('delete subscription confirm')).'</td>';
|
||||
$output .= '<td>'.$_->{name}.'</td>';
|
||||
$output .= '</tr>';
|
||||
}
|
||||
$output .= '</table>';
|
||||
$output .= $p->getBarTraditional($session{form}{pn});
|
||||
|
||||
$output = $i18n->get('no subscriptions') unless (@{$subscriptions});
|
||||
|
||||
return _submenu($output, 'manage subscriptions', 'subscription manage');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_purchaseSubscription {
|
||||
WebGUI::Commerce::ShoppingCart->new->add($session{form}{sid}, 'Subscription');
|
||||
|
||||
return WebGUI::Operation::execute('checkout');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_redeemSubscriptionCode {
|
||||
my (%codeProperties, @subscriptions, %var, $f);
|
||||
my $i18n = WebGUI::International->new("Subscription");
|
||||
|
||||
if ($session{form}{code}) {
|
||||
%codeProperties = WebGUI::SQL->quickHash("select * from subscriptionCode as t1, subscriptionCodeBatch as t2 where ".
|
||||
"t1.batchId = t2.batchId and t1.code=".quote($session{form}{code})." and (t1.dateCreated + t1.expires) > ".quote(time));
|
||||
|
||||
if ($codeProperties{status} eq 'Unused') {
|
||||
# Code is ok
|
||||
@subscriptions = WebGUI::SQL->buildArray("select subscriptionId from subscriptionCodeSubscriptions where code=".quote($session{form}{code}));
|
||||
foreach (@subscriptions) {
|
||||
WebGUI::Subscription->new($_)->apply;
|
||||
}
|
||||
|
||||
# Set code to Used
|
||||
WebGUI::SQL->write("update subscriptionCode set status='Used', dateUsed=".quote(time)." where code=".quote($session{form}{code}));
|
||||
|
||||
$var{batchDescription} = $codeProperties{description};
|
||||
$var{message} = $i18n->get('redeem code success');
|
||||
} else {
|
||||
$var{message} = $i18n->get('redeem code failure');
|
||||
}
|
||||
} else {
|
||||
$var{message} = $i18n->get('redeem code ask for code');
|
||||
}
|
||||
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden('op','redeemSubscriptionCode');
|
||||
$f->text(
|
||||
-name => 'code',
|
||||
-label => $i18n->get('code'),
|
||||
-maxLength => 64,
|
||||
-size => 64
|
||||
);
|
||||
$f->submit;
|
||||
$var{codeForm} = $f->print;
|
||||
|
||||
return WebGUI::Template::process(1, 'Operation/RedeemSubscription', \%var);
|
||||
}
|
||||
|
||||
1;
|
||||
52
lib/WebGUI/Operation/TransactionLog.pm
Normal file
52
lib/WebGUI/Operation/TransactionLog.pm
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
package WebGUI::Operation::TransactionLog;
|
||||
|
||||
use strict;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Commerce::Transaction;
|
||||
use WebGUI::Template;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Operation;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewPurchaseHistory {
|
||||
my (@history, @historyLoop, %var, %properties);
|
||||
|
||||
$var{errorMessage} = shift;
|
||||
|
||||
@history = @{WebGUI::Commerce::Transaction->transactionsByUser($session{user}{userId})};
|
||||
foreach (@history) {
|
||||
%properties = %{$_->get};
|
||||
$properties{initDate} = WebGUI::DateTime::epochToHuman($properties{initDate});
|
||||
$properties{completionDate} = WebGUI::DateTime::epochToHuman($properties{completionDate}) if ($properties{completionDate});
|
||||
push(@historyLoop, {
|
||||
(%properties),
|
||||
itemLoop => $_->getItems,
|
||||
cancelUrl => WebGUI::URL::page('op=cancelRecurringTransaction&tid='.$properties{transactionId}),
|
||||
canCancel => ($properties{recurring} && ($properties{status} eq 'Completed')),
|
||||
});
|
||||
}
|
||||
|
||||
$var{purchaseHistoryLoop} = \@historyLoop;
|
||||
|
||||
return WebGUI::Template::process(1, 'Commerce/ViewPurchaseHistory', \%var);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_cancelRecurringTransaction {
|
||||
my ($transaction, $error, $message);
|
||||
|
||||
my $i18n = WebGUI::International->new("TransactionLog");
|
||||
|
||||
$transaction = WebGUI::Commerce::Transaction->new($session{form}{tid});
|
||||
if ($transaction->isRecurring) {
|
||||
$error = $transaction->cancelTransaction;
|
||||
$message = $i18n->get('cancel error').$error if ($error);
|
||||
} else {
|
||||
$message = $i18n->get('cannot cancel');
|
||||
}
|
||||
|
||||
return www_viewPurchaseHistory($message);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
97
lib/WebGUI/Subscription.pm
Normal file
97
lib/WebGUI/Subscription.pm
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
package WebGUI::Subscription;
|
||||
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Grouping;
|
||||
use WebGUI::Utility;
|
||||
use WebGUI::Commerce::Payment;
|
||||
use WebGUI::DateTime;
|
||||
|
||||
sub _getDuration {
|
||||
my $duration = shift;
|
||||
|
||||
return addToDate(0,0,0,7) if $duration eq 'Weekly';
|
||||
return addToDate(0,0,0,14) if $duration eq 'BiWeekly';
|
||||
return addToDate(0,0,0,28) if $duration eq 'FourWeekly';
|
||||
return addToDate(0,0,1,0) if $duration eq 'Monthly';
|
||||
return addToDate(0,0,3,0) if $duration eq 'Quarterly';
|
||||
return addToDate(0,0,6,0) if $duration eq 'HalfYearly';
|
||||
return addToDate(0,1,0,0) if $duration eq 'Yearly';
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub apply {
|
||||
my ($self, $userId, $groupId, $expirationDate);
|
||||
$self = shift;
|
||||
$userId = shift || $session{user}{userId};
|
||||
$groupId = $self->{_properties}{subscriptionGroup};
|
||||
|
||||
# Make user part of the right group
|
||||
if (WebGUI::Grouping::isInGroup($groupId, $userId)) {
|
||||
# $expirationDate = WebGUI::Grouping::userGroupExpireDate($userId, $groupId) + $self->{_properties}{duration};
|
||||
$expirationDate = WebGUI::Grouping::userGroupExpireDate($userId, $groupId) + _getDuration($self->{_properties}{duration});
|
||||
|
||||
WebGUI::Grouping::userGroupExpireDate($userId, $groupId, $expirationDate);
|
||||
} else {
|
||||
WebGUI::Grouping::addUsersToGroups([$userId], [$groupId], _getDuration($self->{_properties}{duration}));
|
||||
}
|
||||
|
||||
# Add karma
|
||||
WebGUI::User->new($userId)->karma($self->{_properties}{karma}, 'Subscription', 'Added for purchasing subscription '.$self->{_properties}{name});
|
||||
|
||||
# Process executeOnPurchase field
|
||||
system(WebGUI::Macro::process($self->{_properties}{executeOnSubscription})) if ($self->{_properties}{executeOnSubscription} ne "");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub delete {
|
||||
my ($self);
|
||||
$self = shift;
|
||||
|
||||
WebGUI::SQL->write("update subscription set deleted=1 where subscriptionId=".quote($self->{_subscriptionId}));
|
||||
$self->{_properties}{deleted} = 1;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub get {
|
||||
my ($self, $key) = @_;
|
||||
return $self->{_properties}{$key} if ($key);
|
||||
return $self->{_properties};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub new {
|
||||
my ($class, $subscriptionId, %properties);
|
||||
$class = shift;
|
||||
$subscriptionId = shift;
|
||||
|
||||
if ($subscriptionId eq 'new') {
|
||||
$subscriptionId = WebGUI::Id::generate;
|
||||
WebGUI::SQL->write("insert into subscription (subscriptionId) values (".quote($subscriptionId).")");
|
||||
}
|
||||
|
||||
%properties = WebGUI::SQL->quickHash("select * from subscription where subscriptionId=".quote($subscriptionId));
|
||||
|
||||
bless {_subscriptionId => $subscriptionId, _properties => \%properties}, $class;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub set {
|
||||
my ($self, $properties, @fieldsToUpdate);
|
||||
$self = shift;
|
||||
$properties = shift;
|
||||
|
||||
foreach (keys(%{$properties})) {
|
||||
if (isIn($_, qw(name price description subscriptionGroup duration executeOnSubscribe karma))) {
|
||||
$self->{_properties}{$_} = $value;
|
||||
push(@fieldsToUpdate, $_);
|
||||
}
|
||||
}
|
||||
|
||||
WebGUI::SQL->write("update subscription set ".
|
||||
join(',', map {"$_=".quote($properties->{$_})} @fieldsToUpdate).
|
||||
" where subscriptionId=".quote($self->{_subscriptionId}));
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
360
lib/WebGUI/i18n/English/Commerce.pm
Executable file
360
lib/WebGUI/i18n/English/Commerce.pm
Executable file
|
|
@ -0,0 +1,360 @@
|
|||
package WebGUI::i18n::English::Commerce;
|
||||
|
||||
our $I18N = {
|
||||
'commerce settings' => {
|
||||
message => q|Commerce|,
|
||||
lastUpdated => 0,
|
||||
context => q|The displayeed title of the Commerce Settings in the Admin Console|
|
||||
},
|
||||
'pay button' => {
|
||||
message => q|Pay|,
|
||||
lastUpdated => 0,
|
||||
context => q|The button on the checkout form.|
|
||||
},
|
||||
'checkout confirm title' => {
|
||||
message => q|Please fill in the form below to purchase these products.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Message in the checkout form.|
|
||||
},
|
||||
'general tab' => {
|
||||
message => q|General|,
|
||||
lastUpdated => 0,
|
||||
context => q|The name of the 'general' tab in editCommerce.|
|
||||
},
|
||||
'payment tab' => {
|
||||
message => q|Payment Plugins|,
|
||||
lastUpdated => 0,
|
||||
context => q|The name of the 'payment plugins' tab in editCommerce.|
|
||||
},
|
||||
'payment form' => {
|
||||
message => q|Payment Plugin|,
|
||||
lastUpdated => 0,
|
||||
context => q|The name of the 'payment plugin' form option in editCommerce.|
|
||||
},
|
||||
'confirm checkout template' => {
|
||||
message => q|Confirm checkout template|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label indicating the Confirm checkout template.|
|
||||
},
|
||||
'checkout canceled template' => {
|
||||
message => q|Checkout canceled template|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label indicating the Checkout canceled template.|
|
||||
},
|
||||
'transaction error template' => {
|
||||
message => q|Transaction error template|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label indicating the Transaction error template.|
|
||||
},
|
||||
'no payment gateway' => {
|
||||
message => q|No payment gateway selected.|,
|
||||
lastUpdated => 0,
|
||||
context => q|An error message that shows up during checkout process if no payment gateway has been selected|
|
||||
},
|
||||
'edit commerce settings title' => {
|
||||
message => q|Manage Commerce Settings|,
|
||||
lastUpdated => 0,
|
||||
context => q|Title of the Commerce part of the Admin Console.|
|
||||
},
|
||||
|
||||
'help manage commerce title' => {
|
||||
message => q|Commerce, Manage|,
|
||||
lastUpdated => 0,
|
||||
context => q|The title of the manage commerce help page.|
|
||||
},
|
||||
|
||||
'help manage commerce body' => {
|
||||
message => q|The commerce system of WebGUI is highly configurable. You can set the following properties:<br>
|
||||
<br>
|
||||
<b>Confirm checkout template</b><br>
|
||||
This template is shown when a user is asked to confirm his purchase. The form data for the payment gateway is also shown here.<br>
|
||||
<br>
|
||||
<b>Transaction error template </b><br>
|
||||
This is the template that's shown if any error occurs during the payment process. This could be a dclined credit card or a flase cvv2 code, for instance. Also an 'error' is triggered by a fraud protection filter or some other service that requires manual interaction from the merchant.<br>
|
||||
<br>
|
||||
<b>Checkout canceled template</b><br>
|
||||
This is the template that the user sees when he cancels the transaction. This normally only occurs with remote-side payment gateways (like PayPal). This is beacuse a site-side payment gateway usually uses a single step proces.<br>
|
||||
<br>
|
||||
<b>Send daily report to</b>
|
||||
Everyday the scheduler plugin that checks and updates subscriptions send a report on on the succesful and failed term payments. Here you can set to whitch email address it should send this report.<br>
|
||||
<br>
|
||||
<h2>Payment plugins</h2>
|
||||
<b>Payment plugin</b><br>
|
||||
You can select the payment plugin to use here. Please note that you have to enable the plugins you want to choose from in the WebGUI configuration file. If you don't do this they won't show up here.<br>
|
||||
<br>
|
||||
<h3>PayflowPro</h3>
|
||||
This is the plugin for Verisign Payflow Pro. This plugin is disabled by default in the configuration file because it depends on proprietary software from Verisign that can't be shipped with WebGUI.<br>
|
||||
<br>
|
||||
<b>Partner</b><br>
|
||||
Your partner id.<br>
|
||||
<br>
|
||||
<b>Vendor</b>
|
||||
Here you should enter your vendor id.<br>
|
||||
<br>
|
||||
<b>Login</b>
|
||||
Your login to Versign PayflowPro.<br>
|
||||
<br>
|
||||
<b>Password</b>
|
||||
Your password.<br>|,
|
||||
lastUpdated => 0,
|
||||
context => q|The content of the manage commerce help page.|
|
||||
},
|
||||
|
||||
'manage commerce settings' => {
|
||||
message => q|Manage commerce settings.|,
|
||||
lastUpdated => 0,
|
||||
context => q|The menu title for 'Manage commerce settings' in the adminconsole side menu.|
|
||||
},
|
||||
|
||||
'pending transactions' => {
|
||||
message => q|Show pending transactions.|,
|
||||
lastUpdated => 0,
|
||||
context => q|The menu title for 'Show pending transactions' in the adminconsole side menu.|
|
||||
},
|
||||
|
||||
'list pending transactions' => {
|
||||
message => q|Pending transactions|,
|
||||
lastUpdated => 0,
|
||||
context => q|The title of the 'Show pending transactions' admin console screen.|
|
||||
},
|
||||
|
||||
'transactionId' => {
|
||||
message => q|TransactionId|,
|
||||
lastUpdated => 0,
|
||||
context => q|TransactionId, just leave it as it is.|
|
||||
},
|
||||
|
||||
|
||||
'gatewayId' => {
|
||||
message => q|Gateway ID|,
|
||||
lastUpdated => 0,
|
||||
context => q|Gateway ID is the ID the transaction is given by the payment gateway.|,
|
||||
},
|
||||
|
||||
'init date' => {
|
||||
message => q|Initiation Date|,
|
||||
lastUpdated => 0,
|
||||
context => q|The date on which the transaction was started|
|
||||
},
|
||||
|
||||
'gateway' => {
|
||||
message => q|Gateway|,
|
||||
lastUpdated => 0,
|
||||
context => q|Table header of the column that identifies the gateway through which the transaction went.|
|
||||
},
|
||||
|
||||
'weekly' => {
|
||||
message => q|Week|,
|
||||
lastUpdated => 0,
|
||||
context => q|Period name for a weekly subscription.|
|
||||
},
|
||||
|
||||
'biweekly' => {
|
||||
message => q|Two weeks|,
|
||||
lastUpdated => 0,
|
||||
context => q|Period name for a biweekly subscription.|
|
||||
},
|
||||
|
||||
'fourweekly' => {
|
||||
message => q|Four weeks|,
|
||||
lastUpdated => 0,
|
||||
context => q|Period name for a four weekly subscription.|
|
||||
},
|
||||
|
||||
'monthly' => {
|
||||
message => q|Month|,
|
||||
lastUpdated => 0,
|
||||
context => q|Period name for a monthly subscription.|
|
||||
},
|
||||
|
||||
'quarterly' => {
|
||||
message => q|Three months|,
|
||||
lastUpdated => 0,
|
||||
context => q|Period name for a Quarterly subscription.|
|
||||
},
|
||||
|
||||
'halfyearly' => {
|
||||
message => q|Half year|,
|
||||
lastUpdated => 0,
|
||||
context => q|Period name for a semi yearly subscription.|
|
||||
},
|
||||
|
||||
'yearly' => {
|
||||
message => q|Year|,
|
||||
lastUpdated => 0,
|
||||
context => q|Period name for a yearly subscription.|
|
||||
},
|
||||
|
||||
'transaction error' => {
|
||||
message => q|Transaction Error|,
|
||||
lastUpdated => 0,
|
||||
context => q|Name for 'transaction error' status in the Commerce/TransactionError template.|
|
||||
},
|
||||
|
||||
'connection error' => {
|
||||
message => q|Connection Error|,
|
||||
lastUpdated => 0,
|
||||
context => q|Name for 'connection error' status in the Commerce/TransactionError template.|
|
||||
},
|
||||
|
||||
'pending' => {
|
||||
message => q|Pending|,
|
||||
lastUpdated => 0,
|
||||
context => q|Name for 'pending' status in the Commerce/TransactionError template.|
|
||||
},
|
||||
|
||||
'ok' => {
|
||||
message => q|OK|,
|
||||
lastUpdated => 0,
|
||||
context => q|Name for 'OK' status in the Commerce/TransactionError template.|
|
||||
},
|
||||
|
||||
'transaction error title' => {
|
||||
message => q|An error has occurred in one or more transactions|,
|
||||
lastUpdated => 0,
|
||||
context => q|The title used in the transaction error template.|
|
||||
},
|
||||
|
||||
'status codes information' => {
|
||||
message => q|The status codes have the following meaning:<br>
|
||||
<table border="0" cellspacing="0" cellpadding="5">
|
||||
<tr>
|
||||
<td valign="top" align="right"><b>OK</b></td>
|
||||
<td valign="top" align="left">This means that this transaction has been completed successfully. You have purchased the product.</td>
|
||||
</tr><tr>
|
||||
<td valign="top" align="right"><b>Pending</b></td>
|
||||
<td valign="top" align="left">This means that this transaction is under review. This could have anumber of causes, and normally this transaction is processed within a short time.</td>
|
||||
</tr><tr>
|
||||
<td valign="top" align="right"><b>Transaction Error</b></td>
|
||||
<td valign="top" align="left">An unrecoverable error happened while processing the transaction.</td>
|
||||
</tr><tr>
|
||||
<td valign="top" align="right"><b>Connection Error</b></td>
|
||||
<td valign="top" align="left">Something went wrong with the connection to the payment gateway. The admin has been notified.</td>
|
||||
</tr>
|
||||
</table>|,
|
||||
lastUpdated => 0,
|
||||
context => q|A message that explains the status codes that are returned in the transaction error template.|
|
||||
},
|
||||
|
||||
'daily report email' => {
|
||||
message => q|Send daily report to|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label that asks whom to send the daily recurring payments report to.|
|
||||
},
|
||||
'checkout canceled message' => {
|
||||
message => q|The checkout process has been canceled.|,
|
||||
lastUpdated => 0,
|
||||
context => q|A message that's shown to users that cancel their checkout.|
|
||||
},
|
||||
'complete pending transaction' => {
|
||||
message => q|Complete transaction|,
|
||||
lastUpdated => 0,
|
||||
context => q|Label for the link that allows you to complete a pending transaction.|
|
||||
},
|
||||
'help manage pending transactions title' => {
|
||||
message => q|List pending transactions|,
|
||||
lastUpdated => 0,
|
||||
context => q|The title of the help page of the list pending transactions screen.|
|
||||
},
|
||||
'help manage pending transactions body' => {
|
||||
message => q|All transactions that are marked as 'Pending' are listed here. Transactions are marked pending if some extra review is required. For instance when a transction is suspected of fraud. Pending transactions can also be tranactions that yet have to be confirmed by something as or similar to PayPals APN. If you have checked that the transaction is legit you can click on the 'Complete transaction' link.|,
|
||||
lastUpdated => 0,
|
||||
context => q|The body of the help page of the list pending transactions screen.|
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
'help cancel checkout template title' => {
|
||||
message => q|Cancel checkout template|,
|
||||
lastUpdated => 0,
|
||||
context => q|The title of the help page of the cancel checkout template.|
|
||||
},
|
||||
'help cancel checkout template body' => {
|
||||
message => q|The following template variable is available in this template:<br>
|
||||
<br>
|
||||
<b>message</b><br>
|
||||
The internationalized cancelation message.|,
|
||||
lastUpdated => 0,
|
||||
context => q|The body of the help page of the cancel checkout template.|
|
||||
},
|
||||
'help checkout confirm template body' => {
|
||||
message => q|This template separates normal and recurring items. A normal item is an item that is payed only once. Recuuring items are payed once a period, like a subscription.<br>
|
||||
<br>
|
||||
The following template variables are available in this template:<br>
|
||||
<br>
|
||||
<b>title</b><br>
|
||||
The title to use for this template.<br>
|
||||
<br>
|
||||
<b>normalItems</b><br>
|
||||
Th number of normal items in the shopping cart.<br>
|
||||
<br>
|
||||
<b>normalItemLoop</b>
|
||||
A loop containing the normal items in the shoppingcart. The following template varaibles are available in this loop:<br>
|
||||
<blockquote>
|
||||
<b>quantity</b><br>
|
||||
The quantity of the current item in the shopping cart.<br>
|
||||
<br>
|
||||
<b>period</b><br>
|
||||
The period of the recurring payment.<br>
|
||||
<br>
|
||||
<b>name</b><br>
|
||||
The name of this item.<br>
|
||||
<br>
|
||||
<b>price</b><br>
|
||||
The price of one item.<br>
|
||||
<br>
|
||||
<b>totalPrice</b><br>
|
||||
The price of the quantity of this item. (totalPrice = quantity * price)<br>
|
||||
</blockquote>
|
||||
<b>recurringItems</b><br>
|
||||
The number of recurring items in the shoppingcart.<br>
|
||||
<br>
|
||||
<b>recurringItemLoop</b><br>
|
||||
A loop containing the recurring items in the shopping cart. For available template variables seen <b>normalItemLoop</b><br>
|
||||
<br>
|
||||
<b>form</b><br>
|
||||
The form that's generated by the selected payment plugin.<br>|,
|
||||
lastUpdated => 0,
|
||||
context => q|The body of the help page of the confirm checkout template.|
|
||||
},
|
||||
'help checkout confirm template title' => {
|
||||
message => q|Confirm checkout template|,
|
||||
lastUpdated => 0,
|
||||
context => q|The title of the help page of the confirm checkout template.|
|
||||
},
|
||||
'help checkout error template body' => {
|
||||
message => q|The following template variables are available in this template:<br>
|
||||
<br>
|
||||
<b>title</b><br>
|
||||
The title of this template.<br>
|
||||
<br>
|
||||
<b>statusExplanation</b><br>
|
||||
A message which explains the possible statuses an item can have<br>
|
||||
<br>
|
||||
<b>resultLoop</b><br>
|
||||
A template loop containing the items that were checked out. The following template variables are available from within this loop:<br>
|
||||
<blockquote>
|
||||
<b>purchaseDescription</b><br>
|
||||
The description of this transaction.<br>
|
||||
<br>
|
||||
<b>status</b><br>
|
||||
The status of this item.<br>
|
||||
<br>
|
||||
<b>error</b><br>
|
||||
The error text returned from the payment plugin.<br>
|
||||
<br>
|
||||
<b>errorCode</b><br>
|
||||
The error code returned from the payment plugin.<br>
|
||||
</blockquote>|,
|
||||
lastUpdated => 0,
|
||||
context => q|The body of the help page of the checkout error template.|
|
||||
},
|
||||
'help checkout error template body' => {
|
||||
message => q|Checkout error template|,
|
||||
lastUpdated => 0,
|
||||
context => q|The title of the help page of the checkout error template.|
|
||||
},
|
||||
};
|
||||
|
||||
1;
|
||||
130
lib/WebGUI/i18n/English/CommercePaymentPayFlowPro.pm
Executable file
130
lib/WebGUI/i18n/English/CommercePaymentPayFlowPro.pm
Executable file
|
|
@ -0,0 +1,130 @@
|
|||
package WebGUI::i18n::English::CommercePaymentPayFlowPro;
|
||||
|
||||
our $I18N = {
|
||||
'name' => {
|
||||
message => q|Name|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label in the chekout form of the PayFlowPro module.|
|
||||
},
|
||||
'address' => {
|
||||
message => q|Address|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label in the chekout form of the PayFlowPro module.|
|
||||
},
|
||||
'city' => {
|
||||
message => q|City|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label in the chekout form of the PayFlowPro module.|
|
||||
},
|
||||
'state' => {
|
||||
message => q|State|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label in the chekout form of the PayFlowPro module.|
|
||||
},
|
||||
'zipcode' => {
|
||||
message => q|Zipcode|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label in the chekout form of the PayFlowPro module.|
|
||||
},
|
||||
'email' => {
|
||||
message => q|Email|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label in the chekout form of the PayFlowPro module.|
|
||||
},
|
||||
'cardNumber' => {
|
||||
message => q|Credit card number|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label in the chekout form of the PayFlowPro module.|
|
||||
},
|
||||
'expiration date' => {
|
||||
message => q|Expiration date|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label in the chekout form of the PayFlowPro module.|
|
||||
},
|
||||
'cvv2' => {
|
||||
message => q|Verification number (ie. CVV2)|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label in the chekout form of the PayFlowPro module.|
|
||||
},
|
||||
|
||||
'vendor' => {
|
||||
message => q|Vendor|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label in the configuration form of the PayFlowPro module.|
|
||||
},
|
||||
'partner' => {
|
||||
message => q|Partner|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label in the configuration form of the PayFlowPro module.|
|
||||
},
|
||||
'username' => {
|
||||
message => q|Username|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label in the configuration form of the PayFlowPro module.|
|
||||
},
|
||||
'password' => {
|
||||
message => q|Password|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label in the configuration form of the PayFlowPro module.|
|
||||
},
|
||||
'test mode' => {
|
||||
message => q|Use test mode|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label in the configuration form of the PayFlowPro module.|
|
||||
},
|
||||
'test mode warning' => {
|
||||
message => q|Be sure to set this to 'No' when going live!|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label in the configuration form of the PayFlowPro module.|
|
||||
},
|
||||
'module name' => {
|
||||
message => q|Verisign Payflow Pro|,
|
||||
lastUpdated => 0,
|
||||
context => q|The displayed name of the Payflo Pro payment module.|
|
||||
},
|
||||
|
||||
'invalid name' => {
|
||||
message => q|You have to enter a valid name.|,
|
||||
lastUpdated => 0,
|
||||
context => q|An error indicating that an invalid name has been entered.|
|
||||
},
|
||||
'invalid address' => {
|
||||
message => q|You have to enter a valid address.|,
|
||||
lastUpdated => 0,
|
||||
context => q|An error indicating that an invalid street has been entered.|
|
||||
},
|
||||
'invalid city' => {
|
||||
message => q|You have to enter a valid city.|,
|
||||
lastUpdated => 0,
|
||||
context => q|An error indicating that an invalid city has been entered.|
|
||||
},
|
||||
'invalid zip' => {
|
||||
message => q|You have to enter a valid zipcode.|,
|
||||
lastUpdated => 0,
|
||||
context => q|An error indicating that an invalid zipcode has been entered.|
|
||||
},
|
||||
'invalid email' => {
|
||||
message => q|You have to enter a valid email address.|,
|
||||
lastUpdated => 0,
|
||||
context => q|An error indicating that an invalid email address has been entered.|
|
||||
},
|
||||
'invalid card number' => {
|
||||
message => q|You have to enter a valid credit card number.|,
|
||||
lastUpdated => 0,
|
||||
context => q|An error indicating that an invalid credit card number has been entered.|
|
||||
},
|
||||
'invalid cvv2' => {
|
||||
message => q|You have to enter a valid card security code (ie. cvv2).|,
|
||||
lastUpdated => 0,
|
||||
context => q|An error indicating that an invalid card security code has been entered.|
|
||||
},
|
||||
'invalid expiration date' => {
|
||||
message => q|You have to enter a valid expiration date.|,
|
||||
lastUpdated => 0,
|
||||
context => q|An error indicating that an invalid expiration date has been entered.|
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
||||
375
lib/WebGUI/i18n/English/Subscription.pm
Executable file
375
lib/WebGUI/i18n/English/Subscription.pm
Executable file
|
|
@ -0,0 +1,375 @@
|
|||
package WebGUI::i18n::English::Subscription;
|
||||
|
||||
our $I18N = {
|
||||
'listSubscriptionCodes title' => {
|
||||
message => q|Manage Subscription Codes|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Title of listSubscriptionCodes.|
|
||||
},
|
||||
|
||||
'batch id' => {
|
||||
message => q|BatchId|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Shows up in the table header in listSubscriptionCodes.|
|
||||
},
|
||||
|
||||
'subscription description' => {
|
||||
message => q|Description|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Form label in editSubscription|
|
||||
},
|
||||
|
||||
'manage codes' => {
|
||||
message => q|Manage subscription codes|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|A submenu option in the Subscriptions Admin Console menu.|
|
||||
},
|
||||
|
||||
'delete subscription confirm' => {
|
||||
message => q|Are you sure to delete this subscription?|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Corfirmation question when deleting a subscription.|
|
||||
},
|
||||
|
||||
'subscriptionId' => {
|
||||
message => q|Subscription Id|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Just leave it Subscription Id.|
|
||||
},
|
||||
|
||||
'generate batch' => {
|
||||
message => q|Generate a batch of subscription codes|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|A submenu option in the Subscriptions Admin Console menu.|
|
||||
},
|
||||
|
||||
'subscription name' => {
|
||||
message => q|Subscription name|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Form label in editSubscription|
|
||||
},
|
||||
|
||||
'code' => {
|
||||
message => q|Code|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Shows up in the table header in listSubscriptionCodes.|
|
||||
},
|
||||
|
||||
'delete batch confirm' => {
|
||||
message => q|Are you sure to delete this batch?|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Corfirmation question when deleting a code batch.|
|
||||
},
|
||||
|
||||
'selection used' => {
|
||||
message => q|date of usage between|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Shows up in the selection part of listSubscriptionCodes.|
|
||||
},
|
||||
|
||||
'batch description' => {
|
||||
message => q|Batch description|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Form option in createSubscriptionCodeBatch.|
|
||||
},
|
||||
|
||||
'redeem code' => {
|
||||
message => q|Redeem a subscription code.|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|The title of the URL in displayLogin that points to code redemption.|
|
||||
},
|
||||
|
||||
'selection message' => {
|
||||
message => q|You can make a selection of codes by:|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Shows up in the selection part of listSubscriptionCodes.|
|
||||
},
|
||||
|
||||
'help edit subscription title' => {
|
||||
message => q|Subscription, Add/Edit|,
|
||||
lastUpadated => 1101228391,
|
||||
context => q|The Add/Edit subscription help page title.|
|
||||
},
|
||||
|
||||
'help edit subscription body' => {
|
||||
message => q|A subscription will allow the user a piece of content wich he/she has
|
||||
payed for. The following is the list of properties attached to each
|
||||
Description.<br>
|
||||
<br>
|
||||
<b>Subscription name</b><br>
|
||||
Name of the subscription.<br>
|
||||
<br>
|
||||
<b>Price</b><br>
|
||||
Price to pay for the subscription.<br>
|
||||
<br>
|
||||
<b>Description</b><br>
|
||||
Detailed description of the subscription.<br>
|
||||
<br>
|
||||
<b>Group to subscribe to</b><br>
|
||||
When a user payed the fee, he/she will be added to this group.<br>
|
||||
<br>
|
||||
<b>Subscription period</b><br>
|
||||
This sets the length of one subscribtion term. Ie. You pay every month, or every half year.<br>
|
||||
<br>
|
||||
<b>Execute on subscription</b><br>
|
||||
A (perl) script to call when someone has subscribed and payed.<br>
|
||||
<br>
|
||||
<b>Karma</b><br>
|
||||
The amount of karma wich is added to the user after he/she subscribes.<br>|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|The Add/Edit subscription help page text.|
|
||||
},
|
||||
|
||||
'codes expire' => {
|
||||
message => q|Codes expire per|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Form option in createSubscriptionCodeBatch.|
|
||||
},
|
||||
|
||||
'no association error' => {
|
||||
message => q|You have to associate this batch to at least one subscription.|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|An error that cab occur when creating a code batch.|
|
||||
},
|
||||
|
||||
'subscription duration' => {
|
||||
message => q|Subscription period|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Form label in editSubscription|
|
||||
},
|
||||
|
||||
'creation date' => {
|
||||
message => q|Creation date|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Shows up in the table header in listSubscriptionCodes.|
|
||||
},
|
||||
|
||||
'and' => {
|
||||
message => q|and|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Shows up in the selection part of listSubscriptionCodes.|
|
||||
},
|
||||
|
||||
'subscription group' => {
|
||||
message => q|Subscribe to group|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Form label in editSubscription|
|
||||
},
|
||||
|
||||
'manage subscriptions' => {
|
||||
message => q|Subscriptions|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|A submenu option in the Subscriptions Admin Console menu.|
|
||||
},
|
||||
|
||||
'execute on subscription' => {
|
||||
message => q|Execute on subscription|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Form label in editSubscription|
|
||||
},
|
||||
|
||||
'status' => {
|
||||
message => q|Status|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Shows up in the table header in listSubscriptionCodes.|
|
||||
},
|
||||
|
||||
'noc' => {
|
||||
message => q|Number of codes in batch|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Form option in createSubscriptionCodeBatch.|
|
||||
},
|
||||
|
||||
'selection created' => {
|
||||
message => q|date of creation between|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Shows up in the selection part of listSubscriptionCodes.|
|
||||
},
|
||||
|
||||
'manage batches' => {
|
||||
message => q|Manage subscription code batches|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|A submenu option in the Subscriptions Admin Console menu.|
|
||||
},
|
||||
|
||||
'association' => {
|
||||
message => q|Associate with subscription|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Form option in createSubscriptionCodeBatch.|
|
||||
},
|
||||
|
||||
'no description error' => {
|
||||
message => q|You must enter a description.|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|An error that cab occur when creating a code batch.|
|
||||
},
|
||||
|
||||
'subscription price' => {
|
||||
message => q|Price|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Form label in editSubscription|
|
||||
},
|
||||
|
||||
'dateUsed' => {
|
||||
message => q|Date of usage|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Shows up in the table header in listSubscriptionCodes.|
|
||||
},
|
||||
|
||||
'create batch error' => {
|
||||
message => q|An error has occured:|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Identifies an error in createSubscriptionCodeBatch.|
|
||||
},
|
||||
|
||||
'select' => {
|
||||
message => q|Show selection|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Shows up in the selection part of listSubscriptionCodes.|
|
||||
},
|
||||
|
||||
'edit subscription title' => {
|
||||
message => q|Edit Subscription|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Form label in editSubscription|
|
||||
},
|
||||
|
||||
'add subscription' => {
|
||||
message => q|Add a new subscription|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|A submenu option in the Subscriptions Admin Console menu.|
|
||||
},
|
||||
|
||||
'list codes in batch' => {
|
||||
message => q|List the codes in this batch|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|In listSubscriptionCodeBatches|
|
||||
},
|
||||
|
||||
'delete codes' => {
|
||||
message => q|Delete selected codes|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Shows up in listSubscriptionCodes.|
|
||||
},
|
||||
|
||||
'subscription karma' => {
|
||||
message => q|Karma|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Form label in editSubscription|
|
||||
},
|
||||
|
||||
'create batch menu' => {
|
||||
message => q|Create a batch of subscription codes|,
|
||||
lastUpdated => 1101228391,
|
||||
context => q|Menu name for createSubscriptionCodeBatch.|
|
||||
},
|
||||
|
||||
'help manage subscriptions title' => {
|
||||
message => q|Subscriptions, Manage|,
|
||||
lastUpdated => 0,
|
||||
context => q|The title of the Manage Subscriptions help page.|
|
||||
},
|
||||
|
||||
'help manage subscriptions body' => {
|
||||
message => q|Subscriptions allow you to sell your users group access on a subscription basis. You can use subscriptions to sell content to your users by setting this content only viewable for the group a subscription add people to.|,
|
||||
lastUpdated => 0,
|
||||
context => q|The content of the Manage Subscriptions help page.|
|
||||
},
|
||||
|
||||
'help manage subscription codes title' => {
|
||||
message => q|Subscription, Manage Subscription Codes|,
|
||||
lastUpdated => 0,
|
||||
context => q|The title of the Manage Subscriptions codes help page.|
|
||||
},
|
||||
|
||||
'help manage subscription codes body' => {
|
||||
message => q|A subscription code is a 64 character code that is tied to a set of subscriptions. A user can redeem susch a code, and thus make himself subscribed for one term to all subscriptions the code is tied to, using the 'Redeem a subscription code' link in his account menu. Note that when redeeming a suscription code no money is charged.|,
|
||||
lastUpdated => 0,
|
||||
context => q|The content of the Manage Subscriptions codes help page.|
|
||||
},
|
||||
|
||||
'help create batch title' => {
|
||||
message => q|Subscription, Create Batches of Subscription Codes|,
|
||||
lastUpdated => 0,
|
||||
context => q|The title of the Create Subscription code batch help page.|
|
||||
},
|
||||
|
||||
'help create batch body' => {
|
||||
message => q|Generate a batch of subscription codes.<br>
|
||||
<br>
|
||||
<b>Number of codes in batch</b><br>
|
||||
Number of codes to create<br>
|
||||
<br>
|
||||
<b>Codes expires on</b><br>
|
||||
The code must be used before this date.<br>
|
||||
<br>
|
||||
<b>Associate with subscription</b><br>
|
||||
Which subscription(s) are made with the generated codes.<br>
|
||||
<br>
|
||||
<b>Batch description</b><br>
|
||||
Description of the batch.<br>|,
|
||||
lastUpdated => 0,
|
||||
context => q|The content of the Create Subscription code batch help page.|
|
||||
},
|
||||
|
||||
'help manage batch title' => {
|
||||
message => q|Subscription, Manage Subscription Code Batches|,
|
||||
lastUpdated => 0,
|
||||
context => q|The title of the Manage Subscription code batch help page.|
|
||||
},
|
||||
|
||||
'help manage batch body' => {
|
||||
message => q|Subscription code batches are containers for subscription codes. Subscription codes are always generated in batches, even if there's only one code in a batch. All codes in the same batch share the same properties, except for the status flag.|,
|
||||
lastUpdated => q|The body of the Manage Subscription code batch help page.|
|
||||
},
|
||||
|
||||
'no subscriptions' => {
|
||||
message => q|There are no subscriptions yet. You can add subscriptions by using the 'Add Subscription' option in the menu on the right of the screen.|,
|
||||
lastUpdated => 0,
|
||||
context => q|A message that shows up in manage subscriptions indicating that there are no subscriptions at all.|
|
||||
},
|
||||
|
||||
'redeem code success' => {
|
||||
message => q|You've successfully subscribed to the subscriptions. You can enter another code below.|,
|
||||
lastUpdated => 0,
|
||||
context => q|The success message for the code redemption function.|
|
||||
},
|
||||
'redeem code failure' => {
|
||||
message => q|You've entered a code that's wrong, allready being used or expired. Please enter another code below.|,
|
||||
lastUpdated => 0,
|
||||
context => q|The failure message for the code redemption function.|
|
||||
},
|
||||
'redeem code ask for code' => {
|
||||
message => q|Please enter your subscription code below.|,
|
||||
lastUpdated => 0,
|
||||
context => q|The enter a code message for the code redemption function.|
|
||||
},
|
||||
'selection batch id' => {
|
||||
message => q|batch ID|,
|
||||
lastUpdated => 0,
|
||||
context => q|Shows up in the selection part of listSubscriptionCodes.|
|
||||
},
|
||||
|
||||
'help redeem code template body' => {
|
||||
message => q|The following template variables are available through this template:<br>
|
||||
<br>
|
||||
<b>batchDescription</b><br>
|
||||
The description of the batch tied to the subscription code.<br>
|
||||
<br>
|
||||
<b>message</b><br>
|
||||
The message that gives the result of your action. Depending on what you've done is sais that you can enter a code, you've enterd the worong coe, or that you've successfully redeemed your code.<br>
|
||||
<br>
|
||||
<b>codeForm</b>
|
||||
The form in which the user can enter his subscription code.<br>|,
|
||||
lastUpdated => 0,
|
||||
context => q|The body of the help page of the code redemption template.|
|
||||
},
|
||||
'help redeem code template title' => {
|
||||
message => q|Redeem subscripton code template|,
|
||||
lastUpdated => 0,
|
||||
context => q|The title of the help page of the code redemption template.|
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
89
lib/WebGUI/i18n/English/TransactionLog.pm
Normal file
89
lib/WebGUI/i18n/English/TransactionLog.pm
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
package WebGUI::i18n::English::TransactionLog;
|
||||
|
||||
our $I18N = {
|
||||
'cancel error' => {
|
||||
message => q|An error has occurred while canceling the recurring transaction. Please contact the admin. Error: |,
|
||||
lastUpdated => 0,
|
||||
context => q|An error message that's shown when a subscription cancelation fails.|
|
||||
},
|
||||
|
||||
'cannot cancel' => {
|
||||
message => q|You cannot cancel a non recurring transaction|,
|
||||
lastUpdated => 0,
|
||||
context => q|An error message that's shown when an attempt is made to cancel a non recurring transaction.|
|
||||
},
|
||||
|
||||
'help purchase history template body' => {
|
||||
message => q|The following template variables are available in this template:<br>
|
||||
<br>
|
||||
<b>errorMessage</b><br>
|
||||
A message with an error concerning the cancelation of recuuring payment.<br>
|
||||
<br>
|
||||
<b>historyLoop</b><br>
|
||||
A loop containing the transactions in the transaction history. Within this loop these variables are also available:<br>
|
||||
<blockquote>
|
||||
<b>amount</b><br>
|
||||
The total amount of this transaction.<br>
|
||||
<br>
|
||||
<b>recurring</b><br>
|
||||
A boolean that indicates wheter this is a recurring transaction or not.<br>
|
||||
<br>
|
||||
<b>canCancel</b><br>
|
||||
A boolean value indicating wheter it's possible to cancel this transaction. This is only teh case with recurring payments that haven't been canceled yet.<br>
|
||||
<br>
|
||||
<b>cancelUrl</b><br>
|
||||
The URL to visit when you ant to cancel this recurring transaction.<br>
|
||||
<br>
|
||||
<b>initDate</b><br>
|
||||
The date the transaction was initialized.<br>
|
||||
<br>
|
||||
<b>completionDate</b><br>
|
||||
The date on which the transaction has been confirmed.<br>
|
||||
<br>
|
||||
<b>status</b><br>
|
||||
The status for this transaction.<br>
|
||||
<br>
|
||||
<b>lastPayedTerm</b><br>
|
||||
The most recent term that has been payed. This is an integer.<br>
|
||||
<br>
|
||||
<b>gateway</b><br>
|
||||
The payment gateway that was used.<br>
|
||||
<br>
|
||||
<b>gatewayId</b><br>
|
||||
The ID that is assigned to this transaction by the payment gateway.<br>
|
||||
<br>
|
||||
<b>transactionId</b><br>
|
||||
The internal ID that is assigned to this transaction by WebGUI.<br>
|
||||
<br>
|
||||
<b>userId</b><br>
|
||||
The internal WebGUI user ID of the user that performed this transaction.<br>
|
||||
<br>
|
||||
<b>itemLoop</b>
|
||||
This loop contains all items the transaction consists of. These variables are available:<br>
|
||||
<blockquote>
|
||||
<b>amount</b><br>
|
||||
The amount of this item.<br>
|
||||
<br>
|
||||
<b>itemName</b><br>
|
||||
The name of this item.<br>
|
||||
<br>
|
||||
<b>itemId</b><br>
|
||||
The internal WebGUI ID tied to this item.<br>
|
||||
<br>
|
||||
<b>itemType</b><br>
|
||||
The type that this item's of.<br>
|
||||
<br>
|
||||
<b>quantity</b><br>
|
||||
The quantity in which this item is bought.<br>
|
||||
</blockquote>
|
||||
</blockquote>|,
|
||||
lastUpdated => 0,
|
||||
context => q|The body of the help page of the purchase history template.|
|
||||
},
|
||||
'help purchase history template title' => {
|
||||
message => q|View purchase history template|,
|
||||
lastUpdated => 0,
|
||||
context => q|The title of the help page of the purchase history template.|
|
||||
},
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue