Skip to content

Latest commit

 

History

History
185 lines (142 loc) · 14.7 KB

File metadata and controls

185 lines (142 loc) · 14.7 KB

Customers.Documents

Overview

Available Operations

  • list - List documents for customer
  • create - Create a document for customer

list

Returns all identity verification documents submitted for a customer. Includes document status, verification results, document type (passport, driver's license, etc.), and failure reasons if verification was rejected. Used to track document submission and verification progress during the business verification process.

Example Usage

import { Dwolla } from "dwolla";

const dwolla = new Dwolla({
  security: {
    clientID: process.env["DWOLLA_CLIENT_ID"] ?? "",
    clientSecret: process.env["DWOLLA_CLIENT_SECRET"] ?? "",
  },
});

async function run() {
  const result = await dwolla.customers.documents.list({
    id: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { DwollaCore } from "dwolla/core.js";
import { customersDocumentsList } from "dwolla/funcs/customersDocumentsList.js";

// Use `DwollaCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dwolla = new DwollaCore({
  security: {
    clientID: process.env["DWOLLA_CLIENT_ID"] ?? "",
    clientSecret: process.env["DWOLLA_CLIENT_SECRET"] ?? "",
  },
});

async function run() {
  const res = await customersDocumentsList(dwolla, {
    id: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("customersDocumentsList failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.ListCustomerDocumentsRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.Documents>

Errors

Error Type Status Code Content Type
errors.ForbiddenError 403 application/vnd.dwolla.v1.hal+json
errors.NotFoundError 404 application/vnd.dwolla.v1.hal+json
errors.APIError 4XX, 5XX */*

create

Uploads an identity verification document for a customer using multipart form-data. Required when a customer has "document" status during the verification process.

Example Usage

import { Dwolla } from "dwolla";
import { openAsBlob } from "node:fs";

const dwolla = new Dwolla({
  security: {
    clientID: process.env["DWOLLA_CLIENT_ID"] ?? "",
    clientSecret: process.env["DWOLLA_CLIENT_SECRET"] ?? "",
  },
});

async function run() {
  const result = await dwolla.customers.documents.create({
    id: "<id>",
    requestBody: {
      documentType: "license",
      file: await openAsBlob("example.file"),
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { DwollaCore } from "dwolla/core.js";
import { customersDocumentsCreate } from "dwolla/funcs/customersDocumentsCreate.js";
import { openAsBlob } from "node:fs";

// Use `DwollaCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dwolla = new DwollaCore({
  security: {
    clientID: process.env["DWOLLA_CLIENT_ID"] ?? "",
    clientSecret: process.env["DWOLLA_CLIENT_SECRET"] ?? "",
  },
});

async function run() {
  const res = await customersDocumentsCreate(dwolla, {
    id: "<id>",
    requestBody: {
      documentType: "license",
      file: await openAsBlob("example.file"),
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("customersDocumentsCreate failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.CreateCustomerDocumentRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.CreateCustomerDocumentResponse>

Errors

Error Type Status Code Content Type
errors.MaximumNumberOfResourcesSchemaError 400 application/vnd.dwolla.v1.hal+json
errors.InvalidFileTypeSchemaError 400 application/vnd.dwolla.v1.hal+json
errors.DuplicateResourceSchemaError 400 application/vnd.dwolla.v1.hal+json
errors.InvalidResourceStateSchemaError 403 application/vnd.dwolla.v1.hal+json
errors.NotAuthorizedSchemaError 403 application/vnd.dwolla.v1.hal+json
errors.CreateCustomerDocumentNotFoundDwollaV1HalJSONError 404 application/vnd.dwolla.v1.hal+json
errors.CreateCustomerDocumentRequestEntityTooLargeDwollaV1HalJSONError 413 application/vnd.dwolla.v1.hal+json
errors.APIError 4XX, 5XX */*