Signature
Overview
The plugin presents a screen to perform a signature for a transaction, after such transaction has been confirmed, and send the signature/s image data to the backend to be stored matching a transaction reference number.
Downloading plugin dependency
In order to install the plugin, the integrating app must obtain the dependency through cocoapods dependency manager.
target 'Integrating-App-Main-Target' do
use_frameworks!
.
.
pod 'GeoSignaturePlugin'
.
.
end
Once the dependency is installed, it can be imported and used as follows
import Signature
Injecting Signature plugin to the SDK
Same as with other plugins, it is injected into the SDK during configuration by calling the set(plugins:)
method
do {
let paymentsConfiguration = try PaymentsConfiguration.Builder(
endpoint: URL(string: "https://valid-url")!,
.
.
).set(plugins:
[
SDKSignaturePluginInstallerFactory.getInstaller(
delegate: self,
url: URL(string: "www.someValidUrl.com")!
)
]
)
.
.
.build()
PaymentsSDK.configure(paymentsConfiguration: paymentsConfiguration)
} catch {
// Handle error
}
where SDKPanHashPluginInstallerFactory
is the factory method to obtain an instance of the plugin.
the delegate
is any object that implements SDKSignatureCallback
protocol
and url
is the integrating app's backend url, which most likely will be the same as the one injected to the SDK during configuration.
On succesful response, a
200
status code is received as http response and no data associated with it.On Error, the SDK is invoked with a
OnlineDeclined
recoverable error
Example of an implementation of the SDKSignatureCallback
protocol
As mentioned earlier, the Integrating app must implement this protocol to provide mandatory data to the plugin when needed
shouldRequestSignatureOnSwipeTransactions
When the card's read mode is swipe, and there is no pin block data, then the plugin requests a boolean response from the integrating app deciding wether the SDK should present the signature screen or not
shouldPresentSignatureScreen
When the signature is about to be presented, the plugin asks the integrating app to provide a view controller on which to present the signature screen modally
extension SomeDelegateClass: SDKSignatureCallback {
func shouldRequestSignatureOnSwipeTransactions(
transactionData _: TransactionData,
requestSignature: @escaping (Bool) -> Void
) {
requestSignature(true)
}
func shouldPresentSignatureScreen(
on view: @escaping (UIViewController) -> Void
) {
view(aViewController)
}
}