Skip to content

Commit

Permalink
limit the use of vouchers created to a single use
Browse files Browse the repository at this point in the history
  • Loading branch information
bennanis committed Nov 25, 2024
1 parent b6f9fd9 commit 1a8a0fc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions SpmWebHook/SpmVouchers.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ public static function createVoucher( Request $request )
$content = $request->getContent();
parse_str($content, $body);

// $body = json_decode( $content, true );

$defaultCurrency = CurrencyQuery::create()->findOneByByDefault(true)->getCode();
$defaultLocal = LangQuery::create()->findOneByByDefault(true)->getLocale();

Expand Down Expand Up @@ -168,13 +166,13 @@ public static function createVoucher( Request $request )
$coupon->setIsEnabled( 1 );
$coupon->setStartDate( $startDate );
$coupon->setExpirationDate( $expirationDate );
$coupon->setMaxUsage( -1 );
$coupon->setMaxUsage( 1 );
$coupon->setIsCumulative( $isCumulative );
$coupon->setIsRemovingPostage( $isRemovingPostage );
$coupon->setIsAvailableOnSpecialOffers( 0 );
$coupon->setIsUsed( 0 );
$coupon->setSerializedConditions( base64_encode( json_encode( $condition ) ) );
$coupon->setPerCustomerUsageCount( 0 );
$coupon->setPerCustomerUsageCount( 1 );
$coupon->setCreatedAt( new \DateTime() );
$coupon->setUpdatedAt( new \DateTime() );
$coupon->setVersion( 0 );
Expand Down

0 comments on commit 1a8a0fc

Please sign in to comment.