Skip to content

Latest commit

 

History

History
999 lines (881 loc) · 44.9 KB

README.md

File metadata and controls

999 lines (881 loc) · 44.9 KB

Payments

(accounting.payments)

Overview

Available Operations

list

List Payments

Example Usage

import { Apideck } from "@apideck/unify";

const apideck = new Apideck({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const result = await apideck.accounting.payments.list({
    raw: false,
    serviceId: "salesforce",
    limit: 20,
    filter: {
      updatedSince: new Date("2020-09-30T07:43:32.000Z"),
    },
    sort: {
      by: "updated_at",
      direction: "desc",
    },
    passThrough: {
      "search": "San Francisco",
    },
    fields: "id,updated_at",
  });

  for await (const page of result) {
    // Handle the page
    console.log(page);
  }
}

run();

Standalone function

The standalone function version of this method:

import { ApideckCore } from "@apideck/unify/core.js";
import { accountingPaymentsList } from "@apideck/unify/funcs/accountingPaymentsList.js";

// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const res = await accountingPaymentsList(apideck, {
    raw: false,
    serviceId: "salesforce",
    limit: 20,
    filter: {
      updatedSince: new Date("2020-09-30T07:43:32.000Z"),
    },
    sort: {
      by: "updated_at",
      direction: "desc",
    },
    passThrough: {
      "search": "San Francisco",
    },
    fields: "id,updated_at",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  for await (const page of result) {
    // Handle the page
    console.log(page);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.AccountingPaymentsAllRequest ✔️ 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.AccountingPaymentsAllResponse>

Errors

Error Type Status Code Content Type
errors.BadRequestResponse 400 application/json
errors.UnauthorizedResponse 401 application/json
errors.PaymentRequiredResponse 402 application/json
errors.NotFoundResponse 404 application/json
errors.UnprocessableResponse 422 application/json
errors.APIError 4XX, 5XX */*

create

Create Payment

Example Usage

import { Apideck } from "@apideck/unify";

const apideck = new Apideck({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const result = await apideck.accounting.payments.create({
    raw: false,
    serviceId: "salesforce",
    payment: {
      currency: "USD",
      currencyRate: 0.69,
      totalAmount: 49.99,
      reference: "123456",
      paymentMethod: "cash",
      paymentMethodReference: "123456",
      paymentMethodId: "12345",
      account: {
        id: "123456",
        nominalCode: "N091",
        code: "453",
      },
      transactionDate: new Date("2021-05-01T12:00:00.000Z"),
      customer: {
        id: "12345",
        displayName: "Windsurf Shop",
        email: "boring@boring.com",
      },
      companyId: "12345",
      reconciled: true,
      status: "authorised",
      type: "accounts_receivable",
      allocations: [
        {
          id: "123456",
          amount: 49.99,
          allocationId: "123456",
        },
        {
          id: "123456",
          amount: 49.99,
          allocationId: "123456",
        },
      ],
      note: "Some notes about this transaction",
      number: "123456",
      trackingCategories: [
        {
          id: "123456",
          name: "New York",
        },
        {
          id: "123456",
          name: "New York",
        },
      ],
      customFields: [
        {
          id: "2389328923893298",
          name: "employee_level",
          description: "Employee Level",
          value: "Uses Salesforce and Marketo",
        },
        {
          id: "2389328923893298",
          name: "employee_level",
          description: "Employee Level",
          value: "Uses Salesforce and Marketo",
        },
      ],
      rowVersion: "1-12345",
      displayId: "123456",
      passThrough: [
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
      ],
    },
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ApideckCore } from "@apideck/unify/core.js";
import { accountingPaymentsCreate } from "@apideck/unify/funcs/accountingPaymentsCreate.js";

// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const res = await accountingPaymentsCreate(apideck, {
    raw: false,
    serviceId: "salesforce",
    payment: {
      currency: "USD",
      currencyRate: 0.69,
      totalAmount: 49.99,
      reference: "123456",
      paymentMethod: "cash",
      paymentMethodReference: "123456",
      paymentMethodId: "12345",
      account: {
        id: "123456",
        nominalCode: "N091",
        code: "453",
      },
      transactionDate: new Date("2021-05-01T12:00:00.000Z"),
      customer: {
        id: "12345",
        displayName: "Windsurf Shop",
        email: "boring@boring.com",
      },
      companyId: "12345",
      reconciled: true,
      status: "authorised",
      type: "accounts_receivable",
      allocations: [
        {
          id: "123456",
          amount: 49.99,
          allocationId: "123456",
        },
        {
          id: "123456",
          amount: 49.99,
          allocationId: "123456",
        },
      ],
      note: "Some notes about this transaction",
      number: "123456",
      trackingCategories: [
        {
          id: "123456",
          name: "New York",
        },
        {
          id: "123456",
          name: "New York",
        },
      ],
      customFields: [
        {
          id: "2389328923893298",
          name: "employee_level",
          description: "Employee Level",
          value: "Uses Salesforce and Marketo",
        },
        {
          id: "2389328923893298",
          name: "employee_level",
          description: "Employee Level",
          value: "Uses Salesforce and Marketo",
        },
      ],
      rowVersion: "1-12345",
      displayId: "123456",
      passThrough: [
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
      ],
    },
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request operations.AccountingPaymentsAddRequest ✔️ 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.AccountingPaymentsAddResponse>

Errors

Error Type Status Code Content Type
errors.BadRequestResponse 400 application/json
errors.UnauthorizedResponse 401 application/json
errors.PaymentRequiredResponse 402 application/json
errors.NotFoundResponse 404 application/json
errors.UnprocessableResponse 422 application/json
errors.APIError 4XX, 5XX */*

get

Get Payment

Example Usage

import { Apideck } from "@apideck/unify";

const apideck = new Apideck({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const result = await apideck.accounting.payments.get({
    id: "<id>",
    serviceId: "salesforce",
    raw: false,
    fields: "id,updated_at",
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ApideckCore } from "@apideck/unify/core.js";
import { accountingPaymentsGet } from "@apideck/unify/funcs/accountingPaymentsGet.js";

// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const res = await accountingPaymentsGet(apideck, {
    id: "<id>",
    serviceId: "salesforce",
    raw: false,
    fields: "id,updated_at",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request operations.AccountingPaymentsOneRequest ✔️ 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.AccountingPaymentsOneResponse>

Errors

Error Type Status Code Content Type
errors.BadRequestResponse 400 application/json
errors.UnauthorizedResponse 401 application/json
errors.PaymentRequiredResponse 402 application/json
errors.NotFoundResponse 404 application/json
errors.UnprocessableResponse 422 application/json
errors.APIError 4XX, 5XX */*

update

Update Payment

Example Usage

import { Apideck } from "@apideck/unify";

const apideck = new Apideck({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const result = await apideck.accounting.payments.update({
    id: "<id>",
    serviceId: "salesforce",
    raw: false,
    payment: {
      currency: "USD",
      currencyRate: 0.69,
      totalAmount: 49.99,
      reference: "123456",
      paymentMethod: "cash",
      paymentMethodReference: "123456",
      paymentMethodId: "12345",
      account: {
        id: "123456",
        nominalCode: "N091",
        code: "453",
      },
      transactionDate: new Date("2021-05-01T12:00:00.000Z"),
      customer: {
        id: "12345",
        displayName: "Windsurf Shop",
        email: "boring@boring.com",
      },
      companyId: "12345",
      reconciled: true,
      status: "authorised",
      type: "accounts_receivable",
      allocations: [
        {
          id: "123456",
          amount: 49.99,
          allocationId: "123456",
        },
        {
          id: "123456",
          amount: 49.99,
          allocationId: "123456",
        },
        {
          id: "123456",
          amount: 49.99,
          allocationId: "123456",
        },
      ],
      note: "Some notes about this transaction",
      number: "123456",
      trackingCategories: [
        {
          id: "123456",
          name: "New York",
        },
        {
          id: "123456",
          name: "New York",
        },
      ],
      customFields: [
        {
          id: "2389328923893298",
          name: "employee_level",
          description: "Employee Level",
          value: [
            {},
            {},
          ],
        },
        {
          id: "2389328923893298",
          name: "employee_level",
          description: "Employee Level",
          value: true,
        },
      ],
      rowVersion: "1-12345",
      displayId: "123456",
      passThrough: [
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
      ],
    },
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ApideckCore } from "@apideck/unify/core.js";
import { accountingPaymentsUpdate } from "@apideck/unify/funcs/accountingPaymentsUpdate.js";

// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const res = await accountingPaymentsUpdate(apideck, {
    id: "<id>",
    serviceId: "salesforce",
    raw: false,
    payment: {
      currency: "USD",
      currencyRate: 0.69,
      totalAmount: 49.99,
      reference: "123456",
      paymentMethod: "cash",
      paymentMethodReference: "123456",
      paymentMethodId: "12345",
      account: {
        id: "123456",
        nominalCode: "N091",
        code: "453",
      },
      transactionDate: new Date("2021-05-01T12:00:00.000Z"),
      customer: {
        id: "12345",
        displayName: "Windsurf Shop",
        email: "boring@boring.com",
      },
      companyId: "12345",
      reconciled: true,
      status: "authorised",
      type: "accounts_receivable",
      allocations: [
        {
          id: "123456",
          amount: 49.99,
          allocationId: "123456",
        },
        {
          id: "123456",
          amount: 49.99,
          allocationId: "123456",
        },
        {
          id: "123456",
          amount: 49.99,
          allocationId: "123456",
        },
      ],
      note: "Some notes about this transaction",
      number: "123456",
      trackingCategories: [
        {
          id: "123456",
          name: "New York",
        },
        {
          id: "123456",
          name: "New York",
        },
      ],
      customFields: [
        {
          id: "2389328923893298",
          name: "employee_level",
          description: "Employee Level",
          value: [
            {},
            {},
          ],
        },
        {
          id: "2389328923893298",
          name: "employee_level",
          description: "Employee Level",
          value: true,
        },
      ],
      rowVersion: "1-12345",
      displayId: "123456",
      passThrough: [
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
        {
          serviceId: "<id>",
          extendPaths: [
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
            {
              path: "$.nested.property",
              value: {
                "TaxClassificationRef": {
                  "value": "EUC-99990201-V1-00020000",
                },
              },
            },
          ],
        },
      ],
    },
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request operations.AccountingPaymentsUpdateRequest ✔️ 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.AccountingPaymentsUpdateResponse>

Errors

Error Type Status Code Content Type
errors.BadRequestResponse 400 application/json
errors.UnauthorizedResponse 401 application/json
errors.PaymentRequiredResponse 402 application/json
errors.NotFoundResponse 404 application/json
errors.UnprocessableResponse 422 application/json
errors.APIError 4XX, 5XX */*

delete

Delete Payment

Example Usage

import { Apideck } from "@apideck/unify";

const apideck = new Apideck({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const result = await apideck.accounting.payments.delete({
    id: "<id>",
    serviceId: "salesforce",
    raw: false,
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { ApideckCore } from "@apideck/unify/core.js";
import { accountingPaymentsDelete } from "@apideck/unify/funcs/accountingPaymentsDelete.js";

// Use `ApideckCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const apideck = new ApideckCore({
  apiKey: process.env["APIDECK_API_KEY"] ?? "",
  consumerId: "test-consumer",
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
});

async function run() {
  const res = await accountingPaymentsDelete(apideck, {
    id: "<id>",
    serviceId: "salesforce",
    raw: false,
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request operations.AccountingPaymentsDeleteRequest ✔️ 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.AccountingPaymentsDeleteResponse>

Errors

Error Type Status Code Content Type
errors.BadRequestResponse 400 application/json
errors.UnauthorizedResponse 401 application/json
errors.PaymentRequiredResponse 402 application/json
errors.NotFoundResponse 404 application/json
errors.UnprocessableResponse 422 application/json
errors.APIError 4XX, 5XX */*