9 Billing - transaction options



9.1 Payment options available

To use Bango's test payment provider 'TestPay' to test these scenarios generate a userId using the following details:

identificationMethodKey

GBR_BANGO
MSISDN447710900120

Test

Action

Expected result

1

Check for available payment options before starting a transaction

Send a valid OPTIONS request to https://api.bango.net/v5/transaction

E.g.

{
    "bangoUserId": "123456789",
    "externalTransactionId": "{your-transaction-id}",
    "paymentMethods": 
    [
        "OPERATORBILLING",
    ],
    "paymentItems":
    [
        {
            "priceList":
            [
                {
                    "grossAmount": "3.00",
                    "currencyIso3": "USD",
                    "financialBreakdown":
                    {
                        "taxAmount": "0.00",
                        "shippingAmount": "0.00"
                    }
                }
            ],
            "itemName": "Item title",
            "itemDescription": "Item description",
            "itemCategory": "1",
            "externalPaymentItemId": "{your-payment-item-id}",
            "submerchantReferenceKey": "{your-submerchant-reference-key}"
        }
    ],
    "extensionData":
        {
        }
}


An HTTP response code 200 (OK) should be returned with the following body:

{ 
    "responseCode": "OK", 
    "responseMessage": "Success.",
    "availablePaymentMethods":
    [
        {
            "type": "OPERATORBILLING",
            "key": "{network-name}",
            "description": "Direct operator billing",
            "parameters":
            {
            }
        }
    ]
}


9.2 Not available

This scenario can be tested using Prefer Headers.

Test

Action

Expected result

1

Start a transaction

Send a valid OPTIONS request to https://api.bango.net/v5/transaction


Include the following headers in the request:

  • Prefer:status=202
  • preference-extension:responseCode=NOT_AVAILABLE


An HTTP response code 202 (Accepted) should be returned with the following body:

{ "responseCode": "NOT_AVAILABLE", "responseMessage": "No valid payment methods were found." }


9.3 Price not supported

This scenario can be tested using Prefer Headers.

Test

Action

Expected result

1

Start a transaction

Send a valid POST request to https://api.bango.net/v5/transaction


Include the following headers in the request:

  • Prefer:status=202
  • preference-extension:responseCode=PRICE_NOT_SUPPORTED


An HTTP response code 202 (Accepted) should be returned with the following body:

{
  "responseCode": "PRICE_NOT_SUPPORTED",
  "responseMessage": "Price not supported on suggested payment methods."
}


9.4 User exceeded limit

This scenario can be tested using Prefer Headers.

Test

Action

Expected result

1

Start a transaction

Send a valid POST request to https://api.bango.net/v5/transaction


Include the following headers in the request:

  • Prefer:status=202
  • preference-extension:responseCode=USER_EXCEEDED_LIMIT


An HTTP response code 202 (Accepted) should be returned with the following body:

{
  "responseCode": "USER_EXCEEDED_LIMIT",
  "responseMessage": "User exceeded limit on suggested payment methods."
}


9.5 Bad request

This scenario can be tested using Prefer Headers or forcing an error.

Test

Action

Expected result

1

Start a transaction

Option 1: Send a valid POST request to https://api.bango.net/v5/transaction


Include the following headers in the request:

  • Prefer:status=400
  • preference-extension:responseCode=BAD_REQUEST


Option 2: Make a request with any malformed or invalid JSON body.


E.g.:

  • Syntax errors
  • Missing / invalid parameters

An HTTP response code 202 (Accepted) should be returned with the following body:

{
  "responseCode": "BAD_REQUEST",
  "responseMessage": "Invalid request."
}


9.6 Invalid bangoUserId

Test

Action

Expected result

1

Send an OPTIONS request with an invalid bangoUserId to https://api.bango.net/v5/transaction

E.g.

{
    "bangoUserId": "1sdvdv9",
    "externalTransactionId": "{your-transaction-id}",
    "paymentMethods": 
    [
        "OPERATORBILLING",
    ],
    "paymentItems":
    [
        {
            "priceList":
            [
                {
                    "grossAmount": "3.00",
                    "currencyIso3": "USD",
                    "financialBreakdown":
                    {
                        "taxAmount": "0.00",
                        "shippingAmount": "0.00"
                    }
                }
            ],
            "itemName": "Item title",
            "itemDescription": "Item description",
            "itemCategory": "1",
            "externalPaymentItemId": "{your-payment-item-id}",
            "submerchantReferenceKey": "{your-submerchant-reference-key}"
        }
    ],
    "extensionData":
        {
        }
}


An HTTP response code 200 (OK) should be returned with the following body:

{
  "responseCode": "INVALID_BANGOUSERID",
  "responseMessage": "Invalid bangoUserId."
}


9.7 Unauthorized

This scenario can be tested using Prefer Headers.

Test

Action

Expected result

1

Start a transaction

Send a valid POST request to https://api.bango.net/v5/transaction


Include the following header in the request:

  • Prefer:status=401

An HTTP response code 202 (Accepted) should be returned with the following body:

{
  "responseCode": "UNAUTHORIZED",
  "responseMessage": "Invalid access credentials."
}


9.8 Internal Error

This scenario can be tested using Prefer Headers.

Test

Action

Expected result

1

Start a transaction

Send a valid POST request to https://api.bango.net/v5/transaction


Include the following header in the request:

  • Prefer:status=500

An HTTP response code 202 (Accepted) should be returned with the following body:

{
  "responseCode": "INTERNAL_ERROR",
  "responseMessage": "The server encountered an unexpected condition which prevented it from fulfilling the request."
}


9.9 Service unavailable

This scenario can be tested using Prefer Headers.

Test

Action

Expected result

1

Start a transaction

Send a valid POST request to https://api.bango.net/v5/transaction


Include the following header in the request:

  • Prefer:status=503

An HTTP response code 202 (Accepted) should be returned with the following body:

{
  "responseCode": "SERVICE_UNAVAILABLE",
  "responseMessage": "The server is undergoing maintenance and is not available. 
Please, try again later."
}