Skip to content

Commit

Permalink
update service provider
Browse files Browse the repository at this point in the history
  • Loading branch information
repl6669 committed Apr 6, 2024
1 parent dac06c0 commit b0ca3e6
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/LunarRewardsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\ServiceProvider;
use Lunar\Models\Currency;

class LunarRewardsServiceProvider extends ServiceProvider
{
Expand Down Expand Up @@ -37,14 +38,36 @@ public function register(): void
fn () => new LunarRewards,
);

// Register the reward points currency.
$this->app->singleton(
'lunar-rewards-currency',
fn () => new Currency([
'code' => Config::get('wallet.default_currency', 'RP'),
'name' => 'Reward Points',
'exchange_rate' => 1,
'decimal_places' => 0,
'enabled' => true,
]),
);

// Register the reward points calculator.
$this->app->singleton(
\Dystcz\LunarRewards\Domain\Rewards\Contracts\RewardPointsCalculator::class,
fn () => new (Config::get(
'lunar-rewards.reward_point_calculator',
'lunar-rewards.rewards.reward_point_calculator',
\Dystcz\LunarRewards\Domain\Rewards\Calculators\RewardPointsCalculator::class,
)),
);

// Register coupon code generator.
$this->app->singleton(
\Dystcz\LunarRewards\Domain\Discounts\Contracts\CouponCodeGenerator::class,
fn () => new (Config::get(
'lunar-rewards.rewards.coupon_code_generator',
\Dystcz\LunarRewards\Domain\Discounts\Generators\CouponCodeGenerator::class,
)),
);

}

/**
Expand Down

0 comments on commit b0ca3e6

Please sign in to comment.