Skip to content

Latest commit

 

History

History
155 lines (107 loc) · 10.1 KB

File metadata and controls

155 lines (107 loc) · 10.1 KB

Testing

(testing)

Overview

The testing endpoint allows you to test various functionality within Bolt. Create a test credit card to process a test payment in your store. You can also simulate tracking an order’s shipment and programmatically create customer accounts to use as dummy data. See our related guide on Testing.

Available Operations

test_shipping

This endpoint simulates tracking an order's shipment and is for testing purposes only.

Example Usage

from bolt_api_sdk import Bolt, models
from bolt_api_sdk.utils import parse_datetime
import os


with Bolt(
    security=models.Security(
        x_api_key=os.getenv("BOLT_X_API_KEY", ""),
    ),
) as bolt:

    bolt.testing.test_shipping(request={
        "delivery_estimate": "<value>",
        "status": models.MockTrackingInputStatus.FAILURE,
        "tracking_detail": [
            {
                "city": "New York",
                "country": "USA",
                "datetime": parse_datetime("2017-07-21T17:32:28Z"),
                "message": "BILLING INFORMATION RECEIVED",
                "state": "New York",
                "status": models.TrackingDetailStatus.IN_TRANSIT,
                "zip": "10044",
            },
        ],
        "tracking_number": "MockBolt1234",
    })

    # Use the SDK ...

Parameters

Parameter Type Required Description
request models.MockTrackingInput ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.ErrorsBoltAPIResponse 400, 422 application/json
errors.APIError 4XX, 5XX */*

create_testing_shopper_account

Create a Bolt shopper account for testing purposes. Available for sandbox use only and the created account will be recycled after a certain time.

Example Usage

from bolt_api_sdk import Bolt, models
import os


with Bolt(
    security=models.Security(
        x_api_key=os.getenv("BOLT_X_API_KEY", ""),
    ),
) as bolt:

    res = bolt.testing.create_testing_shopper_account(testing_account_request=models.TestingAccountRequest(
        deactivate_in_days=30,
        email_state=models.AccountIdentifierStatus.VERIFIED,
        phone_state=models.AccountIdentifierStatus.VERIFIED,
    ))

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
x_publishable_key Optional[str] The publicly viewable identifier used to identify a merchant division. This key is found in the Developer > API section of the Bolt Merchant Dashboard [RECOMMENDED].
testing_account_request Optional[models.TestingAccountRequest] N/A {
"deactivate_in_days": 30,
"email_state": "verified",
"phone_state": "verified"
}
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.TestingAccountDetails

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

get_test_credit_card_token

This endpoint fetches a new credit card token for Bolt's universal test credit card number 4111 1111 1111 1004. This is for testing and is available only in sandbox.

Example Usage

from bolt_api_sdk import Bolt, models
import os


with Bolt(
    security=models.Security(
        x_api_key=os.getenv("BOLT_X_API_KEY", ""),
    ),
) as bolt:

    res = bolt.testing.get_test_credit_card_token()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.GetTestCreditCardTokenResponse

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*