Skip Navigation

Using Billing Service (deprecated)

The com.sabre.edge.cf.billing.BillingService provides a capability of storing the billing transaction details. Red App can define logical task, in other words define any specific flow within the application, for which the user can get an invoice. The service helps with storing the details only, so the Red App is responsible for defining the action for the billing. Once this action is completed then the billing service can be called to store the transaction in repository.

Dependencies and Classes

Sabre Red 360 has defined some dependencies and classes that are required to use the Billing API. These requirements follow.

Minimal Dependencies

  • com.sabre.edge.cf.core

  • com.sabre.edge.cf.model

  • com.sabre.edge.cf.billing

Classes

  • If your Red App does not contribute to the UI, your Activator must extend AbstractEdgeBaseNonUIPlugin.

  • If your Red App does contribute to the UI, your Activator must extend AbstractEdgeBasePlugin.

  • You must use the getServiceReference() method to get a reference to the SR360 communication bus interface com.sabre.edge.cf.core.registry.service.ISRWCommunication.

  • Data model class is the com.sabre.edge.cf.billing.data.BillingTransaction where the details of billing transaction should be provided.

Using the Billing service

  1. Create your redapp.xml configuration file and add the following authorization entry to the file to use the Billing service: <Authorization name="com.sabre.edge.cf.billing.BillingService" threshold="10" metric="tpm" />

  2. Obtain a reference to the ISRWCommunication service: ISRWCommunication COM = Activator.getDefault().getServiceReference(ISRWCommunication.class);

  3. Create an instance of BillingRequest class, providing the BillingTransaction details.

  4. Create an instance of BillingServiceClient class and call send() method with an instance of BillingRequest class.

  5. Retrieve a response to the ClientResponse<BillingResponse> reference.   This class provides these methods:

    • isSuccess() to check for status - if it returns false, then given transaction wasn’t stored.

    • getErrors() to retrieve errors (if occurred)

The following code listing demonstrates how to use Billing service:

BillingTransaction billingTransaction = new BillingTransaction();
billingTransaction.setTransactionId("ID");
billingTransaction.setEventName("nameOfEvent");
billingTransaction.setComponent("component");
BillingServiceClient client = new BillingServiceClient(COM);
BillingRequest request = new BillingRequest(billingTransaction);
ClientResponse <BillingResponse> response = client.send(request);
if (!response.isSuccess())
{
      for (IError error : response.getErrors())
      {
            // process error
      }
}

 

Note
You can find error codes retrieved in SRWRuntime Error Codes  section.

 

Note
To use Billing from Javascript see Accessing Billing API from JavaScript. == Billing transaction details The transaction details have to have three mandatory fields:

transactionId - assigned by the business to uniquely designate or refer to a billable Sabre Red 360 transaction within a particular scope of operations eventName - an Application Event Name is the word or words that are generally used to identify (or refer to) an action or occurrence detected by the Sabre Red 360 to logically group a billable transaction component - an Application Component Name is the word or words that are generally used to identify (or refer to) a set of related functions or services in a Sabre Red 360 that are a billable transactions

The BillingTransaction may be also specified with additional information - optional fields:

  1. description - description text is a freeform narrative that defines the business logic which relates to billing transaction

  2. unit - a Transaction Unit Name is the word or words that are generally used to identify (or refer to) the type of service transaction. For example: hotel reservation. currency - a Billing Currency Code is the set of letters (as specified in ISO 4217 ) that is an abbreviation or mnemonic representing the name of the particular monetary exchange unit used for a given payment transaction. For example: USD, EUR, JPY. It is required to be set whenever gross, fee or netAmount is set.

  3. gross - a numeric monetary value, expressed in a given transactions billing currency code, that represents the total billable amount for a given transaction. Note that all monetary values are represented as Integers to prevent rounding problems related to floating point precision. To represent $12.10 you should set gross to 1210 and currency to USD.

  4. fee - a numeric monetary value, expressed in transitions billing currency code, that application developer assesses on the user/agency of the Sabre Red 360. Note that all monetary values are represented as Integers to prevent rounding problems related to floating point precision. To represent $12.10 you should set fee to 1210 and currency to USD.

  5. netAmount - a Billing Net Amount is a numeric monetary value, expressed in transactions billing currency code, that represents the transaction amount minus the billing fee amount. Note that all monetary values are represented as Integers to prevent rounding problems related to floating point precision. To represent $12.10 you should set netAmount to 1210 and currency to USD.

  6. quantity - is the number of billable Sabre Red 360 services associated with a given transaction

  7. refAppRefCode - an Application Reference Code represents the logical grouping of Sabre Red 360 applications

  8. sabreRLoc - a Sabre Record Locator Code represents a specific Sabre travel record which is tied to this billable transaction

Note
Read the JavaDoc of BillingTransaction class to see other constraints - text field length etc.  

Debug mode

While implementation is possible to check the results of Billing service - all the transactions will be stored within the local CSV file. The file will be stored within <WORKING_DIRECTORY>\.metadata\.plugins\com.sabre.edge.cf.billing.debug.mode\billing_yyyy_MM_dd.csv

To run the application in the debug mode the com.sabre.edge.cf.billing.debug.mode plug-in should be add to the running configuration. By default, it’s in the target platform. It’s strongly recommended to have this plug-in run when testing.

List of errors for Billing Transaction Request

List of common error codes can be found here. For all other errors please contact redappssuport@sabre.com sending your Red App ID and the error code you are getting.