Skip to content

(feat): Adding spending logic for gift cards boost credits minds#4125

Fausto Arcidiacono requested to merge feat/gift-card-spending-4125 into master

Ticket(s) / Related Merge Requests

minds#4125 (closed)

Summary of Changes

Added spending logic for gift cards boost credits

Testing Considerations

Before starting, make sure you have boost credits available for the account you are going to test the feature with.

If you don't have enough boost credits, you can add them by performing the following steps in the minds-engine-sandbox container:

  1. Exec into feat-gift-card-spending-4125-minds-engine-sandbox-cf97dc8758ns8
  2. Run cd /var/www/Minds/engine
  3. Run
source /vault/secrets/env && \
php cli.php GiftCards createTestCard \
--user_guid=<issuer_user_guid> \
--amount=<amount> \
--recipient_user_guid=<recipient_user_guid> \
--payment_type=2
  1. Run
source /vault/secrets/env && \
php cli.php GiftCards claimGiftCard \
--user_guid=<recipient_user_guid> \
--claim_code=<claim_code>

Repeat step 3 and 4 as many times as needed to generate gift cards.

Once you have enough boost credits, you can test the feature by performing the following steps:

Scenario 1 - No boost credits available to spend

  • Go to a post page
  • Open the boost modal
  • Make sure to use the cash payment type
  • When selecting the payment method from the dropdown, notice that the Boost Credits option is not available

Scenario 2 - Boost credits available to spend but not enough to cover the boost

  • Go to a post page
  • Open the boost modal
  • Make sure to use the cash payment type
  • When selecting the payment method from the dropdown, notice that the Boost Credits option is available
  • Make sure to select a boost that costs more than the boost credits available
  • Select the Boost Credits option from the payment method dropdown
  • Click on the Boost button
  • Notice that the boost fails and the error message Insufficient credits to complete this transaction is displayed

Scenario 3 - Boost credits available to spend and enough to cover the boost

  • Go to a post page
  • Open the boost modal
  • Make sure to use the cash payment type
  • When selecting the payment method from the dropdown, notice that the Boost Credits option is available
  • Make sure to select a boost that costs less than the boost credits available
  • Select the Boost Credits option from the payment method dropdown
  • Click on the Boost button
  • Notice that the boost succeeds and the boost credits are deducted from the user's account

Scenario 4 - Refund boost created with boost credits

  • Login as the sandbox admin user (credentials can be found in the Bitwarden)
  • Go to the admin panel
  • Go to the Boosts page
  • Find the post that was boosted in the previous scenario
  • Reject the boost
  • Login as the user that boosted the post
  • Notice that the boost credits were refunded to the user's account

Deployment Considerations

Some table alterations for gift card transactions table

Regression Scope

Platform Affected (web, mobile, etc)

Developer Testing Completed

Screenshots / Screen Recording

Does this impact

  • Localization
  • Dark/light mode
  • Guest mode

Definition of Done Checklist

  • The Acceptance Criteria has been met
  • Code is tested: Testing includes unit/spec, E2E/automated and manual testing
  • Merge requests description has been filled out
Edited by Fausto Arcidiacono

Merge request reports