update usedBy when redeeming subscription code
This commit is contained in:
parent
475a885146
commit
ef2727f6f5
2 changed files with 7 additions and 6 deletions
|
|
@ -519,8 +519,9 @@ sub redeemCode {
|
|||
$self->apply;
|
||||
|
||||
# Set code to Used
|
||||
$session->db->write("update Subscription_code set status='Used', dateUsed=? where code =?", [
|
||||
$session->db->write("update Subscription_code set status='Used', dateUsed=?, usedBy=? where code =?", [
|
||||
time,
|
||||
$self->session->user->userId,
|
||||
$code,
|
||||
]);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -143,8 +143,8 @@ my $batchId = $session->db->setRow( 'Subscription_codeBatch', 'batchId', {
|
|||
});
|
||||
|
||||
$mech->get_ok( $sku->getUrl( 'func=listSubscriptionCodeBatches' ) );
|
||||
$mech->text_contains( "Sign up to get your paycheck!" );
|
||||
$mech->text_contains( "Sign up to get fired!" );
|
||||
$mech->content_contains( "Sign up to get your paycheck!" );
|
||||
$mech->content_contains( "Sign up to get fired!" );
|
||||
$mech->submit_form_ok( {
|
||||
fields => {
|
||||
selection => "dc",
|
||||
|
|
@ -153,7 +153,7 @@ $mech->submit_form_ok( {
|
|||
},
|
||||
}, 'limit subscription code batches' );
|
||||
$mech->content_lacks( "Sign up to get your paycheck!" );
|
||||
$mech->text_contains( "Sign up to get fired!" );
|
||||
$mech->content_contains( "Sign up to get fired!" );
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -229,7 +229,7 @@ $mech->submit_form_ok({
|
|||
my $i18n = WebGUI::International->new($session, "Asset_Subscription");
|
||||
$mech->content_contains( $i18n->get('redeem code success') );
|
||||
|
||||
my %redeemed = $session->db->quickHash( "SELECT * FROM Subscription_code WHERE code=?", [ $codeId ] );
|
||||
my %redeemed = $session->db->quickHash( "SELECT * FROM Subscription_code WHERE code=?", [ $codes->[0]{code} ] );
|
||||
is( $redeemed{status}, 'Used', "status updated" );
|
||||
is( $redeemed{usedBy}, $mech->session->user->userId, "used by updated" );
|
||||
cmp_ok( $redeemed{dateUsed}, '>=', time, "dateUsed updated" );
|
||||
cmp_ok( $redeemed{dateUsed}, '>=', time - 10, "dateUsed updated" );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue