Use custom data in a webview on the web checkout screen

Out of date

To pass custom data to the webview from the subscriber/controller, you need to inject your own implementation of CheckoutWebViewDataModelMapper protocol.

This object maps the domain model into a model that is usable by the webview.

Use the example below as a guide to complete this:

import PoqWebCheckout
import PoqFoundation
import PoqPlatform
class ClientModule: PoqModule {
func didAddToPlatform() {
// Override platform's deeplink logic.
let navigator = NavigationHelper.sharedInstance
navigator.mapRoute(navigator.cartTransferURL, toDestination: { _ in
navigator.openController(ClientModule.createWebCheckoutViewController())
})
}
static func createWebCheckoutViewController() -> UIViewController {
let router = CheckoutRouter(navigator: NavigationHelper.sharedInstance)
let supportedLocations = [CheckoutLocationDomainModel(host: "poq-web-carttransferdemo.azurewebsites.net", port: nil), CheckoutLocationDomainModel(host: "poq-web-carttransferdemo-uat.azurewebsites.net", port: nil)]
let checkoutBridgeConfiguration = CheckoutBridgeConfiguration(supportedLocations: supportedLocations, checkoutPaymentConfiguration: nil)
let checkoutType: CheckoutWebViewType = .bridge(configuration: checkoutBridgeConfiguration)
let viewDataMapper = CustomCheckoutWebViewDataModelMapper()
return WebCheckoutBuilder<PoqCheckoutState>(router: router, type: checkoutType)
.withViewDataMapper(viewDataMapper)
.build()
}
}
public class CustomCheckoutWebViewDataModelMapper: CheckoutWebViewDataModelMapper {
public func map(from domainModel: CheckoutDomainModel) -> CheckoutWebViewDataModel {
// Your custom implementation goes here.
}
}