myamolane / docusign-sdk

DocuSign sdk for flutter
Other
4 stars 2 forks source link

docusign_sdk

A flutter plugin for DocuSign Sdk

Since DocuSign Sdk only support iOS platform currently, so this plugin only support iOS platform.

Supported Platforms

Getting Started

DocuSign integration guide

After you get integration key and your account.

Usually you need login in at first

  DocusignSdk.loginWithEmail(
    email: 'myamolane@outlook.com',
    password: 'password',
    host: 'https://demo.docusign.net/restapi',
    integratorKey: 'your-integration-key'
  );

And then you can call renderWithTemplateId to popup the Signing View

online mode

import 'package:docusign_sdk/docusign_sdk.dart';
import 'package:docusign_sdk/model.dart';

RaisedButton(
  child: Text('sign'),
  onPressed: () async {
    RecipientDefault recip = RecipientDefault(
      recipientRoleName: 'Visitor',
      recipientEmail: 'myamolane@outlook.com',
      recipientName: 'myamo lane',
      inPersonSignerName: 'Test Customer',
      recipientType: RecipientType.recipientTypeInPersonSigner,
    );

    await DocusignSdk.renderWithTemplateId(
      templateId,
      signingMode: DocuSignSigningMode.online,
      envelopeDefaults:
        EnvelopeDefaults(recipientDefaults: [recip])
    );
  },
)

offline mode

Since code before sign the document with online mode, it's require good network and more waiting during the signing. So If you want a better experience, you should use the offline signing mode

First, you need cache the template before you start signing

  await DocusignSdk.cacheTemplateWithId(templateId);

And then, call renderWithTemplateId with signingMode set to DocuSignSigningMode.offline

await DocusignSdk.renderWithTemplateId(
  templateId,
  signingMode: DocuSignSigningMode.offline,
  envelopeDefaults:
    EnvelopeDefaults(recipientDefaults: [recip])
);

After signing, since the envelope is generated by local, you need sync to server at the time you want.

await DocusignSdk.syncEnvelopes();