Test orders without a provider #
The unsafe order provider stands in for a third-party store such as Steam or Epic, so you can test order sync and fulfillment without real purchases. You can grant an order to a player through an Http route, and the next order sync for that player fulfills it, or you can set a chance out of 1000 that a random SKU will be granted.
The unsafe order provider syncs orders for players who log in with the Unsafe identity provider. Use this provider if you want to test the fulfillment flow for a load sim without hitting a 3rd party.
The unsafe order routes accept any player’s social Id with no authorization check. Never enable them on a shard that real players can reach.
Enable the unsafe order provider #
Add the route plugin to the social player gateway, and register UnsafeOrderProviderPlugin as an order provider pointed at that gateway:
social:
serviceConfigs:
UnsafeOrderDaoConfig:
databaseConfig:
identifierSchema:
identifier: defaultIdentifier
schema: test_unsafe_order
pluginConfigs:
SocialPlayerGatewayNodeService.routePlugins:
plugins:
UnsafeOrder:
class: pragma.order.UnsafeOrderRoutePlugin
ThirdPartyNodeService.orderProviderPlugins:
plugins:
Unsafe:
class: pragma.order.UnsafeOrderProviderPlugin
config:
baseUrl: http://127.0.0.1:11000
UnsafeOrderService stores granted orders in its own database, configured by UnsafeOrderDaoConfig. Local dev-defaults.yml already
includes it.
UnsafeOrderProviderPlugin settings:
| Setting | Default | Description |
|---|---|---|
baseUrl | "" | Base Url of the social player gateway hosting the unsafe order routes. Blank disables granted orders; only the random behavior below applies. |
chanceToReceivePerThousand | 0 | Chance out of 1000, per sync, that the player receives a random SKU from your order mappings. Values above 1000 can grant more than one. |
chanceToRevokePerThousand | 0 | Chance out of 1000, per sync, that one of the player’s received orders is revoked. |
chanceToErrorPerThousand | 0 | Chance out of 1000, per sync, that the sync fails with an error. |
Grant an order #
Post the player’s social Id and a SKU to /v1/unsafeorders on the social player gateway. The SKU must exist in your order mapping content.
curl --location 'http://localhost:11000/v1/unsafeorders' \
--write-out '\nHTTP %{http_code}\n' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"pragmaSocialId": "<pragma-social-id>",
"skuId": "<sku-id>"
}'
The response contains the new order’s orderId, skuId, and grantedTimestampMillis. A SKU that isn’t in your order mappings returns 400 with {"error": "sku not found"}.
The order is received the next time the player’s orders sync, for example when the player fulfills orders. Each granted order is received once.
List granted orders #
curl --location 'http://localhost:11000/v1/unsafeorders?pragma_social_id=<pragma-social-id>' \
--write-out '\nHTTP %{http_code}\n' \
--header 'Accept: application/json'
The response lists every order granted to the player through the route, whether or not it has synced yet.
Disable the routes #
Set enabled to false on the route plugin to make both routes return 404 without removing the rest of the configuration:
social:
pluginConfigs:
SocialPlayerGatewayNodeService.routePlugins:
plugins:
UnsafeOrder:
class: pragma.order.UnsafeOrderRoutePlugin
config:
enabled: false
Multinode shards #
UnsafeOrderService must be assigned to a node on multinode shards (single node shards run all services). Contact your CSM to make sure it’s configured or disabled on your multinode shards.