Billing Integration Testing Cases

There is a set of cases and data that should be obligatory tested:


Here is a detailed instruction on how to test your billing system with steps you should perform and the results you should get.

Note: Upgrading and refilling should be tested not just for active users, but also for deactivated and destroyed.

Upgrading New Account

1. Sign up for a new trial account at app.{provider_domain}.

Navigate to JCA > Users.

Find your newly registered account and make sure that it belongs to the trial users group.


Expected result: trial account should be created.

2. Click Upgrade trial account button at the dashboard.


Expected result: first step of trial-to-paid upgrade wizard should be opened in Upgrade to paid account window.

3. Select appropriate country and fill in all the required fields.

Check the following items:

  • VAT number field accepts the correct VAT numbers according to the selected country;
  • Additionally set extra fields and their filling rules correspond to the system settings in jbilling > account.convert.json.config parameter at JCA.

Press Create Account button.

Expected result:
  • All the required fields should be correctly validated.
  • You should be forwarded to the second page of trial-to-paid upgrade wizard after clicking Create account button.
  • You should receive email with correct credentials to billing system and corresponding URL.

4. Then check the following parameters:

  • All payment methods, stated in JCA > System settings > jbilling > external.billing.plugin.json.config parameter exist in Jelastic dashboard (Balance > Payment Methods menu item) and are available during trial-to-paid account upgrade.

  • Icons, captions and hints for payment methods are correct and changed automatically in case of dashboard language switching.

  • All recharge cards, registered at JCA > Billing > Recharge cards section are present in Refill Balance tab.

  • VAT percent is calculated properly according to the rules, defined in billing system.

  • If the value of the jbilling >pba.use_eu_tax_calculation parameter (in PBA system) is true, then VAT percent should be calculated according to the European rules.

5. Select Payment Method and Recharge card, click Submit Payment button. Make sure that confirmation dialog is opened and the following payment window is displayed in a separate browser's frame.


Expected result: A new order should be created in the admin panel of billing system. Notification email about order is sent to the user.

6. Fill in your payment information (Credit card, Paypal, etc) and confirm the payment.

Expected result:
  • A new window for Credit card data filling should be opened (in case of its choosing).
  • You should receive two emails: one about upgrading to billing account and another one with credentials to the admin panel of billing system.
  • After payment completion money should be transferred to the user’s account. The amount of money must comply with the chosen recharge card.
  • A new fund operation should appear for the particular account in JCA > User > Funding history.

Checking Account's Info at the Admin Panel

1. Upgrade a new trial account as it was described in 2-5 steps of the Upgrading New Account section.

2. Navigate to the Admin Panel of your billing system.

Expected result: Sign in form should be opened.

3. Sign in with credentials specified in JCA > System Settings > jbilling section: external.billing.password and external.billing.login parameters.


Expected result: Billing system’s Admin Panel should open.

4. Find your new upgraded account and look through the account's info.


Expected result: all the fields, filled in while account upgrading, should be shown in account's info. Data in the info should match the entered in the fields.

Refill Balance

1. Create billing account as it was described in 2-5 steps of the Upgrading New Account section.

2. Navigate to the Balance  > Refill Balance menu item in the dashboard.


Expected result: Refill balance tab should open.

3. State Sum adjustment using the slider and choose the Payment method.

Check whether all recharge cards at JCA > Billing  > Recharge cards section are present in dashboard Balance > Payment Methods menu item.

Click Submit Payment button.


Expected result: you should receive payment order and invoice (for WHMCS) with chosen sum to pay via email.

4. Go to the Admin Panel of your billing system and log in as described in step 3 of Checking Account's Info at the Admin Panel section.


5. Find your account and look for a newly created order in the Orders tab.

Expected result: A new order should be displayed. 

Auto Refilling

Note: auto-refill option is not currently enabled for WHMCS billing system.

A. Enable/Disable Auto-Refill


  • while account upgrade

1. Repeat 1-3 steps of Upgrade New Account section.

2. In the opened second page of Upgrade to paid account wizard choose the payment method, state the sum of the first refilling using the slider, and tick Auto-refill line at the bottom of window. Click Submit.


Complete the account replenishment.

Expected result: Balance should be refunded. The chosen via slider sum will be used for all further auto refillings.

3. Click Balance > Configure auto-refill menu item in the dashboard.


Expected result: Auto-refill tab should open. The following message should appear at the top of the tab: "Auto-refill is currently active. Click here to disable auto-refill, or edit the settings below if you want to make changes".


4. Click on the following link in this message:
Click here to disable auto-refill”

Expected result: auto refilling should be disabled.

  • while account refilling

1. Repeat 2-3 steps of Refill Balance section. While performing the third step, tick the Auto-refill when my balance falls below line.


Complete the payment.

Expected result: Balance should be refunded. The chosen via slider sum will be used for all further auto refillings.

2. Open Auto-refill tab.

Expected result: The following message should be displayed at the top of the tab: "Auto-refill is currently active. Click here to disable auto-refill, or edit the settings below if you want to make changes".



3. Click on the following link in this message:
Click here to disable auto-refill”

Expected result: auto refilling should be disabled.

  • setting auto-refill separately

1. Click Balance > Configure auto-refill menu item in the dashboard.


Expected result: Auto-refill tab should open. 


2. State
Sum adjustment using the slider and choose the Payment method.

Choose the frequency of refilling and click Confirm.

Agree with the statement in the opened confirmation window.


Open
Auto-refill tab again.

Expected result: The following message should appear at the top of the tab: "Auto-refill is currently active. Click here to disable auto-refill, or edit the settings below if you want to make changes".


3. Click on the following link in this message:
Click here to disable auto-refill”

Expected result: auto refilling should be disabled.

4. Repeat auto refill settings for each condition separately - weekly, monthly, and when balance is less than the stated sum.


Expected result: the same as in the 2nd step.

B. Auto-Refill Applying


1. Click Balance > Configure auto-refill menu item in the dashboard.


Expected result: Auto-refill tab should open. 


2. Specify
Sum adjustment using the slider and choose the Payment method.

State the value of Balance less than auto-refill option a bit lower than your current balance and click Confirm.

Wait for the 15th minute of the next hour with running environment that consumes some resources. Check the balance.

Expected result:
Balance should be refilled as you pay for the resource consumption on the hourly basis. It means that at the beginning of each hour some sum (according to your resource usage) should be withdrawned from your balance, amount of funds will become less than stated as auto-refilling limit and, as a result, balance will be refilled automatically.

3. Check whether auto refilling is not performed too often: autorefill orders should be created not more frequently than value of level.autopay.delay.hours parameter (System Settings > jbilling section of JCA). Also orders shouldn’t be created at all if the previous autorefill order wasn’t paid.  

Post-payment

1. Upgrade newly created account and change its group to post via JCA (detailed instruction is described here)

Expected result: account should become post without any problems.

2. Navigate back to the Jelastic dashboard and create any environment, which consumes some resources in order to get billing history in an hour.

3. Access Jelastic database and make the following request:


USE hivext_jbilling;
UPDATE billing_history AS bh
INNER JOIN environment AS e ON bh.environment_id = e.id
INNER JOIN account AS a ON e.account_id = a.id
SET  
startDate = DATE_SUB(NOW(), interval 1 MONTH),
endDate = DATE_SUB(NOW(), interval 1 MONTH),
is_withdrawn = 0,
cost=10,
usedCloudletsAmount=1,
fixedCloudletsAmount=1,
fixedCloudletsCost=1


where

a.uid = {user_id};

Note that you need to substitute a.uid value with the ID number of your newly upgraded user.

4. Open JCA admin panel and navigate to the System Settings > jbilling section.

Find the qjob.invoice.cron_schedule and qjob.invoice_checker.schedule parameters and change their values to the 0 0/10 * * * ?


Expected result: A new invoice should be received via email in 10 minutes (as stated in parameter). The balance should be charged.

4. Change values of the following parameters back to the default:

qjob.invoice.cron_schedule: 0 0 0 1 * ? (the first day of each month at twelve o’clock)
qjob.invoice_checker.schedule: 0 0 0/1 1/1 * ? * (every hour)

It is recommended to track the appliance of this parameters at the beginning of the next month too. Don’t forget to remain a running environment at the dashboard.


Expected result: A new invoice should be received via email at the beginning of the next month. The balance should be charged.

Custom Testing

The following sets of tests should be performed only if you have billing system mentioned in the test section heading.

A. Invoice Preview Option (for WHMCS and PBAS)


1. Repeat steps 1-3 of the Upgrading New Account section.

2. Click Balance > View invoices at the Jelastic dashboard.


Expected result: A new window of billing system Admin Panel should open.

3. Check all the information about account owner.

Expected result: All the information entered while account upgrade should be displayed.

B. Balance Refilling through WHMCS/PBAS/PBA Account Panel


1. Register a new Jelastic account and sign in to the Jelastic dashboard with its credentials.

2. Open JCA panel and navigate to the Users section. Find your account and change its group to trial (if it isn’t yet).

3. Upgrade the account via dashboard and check account’s group in JCA.


Expected result: account's group should become billing.

4. Check the email you’ve received while account upgrade.

Expected result: Email should contain the credentials to the billing system’s Admin Panel.

5. Go to the account panel of your billing system and create a new order.

6. Use testing credit card or ask billing system’s administrator to accept the order (in other words, “pay” the order).

Expected result: Order’s status should be paid.

7. Navigate back to the Jelastic dashboard and check the balance.

Expected result: Balance should be refilled.