I want to make a simple wallet like functionality for Drupal commerce 8 module for my website. I researched how promotions work in drupal commerce. To adjust the price promotions use adjustment constructor.
$order->addAdjustment(new Adjustment([ 'type' => 'promotion', // @todo Change to label from UI when added in #2770731. 'label' => t('Discount'), 'amount' => $adjustment_amount->multiply('-1'), 'percentage' => $this->getPercentage(), 'source_id' => $promotion->id(), ]));
In there we have type and source_id. My question is that, if I want to have a custom discount which will be like a user have some coins in his wallet and can use it to purchase (default promotions can’t be used because it offers either fixed amount or percentage type but I need dynamic amount to be filled by customer), so do I need to create a new entity type like promotions or I can pass any string in type and source will come from my custom table where I will manage coins of users?