social-common / pragma.order / OrderProviderPlugin /

OrderProviderPlugin #

interface OrderProviderPlugin : PragmaServicePlugin

Plugin for syncing orders to Pragma from a third party provider.

Functions #

NameSummary

getName

abstract fun getName(): String

Human-readable name of the third party provider. Used for logging metrics. e.g. "Steam", "Twitch"

getType

abstract fun getType(): <ERROR CLASS>

Third party provider type identifier. Used for indexing OrderProviderPlugin objects in OrderProviderPluginCollection.

orderProviderUnexpectedResponse

open fun orderProviderUnexpectedResponse(e: Exception, service: Service): Nothing

Logs a metric and throws the OrderProviderUnexpectedResponseApplicationError. Called when there is an issue communicating with the third party provider.

registerBackgroundTasks

open fun registerBackgroundTasks(backgroundManager: BackgroundManager, ordersFactory: OrdersFactory)

Registers any background polling tasks onto the provided BackgroundManager. Called a single time when the primary pragma.order.OrderService instance starts up. An example usage of this method includes registering a background task to poll a third party provider refund endpoint to check for and process new refunds.

syncOrders

abstract suspend fun syncOrders(accountId: String, providerData: ProviderData, orders: Orders)

Fetches entitlements from the third party provider and syncs them as Pragma orders. References OrderMappingSpecs.json to map provider entitlements to Pragma sku ids.