The functionality of Subscription is implemented by product-manager.

It‘s main features are below:

  1. Subscription Plan

  2. Subscription Operations

  3. Customer Subscription

  4. Customer Subscription Transactions

  5. Customer Subscription Usage

  6. Free Subscription

  7. Bonus Operations

Brief introduction of product-manager

Product different from product of TM, it’s meaning is Subscription as product. For now, it contains 3 different levels, and in each level, we have several types of free operations. Set up initial plans .

These free operations will be used when customer dealing with transactions, or customer will pay for that operation. Subscription will be renewal each month, and customers can choose to upgrade or downgrade subscription. After customer complete challenge missions, we will give customer bonus operations. Those bonus operations will be used firstly. Challenge missions will also provide free subscriptions, this means if customer have free subscriptions, next renewal of subscription will be free (once or more depends on free subscription times).

Key features

Subscription Plan

Subscription plan is a system level template, it maintains basic info of 3 different levels. Like name, monthly fee amount, etc.

Subscription operations

There have several operations for back transactions, some of them will need extra fee. After purchase one subscription plan, customer will get free operation usage times depends on the level of subscription plan. Customer may also get bonus operations after complete challenge missions, which will introduce later.

When customer dealing transactions, TPM will invoke this micro service. This service will check if customer have active subscription, bonus operations or free operation usages. If so, operation usage record will be added, otherwise, customer must pay extra fee for that transaction, this feature will discuss later at Subscription operation usage.

Customer Subscription

When customer onboarding, he/she needs to choose one of 3 subscription levels. System will generate customer subscription record for him/her automatically. Default status will be inactive, customer could pay for subscription now or at most 7 days later.

Renewal

Customers need to pay for subscription monthly, and the renewal date (aka auto debit date) depends on the date he/she choose at first subscription charge date. If it’s before or equal to 28th of that month, the renewal day will be the same date of next month. If it’s later than 28th, the next renewal date will be set to 28th of next month.

System will automatically charge subscription fee from main account if it has enough money, otherwise, will create a loan to pay for subscription fee. (Schedule to charge monthly haven’t implemented yet!)

Customer Subscription Operation Usage

As we discussed before, when customers dealing with transaction, he/she will have several times of free operations. The count of free operation is based on the number of bonus operations and the level of subscription.

When commit a usage of operations, method now will check the bonus operation first, if it’s not enough times then, the rest times of subscription operations will be considered. After that if there still have operation usage, we will calculate extra fee the customer has to pay.

The formula of extra fee calculate is ((perOperationFee + percentageFee * operationAmount) * nonFreeUsedNow.toBigDecimal()).setScale(2, RoundingMode.HALF_UP)

After customer committed operation usage, system will record this usage detail for rest operation usage calculation.

The process of calculates rest of operation usage times is following below steps:

  1. Select each operation type and the sum of times used of each operation by current customer id and used at is greater than the last renewal date.

  2. Subtraction each subscription plan’s operation times by used times

Customer subscription transaction

Each time when user pay for subscription manually or automatically, current solution is sending a posting to thought machine, but not wait for the result of TM posting, it changes the status of customer subscription immediately. And the listener which listen to TM posting process result is just record a fee transaction with credit to false. This will cause a bug if the result of TM posting failure. We have raised it to VL and waiting for them to give a better implementation such as record a pending status of transaction when post a posting message to TM and change the status finally when result of TM posting is successful.

And for waive subscription fee, we will also create a subscription fee transaction record, it’s amount/currency and customer subscription id are the same as original transaction but set credit to true. After this, the original transaction will update revert by to this waive fee transaction.

Free subscription

This part is an extension of challenge. If customers complete a mission which reward includes free subscriptions, we will record a free subscription with used times. This means next time when customers want to pay for their subscription renewal fee, he or she will no need to pay any cash for that just minus one free subscription used time.

Bonus Operations

It’s like free subscription will be given to customers when they complete a mission which rewards include bonus operations. When customers commit a subscription operation usage, first we will check if he has enough bonus operations. If so, will not use any subscription operation usage times, otherwise we will use subscription operation or ask them to pay more extra transaction fee.

Swagger On Brave

The swagger page of brave env is here: https://product-manager.apps.brave.safibank.online/swagger/views/swagger-ui/#/