Usm billing EN

Материал из WiKi - UserSide

en | ru

This function is one of the possibilities
to update the activity date of an object

usm_billing - module for organising import of data from billing systems into ERP UserSide using the so-called Universal API

Language of the module: PHP

Current version: see page: Modules

Supported standard billings: uBilling v.0.7.2+, MikBill v.2.8.16+, Carbon Billing v.5.15.06+, ABillS v.0.77.50+, Platex v.7+

Module Status: Free

List of data to be imported *

* - may vary depending on what kind of data the billing system gives you

Tariff Plans

  • name
  • subscription fee
  • daily or monthly subscription fee
  • incoming speed
  • outgoing speed
  • amount of included traffic

Customers

  • account
  • FULL NAME
  • contract number and date
  • personal account number
  • current tariff plan
  • next tariff plan
  • date of last internet activity
  • volume of traffic consumed by the customer during the current month
  • customer's address ( locality, street, house number, house building, flat)
  • IP/MAC-addresses
  • work status in billing
  • customer notes
  • balance
  • credit
  • customer discount
  • 2 phone number
  • individual/legal entity
  • date of connection to the network
  • e-mail address
  • additional customer fields/data (customisable)

Information on installing the module

The usm_billing.zip archive contains the files

usm_billing.php
usm_billing.conf.php-example

1. Allocate a separate (random) directory for the module and place these files in it

2. Allocate a separate directory for the module logs. Give write permissions to this directory.

3. The example configuration file usm_billing.conf.php-example should be renamed to usm_billing.conf.php and make the required changes (the list of parameters is given below) in it

4. Run the module manually several times (*) with the command

php usm_billing.php

It should work without error and return the data:

usm_billing
====================================
 Start module at 2015-11-22 17:32:03
Finish module at 2015-11-22 17:32:14
====================================

* - At the first run - many objects will be pre-created only. The more objects the module imports - the longer it will take. The second and subsequent runs will verify the changed data and only these will be updated. The second run will also take a long time, because after the first run the newly created objects do not contain any data. But the third and subsequent runs will run much faster.

5. Visually verify the completeness of the imported data in the ERP "UserSide"

6. When it is clear that the module works stably - add it to the system cron for periodic operation (specify the necessary paths)

*/10 * * * * php usm_billing.php

Configuration parameters

$billingName         - Billing type [standart|carbon5]
$usersideUrl         - URL to ERP "UserSide"
$usersideApiKey      - API-key of ERP "UserSide"
$billingUrl          - URL to the billing API
$billingId           - Billing number in ERP "UserSide" ("Settings - Billings")
$logPath             - Path for logging
$isSilence           - "Silence Mode" flag (hide the output of information messages from the module to the console)
// It is possible to configure import of additional fields from billing to additional fields of ERP "UserSide" customer (if necessary)
// The $additionalDataMerge array (for userside 3.13 and earlier) or $additionalCustomerDataMerge array (for userside 3.14 and later) is filled in. You can add your own fields. If the field code value is null - import is not performed
// Import is performed into already created additional fields. I.e. beforehand - this additional field must be created in UserSide for the customer's card.
$additionalCustomerDataMerge - Configuring import of additional data/fields

These parameters can be used in all modules of interaction with standard billing (usm_utm5, usm_abills, etc.), as they are based on the current module.

$confIsSkipUpdateAgreementDate    - flag - skip updates of contract date
$confIsDisableCreateAddress       - flag - do not create new address objects when importing data
$confIsSkipDeleteEmptyIp          - flag - do not delete unused IP addresses of customers
$confIsForceDeleteEmptyIp          - flag - forcibly remove unused IP addresses from customers
$confSkipDeleteIp                 - array with the range of IP addresses ignored for deletion
$confIsImportLessPhone            - flag - import empty phone values (delete already filled ones in userside)
$confIsImportLessAddress          - flag - import empty customer address (delete already filled in userside)
$confIsUpdateEmptyLevel           - flag - import empty customer floor (delete in userside already filled in)
$confIsUpdateEmptyEntrance        - flag - import empty entryway of customer (delete in userside already filled)
$confIsImportPasswordToUsPassword - flag - import customer's password from billing into password for login to UserSide personal cabinet
$confIsSkipUpdateDateActivity     - flag - do not update the date of customer's activity in the billing system
$confIsSkipSyncCustomerIsCorporate - flag - do not update the "legal entity" flag for customers
$confIsSkipUnusedAddress          - flag - do not import unused addresses
$isWithoutLog                     - flag - do not create log files
$confAlwaysSetCustomerGroupId     - set group ID for all imported customers 
$confIsUseStreetFullName          - flag - use full name of imported street (with suffix/prefix)
$confIsImportMessage              - flag - import customer messages from billing (where possible)

Using the module in Docker

The Docker-bundle since version 3.16.6 includes a service that includes usm_billing.

The service is configured using environment variables directly in compose.yaml. The names of the environment variables are identical to the names of the configuration variables given in the previous section.

For more advanced configuration, an additional configuration file containing only special variables whose values cannot be set via environment variables can be attached. To do this, in compose.yaml for the usm_billing service, add or uncomment the line in volumes:

- ${ERP_BASE_DIR}/config/usm_billing_config.php:/module/usm_billing_config.php

And change (create) the file in config/usm_billing_config.php in the bandle subdirectory to specify special variables.The first line of this file must necessarily be the line <?php.

To enable periodic launch of the module, you need to uncomment the corresponding line in /etc/cron.d/userside.

You can also run the module outside of the docker bundle. To do this, you must also specify the URL of your USERSIDE in the USERSIDE_API_URL environment variable.