registerServices

The registerService API is used by the Super App to register the services (such as the services provided by SPIs).

Method signature

The following code shows the method signature of the registerService API:

copy
func registerServices(metaInfos: Set<IAPWalletBaseServiceProvider>)

Request parameters

Field

Data type

Description

Required

metaInfos

Set<IAPWalletBaseServiceProvider>

The list of service providers to be registered

Yes

IAPWalletBaseServiceProvider

Field

Data type

Description

Required

type

IAPWalletServiceType

Wallet service types, which contains a wrapper for default wallet types and other customized types.

Yes

name

String

The name of service class

Yes

Response parameters

N/A

Exception

N/A

Samples

Swift

copy
class ServicesRegister {
    static func setup() {
        IAPWalletContextManager.instance.serviceManager = IAPWalletAPIManager()

        // This meta info can be loaded in a invisible swift file to load the real data
        let IAPWalletPaymentServiceMetaInfo = IAPWalletBaseServiceProvider(
            type: IAPWalletServiceType(category: .acl, type: "payment"),
            name: NSStringFromClass(PaymentService.self)
        )

        let IAPWalletOAuthServiceMetaInfo = IAPWalletBaseServiceProvider(
            type: IAPWalletServiceType(category: .acl, type: "oauth"),
            name: NSStringFromClass(OAuthService.self)
        )

        let IAPWalletMemberServiceMetaInfo = IAPWalletBaseServiceProvider(
            type: IAPWalletServiceType(category: .acl, type: "account"),
            name: NSStringFromClass(MemberInfoService.self)
        )

        let IAPWalletCodeServiceMetaInfo = IAPWalletBaseServiceProvider(
            type: IAPWalletServiceType(category: .foundation, type: "code"),
            name: NSStringFromClass(CodeService.self)
        )

        IAPWalletContextManager.instance.serviceManager?.registerServices(metaInfos: [
            IAPWalletPaymentServiceMetaInfo,
            IAPWalletOAuthServiceMetaInfo,
            IAPWalletMemberServiceMetaInfo,
            IAPWalletDeeplinkServiceMetaInfo,
            IAPWalletCodeServiceMetaInfo
        ])
    }
}