mblanchard

Getting DocumentId & PackageId

0 votes
Hello, In the didSynchronizeTransaction protocol, we get a guid representing a signing ceremony id. My backend team need a DocumentID AND a PackageID. Is it possible to get these informations in the callbacks of the protocols? If so, which one ? Thank you

Approved Answer

Reply to: Getting DocumentId & PackageId

2 votes
Hi mblanchard, Thanks for posting in our community! For package ID, you can directly retrieve it from the aDict parameter: aDict["guid"], it should look like this format "kAlVeXCQK3ut0EEtkGvWagf8WGQ=" However, in iOS SDK modeling, there's no document ID: if you checked "ESDocument.h" file, you'll find there's no such an attribute, which means, all the document IDs were generated at OneSpan Sign server's side. You have to make an extra call grabbing this information from OSS server, either at the mobile app side or at your backend side. If pulling from mobile app side, document ID won't be returned with the built-in function "transactionWithGUID" (I assume the reason is that there's no document ID concept in iOS SDK as I mentioned above):
public func didSynchronizeTransaction(_ aDict: [AnyHashable : Any]!) {
        print("Transaction Successfully synchronized to the Server \(aDict)")
        eSignLive.dashboard().transaction(withGUID: aDict["guid"] as? String, withCallback: {(dict: [AnyHashable : Any]?) -> Void in
        if let myDict = dict, let guid = myDict["guid"] as? String {
            print(myDict)
        }
    })
        DispatchQueue.main.async {
            self.loadingView.isHidden = true
        }
    }
So the only way is to create a custom function invoking below API call, and loop through the "documents" array in response JSON:
HTTP Request
GET /api/packages/{packageId}

HTTP Headers
Accept: application/json; esl-api-version=11.21
Authorization: Basic api_key
Or you can have your backend team implement this function at the backend, since the document ID was created at OSS server-side, both of the solutions have to make an extra call. Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off