Creating Subscriber Ids

All,

I hope this community grows with wider contributions. I have just started looking at BilRun, more on an evaluation basis at this stage. My initial observations are that it is well structured, does the fundamental things required for a billing system (rating, discounting and invoicing).

However, attempting to create a PoC, I have found the documentation lacking in some aspects - especially how to model the common use cases.

Question 1
When you create a customer and a subscription with a set of services are associated to this customer, the subscriber_Id seems to be system generated (a number starting and incrementing by 1), So when you want to test the CDRs, how do you correlate the CLI in the incoming CDR to the subscriber? I had assumed that the subscriber id would be the CLI.

Question 2
I haven’t started looking at the apis (list looks great), but is there a Postman prescript to calculate the HMAC?

Thanks and regards,
Satinder

Hi Satinder

Thank you for using BillRun.

For question #1 - you can match the field in the CDR to field in the subscriber entity (field can also be custom field).

For question #2 - Please share the code that you’ve used. We will share postman soon.

Thanks,
Ofer

  1. I tried the exact code as listed in documentation for Python. I have also tried this python code

satinderpahwa@GO001001 billrun-docker % clear

satinderpahwa@GO001001 billrun-docker % python3

Python 3.7.3 (default, Apr 7 2020, 14:06:47)

[Clang 11.0.3 (clang-1103.0.32.59)] on darwin

Type “help”, “copyright”, “credits” or “license” for more information.

import requests

import hashlib

import hmac

import json

import time

secret = b’fd0bad92f692b0b9bc969086344e550d’

timestamp = str(int(time.time()))

id=‘1’;

params = ‘{“t”:"’ + timestamp + ‘",“sid”:"’ + id + ‘"}’

message = str.encode(params)

signing = hmac.new(secret, message, hashlib.sha512)

sig = signing.hexdigest()

getParams = ‘t=’ + timestamp + ‘&sid=’ + id + ‘&sig=’ + sig

url = 'http://localhost:8080/billapi/subscribers/get?’ + getParams

r = requests.get(url)

r.content

b’{“status”:0,“code”:17577,“message”:“Input parsing error”,“display”:{“code”:0,“desc”:“General error.”}}’

url
http://localhost:8080/billapi/subscribers/get?t=1596553150&sid=1&sig=45298e05cdeff56de873159279ceae61321c35a9fa20ded0f889806476d5c4ed4de13f37e602a813ac73722949fed33e4a3cde6515e2638c115f6fb28a120286’

Hi

The code you put is not identical to the one in our documentation: https://docs.bill.run/en/api/security#python-example

The query structure should be as follows:
https://test.billrun.cloud/billapi/accounts/get?query={“sid”:1}&page=0&size=1&t=XXXX&sig=YYYY

Please check and feedback.

Thanks, Ofer


I get the same message from the code in documentation. When I paste it here the underscores disappear - so tried to paste a picture,

Please put query argument with empty stringify object {}, means adding to the URL:

&query={}

It should be also hashed and order of the variable is important to the hash.