diff --git a/openapi.json b/openapi.json index 94a1cb7..02424ee 100644 --- a/openapi.json +++ b/openapi.json @@ -101,6 +101,9 @@ "/customers/{customerId}/authorized-users": { "$ref": "./schemas/customer/customerPaths.json#/authorizedUsers" }, + "/customers/{customerId}/authorized-users/{authorizedUserId}": { + "$ref": "./schemas/customer/customerPaths.json#/authorizedUser" + }, "/payments": { "$ref": "./schemas/payment/paymentsPaths.json#/getAndCreatePayments" }, @@ -110,6 +113,12 @@ "/payments/{paymentId}/cancel": { "$ref": "./schemas/payment/paymentsPaths.json#/cancelPayment" }, + "/payments/{paymentId}/clear": { + "$ref": "./schemas/payment/paymentsPaths.json#/clearAchDebitPayment" + }, + "/payments/bulk": { + "$ref": "./schemas/payment/paymentsPaths.json#/createBulkPayments" + }, "/store-locations": { "$ref": "./schemas/cash-deposit/cashDepositPaths.json#/listCashDepositStoreLocations" }, @@ -123,7 +132,7 @@ "$ref": "./schemas/payment/paymentsPaths.json#/listReceivedPayments" }, "/returns/{transactionId}": { - "$ref": "./schemas/payment/paymentsPaths.json#/returnReceivedACHTransaction" + "$ref": "./schemas/payment/paymentsPaths.json#/returnReceivedAchTransaction" }, "/received-payments/{paymentId}": { "$ref": "./schemas/payment/paymentsPaths.json#/receivedPayments" @@ -143,6 +152,9 @@ "/counterparties/{counterpartyId}/balance": { "$ref": "./schemas/counterparty/counterpartyPaths.json#/counterpartyBalance" }, + "/batch-releases": { + "$ref": "./schemas/payment/batchReleasesPaths.json#/createBatchReleases" + }, "/recurring-payments": { "$ref": "./schemas/payment/paymentsPaths.json#/recurringPayments" }, @@ -155,6 +167,9 @@ "/recurring-payments/{paymentId}/enable": { "$ref": "./schemas/payment/paymentsPaths.json#/enableRecurringPayment" }, + "/recurring-payments/{paymentId}/delete": { + "$ref": "./schemas/payment/paymentsPaths.json#/deleteRecurringPayment" + }, "/cards": { "$ref": "./schemas/card/cardPaths.json#/cards" }, @@ -185,6 +200,24 @@ "/cards/{cardId}/replace": { "$ref": "./schemas/card/cardPaths.json#/replaceCard" }, + "/cards/{cardId}/mobile-wallet-payload": { + "$ref": "./schemas/card/cardPaths.json#/mobileWalletPayload" + }, + "/cards/{cardId}/activate": { + "$ref": "./schemas/card/cardPaths.json#/activateCard" + }, + "/cards/{cardId}/secure-data/pin/set": { + "$ref": "./schemas/card/cardPaths.json#/setPIN" + }, + "/cards/{cardId}/secure-data/pin/change": { + "$ref": "./schemas/card/cardPaths.json#/changePIN" + }, + "/cards/{cardId}/cardholder/token": { + "$ref": "./schemas/card/cardPaths.json#/cardholderToken" + }, + "/cards/{cardId}/cardholder/token/verification": { + "$ref": "./schemas/card/cardPaths.json#/cardholderTokenVerification" + }, "/authorizations": { "$ref": "./schemas/authorization/authorizationPaths.json#/authorizations" }, @@ -246,10 +279,10 @@ "$ref": "./schemas/check/checkDepositPaths.json#/confirmCheckDeposit" }, "/check-deposits/{checkDepositId}/front": { - "$ref": "./schemas/check/checkDepositPaths.json#/getFrontCheckDeposit" + "$ref": "./schemas/check/checkDepositPaths.json#/frontImageCheckDeposit" }, "/check-deposits/{checkDepositId}/back": { - "$ref": "./schemas/check/checkDepositPaths.json#/getBackCheckDeposit" + "$ref": "./schemas/check/checkDepositPaths.json#/backImageCheckDeposit" }, "/users/{userId}/api-tokens": { "$ref": "./schemas/token/tokenPaths.json#/apiTokens" @@ -284,6 +317,9 @@ "/transactions": { "$ref": "./schemas/transaction/transactionPaths.json#/listTransactions" }, + "/transactions/{transactionId}": { + "$ref": "./schemas/transaction/transactionPaths.json#/transactionById" + }, "/disputes": { "$ref": "./schemas/dispute/disputePaths.json#/listDisputes" }, @@ -358,6 +394,66 @@ }, "/sandbox/received-ach-payment": { "$ref": "./schemas/simulation/simulationPaths.json#/createIncomingAchPayment" + }, + "/wire-drawdowns/{wireDrawdownId}": { + "$ref": "./schemas/payment/wireDrawdownPaths.json#/getWireDrawdown" + }, + "/wire-drawdowns": { + "$ref": "./schemas/payment/wireDrawdownPaths.json#/listWireDrawdowns" + }, + "/wire-drawdowns/{wireDrawdownId}/send": { + "$ref": "./schemas/payment/wireDrawdownPaths.json#/sendWireDrawdown" + }, + "/card-fraud-cases/{id}": { + "$ref": "./schemas/card/cardFraudOutreachPaths.json#/cardFraudCase" + }, + "/card-fraud-cases": { + "$ref": "./schemas/card/cardFraudOutreachPaths.json#/cardFraudCases" + }, + "/card-fraud-cases/{id}/fraud": { + "$ref": "./schemas/card/cardFraudOutreachPaths.json#/markCardFraudCaseAsFraud" + }, + "/card-fraud-cases/{id}/no-fraud": { + "$ref": "./schemas/card/cardFraudOutreachPaths.json#/markCardFraudCaseAsNoFraud" + }, + "/fraud-outreach-policies": { + "$ref": "./schemas/card/cardFraudOutreachPaths.json#/createCardFraudOutreachPolicy" + }, + "/fraud-outreach-policies/{policyId}": { + "$ref": "./schemas/card/cardFraudOutreachPaths.json#/fraudOutreachPolicy" + }, + "/credit-applications": { + "$ref": "./schemas/credit-application/creditApplicationPaths.json#/creditApplications" + }, + "/credit-applications/{creditApplicationId}": { + "$ref": "./schemas/credit-application/creditApplicationPaths.json#/creditApplication" + }, + "/credit-decisions": { + "$ref": "./schemas/credit-decision/creditDecisionPaths.json#/creditDecisions" + }, + "/credit-decisions/{id}": { + "$ref": "./schemas/credit-decision/creditDecisionPaths.json#/creditDecision" + }, + "/lending-programs": { + "$ref": "./schemas/lending-program/lendingProgramPaths.json#/lendingPrograms" + }, + "/lending-programs/{id}": { + "$ref": "./schemas/lending-program/lendingProgramPaths.json#/lendingProgram" + }, + "/lending-programs/{id}/extended": { + "$ref": "./schemas/lending-program/lendingProgramPaths.json#/lendingProgramExtended" + }, + "/receivables/{id}": { + "$ref": "./schemas/receivables/receivablesPaths.json#/receivable" + }, + "/receivables": { + "$ref": "./schemas/receivables/receivablesPaths.json#/receivables" + }, + "/receivablesreports/balance": { + "$ref": "./schemas/receivables/receivablesPaths.json#/receivablesBalance" + }, + "/accrued-interest/total": { + "$ref": "./schemas/interest/interestPaths.json#/getTotalAccruedInterest" } }, "components": { diff --git a/package.json b/package.json index fb7373e..c5afa1e 100644 --- a/package.json +++ b/package.json @@ -3,10 +3,11 @@ "bundle": "redocly bundle openapi.json -o dist/bundledSchema.json", "fix-java-file-get-requests": "ts-node ./scripts/java/fixFileRelatedGetRequests.ts", "add-version-header-to-java": "ts-node ./scripts/java/addVersionHeaderToApiClient.ts", + "fix-deep-object-query-params": "ts-node ./scripts/python/fixDeepObjectQueryParams.ts", "generate-java": "rm -rf ./dist/java-sdk && npm run bundle && npx mkdirp dist/java-sdk/src/test/java/unit/java/sdk && cp -a ./unit/e2e_tests/java/. ./dist/java-sdk/src/test/java/unit/java/sdk && openapi-generator-cli generate -g java -i ./dist/bundledSchema.json -o ./dist/java-sdk -p hideGenerationTimestamp=true -p packageName=unit.java.sdk -p modelPackage=unit.java.sdk.model -p apiPackage=unit.java.sdk.api --library native -p useJakartaEe=true --openapi-normalizer REFACTOR_ALLOF_WITH_PROPERTIES_ONLY=true && npm run fix-java-file-get-requests -- --path=./dist/java-sdk/src/main/java/unit/java/sdk/api/UnitApi.java && npm run add-version-header-to-java -- --path=./dist/java-sdk/src/main/java/unit/java/sdk/ApiClient.java", "generate-ruby": "rm -rf ./dist/ruby-sdk && npm run bundle && openapi-generator-cli generate -g ruby -i ./dist/bundledSchema.json -o ./dist/ruby-sdk -p gemName=unit_openapi_ruby_sdk && rm -rf ./dist/ruby-sdk/spec && npx mkdirp dist/ruby-sdk/spec && cp -a ./unit/e2e_tests/ruby/spec ./dist/ruby-sdk", "generate-node": "rm -rf ./dist/node-sdk && npm run bundle && openapi-generator-cli generate -g typescript-axios -i ./dist/bundledSchema.json -o ./dist/node-sdk", - "generate-python": "rm -rf ./dist/python-sdk && npm run bundle && openapi-generator-cli generate -i ./dist/bundledSchema.json -g python -o ./dist/python-sdk -p packageName=unit_openapi_python_sdk", + "generate-python": "rm -rf ./dist/python-sdk && npm run bundle && openapi-generator-cli generate -i ./dist/bundledSchema.json -g python -o ./dist/python-sdk -p packageName=unit_openapi_python_sdk && npm run fix-deep-object-query-params -- --path=./dist/python-sdk/unit_openapi_python_sdk/api_client.py --schema=./dist/bundledSchema.json --unit-api=./dist/python-sdk/unit_openapi_python_sdk/api/unit_api.py", "lint": "redocly lint --config .redocly.yaml openapi.json", "format": "prettier ./schemas --write" }, @@ -17,4 +18,4 @@ "prettier": "^3.2.5", "ts-node": "^10.9.2" } -} +} \ No newline at end of file diff --git a/schemas/account/account.json b/schemas/account/account.json index 19bcc24..2a975e2 100644 --- a/schemas/account/account.json +++ b/schemas/account/account.json @@ -4,6 +4,7 @@ "DepositAccount": { "title": "Deposit Account", "type": "object", + "description": "Deposit Accounts are bank accounts maintained by a financial institution, in which a customer can deposit and withdraw money. Deposit accounts can be checking accounts, savings accounts, or any of several other types.", "allOf": [ { "$ref": "#/components/schemas/Account" @@ -16,21 +17,26 @@ "properties": { "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the account was created." }, "name": { - "type": "string" + "type": "string", + "description": "The name of the account." }, "depositProduct": { - "type": "string" + "type": "string", + "description": "The name of the deposit product, which defines the set of end-customer terms applied to the account." }, "routingNumber": { "type": "string", - "pattern": "^\\d{9}$" + "pattern": "^\\d{9}$", + "description": "The routing number for the account." }, "accountNumber": { "type": "string", - "pattern": "^\\d{10,12}$" + "pattern": "^\\d{10,12}$", + "description": "The account number." }, "secondaryAccountNumber": { "type": "object", @@ -71,10 +77,18 @@ "format": "int64" }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { + "$ref": "../types.json#/components/schemas/Tags" + }, + { + "description": "Optional. See [Tags](https://www.unit.co/docs/api/#tags)." + } + ] }, "status": { - "enum": ["Open", "Closed", "Frozen"] + "enum": ["Open", "Closed", "Frozen"], + "description": "The status of the account." }, "closeReason": { "type": "string", @@ -86,7 +100,8 @@ "BreachOfTermsAndConditions", "NoAccountActivity", "ProgramChange" - ] + ], + "description": "The reason for closing the account." }, "fraudReason": { "type": "string", @@ -99,28 +114,34 @@ "ClientIdentified", "IdentityTheft", "LinkedToFraudulentCustomer" - ] + ], + "description": "The expanded fraud reason for closing the account when Fraud is specified as the reason." }, "closeReasonText": { "type": "string", "maxLength": 255 }, "freezeReason": { - "type": "string" + "type": "string", + "description": "The reason for freezing the account." }, "maskedAccountNumber": { "type": "string", - "pattern": "^\\*{6,8}\\d{4}$" + "pattern": "^\\*{6,8}\\d{4}$", + "description": "Masked version of the account number, showing only the last 4 digits." }, "isOverdrawnWithinLimit": { - "type": "boolean" + "type": "boolean", + "description": "Indicates whether the account is overdrawn but within the overdraft limit." }, "dacaStatus": { - "enum": ["Activated", "Entered"] + "enum": ["Activated", "Entered"], + "description": "The status of the Deposit Account Control Agreement (DACA). When set to `Activated`, funds cannot be withdrawn from the account through end-customer initiated actions or external attempts. When set to `Entered`, the account is marked as subject to a DACA but operates normally." }, "updatedAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the account was last updated." } }, "additionalProperties": false, @@ -291,41 +312,58 @@ "properties": { "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the wallet was created." }, "name": { - "type": "string" + "type": "string", + "description": "The name of the wallet." }, "status": { - "enum": ["Open", "Closed", "Frozen"] + "enum": ["Open", "Closed", "Frozen"], + "description": "The status of the wallet." }, "walletTerms": { - "type": "string" + "type": "string", + "description": "The name of the wallet terms." }, "routingNumber": { - "type": "string" + "type": "string", + "description": "The routing number for the wallet." }, "accountNumber": { - "type": "string" + "type": "string", + "description": "The account number." }, "currency": { "type": "string", - "default": "USD" + "default": "USD", + "description": "The currency of the wallet." }, "balance": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "The current balance of the wallet in cents." }, "hold": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "The amount currently on hold in the wallet in cents." }, "available": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "The available balance in the wallet in cents." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { + "$ref": "../types.json#/components/schemas/Tags" + }, + { + "description": "Optional. See [Tags](https://www.unit.co/docs/api/#tags)." + } + ] }, "closeReason": { "type": "string", @@ -338,7 +376,8 @@ "BreachOfTermsAndConditions", "NoAccountActivity", "ProgramChange" - ] + ], + "description": "The reason for closing the wallet." }, "fraudReason": { "type": "string", @@ -351,24 +390,27 @@ "ClientIdentified", "IdentityTheft", "LinkedToFraudulentCustomer" - ] + ], + "description": "The expanded fraud reason for closing the wallet when Fraud is specified as the reason." }, "freezeReason": { - "type": "string" + "type": "string", + "description": "The reason for freezing the wallet." } }, "additionalProperties": false, "required": [ "createdAt", "name", - "creditTerms", + "status", + "walletTerms", + "routingNumber", + "accountNumber", "currency", "balance", "hold", "available", - "tags", - "status", - "creditLimit" + "tags" ] }, "relationships": { diff --git a/schemas/account/accountEndOfDay.json b/schemas/account/accountEndOfDay.json index c9302f1..9af0856 100644 --- a/schemas/account/accountEndOfDay.json +++ b/schemas/account/accountEndOfDay.json @@ -31,23 +31,28 @@ "properties": { "date": { "type": "string", - "format": "date" + "format": "date", + "description": "The date for which the end-of-day balance is recorded." }, "balance": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "The account balance at the end of the day." }, "hold": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "The hold amount on the account at the end of the day." }, "available": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "The available balance at the end of the day." }, "overdraftLimit": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "The overdraft limit, if applicable." } }, "required": ["date", "balance", "hold", "available"], diff --git a/schemas/account/accountPaths.json b/schemas/account/accountPaths.json index a2b078a..b6b13d5 100644 --- a/schemas/account/accountPaths.json +++ b/schemas/account/accountPaths.json @@ -33,12 +33,23 @@ "$ref": "./account.json#/components/schemas/DepositAccount" } } + }, + "UnitWalletAccountResponse": { + "type": "object", + "title": "Unit Wallet Account Response", + "properties": { + "data": { + "$ref": "./account.json#/components/schemas/WalletAccount" + } + } } } }, "accounts": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getAccountsList", "summary": "Get List Accounts", "description": "Get List Accounts from API ", @@ -61,14 +72,22 @@ "type": "array", "items": { "type": "string", - "enum": ["Open", "Frozen", "Closed"] + "enum": [ + "Open", + "Frozen", + "Closed" + ] } }, "type": { "type": "array", "items": { "type": "string", - "enum": ["deposit", "credit"] + "enum": [ + "deposit", + "credit", + "wallet" + ] } }, "fromBalance": { @@ -125,14 +144,19 @@ }, "401": { "$ref": "../types.json#/components/schemas/DefaultError" + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "createAccount", - "summary": "Create Account", - "description": "Create Account via API ", + "summary": "Create Deposit Account", + "description": "Creates a deposit account for a Customer (or customers). An account.created event is raised when the call was successful. Each deposit account is created using a specific deposit product. A deposit product is a predefined set of terms associated with this deposit account (e.g. interest rate, spending limits). Use **checking** as the default value for the deposit product field while building your solution in sandbox. Contact Unit to create other deposit products under your organization. Deposit Account creation request supports Idempotency, ensuring that performing multiple identical requests will have the same effect as performing a single request. A successful account creation will result in an account in Open status. Later on, accounts can be either frozen, closed and in some cases reopened.", "requestBody": { "description": "Create Account Request", "required": true, @@ -163,7 +187,9 @@ }, "account": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getAccount", "parameters": [ { @@ -195,11 +221,16 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "patch": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "updateAccount", "summary": "Update Account", "description": "Update an Account via API ", @@ -244,7 +275,9 @@ }, "getAccountLimits": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getAccountLimits", "parameters": [ { @@ -275,13 +308,18 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "unfreezeAccount": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "unfreezeAccount", "parameters": [ { @@ -291,11 +329,11 @@ "name": "accountId", "in": "path", "required": true, - "description": "ID of the account to get" + "description": "ID of the account to unfreeze" } ], "summary": "Unfreeze Account by Id", - "description": "Unfreeze an Account via API ", + "description": "Unfreezes a previously frozen account. An account.unfrozen event is raised when the call is successful.", "responses": { "200": { "description": "Successful Response", @@ -315,10 +353,12 @@ }, "freezeAccount": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "freezeAccount", "summary": "Freeze Account by Id", - "description": "Freeze Account via API ", + "description": "Freezes an account. Freezing an account prevents users from performing many operations while preserving all the account data. An account.frozen event is raised when the call is successful.", "parameters": [ { "schema": { @@ -360,10 +400,12 @@ }, "closeAccount": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "closeAccount", "summary": "Close an Account by Id", - "description": "Close an Account via API ", + "description": "Closes an account. Closing an account is irreversible and can only be done by an Org user. An account.closed event is raised when the call was successful.\n\nNote that closing an account will also close the cards associated with the account.\n\nWhen closing an account with a balance of $1 or less, the funds will automatically be transferred to your organization's revenue account (see more at Account Low Balance Closure). When closing an account with a balance greater than $1, a check will be mailed to the business or individual address on file.\n\nWhen closing an account with a negative balance, the balance will be considered a loss, and will be covered from your reserve account", "parameters": [ { "schema": { @@ -405,10 +447,12 @@ }, "reopenAccount": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "reopenAccount", "summary": "Reopen an Account by Id", - "description": "Reopen an Account via API ", + "description": "Reopens a previously closed account. An account.reopened event is raised when the call was successful.", "parameters": [ { "schema": { @@ -417,7 +461,7 @@ "name": "accountId", "in": "path", "required": true, - "description": "ID of the account to close" + "description": "ID of the account to reopen" } ], "responses": { @@ -439,10 +483,12 @@ }, "enterDaca": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "enterControlAgreementForAccount", "summary": "Enter Account Control Agreement by Id", - "description": "Enter Control Agreement for Account via API ", + "description": "Indicates that a certain deposit account is subject to a Deposit Account Control Agreement. When DACA is entered, an `Operator` is assigned so in case of DACA activation the `Operator` will take control over the account, being the only entity authorized to move funds outside of the account. Setting an account with DACA `Entered` will not affect the account. It only means that DACA can be activated for this account in the future.", "parameters": [ { "schema": { @@ -473,10 +519,12 @@ }, "activateDaca": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "activateControlAgreementForAccount", "summary": "Activate Account Control Agreement by Id", - "description": "Activate Control Agreement for Account via API ", + "description": "Activates the Deposit Account Control Agreement, preventing funds from being withdrawn from the account through either end-customer initiated actions (freezing cards, restricting ACH/Wire origination) or external attempts (automatically rejecting received ACH debits). The only way of initiating money related activities (that will result in withdrawing funds from the account) would be using an org API token (when acting as the `Operator`). Activating a DACA will work only for a DACA `Operator` and for accounts that have previously entered a DACA.", "parameters": [ { "schema": { @@ -507,10 +555,12 @@ }, "deactivateDaca": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "deactivateControlAgreementForAccount", "summary": "Deactivate Account Control Agreement by Id", - "description": "Deactivate Control Agreement for Account via API", + "description": "Deactivate an account with DACA `Activated` status. This action will: 1. Return account's `dacaStatus` to `Entered`. 2. Unfreeze all account's cards that were frozen due to DACA. 3. Remove the restrictions on ACH, Wire and Book (when funds are debited from the DACA account). 4. Remove the restriction on incoming debit ACH payments.", "parameters": [ { "schema": { @@ -535,16 +585,21 @@ }, "404": { "$ref": "../types.json#/components/schemas/DefaultError" + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "getAccountBalanceHistory": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getAccountBalanceHistory", "summary": "Get Account Balance History", - "description": "Get Account Balance History List from API ", + "description": "List account end-of-day balances history (filtering and paging can be applied). The account balance history can be used to provide the customer with an overview of their balance across account(s) over time in a visually engaging way, providing insights and creating custom product features around it.", "parameters": [ { "$ref": "../types.json#/components/schemas/PageQuery" @@ -558,18 +613,22 @@ "type": "object", "properties": { "customerId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified customer id. At least one of accountId and customerId is required." }, "accountId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified account id. At least one of accountId and customerId is required." }, "since": { "type": "string", - "format": "date" + "format": "date", + "description": "Optional. Filters the account end-of-day balances after the specified date. e.g. 2021-06-01" }, "until": { "type": "string", - "format": "date" + "format": "date", + "description": "Optional. Filters the account end-of-day balances before the specified date. e.g. 2021-07-01" } } } @@ -589,6 +648,9 @@ "items": { "$ref": "./accountEndOfDay.json#/components/schemas/AccountEndOfDay" } + }, + "meta": { + "$ref": "../types.json#/components/schemas/PaginationMeta" } } } @@ -603,7 +665,9 @@ }, "repaymentInfo": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getRepaymentInformation", "summary": "Get Repayment Information", "description": "Retrieve the repayment information for a specific account via API", @@ -637,10 +701,12 @@ }, "depositProducts": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getDepositProductsList", - "summary": "Get Deposit Products", - "description": "Retrieve the list of available deposit products compatible to the account.", + "summary": "Get Available Deposit Products", + "description": "List of available deposit products compatible to the account.", "parameters": [ { "schema": { @@ -671,7 +737,9 @@ }, "customers": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "addAccountOwners", "parameters": [ { @@ -685,7 +753,7 @@ } ], "summary": "Add Owners to Account by Id", - "description": "Add Owners to Account via API ", + "description": "Add owner or owners to an existing deposit account.", "requestBody": { "description": "Add Account Owners Request", "required": true, @@ -714,7 +782,9 @@ } }, "delete": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "removeAccountOwners", "parameters": [ { @@ -724,11 +794,11 @@ "name": "accountId", "in": "path", "required": true, - "description": "ID of the account to add owners to" + "description": "ID of the account to remove owners from" } ], "summary": "Remove Owners from Account by Id", - "description": "Remove Owners from Account via API ", + "description": "Remove owner or owners from an existing joint deposit account.\n\nNote: At least one of the owners after deletion must be over 18 years old.\n\nNote: All cards related to the removed owners will be closed.", "requestBody": { "description": "Remove Account Owners Request", "required": true, @@ -757,4 +827,4 @@ } } } -} +} \ No newline at end of file diff --git a/schemas/account/closeAccount.json b/schemas/account/closeAccount.json index 414e9bc..9f15bc4 100644 --- a/schemas/account/closeAccount.json +++ b/schemas/account/closeAccount.json @@ -21,8 +21,8 @@ "properties": { "reason": { "type": "string", - "enum": ["ByCustomer", "Fraud"], - "default": "ByCustomer" + "enum": ["ByCustomer", "Fraud", "ByBank", "NegativeBalance"], + "description": "The reason for closing the account. Either ByCustomer, Fraud, ByBank, or NegativeBalance." }, "fraudReason": { "type": "string", @@ -36,23 +36,31 @@ "ClientIdentified", "IdentityTheft", "LinkedToFraudulentCustomer" - ] + ], + "description": "Optional. The expanded fraud reason for closing the account when Fraud is specified as the reason. Can be one of: (ACHActivity, CardActivity, CheckActivity, ApplicationHistory, AccountActivity, ClientIdentified, IdentityTheft, LinkedToFraudulentCustomer)." }, "bankReason": { "type": "string", "nullable": true, "enum": [ - "ProhibitedBusiness", - "MissingCddEdd", - "NonUsOperation", + "ProhibitedBusiness", + "MissingCddEdd", + "NonUsOperations", "SuspectedFraud" - ] + ], + "description": "Optional. The expanded bank reason for closing the account when ByBank is specified as the reason. Can be one of: (ProhibitedBusiness, MissingCddEdd, NonUsOperations, SuspectedFraud). This list is subject to change." } - } + }, + "required": ["reason"], + "additionalProperties": false } - } + }, + "required": ["type", "attributes"], + "additionalProperties": false } - } + }, + "required": ["data"], + "additionalProperties": false }, "FreezeAccountRequest": { "type": "object", @@ -79,11 +87,17 @@ "type": "string", "nullable": true } - } + }, + "required": ["reason"], + "additionalProperties": false } - } + }, + "required": ["type", "attributes"], + "additionalProperties": false } - } + }, + "required": ["data"], + "additionalProperties": false } } } diff --git a/schemas/account/createAccount.json b/schemas/account/createAccount.json index 7387315..7e5c2b3 100644 --- a/schemas/account/createAccount.json +++ b/schemas/account/createAccount.json @@ -21,10 +21,24 @@ "format": "int64" }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { + "$ref": "../types.json#/components/schemas/Tags" + }, + { + "description": "Optional. See [Tags](https://www.unit.co/docs/api/#tags)." + } + ] }, "idempotencyKey": { - "$ref": "../types.json#/components/schemas/IdempotencyKey" + "allOf": [ + { + "$ref": "../types.json#/components/schemas/IdempotencyKey" + }, + { + "description": "Optional. See [Idempotency](https://www.unit.co/docs/api/#intro-idempotency)." + } + ] } }, "additionalProperties": false, @@ -58,13 +72,28 @@ "type": "object", "properties": { "depositProduct": { - "type": "string" + "type": "string", + "description": "The name of the deposit product." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { + "$ref": "../types.json#/components/schemas/Tags" + }, + { + "description": "Optional. See [Tags](https://www.unit.co/docs/api/#tags)." + } + ] }, "idempotencyKey": { - "$ref": "../types.json#/components/schemas/IdempotencyKey" + "allOf": [ + { + "$ref": "../types.json#/components/schemas/IdempotencyKey" + }, + { + "description": "Optional. See [Idempotency](https://www.unit.co/docs/api/#intro-idempotency)." + } + ] } }, "additionalProperties": false, @@ -84,24 +113,42 @@ "additionalProperties": false }, "CreateWalletAccount": { + "title": "Create Wallet Account", "type": "object", + "description": "Creates a wallet account for a BusinessCustomer or BusinessWalletCustomer.", "properties": { "type": { "type": "string", "default": "walletAccount", - "enum": ["walletAccount"] + "enum": ["walletAccount"], + "description": "The type of account to create." }, "attributes": { "type": "object", "properties": { "walletTerms": { - "type": "string" + "type": "string", + "description": "The name of the wallet terms." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { + "$ref": "../types.json#/components/schemas/Tags" + }, + { + "description": "Optional. See [Tags](https://www.unit.co/docs/api/#tags)." + } + ] }, "idempotencyKey": { - "$ref": "../types.json#/components/schemas/IdempotencyKey" + "allOf": [ + { + "$ref": "../types.json#/components/schemas/IdempotencyKey" + }, + { + "description": "Optional. See [Idempotency](https://www.unit.co/docs/api/#intro-idempotency)." + } + ] } }, "required": ["walletTerms"] @@ -112,7 +159,8 @@ "title": "Create Wallet Account Relationships", "type": "object", "required": ["customer"], - "additionalProperties": false + "additionalProperties": false, + "description": "The customer the wallet belongs to. The customer is either a BusinessCustomer or BusinessWalletCustomer." }, { "$ref": "../relationships.json#/components/schemas/CustomerRelationship" diff --git a/schemas/account/depositProduct.json b/schemas/account/depositProduct.json index 299d53e..993a8b1 100644 --- a/schemas/account/depositProduct.json +++ b/schemas/account/depositProduct.json @@ -3,6 +3,7 @@ "schemas": { "DepositProduct": { "type": "object", + "description": "Deposit products define the set of end-customer terms that are applied to accounts, including interest rates, fees, limits, and clearing periods.", "properties": { "type": { "type": "string", @@ -10,7 +11,12 @@ }, "attributes": { "type": "object", - "properties": { "name": { "type": "string" } }, + "properties": { + "name": { + "type": "string", + "description": "The name of the deposit product." + } + }, "required": ["name"] } }, @@ -18,7 +24,8 @@ }, "UnitDepositProductsResponse": { "type": "object", - "title": "Credit Account Repayment Information Response", + "title": "Available Deposit Products Response", + "description": "Response containing available deposit products that are compatible with the account.", "properties": { "data": { "type": "array", diff --git a/schemas/account/limits.json b/schemas/account/limits.json index 595cecf..959b2c6 100644 --- a/schemas/account/limits.json +++ b/schemas/account/limits.json @@ -274,6 +274,7 @@ "WalletLimits": { "title": "Wallet Account Limits", "type": "object", + "description": "Some monetary transactions (such as originating ACH payments, ATM withdrawals or deposits) are subject to daily and/or monthly amount limits that are defined on the wallet level.", "allOf": [ { "$ref": "./limits.json#/components/schemas/Limits" @@ -286,6 +287,7 @@ "properties": { "ach": { "type": "object", + "description": "ACH payment limits configuration", "properties": { "limits": { "type": "object", @@ -359,6 +361,7 @@ }, "card": { "type": "object", + "description": "Card transaction limits configuration", "properties": { "limits": { "type": "object", @@ -414,6 +417,7 @@ }, "checkDeposit": { "type": "object", + "description": "Check deposit limits configuration", "properties": { "limits": { "type": "object", @@ -455,6 +459,7 @@ }, "wire": { "type": "object", + "description": "Wire transfer limits configuration", "properties": { "limits": { "type": "object", @@ -462,19 +467,19 @@ "dailyTransfer": { "type": "number" }, - "montlyTransfer": { + "monthlyTransfer": { "type": "number" }, "dailyTransferSoft": { "type": "number" }, - "montlyTransferSoft": { + "monthlyTransferSoft": { "type": "number" } }, "required": [ "dailyTransfer", - "montlyTransfer" + "monthlyTransfer" ] }, "totalsDaily": { @@ -486,7 +491,7 @@ }, "required": ["transfers"] }, - "totalsMontly": { + "totalsMonthly": { "type": "object", "properties": { "transfers": { @@ -499,11 +504,12 @@ "required": [ "limits", "totalsDaily", - "totalsMontly" + "totalsMonthly" ] }, "checkPayment": { "type": "object", + "description": "Check payment limits configuration", "properties": { "limits": { "type": "object", @@ -511,7 +517,7 @@ "dailySent": { "type": "number" }, - "montlySent": { + "monthlySent": { "type": "number" }, "dailySentSoft": { @@ -535,7 +541,7 @@ }, "required": ["sent"] }, - "totalsMontly": { + "totalsMonthly": { "type": "object", "properties": { "sent": { @@ -548,7 +554,7 @@ "required": [ "limits", "totalsDaily", - "totalsMontly" + "totalsMonthly" ] } }, diff --git a/schemas/account/owners.json b/schemas/account/owners.json index 44b9857..5e3582f 100644 --- a/schemas/account/owners.json +++ b/schemas/account/owners.json @@ -3,6 +3,7 @@ "schemas": { "DepositAccountOwner": { "type": "object", + "description": "Represents an individual customer owner of a deposit account.", "properties": { "type": { "type": "string", @@ -16,10 +17,12 @@ }, "DepositAccountOwners": { "type": "array", + "description": "A list of individual customers to be added to or removed from an account.", "items": { "$ref": "#/components/schemas/DepositAccountOwner" } }, "AddAccountOwnersRequest": { "type": "object", + "description": "Request to add owners to an existing deposit account.", "properties": { "data": { "$ref": "#/components/schemas/DepositAccountOwners" @@ -29,6 +32,7 @@ }, "RemoveAccountOwnersRequest": { "type": "object", + "description": "Request to remove owners from an existing joint deposit account.", "properties": { "data": { "$ref": "#/components/schemas/DepositAccountOwners" diff --git a/schemas/account/patchAccount.json b/schemas/account/patchAccount.json index 5d4bee9..eb90f4e 100644 --- a/schemas/account/patchAccount.json +++ b/schemas/account/patchAccount.json @@ -50,6 +50,42 @@ "additionalProperties": false, "required": ["type", "attributes"] }, + "UpdateWalletAccount": { + "title": "Update Wallet Account", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["walletAccount"], + "default": "walletAccount" + }, + "attributes": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Optional. The name of the wallet." + }, + "tags": { + "allOf": [ + { + "$ref": "../types.json#/components/schemas/Tags" + }, + { + "description": "Optional. See [Tags](https://www.unit.co/docs/api/#tags)." + } + ] + }, + "walletTerms": { + "type": "string", + "description": "Optional. The name of the selected wallet terms." + } + } + } + }, + "additionalProperties": false, + "required": ["type", "attributes"] + }, "UpdateAccountRequest": { "title": "Update Account", "type": "object", @@ -61,6 +97,9 @@ }, { "$ref": "#/components/schemas/UpdateCreditAccount" + }, + { + "$ref": "#/components/schemas/UpdateWalletAccount" } ] } diff --git a/schemas/application/application.json b/schemas/application/application.json index ab58992..40f958d 100644 --- a/schemas/application/application.json +++ b/schemas/application/application.json @@ -10,7 +10,8 @@ "Denied", "Pending", "Canceled" - ] + ], + "description": "Status of the application. The final statuses for an application are `Approved`, `Denied` or `Canceled`. Once an application is approved, a Customer resource will be created and associated with the application resource." }, "PowerOfAttorneyAgent": { "title": "Power of Attorney Agent", diff --git a/schemas/application/applicationPaths.json b/schemas/application/applicationPaths.json index ef2cd10..c4f7d9e 100644 --- a/schemas/application/applicationPaths.json +++ b/schemas/application/applicationPaths.json @@ -43,7 +43,9 @@ }, "type": { "type": "string", - "enum": ["beneficialOwner"], + "enum": [ + "beneficialOwner" + ], "default": "beneficialOwner" }, "attributes": { @@ -52,13 +54,17 @@ } } }, - "required": ["data"] + "required": [ + "data" + ] } } }, "application": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getApplication", "parameters": [ { @@ -90,14 +96,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "patch": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "updateApplication", "summary": "Update Application", - "description": "Update an Application via API ", + "description": "Update an Application via API. Can be used to update individual applications, sole proprietorships, business applications, and business officers.", "parameters": [ { "schema": { @@ -130,13 +141,18 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "cancelApplication": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "cancelApplication", "parameters": [ { @@ -149,8 +165,8 @@ "description": "ID of the application to get" } ], - "summary": "Cancel Application by Id", - "description": "Cancel a Application via API ", + "summary": "Cancel Application", + "description": "Cancel an Application at any point that is not Pending, Approved or Denied. The status of the application will change to Canceled, and the relevant webhook event will be fired.", "requestBody": { "description": "Cancel Application Request", "required": true, @@ -165,7 +181,9 @@ "properties": { "type": { "type": "string", - "enum": ["applicationCancel"] + "enum": [ + "applicationCancel" + ] }, "attributes": { "type": "object", @@ -204,15 +222,20 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "applications": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getApplicationsList", - "summary": "Get List Application", + "summary": "List", "description": "Get List Applications from API ", "parameters": [ { @@ -292,7 +315,9 @@ } }, "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "createApplication", "summary": "Create Application", "description": "Create an Application via API ", @@ -329,13 +354,18 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "applicationForms": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getApplicationFormsList", "summary": "Get List Application Forms", "description": "Get List Application Forms from API ", @@ -358,7 +388,10 @@ "type": "array", "items": { "type": "string", - "enum": ["Pending", "Approved"] + "enum": [ + "Pending", + "Approved" + ] } }, "email": { @@ -400,11 +433,16 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "createApplicationForm", "summary": "Create Application Form", "description": "Create an Application Form via API ", @@ -435,13 +473,18 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "applicationForm": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getApplicationForm", "parameters": [ { @@ -482,13 +525,18 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "uploadApplicationDocumentFile": { "put": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "uploadApplicationDocumentFile", "parameters": [ { @@ -510,7 +558,8 @@ "description": "ID of the document to upload a file for" } ], - "summary": "Upload an application document file. Supports PDF, PNG and JPG files", + "summary": "Upload Document", + "description": "Uploads a document file. Supported file types are `pdf`, `jpeg` or `png`. For a driver's license, this operation uploads the front-side only. Upload the back-side of a driver's licence using Upload Document Back-Side API. Maximum size for a document is 20mb.", "requestBody": { "description": "An application document file", "required": true, @@ -532,13 +581,18 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "uploadApplicationDocumentFileBack": { "put": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "uploadApplicationDocumentFileBackSide", "parameters": [ { @@ -560,8 +614,8 @@ "description": "ID of the document to upload a file for" } ], - "summary": "Upload an application document file - Back Side. Supports PDF, PNG and JPG files", - "description": "Upload an application file via API - Back Side. Supports PDF, PNG and JPG files", + "summary": "Upload Document Back-Side", + "description": "Uploads the back-side of a document. Supported file types are `pdf`, `jpeg` or `png`. This operation is only relevant to driver's licenses. Maximum size for a document is 20mb.", "requestBody": { "description": "Upload an application document file - Back Side. Supports PDF, PNG and JPG files", "required": true, @@ -583,15 +637,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "documents": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getApplicationDocuments", - "parameters": [ { "schema": { @@ -603,8 +661,8 @@ "description": "ID of the application to get documents for" } ], - "summary": "Get List of Documents", - "description": "Get List of Documents via API ", + "summary": "List", + "description": "List application documents. You can also list the application documents via Get Application by Id, the documents will be included in the response `included` top-level field.", "responses": { "200": { "description": "Successful Response", @@ -624,13 +682,17 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "createApplicationDocument", - "parameters": [ { "schema": { @@ -651,8 +713,8 @@ } } ], - "summary": "Create an application document", - "description": "Create an application document via API", + "summary": "Create Document", + "description": "Unit allows you to create (and store) **custom documents**. This feature allows you to run additional document verifications on your side - these are documents that are not required by Unit for the evaluation of the application. Once you create a custom document resource, you can upload and store the document by using the relevant endpoints.", "responses": { "200": { "description": "Successful Response", @@ -663,15 +725,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "verifyDocument": { - "put": { - "tags": ["unit"], + "post": { + "tags": [ + "unit" + ], "operationId": "verifyApplicationDocument", - "parameters": [ { "schema": { @@ -692,21 +758,48 @@ "description": "ID of the document to verify" } ], - "summary": "Verify a document", - "description": "Verify a document via API ", + "summary": "Verify Document", + "description": "Verify Selfie Verification document", "requestBody": { "description": "Verify Document", "required": true, "content": { - "application/json": { + "application/vnd.api+json": { "schema": { "type": "object", - "title": "Verify Document", + "title": "Verify Document Request", "properties": { - "jobId": { - "type": "string" + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "selfieVerification" + ] + }, + "attributes": { + "type": "object", + "properties": { + "jobId": { + "type": "string", + "description": "Verification job identifier" + } + }, + "required": [ + "jobId" + ] + } + }, + "required": [ + "type", + "attributes" + ] } - } + }, + "required": [ + "data" + ] } } } @@ -721,15 +814,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "downloadDocument": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "downloadApplicationDocument", - "parameters": [ { "schema": { @@ -750,8 +847,8 @@ "description": "ID of the document to download" } ], - "summary": "Download a Document", - "description": "Download a Document via API ", + "summary": "Download Document", + "description": "Download the application document file.", "responses": { "200": { "description": "Successful Response", @@ -763,15 +860,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "downloadBackSideDocument": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "downloadApplicationBackSideDocument", - "parameters": [ { "schema": { @@ -792,8 +893,8 @@ "description": "ID of the document to download" } ], - "summary": "Download a Document - Back Side", - "description": "Download a Document - Back Side via API", + "summary": "Download Document Back-Side", + "description": "Download the application document back-side file.", "responses": { "200": { "description": "Successful Response", @@ -805,16 +906,21 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "updateBusinessBeneficialOwner": { "patch": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "updateBusinessBeneficialOwner", - "description": "Update a Business Beneficial Owner", - "summary": "Update a Business Beneficial Owner via API", + "summary": "Update Business Beneficial Owner", + "description": "Update a business application's beneficial owner. The application id associated with the beneficial owner must be passed as a relationship in the request body.", "parameters": [ { "schema": { @@ -847,8 +953,11 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/application/document.json b/schemas/application/document.json index 1ce99ed..67d80db 100644 --- a/schemas/application/document.json +++ b/schemas/application/document.json @@ -17,13 +17,34 @@ "type": "object", "properties": { "documentType": { - "type": "string" + "type": "string", + "enum": [ + "IdDocument", + "Passport", + "AddressVerification", + "SocialSecurityCard", + "CertificateOfIncorporation", + "EmployerIdentificationNumberConfirmation", + "ClientRequested", + "SelfieVerification" + ], + "description": "The type of document. IdDocument: An individual's Drivers License or State ID. Both front-side and back-side are required. Passport: An individual's passport. AddressVerification: An individual's document to verify address. Document may be a utility bill, bank statement, lease agreement or current pay stub. SocialSecurityCard: An individual's social security card. CertificateOfIncorporation: A business's certificate of incorporation. A certificate of assumed name will also be accepted. EmployerIdentificationNumberConfirmation: A business's EIN confirmation document (either IRS form 147c or IRS form CP-575). ClientRequested: Client requested customer document. SelfieVerification: Selfie verification document." }, "status": { - "type": "string" + "type": "string", + "enum": [ + "Required", + "ReceivedBack", + "ReceivedFront", + "Invalid", + "Approved", + "PendingReview" + ], + "description": "The status of the document. Required: The document is required for the application to be evaluated. ReceivedBack: Back-side of the document was received. Front-side is still required. Only relevant for IdDocument document type. ReceivedFront: Front-side of the document was received. Back-side is still required. Only relevant for IdDocument document type. Invalid: The document is invalid. You may re-upload the correct document for the application to be evaluated. Approved: The document is approved. PendingReview: The document is currently undergoing review." }, "description": { - "type": "string" + "type": "string", + "description": "Description of the document." }, "nationality": { "$ref": "../types.json#/components/schemas/Country" @@ -38,10 +59,12 @@ "type": "string" }, "name": { - "type": "string" + "type": "string", + "description": "Name associated with the document." }, "address": { - "$ref": "../types.json#/components/schemas/Address" + "$ref": "../types.json#/components/schemas/Address", + "description": "Address associated with the document." }, "dateOfIncorporation": { "type": "string", @@ -52,7 +75,8 @@ }, "dateOfBirth": { "type": "string", - "format": "date" + "format": "date", + "description": "Date of birth associated with the document." }, "ein": { "type": "string", diff --git a/schemas/application/updateApplication.json b/schemas/application/updateApplication.json index 4aa6886..4eb1031 100644 --- a/schemas/application/updateApplication.json +++ b/schemas/application/updateApplication.json @@ -14,16 +14,28 @@ "type": "object", "properties": { "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "See [Updating Tags](https://www.unit.co/docs/api/#updating-tags)." } + ] }, "occupation": { - "$ref": "../types.json#/components/schemas/Occupation" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Occupation" }, + { "description": "Optional. Occupation of the individual. See [Occupation](https://www.unit.co/docs/api/types/#occupation)." } + ] }, "annualIncome": { - "$ref": "../types.json#/components/schemas/AnnualIncome" + "allOf": [ + { "$ref": "../types.json#/components/schemas/AnnualIncome" }, + { "description": "Optional. Annual income of the individual. See [AnnualIncome](https://www.unit.co/docs/api/types/#annual-income)." } + ] }, "sourceOfIncome": { - "$ref": "../types.json#/components/schemas/SourceOfIncome" + "allOf": [ + { "$ref": "../types.json#/components/schemas/SourceOfIncome" }, + { "description": "Optional. Source of income of the individual. See [SourceOfIncome](https://www.unit.co/docs/api/types/#source-of-income)." } + ] } }, "additionalProperties": false @@ -45,31 +57,56 @@ "type": "object", "properties": { "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "See [Updating Tags](https://www.unit.co/docs/api/#updating-tags)." } + ] }, "annualRevenue": { - "$ref": "../types.json#/components/schemas/BusinessAnnualRevenue" + "allOf": [ + { "$ref": "../types.json#/components/schemas/BusinessAnnualRevenue" }, + { "description": "Optional. Annual revenue of the business. See [BusinessAnnualRevenue](https://www.unit.co/docs/api/types/#annual-revenue)." } + ] }, "numberOfEmployees": { - "$ref": "../types.json#/components/schemas/BusinessNumberOfEmployees" + "allOf": [ + { "$ref": "../types.json#/components/schemas/BusinessNumberOfEmployees" }, + { "description": "Optional. Number of employees at the business. See [BusinessNumberOfEmployees](https://www.unit.co/docs/api/types/#number-of-employees)." } + ] }, "cashFlow": { - "$ref": "../types.json#/components/schemas/CashFlow" + "allOf": [ + { "$ref": "../types.json#/components/schemas/CashFlow" }, + { "description": "Optional. Cash flow of the business. See [CashFlow](https://www.unit.co/docs/api/types/#cashflow)." } + ] }, "yearOfIncorporation": { - "$ref": "../types.json#/components/schemas/Year" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Year" }, + { "description": "Optional. Year of incorporation of the business. See [Year](https://www.unit.co/docs/api/types/#year)." } + ] }, "countriesOfOperation": { "type": "array", "items": { "$ref": "../types.json#/components/schemas/Country" }, - "minItems": 1 + "minItems": 1, + "description": "Optional. Countries of operation of the business." + }, + "stockSymbol": { + "type": "string", + "description": "Optional. Stock symbol of the business." + }, + "website": { + "type": "string", + "description": "Optional. Website of the business." }, - "stockSymbol": { "type": "string" }, - "website": { "type": "string" }, "businessVertical": { - "$ref": "../types.json#/components/schemas/BusinessVertical" + "allOf": [ + { "$ref": "../types.json#/components/schemas/BusinessVertical" }, + { "description": "Optional. Business vertical of the business. See [BusinessVertical](https://www.unit.co/docs/api/types/#business-vertical)." } + ] } }, "additionalProperties": false @@ -91,13 +128,22 @@ "type": "object", "properties": { "occupation": { - "$ref": "../types.json#/components/schemas/Occupation" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Occupation" }, + { "description": "Optional. Occupation of the beneficial owner. See [Occupation](https://www.unit.co/docs/api/types/#occupation)." } + ] }, "annualIncome": { - "$ref": "../types.json#/components/schemas/AnnualIncome" + "allOf": [ + { "$ref": "../types.json#/components/schemas/AnnualIncome" }, + { "description": "Optional. Annual income of the beneficial owner. See [AnnualIncome](https://www.unit.co/docs/api/types/#annual-income)." } + ] }, "sourceOfIncome": { - "$ref": "../types.json#/components/schemas/SourceOfIncome" + "allOf": [ + { "$ref": "../types.json#/components/schemas/SourceOfIncome" }, + { "description": "Optional. Source of income of the beneficial owner. See [SourceOfIncome](https://www.unit.co/docs/api/types/#source-of-income)." } + ] }, "relationships": { "$ref": "../relationships.json#/components/schemas/ApplicationRelationship" @@ -122,19 +168,32 @@ "type": "object", "properties": { "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "See [Updating Tags](https://www.unit.co/docs/api/#updating-tags)." } + ] }, "annualRevenue": { - "$ref": "../types.json#/components/schemas/SoleProprietorshipAnnualRevenue" + "allOf": [ + { "$ref": "../types.json#/components/schemas/SoleProprietorshipAnnualRevenue" }, + { "description": "Optional. Specify the annual revenue here. See [SoleProprietorshipAnnualRevenue](https://www.unit.co/docs/api/types/#annual-revenue)." } + ] }, "numberOfEmployees": { - "$ref": "../types.json#/components/schemas/SoleProprietorshipNumberOfEmployees" + "allOf": [ + { "$ref": "../types.json#/components/schemas/SoleProprietorshipNumberOfEmployees" }, + { "description": "Optional. Specify the number of employees here. See [SoleProprietorshipNumberOfEmployees](https://www.unit.co/docs/api/types/#number-of-employees)." } + ] }, "businessVertical": { - "$ref": "../types.json#/components/schemas/BusinessVertical" + "allOf": [ + { "$ref": "../types.json#/components/schemas/BusinessVertical" }, + { "description": "Optional. Specify the business vertical here. See [BusinessVertical](https://www.unit.co/docs/api/types/#business-vertical)." } + ] }, "website": { - "type": "string" + "type": "string", + "description": "Optional. Specify the business website here." } }, "additionalProperties": false @@ -147,13 +206,22 @@ "type": "object", "properties": { "occupation": { - "$ref": "../types.json#/components/schemas/Occupation" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Occupation" }, + { "description": "Optional. Occupation of the officer. See [Occupation](https://www.unit.co/docs/api/types/#occupation)." } + ] }, "annualIncome": { - "$ref": "../types.json#/components/schemas/AnnualIncome" + "allOf": [ + { "$ref": "../types.json#/components/schemas/AnnualIncome" }, + { "description": "Optional. Annual income of the officer. See [AnnualIncome](https://www.unit.co/docs/api/types/#annual-income)." } + ] }, "sourceOfIncome": { - "$ref": "../types.json#/components/schemas/SourceOfIncome" + "allOf": [ + { "$ref": "../types.json#/components/schemas/SourceOfIncome" }, + { "description": "Optional. Source of income of the officer. See [SourceOfIncome](https://www.unit.co/docs/api/types/#source-of-income)." } + ] } } }, diff --git a/schemas/application/updateBusinessBeneficialOwner.json b/schemas/application/updateBusinessBeneficialOwner.json index 2a74213..f08a62d 100644 --- a/schemas/application/updateBusinessBeneficialOwner.json +++ b/schemas/application/updateBusinessBeneficialOwner.json @@ -14,13 +14,28 @@ "type": "object", "properties": { "occupation": { - "$ref": "../types.json#/components/schemas/Occupation" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Occupation" }, + { "description": "Optional. Occupation of the beneficial owner. See [Occupation](https://www.unit.co/docs/api/types/#occupation)." } + ] }, "annualIncome": { - "$ref": "../types.json#/components/schemas/AnnualIncome" + "allOf": [ + { "$ref": "../types.json#/components/schemas/AnnualIncome" }, + { "description": "Optional. Annual income of the beneficial owner. See [AnnualIncome](https://www.unit.co/docs/api/types/#annual-income)." } + ] }, "sourceOfIncome": { - "$ref": "../types.json#/components/schemas/SourceOfIncome" + "allOf": [ + { "$ref": "../types.json#/components/schemas/SourceOfIncome" }, + { "description": "Optional. Source of income of the beneficial owner. See [SourceOfIncome](https://www.unit.co/docs/api/types/#source-of-income)." } + ] + }, + "percentage": { + "type": "integer", + "minimum": 25, + "maximum": 100, + "description": "Optional. The beneficial owner percentage of ownership at the business (between 25 and 100). See [beneficial owner percentage](https://www.unit.co/docs/api/applications/#update-business-beneficial-owner)." } } }, diff --git a/schemas/atm/atmLocation.json b/schemas/atm/atmLocation.json index 3ed2086..77aa253 100644 --- a/schemas/atm/atmLocation.json +++ b/schemas/atm/atmLocation.json @@ -2,7 +2,7 @@ "components": { "schemas": { "AtmLocation": { - "title": "Atm Location", + "title": "ATM Location", "type": "object", "properties": { "type": { @@ -14,25 +14,36 @@ "type": "object", "properties": { "network": { - "type": "string" + "type": "string", + "description": "The ATM network." }, "locationName": { - "type": "string" + "type": "string", + "description": "The name of the ATM location." }, "coordinates": { - "$ref": "../types.json#/components/schemas/Coordinates" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Coordinates" }, + { "description": "The coordinates of the ATM location." } + ] }, "address": { - "$ref": "../types.json#/components/schemas/Address" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Address" }, + { "description": "The address of the ATM location." } + ] }, "distance": { - "type": "integer" + "type": "number", + "description": "The distance from the search location in miles." }, "surchargeFree": { - "type": "boolean" + "type": "boolean", + "description": "Indicates whether the ATM is surcharge-free." }, "acceptDeposits": { - "type": "boolean" + "type": "boolean", + "description": "Indicates whether the ATM accepts deposits." } } } diff --git a/schemas/atm/atmLocationPaths.json b/schemas/atm/atmLocationPaths.json index b6e2493..90b9f4e 100644 --- a/schemas/atm/atmLocationPaths.json +++ b/schemas/atm/atmLocationPaths.json @@ -1,33 +1,84 @@ { "listAtmLocations": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getAtmLocationsList", - "summary": "Get List of ATM Locations", - "description": "Get List ATM Locations from API ", + "summary": "List ATM Locations", + "description": "Unit provides an API for nearby ATM search. The API supports searching by coordinates, postal code, address and radius.", "parameters": [ { - "name": "filter", + "name": "filter[coordinates]", "in": "query", + "schema": { + "type": "object", + "properties": { + "longitude": { + "type": "string", + "description": "The longitude coordinate." + }, + "latitude": { + "type": "string", + "description": "The latitude coordinate." + } + }, + "required": [ + "longitude", + "latitude" + ] + }, "style": "deepObject", - "allowReserved": true, + "explode": true, + "description": "Filters the results by the specified coordinates." + }, + { + "name": "filter[searchRadius]", + "in": "query", + "schema": { + "type": "number" + }, + "description": "Optional. Filters the results by the search radius (in miles). Default and max values are 100." + }, + { + "name": "filter[postalCode]", + "in": "query", + "schema": { + "type": "string" + }, + "description": "Filters the results by the specified postal code." + }, + { + "name": "filter[address]", + "in": "query", "schema": { "type": "object", "properties": { - "coordinates": { - "type": "object" + "street": { + "type": "string", + "description": "The street address." + }, + "city": { + "type": "string", + "description": "The city." }, - "searchRadius": { - "type": "integer" + "state": { + "type": "string", + "description": "The state." }, "postalCode": { - "type": "string" + "type": "string", + "description": "The postal code." }, - "address": { - "type": "object" + "country": { + "type": "string", + "description": "The country code." } } - } + }, + "style": "deepObject", + "explode": true, + "description": "Filters the results by the specified address." } ], "responses": { @@ -36,16 +87,28 @@ "content": { "application/vnd.api+json; charset=utf-8": { "schema": { - "type": "array", - "title": "Unit Atm Locations List Response", - "items": { - "$ref": "./atmLocation.json#/components/schemas/AtmLocation" - } + "type": "object", + "title": "ATM Locations List Response", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "./atmLocation.json#/components/schemas/AtmLocation" + }, + "description": "Array of ATM Location resources." + } + }, + "required": [ + "data" + ] } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/authorization/authorization.json b/schemas/authorization/authorization.json index 4182c3e..86ddd80 100644 --- a/schemas/authorization/authorization.json +++ b/schemas/authorization/authorization.json @@ -29,6 +29,7 @@ "Authorization": { "title": "Authorization Document", "type": "object", + "description": "The authorization (also authorization hold) process is an essential step in completing a card transaction. During authorization, the merchant receives the card holder's information and verifies that the card is valid and that the card holder has sufficient funds to cover the amount of the transaction. Most merchants proceed immediately from authorization to the completion of the transaction, but they have the option to place a hold instead.", "properties": { "type": { "type": "string", @@ -43,48 +44,80 @@ "properties": { "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the authorization was created." }, "amount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "The amount of the authorization in cents." }, "cardLast4Digits": { - "type": "string" + "type": "string", + "description": "The last 4 digits of the card number." }, "merchant": { - "$ref": "../types.json#/components/schemas/Merchant" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Merchant" }, + { "description": "Information about the merchant where the transaction occurred." } + ] }, "recurring": { - "type": "boolean" + "type": "boolean", + "description": "Indicates whether this is a recurring transaction." }, "status": { - "type": "string" + "type": "string", + "enum": ["Authorized", "Completed", "Canceled", "Declined"], + "description": "The status of the authorization. Possible values: Authorized, Completed, Canceled, Declined." }, "declineReason": { - "type": "string" + "type": "string", + "enum": [ + "CardVerificationValueFailed", + "IncorrectPIN", + "ExceedsAmountLimit", + "InsufficientFunds", + "RequestedFunctionNotSupported", + "AllowablePINTriesExceeded", + "SuspectedFraud", + "ClosedAccount", + "DoNotHonor", + "CardholderBlocked", + "CardStolen", + "RestrictedCard" + ], + "description": "The reason for declining the authorization if the status is Declined." }, "tags": { "$ref": "../types.json#/components/schemas/Tags" }, "paymentMethod": { - "type": "string" + "type": "string", + "description": "The payment method used for the transaction." }, "digitalWallet": { - "type": "string" + "type": "string", + "description": "The digital wallet used for the transaction, if applicable." }, "summary": { - "type": "string" + "type": "string", + "description": "A summary of the transaction." }, "cardVerificationData": { - "$ref": "../types.json#/components/schemas/CardVerificationData" + "allOf": [ + { "$ref": "../types.json#/components/schemas/CardVerificationData" }, + { "description": "Card verification data for the transaction." } + ] }, "cardNetwork": { - "type": "string" + "type": "string", + "description": "The card network used for the transaction." }, "cashWithdrawalAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "The cash withdrawal amount for ATM transactions, in cents." } }, "required": [ diff --git a/schemas/authorization/authorizationPaths.json b/schemas/authorization/authorizationPaths.json index bf222ee..ccec258 100644 --- a/schemas/authorization/authorizationPaths.json +++ b/schemas/authorization/authorizationPaths.json @@ -1,11 +1,12 @@ { "authorizations": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getAuthorizationsList", - "summary": "Get List authorizations", - "description": "Get List Authorizations from API ", + "description": "List authorizations. Filtering and sorting can be applied. Paging is available only when filtering by customer id or account id.", "parameters": [ { "$ref": "../types.json#/components/schemas/PageQuery" @@ -19,39 +20,56 @@ "type": "object", "properties": { "accountId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified account id." }, "accountType": { - "type": "string" + "type": "string", + "enum": [ + "deposit", + "credit" + ], + "description": "Optional. Filter the results by account type (deposit, credit)." }, "customerId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified customer id." }, "cardId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified card id." }, "includeNonAuthorized": { - "type": "boolean" + "type": "boolean", + "default": false, + "description": "Optional. Include authorizations from all statuses." }, "merchantCategoryCode": { "type": "array", "items": { - "type": "string" - } + "type": "integer" + }, + "description": "Optional. Filter authorizations by their 4-digit ISO 18245 merchant category code (MCC)." }, "since": { - "type": "string" + "type": "string", + "format": "date-time", + "description": "Optional. Filters the Authorizations that occurred _after_ the specified date. e.g. 2020-01-13T16:01:19.346Z" }, "until": { - "type": "string" + "type": "string", + "format": "date-time", + "description": "Optional. Filters the Authorizations that occurred _before_ the specified date. e.g. 2020-01-02T20:06:23.486Z" }, "fromAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "Optional. Filters the Authorizations that have an amount that is _higher or equal to_ the specified amount (in cents). e.g. 5000" }, "toAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "Optional. Filters the Authorizations that have an amount that is _lower or equal to_ the specified amount (in cents). e.g. 7000" }, "status": { "type": "array", @@ -63,7 +81,9 @@ "Canceled", "Declined" ] - } + }, + "default": ["Authorized"], + "description": "Optional. Filter authorizations by Authorization Status." } } } @@ -72,8 +92,10 @@ "name": "sort", "in": "query", "schema": { - "type": "string" - } + "type": "string", + "default": "-createdAt" + }, + "description": "Optional. Leave empty or provide sort=createdAt for ascending order. Provide sort=-createdAt (leading minus sign) for descending order." } ], "responses": { @@ -90,20 +112,34 @@ "items": { "$ref": "./authorization.json#/components/schemas/Authorization" } + }, + "meta": { + "allOf": [ + { + "$ref": "../types.json#/components/schemas/PaginationMeta" + }, + { + "description": "Pagination metadata. Will be defined only when filtered by customer or account id." + } + ] } } } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "authorization": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getAuthorization", - "parameters": [ { "schema": { @@ -115,15 +151,16 @@ "description": "ID of the authorization to get" }, { - "name": "includeNoneAuthorized", + "name": "filter[includeNonAuthorized]", "in": "query", "schema": { "type": "boolean" - } + }, + "description": "Optional. Include authorizations from all statuses." } ], "summary": "Get Authorization by Id", - "description": "Get a Authorization from API ", + "description": "Get an authorization resource by id.", "responses": { "200": { "description": "Successful Response", @@ -140,17 +177,21 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "authorizationsRequests": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getAuthorizationRequestsList", - "summary": "Get List Authorization Requests", - "description": "Get List Authorization Requests from API ", + "description": "List authorization requests. Filtering and paging can be applied.", "parameters": [ { "$ref": "../types.json#/components/schemas/PageQuery" @@ -164,24 +205,29 @@ "type": "object", "properties": { "accountId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified account id." }, "customerId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified customer id." }, - "merchantCategoryCode": { + "merchantCategoryCode[]": { "type": "array", "items": { - "type": "string" - } + "type": "integer" + }, + "description": "Optional. Filter result by their 4-digit ISO 18245 merchant category code (MCC)." }, "fromAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "Optional. Filters the result that have an amount that is _higher or equal to_ the specified amount (in cents). e.g. 5000" }, "toAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "Optional. Filters the result that have an amount that is _lower or equal to_ the specified amount (in cents). e.g. 7000" } } } @@ -206,15 +252,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "authorizationRequest": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getAuthorizationRequest", - "parameters": [ { "schema": { @@ -227,7 +277,7 @@ } ], "summary": "Get Authorization Request by Id", - "description": "Get a Authorization Request from API ", + "description": "Get an authorization request resource by id.", "responses": { "200": { "description": "Successful Response", @@ -244,15 +294,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "approveAuthorizationRequests": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "approveAuthorizationRequest", - "parameters": [ { "schema": { @@ -265,7 +319,7 @@ } ], "summary": "Approve Authorization Request by Id", - "description": "Approve a Authorization Request via API ", + "description": "Approve an authorization request.", "requestBody": { "description": "Approve Authorization Request", "required": true, @@ -299,15 +353,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "declineAuthorizationRequests": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "declineAuthorizationRequest", - "parameters": [ { "schema": { @@ -320,7 +378,7 @@ } ], "summary": "Decline Authorization Request", - "description": "Decline Authorization Request via API ", + "description": "Decline an authorization request.", "requestBody": { "description": "Decline Authorization Request", "required": true, @@ -354,8 +412,11 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/authorization/authorizationRequest.json b/schemas/authorization/authorizationRequest.json index 5fe4aea..7675881 100644 --- a/schemas/authorization/authorizationRequest.json +++ b/schemas/authorization/authorizationRequest.json @@ -15,13 +15,18 @@ "properties": { "amount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "Optional. The approved amount (in cents). Can only be specified if the authorization request's partialApprovalAllowed is set to true." }, "fundingAccount": { - "type": "string" + "type": "string", + "description": "Optional. The id of an alternate account (either the customer's or another's) that should be used for funding the transaction. Please contact Unit to enable this feature." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional, See [Tags](https://www.unit.co/docs/api/#tags). The specified tags will be inherited by the resulting authorization and transaction resources." } + ] } } } @@ -52,7 +57,8 @@ "ReferToCardIssuer", "RestrictedCard", "TransactionNotPermittedToCardholder" - ] + ], + "description": "The reason for declining the authorization request. One of AccountClosed, CardExceedsAmountLimit, DoNotHonor, InsufficientFunds, InvalidMerchant, ReferToCardIssuer, RestrictedCard, TransactionNotPermittedToCardholder." } } } @@ -97,58 +103,120 @@ "properties": { "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the authorization request was created." }, "amount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "The amount of the authorization request in cents." + }, + "available": { + "type": "integer", + "format": "int64", + "description": "The available balance in the account, in cents." }, "status": { - "type": "string" + "type": "string", + "enum": ["Pending", "Approved", "Declined"], + "description": "The status of the authorization request." }, "partialApprovalAllowed": { - "type": "boolean" + "type": "boolean", + "description": "Indicates whether partial approval is allowed for this request." }, "approvedAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "The approved amount for the authorization request, if applicable." }, "declineReason": { - "type": "string" + "type": "string", + "description": "The reason for declining the authorization request, if declined." }, "merchant": { - "$ref": "../types.json#/components/schemas/Merchant" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Merchant" }, + { "description": "Information about the merchant where the transaction is occurring." } + ] }, "recurring": { - "type": "boolean" + "type": "boolean", + "description": "Indicates whether this is a recurring transaction." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional tags associated with this authorization request." } + ] }, "healthcareAmounts": { - "$ref": "../types.json#/components/schemas/HealthcareAmounts" + "allOf": [ + { "$ref": "../types.json#/components/schemas/HealthcareAmounts" }, + { "description": "Healthcare-related amounts, if applicable." } + ] }, "paymentMethod": { - "type": "string" + "type": "string", + "description": "The payment method used for the transaction." }, "digitalWallet": { - "type": "string" + "type": "string", + "description": "The digital wallet used for the transaction, if applicable." }, "cardVerificationData": { - "$ref": "../types.json#/components/schemas/CardVerificationData" + "allOf": [ + { "$ref": "../types.json#/components/schemas/CardVerificationData" }, + { "description": "Card verification data for the transaction." } + ] }, "ecommerce": { - "type": "boolean" + "type": "boolean", + "description": "Indicates whether this is an e-commerce transaction." }, "cardPresent": { - "type": "boolean" + "type": "boolean", + "description": "Indicates whether the card was physically present for the transaction." + }, + "direction": { + "type": "string", + "description": "The direction of the transaction (e.g., Debit)." + }, + "mustBeApproved": { + "type": "boolean", + "description": "Indicates whether this authorization request must be approved." + }, + "currencyConversion": { + "type": "object", + "properties": { + "originalCurrency": { + "type": "string", + "description": "The original currency of the transaction." + }, + "amountInOriginalCurrency": { + "type": "integer", + "format": "int64", + "description": "The amount in the original currency." + }, + "fxRate": { + "type": "string", + "description": "The foreign exchange rate applied." + } + }, + "description": "Currency conversion information for international transactions." + }, + "isInternational": { + "type": "boolean", + "description": "Indicates whether this is an international transaction." }, "cardNetwork": { - "type": "string" + "type": "string", + "description": "The card network used for the transaction." }, "cashWithdrawalAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "The cash withdrawal amount for ATM transactions, in cents." } }, "required": [ @@ -185,45 +253,109 @@ "properties": { "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the authorization request was created." }, "amount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "The amount of the authorization request in cents." + }, + "available": { + "type": "integer", + "format": "int64", + "description": "The available balance in the account, in cents." }, "status": { - "type": "string" + "type": "string", + "enum": ["Pending", "Approved", "Declined"], + "description": "The status of the authorization request." }, "partialApprovalAllowed": { - "type": "boolean" + "type": "boolean", + "description": "Indicates whether partial approval is allowed for this request." }, "approvedAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "The approved amount for the authorization request, if applicable." }, "declineReason": { - "type": "string" + "type": "string", + "description": "The reason for declining the authorization request, if declined." }, "merchant": { - "$ref": "../types.json#/components/schemas/Merchant" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Merchant" }, + { "description": "Information about the merchant where the transaction is occurring." } + ] }, "recurring": { - "type": "boolean" + "type": "boolean", + "description": "Indicates whether this is a recurring transaction." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional tags associated with this authorization request." } + ] }, "paymentMethod": { - "type": "string" + "type": "string", + "description": "The payment method used for the transaction." }, "digitalWallet": { - "type": "string" + "type": "string", + "description": "The digital wallet used for the transaction, if applicable." }, "cardVerificationData": { - "$ref": "../types.json#/components/schemas/CardVerificationData" + "allOf": [ + { "$ref": "../types.json#/components/schemas/CardVerificationData" }, + { "description": "Card verification data for the transaction." } + ] + }, + "ecommerce": { + "type": "boolean", + "description": "Indicates whether this is an e-commerce transaction." + }, + "cardPresent": { + "type": "boolean", + "description": "Indicates whether the card was physically present for the transaction." + }, + "direction": { + "type": "string", + "description": "The direction of the transaction (e.g., Debit)." + }, + "mustBeApproved": { + "type": "boolean", + "description": "Indicates whether this authorization request must be approved." + }, + "currencyConversion": { + "type": "object", + "properties": { + "originalCurrency": { + "type": "string", + "description": "The original currency of the transaction." + }, + "amountInOriginalCurrency": { + "type": "integer", + "format": "int64", + "description": "The amount in the original currency." + }, + "fxRate": { + "type": "string", + "description": "The foreign exchange rate applied." + } + }, + "description": "Currency conversion information for international transactions." + }, + "isInternational": { + "type": "boolean", + "description": "Indicates whether this is an international transaction." }, "cardNetwork": { - "type": "string" + "type": "string", + "description": "The card network used for the transaction." } }, "required": [ @@ -260,47 +392,95 @@ "properties": { "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the authorization request was created." }, "amount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "The amount of the authorization request in cents." + }, + "available": { + "type": "integer", + "format": "int64", + "description": "The available balance in the account, in cents." }, "status": { - "type": "string" + "type": "string", + "enum": ["Pending", "Approved", "Declined"], + "description": "The status of the authorization request." }, "partialApprovalAllowed": { - "type": "boolean" + "type": "boolean", + "description": "Indicates whether partial approval is allowed for this request." }, "approvedAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "The approved amount for the authorization request, if applicable." }, "declineReason": { - "type": "string" + "type": "string", + "description": "The reason for declining the authorization request, if declined." }, "direction": { - "type": "string" + "type": "string", + "description": "The direction of the ATM transaction (e.g., withdrawal, deposit)." }, "atmName": { - "type": "string" + "type": "string", + "description": "The name of the ATM where the transaction is occurring." }, "atmLocation": { - "type": "string" + "type": "string", + "description": "The location of the ATM where the transaction is occurring." }, "surcharge": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "The ATM surcharge amount in cents." }, "internationalServiceFee": { "type": "number", - "nullable": true + "nullable": true, + "description": "The international service fee, if applicable." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional tags associated with this authorization request." } + ] + }, + "mustBeApproved": { + "type": "boolean", + "description": "Indicates whether this authorization request must be approved." + }, + "currencyConversion": { + "type": "object", + "properties": { + "originalCurrency": { + "type": "string", + "description": "The original currency of the transaction." + }, + "amountInOriginalCurrency": { + "type": "integer", + "format": "int64", + "description": "The amount in the original currency." + }, + "fxRate": { + "type": "string", + "description": "The foreign exchange rate applied." + } + }, + "description": "Currency conversion information for international transactions." + }, + "isInternational": { + "type": "boolean", + "description": "Indicates whether this is an international transaction." }, "cardNetwork": { - "type": "string" + "type": "string", + "description": "The card network used for the ATM transaction." } }, "required": [ @@ -323,17 +503,165 @@ } ] }, + "IIASAuthorization": { + "title": "IIAS Authorization Request Resource", + "type": "object", + "allOf": [ + { + "$ref": "./authorizationRequest.json#/components/schemas/AuthorizationRequest" + }, + { + "type": "object", + "properties": { + "attributes": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "format": "date-time", + "description": "The date and time when the authorization request was created." + }, + "amount": { + "type": "integer", + "format": "int64", + "description": "The amount of the authorization request in cents." + }, + "available": { + "type": "integer", + "format": "int64", + "description": "The available balance in the account, in cents." + }, + "status": { + "type": "string", + "enum": ["Pending", "Approved", "Declined"], + "description": "The status of the authorization request." + }, + "partialApprovalAllowed": { + "type": "boolean", + "description": "Indicates whether partial approval is allowed for this request." + }, + "approvedAmount": { + "type": "integer", + "format": "int64", + "description": "The approved amount for the authorization request, if applicable." + }, + "declineReason": { + "type": "string", + "description": "The reason for declining the authorization request, if declined." + }, + "merchant": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/Merchant" }, + { "description": "Information about the merchant where the transaction is occurring." } + ] + }, + "recurring": { + "type": "boolean", + "description": "Indicates whether this is a recurring transaction." + }, + "tags": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional tags associated with this authorization request." } + ] + }, + "healthcareAmounts": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/HealthcareAmounts" }, + { "description": "Healthcare-related amounts, if applicable." } + ] + }, + "paymentMethod": { + "type": "string", + "description": "The payment method used for the transaction." + }, + "digitalWallet": { + "type": "string", + "description": "The digital wallet used for the transaction, if applicable." + }, + "cardVerificationData": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/CardVerificationData" }, + { "description": "Card verification data for the transaction." } + ] + }, + "ecommerce": { + "type": "boolean", + "description": "Indicates whether this is an e-commerce transaction." + }, + "cardPresent": { + "type": "boolean", + "description": "Indicates whether the card was physically present for the transaction." + }, + "direction": { + "type": "string", + "description": "The direction of the transaction (e.g., Debit)." + }, + "mustBeApproved": { + "type": "boolean", + "description": "Indicates whether this authorization request must be approved." + }, + "currencyConversion": { + "type": "object", + "properties": { + "originalCurrency": { + "type": "string", + "description": "The original currency of the transaction." + }, + "amountInOriginalCurrency": { + "type": "integer", + "format": "int64", + "description": "The amount in the original currency." + }, + "fxRate": { + "type": "string", + "description": "The foreign exchange rate applied." + } + }, + "description": "Currency conversion information for international transactions." + }, + "isInternational": { + "type": "boolean", + "description": "Indicates whether this is an international transaction." + }, + "cardNetwork": { + "type": "string", + "description": "The card network used for the transaction." + } + }, + "required": [ + "createdAt", + "amount", + "status", + "partialApprovalAllowed", + "merchant", + "recurring" + ], + "additionalProperties": false + }, + "relationships": { + "$ref": "#/components/schemas/AuthorizationRequestRelationships" + } + }, + "additionalProperties": false, + "required": ["relationships"] + } + ] + }, "AuthorizationRequest": { "title": "Authorization Request Document", "type": "object", + "description": "Authorization requests that require manual review by the application before being approved or declined.", "properties": { "type": { "type": "string", "enum": [ "purchaseAuthorizationRequest", "cardTransactionAuthorizationRequest", - "atmAuthorizationRequest" - ] + "atmAuthorizationRequest", + "iiasAuthorizationRequest" + ], + "description": "The type of authorization request." }, "id": { "$ref": "../types.json#/components/schemas/Identifier" @@ -344,7 +672,8 @@ "mapping": { "purchaseAuthorizationRequest": "#/components/schemas/PurchaseAuthorization", "cardTransactionAuthorizationRequest": "#/components/schemas/CardTransactionAuthorization", - "atmAuthorizationRequest": "#/components/schemas/AtmAuthorization" + "atmAuthorizationRequest": "#/components/schemas/AtmAuthorization", + "iiasAuthorizationRequest": "#/components/schemas/IIASAuthorization" } } } diff --git a/schemas/card/card.json b/schemas/card/card.json index 01f1831..192955a 100644 --- a/schemas/card/card.json +++ b/schemas/card/card.json @@ -13,7 +13,8 @@ "Unknown", "SuspectedFraud", "ActiveForOnlineUse" - ] + ], + "description": "The current status of a physical card, which determines what actions can or can't be completed using the card." }, "VirtualCardStatus": { "type": "string", @@ -26,7 +27,8 @@ "ClosedByCustomer", "Unknown", "SuspectedFraud" - ] + ], + "description": "The current status of a virtual card, which determines what actions can or can't be completed using the card." }, "CardRelationships": { "allOf": [ @@ -59,42 +61,59 @@ "properties": { "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the card was created" }, "updatedAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the card was last updated" }, "last4Digits": { "type": "string", - "pattern": "^\\d{4}$" + "pattern": "^\\d{4}$", + "description": "Last 4 digits of the card number" }, "expirationDate": { "type": "string", - "pattern": "^\\d{4}[-](1[012]|0[1-9])$" + "pattern": "^\\d{4}[-](1[012]|0[1-9])$", + "description": "The card's expiration date in YYYY-MM format" }, "nextExpirationDate": { "type": "string", - "pattern": "^\\d{4}[-](1[012]|0[1-9])$" + "pattern": "^\\d{4}[-](1[012]|0[1-9])$", + "description": "The new card's expiration date for automated reissue in YYYY-MM format" }, "shippingAddress": { - "$ref": "../types.json#/components/schemas/Address" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Address"}, + {"description": "Address to which the card is shipped"} + ] }, "bin": { "type": "string", - "pattern": "^\\d{9}$" + "pattern": "^\\d{9}$", + "description": "Bank Identification Number (BIN)" }, "status": { - "$ref": "#/components/schemas/PhysicalCardStatus" + "allOf": [ + {"$ref": "#/components/schemas/PhysicalCardStatus"}, + {"description": "Current status of the card: Active, Inactive, Stolen, Lost, Frozen, ClosedByCustomer, SuspectedFraud, ActiveForOnlineUse"} + ] }, "design": { - "type": "string" + "type": "string", + "description": "The card design name" }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Tags"}, + {"description": "Custom tags for the card"} + ] }, "freezeReason": { - "type": "string" + "type": "string", + "description": "Reason why the card was frozen" } }, "required": [ @@ -112,7 +131,8 @@ "additionalProperties": false, "required": ["attributes", "relationships"] } - ] + ], + "description": "A physical debit card belonging to an Individual customer, including sole proprietors. The details of the card holder (name, email, phone number etc.) will be the individual customer's details." }, "BusinessDebitCard": { "title": "Business Debit Card", @@ -129,68 +149,103 @@ "properties": { "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the card was created" }, "updatedAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the card was last updated" }, "last4Digits": { "type": "string", - "pattern": "^\\d{4}$" + "pattern": "^\\d{4}$", + "description": "Last 4 digits of the card number" }, "expirationDate": { "type": "string", - "pattern": "^\\d{4}[-](1[012]|0[1-9])$" + "pattern": "^\\d{4}[-](1[012]|0[1-9])$", + "description": "The card's expiration date in YYYY-MM format" }, "nextExpirationDate": { "type": "string", - "pattern": "^\\d{4}[-](1[012]|0[1-9])$" + "pattern": "^\\d{4}[-](1[012]|0[1-9])$", + "description": "The new card's expiration date for automated reissue in YYYY-MM format" }, "shippingAddress": { - "$ref": "../types.json#/components/schemas/Address" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Address"}, + {"description": "Address to which the card is shipped"} + ] }, "address": { - "$ref": "../types.json#/components/schemas/Address" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Address"}, + {"description": "Address of the card holder"} + ] }, "fullName": { - "$ref": "../types.json#/components/schemas/FullName" + "allOf": [ + {"$ref": "../types.json#/components/schemas/FullName"}, + {"description": "Full name of the card holder"} + ] }, "phone": { - "$ref": "../types.json#/components/schemas/Phone" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Phone"}, + {"description": "Phone number of the card holder"} + ] }, "email": { - "$ref": "../types.json#/components/schemas/Email" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Email"}, + {"description": "Email address of the card holder"} + ] }, "dateOfBirth": { "type": "string", - "format": "date" + "format": "date", + "description": "Date of birth of the card holder" }, "nationality": { - "$ref": "../types.json#/components/schemas/Country" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Country"}, + {"description": "Nationality of the card holder"} + ] }, "ssn": { "type": "string", - "pattern": "^\\d{9}$" + "pattern": "^\\d{9}$", + "description": "Social Security Number of the card holder" }, "passport": { - "type": "string" + "type": "string", + "description": "Passport number of the card holder" }, "bin": { "type": "string", - "pattern": "^\\d{9}$" + "pattern": "^\\d{9}$", + "description": "Bank Identification Number (BIN)" }, "status": { - "$ref": "#/components/schemas/PhysicalCardStatus" + "allOf": [ + {"$ref": "#/components/schemas/PhysicalCardStatus"}, + {"description": "Current status of the card: Active, Inactive, Stolen, Lost, Frozen, ClosedByCustomer, SuspectedFraud, ActiveForOnlineUse"} + ] }, "design": { - "type": "string" + "type": "string", + "description": "The card design name" }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Tags"}, + {"description": "Custom tags for the card"} + ] }, "freezeReason": { - "type": "string" + "type": "string", + "description": "Reason why the card was frozen" } }, "additionalProperties": false, @@ -212,7 +267,8 @@ "additionalProperties": false, "required": ["attributes", "relationships"] } - ] + ], + "description": "A physical debit card belonging to a Business customer. The card holder may be any person associated with the business. The details of the card holder (name, email, phone number etc.) and shipping address will be provided as part of the card creation request." }, "IndividualVirtualDebitCard": { "title": "Individual Virtual Debit Card", @@ -229,36 +285,49 @@ "properties": { "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the card was created" }, "updatedAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the card was last updated" }, "last4Digits": { "type": "string", - "pattern": "^\\d{4}$" + "pattern": "^\\d{4}$", + "description": "Last 4 digits of the card number" }, "expirationDate": { "type": "string", - "pattern": "^\\d{4}[-](1[012]|0[1-9])$" + "pattern": "^\\d{4}[-](1[012]|0[1-9])$", + "description": "The card's expiration date in YYYY-MM format" }, "nextExpirationDate": { "type": "string", - "pattern": "^\\d{4}[-](1[012]|0[1-9])$" + "pattern": "^\\d{4}[-](1[012]|0[1-9])$", + "description": "The new card's expiration date for automated reissue in YYYY-MM format" }, "bin": { "type": "string", - "pattern": "^\\d{9}$" + "pattern": "^\\d{9}$", + "description": "Bank Identification Number (BIN)" }, "status": { - "$ref": "#/components/schemas/VirtualCardStatus" + "allOf": [ + {"$ref": "#/components/schemas/VirtualCardStatus"}, + {"description": "Current status of the card: Active, Inactive, Stolen, Lost, Frozen, ClosedByCustomer, SuspectedFraud"} + ] }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Tags"}, + {"description": "Custom tags for the card"} + ] }, "freezeReason": { - "type": "string" + "type": "string", + "description": "Reason why the card was frozen" } }, "required": [ @@ -276,7 +345,8 @@ "additionalProperties": false, "required": ["attributes", "relationships"] } - ] + ], + "description": "A virtual debit card belonging to an Individual customer, including sole proprietors. The details of the card holder (name, email, phone number etc.) will be the individual customer's details." }, "BusinessVirtualDebitCard": { "title": "Business Virtual Debit Card", @@ -293,62 +363,93 @@ "properties": { "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the card was created" }, "updatedAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the card was last updated" }, "last4Digits": { "type": "string", - "pattern": "^\\d{4}$" + "pattern": "^\\d{4}$", + "description": "Last 4 digits of the card number" }, "expirationDate": { "type": "string", - "pattern": "^\\d{4}[-](1[012]|0[1-9])$" + "pattern": "^\\d{4}[-](1[012]|0[1-9])$", + "description": "The card's expiration date in YYYY-MM format" }, "nextExpirationDate": { "type": "string", - "pattern": "^\\d{4}[-](1[012]|0[1-9])$" + "pattern": "^\\d{4}[-](1[012]|0[1-9])$", + "description": "The new card's expiration date for automated reissue in YYYY-MM format" }, "address": { - "$ref": "../types.json#/components/schemas/Address" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Address"}, + {"description": "Address of the card holder"} + ] }, "fullName": { - "$ref": "../types.json#/components/schemas/FullName" + "allOf": [ + {"$ref": "../types.json#/components/schemas/FullName"}, + {"description": "Full name of the card holder"} + ] }, "phone": { - "$ref": "../types.json#/components/schemas/Phone" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Phone"}, + {"description": "Phone number of the card holder"} + ] }, "email": { - "$ref": "../types.json#/components/schemas/Email" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Email"}, + {"description": "Email address of the card holder"} + ] }, "dateOfBirth": { "type": "string", - "format": "date" + "format": "date", + "description": "Date of birth of the card holder" }, "nationality": { - "$ref": "../types.json#/components/schemas/Country" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Country"}, + {"description": "Nationality of the card holder"} + ] }, "ssn": { "type": "string", - "pattern": "^\\d{9}$" + "pattern": "^\\d{9}$", + "description": "Social Security Number of the card holder" }, "passport": { - "type": "string" + "type": "string", + "description": "Passport number of the card holder" }, "bin": { "type": "string", - "pattern": "^\\d{9}$" + "pattern": "^\\d{9}$", + "description": "Bank Identification Number (BIN)" }, "status": { - "$ref": "#/components/schemas/VirtualCardStatus" + "allOf": [ + {"$ref": "#/components/schemas/VirtualCardStatus"}, + {"description": "Current status of the card: Active, Inactive, Stolen, Lost, Frozen, ClosedByCustomer, SuspectedFraud"} + ] }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Tags"}, + {"description": "Custom tags for the card"} + ] }, "freezeReason": { - "type": "string" + "type": "string", + "description": "Reason why the card was frozen" } }, "additionalProperties": false, @@ -370,7 +471,8 @@ "additionalProperties": false, "required": ["attributes", "relationships"] } - ] + ], + "description": "A virtual debit card belonging to a Business customer. The card holder may be any person associated with the business. The details of the card holder (name, email, phone number etc.) will be provided as part of the card creation request. In order to create the customer token that is needed to reveal the card information, the card holder must be the business contact or an authorized user." }, "BusinessCreditCard": { "title": "Business Credit Card", @@ -387,68 +489,103 @@ "properties": { "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the card was created" }, "updatedAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the card was last updated" }, "last4Digits": { "type": "string", - "pattern": "^\\d{4}$" + "pattern": "^\\d{4}$", + "description": "Last 4 digits of the card number" }, "expirationDate": { "type": "string", - "pattern": "^\\d{4}[-](1[012]|0[1-9])$" + "pattern": "^\\d{4}[-](1[012]|0[1-9])$", + "description": "The card's expiration date in YYYY-MM format" }, "nextExpirationDate": { "type": "string", - "pattern": "^\\d{4}[-](1[012]|0[1-9])$" + "pattern": "^\\d{4}[-](1[012]|0[1-9])$", + "description": "The new card's expiration date for automated reissue in YYYY-MM format" }, "shippingAddress": { - "$ref": "../types.json#/components/schemas/Address" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Address"}, + {"description": "Address to which the card is shipped"} + ] }, "address": { - "$ref": "../types.json#/components/schemas/Address" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Address"}, + {"description": "Address of the card holder"} + ] }, "fullName": { - "$ref": "../types.json#/components/schemas/FullName" + "allOf": [ + {"$ref": "../types.json#/components/schemas/FullName"}, + {"description": "Full name of the card holder"} + ] }, "phone": { - "$ref": "../types.json#/components/schemas/Phone" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Phone"}, + {"description": "Phone number of the card holder"} + ] }, "email": { - "$ref": "../types.json#/components/schemas/Email" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Email"}, + {"description": "Email address of the card holder"} + ] }, "dateOfBirth": { "type": "string", - "format": "date" + "format": "date", + "description": "Date of birth of the card holder" }, "nationality": { - "$ref": "../types.json#/components/schemas/Country" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Country"}, + {"description": "Nationality of the card holder"} + ] }, "ssn": { "type": "string", - "pattern": "^\\d{9}$" + "pattern": "^\\d{9}$", + "description": "Social Security Number of the card holder" }, "passport": { - "type": "string" + "type": "string", + "description": "Passport number of the card holder" }, "bin": { "type": "string", - "pattern": "^\\d{9}$" + "pattern": "^\\d{9}$", + "description": "Bank Identification Number (BIN)" }, "status": { - "$ref": "#/components/schemas/PhysicalCardStatus" + "allOf": [ + {"$ref": "#/components/schemas/PhysicalCardStatus"}, + {"description": "Current status of the card: Active, Inactive, Stolen, Lost, Frozen, ClosedByCustomer, SuspectedFraud, ActiveForOnlineUse"} + ] }, "design": { - "type": "string" + "type": "string", + "description": "The card design name" }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Tags"}, + {"description": "Custom tags for the card"} + ] }, "freezeReason": { - "type": "string" + "type": "string", + "description": "Reason why the card was frozen" } }, "additionalProperties": false, @@ -470,7 +607,8 @@ "additionalProperties": false, "required": ["attributes", "relationships"] } - ] + ], + "description": "A physical credit card belonging to a Business customer. The card holder may be any person associated with the business. The details of the card holder (name, email, phone number etc.) and shipping address will be provided as part of the card creation request." }, "BusinessVirtualCreditCard": { "title": "Business Virtual Credit Card", @@ -487,62 +625,93 @@ "properties": { "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the card was created" }, "updatedAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the card was last updated" }, "last4Digits": { "type": "string", - "pattern": "^\\d{4}$" + "pattern": "^\\d{4}$", + "description": "Last 4 digits of the card number" }, "expirationDate": { "type": "string", - "pattern": "^\\d{4}[-](1[012]|0[1-9])$" + "pattern": "^\\d{4}[-](1[012]|0[1-9])$", + "description": "The card's expiration date in YYYY-MM format" }, "nextExpirationDate": { "type": "string", - "pattern": "^\\d{4}[-](1[012]|0[1-9])$" + "pattern": "^\\d{4}[-](1[012]|0[1-9])$", + "description": "The new card's expiration date for automated reissue in YYYY-MM format" }, "address": { - "$ref": "../types.json#/components/schemas/Address" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Address"}, + {"description": "Address of the card holder"} + ] }, "fullName": { - "$ref": "../types.json#/components/schemas/FullName" + "allOf": [ + {"$ref": "../types.json#/components/schemas/FullName"}, + {"description": "Full name of the card holder"} + ] }, "phone": { - "$ref": "../types.json#/components/schemas/Phone" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Phone"}, + {"description": "Phone number of the card holder"} + ] }, "email": { - "$ref": "../types.json#/components/schemas/Email" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Email"}, + {"description": "Email address of the card holder"} + ] }, "dateOfBirth": { "type": "string", - "format": "date" + "format": "date", + "description": "Date of birth of the card holder" }, "nationality": { - "$ref": "../types.json#/components/schemas/Country" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Country"}, + {"description": "Nationality of the card holder"} + ] }, "ssn": { "type": "string", - "pattern": "^\\d{9}$" + "pattern": "^\\d{9}$", + "description": "Social Security Number of the card holder" }, "passport": { - "type": "string" + "type": "string", + "description": "Passport number of the card holder" }, "bin": { "type": "string", - "pattern": "^\\d{9}$" + "pattern": "^\\d{9}$", + "description": "Bank Identification Number (BIN)" }, "status": { - "$ref": "#/components/schemas/VirtualCardStatus" + "allOf": [ + {"$ref": "#/components/schemas/VirtualCardStatus"}, + {"description": "Current status of the card: Active, Inactive, Stolen, Lost, Frozen, ClosedByCustomer, SuspectedFraud"} + ] }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Tags"}, + {"description": "Custom tags for the card"} + ] }, "freezeReason": { - "type": "string" + "type": "string", + "description": "Reason why the card was frozen" } }, "additionalProperties": false, @@ -564,7 +733,8 @@ "additionalProperties": false, "required": ["attributes", "relationships"] } - ] + ], + "description": "A virtual credit card belonging to a Business customer. The card holder may be any person associated with the business. The details of the card holder (name, email, phone number etc.) will be provided as part of the card creation request. In order to create the customer token that is needed to reveal the card information, the card holder must be the business contact or an authorized user." }, "Card": { "title": "Card Document", @@ -579,10 +749,14 @@ "individualVirtualDebitCard", "businessCreditCard", "businessVirtualCreditCard" - ] + ], + "description": "Type of the card resource" }, "id": { - "$ref": "../types.json#/components/schemas/Identifier" + "allOf": [ + {"$ref": "../types.json#/components/schemas/Identifier"}, + {"description": "Unique identifier of the card"} + ] } }, "discriminator": { @@ -595,7 +769,8 @@ "businessCreditCard": "#/components/schemas/BusinessCreditCard", "businessVirtualCreditCard": "#/components/schemas/BusinessVirtualCreditCard" } - } + }, + "description": "The Card resource represents a card under an account." } } } diff --git a/schemas/card/cardFraudCase.json b/schemas/card/cardFraudCase.json new file mode 100644 index 0000000..cf37139 --- /dev/null +++ b/schemas/card/cardFraudCase.json @@ -0,0 +1,275 @@ +{ + "components": { + "schemas": { + "CardFraudCaseActivity": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The unique identifier of the card activity." + }, + "createdAt": { + "type": "string", + "format": "date-time", + "description": "The date and time when the card activity was created in the card fraud case." + }, + "activityType": { + "type": "string", + "enum": ["Authorization", "Transaction"], + "description": "The type of the card activity." + }, + "cardActivityCreatedAt": { + "type": "string", + "format": "date-time", + "description": "The date and time when the card activity was created." + }, + "cardActivity": { + "type": "string", + "description": "The unique identifier of the card activity (transaction or authorization)." + }, + "location": { + "type": "string", + "description": "The location where the card activity occurred." + }, + "merchant": { + "type": "string", + "description": "The merchant name where the card activity occurred." + }, + "amount": { + "type": "integer", + "description": "The amount of the card activity in cents." + }, + "decision": { + "type": "string", + "enum": ["Pending", "Fraud", "NoFraud"], + "description": "The decision made for the card activity." + }, + "updatedAt": { + "type": "string", + "format": "date-time", + "description": "The date and time when the card activity was last updated." + } + }, + "required": ["id", "createdAt", "activityType", "cardActivityCreatedAt", "cardActivity", "amount"], + "additionalProperties": false + }, + "CardFraudCaseBase": { + "type": "object", + "properties": { + "attributes": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "format": "date-time", + "description": "The date and time when the card fraud case was created." + }, + "status": { + "type": "string", + "enum": ["Created", "Active", "Closed", "Expired"], + "description": "The status of the card fraud case." + }, + "decision": { + "type": "string", + "enum": ["Pending", "Fraud", "NoFraud"], + "description": "The decision made for the card fraud case." + }, + "expiresAt": { + "type": "string", + "format": "date-time", + "description": "The date and time when the card fraud case expires." + }, + "cardActivities": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CardFraudCaseActivity" + }, + "description": "The card activities related to the card fraud case." + }, + "updatedAt": { + "type": "string", + "format": "date-time", + "description": "The date and time when the card fraud case was last updated." + } + }, + "required": ["createdAt", "status", "decision", "expiresAt", "cardActivities"], + "additionalProperties": false + }, + "relationships": { + "type": "object", + "properties": { + "card": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["card"], + "default": "card" + }, + "id": { + "type": "string" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + }, + "account": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["account"], + "default": "account" + }, + "id": { + "type": "string" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + }, + "customer": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["customer"], + "default": "customer" + }, + "id": { + "type": "string" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + } + }, + "required": ["card", "account", "customer"], + "additionalProperties": false + } + }, + "required": ["attributes", "relationships"], + "additionalProperties": false + }, + "AuthorizationCardFraudCase": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/CardFraudCaseBase" + } + ], + "properties": { + "type": { + "type": "string", + "enum": ["authorizationCardFraudCase"], + "default": "authorizationCardFraudCase" + }, + "id": { + "type": "string" + }, + "relationships": { + "type": "object", + "properties": { + "authorization": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["authorization"], + "default": "authorization" + }, + "id": { + "type": "string" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + } + }, + "required": ["authorization"], + "additionalProperties": false + } + }, + "required": ["type", "id"], + "additionalProperties": false + }, + "TransactionCardFraudCase": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/CardFraudCaseBase" + } + ], + "properties": { + "type": { + "type": "string", + "enum": ["transactionCardFraudCase"], + "default": "transactionCardFraudCase" + }, + "id": { + "type": "string" + }, + "relationships": { + "type": "object", + "properties": { + "transaction": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["transaction"], + "default": "transaction" + }, + "id": { + "type": "string" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + } + }, + "required": ["transaction"], + "additionalProperties": false + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/schemas/card/cardFraudOutreachPaths.json b/schemas/card/cardFraudOutreachPaths.json new file mode 100644 index 0000000..fbd96d2 --- /dev/null +++ b/schemas/card/cardFraudOutreachPaths.json @@ -0,0 +1,410 @@ +{ + "components": { + "schemas": { + "UnitCardFraudCaseResponse": { + "title": "Unit Card Fraud Case Response", + "type": "object", + "properties": { + "data": { + "oneOf": [ + { + "$ref": "./cardFraudCase.json#/components/schemas/AuthorizationCardFraudCase" + }, + { + "$ref": "./cardFraudCase.json#/components/schemas/TransactionCardFraudCase" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "data" + ] + }, + "UnitCardFraudCasesListResponse": { + "title": "Unit Card Fraud Cases List Response", + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "./cardFraudCase.json#/components/schemas/AuthorizationCardFraudCase" + }, + { + "$ref": "./cardFraudCase.json#/components/schemas/TransactionCardFraudCase" + } + ] + } + }, + "meta": { + "type": "object", + "properties": { + "offset": { + "type": "integer" + }, + "limit": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + } + }, + "additionalProperties": false, + "required": [ + "data" + ] + }, + "UnitCardFraudOutreachPolicyResponse": { + "title": "Unit Card Fraud Outreach Policy Response", + "type": "object", + "properties": { + "data": { + "$ref": "./cardFraudOutreachPolicy.json#/components/schemas/CardFraudOutreachPolicy" + } + }, + "additionalProperties": false, + "required": [ + "data" + ] + } + } + }, + "cardFraudCase": { + "get": { + "tags": [ + "unit" + ], + "operationId": "getCardFraudCase", + "summary": "Get Card Fraud Case by Id", + "description": "Get a card fraud case by id.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "id", + "in": "path", + "required": true, + "description": "ID of the card fraud case to get" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitCardFraudCaseResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "cardFraudCases": { + "get": { + "tags": [ + "unit" + ], + "operationId": "listCardFraudCases", + "summary": "List Card Fraud Cases", + "description": "List card fraud case resources. Paging can be applied.", + "parameters": [ + { + "$ref": "../types.json#/components/schemas/PageQuery" + }, + { + "name": "filter", + "style": "deepObject", + "allowReserved": true, + "in": "query", + "schema": { + "type": "object", + "properties": { + "cardId": { + "type": "string", + "description": "Filter by card id." + }, + "accountId": { + "type": "string", + "description": "Filter by account id." + }, + "customerId": { + "type": "string", + "description": "Filter by customer id." + }, + "status[]": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "Created", + "Active", + "Closed", + "Expired" + ] + }, + "description": "Filter by case status. Can be one of the following values: Created, Active, Closed, Expired." + }, + "decision[]": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "Pending", + "Fraud", + "NoFraud" + ] + }, + "description": "Filter by case decision. Can be one of the following values: Pending, Fraud, NoFraud." + } + } + } + }, + { + "name": "sort", + "in": "query", + "schema": { + "type": "string", + "default": "sort=-createdAt", + "description": "Optional. sort=createdAt for ascending order or sort=-createdAt (leading minus sign) for descending order." + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitCardFraudCasesListResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "markCardFraudCaseAsFraud": { + "post": { + "tags": [ + "unit" + ], + "operationId": "markCardFraudCaseAsFraud", + "summary": "Mark Card Fraud Case as Fraud", + "description": "Mark a card fraud case as fraud.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "id", + "in": "path", + "required": true, + "description": "ID of the card fraud case to mark as fraud" + } + ], + "requestBody": { + "description": "Mark Card Fraud Case as Fraud Request", + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "./markCardFraudCase.json#/components/schemas/MarkCardFraudCaseAsFraudRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitCardFraudCaseResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "markCardFraudCaseAsNoFraud": { + "post": { + "tags": [ + "unit" + ], + "operationId": "markCardFraudCaseAsNoFraud", + "summary": "Mark Card Fraud Case as No Fraud", + "description": "Mark a card fraud case as no fraud.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "id", + "in": "path", + "required": true, + "description": "ID of the card fraud case to mark as no fraud" + } + ], + "requestBody": { + "description": "Mark Card Fraud Case as No Fraud Request", + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "./markCardFraudCase.json#/components/schemas/MarkCardFraudCaseAsNoFraudRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitCardFraudCaseResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "createCardFraudOutreachPolicy": { + "post": { + "tags": [ + "unit" + ], + "operationId": "createCardFraudOutreachPolicy", + "summary": "Create Card Fraud Outreach Policy", + "description": "Create a card fraud outreach policy.", + "requestBody": { + "description": "Create Card Fraud Outreach Policy Request", + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "./createCardFraudOutreachPolicy.json#/components/schemas/CreateCardFraudOutreachPolicyRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitCardFraudOutreachPolicyResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "fraudOutreachPolicy": { + "patch": { + "tags": [ + "unit" + ], + "operationId": "updateCardFraudOutreachPolicy", + "summary": "Update Card Fraud Outreach Policy", + "description": "Update a card fraud outreach policy.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "policyId", + "in": "path", + "required": true, + "description": "ID of the card fraud outreach policy to update" + } + ], + "requestBody": { + "description": "Update Card Fraud Outreach Policy Request", + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "./updateCardFraudOutreachPolicy.json#/components/schemas/UpdateCardFraudOutreachPolicyRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitCardFraudOutreachPolicyResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + }, + "get": { + "tags": [ + "unit" + ], + "operationId": "getCardFraudOutreachPolicy", + "summary": "Get Card Fraud Outreach Policy by Id", + "description": "Get a card fraud outreach policy by id.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "policyId", + "in": "path", + "required": true, + "description": "ID of the card fraud outreach policy to get" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitCardFraudOutreachPolicyResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + } +} \ No newline at end of file diff --git a/schemas/card/cardFraudOutreachPolicy.json b/schemas/card/cardFraudOutreachPolicy.json new file mode 100644 index 0000000..c799f4b --- /dev/null +++ b/schemas/card/cardFraudOutreachPolicy.json @@ -0,0 +1,136 @@ +{ + "components": { + "schemas": { + "CardFraudOutreachPolicy": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["cardFraudOutreachPolicy"], + "default": "cardFraudOutreachPolicy" + }, + "id": { + "type": "string" + }, + "attributes": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "format": "date-time", + "description": "The date and time when the card fraud outreach policy was created." + }, + "activitiesLookBackPeriodHours": { + "type": "integer", + "enum": [12, 24, 48, 72], + "description": "The period in hours before the card fraud case was created, for which the card fraud case activities will be included in the case. Can be one of the following periods: 12, 24, 48, 72." + }, + "caseExpirationPeriodHours": { + "type": "integer", + "enum": [12, 24, 48, 72], + "description": "The period in hours after the card fraud case was created, after which the card fraud case expires. Can be one of the following periods: 12, 24, 48, 72." + }, + "numberOfActivities": { + "type": "integer", + "description": "The number of card activities that will be included in the card fraud case. Up to 5 activities max." + }, + "contactPhone": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/Phone" }, + { "description": "The client support contact phone number." } + ] + }, + "contactUrl": { + "type": "string", + "description": "The client support contact URL. Should be a valid https URL." + }, + "enabled": { + "type": "boolean", + "description": "Whether the card fraud outreach policy is enabled." + } + }, + "required": ["createdAt", "activitiesLookBackPeriodHours", "caseExpirationPeriodHours", "numberOfActivities", "contactPhone", "contactUrl", "enabled"], + "additionalProperties": false + }, + "relationships": { + "type": "object", + "properties": { + "emailOutreachSettings": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["emailOutreachSettings"], + "default": "emailOutreachSettings" + }, + "id": { + "type": "string" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false, + "description": "The email outreach settings to be used for the policy." + }, + "messageOutreachSettings": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["messageOutreachSettings"], + "default": "messageOutreachSettings" + }, + "id": { + "type": "string" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false, + "description": "The message outreach settings to be used for the policy." + }, + "whiteLabelTheme": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["whiteLabelTheme"], + "default": "whiteLabelTheme" + }, + "id": { + "type": "string" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false, + "description": "The white-label theme to be used for the policy. See https://www.unit.co/docs/white-label-uis/themes/." + } + }, + "additionalProperties": false + } + }, + "required": ["type", "id", "attributes"], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/schemas/card/cardPaths.json b/schemas/card/cardPaths.json index b992b94..af11684 100644 --- a/schemas/card/cardPaths.json +++ b/schemas/card/cardPaths.json @@ -10,7 +10,9 @@ "properties": { "type": { "type": "string", - "enum": ["limits"], + "enum": [ + "limits" + ], "default": "limits" }, "attributes": { @@ -26,16 +28,24 @@ "$ref": "../types.json#/components/schemas/CardTotals" } }, - "required": ["dailyTotals", "monthlyTotals"], + "required": [ + "dailyTotals", + "monthlyTotals" + ], "additionalProperties": false } }, "additionalProperties": false, - "required": ["type", "attributes"] + "required": [ + "type", + "attributes" + ] } }, "additionalProperties": false, - "required": ["data"] + "required": [ + "data" + ] }, "UnitPinStatusResponse": { "title": "Unit Pin Status Response", @@ -46,7 +56,9 @@ "properties": { "type": { "type": "string", - "enum": ["pinStatus"], + "enum": [ + "pinStatus" + ], "default": "pinStatus" }, "attributes": { @@ -54,7 +66,11 @@ "properties": { "status": { "type": "string", - "enum": ["Set", "NotSet"] + "enum": [ + "Set", + "NotSet" + ], + "description": "Card PIN status, either 'Set' or 'NotSet'" } } } @@ -103,12 +119,53 @@ } } } + }, + "UnitMobileWalletPayloadResponse": { + "title": "Unit Mobile Wallet Payload Response", + "type": "object", + "properties": { + "data": { + "$ref": "./mobileWalletPayload.json#/components/schemas/MobileWalletPayload" + } + }, + "additionalProperties": false, + "required": [ + "data" + ] + }, + "UnitCardholderBearerTokenResponse": { + "title": "Unit Cardholder Bearer Token Response", + "type": "object", + "properties": { + "data": { + "$ref": "./cardholderToken.json#/components/schemas/CardholderBearerToken" + } + }, + "additionalProperties": false, + "required": [ + "data" + ] + }, + "UnitCardholderTokenVerificationResponse": { + "title": "Unit Cardholder Token Verification Response", + "type": "object", + "properties": { + "data": { + "$ref": "./cardholderTokenVerification.json#/components/schemas/CardholderTokenVerification" + } + }, + "additionalProperties": false, + "required": [ + "data" + ] } } }, "cards": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getCardsList", "summary": "Get List of Cards", "description": "Get List of Cards from API ", @@ -179,11 +236,16 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "createCard", "summary": "Create a Card", "description": "Create a Card via API ", @@ -208,13 +270,18 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "card": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getCard", "parameters": [ { @@ -246,11 +313,16 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "patch": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "updateCard", "summary": "Update Card", "description": "Update a Card via API ", @@ -286,13 +358,148 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "activateCard": { + "post": { + "tags": [ + "unit" + ], + "operationId": "activateCard", + "summary": "Activate Card", + "description": "Cards can be activated using this endpoint or by calling the toll-free number printed on the card. Virtual cards do not require activation.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "cardId", + "in": "path", + "required": true, + "description": "ID of the card to activate" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitCardResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "setPIN": { + "post": { + "tags": [ + "unit" + ], + "operationId": "setCardPIN", + "summary": "Set Card PIN", + "description": "Set the PIN for a card. The PIN is set via a third-party service and requires a customer token.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "cardId", + "in": "path", + "required": true, + "description": "ID of the card to set PIN for" + } + ], + "requestBody": { + "description": "Set Card PIN Request", + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "./setCardPin.json#/components/schemas/SetCardPinRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitCardResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "changePIN": { + "post": { + "tags": [ + "unit" + ], + "operationId": "changeCardPIN", + "summary": "Change Card PIN", + "description": "Change the PIN for a card. The PIN is changed via a third-party service and requires a customer token.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "cardId", + "in": "path", + "required": true, + "description": "ID of the card to change PIN for" + } + ], + "requestBody": { + "description": "Change Card PIN Request", + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "./changeCardPin.json#/components/schemas/ChangeCardPinRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitCardResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "reportLostCard": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "reportCardAsLost", "summary": "Report lost as stolen", "parameters": [ @@ -306,7 +513,7 @@ "description": "ID of the card" } ], - "description": "Report lost as stolen via API ", + "description": "Report card as lost. A lost card cannot be reopened.", "responses": { "200": { "description": "Successful Response", @@ -317,13 +524,18 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "reportStolenCard": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "reportCardAsStolen", "summary": "Report card as stolen", "parameters": [ @@ -337,7 +549,7 @@ "description": "ID of the card" } ], - "description": "Report card as stolen via API ", + "description": "Report card as stolen. A stolen card cannot be reopened.", "responses": { "200": { "description": "Successful Response", @@ -348,16 +560,21 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "closeCard": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "closeCard", "summary": "Close a Card", - "description": "Close a Card via API ", + "description": "Close a Card. A closed card cannot be reopened.", "parameters": [ { "schema": { @@ -379,16 +596,21 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "cardPinStatus": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getCardPinStatus", "summary": "Get Card PIN Status", - "description": "Get Card PIN Status via API ", + "description": "Get the status of a card's PIN, whether it has been set or not.", "parameters": [ { "schema": { @@ -410,13 +632,18 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "freezeCard": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "freezeCard", "parameters": [ { @@ -430,7 +657,7 @@ } ], "summary": "Freeze a Card", - "description": "Freeze a Card via API ", + "description": "Freeze a Card via API", "responses": { "200": { "description": "Successful Response", @@ -441,13 +668,18 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "unfreezeCard": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "unfreezeCard", "parameters": [ { @@ -461,7 +693,7 @@ } ], "summary": "Unfreeze a Card", - "description": "Unfreeze a Card via API ", + "description": "Unfreeze a Card via API", "responses": { "200": { "description": "Successful Response", @@ -472,13 +704,18 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "cardLimits": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getCardLimits", "parameters": [ { @@ -492,7 +729,7 @@ } ], "summary": "Get Card Limit by Id", - "description": "Get a Card Limits from API ", + "description": "Card purchases and withdrawals can be subjected to daily and monthly amount limits. Limits are optional (by default there are no card-specific limits), and can be set when the card is created or updated. The limits are enforced by Unit, and once the limit is reached, the transaction will be rejected.", "responses": { "200": { "description": "Successful Response", @@ -503,13 +740,18 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "replaceCard": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "replaceCard", "parameters": [ { @@ -523,7 +765,7 @@ } ], "summary": "Replace a Card", - "description": "Replace a Card via API ", + "description": "Replace a Card via API", "requestBody": { "required": true, "content": { @@ -544,8 +786,152 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "mobileWalletPayload": { + "post": { + "tags": [ + "unit" + ], + "operationId": "getMobileWalletPayload", + "summary": "Get mobile wallet payload", + "description": "Get the mobile wallet encrypted payload for the specified card. The encrypted payload is unique per issuance and is required as part of the SDK integration.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "cardId", + "in": "path", + "required": true, + "description": "ID of the card to get mobile wallet payload for" + } + ], + "requestBody": { + "description": "Mobile Wallet Payload Request", + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "./mobileWalletPayload.json#/components/schemas/GetMobileWalletPayloadRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitMobileWalletPayloadResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "cardholderToken": { + "post": { + "tags": [ + "unit" + ], + "operationId": "createCardholderToken", + "summary": "Create Cardholder Token", + "description": "Create a bearer token for a specific card. A Cardholder Token can only interact with one card.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "cardId", + "in": "path", + "required": true, + "description": "ID of the card to create a token for" + } + ], + "requestBody": { + "description": "Create Cardholder Token Request", + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "./createCardholderToken.json#/components/schemas/CreateCardholderTokenRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitCardholderBearerTokenResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "cardholderTokenVerification": { + "post": { + "tags": [ + "unit" + ], + "operationId": "createCardholderTokenVerification", + "summary": "Create Cardholder Token Verification", + "description": "When creating a cardholder token that contains a scope which requires two-factor authentication (see Scopes), it is required to first create a verification challenge that will be sent to the customer. The challenge is a six digit code and is valid for 10 minutes after its creation.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "cardId", + "in": "path", + "required": true, + "description": "ID of the card to create token verification for" + } + ], + "requestBody": { + "description": "Create Cardholder Token Verification Request", + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "./createCardholderTokenVerification.json#/components/schemas/CreateCardholderTokenVerificationRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitCardholderTokenVerificationResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/card/cardholderToken.json b/schemas/card/cardholderToken.json new file mode 100644 index 0000000..8def3cd --- /dev/null +++ b/schemas/card/cardholderToken.json @@ -0,0 +1,33 @@ +{ + "components": { + "schemas": { + "CardholderBearerToken": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["cardholderBearerToken"], + "default": "cardholderBearerToken" + }, + "attributes": { + "type": "object", + "properties": { + "token": { + "type": "string", + "description": "The token issued for the card." + }, + "expiresIn": { + "type": "integer", + "description": "The lifetime of the token (in seconds)." + } + }, + "required": ["token", "expiresIn"], + "additionalProperties": false + } + }, + "required": ["type", "attributes"], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/schemas/card/cardholderTokenVerification.json b/schemas/card/cardholderTokenVerification.json new file mode 100644 index 0000000..9a2c80e --- /dev/null +++ b/schemas/card/cardholderTokenVerification.json @@ -0,0 +1,29 @@ +{ + "components": { + "schemas": { + "CardholderTokenVerification": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["cardholderTokenVerification"], + "default": "cardholderTokenVerification" + }, + "attributes": { + "type": "object", + "properties": { + "verificationToken": { + "type": "string", + "description": "The generated verification token. It should be passed back to Create Cardholder Bearer Token along with the verification code the customer received on the specified channel" + } + }, + "required": ["verificationToken"], + "additionalProperties": false + } + }, + "required": ["type", "attributes"], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/schemas/card/changeCardPin.json b/schemas/card/changeCardPin.json new file mode 100644 index 0000000..1c1d470 --- /dev/null +++ b/schemas/card/changeCardPin.json @@ -0,0 +1,34 @@ +{ + "components": { + "schemas": { + "ChangeCardPinRequest": { + "title": "Change Card PIN Request", + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["changeCardPin"], + "default": "changeCardPin" + }, + "attributes": { + "type": "object", + "properties": { + "customerToken": { + "type": "string", + "description": "A customer token obtained via the customer token API" + } + }, + "required": ["customerToken"] + } + }, + "required": ["type", "attributes"] + } + }, + "required": ["data"] + } + } + } +} \ No newline at end of file diff --git a/schemas/card/createCardFraudOutreachPolicy.json b/schemas/card/createCardFraudOutreachPolicy.json new file mode 100644 index 0000000..c39546c --- /dev/null +++ b/schemas/card/createCardFraudOutreachPolicy.json @@ -0,0 +1,134 @@ +{ + "components": { + "schemas": { + "CreateCardFraudOutreachPolicy": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["cardFraudOutreachPolicy"], + "default": "cardFraudOutreachPolicy" + }, + "attributes": { + "type": "object", + "properties": { + "caseExpirationPeriodHours": { + "type": "integer", + "enum": [12, 24, 48, 72], + "description": "The period in hours after the card fraud case was created, after which the card fraud case expires. Can be one of the following periods: 12, 24, 48, 72." + }, + "activitiesLookBackPeriodHours": { + "type": "integer", + "enum": [12, 24, 48, 72], + "description": "The period in hours before the card fraud case was created, for which the card fraud case activities will be included in the case. Can be one of the following periods: 12, 24, 48, 72." + }, + "contactUrl": { + "type": "string", + "description": "The client support contact URL. Should be a valid https URL." + }, + "contactPhone": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/Phone" }, + { "description": "The client support contact phone number." } + ] + }, + "numberOfCardActivities": { + "type": "integer", + "description": "The number of card activities that will be included in the card fraud case. Up to 5 activities max." + } + }, + "required": ["caseExpirationPeriodHours", "activitiesLookBackPeriodHours", "contactUrl", "contactPhone", "numberOfCardActivities"], + "additionalProperties": false + }, + "relationships": { + "type": "object", + "properties": { + "whiteLabelTheme": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["whiteLabelTheme"], + "default": "whiteLabelTheme" + }, + "id": { + "type": "string" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false, + "description": "Optional. The white-label theme to be used for the policy. See https://www.unit.co/docs/white-label-uis/themes/." + }, + "emailOutreachSettings": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["emailOutreachSettings"], + "default": "emailOutreachSettings" + }, + "id": { + "type": "string" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false, + "description": "Optional. The email outreach settings to be used for the policy." + }, + "messageOutreachSettings": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["messageOutreachSettings"], + "default": "messageOutreachSettings" + }, + "id": { + "type": "string" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false, + "description": "Optional. The message outreach settings to be used for the policy." + } + }, + "additionalProperties": false + } + }, + "required": ["type", "attributes"], + "additionalProperties": false + }, + "CreateCardFraudOutreachPolicyRequest": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CreateCardFraudOutreachPolicy" + } + }, + "required": ["data"], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/schemas/card/createCardholderToken.json b/schemas/card/createCardholderToken.json new file mode 100644 index 0000000..b52e9fa --- /dev/null +++ b/schemas/card/createCardholderToken.json @@ -0,0 +1,55 @@ +{ + "components": { + "schemas": { + "CreateCardholderToken": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["cardholderToken"], + "default": "cardholderToken" + }, + "attributes": { + "type": "object", + "properties": { + "scope": { + "type": "string", + "description": "list of Scopes separated by spaces. Only cards (cards cards-sensitive cards-write cards-sensitive-write) scopes are allowed." + }, + "verificationToken": { + "type": "string", + "description": "Required if scope includes a scope which requires two-factor authentication. Received as a response from Create Cardholder Token Verification." + }, + "verificationCode": { + "type": "string", + "description": "Required if scope includes a scope which requires two-factor authentication. 6 digit code sent to the card holder through the desired channel." + }, + "expiresIn": { + "type": "integer", + "description": "Optional. The lifetime of the token (in seconds). Maximum value is 86400 (24 hours). Default value is also 24 hours." + }, + "upgradableScope": { + "type": "string", + "description": "Optional. list of Scopes separated by spaces. The card holder will be able to upgrade the token to the scopes you provide here." + } + }, + "required": ["scope"], + "additionalProperties": false + } + }, + "required": ["type", "attributes"], + "additionalProperties": false + }, + "CreateCardholderTokenRequest": { + "type": "object", + "required": ["data"], + "properties": { + "data": { + "$ref": "#/components/schemas/CreateCardholderToken" + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/schemas/card/createCardholderTokenVerification.json b/schemas/card/createCardholderTokenVerification.json new file mode 100644 index 0000000..de0ee14 --- /dev/null +++ b/schemas/card/createCardholderTokenVerification.json @@ -0,0 +1,54 @@ +{ + "components": { + "schemas": { + "CreateCardholderTokenVerification": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["cardholderTokenVerification"], + "default": "cardholderTokenVerification" + }, + "attributes": { + "type": "object", + "properties": { + "channel": { + "type": "string", + "enum": ["sms", "call"], + "description": "Send a verification code to the card holder through one of the following channels - sms or call." + }, + "phone": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/Phone" }, + { "description": "Optional. This allows providing the phone number of one of the customer's authorized users. The provided phone must match an authorized user phone and will be used in the One Time Password (OTP) authentication process instead of the business customer contact's phone." } + ] + }, + "appHash": { + "type": "string", + "description": "Optional. For sms verifications only, 11-character hash string that identifies your app. Appended at the end of your verification SMS body the way that client-side SMS Retriever API expects." + }, + "language": { + "type": "string", + "description": "Optional. Select the verification language using a 2-letter code.Default is English.See Localization Options bellow for the support languages and their 2-letter code." + } + }, + "required": ["channel"], + "additionalProperties": false + } + }, + "required": ["type", "attributes"], + "additionalProperties": false + }, + "CreateCardholderTokenVerificationRequest": { + "type": "object", + "required": ["data"], + "properties": { + "data": { + "$ref": "#/components/schemas/CreateCardholderTokenVerification" + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/schemas/card/markCardFraudCase.json b/schemas/card/markCardFraudCase.json new file mode 100644 index 0000000..b08735d --- /dev/null +++ b/schemas/card/markCardFraudCase.json @@ -0,0 +1,50 @@ +{ + "components": { + "schemas": { + "MarkCardFraudCaseAsFraud": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["markAsFraud"], + "default": "markAsFraud" + } + }, + "required": ["type"], + "additionalProperties": false + }, + "MarkCardFraudCaseAsFraudRequest": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/MarkCardFraudCaseAsFraud" + } + }, + "required": ["data"], + "additionalProperties": false + }, + "MarkCardFraudCaseAsNoFraud": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["markAsNoFraud"], + "default": "markAsNoFraud" + } + }, + "required": ["type"], + "additionalProperties": false + }, + "MarkCardFraudCaseAsNoFraudRequest": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/MarkCardFraudCaseAsNoFraud" + } + }, + "required": ["data"], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/schemas/card/mobileWalletPayload.json b/schemas/card/mobileWalletPayload.json new file mode 100644 index 0000000..19aa92a --- /dev/null +++ b/schemas/card/mobileWalletPayload.json @@ -0,0 +1,57 @@ +{ + "components": { + "schemas": { + "MobileWalletPayload": { + "title": "Mobile Wallet Payload", + "type": "object", + "description": "A JSON object containing the encrypted payload for mobile wallet.", + "properties": { + "type": { + "type": "string", + "enum": ["mobileWalletPayload"], + "default": "mobileWalletPayload" + }, + "attributes": { + "type": "object", + "properties": { + "payload": { + "type": "string", + "description": "The encrypted payload for mobile wallet." + } + }, + "additionalProperties": false, + "required": ["payload"] + } + }, + "additionalProperties": false, + "required": ["type", "attributes"] + }, + "GetMobileWalletPayloadRequest": { + "title": "Mobile Wallet Payload Request", + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "attributes": { + "type": "object", + "properties": { + "signedNonce": { + "type": "string", + "description": "The signedNonce received from the Visa SDK" + } + }, + "additionalProperties": false, + "required": ["signedNonce"] + } + }, + "additionalProperties": false, + "required": ["attributes"] + } + }, + "additionalProperties": false, + "required": ["data"] + } + } + } +} \ No newline at end of file diff --git a/schemas/card/setCardPin.json b/schemas/card/setCardPin.json new file mode 100644 index 0000000..d20b956 --- /dev/null +++ b/schemas/card/setCardPin.json @@ -0,0 +1,34 @@ +{ + "components": { + "schemas": { + "SetCardPinRequest": { + "title": "Set Card PIN Request", + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["setCardPin"], + "default": "setCardPin" + }, + "attributes": { + "type": "object", + "properties": { + "customerToken": { + "type": "string", + "description": "A customer token obtained via the customer token API" + } + }, + "required": ["customerToken"] + } + }, + "required": ["type", "attributes"] + } + }, + "required": ["data"] + } + } + } +} \ No newline at end of file diff --git a/schemas/card/updateCardFraudOutreachPolicy.json b/schemas/card/updateCardFraudOutreachPolicy.json new file mode 100644 index 0000000..0c7fd24 --- /dev/null +++ b/schemas/card/updateCardFraudOutreachPolicy.json @@ -0,0 +1,70 @@ +{ + "components": { + "schemas": { + "UpdateCardFraudOutreachPolicy": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["cardFraudOutreachPolicy"], + "default": "cardFraudOutreachPolicy" + }, + "attributes": { + "type": "object", + "properties": { + "caseExpirationPeriodHours": { + "type": "integer", + "enum": [12, 24, 48, 72], + "description": "Optional. The period in hours after the card fraud case was created, after which the card fraud case expires. Can be one of the following periods: 12, 24, 48, 72." + }, + "activitiesLookBackPeriodHours": { + "type": "integer", + "enum": [12, 24, 48, 72], + "description": "Optional. The period in hours before the card fraud case was created, for which the card fraud case activities will be included in the case. Can be one of the following periods: 12, 24, 48, 72." + }, + "contactUrl": { + "type": "string", + "description": "Optional. The client support contact URL. Should be a valid https URL." + }, + "contactPhone": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/Phone" }, + { "description": "Optional. The client support contact phone number." } + ] + }, + "numberOfCardActivities": { + "type": "integer", + "description": "Optional. The number of card activities that will be included in the card fraud case. Up to 5 activities max." + }, + "emailOutreachSettings": { + "type": "string", + "description": "Optional. The id of the email outreach settings to be used for the policy." + }, + "messageOutreachSettings": { + "type": "string", + "description": "Optional. The id of the message outreach settings to be used for the policy." + }, + "whiteLabelTheme": { + "type": "string", + "description": "Optional. The id of the white-label theme to be used for the policy." + } + }, + "additionalProperties": false + } + }, + "required": ["type", "attributes"], + "additionalProperties": false + }, + "UpdateCardFraudOutreachPolicyRequest": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/UpdateCardFraudOutreachPolicy" + } + }, + "required": ["data"], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/schemas/cash-deposit/cashDepositBarcode.json b/schemas/cash-deposit/cashDepositBarcode.json index 555f5d0..95f1bca 100644 --- a/schemas/cash-deposit/cashDepositBarcode.json +++ b/schemas/cash-deposit/cashDepositBarcode.json @@ -20,6 +20,7 @@ "CashDepositBarcode": { "title": "Cash Deposit Barcode", "type": "object", + "description": "Cash Deposit Barcode resource.", "properties": { "type": { "type": "string", @@ -30,21 +31,36 @@ "type": "object", "properties": { "barcodeNumber": { - "type": "string" + "type": "string", + "description": "The unique barcode number." }, "expiration": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The expiration date and time of the barcode." + }, + "storeId": { + "type": "string", + "description": "The unique storeId identifier of a store." + }, + "retailerName": { + "type": "string", + "description": "The name of the retailer." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" } + ] } }, - "required": ["amount", "description"], + "required": ["barcodeNumber", "expiration", "storeId", "retailerName"], "additionalProperties": false }, "relationships": { - "$ref": "#/components/schemas/CashDepositBarcodeRelationships" + "allOf": [ + { "$ref": "#/components/schemas/CashDepositBarcodeRelationships" }, + { "description": "The relationships of the cash deposit barcode. account: The Deposit Account receiving the payment. customer: The Customer receiving the payment." } + ] } }, "required": ["type", "attributes", "relationships"] diff --git a/schemas/cash-deposit/cashDepositPaths.json b/schemas/cash-deposit/cashDepositPaths.json index 17b3a2a..aa9d402 100644 --- a/schemas/cash-deposit/cashDepositPaths.json +++ b/schemas/cash-deposit/cashDepositPaths.json @@ -19,10 +19,12 @@ }, "generateBarcode": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "generateBarcode", - "summary": "Generate Cash Deposit Barcode", - "description": "Generate Cash Deposit Barcode via API ", + "summary": "Generate Barcode", + "description": "Generate a barcode for a Cash Deposit store location. Cash Deposit barcodes are valid for a single use, at a specific location, and up to one hour from the time they are generated.", "requestBody": { "description": "Generate Cash Deposit Barcode Request", "required": true, @@ -35,7 +37,7 @@ } }, "responses": { - "201": { + "200": { "description": "Successful Response", "content": { "application/vnd.api+json": { @@ -50,17 +52,21 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "listCashDepositStoreLocations": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getCashDepositStoreLocationsList", - - "summary": "Get Cash Deposit Store Locations List By Coordinates", - "description": "Get Cash Deposit Store Locations List By Coordinates from API ", + "summary": "List Cash Deposit Store Locations", + "description": "Unit provides an API for searching nearby Cash Deposit store locations by coordinates or postal code. Cash deposits can be made by either swiping a customer card, or by scanning a barcode. The API supports searching by coordinates and postal code.", "parameters": [ { "$ref": "../types.json#/components/schemas/PageQuery" @@ -74,17 +80,29 @@ "type": "object", "properties": { "postalCode": { - "type": "string" + "type": "string", + "description": "Filters the results by the specified postal code." }, "coordinates": { - "$ref": "../types.json#/components/schemas/Coordinates" + "allOf": [ + { + "$ref": "../types.json#/components/schemas/Coordinates" + }, + { + "description": "Filters the results by the specified coordinates." + } + ] }, "serviceType": { "type": "string", - "enum": ["Swipe", "Barcode"] + "enum": [ + "Swipe", + "Barcode" + ], + "default": "Swipe", + "description": "Optional. Filters the results by the specified service type. Possible values are: Swipe, Barcode." } - }, - "required": ["serviceType"] + } } } ], @@ -98,17 +116,21 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "getBarcodeImage": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getBarcodeImage", - - "summary": "Get Barcode Image By Barcode Number", - "description": "Get Barcode Image By Barcode Number from API ", + "summary": "Get Barcode Image by Barcode Number", + "description": "Get a cash deposit barcode image by barcode number.", "parameters": [ { "name": "barcodeNumber", @@ -116,7 +138,8 @@ "required": true, "schema": { "type": "string" - } + }, + "description": "The unique barcodeNumber identifier of a barcode, obtained from Generate Barcode endpoint." } ], "responses": { @@ -130,8 +153,11 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/cash-deposit/generateBarcode.json b/schemas/cash-deposit/generateBarcode.json index 0d39549..1ccaa4e 100644 --- a/schemas/cash-deposit/generateBarcode.json +++ b/schemas/cash-deposit/generateBarcode.json @@ -30,13 +30,21 @@ "type": "object", "properties": { "storeId": { - "type": "string" + "type": "string", + "description": "The unique storeId identifier of a store, obtained from either List by coordinates or List by post code endpoints." } }, "required": ["storeId"] }, "relationships": { - "$ref": "#/components/schemas/GenerateBarcodeRequestRelationships" + "allOf": [ + { + "$ref": "#/components/schemas/GenerateBarcodeRequestRelationships" + }, + { + "description": "The relationships for the cash deposit barcode. account: The Deposit Account receiving the payment. customer: The Customer receiving the payment." + } + ] } }, "required": ["type", "attributes", "relationships"] diff --git a/schemas/cash-deposit/storeLocation.json b/schemas/cash-deposit/storeLocation.json index 8404b23..7304742 100644 --- a/schemas/cash-deposit/storeLocation.json +++ b/schemas/cash-deposit/storeLocation.json @@ -4,6 +4,7 @@ "StoreLocation": { "title": "Store Location", "type": "object", + "description": "Cash Deposit Store Location resource.", "properties": { "type": { "type": "string", @@ -14,22 +15,32 @@ "type": "object", "properties": { "storeId": { - "type": "string" + "type": "string", + "description": "The unique identifier of the store." }, "retailerName": { - "type": "string" + "type": "string", + "description": "The name of the retailer." }, "phone": { - "type": "string" + "type": "string", + "description": "The phone number of the store." }, "address": { - "$ref": "../types.json#/components/schemas/Address" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Address" }, + { "description": "The address of the store." } + ] }, "coordinates": { - "$ref": "../types.json#/components/schemas/Coordinates" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Coordinates" }, + { "description": "The geographical coordinates of the store location." } + ] }, "distance": { - "type": "number" + "type": "number", + "description": "The distance from the requested coordinates to the store, in miles." } }, "required": [ diff --git a/schemas/check/checkDeposit.json b/schemas/check/checkDeposit.json index 924a0b7..bf3aaf4 100644 --- a/schemas/check/checkDeposit.json +++ b/schemas/check/checkDeposit.json @@ -15,7 +15,8 @@ "Sent", "Canceled", "Returned" - ] + ], + "description": "The check deposit status. Possible values are: AwaitingImages (The check deposit was created. Waiting for the front-side and back-side images to be uploaded.), AwaitingFrontImage (The back-side image of the check was received. Waiting for the front-side image to be uploaded.), AwaitingBackImage (The front-side image of the check was received. Waiting for the back-side image to be uploaded.), AwaitingCustomerConfirmation (The check deposit requires the customer's attention: either retaking the images or confirmation check deposit amount. If no action is captured within a 10 minutes window, the check deposit will automatically be Rejected. This status is not part of all check deposit's lifecycles and mainly depends on a bank partner.), Pending (The check deposit was created on the Unit ledger but was not yet processed. Check deposits with Pending status may be canceled by the originator.), PendingReview (The check deposit is pending review by Unit.), Rejected (The check deposit was rejected (see reason for more details). Some rejections are immediate but some can take up to a couple of days.), Clearing (The check deposit was processed and the funds have been received by Unit, but the deposit account was not credited yet. The check deposit will stay clearing for a period of time as defined on the deposit product, for fraud risk mitigation reasons. It's recommended that the physical check is kept securely until the end of the statement cycle.), Sent (The check deposit was processed and the deposit account was credited. This is the final state for successful check deposits.), Canceled (The check deposit was canceled.), Returned (The check deposit was processed but the receiving bank was not able to complete the transfer (see reason for more details).)" }, "CheckDepositRelationships": { "allOf": [ @@ -97,69 +98,76 @@ "properties": { "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the check deposit was created" }, "settlementDate": { "type": "string", - "format": "date" + "format": "date", + "description": "The date when the check deposit was settled" }, "amount": { "type": "integer", "minimum": 1, - "format": "int64" + "format": "int64", + "description": "The check amount (in cents) to deposit" }, "description": { "type": "string", "minLength": 1, - "maxLength": 50 + "maxLength": 50, + "description": "Description of the check deposit (maximum of 50 characters)" }, "status": { - "type": "string", - "enum": [ - "AwaitingImages", - "AwaitingFrontImage", - "AwaitingBackImage", - "Pending", - "PendingReview", - "AwaitingCustomerConfirmation", - "Rejected", - "Clearing", - "Sent", - "Canceled", - "Returned" - ] + "$ref": "#/components/schemas/CheckDepositStatus" }, "reason": { "type": "string", - "nullable": true + "nullable": true, + "description": "Reason for rejection or return, if applicable" }, "statusCreatedAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the current status was set" }, "statusSetBy": { - "type": "string" + "type": "string", + "description": "Who set the current status" }, "statusHistory": { "type": "array", "items": { "$ref": "#/components/schemas/StatusEvent" - } + }, + "description": "History of status changes for this check deposit" }, "reasonText": { - "type": "string" + "type": "string", + "description": "Additional text explaining the reason for rejection or return" }, "checkNumber": { - "type": "string" + "type": "string", + "description": "The check number" }, "vendor": { - "type": "string" + "type": "string", + "description": "The vendor processing the check deposit" }, "counterparty": { - "$ref": "#/components/schemas/CheckDepositCounterparty" + "$ref": "#/components/schemas/CheckDepositCounterparty", + "description": "Information about the counterparty of the check deposit" }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional. See https://www.unit.co/docs/api/#tags" } + ] + }, + "clearingDaysOverride": { + "type": "integer", + "minimum": 1, + "description": "Optional. The number of days until the check deposit clears. See https://www.unit.co/docs/api/check-deposits/#dynamic-clearing-period-check-deposit" } }, "required": [ diff --git a/schemas/check/checkDepositPaths.json b/schemas/check/checkDepositPaths.json index 0f49840..b66dacd 100644 --- a/schemas/check/checkDepositPaths.json +++ b/schemas/check/checkDepositPaths.json @@ -1,5 +1,5 @@ { - "componenets": { + "components": { "schemas": { "UnitCheckDepositResponse": { "type": "object", @@ -26,9 +26,10 @@ }, "checkDeposits": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getCheckDepositsList", - "summary": "Get List Check Deposits", "description": "Get List Check Deposits from API ", "parameters": [ @@ -44,16 +45,19 @@ "type": "object", "properties": { "accountId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified account id." }, "customerId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified customer id." }, "tags": { "type": "object", "additionalProperties": { "type": "string" - } + }, + "description": "Optional. Filter check deposits by Tags." }, "status": { "type": "array", @@ -72,7 +76,8 @@ "Returned", "AwaitingCustomerConfirmation" ] - } + }, + "description": "Optional. Filter by Check Deposit Status." } } } @@ -82,14 +87,16 @@ "in": "query", "schema": { "type": "string" - } + }, + "description": "Optional. Leave empty or provide sort=createdAt for ascending order. Provide sort=-createdAt (leading minus sign) for descending order." }, { "name": "include", "in": "query", "schema": { "type": "string" - } + }, + "description": "Optional. A comma-separated list of related resources to include in the response. Related resources include: customer, account, transaction." } ], "responses": { @@ -98,17 +105,21 @@ "content": { "application/vnd.api+json; charset=utf-8": { "schema": { - "$ref": "#/componenets/schemas/UnitListCheckDepositResponse" + "$ref": "#/components/schemas/UnitListCheckDepositResponse" } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "createCheckDeposit", - "summary": "Create Check Deposit", "description": "Create a Check Deposit via API ", "requestBody": { @@ -128,19 +139,23 @@ "content": { "application/vnd.api+json": { "schema": { - "$ref": "#/componenets/schemas/UnitCheckDepositResponse" + "$ref": "#/components/schemas/UnitCheckDepositResponse" } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "checkDeposit": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getCheckDeposit", - "parameters": [ { "schema": { @@ -160,17 +175,21 @@ "content": { "application/vnd.api+json; charset=utf-8": { "schema": { - "$ref": "#/componenets/schemas/UnitCheckDepositResponse" + "$ref": "#/components/schemas/UnitCheckDepositResponse" } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "patch": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "updateCheckDeposit", - "summary": "Update Check Deposit", "description": "Update a Check Deposit via API ", "parameters": [ @@ -201,17 +220,22 @@ "content": { "application/vnd.api+json": { "schema": { - "$ref": "#/componenets/schemas/UnitCheckDepositResponse" + "$ref": "#/components/schemas/UnitCheckDepositResponse" } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "confirmCheckDeposit": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "confirmCheckDeposit", "parameters": [ { @@ -225,13 +249,13 @@ } ], "summary": "Confirm by Id", - "description": "Confirm a Check Deposit from API ", + "description": "Confirms a check deposit details when it's in 'AwaitingCustomerConfirmation' status", "requestBody": { "required": true, "content": { "application/vnd.api+json": { "schema": { - "$ref": "./confirmCheckDeposit.json#/componenets/schemas/ConfirmCheckDepositRequest" + "$ref": "./confirmCheckDeposit.json#/components/schemas/ConfirmCheckDepositRequest" } } } @@ -242,19 +266,23 @@ "content": { "application/vnd.api+json; charset=utf-8": { "schema": { - "$ref": "#/componenets/schemas/UnitCheckDepositResponse" + "$ref": "#/components/schemas/UnitCheckDepositResponse" } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, - "getFrontCheckDeposit": { + "frontImageCheckDeposit": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getFrontCheckDeposit", - "parameters": [ { "schema": { @@ -267,32 +295,79 @@ } ], "summary": "Get Front Check Deposit Image by Id", - "description": "Get Front Check Deposit Image from API ", + "description": "Get a check deposit front image by check deposit id.", "responses": { "200": { "description": "Successful Response", "content": { - "application/vnd.api+json; charset=utf-8": { + "image/jpeg": { "schema": { - "type": "object", - "title": "Unit Front Check Deposit Response", - "properties": { - "data": { - "type": "string" - } - } + "type": "string", + "format": "binary" + } + } + } + }, + "302": { + "description": "Found - Client should follow redirect" + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + }, + "put": { + "tags": [ + "unit" + ], + "operationId": "uploadFrontCheckDeposit", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "checkDepositId", + "in": "path", + "required": true, + "description": "ID of the check deposit" + } + ], + "summary": "Upload Front-Side Image", + "description": "Uploads a check front-side image file. Currently only jpeg file type is supported.", + "requestBody": { + "required": true, + "content": { + "image/jpeg": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/UnitCheckDepositResponse" } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, - "getBackCheckDeposit": { + "backImageCheckDeposit": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getBackCheckDeposit", - "parameters": [ { "schema": { @@ -305,25 +380,71 @@ } ], "summary": "Get Back Check Deposit Image by Id", - "description": "Get Back Check Deposit Image from API ", + "description": "Get a check deposit back image by check deposit id.", "responses": { "200": { "description": "Successful Response", "content": { - "application/vnd.api+json; charset=utf-8": { + "image/jpeg": { "schema": { - "type": "object", - "title": "Unit Back Check Deposit Response", - "properties": { - "data": { - "type": "string" - } - } + "type": "string", + "format": "binary" + } + } + } + }, + "302": { + "description": "Found - Client should follow redirect" + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + }, + "put": { + "tags": [ + "unit" + ], + "operationId": "uploadBackCheckDeposit", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "checkDepositId", + "in": "path", + "required": true, + "description": "ID of the check deposit" + } + ], + "summary": "Upload Back-Side Image", + "description": "Uploads a check back-side image file. Currently only jpeg file type is supported.", + "requestBody": { + "required": true, + "content": { + "image/jpeg": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/UnitCheckDepositResponse" } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/check/checkPayment.json b/schemas/check/checkPayment.json index 18567e8..e189cbb 100644 --- a/schemas/check/checkPayment.json +++ b/schemas/check/checkPayment.json @@ -4,19 +4,26 @@ "ReturnReason": { "type": "string", "enum": [ - "InsufficientFunds", - "AccountClosed", - "AlteredCheck", - "ForgedSignature", - "PostdatedCheck", - "StopPaymentOrder", - "UnauthorizedDebit", - "WrongAmount", - "DuplicatePayment", - "MissingSignature", - "IrregularEndorsement", - "Other" - ] + "NotSufficientFunds", + "UncollectedFundsHold", + "StopPayment", + "ClosedAccount", + "UnableToLocateAccount", + "FrozenOrBlockedAccount", + "StaleDated", + "PostDated", + "NotValidCheckOrCashItem", + "AlteredOrFictitious", + "UnableToProcess", + "ItemExceedsDollarLimit", + "NotAuthorized", + "ReferToMaker", + "UnusableImage", + "DuplicatePresentment", + "WarrantyBreach", + "UnauthorizedWarrantyBreach" + ], + "description": "The reason for returning the Check Payment." }, "CheckPaymentRelationships": { "allOf": [ @@ -43,17 +50,57 @@ "title": "Check Payment Counterparty", "properties": { "name": { - "type": "string" + "type": "string", + "description": "Name of the check payment recipient" }, "address": { - "$ref": "../types.json#/components/schemas/Address" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Address" }, + { "description": "Address of the check payment recipient" } + ] }, "counterpartyMoved": { - "type": "boolean" + "type": "boolean", + "description": "Indicates if the counterparty has moved" } }, "additionalProperties": false }, + "CheckPaymentStatus": { + "type": "string", + "enum": [ + "New", + "Rejected", + "Pending", + "Canceled", + "PendingCancellation", + "InProduction", + "InDelivery", + "Delivered", + "ReturnedToSender", + "PendingReview", + "Processed", + "MarkedForReturn", + "Returned" + ], + "description": "Status of the check payment. Possible values: New (A request to originate a check payment has been registered and is being processed), Rejected (See rejectReason for further details), Pending (The check payment is pending submission and will be sent to the printers at the next cutoff time), Canceled (The originated check payment was canceled), PendingCancellation (A cancellation has been requested and is pending for a result), InProduction (Cutoff time has passed. The check payment has been sent to the printers and can no longer be updated or canceled), InDelivery (The check payment has been accepted by the mail service and is en route), Delivered (The check payment was delivered), ReturnedToSender (The check payment could not be delivered and has been returned to the sender), PendingReview (The check payment is pending review by Unit), Processed (The check payment was processed and the deposit account was debited), MarkedForReturn (The check payment was marked for return), Returned (The check payment was returned)" + }, + "CheckPaymentDeliveryStatus": { + "type": "string", + "enum": [ + "Mailed", + "InLocalArea", + "Delivered", + "Rerouted", + "ReturnedToSender" + ], + "description": "Delivery status of the check payment. Possible values: Mailed (The check has been handed off to and accepted by the mail service), InLocalArea (The check payment is being processed at the destination facility. This is the final delivery status for checks sent to P.O boxes), Delivered (The check payment has been delivered to its destination), Rerouted (The check payment has been re-routed), ReturnedToSender (The check payment could not be delivered and is being returned to the customer's address)" + }, + "AdditionalVerificationStatus": { + "type": "string", + "enum": ["Required", "NotRequired", "Approved"], + "description": "The additional verification status for the check payment" + }, "CheckPayment": { "title": "Check Payment Resource", "type": "object", @@ -71,102 +118,118 @@ "properties": { "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the check payment was created" }, "updatedAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the check payment was last updated" }, "amount": { "type": "integer", "minimum": 1, - "format": "int64" + "format": "int64", + "description": "The check amount (in cents)" }, "returnCutoffTime": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time until which the check payment can be returned" }, "status": { - "type": "string", - "enum": [ - "MarkedForReturn", - "Returned", - "Processed", - "PendingReview" - ] + "$ref": "#/components/schemas/CheckPaymentStatus" }, "memo": { - "type": "string" + "type": "string", + "description": "Memo for the check payment" }, "deliveryStatus": { - "type": "string", - "enum": [ - "Mailed", - "InLocalArea", - "Delivered", - "Rerouted", - "ReturnedToSender" - ] + "$ref": "#/components/schemas/CheckPaymentDeliveryStatus" }, "sendAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the check will be sent" }, "counterparty": { - "$ref": "#/components/schemas/CheckPaymentCounterparty" + "allOf": [ + { "$ref": "#/components/schemas/CheckPaymentCounterparty" }, + { "description": "Information about the counterparty of the check payment" } + ] }, "trackedAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the check payment was tracked" }, "postalCode": { - "type": "string" + "type": "string", + "description": "Postal code for delivery tracking" }, "expectedDelivery": { "type": "string", - "format": "date" + "format": "date", + "description": "Expected delivery date of the check" }, "originated": { - "type": "boolean" + "type": "boolean", + "description": "Indicates if the check payment was originated through the Unit API" }, "expirationDate": { "type": "string", - "format": "date" + "format": "date", + "description": "Expiration date of the check" }, "rejectReason": { - "type": "string" + "type": "string", + "description": "The reason why the check payment was rejected, if applicable" }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional tags for the check payment. See https://www.unit.co/docs/api/#tags" } + ] }, "description": { - "type": "string" + "type": "string", + "description": "Description of the check payment (maximum of 50 characters)" }, "returnReason": { - "$ref": "#/components/schemas/ReturnReason" + "allOf": [ + { "$ref": "#/components/schemas/ReturnReason" }, + { "description": "The reason why the check payment was returned, if applicable" } + ] }, "pendingReviewReasons": { "type": "array", "items": { "type": "string", "enum": ["NameMissMatch", "SoftLimit"] - } + }, + "description": "Reasons why the check payment is pending review" }, "checkNumber": { - "type": "string" + "type": "string", + "description": "The check number" }, "onUsAuxiliary": { - "type": "string" + "type": "string", + "description": "MICR on-us auxiliary field" }, "onUs": { - "type": "string" + "type": "string", + "description": "MICR on-us field" }, "counterpartyRoutingNumber": { - "type": "string" + "type": "string", + "description": "Routing number of the counterparty's bank" }, "additionalVerificationStatus": { - "type": "string", - "enum": ["Required", "NotRequired", "Approved"] + "allOf": [ + { "$ref": "#/components/schemas/AdditionalVerificationStatus" }, + { "description": "The status of additional verification for the check payment" } + ] } }, "required": [ diff --git a/schemas/check/checkPaymentPaths.json b/schemas/check/checkPaymentPaths.json index 0060380..b5b0b33 100644 --- a/schemas/check/checkPaymentPaths.json +++ b/schemas/check/checkPaymentPaths.json @@ -14,10 +14,12 @@ }, "checkPayments": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getCheckPaymentsList", - "summary": "Get List Check Payments", - "description": "Get List Check Payments from API ", + "summary": "List Check Payments", + "description": "Lists all check payments with optional filters for account, customer, status, and more.", "parameters": [ { "$ref": "../types.json#/components/schemas/PageQuery" @@ -29,10 +31,12 @@ "type": "object", "properties": { "accountId": { - "type": "string" + "type": "string", + "description": "Filter check payments by account ID" }, "customerId": { - "type": "string" + "type": "string", + "description": "Filter check payments by customer ID" }, "status": { "type": "array", @@ -40,43 +44,50 @@ "type": "string", "enum": [ "New", + "Rejected", "Pending", "Canceled", - "Rejected", - "InDelivery", + "PendingCancellation", "InProduction", + "InDelivery", "Delivered", "ReturnedToSender", - "Pending", - "Processed", "PendingReview", + "Processed", "MarkedForReturn", "Returned" ] - } + }, + "description": "Filter check payments by status" }, "tags": { "type": "object", "additionalProperties": { "type": "string" - } + }, + "description": "Filter check payments by tags" }, "since": { - "type": "string" + "type": "string", + "description": "Filter check payments created since this date" }, "until": { - "type": "string" + "type": "string", + "description": "Filter check payments created until this date" }, "fromAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "Filter check payments by minimum amount" }, "toAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "Filter check payments by maximum amount" }, "checkNumber": { - "type": "string" + "type": "string", + "description": "Filter Check Payments by check number (trimming leading zeros)" } } } @@ -86,14 +97,16 @@ "in": "query", "schema": { "type": "string" - } + }, + "description": "Sort the results by a specific field" }, { "name": "include", "in": "query", "schema": { "type": "string" - } + }, + "description": "A comma-separated list of related resources to include in the response. Related resources include: customer, account, transaction. See https://www.unit.co/docs/api/about-jsonapi/#intro-getting-related-resources" } ], "responses": { @@ -115,15 +128,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "createCheckPayment", - - "summary": "Create Check Payment", - "description": "Create Check Payment via API ", + "summary": "Originate Check Payment (Mail Physical Check)", + "description": "Creates a physical check. The check will be printed and mailed to the US recipient specified in the request. Originated check payments can be set to be sent immediately or scheduled for a future date.", "requestBody": { "description": "Create Check Payment Request", "required": true, @@ -145,15 +162,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "checkPayment": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getCheckPayment", - "parameters": [ { "schema": { @@ -166,7 +187,7 @@ } ], "summary": "Get Check Payment by Id", - "description": "Get a Check Payment from API ", + "description": "Retrieve a specific check payment by its ID.", "responses": { "200": { "description": "Successful Response", @@ -177,15 +198,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "checkPaymentApprove": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "approveCheckPayment", - "parameters": [ { "schema": { @@ -211,18 +236,26 @@ "properties": { "type": { "type": "string", - "enum": ["additionalVerification"], + "enum": [ + "additionalVerification" + ], "default": "additionalVerification" } - } + }, + "required": [ + "type" + ] } - } + }, + "required": [ + "data" + ] } } } }, - "summary": "Approve Check Payment by Id", - "description": "Approve a Check Payment via API ", + "summary": "Approve Check Payment Additional Verification", + "description": "Needs to be used when additionalVerificationStatus is Required in order to approve the Check Payment. Serves as an evidence that an additional verification was performed and an approval was captured from the end customer to continue processing this Check Payment.", "responses": { "200": { "description": "Successful Response", @@ -233,15 +266,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "checkPaymentReturn": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "returnCheckPayment", - "parameters": [ { "schema": { @@ -267,26 +304,45 @@ "properties": { "type": { "type": "string", - "enum": ["checkPaymentReturn"], + "enum": [ + "checkPaymentReturn" + ], "default": "checkPaymentReturn" }, "attributes": { "type": "object", "properties": { "reason": { - "$ref": "./checkPayment.json#/components/schemas/ReturnReason" + "allOf": [ + { + "$ref": "./checkPayment.json#/components/schemas/ReturnReason" + }, + { + "description": "The reason for returning the Check Payment. See valid reasons for Check Payment returns." + } + ] } - } + }, + "required": [ + "reason" + ] } - } + }, + "required": [ + "type", + "attributes" + ] } - } + }, + "required": [ + "data" + ] } } } }, - "summary": "Return Check Payment by Id", - "description": "Return a Check Payment via API ", + "summary": "Return Check Payment", + "description": "Create a return as long as it happens before the returnCutoffTime, the Check Payment status will be set to MarkedForReturn. If the Check Payment was Processed, a Returned Check Payment Transaction will be created.", "responses": { "200": { "description": "Successful Response", @@ -297,15 +353,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "checkPaymentCancel": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "cancelCheckPayment", - "parameters": [ { "schema": { @@ -317,8 +377,8 @@ "description": "ID of the check payment to cancel" } ], - "summary": "Cancel Check Payment by Id", - "description": "Cancel a Check Payment via API ", + "summary": "Cancel Check Payment", + "description": "Cancels a previously processed check payment. Only check payments in status Pending can be canceled. If cancelation was successful, the check status will change to Canceled.", "responses": { "200": { "description": "Successful Response", @@ -329,15 +389,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "getCheckPaymentFront": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getCheckPaymentFront", - "parameters": [ { "schema": { @@ -350,7 +414,7 @@ } ], "summary": "Get front image", - "description": "Get front image via API ", + "description": "Get a check payment front image by check payment ID.", "responses": { "200": { "description": "Successful Response", @@ -362,15 +426,22 @@ } } } + }, + "302": { + "description": "Redirect Found - Client should support following redirects" + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "getCheckPaymentBack": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getCheckPaymentBack", - "parameters": [ { "schema": { @@ -383,7 +454,7 @@ } ], "summary": "Get back image", - "description": "Get back image via API ", + "description": "Get a check payment back image by check payment ID.", "responses": { "200": { "description": "Successful Response", @@ -395,8 +466,14 @@ } } } + }, + "302": { + "description": "Redirect Found - Client should support following redirects" + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/check/confirmCheckDeposit.json b/schemas/check/confirmCheckDeposit.json index c43da3a..eeb1021 100644 --- a/schemas/check/confirmCheckDeposit.json +++ b/schemas/check/confirmCheckDeposit.json @@ -1,5 +1,5 @@ { - "componenets": { + "components": { "schemas": { "ConfirmCheckDepositRequest": { "type": "object", @@ -9,7 +9,9 @@ "type": "object", "properties": { "type": { - "type": "string" + "type": "string", + "enum": ["checkDeposit"], + "default": "checkDeposit" } }, "required": ["type"] diff --git a/schemas/check/createCheckDeposit.json b/schemas/check/createCheckDeposit.json index cfab973..f530931 100644 --- a/schemas/check/createCheckDeposit.json +++ b/schemas/check/createCheckDeposit.json @@ -13,51 +13,64 @@ } ] }, - "CreateCheckDepositRequest": { + "CreateCheckDeposit": { "type": "object", "properties": { - "data": { + "type": { + "type": "string", + "enum": ["checkDeposit"], + "default": "checkDeposit" + }, + "attributes": { "type": "object", "properties": { - "type": { + "amount": { + "type": "integer", + "minimum": 1, + "format": "int64", + "description": "The check amount (in cents) to deposit." + }, + "clearingDaysOverride": { + "type": "integer", + "minimum": 1, + "description": "Optional. See https://www.unit.co/docs/api/check-deposits/#dynamic-clearing-period-check-deposit." + }, + "description": { "type": "string", - "enum": ["checkDeposit"], - "default": "checkDeposit" + "minLength": 1, + "maxLength": 50, + "description": "Description of the check deposit (maximum of 50 characters)." }, - "attributes": { - "type": "object", - "properties": { - "amount": { - "type": "integer", - "minimum": 1, - "format": "int64" - }, - "clearingDaysOverride": { - "type": "integer", - "minimum": 1 - }, - "description": { - "type": "string", - "minLength": 1, - "maxLength": 50 - }, - "idempotencyKey": { - "$ref": "../types.json#/components/schemas/IdempotencyKey" - }, - "tags": { - "$ref": "../types.json#/components/schemas/Tags" - } - }, - "required": ["amount", "description"], - "additionalProperties": false + "idempotencyKey": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/IdempotencyKey" }, + { "description": "Optional, but strongly recommended. See https://www.unit.co/docs/api/#intro-idempotency." } + ] }, - "relationships": { - "$ref": "#/components/schemas/CreateCheckDepositRelationships" + "tags": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional. See https://www.unit.co/docs/api/#tags." } + ] } }, - "required": ["type", "attributes", "relationships"] + "required": ["amount", "description"], + "additionalProperties": false + }, + "relationships": { + "$ref": "#/components/schemas/CreateCheckDepositRelationships" + } + }, + "required": ["type", "attributes", "relationships"] + }, + "CreateCheckDepositRequest": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CreateCheckDeposit" } - } + }, + "required": ["data"] } } } diff --git a/schemas/check/createCheckPayment.json b/schemas/check/createCheckPayment.json index e973c4b..5e9ba70 100644 --- a/schemas/check/createCheckPayment.json +++ b/schemas/check/createCheckPayment.json @@ -34,13 +34,18 @@ "properties": { "name": { "type": "string", - "maxLength": 40 + "maxLength": 40, + "description": "Name of the check payment recipient (maximum of 40 characters)" }, "address": { - "$ref": "../types.json#/components/schemas/Address" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Address" }, + { "description": "Address of the check payment recipient. Must be a valid US address." } + ] }, "counterpartyMoved": { - "type": "boolean" + "type": "boolean", + "description": "Indicates if the counterparty has moved" } }, "required": ["name", "address"], @@ -49,25 +54,35 @@ "amount": { "type": "integer", "minimum": 1, - "format": "int64" + "format": "int64", + "description": "The check amount (in cents)" }, "idempotencyKey": { - "$ref": "../types.json#/components/schemas/IdempotencyKey" + "allOf": [ + { "$ref": "../types.json#/components/schemas/IdempotencyKey" }, + { "description": "A unique key used to prevent duplicate processing" } + ] }, "sendDate": { "type": "string", - "format": "date" + "format": "date", + "description": "Optional. The date when the check should be sent. If not provided, the check will be sent immediately." }, "memo": { - "type": "string" + "type": "string", + "description": "Optional. Memo for the check payment, up to 40 characters." }, "description": { "type": "string", "minLength": 1, - "maxLength": 50 + "maxLength": 50, + "description": "Description of the check payment (maximum of 50 characters)" }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional tags for the check payment. See https://www.unit.co/docs/api/#tags" } + ] } }, "required": [ diff --git a/schemas/check/updateCheckDeposit.json b/schemas/check/updateCheckDeposit.json index 23b96b7..bbf8507 100644 --- a/schemas/check/updateCheckDeposit.json +++ b/schemas/check/updateCheckDeposit.json @@ -15,10 +15,14 @@ "properties": { "clearingDaysOverride": { "type": "integer", - "minimum": 1 + "minimum": 1, + "description": "Optional. See https://www.unit.co/docs/api/check-deposits/#dynamic-clearing-period-check-deposit." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "See https://www.unit.co/docs/api/#updating-tags." } + ] } }, "additionalProperties": false diff --git a/schemas/counterparty/counterparty.json b/schemas/counterparty/counterparty.json index 76b47bc..c03be3a 100644 --- a/schemas/counterparty/counterparty.json +++ b/schemas/counterparty/counterparty.json @@ -6,6 +6,7 @@ { "type": "object", "title": "Counterparty Relationships", + "description": "Relationships for a counterparty resource.", "required": ["customer"], "additionalProperties": false }, @@ -16,6 +17,7 @@ }, "Counterparty": { "title": "Counterparty Document", + "description": "The `counterparty` resource represents the other party that participates in a financial transaction.", "type": "object", "properties": { "type": { @@ -31,27 +33,33 @@ "properties": { "routingNumber": { "type": "string", - "pattern": "^\\d{9}$" + "pattern": "^\\d{9}$", + "description": "Valid 9-digit ABA routing transit number." }, "accountNumber": { "type": "string", - "pattern": "^\\d{1,17}$" + "pattern": "^\\d{1,17}$", + "description": "Bank account number." }, "accountType": { "type": "string", - "enum": ["Checking", "Savings", "Loan"] + "enum": ["Checking", "Savings", "Loan"], + "description": "Either Checking, Savings or Loan." }, "type": { "type": "string", - "enum": ["Business", "Person", "Unknown"] + "enum": ["Business", "Person", "Unknown"], + "description": "Either Business, Person or Unknown." }, "name": { "type": "string", "minLength": 1, - "maxLength": 50 + "maxLength": 50, + "description": "The account holder's name (whether an individual or a business, maximum of 50 characters)." }, "bank": { - "type": "string" + "type": "string", + "description": "The name of the bank." }, "permissions": { "type": "string", @@ -59,14 +67,17 @@ "CreditOnly", "DebitOnly", "CreditAndDebit" - ] + ], + "description": "Custom counterparty permissions. Either CreditOnly, DebitOnly or CreditAndDebit. 'CreditOnly' will be assigned as default value when permissions attribute is not declared." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "$ref": "../types.json#/components/schemas/Tags", + "description": "Optional. See Tags." }, "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the counterparty was created." } }, "required": [ diff --git a/schemas/counterparty/counterpartyBalance.json b/schemas/counterparty/counterpartyBalance.json index 00d3a54..aea8e05 100644 --- a/schemas/counterparty/counterpartyBalance.json +++ b/schemas/counterparty/counterpartyBalance.json @@ -6,6 +6,7 @@ { "type": "object", "title": "Counterparty Balance Relationships", + "description": "The relationships for a counterparty balance resource.", "required": ["customer", "counterparty"], "additionalProperties": false }, @@ -19,6 +20,7 @@ }, "CounterpartyBalance": { "title": "Counterparty Balance", + "description": "The counterparty balance resource.", "type": "object", "properties": { "type": { @@ -33,10 +35,12 @@ "type": "object", "properties": { "balance": { - "type": "number" + "type": "number", + "description": "The current balance of the counterparty account." }, "available": { - "type": "number" + "type": "number", + "description": "The available balance of the counterparty account." } }, "required": ["balance"], diff --git a/schemas/counterparty/counterpartyPaths.json b/schemas/counterparty/counterpartyPaths.json index 06ef586..7124cfb 100644 --- a/schemas/counterparty/counterpartyPaths.json +++ b/schemas/counterparty/counterpartyPaths.json @@ -4,6 +4,7 @@ "UnitCounterpartyResponse": { "type": "object", "title": "Unit Counterparty Response", + "description": "The target counterparty resource after the operation was completed.", "properties": { "data": { "$ref": "./counterparty.json#/components/schemas/Counterparty" @@ -12,22 +13,56 @@ }, "UnitCounterpartyBalanceResponse": { "type": "object", - "title": "Unit Counterparty Response", + "title": "Unit Counterparty Balance Response", + "description": "Counterparty Balance resource.", "properties": { "data": { "$ref": "./counterpartyBalance.json#/components/schemas/CounterpartyBalance" } } + }, + "UnitCounterpartiesListResponse": { + "type": "object", + "title": "Unit Counterparties List Response", + "description": "Array of counterparty resources.", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "./counterparty.json#/components/schemas/Counterparty" + } + }, + "meta": { + "type": "object", + "properties": { + "pagination": { + "type": "object", + "properties": { + "total": { + "type": "integer" + }, + "limit": { + "type": "integer" + }, + "offset": { + "type": "integer" + } + } + } + } + } + } } } }, "counterparties": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getCounterpartiesList", - - "summary": "Get Counterparties List", - "description": "Get Counterparties List from API ", + "summary": "List Counterparties", + "description": "List counterparties. Filtering and paging can be applied.", "parameters": [ { "$ref": "../types.json#/components/schemas/PageQuery" @@ -41,16 +76,20 @@ "type": "object", "properties": { "customerId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified customer id." }, "accountNumber": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified account number." }, "routingNumber": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified routing number." }, "permissions": { "type": "array", + "description": "Optional. Filters the results by the specified counterparty permissions either CreditOnly, DebitOnly, CreditAndDebit.", "items": { "type": "string", "enum": [ @@ -62,6 +101,7 @@ }, "tags": { "type": "object", + "description": "Optional. Filter Counterparties by Tags.", "additionalProperties": { "type": "string" } @@ -72,6 +112,7 @@ { "name": "sort", "in": "query", + "description": "Optional. sort=createdAt for ascending order or sort=-createdAt (leading minus sign) for descending order.", "schema": { "type": "string" } @@ -83,28 +124,23 @@ "content": { "application/vnd.api+json; charset=utf-8": { "schema": { - "type": "object", - "title": "Unit Counterparties List Response", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "./counterparty.json#/components/schemas/Counterparty" - } - } - } + "$ref": "#/components/schemas/UnitCounterpartiesListResponse" } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "createCounterparty", - "summary": "Create Counterparty", - "description": "Create a counterparty via API ", + "description": "Creates an ACH counterparty for a specific customer.", "requestBody": { "description": "Create Counterparty Request", "required": true, @@ -126,15 +162,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "counterparty": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getCounterparty", - "parameters": [ { "schema": { @@ -147,7 +187,7 @@ } ], "summary": "Get Counterparty by Id", - "description": "Get a Counterparty from API ", + "description": "Get a counterparty resource by id.", "responses": { "200": { "description": "Successful Response", @@ -158,15 +198,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "patch": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "updateCounterparty", - "summary": "Update Counterparty", - "description": "Update a Counterparty via API ", + "description": "Update a Counterparty. Relink existing counterparty with a new Plaid processor token.", "parameters": [ { "schema": { @@ -199,13 +243,17 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "delete": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "deleteCounterparty", - "parameters": [ { "schema": { @@ -218,20 +266,24 @@ } ], "summary": "Delete Counterparty by Id", - "description": "Delete Counterparty via API ", + "description": "Delete a counterparty resource by id.", "responses": { "204": { - "description": "Successful Response" + "description": "No content. The operation was completed successfully." + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "counterpartyBalance": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getCounterpartyBalance", - - "summary": "Get Counterparty Balance", + "summary": "Get Counterparty Balance By Id", "parameters": [ { "schema": { @@ -240,10 +292,10 @@ "name": "counterpartyId", "in": "path", "required": true, - "description": "ID of the counterparty to get" + "description": "ID of the counterparty to get the balance for" } ], - "description": "Get Recurring Payment from API ", + "description": "Get a counterparty balance by id. Counterparty must be created with Plaid Processor token in order to run this request. The external account balance will only be returned if customer is the owner of the counterparty account.", "responses": { "200": { "description": "Successful Response", @@ -254,8 +306,11 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/counterparty/createCounterparty.json b/schemas/counterparty/createCounterparty.json index fd912bc..fa9fc78 100644 --- a/schemas/counterparty/createCounterparty.json +++ b/schemas/counterparty/createCounterparty.json @@ -6,7 +6,8 @@ { "type": "object", "required": ["customer"], - "additionalProperties": false + "additionalProperties": false, + "description": "The customer that the counterparty belongs to." }, { "$ref": "../relationships.json#/components/schemas/CustomerRelationship" @@ -15,6 +16,7 @@ }, "CreateAchCounterparty": { "title": "Create Ach Counterparty", + "description": "Creates an ACH counterparty for a specific customer.", "type": "object", "properties": { "type": { @@ -26,14 +28,17 @@ "type": "object", "properties": { "routingNumber": { - "type": "string" + "type": "string", + "description": "Valid 9-digit ABA routing transit number." }, "accountNumber": { - "type": "string" + "type": "string", + "description": "Bank account number." }, "accountType": { "type": "string", - "enum": ["Checking", "Savings", "Loan"] + "enum": ["Checking", "Savings", "Loan"], + "description": "(defaults to checking). Either Checking, Savings or Loan." }, "permissions": { "type": "string", @@ -41,20 +46,25 @@ "CreditOnly", "DebitOnly", "CreditAndDebit" - ] + ], + "description": "Optional, custom counterparty permissions. Only DebitOnly or CreditAndDebit are valid values when using the permissions' attribute. 'CreditOnly' will be assigned as default value when permissions attribute is not declared. If the account and rounting number of the counterparty belong to an account under your org on Unit, you may specify \"CreditAndDebit\" or \"DebitOnly\" permissions as well." }, "type": { "type": "string", - "enum": ["Business", "Person", "Unknown"] + "enum": ["Business", "Person", "Unknown"], + "description": "Either Business, Person or Unknown." }, "name": { - "type": "string" + "type": "string", + "description": "The account holder's name (whether an individual or a business, maximum of 50 characters)." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "$ref": "../types.json#/components/schemas/Tags", + "description": "Optional. See Tags." }, "idempotencyKey": { - "$ref": "../types.json#/components/schemas/IdempotencyKey" + "$ref": "../types.json#/components/schemas/IdempotencyKey", + "description": "Optional. See Idempotency." } }, "required": [ @@ -75,6 +85,7 @@ }, "CreatePlaidCounterparty": { "title": "Create Plaid Counterparty", + "description": "Creates a counterparty for a specific customer using a Plaid processor token.", "type": "object", "properties": { "type": { @@ -87,17 +98,21 @@ "properties": { "type": { "type": "string", - "enum": ["Business", "Person", "Unknown"] + "enum": ["Business", "Person", "Unknown"], + "description": "Either Business, Person or Unknown." }, "name": { - "type": "string" + "type": "string", + "description": "The account holder's name (whether an individual or a business)." }, "verifyName": { "type": "boolean", - "default": false + "default": false, + "description": "Optional, default to false. Verify a match between the name of the counterparty and the name of the external account's owner as provided by Plaid. If the name verification fails the request will fail with code field set to NameVerificationFailed." }, "plaidProcessorToken": { - "$ref": "../types.json#/components/schemas/PlaidProcessorToken" + "$ref": "../types.json#/components/schemas/PlaidProcessorToken", + "description": "Plaid integration token. See Plaid processor token." }, "permissions": { "type": "string", @@ -105,13 +120,16 @@ "CreditOnly", "DebitOnly", "CreditAndDebit" - ] + ], + "description": "Optional, custom counterparty permissions. Either CreditOnly, DebitOnly, CreditAndDebit. Default is CreditAndDebit." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "$ref": "../types.json#/components/schemas/Tags", + "description": "Optional. See Tags." }, "idempotencyKey": { - "$ref": "../types.json#/components/schemas/IdempotencyKey" + "$ref": "../types.json#/components/schemas/IdempotencyKey", + "description": "Optional. See Idempotency." } }, "required": ["type", "plaidProcessorToken"], diff --git a/schemas/counterparty/updateCounterparty.json b/schemas/counterparty/updateCounterparty.json index 3d8d599..2c40ea5 100644 --- a/schemas/counterparty/updateCounterparty.json +++ b/schemas/counterparty/updateCounterparty.json @@ -3,6 +3,7 @@ "schemas": { "UpdateCounterparty": { "title": "Update Counterparty", + "description": "Update a Counterparty. Relink existing counterparty with a new Plaid processor token.", "type": "object", "properties": { "type": { @@ -14,12 +15,14 @@ "type": "object", "properties": { "plaidProcessorToken": { - "$ref": "../types.json#/components/schemas/PlaidProcessorToken" + "$ref": "../types.json#/components/schemas/PlaidProcessorToken", + "description": "Optional, unless updating a Plaid counterparty. Plaid integration token. See Plaid processor token." }, "name": { "type": "string", "minLength": 1, - "maxLength": 50 + "maxLength": 50, + "description": "The account holder's name (whether an individual or a business, maximum of 50 characters)." }, "permissions": { "type": "string", @@ -27,14 +30,17 @@ "CreditOnly", "DebitOnly", "CreditAndDebit" - ] + ], + "description": "Optional, custom counterparty permissions. Either CreditOnly, DebitOnly, CreditAndDebit." }, "verifyName": { "type": "boolean", - "default": false + "default": false, + "description": "Optional, default to false. Verify the name of the counterparty, if the name verification fails the request will fail with code field set to NameVerificationFailed." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "$ref": "../types.json#/components/schemas/Tags", + "description": "Optional. See Tags." } }, "additionalProperties": false diff --git a/schemas/credit-application/createCreditApplication.json b/schemas/credit-application/createCreditApplication.json new file mode 100644 index 0000000..b66c3f7 --- /dev/null +++ b/schemas/credit-application/createCreditApplication.json @@ -0,0 +1,235 @@ +{ + "components": { + "schemas": { + "CreateOnboardingCustomerCreditApplication": { + "title": "Create Onboarding Customer Credit Application", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["createOnboardingCustomerCreditApplication"] + }, + "attributes": { + "type": "object", + "properties": { + "aggregatorAccessTokens": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Optional. Array of aggregator access tokens which are Plaid (or other account linking platform) integration tokens. See [Plaid processor token](https://plaid.com/docs/api/processors/)" + }, + "annualIncome": { + "type": "integer", + "description": "Optional. The annual income of the applicant." + }, + "numberOfEmployees": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/BusinessNumberOfEmployees" }, + { "description": "Optional. Number of employees of the business." } + ] + }, + "yearsInBusiness": { + "type": "integer", + "description": "Optional. Number of years the business has been in operation." + }, + "additionalUnderwritingData": { + "type": "object", + "description": "Optional. Object containing key-value pairs of underwriting data per credit policy." + }, + "idempotencyKey": { + "type": "string", + "description": "Optional. See [Idempotency](https://www.unit.co/docs/api/#intro-idempotency)." + } + }, + "additionalProperties": false + }, + "relationships": { + "type": "object", + "properties": { + "application": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["application"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + }, + "lendingProgram": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["lendingProgram"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + } + }, + "required": ["application", "lendingProgram"], + "additionalProperties": false + } + }, + "required": ["type", "relationships"], + "additionalProperties": false + }, + "CreateExistingCustomerCreditApplication": { + "title": "Create Existing Customer Credit Application", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["createExistingCustomerCreditApplication"] + }, + "attributes": { + "type": "object", + "properties": { + "aggregatorAccessTokens": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Optional. Array of aggregator access tokens which are Plaid (or other account linking platform) integration tokens. See [Plaid processor token](https://plaid.com/docs/api/processors/)" + }, + "annualIncome": { + "type": "integer", + "description": "Optional. The annual income of the applicant." + }, + "numberOfEmployees": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/BusinessNumberOfEmployees" }, + { "description": "Optional. Number of employees of the business." } + ] + }, + "yearsInBusiness": { + "type": "integer", + "description": "Optional. Number of years the business has been in operation." + }, + "additionalUnderwritingData": { + "type": "object", + "description": "Optional. Object containing key-value pairs of underwriting data per credit policy." + }, + "idempotencyKey": { + "type": "string", + "description": "Optional. See [Idempotency](https://www.unit.co/docs/api/#intro-idempotency)." + } + }, + "additionalProperties": false + }, + "relationships": { + "type": "object", + "properties": { + "customer": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["customer"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + }, + "lendingProgram": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["lendingProgram"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + } + }, + "required": ["customer", "lendingProgram"], + "additionalProperties": false + } + }, + "required": ["type", "relationships"], + "additionalProperties": false + }, + "CreateOnboardingCustomerCreditApplicationRequest": { + "title": "Create Onboarding Customer Credit Application Request", + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CreateOnboardingCustomerCreditApplication" + } + }, + "required": ["data"] + }, + "CreateExistingCustomerCreditApplicationRequest": { + "title": "Create Existing Customer Credit Application Request", + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CreateExistingCustomerCreditApplication" + } + }, + "required": ["data"] + }, + "CreateCreditApplicationRequest": { + "title": "Create Credit Application Request", + "type": "object", + "properties": { + "data": { + "oneOf": [ + { + "$ref": "#/components/schemas/CreateOnboardingCustomerCreditApplication" + }, + { + "$ref": "#/components/schemas/CreateExistingCustomerCreditApplication" + } + ] + } + }, + "required": ["data"] + } + } + } +} \ No newline at end of file diff --git a/schemas/credit-application/creditApplication.json b/schemas/credit-application/creditApplication.json new file mode 100644 index 0000000..22b9473 --- /dev/null +++ b/schemas/credit-application/creditApplication.json @@ -0,0 +1,222 @@ +{ + "components": { + "schemas": { + "OnboardingCreditApplicationAttributes": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "description": "The date and time when the credit application was created." + }, + "status": { + "type": "string", + "enum": ["Created", "Pending", "ManualReview", "Approved", "Denied", "Canceled"], + "description": "The status of the credit application." + }, + "aggregatorAccessTokens": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Optional. Array of aggregator access tokens which are Plaid (or other account linking platform) integration tokens. See [Plaid processor token](https://plaid.com/docs/api/processors/)" + }, + "annualIncome": { + "type": "integer", + "description": "Optional. The annual income of the applicant." + }, + "numberOfEmployees": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/BusinessNumberOfEmployees" }, + { "description": "Optional. Number of employees of the business." } + ] + }, + "yearsInBusiness": { + "type": "integer", + "description": "Optional. Number of years the business has been in operation." + }, + "additionalUnderwritingData": { + "type": "object", + "description": "Optional. Object containing key-value pairs of underwriting data per credit policy." + } + }, + "required": ["createdAt", "status", "aggregatorAccessTokens"] + }, + "ExistingCustomerCreditApplicationAttributes": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "description": "The date and time when the credit application was created." + }, + "status": { + "type": "string", + "enum": ["Created", "Pending", "ManualReview", "Approved", "Denied", "Canceled"], + "description": "The status of the credit application." + }, + "aggregatorAccessTokens": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Optional. Array of aggregator access tokens which are Plaid (or other account linking platform) integration tokens. See [Plaid processor token](https://plaid.com/docs/api/processors/)" + }, + "annualIncome": { + "type": "integer", + "description": "Optional. The annual income of the applicant." + }, + "numberOfEmployees": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/BusinessNumberOfEmployees" }, + { "description": "Optional. Number of employees of the business." } + ] + }, + "yearsInBusiness": { + "type": "integer", + "description": "Optional. Number of years the business has been in operation." + }, + "additionalUnderwritingData": { + "type": "object", + "description": "Optional. Object containing key-value pairs of underwriting data per credit policy." + } + }, + "required": ["createdAt", "status", "aggregatorAccessTokens"] + }, + "OnboardingCreditApplicationRelationships": { + "allOf": [ + { + "type": "object", + "required": [ + "application", + "lendingProgram" + ] + }, + { + "$ref": "../relationships.json#/components/schemas/LendingProgramRelationship" + }, + { + "type": "object", + "properties": { + "application": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["application"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + }, + "required": ["type", "id"] + } + } + } + } + } + ] + }, + "ExistingCustomerCreditApplicationRelationships": { + "allOf": [ + { + "type": "object", + "required": [ + "customer", + "lendingProgram" + ] + }, + { + "$ref": "../relationships.json#/components/schemas/LendingProgramRelationship" + }, + { + "type": "object", + "properties": { + "customer": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["customer"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + }, + "required": ["type", "id"] + } + } + } + } + } + ] + }, + "OnboardingCustomerCreditApplication": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["onboardingCustomerCreditApplication"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "attributes": { + "$ref": "#/components/schemas/OnboardingCreditApplicationAttributes" + }, + "relationships": { + "$ref": "#/components/schemas/OnboardingCreditApplicationRelationships" + } + }, + "required": ["type", "id", "attributes", "relationships"] + }, + "ExistingCustomerCreditApplication": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["existingCustomerCreditApplication"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "attributes": { + "$ref": "#/components/schemas/ExistingCustomerCreditApplicationAttributes" + }, + "relationships": { + "$ref": "#/components/schemas/ExistingCustomerCreditApplicationRelationships" + } + }, + "required": ["type", "id", "attributes", "relationships"] + }, + "CreditApplication": { + "title": "Credit Application Resource", + "description": "This process often involves a comprehensive evaluation of the applicant's financial stability, credit history, and the purpose of the loan.", + "type": "object", + "properties": { + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "type": { + "type": "string", + "enum": [ + "onboardingCustomerCreditApplication", + "existingCustomerCreditApplication" + ] + } + }, + "discriminator": { + "propertyName": "type", + "mapping": { + "onboardingCustomerCreditApplication": "#/components/schemas/OnboardingCustomerCreditApplication", + "existingCustomerCreditApplication": "#/components/schemas/ExistingCustomerCreditApplication" + } + } + } + } + } +} \ No newline at end of file diff --git a/schemas/credit-application/creditApplicationPaths.json b/schemas/credit-application/creditApplicationPaths.json new file mode 100644 index 0000000..e83c213 --- /dev/null +++ b/schemas/credit-application/creditApplicationPaths.json @@ -0,0 +1,224 @@ +{ + "components": { + "schemas": { + "UnitCreditApplicationResponse": { + "title": "Unit Credit Application Response", + "type": "object", + "properties": { + "data": { + "$ref": "./creditApplication.json#/components/schemas/CreditApplication" + } + }, + "required": ["data"] + }, + "UnitCreditApplicationListResponse": { + "title": "Unit Credit Application List Response", + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "./creditApplication.json#/components/schemas/CreditApplication" + } + }, + "meta": { + "$ref": "../types.json#/components/schemas/PaginationMeta" + } + }, + "required": ["data"] + } + } + }, + "creditApplications": { + "post": { + "tags": ["unit"], + "summary": "Create a credit application", + "description": "Create an onboarding or existing customer credit application.", + "operationId": "createCreditApplication", + "requestBody": { + "description": "Create Credit Application Request", + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "./createCreditApplication.json#/components/schemas/CreateCreditApplicationRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitCreditApplicationResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + }, + "get": { + "tags": ["unit"], + "summary": "List credit applications", + "description": "List credit applications resources. Paging can be applied.", + "operationId": "listCreditApplications", + "parameters": [ + { + "name": "page[limit]", + "in": "query", + "description": "Optional. Maximum number of resources that will be returned. Maximum is 1000 resources. See [Pagination](https://www.unit.co/docs/api/#intro-pagination).", + "schema": { + "type": "integer", + "default": 100 + } + }, + { + "name": "page[offset]", + "in": "query", + "description": "Optional. Number of resources to skip. See [Pagination](https://www.unit.co/docs/api/#intro-pagination).", + "schema": { + "type": "integer", + "default": 0 + } + }, + { + "name": "filter[lendingProgramId]", + "in": "query", + "description": "Optional. Search resources by lending program id.", + "schema": { + "type": "string" + } + }, + { + "name": "filter[orgId]", + "in": "query", + "description": "Optional. Search resources by organization id.", + "schema": { + "type": "string" + } + }, + { + "name": "filter[bankId]", + "in": "query", + "description": "Optional. Search resources by bank id.", + "schema": { + "type": "string" + } + }, + { + "name": "filter[applicationId]", + "in": "query", + "description": "Optional. Search resources by application id.", + "schema": { + "type": "string" + } + }, + { + "name": "filter[customerId]", + "in": "query", + "description": "Optional. Search resources by customer id.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitCreditApplicationListResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "creditApplication": { + "get": { + "tags": ["unit"], + "summary": "Get a credit application by ID", + "description": "Get a credit application resource by id.", + "operationId": "getCreditApplication", + "parameters": [ + { + "name": "creditApplicationId", + "in": "path", + "required": true, + "description": "The ID of the credit application to retrieve", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitCreditApplicationResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + }, + "patch": { + "tags": ["unit"], + "summary": "Update a credit application", + "description": "Update a credit application.", + "operationId": "updateCreditApplication", + "parameters": [ + { + "name": "creditApplicationId", + "in": "path", + "required": true, + "description": "The ID of the credit application to update", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "Update Credit Application Request", + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "./patchCreditApplication.json#/components/schemas/PatchCreditApplicationRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitCreditApplicationResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + } +} \ No newline at end of file diff --git a/schemas/credit-application/patchCreditApplication.json b/schemas/credit-application/patchCreditApplication.json new file mode 100644 index 0000000..f46b48b --- /dev/null +++ b/schemas/credit-application/patchCreditApplication.json @@ -0,0 +1,59 @@ +{ + "components": { + "schemas": { + "PatchCreditApplication": { + "title": "Patch Credit Application", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["patchCreditApplication"] + }, + "attributes": { + "type": "object", + "properties": { + "aggregatorAccessTokens": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Optional. Array of aggregator access tokens which are Plaid (or other account linking platform) integration tokens. See [Plaid processor token](https://plaid.com/docs/api/processors/)" + }, + "annualIncome": { + "type": "integer", + "description": "Optional. The annual income of the applicant." + }, + "numberOfEmployees": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/BusinessNumberOfEmployees" }, + { "description": "Optional. Number of employees of the business." } + ] + }, + "yearsInBusiness": { + "type": "integer", + "description": "Optional. Number of years the business has been in operation." + }, + "additionalUnderwritingData": { + "type": "object", + "description": "Optional. Object containing key-value pairs of underwriting data per credit policy." + } + }, + "additionalProperties": false + } + }, + "required": ["type"], + "additionalProperties": false + }, + "PatchCreditApplicationRequest": { + "title": "Patch Credit Application Request", + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/PatchCreditApplication" + } + }, + "required": ["data"] + } + } + } +} \ No newline at end of file diff --git a/schemas/credit-decision/createCreditDecision.json b/schemas/credit-decision/createCreditDecision.json new file mode 100644 index 0000000..50a21ab --- /dev/null +++ b/schemas/credit-decision/createCreditDecision.json @@ -0,0 +1,457 @@ +{ + "components": { + "schemas": { + "CreateManualReviewCreditApplicationDecisionAttributes": { + "type": "object", + "properties": { + "externalApplicationId": { + "type": "string", + "description": "Identifier for client's credit evaluation related to this decision. Max 200 char." + }, + "submissionTimestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the corresponding credit application was submitted." + }, + "decisionTimestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the credit decision was made." + }, + "policyException": { + "type": "boolean", + "description": "One of true or false." + }, + "policyExceptionReason": { + "type": "string", + "description": "Conditional if policyException is true. Brief description of reason for policy exception. Max 200 char." + }, + "additionalUnderwritingData": { + "type": "object", + "description": "Object containing key-value pairs of underwriting data per credit policy." + }, + "idempotencyKey": { + "type": "string", + "description": "Optional. See [Idempotency](https://www.unit.co/docs/api/#intro-idempotency)." + } + }, + "required": [ + "externalApplicationId", + "submissionTimestamp", + "decisionTimestamp", + "policyException" + ] + }, + "CreateDeniedCreditApplicationDecisionAttributes": { + "type": "object", + "properties": { + "externalApplicationId": { + "type": "string", + "description": "Identifier for client's credit evaluation related to this decision. Max 200 char." + }, + "submissionTimestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the corresponding credit application was submitted." + }, + "decisionTimestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the credit decision was made." + }, + "decisionReason": { + "type": "string", + "description": "Reason for denial per credit policy. Max 200 char." + }, + "adverseActionReasons": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Array of strings representing Adverse action reasons (must have at least one). Max 200 char per reason." + }, + "policyException": { + "type": "boolean", + "description": "One of true or false." + }, + "policyExceptionReason": { + "type": "string", + "description": "Conditional if policyException is true. Brief description of reason for policy exception. Max 200 char." + }, + "additionalUnderwritingData": { + "type": "object", + "description": "Object containing key-value pairs of underwriting data per credit policy." + }, + "idempotencyKey": { + "type": "string", + "description": "Optional. See [Idempotency](https://www.unit.co/docs/api/#intro-idempotency)." + } + }, + "required": [ + "externalApplicationId", + "submissionTimestamp", + "decisionTimestamp", + "decisionReason", + "adverseActionReasons", + "policyException" + ] + }, + "CreateApprovedCreditLimitDecisionAttributes": { + "type": "object", + "properties": { + "externalApplicationId": { + "type": "string", + "description": "Identifier for client's credit evaluation related to this decision. Max 200 char." + }, + "submissionTimestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the corresponding credit application was submitted." + }, + "decisionTimestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the credit decision was made." + }, + "creditLimit": { + "type": "integer", + "description": "Credit limit for application as evaluated per policy." + }, + "policyException": { + "type": "boolean", + "description": "One of true or false." + }, + "policyExceptionReason": { + "type": "string", + "description": "Conditional if policyException is true. Brief description of reason for policy exception. Max 200 char." + }, + "additionalUnderwritingData": { + "type": "object", + "description": "Object containing key-value pairs of underwriting data per credit policy." + }, + "idempotencyKey": { + "type": "string", + "description": "Optional. See [Idempotency](https://www.unit.co/docs/api/#intro-idempotency)." + } + }, + "required": [ + "externalApplicationId", + "submissionTimestamp", + "decisionTimestamp", + "creditLimit", + "policyException" + ] + }, + "CreateDeniedCreditLimitDecisionAttributes": { + "type": "object", + "properties": { + "externalApplicationId": { + "type": "string", + "description": "Identifier for client's credit evaluation related to this decision. Max 200 char." + }, + "submissionTimestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the corresponding credit application was submitted." + }, + "decisionTimestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the credit decision was made." + }, + "decisionReason": { + "type": "string", + "description": "Reason for denial per credit policy. Max 200 char." + }, + "adverseActionReasons": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Array of strings representing Adverse action reasons (must have at least one). Max 200 char per reason." + }, + "policyException": { + "type": "boolean", + "description": "One of true or false." + }, + "policyExceptionReason": { + "type": "string", + "description": "Conditional if policyException is true. Brief description of reason for policy exception. Max 200 char." + }, + "additionalUnderwritingData": { + "type": "object", + "description": "Object containing key-value pairs of underwriting data per credit policy." + }, + "idempotencyKey": { + "type": "string", + "description": "Optional. See [Idempotency](https://www.unit.co/docs/api/#intro-idempotency)." + } + }, + "required": [ + "externalApplicationId", + "submissionTimestamp", + "decisionTimestamp", + "decisionReason", + "adverseActionReasons", + "policyException" + ] + }, + "CreateManualReviewCreditLimitDecisionAttributes": { + "type": "object", + "properties": { + "externalApplicationId": { + "type": "string", + "description": "Identifier for client's credit evaluation related to this decision. Max 200 char." + }, + "submissionTimestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the corresponding credit application was submitted." + }, + "decisionTimestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the credit decision was made." + }, + "policyException": { + "type": "boolean", + "description": "One of true or false." + }, + "policyExceptionReason": { + "type": "string", + "description": "Conditional if policyException is true. Brief description of reason for policy exception. Max 200 char." + }, + "additionalUnderwritingData": { + "type": "object", + "description": "Object containing key-value pairs of underwriting data per credit policy." + }, + "idempotencyKey": { + "type": "string", + "description": "Optional. See [Idempotency](https://www.unit.co/docs/api/#intro-idempotency)." + } + }, + "required": [ + "externalApplicationId", + "submissionTimestamp", + "decisionTimestamp", + "policyException" + ] + }, + "CreateManualReviewCreditApplicationDecision": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["manualReviewCreditApplicationDecision"] + }, + "attributes": { + "$ref": "#/components/schemas/CreateManualReviewCreditApplicationDecisionAttributes" + }, + "relationships": { + "type": "object", + "properties": { + "creditApplication": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["creditApplication"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + }, + "required": ["type", "id"] + } + }, + "required": ["data"] + } + }, + "required": ["creditApplication"] + } + }, + "required": ["type", "attributes", "relationships"] + }, + "CreateDeniedCreditApplicationDecision": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["deniedCreditApplicationDecision"] + }, + "attributes": { + "$ref": "#/components/schemas/CreateDeniedCreditApplicationDecisionAttributes" + }, + "relationships": { + "type": "object", + "properties": { + "creditApplication": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["creditApplication"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + }, + "required": ["type", "id"] + } + }, + "required": ["data"] + } + }, + "required": ["creditApplication"] + } + }, + "required": ["type", "attributes", "relationships"] + }, + "CreateApprovedCreditLimitDecision": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["approvedCreditLimitDecision"] + }, + "attributes": { + "$ref": "#/components/schemas/CreateApprovedCreditLimitDecisionAttributes" + }, + "relationships": { + "type": "object", + "properties": { + "creditApplication": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["creditApplication"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + }, + "required": ["type", "id"] + } + }, + "required": ["data"] + } + }, + "required": ["creditApplication"] + } + }, + "required": ["type", "attributes", "relationships"] + }, + "CreateDeniedCreditLimitDecision": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["deniedCreditLimitDecision"] + }, + "attributes": { + "$ref": "#/components/schemas/CreateDeniedCreditLimitDecisionAttributes" + }, + "relationships": { + "type": "object", + "properties": { + "creditApplication": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["creditApplication"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + }, + "required": ["type", "id"] + } + }, + "required": ["data"] + } + }, + "required": ["creditApplication"] + } + }, + "required": ["type", "attributes", "relationships"] + }, + "CreateManualReviewCreditLimitDecision": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["manualReviewCreditLimitDecision"] + }, + "attributes": { + "$ref": "#/components/schemas/CreateManualReviewCreditLimitDecisionAttributes" + }, + "relationships": { + "type": "object", + "properties": { + "creditApplication": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["creditApplication"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + }, + "required": ["type", "id"] + } + }, + "required": ["data"] + } + }, + "required": ["creditApplication"] + } + }, + "required": ["type", "attributes", "relationships"] + }, + "CreateCreditDecisionRequest": { + "type": "object", + "properties": { + "data": { + "oneOf": [ + { + "$ref": "#/components/schemas/CreateManualReviewCreditApplicationDecision" + }, + { + "$ref": "#/components/schemas/CreateDeniedCreditApplicationDecision" + }, + { + "$ref": "#/components/schemas/CreateApprovedCreditLimitDecision" + }, + { + "$ref": "#/components/schemas/CreateDeniedCreditLimitDecision" + }, + { + "$ref": "#/components/schemas/CreateManualReviewCreditLimitDecision" + } + ] + } + }, + "required": ["data"] + } + } + } +} \ No newline at end of file diff --git a/schemas/credit-decision/creditDecision.json b/schemas/credit-decision/creditDecision.json new file mode 100644 index 0000000..173f72f --- /dev/null +++ b/schemas/credit-decision/creditDecision.json @@ -0,0 +1,314 @@ +{ + "components": { + "schemas": { + "CreditDecisionBaseAttributes": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "format": "date-time", + "description": "The date and time when the credit decision was created." + }, + "externalApplicationId": { + "type": "string", + "description": "Identifier for client's credit evaluation related to this decision. Max 200 char." + }, + "evaluationType": { + "type": "string", + "enum": ["CreditApplication", "CreditLimit"], + "description": "The type of evaluation for this credit decision." + }, + "submissionTimestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the corresponding credit application was submitted." + }, + "decisionTimestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the credit decision was made." + }, + "decision": { + "type": "string", + "enum": ["Approved", "Denied", "ManualReview"], + "description": "The decision made for this credit application." + }, + "policyException": { + "type": "boolean", + "description": "One of true or false." + }, + "policyExceptionReason": { + "type": "string", + "description": "Conditional if policyException is true. Brief description of reason for policy exception. Max 200 char." + }, + "additionalUnderwritingData": { + "type": "object", + "description": "Object containing key-value pairs of underwriting data per credit policy." + } + }, + "required": [ + "createdAt", + "externalApplicationId", + "evaluationType", + "submissionTimestamp", + "decisionTimestamp", + "decision", + "policyException" + ] + }, + "ApprovedCreditDecisionAttributes": { + "allOf": [ + { + "$ref": "#/components/schemas/CreditDecisionBaseAttributes" + }, + { + "type": "object", + "properties": { + "creditLimit": { + "type": "integer", + "description": "Credit limit for application as evaluated per policy." + } + }, + "required": ["creditLimit"] + } + ] + }, + "DeniedCreditDecisionAttributes": { + "allOf": [ + { + "$ref": "#/components/schemas/CreditDecisionBaseAttributes" + }, + { + "type": "object", + "properties": { + "decisionReason": { + "type": "string", + "description": "Reason for denial per credit policy. Max 200 char." + }, + "adverseActionReasons": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Array of strings representing Adverse action reasons (must have at least one). Max 200 char per reason." + } + }, + "required": ["decisionReason", "adverseActionReasons"] + } + ] + }, + "ManualReviewCreditDecisionAttributes": { + "allOf": [ + { + "$ref": "#/components/schemas/CreditDecisionBaseAttributes" + } + ] + }, + "CreditDecisionRelationships": { + "allOf": [ + { + "type": "object", + "properties": { + "bank": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["bank"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + } + } + } + ] + }, + "CreditApplicationDecisionRelationships": { + "allOf": [ + { + "$ref": "#/components/schemas/CreditDecisionRelationships" + }, + { + "$ref": "../relationships.json#/components/schemas/CreditApplicationRelationship" + }, + { + "$ref": "../relationships.json#/components/schemas/ApplicationRelationship" + } + ] + }, + "CreditLimitDecisionRelationships": { + "allOf": [ + { + "$ref": "#/components/schemas/CreditDecisionRelationships" + }, + { + "$ref": "../relationships.json#/components/schemas/CreditApplicationRelationship" + }, + { + "$ref": "../relationships.json#/components/schemas/CustomerRelationship" + }, + { + "$ref": "../relationships.json#/components/schemas/AccountRelationship" + } + ] + }, + "ApprovedCreditLimitDecision": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["approvedCreditLimitDecision"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "attributes": { + "$ref": "#/components/schemas/ApprovedCreditDecisionAttributes" + }, + "relationships": { + "$ref": "#/components/schemas/CreditLimitDecisionRelationships" + } + }, + "required": ["type", "id", "attributes", "relationships"] + }, + "DeniedCreditLimitDecision": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["deniedCreditLimitDecision"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "attributes": { + "$ref": "#/components/schemas/DeniedCreditDecisionAttributes" + }, + "relationships": { + "$ref": "#/components/schemas/CreditLimitDecisionRelationships" + } + }, + "required": ["type", "id", "attributes", "relationships"] + }, + "ManualReviewCreditLimitDecision": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["manualReviewCreditLimitDecision"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "attributes": { + "$ref": "#/components/schemas/ManualReviewCreditDecisionAttributes" + }, + "relationships": { + "$ref": "#/components/schemas/CreditLimitDecisionRelationships" + } + }, + "required": ["type", "id", "attributes", "relationships"] + }, + "ApprovedCreditApplicationDecision": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["approvedCreditApplicationDecision"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "attributes": { + "$ref": "#/components/schemas/ApprovedCreditDecisionAttributes" + }, + "relationships": { + "$ref": "#/components/schemas/CreditApplicationDecisionRelationships" + } + }, + "required": ["type", "id", "attributes", "relationships"] + }, + "DeniedCreditApplicationDecision": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["deniedCreditApplicationDecision"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "attributes": { + "$ref": "#/components/schemas/DeniedCreditDecisionAttributes" + }, + "relationships": { + "$ref": "#/components/schemas/CreditApplicationDecisionRelationships" + } + }, + "required": ["type", "id", "attributes", "relationships"] + }, + "ManualReviewCreditApplicationDecision": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["manualReviewCreditApplicationDecision"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "attributes": { + "$ref": "#/components/schemas/ManualReviewCreditDecisionAttributes" + }, + "relationships": { + "$ref": "#/components/schemas/CreditApplicationDecisionRelationships" + } + }, + "required": ["type", "id", "attributes", "relationships"] + }, + "CreditDecision": { + "title": "Credit Decision Resource", + "description": "A credit decision resource for credit applications or credit limits.", + "type": "object", + "properties": { + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "type": { + "type": "string", + "enum": [ + "approvedCreditLimitDecision", + "deniedCreditLimitDecision", + "manualReviewCreditLimitDecision", + "approvedCreditApplicationDecision", + "deniedCreditApplicationDecision", + "manualReviewCreditApplicationDecision" + ] + } + }, + "discriminator": { + "propertyName": "type", + "mapping": { + "approvedCreditLimitDecision": "#/components/schemas/ApprovedCreditLimitDecision", + "deniedCreditLimitDecision": "#/components/schemas/DeniedCreditLimitDecision", + "manualReviewCreditLimitDecision": "#/components/schemas/ManualReviewCreditLimitDecision", + "approvedCreditApplicationDecision": "#/components/schemas/ApprovedCreditApplicationDecision", + "deniedCreditApplicationDecision": "#/components/schemas/DeniedCreditApplicationDecision", + "manualReviewCreditApplicationDecision": "#/components/schemas/ManualReviewCreditApplicationDecision" + } + } + } + } + } +} \ No newline at end of file diff --git a/schemas/credit-decision/creditDecisionPaths.json b/schemas/credit-decision/creditDecisionPaths.json new file mode 100644 index 0000000..9690f87 --- /dev/null +++ b/schemas/credit-decision/creditDecisionPaths.json @@ -0,0 +1,199 @@ +{ + "components": { + "schemas": { + "UnitCreditDecisionResponse": { + "title": "Unit Credit Decision Response", + "type": "object", + "properties": { + "data": { + "$ref": "./creditDecision.json#/components/schemas/CreditDecision" + } + }, + "required": ["data"] + }, + "UnitCreditDecisionListResponse": { + "title": "Unit Credit Decision List Response", + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "./creditDecision.json#/components/schemas/CreditDecision" + } + }, + "meta": { + "$ref": "../types.json#/components/schemas/PaginationMeta" + } + }, + "required": ["data"] + } + } + }, + "creditDecisions": { + "post": { + "tags": ["unit"], + "summary": "Create a credit decision", + "description": "Create a credit decision for a credit application or credit limit.", + "operationId": "createCreditDecision", + "requestBody": { + "description": "Create Credit Decision Request", + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "./createCreditDecision.json#/components/schemas/CreateCreditDecisionRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitCreditDecisionResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + }, + "get": { + "tags": ["unit"], + "summary": "List credit decisions", + "description": "List credit decision resources. Paging can be applied.", + "operationId": "listCreditDecisions", + "parameters": [ + { + "name": "page[limit]", + "in": "query", + "description": "Optional. Maximum number of resources that will be returned. Maximum is 1000 resources. See [Pagination](https://www.unit.co/docs/api/#intro-pagination).", + "schema": { + "type": "integer", + "default": 100 + } + }, + { + "name": "page[offset]", + "in": "query", + "description": "Optional. Number of resources to skip. See [Pagination](https://www.unit.co/docs/api/#intro-pagination).", + "schema": { + "type": "integer", + "default": 0 + } + }, + { + "name": "filter[orgId]", + "in": "query", + "description": "Optional. Filters the results by the specified org id.", + "schema": { + "type": "string" + } + }, + { + "name": "filter[customerId]", + "in": "query", + "description": "Optional. Filters the results by the specified customer id.", + "schema": { + "type": "string" + } + }, + { + "name": "filter[accountId]", + "in": "query", + "description": "Optional. Filters the results by the specified account id.", + "schema": { + "type": "string" + } + }, + { + "name": "filter[applicationId]", + "in": "query", + "description": "Optional. Filters the results by the specified application id.", + "schema": { + "type": "string" + } + }, + { + "name": "filter[bankId]", + "in": "query", + "description": "Optional. Filters the results by the specified bank id.", + "schema": { + "type": "string" + } + }, + { + "name": "filter[decision]", + "in": "query", + "description": "Optional. Filters the results by the specified decision (one of Approved or Denied).", + "schema": { + "type": "string", + "enum": ["Approved", "Denied"] + } + }, + { + "name": "filter[evaluationType]", + "in": "query", + "description": "Optional. Filters the results by the specified evaluation type (one of CreditLimit or CreditApplication).", + "schema": { + "type": "string", + "enum": ["CreditLimit", "CreditApplication"] + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitCreditDecisionListResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "creditDecision": { + "get": { + "tags": ["unit"], + "summary": "Get a credit decision by ID", + "description": "Get a credit decision resource by id.", + "operationId": "getCreditDecision", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the credit decision to retrieve", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitCreditDecisionResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + } +} \ No newline at end of file diff --git a/schemas/customer/addAuthorizedUser.json b/schemas/customer/addAuthorizedUser.json index 5b1e387..93376ce 100644 --- a/schemas/customer/addAuthorizedUser.json +++ b/schemas/customer/addAuthorizedUser.json @@ -19,13 +19,17 @@ "type": "array", "items": { "$ref": "../types.json#/components/schemas/AuthorizedUser" - } + }, + "description": "Array of authorized users. The provided array items will be added to the existing ones." } - } + }, + "required": ["authorizedUsers"] } - } + }, + "required": ["type", "attributes"] } - } + }, + "required": ["data"] }, "RemoveAuthorizedUsersRequest": { "type": "object", @@ -46,13 +50,17 @@ "items": { "type": "string", "format": "email" - } + }, + "description": "The list of authorized users emails to remove from the customer." } - } + }, + "required": ["authorizedUsersEmails"] } - } + }, + "required": ["type", "attributes"] } - } + }, + "required": ["data"] } } } diff --git a/schemas/customer/createCustomer.json b/schemas/customer/createCustomer.json index 044b0e1..5e5c3bc 100644 --- a/schemas/customer/createCustomer.json +++ b/schemas/customer/createCustomer.json @@ -177,7 +177,7 @@ } }, "CreateBusinessWalletCustomer": { - "title": "Create Business Customer", + "title": "Create Business Wallet Customer", "type": "object", "properties": { "type": { @@ -189,26 +189,49 @@ "type": "object", "properties": { "bankName": { - "type": "string" + "type": "string", + "description": "The name of the bank partner this customer is about to create a wallet under." }, "businessName": { - "type": "string" + "type": "string", + "description": "The name of the business this customer represents." + }, + "name": { + "type": "string", + "description": "The name of the business." }, "address": { - "$ref": "../types.json#/components/schemas/Address" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Address" }, + { "description": "Address of the business." } + ] }, "ein": { "type": "string", - "pattern": "^\\d{9}$" + "pattern": "^\\d{9}$", + "description": "Business EIN (numbers only)." }, "businessVertical": { - "$ref": "../types.json#/components/schemas/BusinessVertical" + "allOf": [ + { "$ref": "../types.json#/components/schemas/BusinessVertical" }, + { "description": "The business vertical of the business." } + ] }, "numberOfEmployees": { - "$ref": "../types.json#/components/schemas/BusinessNumberOfEmployees" + "allOf": [ + { "$ref": "../types.json#/components/schemas/BusinessNumberOfEmployees" }, + { "description": "The number of employees working for this business." } + ] }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional. See [Updating Tags](https://www.unit.co/docs/api/#updating-tags)." } + ] + }, + "idempotencyKey": { + "type": "string", + "description": "Optional. Idempotency key for the request." } }, "additionalProperties": false, @@ -221,6 +244,9 @@ "businessVertical", "numberOfEmployees" ] + }, + "relationships": { + "$ref": "#/components/schemas/CreateCustomerRelationships" } }, "additionalProperties": false, diff --git a/schemas/customer/customer.json b/schemas/customer/customer.json index ba3d27b..47f83d6 100644 --- a/schemas/customer/customer.json +++ b/schemas/customer/customer.json @@ -101,7 +101,8 @@ }, "status": { "type": "string", - "enum": ["Active", "Archived"] + "enum": ["Active", "Archived"], + "description": "Status of the customer, either Active or Archived." }, "archiveReason": { "type": "string", @@ -113,8 +114,10 @@ "FraudApplicationHistory", "FraudAccountActivity", "FraudClientIdentified", - "FraudLinkedToFraudulentCustomer" - ] + "FraudLinkedToFraudulentCustomer", + "ByBank" + ], + "description": "The reason the customer was archived. One of Inactive, FraudACHActivity, FraudCardActivity, FraudCheckActivity, FraudApplicationHistory, FraudAccountActivity, FraudClientIdentified, FraudLinkedToFraudulentCustomer, ByBank. This list is subject to change." } }, "additionalProperties": false, @@ -192,7 +195,8 @@ }, "status": { "type": "string", - "enum": ["Active", "Archived"] + "enum": ["Active", "Archived"], + "description": "Status of the customer, either Active or Archived." }, "archiveReason": { "type": "string", @@ -204,8 +208,10 @@ "FraudApplicationHistory", "FraudAccountActivity", "FraudClientIdentified", - "FraudLinkedToFraudulentCustomer" - ] + "FraudLinkedToFraudulentCustomer", + "ByBank" + ], + "description": "The reason the customer was archived. One of Inactive, FraudACHActivity, FraudCardActivity, FraudCheckActivity, FraudApplicationHistory, FraudAccountActivity, FraudClientIdentified, FraudLinkedToFraudulentCustomer, ByBank. This list is subject to change." } }, "additionalProperties": false, diff --git a/schemas/customer/customerPaths.json b/schemas/customer/customerPaths.json index b37053d..87b526f 100644 --- a/schemas/customer/customerPaths.json +++ b/schemas/customer/customerPaths.json @@ -14,7 +14,9 @@ }, "customer": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getCustomer", "parameters": [ { @@ -25,10 +27,18 @@ "in": "path", "required": true, "description": "ID of the customer to get" + }, + { + "name": "include", + "in": "query", + "schema": { + "type": "string" + }, + "description": "Optional. A comma-separated list of related resources to include in the response. Related resource include: authorizedUser. See [Getting Related Resources](https://www.unit.co/docs/api/about-jsonapi/#intro-getting-related-resources)" } ], - "summary": "Get Customer by Id", - "description": "Get a Customer from API ", + "summary": "Get by Id", + "description": "Get a customer resource by id.", "responses": { "200": { "description": "Successful Response", @@ -39,14 +49,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "patch": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "updateCustomer", "summary": "Update Customer", - "description": "Update an Customer via API ", + "description": "Update an Customer via API. The Customer Updated webhook event will be fired.", "parameters": [ { "schema": { @@ -79,16 +94,21 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "listCustomers": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getCustomersList", - "summary": "Get Customers List", - "description": "Get Customers List from API ", + "summary": "List", + "description": "List customer resources. Paging can be applied.", "parameters": [ { "$ref": "../types.json#/components/schemas/PageQuery" @@ -102,23 +122,30 @@ "type": "object", "properties": { "query": { - "type": "string" + "type": "string", + "description": "Optional. Search term according to the [Full-Text Search Rules](https://www.unit.co/docs/api/#full-text-search)." }, "status": { "type": "array", "items": { "type": "string", - "enum": ["Active", "Archived"] - } + "enum": [ + "Active", + "Archived" + ] + }, + "description": "Optional. Filter customers by status (Active, Archived). Usage example: *filter[status][0]=Active" }, "email": { - "type": "string" + "type": "string", + "description": "Optional. Filter customers by email address (case sensitive)." }, "tags": { "type": "object", "additionalProperties": { "type": "string" - } + }, + "description": "Optional. Filter Customers by [Tags](https://www.unit.co/docs/api/#tags)." } } } @@ -128,7 +155,8 @@ "in": "query", "schema": { "type": "string" - } + }, + "description": "Optional. sort=createdAt for ascending order or sort=-createdAt (leading minus sign) for descending order." } ], "responses": { @@ -153,13 +181,66 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + }, + "post": { + "tags": [ + "unit" + ], + "operationId": "createBusinessWalletCustomer", + "summary": "Create Business Wallet Customer", + "description": "Create a business wallet customer.", + "requestBody": { + "description": "Create Business Wallet Customer Request", + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "./createCustomer.json#/components/CreateBusinessWalletCustomer" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "responses": { + "201": { + "description": "Successful Response", + "content": { + "application/vnd.api+json": { + "schema": { + "type": "object", + "title": "Unit Business Wallet Customer Response", + "properties": { + "data": { + "$ref": "./customer.json#/components/schemas/BusinessWalletCustomer" + } + } + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "archiveCustomer": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "archiveCustomer", "parameters": [ { @@ -183,8 +264,8 @@ } } }, - "summary": "Archive Customer by Id", - "description": "Archive a Customer via API ", + "summary": "Archive Customer", + "description": "Archive a customer. The Customer Archived webhook event will be fired.", "responses": { "200": { "description": "Successful Response", @@ -195,13 +276,18 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "authorizedUsers": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "addAuthorizedUsers", "parameters": [ { @@ -225,8 +311,8 @@ } } }, - "summary": "Add Authorized Users by Id", - "description": "Add Authorized Users via API", + "summary": "Add Authorized Users", + "description": "Add authorized users for a customer. The Customer Update webhook event will be fired.", "responses": { "200": { "description": "Successful Response", @@ -237,11 +323,74 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + }, + "get": { + "tags": [ + "unit" + ], + "operationId": "listAuthorizedUsers", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "customerId", + "in": "path", + "required": true, + "description": "ID of the customer to list authorized users for" + }, + { + "name": "filter[jwtSubject]", + "in": "query", + "schema": { + "type": "string" + }, + "description": "Optional. Filter authorized users by JWT subject." + }, + { + "name": "filter[phone]", + "in": "query", + "schema": { + "$ref": "../types.json#/components/schemas/Phone" + }, + "description": "Optional. Filter authorized users by phone." + } + ], + "summary": "List", + "description": "List of authorized user resources. Filtering can be applied.", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "../types.json#/components/schemas/AuthorizedUser" + } + } + } + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "delete": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "removeAuthorizedUsers", "parameters": [ { @@ -255,7 +404,7 @@ } ], "requestBody": { - "description": "Add Authorized Users Request", + "description": "Remove Authorized Users Request", "required": true, "content": { "application/vnd.api+json": { @@ -265,8 +414,8 @@ } } }, - "summary": "Remove Authorized Users by Id", - "description": "Remove Authorized Users via API", + "summary": "Remove Authorized Users", + "description": "Remove existing authorized users from a customer. The Customer Update webhook event will be fired.", "responses": { "200": { "description": "Successful Response", @@ -277,8 +426,61 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "authorizedUser": { + "get": { + "tags": [ + "unit" + ], + "operationId": "getAuthorizedUser", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "customerId", + "in": "path", + "required": true, + "description": "ID of the customer that the authorized user belongs to" + }, + { + "schema": { + "type": "string" + }, + "name": "authorizedUserId", + "in": "path", + "required": true, + "description": "ID of the authorized user to get" + } + ], + "summary": "Get by Id", + "description": "Get an authorized user resource by id.", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "../types.json#/components/schemas/AuthorizedUser" + } + } + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/customer/updateCustomer.json b/schemas/customer/updateCustomer.json index 3192db6..d47b36d 100644 --- a/schemas/customer/updateCustomer.json +++ b/schemas/customer/updateCustomer.json @@ -153,8 +153,10 @@ "FraudApplicationHistory", "FraudAccountActivity", "FraudClientIdentified", - "FraudLinkedToFraudulentCustomer" - ] + "FraudLinkedToFraudulentCustomer", + "ByBank" + ], + "description": "The reason for archiving the customer. One of Inactive, FraudACHActivity, FraudCardActivity, FraudCheckActivity, FraudApplicationHistory, FraudAccountActivity, FraudClientIdentified, FraudLinkedToFraudulentCustomer, ByBank. This list is subject to change." } } } diff --git a/schemas/dispute/dispute.json b/schemas/dispute/dispute.json index bdce0b9..02dc5b4 100644 --- a/schemas/dispute/dispute.json +++ b/schemas/dispute/dispute.json @@ -23,6 +23,7 @@ "Dispute": { "title": "Dispute Document", "type": "object", + "description": "The Dispute resource represents a card dispute that has been raised by an end customer. More details on card disputes can be found in Unit's disputes guide", "properties": { "type": { "type": "string", @@ -30,43 +31,59 @@ "default": "dispute" }, "id": { - "$ref": "../types.json#/components/schemas/Identifier" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Identifier" }, + { "description": "The identifier of the dispute." } + ] }, "attributes": { "type": "object", "properties": { "source": { "type": "string", - "enum": ["DebitCard", "ACH"] + "enum": ["DebitCard", "ACH"], + "description": "The source of the dispute, either DebitCard or ACH." }, "externalId": { "type": "string", - "maxLength": 255 + "maxLength": 255, + "description": "The external identifier of the dispute." }, "link": { - "$ref": "../types.json#/components/schemas/Url" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Url" }, + { "description": "A URL link related to the dispute." } + ] }, "description": { - "$ref": "../types.json#/components/schemas/Description" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Description" }, + { "description": "A description of the dispute." } + ] }, "amount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "The amount of the dispute in cents." }, "status": { - "type": "string" + "type": "string", + "description": "The current status of the dispute." }, "statusHistory": { "type": "array", + "description": "History of status changes for this dispute.", "items": { "type": "object", "properties": { "type": { - "type": "string" + "type": "string", + "description": "The type of status change." }, "updatedAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the status was updated." } }, "additionalProperties": false @@ -74,10 +91,12 @@ }, "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the dispute was created." }, "decisionReason": { - "type": "string" + "type": "string", + "description": "The reason for the decision on the dispute, if applicable." } }, "required": [ diff --git a/schemas/dispute/disputePaths.json b/schemas/dispute/disputePaths.json index ddc9204..30b9a33 100644 --- a/schemas/dispute/disputePaths.json +++ b/schemas/dispute/disputePaths.json @@ -1,11 +1,12 @@ { "listDisputes": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getDisputesList", - - "summary": "Get List Disputes", - "description": "Get List Disputes from API ", + "summary": "List Disputes", + "description": "List dispute resources. Paging can be applied.", "parameters": [ { "$ref": "../types.json#/components/schemas/PageQuery" @@ -19,10 +20,12 @@ "type": "object", "properties": { "query": { - "type": "string" + "type": "string", + "description": "Optional. Search term according to the Full-Text Search Rules." } } - } + }, + "description": "Filter parameters" } ], "responses": { @@ -31,23 +34,32 @@ "content": { "application/vnd.api+json; charset=utf-8": { "schema": { - "type": "array", + "type": "object", "title": "Unit Disputes List Response", - "items": { - "$ref": "./dispute.json#/components/schemas/Dispute" + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "./dispute.json#/components/schemas/Dispute" + } + } } } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "getDispute": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getDispute", - "parameters": [ { "schema": { @@ -60,7 +72,7 @@ } ], "summary": "Get Dispute by Id", - "description": "Get a Dispute from API ", + "description": "Get a dispute resource by id.", "responses": { "200": { "description": "Successful Response", @@ -77,8 +89,11 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/event/event.json b/schemas/event/event.json index 9114182..aa7ec73 100644 --- a/schemas/event/event.json +++ b/schemas/event/event.json @@ -1,28 +1,681 @@ { "components": { "schemas": { - "Event": { - "title": "Event Resource", + "BaseEvent": { + "title": "Base Event Resource", "type": "object", + "description": "Unit uses `Events` to record important changes happening under your org. Once an event is created, it will be delivered to your application via a webhook call.\n\nOur event types follow a specific structure: `resource.event`.\n\nEach event includes an `id` field, which uniquely identifies the event instance, and a `type` field that identifies the type of the event instance.\n\nEach event type includes a different set of attributes and relationships, relevant to that specific event.\n\nEvent attributes may contain a set of custom tags inherited from a related resource request.", "properties": { "type": { - "type": "string" + "type": "string", + "description": "Identifies the type of the event instance" }, "id": { - "$ref": "../types.json#/components/schemas/Identifier" + "$ref": "../types.json#/components/schemas/Identifier", + "description": "Uniquely identifies the event instance" }, "attributes": { "type": "object", - "properties": {} - }, - "relationships": { - "type": "object", - "title": "Event Relationships", - "properties": {} + "properties": { + "createdAt": { + "type": "string", + "format": "date-time", + "description": "The time when the event was created" + }, + "tags": { + "$ref": "../types.json#/components/schemas/Tags", + "description": "Event attributes may contain a set of custom tags inherited from a related resource request" + } + } } }, - "additionalProperties": false, - "required": ["type", "id"] + "required": ["type", "id", "attributes"] + }, + "AccountCreatedEvent": { + "allOf": [ + { "$ref": "#/components/schemas/BaseEvent" }, + { + "type": "object", + "description": "Occurs when an Account is created successfully.", + "properties": { + "type": { + "type": "string", + "enum": ["account.created"] + }, + "relationships": { + "type": "object", + "properties": { + "account": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["account"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + } + } + } + }, + "customer": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["customer", "individualCustomer", "businessCustomer"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + } + } + } + } + } + } + } + } + ] + }, + "AccountClosedEvent": { + "allOf": [ + { "$ref": "#/components/schemas/BaseEvent" }, + { + "type": "object", + "description": "Occurs when an Account is closed.", + "properties": { + "type": { + "type": "string", + "enum": ["account.closed"] + }, + "attributes": { + "type": "object", + "properties": { + "closeReason": { + "type": "string", + "description": "Reason for closing the account" + } + } + }, + "relationships": { + "type": "object", + "properties": { + "account": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["account"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + } + } + } + }, + "customer": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["customer", "individualCustomer", "businessCustomer"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + } + } + } + } + } + } + } + } + ] + }, + "AccountFrozenEvent": { + "allOf": [ + { "$ref": "#/components/schemas/BaseEvent" }, + { + "type": "object", + "description": "Occurs when an Account is frozen.", + "properties": { + "type": { + "type": "string", + "enum": ["account.frozen"] + }, + "attributes": { + "type": "object", + "properties": { + "freezeReason": { + "type": "string", + "description": "Reason for freezing the account" + } + } + }, + "relationships": { + "type": "object", + "properties": { + "account": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["account"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + } + } + } + }, + "customer": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["customer", "individualCustomer", "businessCustomer"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + } + } + } + } + } + } + } + } + ] + }, + "AccountReopenedEvent": { + "allOf": [ + { "$ref": "#/components/schemas/BaseEvent" }, + { + "type": "object", + "description": "Occurs when a closed Account is reopened.", + "properties": { + "type": { + "type": "string", + "enum": ["account.reopened"] + }, + "relationships": { + "type": "object", + "properties": { + "account": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["account"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + } + } + } + }, + "customer": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["customer", "individualCustomer", "businessCustomer"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + } + } + } + } + } + } + } + } + ] + }, + "AccountUnfrozenEvent": { + "allOf": [ + { "$ref": "#/components/schemas/BaseEvent" }, + { + "type": "object", + "description": "Occurs when a frozen Account is unfrozen.", + "properties": { + "type": { + "type": "string", + "enum": ["account.unfrozen"] + }, + "relationships": { + "type": "object", + "properties": { + "account": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["account"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + } + } + } + }, + "customer": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["customer", "individualCustomer", "businessCustomer"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + } + } + } + } + } + } + } + } + ] + }, + "AccountUpdatedEvent": { + "allOf": [ + { "$ref": "#/components/schemas/BaseEvent" }, + { + "type": "object", + "description": "Occurs when an Account is updated. The list of changes is provided in the `changes` attribute.", + "properties": { + "type": { + "type": "string", + "enum": ["account.updated"] + }, + "attributes": { + "type": "object", + "properties": { + "changes": { + "type": "object", + "description": "List of changes to the resource", + "additionalProperties": { + "type": "object", + "properties": { + "previous": { + "type": "string", + "description": "The previous value" + }, + "current": { + "type": "string", + "description": "The current value" + } + } + }, + "example": { + "depositProduct": { + "previous": "934", + "current": "120009" + } + } + } + } + }, + "relationships": { + "type": "object", + "properties": { + "account": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["account"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + } + } + } + }, + "customer": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["customer", "individualCustomer", "businessCustomer"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + } + } + } + } + } + } + } + } + ] + }, + "AuthorizationCreatedEvent": { + "allOf": [ + { "$ref": "#/components/schemas/BaseEvent" }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["authorization.created"] + }, + "attributes": { + "type": "object", + "properties": { + "amount": { + "type": "integer", + "description": "Transaction amount" + }, + "available": { + "type": "integer", + "description": "Available balance" + }, + "cardLast4Digits": { + "type": "string", + "description": "Last 4 digits of the card" + }, + "merchant": { + "type": "object", + "description": "Merchant information", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "id": { + "type": "string" + } + } + }, + "recurring": { + "type": "boolean", + "description": "Whether the transaction is recurring" + } + } + }, + "relationships": { + "type": "object", + "properties": { + "authorization": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["authorization"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + } + } + } + } + } + } + } + } + ] + }, + "TransactionCreatedEvent": { + "allOf": [ + { "$ref": "#/components/schemas/BaseEvent" }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["transaction.created"] + }, + "attributes": { + "type": "object", + "properties": { + "amount": { + "type": "integer", + "description": "Transaction amount" + }, + "direction": { + "type": "string", + "description": "Transaction direction" + }, + "summary": { + "type": "string", + "description": "Transaction summary" + } + } + }, + "relationships": { + "type": "object", + "properties": { + "account": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["account"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + } + } + } + }, + "transaction": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["wireTransaction", "achTransaction", "bookTransaction", "transaction"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + } + } + } + }, + "customer": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["customer", "individualCustomer", "businessCustomer"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + } + } + } + } + } + } + } + } + ] + }, + "WireDrawdownCreatedEvent": { + "allOf": [ + { "$ref": "#/components/schemas/BaseEvent" }, + { + "type": "object", + "description": "Occurs when a Wire Drawdown request is created.", + "properties": { + "type": { + "type": "string", + "enum": ["wireDrawdown.created"] + }, + "attributes": { + "type": "object", + "properties": { + "amount": { + "type": "integer", + "description": "Transaction amount" + }, + "direction": { + "type": "string", + "description": "Transaction direction" + }, + "counterparty": { + "type": "object", + "description": "Counterparty information", + "properties": { + "name": { + "type": "string" + }, + "routingNumber": { + "type": "string" + }, + "accountNumber": { + "type": "string" + } + } + } + } + }, + "relationships": { + "type": "object", + "properties": { + "wireDrawdown": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["wireDrawdown"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + } + } + } + }, + "customer": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["customer", "individualCustomer", "businessCustomer"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + } + } + } + }, + "account": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["account"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + } + } + } + } + } + } + } + } + ] + }, + "Event": { + "title": "Event Resource", + "description": "Unit uses `Events` to record important changes happening under your org. Once an event is created, it will be delivered to your application via a webhook call.\n\nOur event types follow a specific structure: `resource.event`.\n\nEach event includes an `id` field, which uniquely identifies the event instance, and a `type` field that identifies the type of the event instance.\n\nEach event type includes a different set of attributes and relationships, relevant to that specific event.\n\nEvent attributes may contain a set of custom tags inherited from a related resource request.", + "oneOf": [ + { "$ref": "#/components/schemas/AccountCreatedEvent" }, + { "$ref": "#/components/schemas/AccountClosedEvent" }, + { "$ref": "#/components/schemas/AccountFrozenEvent" }, + { "$ref": "#/components/schemas/AccountUnfrozenEvent" }, + { "$ref": "#/components/schemas/AccountReopenedEvent" }, + { "$ref": "#/components/schemas/AccountUpdatedEvent" }, + { "$ref": "#/components/schemas/AuthorizationCreatedEvent" }, + { "$ref": "#/components/schemas/TransactionCreatedEvent" }, + { "$ref": "#/components/schemas/WireDrawdownCreatedEvent" } + ], + "discriminator": { + "propertyName": "type" + } } } } diff --git a/schemas/event/eventPaths.json b/schemas/event/eventPaths.json index 1462838..889674e 100644 --- a/schemas/event/eventPaths.json +++ b/schemas/event/eventPaths.json @@ -9,16 +9,131 @@ "$ref": "./event.json#/components/schemas/Event" } } + }, + "EventType": { + "type": "string", + "description": "The type of the event instance", + "enum": [ + "account.created", + "account.closed", + "account.reopened", + "account.frozen", + "account.unfrozen", + "account.updated", + "application.created", + "application.denied", + "application.canceled", + "application.pendingReview", + "application.awaitingDocuments", + "authorization.created", + "authorization.canceled", + "authorization.amountChanged", + "authorization.declined", + "authorization.updated", + "authorizationRequest.approved", + "authorizationRequest.declined", + "authorizationRequest.pending", + "bulkPayments.failed", + "bulkPayments.finished", + "card.created", + "card.activated", + "card.statusChanged", + "card.pinChanged", + "card.reissuing", + "checkDeposit.created", + "checkDeposit.pendingReview", + "checkDeposit.pending", + "checkDeposit.rejected", + "checkDeposit.clearing", + "checkDeposit.sent", + "checkDeposit.returned", + "checkPayment.created", + "checkPayment.markedForReturn", + "checkPayment.processed", + "checkPayment.returned", + "checkPayment.pending", + "checkPayment.rejected", + "checkPayment.inProduction", + "checkPayment.inDelivery", + "checkPayment.delivered", + "checkPayment.returnToSender", + "checkPayment.canceled", + "checkPayment.deliveryStatusChanged", + "checkPayment.additionalVerificationRequired", + "checkPayment.additionalVerificationApproved", + "stopPayment.created", + "stopPayment.paymentStopped", + "stopPayment.disabled", + "stopPayment.updated", + "creditDecision.approved", + "creditDecision.manualReview", + "creditDecision.denied", + "customer.created", + "customer.updated", + "customer.archived", + "declinedIncomingPayment.created", + "dispute.created", + "dispute.statusChanged", + "document.approved", + "document.rejected", + "payment.created", + "payment.clearing", + "payment.sent", + "payment.rejected", + "payment.returned", + "payment.canceled", + "payment.pendingReview", + "recurringPayment.created", + "recurringPayment.statusChanged", + "recurringPayment.failed", + "recurringRepayment.created", + "recurringRepayment.failed", + "recurringRepayment.skipped", + "recurringRepayment.statusChanged", + "statements.created", + "statement.created", + "taxForm.created", + "taxForm.updated", + "transaction.created", + "transaction.updated", + "receivedPayment.created", + "receivedPayment.advanced", + "receivedPayment.pendingReview", + "receivedPayment.pending", + "receivedPayment.markedForReturn", + "receivedPayment.completed", + "receivedPayment.returned", + "chargeback.created", + "reward.sent", + "reward.rejected", + "repayment.created", + "repayment.statusChanged", + "creditApplication.created", + "creditApplication.pending", + "creditApplication.approved", + "creditApplication.manualReview", + "creditApplication.denied", + "creditApplication.canceled", + "cardFraudCase.created", + "cardFraudCase.activated", + "cardFraudCase.expired", + "cardFraudCase.fraud", + "cardFraudCase.noFraud", + "wireDrawdown.created" + ] } } }, "listEvents": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getEventsList", - "summary": "Get Events List", - "description": "Get Events List from API ", + "description": "List event resources, going back up to 90 days. Paging can be applied.", + "x-scope": "events", + "x-timeout": 5, "parameters": [ { "$ref": "../types.json#/components/schemas/PageQuery" @@ -32,16 +147,21 @@ "type": "object", "properties": { "since": { - "type": "string" + "type": "string", + "format": "date-time", + "description": "Optional. Filters the events that occurred after the specified date. e.g. 2022-01-13T16:01:19.346Z" }, "until": { - "type": "string" + "type": "string", + "format": "date-time", + "description": "Optional. Filters the events that occurred before the specified date. e.g. 2022-01-15T20:06:23.486Z" }, - "type": { + "type[]": { "type": "array", "items": { - "type": "string" - } + "$ref": "#/components/schemas/EventType" + }, + "description": "Optional. Filter Events by Event type." } } } @@ -66,15 +186,21 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "event": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getEvent", - + "x-scope": "events", + "x-timeout": 5, "parameters": [ { "schema": { @@ -87,7 +213,7 @@ } ], "summary": "Get Event by Id", - "description": "Get an Event from API ", + "description": "Get an event resource by id. This API is available only for events that were created within the last 90 days.", "responses": { "200": { "description": "Successful Response", @@ -104,13 +230,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "fireEvent", - + "x-scope": "events-write", + "x-timeout": 5, "parameters": [ { "schema": { @@ -123,7 +255,19 @@ } ], "summary": "Fire Event by Id", - "description": "Fire an Event via API ", + "description": "Resend a previously published webhook event. This API is available only for events that were created within the last 90 days.", + "requestBody": { + "description": "Fire Event Request", + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "type": "object", + "properties": {} + } + } + } + }, "responses": { "200": { "description": "Successful Response", @@ -134,8 +278,11 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/fee/createFee.json b/schemas/fee/createFee.json index aa4e049..ffa6834 100644 --- a/schemas/fee/createFee.json +++ b/schemas/fee/createFee.json @@ -9,7 +9,10 @@ "additionalProperties": false }, { - "$ref": "../relationships.json#/components/schemas/AccountRelationship" + "allOf": [ + { "$ref": "../relationships.json#/components/schemas/AccountRelationship" }, + { "description": "The account to charge the fee." } + ] } ] }, @@ -30,17 +33,25 @@ "amount": { "type": "integer", "minimum": 1, - "format": "int64" + "format": "int64", + "description": "The amount (in cents) to charge the account." }, "description": { "type": "string", - "maxLength": 50 + "maxLength": 50, + "description": "Description of the fee (maximum of 50 characters)." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional. See Tags." } + ] }, "idempotencyKey": { - "$ref": "../types.json#/components/schemas/IdempotencyKey" + "allOf": [ + { "$ref": "../types.json#/components/schemas/IdempotencyKey" }, + { "description": "Optional, but strongly recommended. See Idempotency." } + ] } }, "required": ["amount", "description"], diff --git a/schemas/fee/fee.json b/schemas/fee/fee.json index 0915bd7..ef7f80e 100644 --- a/schemas/fee/fee.json +++ b/schemas/fee/fee.json @@ -10,7 +10,10 @@ "additionalProperties": false }, { - "$ref": "../relationships.json#/components/schemas/AccountRelationship" + "allOf": [ + { "$ref": "../relationships.json#/components/schemas/AccountRelationship" }, + { "description": "The account to charge the fee." } + ] } ] }, @@ -32,14 +35,19 @@ "amount": { "type": "integer", "minimum": 1, - "format": "int64" + "format": "int64", + "description": "The amount (in cents) to charge the account." }, "description": { "type": "string", - "maxLength": 50 + "maxLength": 50, + "description": "Description of the fee (maximum of 50 characters)." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional. See Tags." } + ] } }, "required": ["amount", "description"], diff --git a/schemas/fee/feePaths.json b/schemas/fee/feePaths.json index 46cb041..9ac5546 100644 --- a/schemas/fee/feePaths.json +++ b/schemas/fee/feePaths.json @@ -1,10 +1,12 @@ { "createFee": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "createFee", "summary": "Create Fee", - "description": "Create a Fee via API ", + "description": "Creates a fee for an Account. Fees are a way for you to bill your customer for their activity, and can be used for everything from monthly subscriptions to financial activity fees (payments, card issuance etc.)", "requestBody": { "description": "Create Fee Request", "required": true, @@ -32,16 +34,21 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "reverseFee": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "reverseFee", "summary": "Reverse Fee", - "description": "Reverse a Fee via API ", + "description": "Reverse a fee for an Account.", "requestBody": { "description": "Reverse Fee Request", "required": true, @@ -69,8 +76,11 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/fee/feeReversal.json b/schemas/fee/feeReversal.json index f76d086..cf6f36d 100644 --- a/schemas/fee/feeReversal.json +++ b/schemas/fee/feeReversal.json @@ -8,14 +8,21 @@ "required": ["account", "transaction"] }, { - "$ref": "../relationships.json#/components/schemas/TransactionRelationship" + "allOf": [ + { "$ref": "../relationships.json#/components/schemas/TransactionRelationship" }, + { "description": "The transaction to reverse." } + ] }, { - "$ref": "../relationships.json#/components/schemas/AccountRelationship" + "allOf": [ + { "$ref": "../relationships.json#/components/schemas/AccountRelationship" }, + { "description": "The account to reverse the fee." } + ] } ] }, "FeeReversal": { + "title": "Fee Reversal", "type": "object", "properties": { "type": { @@ -23,14 +30,26 @@ "enum": ["feeReversal"], "default": "feeReversal" }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, "attributes": { "type": "object", "properties": { + "amount": { + "type": "integer", + "format": "int64", + "description": "The amount of the reversed fee." + }, "description": { - "type": "string" + "type": "string", + "description": "Description of the fee reversal." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional. See Tags." } + ] } }, "required": ["description"] @@ -39,7 +58,7 @@ "$ref": "#/components/schemas/FeeReversalRelationships" } }, - "required": [] + "required": ["type", "id", "attributes", "relationships"] } } } diff --git a/schemas/fee/reverseFee.json b/schemas/fee/reverseFee.json index 3aaa40f..2cedc2f 100644 --- a/schemas/fee/reverseFee.json +++ b/schemas/fee/reverseFee.json @@ -9,10 +9,16 @@ "additionalProperties": false }, { - "$ref": "../relationships.json#/components/schemas/AccountRelationship" + "allOf": [ + { "$ref": "../relationships.json#/components/schemas/AccountRelationship" }, + { "description": "The account to reverse the fee." } + ] }, { - "$ref": "../relationships.json#/components/schemas/TransactionRelationship" + "allOf": [ + { "$ref": "../relationships.json#/components/schemas/TransactionRelationship" }, + { "description": "The transaction to reverse." } + ] } ] }, @@ -32,13 +38,20 @@ "properties": { "description": { "type": "string", - "maxLength": 50 + "maxLength": 50, + "description": "Description of the fee (maximum of 50 characters)." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional. See Tags." } + ] }, "idempotencyKey": { - "$ref": "../types.json#/components/schemas/IdempotencyKey" + "allOf": [ + { "$ref": "../types.json#/components/schemas/IdempotencyKey" }, + { "description": "Optional, but strongly recommended. See Idempotency." } + ] } }, "required": ["description"] diff --git a/schemas/institution/institution.json b/schemas/institution/institution.json index adcb360..fc67404 100644 --- a/schemas/institution/institution.json +++ b/schemas/institution/institution.json @@ -4,6 +4,7 @@ "Institution": { "title": "Institution Resource", "type": "object", + "description": "The financial institution list gets updated periodically.", "properties": { "type": { "type": "string", @@ -14,19 +15,24 @@ "type": "object", "properties": { "routingNumber": { - "type": "string" + "type": "string", + "description": "The routing number of the financial institution." }, "name": { - "type": "string" + "type": "string", + "description": "The name of the financial institution." }, "address": { - "type": "string" + "type": "string", + "description": "The address of the financial institution." }, "isWireSupported": { - "type": "boolean" + "type": "boolean", + "description": "Indicates whether the institution supports wire payments." }, "isACHSupported": { - "type": "boolean" + "type": "boolean", + "description": "Indicates whether the institution supports ACH payments." } }, "required": [ diff --git a/schemas/institution/institutionPaths.json b/schemas/institution/institutionPaths.json index 43dcc7b..444cd9f 100644 --- a/schemas/institution/institutionPaths.json +++ b/schemas/institution/institutionPaths.json @@ -1,7 +1,9 @@ { "getInstitution": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getInstitution", "parameters": [ { @@ -11,11 +13,11 @@ "name": "routingNumber", "in": "path", "required": true, - "description": "routingNumber of the institution to get" + "description": "Routing number of the financial institution to get" } ], "summary": "Get Institution by Routing Number", - "description": "Get an Institution from API ", + "description": "Get an institution resource by routing number. The financial institution list gets updated periodically. If you have attempted to use this API with a valid routing number and it didn't return the expected result, please contact Unit with the details and we will add it to the institution list.", "responses": { "200": { "description": "Successful Response", @@ -32,8 +34,11 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/interest/interest.json b/schemas/interest/interest.json new file mode 100644 index 0000000..3f3bb83 --- /dev/null +++ b/schemas/interest/interest.json @@ -0,0 +1,47 @@ +{ + "components": { + "schemas": { + "AccruedInterest": { + "title": "Accrued Interest", + "type": "object", + "properties": { + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "type": { + "type": "string", + "const": "accruedInterest" + }, + "attributes": { + "type": "object", + "properties": { + "amount": { + "type": "integer", + "description": "The accrued interest amount in cents." + }, + "createdAt": { + "type": "string", + "format": "date-time", + "description": "The date and time when the record was created." + } + }, + "required": ["amount", "createdAt"], + "additionalProperties": false + }, + "relationships": { + "type": "object", + "properties": { + "account": { + "$ref": "../relationships.json#/components/schemas/AccountRelationship" + } + }, + "additionalProperties": false, + "required": ["account"] + } + }, + "required": ["type", "attributes", "relationships"], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/schemas/interest/interestPaths.json b/schemas/interest/interestPaths.json new file mode 100644 index 0000000..705cec5 --- /dev/null +++ b/schemas/interest/interestPaths.json @@ -0,0 +1,84 @@ +{ + "getTotalAccruedInterest": { + "get": { + "tags": [ + "unit" + ], + "operationId": "getTotalAccruedInterest", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "filter[accountId]", + "in": "query", + "required": false, + "description": "Optional. Filters the results by the specified account id." + }, + { + "schema": { + "type": "string", + "format": "date-time" + }, + "name": "filter[since]", + "in": "query", + "required": false, + "description": "Optional. Filters the accrued interest after the specified date. e.g. 2024-01-13T16:01:19.346Z. Either a set of [since] & [until] OR a set of [sinceInterestMonth] & [untilInterestMonth] is required." + }, + { + "schema": { + "type": "string", + "format": "date-time" + }, + "name": "filter[until]", + "in": "query", + "required": false, + "description": "Optional. Filters the account accrued interest before the specified date. e.g. 2024-05-06T16:01:00.123Z. Either a set of [since] & [until] OR a set of [sinceInterestMonth] & [untilInterestMonth] is required." + }, + { + "schema": { + "type": "string", + "pattern": "^\\d{4}-\\d{2}$" + }, + "name": "filter[sinceInterestMonth]", + "in": "query", + "required": false, + "description": "Optional. Filters the accrued interest after the specified month. e.g. 2024-03. Either a set of [since] & [until] OR a set of [sinceInterestMonth] & [untilInterestMonth] is required." + }, + { + "schema": { + "type": "string", + "pattern": "^\\d{4}-\\d{2}$" + }, + "name": "filter[untilInterestMonth]", + "in": "query", + "required": false, + "description": "Optional. Filters the accrued interest before the specified month. e.g. 2024-07. Either a set of [since] & [until] OR a set of [sinceInterestMonth] & [untilInterestMonth] is required." + } + ], + "summary": "Get Total Accrued Interest", + "description": "The response to this API call includes the sum of customer accrued interest (in cents) for a given period of time.", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "type": "object", + "title": "Unit Total Accrued Interest Response", + "properties": { + "data": { + "$ref": "../types.json#/components/schemas/TotalAccruedInterest" + } + } + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + } +} \ No newline at end of file diff --git a/schemas/lending-program/lendingProgram.json b/schemas/lending-program/lendingProgram.json new file mode 100644 index 0000000..3bacb7d --- /dev/null +++ b/schemas/lending-program/lendingProgram.json @@ -0,0 +1,126 @@ +{ + "components": { + "schemas": { + "BankSponsoredChargeCardProgram": { + "type": "object", + "title": "Bank Sponsored Charge Card Program", + "properties": { + "type": { + "type": "string", + "enum": ["bankSponsoredChargeCardProgram"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "attributes": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "format": "date-time", + "description": "ISO8601 date time." + }, + "name": { + "type": "string", + "description": "The name of the lending program." + }, + "programSizeLimit": { + "type": "integer", + "description": "The size of the credit line set by the Bank." + } + }, + "required": ["createdAt", "name", "programSizeLimit"], + "additionalProperties": false + } + }, + "required": ["type", "id", "attributes"], + "additionalProperties": false + }, + "ClientSponsoredChargeCardProgram": { + "type": "object", + "title": "Client Sponsored Charge Card Program", + "properties": { + "type": { + "type": "string", + "enum": ["clientSponsoredChargeCardProgram"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "attributes": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "format": "date-time", + "description": "ISO8601 date time." + }, + "name": { + "type": "string", + "description": "The name of the lending program." + }, + "programSizeLimit": { + "type": "integer", + "description": "The size of the credit line set by the Bank." + } + }, + "required": ["createdAt", "name", "programSizeLimit"], + "additionalProperties": false + } + }, + "required": ["type", "id", "attributes"], + "additionalProperties": false + }, + "ReceivablesRetentionProgram": { + "type": "object", + "title": "Receivables Retention Program", + "properties": { + "type": { + "type": "string", + "enum": ["receivablesRetention"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "attributes": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "format": "date-time", + "description": "ISO8601 date time." + }, + "name": { + "type": "string", + "description": "The name of the lending program." + }, + "programSizeLimit": { + "type": "integer", + "description": "The size of the credit line set by the Bank." + } + }, + "required": ["createdAt", "name", "programSizeLimit"], + "additionalProperties": false + } + }, + "required": ["type", "id", "attributes"], + "additionalProperties": false + }, + "LendingProgramResource": { + "title": "Lending Program Resource", + "type": "object", + "oneOf": [ + { + "$ref": "#/components/schemas/BankSponsoredChargeCardProgram" + }, + { + "$ref": "#/components/schemas/ClientSponsoredChargeCardProgram" + }, + { + "$ref": "#/components/schemas/ReceivablesRetentionProgram" + } + ] + } + } + } +} \ No newline at end of file diff --git a/schemas/lending-program/lendingProgramExtended.json b/schemas/lending-program/lendingProgramExtended.json new file mode 100644 index 0000000..7eb72dd --- /dev/null +++ b/schemas/lending-program/lendingProgramExtended.json @@ -0,0 +1,44 @@ +{ + "components": { + "schemas": { + "LendingProgramExtendedInformation": { + "title": "Lending Program Extended Information", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["lendingProgramExtended"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "attributes": { + "type": "object", + "properties": { + "programType": { + "type": "string", + "description": "The type of the lending program." + }, + "programSizeLimit": { + "type": "integer", + "description": "The size of the credit line set by the Bank." + }, + "remainingAvailableBalance": { + "type": "integer", + "description": "The remaining available balance of the lending program." + }, + "utilizedAmount": { + "type": "integer", + "description": "The utilized amount of the lending program." + } + }, + "required": ["programType", "programSizeLimit", "remainingAvailableBalance", "utilizedAmount"], + "additionalProperties": false + } + }, + "required": ["type", "id", "attributes"], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/schemas/lending-program/lendingProgramPaths.json b/schemas/lending-program/lendingProgramPaths.json new file mode 100644 index 0000000..7660e34 --- /dev/null +++ b/schemas/lending-program/lendingProgramPaths.json @@ -0,0 +1,214 @@ +{ + "components": { + "schemas": { + "UnitLendingProgramResponse": { + "title": "Unit Lending Program Response", + "type": "object", + "properties": { + "data": { + "$ref": "./lendingProgram.json#/components/schemas/LendingProgramResource" + } + }, + "required": [ + "data" + ] + }, + "UnitLendingProgramListResponse": { + "title": "Unit Lending Program List Response", + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "./lendingProgram.json#/components/schemas/LendingProgramResource" + } + }, + "meta": { + "$ref": "../types.json#/components/schemas/PaginationMeta" + } + }, + "required": [ + "data", + "meta" + ] + }, + "UnitLendingProgramExtendedResponse": { + "title": "Unit Lending Program Extended Response", + "type": "object", + "properties": { + "data": { + "$ref": "./lendingProgramExtended.json#/components/schemas/LendingProgramExtendedInformation" + } + }, + "required": [ + "data" + ] + } + } + }, + "lendingProgram": { + "get": { + "tags": [ + "unit" + ], + "summary": "Get lending program by id", + "description": "Get a lending program resource by id.", + "operationId": "getLendingProgram", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "description": "Lending program id" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitLendingProgramResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "lendingProgramExtended": { + "get": { + "tags": [ + "unit" + ], + "summary": "Get lending program extended information by id", + "description": "Get lending program extended information resource by id.", + "operationId": "getLendingProgramExtended", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "description": "Lending program id" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitLendingProgramExtendedResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "lendingPrograms": { + "get": { + "tags": [ + "unit" + ], + "summary": "List lending programs", + "description": "List lending program resources. Paging can be applied.", + "operationId": "listLendingPrograms", + "parameters": [ + { + "name": "page[limit]", + "in": "query", + "schema": { + "type": "integer", + "default": 100 + }, + "description": "Optional. Maximum number of resources that will be returned. Maximum is 1000 resources. See [Pagination](/docs/api/#intro-pagination)." + }, + { + "name": "page[offset]", + "in": "query", + "schema": { + "type": "integer", + "default": 0 + }, + "description": "Optional. Number of resources to skip. See [Pagination](/docs/api/#intro-pagination)." + }, + { + "name": "filter[name]", + "in": "query", + "schema": { + "type": "string" + }, + "description": "Optional. Filters the results by the specified program name." + }, + { + "name": "filter[programType]", + "in": "query", + "schema": { + "type": "string" + }, + "description": "Optional. Filters the results by the specified [Lending Program Type](/docs/#lending-program-type)." + }, + { + "name": "filter[minProgramLimit]", + "in": "query", + "schema": { + "type": "string" + }, + "description": "Optional. Filters the results by a minimum value of programSizeLimit." + }, + { + "name": "filter[maxProgramLimit]", + "in": "query", + "schema": { + "type": "string" + }, + "description": "Optional. Filters the results by a maximum value of programSizeLimit." + }, + { + "name": "filter[orgId]", + "in": "query", + "schema": { + "type": "string" + }, + "description": "Optional. Filters the results by the specified org id." + }, + { + "name": "filter[bankId]", + "in": "query", + "schema": { + "type": "string" + }, + "description": "Optional. Filters the results by the specified bank id." + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitLendingProgramListResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + } +} \ No newline at end of file diff --git a/schemas/payment/batchRelease.json b/schemas/payment/batchRelease.json new file mode 100644 index 0000000..36711ad --- /dev/null +++ b/schemas/payment/batchRelease.json @@ -0,0 +1,78 @@ +{ + "components": { + "schemas": { + "BatchRelease": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["batchRelease"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "attributes": { + "type": "object", + "properties": { + "amount": { + "type": "integer", + "description": "The amount (in cents) to move from the batch account to the receiver account." + }, + "description": { + "type": "string", + "description": "Description of the payment (maximum of 50 characters)." + }, + "senderName": { + "type": "string", + "description": "Sender name for the payment (maximum of 255 characters)." + }, + "senderAddress": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/Address" }, + { "description": "Sender address for the payment." } + ] + }, + "senderAccountNumber": { + "type": "string", + "description": "A unique identifier for the sender of the payment (maximum of 17 characters). As an example, when the payment comes from a card processor, this identifier may be set to the BIN followed by the last four digits of the card used." + }, + "tags": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional. See Tags at https://www.unit.co/docs/api/#tags. Will be passed to the related Release Transaction." } + ] + }, + "idempotencyKey": { + "type": "string", + "description": "Optional, but strongly recommended. See Idempotency at https://www.unit.co/docs/api/#intro-idempotency." + } + }, + "required": [ + "amount", + "description", + "senderName", + "senderAddress", + "senderAccountNumber" + ], + "additionalProperties": false + }, + "relationships": { + "type": "object", + "properties": { + "batchAccount": { + "$ref": "../relationships.json#/components/schemas/BatchAccountRelationship" + }, + "receiver": { + "$ref": "../relationships.json#/components/schemas/CustomerDepositAccountRelationship" + } + }, + "required": ["batchAccount", "receiver"], + "additionalProperties": false + } + }, + "required": ["type", "attributes", "relationships"], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/schemas/payment/batchReleasesPaths.json b/schemas/payment/batchReleasesPaths.json new file mode 100644 index 0000000..9e18920 --- /dev/null +++ b/schemas/payment/batchReleasesPaths.json @@ -0,0 +1,54 @@ +{ + "components": { + "schemas": { + "UnitBatchReleasesResponse": { + "type": "object", + "title": "Unit Batch Releases Response", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "./batchRelease.json#/components/schemas/BatchRelease" + } + } + } + } + } + }, + "createBatchReleases": { + "post": { + "tags": [ + "unit" + ], + "operationId": "createBatchReleases", + "summary": "Create Batch Releases", + "description": "Release is the act of splitting a single batch payment between multiple customer accounts in your organization. When creating releases, you are required to provide compliance information for the original senders of the funds.", + "requestBody": { + "description": "Create Batch Releases Request", + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "./createBatchReleases.json#/components/schemas/CreateBatchReleasesRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitBatchReleasesResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + } +} \ No newline at end of file diff --git a/schemas/payment/createBatchReleases.json b/schemas/payment/createBatchReleases.json new file mode 100644 index 0000000..8c84a5b --- /dev/null +++ b/schemas/payment/createBatchReleases.json @@ -0,0 +1,89 @@ +{ + "components": { + "schemas": { + "CreateBatchRelease": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["batchRelease"] + }, + "attributes": { + "type": "object", + "properties": { + "amount": { + "type": "integer", + "description": "The amount (in cents) to move from the batch account to the receiver account." + }, + "description": { + "type": "string", + "description": "Description of the payment (maximum of 50 characters)." + }, + "senderName": { + "type": "string", + "description": "Sender name for the payment (maximum of 255 characters)." + }, + "senderAddress": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/Address" }, + { "description": "Sender address for the payment." } + ] + }, + "senderAccountNumber": { + "type": "string", + "description": "A unique identifier for the sender of the payment (maximum of 17 characters). As an example, when the payment comes from a card processor, this identifier may be set to the BIN followed by the last four digits of the card used." + }, + "tags": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional. See Tags at https://www.unit.co/docs/api/#tags will be passed to the related Release Transaction." } + ] + }, + "idempotencyKey": { + "type": "string", + "description": "Optional, but strongly recommended. See Idempotency at https://www.unit.co/docs/api/#intro-idempotency." + } + }, + "required": [ + "amount", + "description", + "senderName", + "senderAddress", + "senderAccountNumber" + ], + "additionalProperties": false + }, + "relationships": { + "type": "object", + "properties": { + "batchAccount": { + "$ref": "../relationships.json#/components/schemas/BatchAccountRelationship" + }, + "receiver": { + "$ref": "../relationships.json#/components/schemas/CustomerDepositAccountRelationship" + } + }, + "required": ["batchAccount", "receiver"], + "additionalProperties": false + } + }, + "required": ["type", "attributes", "relationships"], + "additionalProperties": false + }, + "CreateBatchReleasesRequest": { + "title": "Create Batch Releases Request", + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CreateBatchRelease" + } + } + }, + "required": ["data"], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/schemas/payment/createPayment.json b/schemas/payment/createPayment.json index 5100e89..7f32521 100644 --- a/schemas/payment/createPayment.json +++ b/schemas/payment/createPayment.json @@ -32,15 +32,29 @@ "allOf": [ { "type": "object", - "required": ["account", "counterpartyAccount"], - "additionalProperties": false + "additionalProperties": false, + "description": "Relationships for a payment with a counterparty account" }, { - "$ref": "../relationships.json#/components/schemas/AccountRelationship" + "allOf": [ + { + "$ref": "../relationships.json#/components/schemas/AccountRelationship" + }, + { + "description": "The Deposit Account originating the payment." + } + ] }, { - "$ref": "../relationships.json#/components/schemas/CounterpartyAccountRelationship" + "allOf": [ + { + "$ref": "../relationships.json#/components/schemas/CounterpartyAccountRelationship" + }, + { + "description": "The Counterparty account the payment to be made to." + } + ] } ] }, @@ -75,7 +89,8 @@ "CreateBookPaymentRelationships": { "allOf": [ { - "title": "Create Book Payment Relationships" + "title": "Create Book Payment Relationships", + "description": "The relationships required for creating a book payment. Book payments require both account and counterpartyAccount." }, { "$ref": "#/components/schemas/CreatePaymentRelationshipsWithCounterpartyAccount" @@ -142,7 +157,8 @@ }, "secCode": { "type": "string", - "enum": ["WEB", "CCD", "PPD"] + "enum": ["WEB", "CCD", "PPD"], + "description": "A Standard Entry Class (SEC) code used in all ACH payments to identify certain types of ACH payments. See https://www.unit.co/docs/api/ach-origination/#use-a-custom-standard-entry-class-sec-code for supported SEC codes." } }, "required": [ @@ -201,7 +217,8 @@ }, "secCode": { "type": "string", - "enum": ["WEB", "CCD", "PPD"] + "enum": ["WEB", "CCD", "PPD"], + "description": "A Standard Entry Class (SEC) code used in all ACH payments to identify certain types of ACH payments. See https://www.unit.co/docs/api/ach-origination/#use-a-custom-standard-entry-class-sec-code for supported SEC codes." } }, "required": ["amount", "description", "direction"], @@ -262,7 +279,8 @@ }, "secCode": { "type": "string", - "enum": ["WEB", "CCD", "PPD"] + "enum": ["WEB", "CCD", "PPD"], + "description": "A Standard Entry Class (SEC) code used in all ACH payments to identify certain types of ACH payments. See https://www.unit.co/docs/api/ach-origination/#use-a-custom-standard-entry-class-sec-code for supported SEC codes." } }, "required": [ @@ -294,19 +312,26 @@ "properties": { "amount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "The amount (in cents)." }, "description": { - "type": "string" + "type": "string", + "maxLength": 80, + "description": "Payment description (maximum of 80 characters), this will show up on statement of the counterparty." }, "idempotencyKey": { - "$ref": "../types.json#/components/schemas/IdempotencyKey" + "$ref": "../types.json#/components/schemas/IdempotencyKey", + "description": "Optional. See https://www.unit.co/docs/api/#intro-idempotency." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "$ref": "../types.json#/components/schemas/Tags", + "description": "Optional. See https://www.unit.co/docs/api/#tags. Tags that will be copied to any transaction that this payment creates (see https://www.unit.co/docs/api/#tag-inheritance)." }, "transactionSummaryOverride": { - "type": "string" + "type": "string", + "maxLength": 100, + "description": "Optional. If this field is populated, its contents will be returned as the bookTransaction's summary field (maximum of 100 characters)." } }, "required": ["amount", "description"], @@ -333,30 +358,45 @@ "properties": { "amount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "The amount (in cents)." }, "direction": { "type": "string", - "enum": ["Credit"] + "enum": ["Credit"], + "description": "The direction of wire payment is always 'Credit', moving funds from the Unit 'account' to the 'counterparty' account." }, "description": { - "type": "string" + "type": "string", + "description": "Payment description (maximum of 50 characters), this will show up on statement of the counterparty." }, "counterparty": { - "$ref": "./payment.json#/components/schemas/WirePaymentCounterparty" + "allOf": [ + { "$ref": "./payment.json#/components/schemas/WirePaymentCounterparty" }, + { "description": "The party on the other side of the Wire payment." } + ] }, "idempotencyKey": { - "$ref": "../types.json#/components/schemas/IdempotencyKey" + "allOf": [ + { "$ref": "../types.json#/components/schemas/IdempotencyKey" }, + { "description": "Optional. See Idempotency." } + ] }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional. See Tags. Tags that will be copied to any transaction that this payment creates (see Tag Inheritance)." } + ] } }, "required": ["amount", "description", "counterparty"], "additionalProperties": false }, "relationships": { - "$ref": "#/components/schemas/CreateWirePaymentRelationships" + "allOf": [ + { "$ref": "#/components/schemas/CreateWirePaymentRelationships" }, + { "description": "The relationships required for creating a wire payment." } + ] } }, "additionalProperties": false, diff --git a/schemas/payment/createStopPayment.json b/schemas/payment/createStopPayment.json index a16f728..e48533f 100644 --- a/schemas/payment/createStopPayment.json +++ b/schemas/payment/createStopPayment.json @@ -8,7 +8,10 @@ "required": ["account"] }, { - "$ref": "../relationships.json#/components/schemas/AccountRelationship" + "allOf": [ + { "$ref": "../relationships.json#/components/schemas/AccountRelationship" }, + { "description": "The account that payments will be stopped for." } + ] } ] }, @@ -19,7 +22,10 @@ "required": ["account"] }, { - "$ref": "../relationships.json#/components/schemas/AccountRelationship" + "allOf": [ + { "$ref": "../relationships.json#/components/schemas/AccountRelationship" }, + { "description": "The account that payments will be stopped for." } + ] } ] }, @@ -38,17 +44,25 @@ "amount": { "type": "integer", "minimum": 1, - "format": "int64" + "format": "int64", + "description": "Optional. The amount (in cents) to look on payments to stop." }, "checkNumber": { "type": "string", - "maxLength": 12 + "maxLength": 12, + "description": "The check number to look on a check payment to stop." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional. See Tags." } + ] }, "idempotencyKey": { - "$ref": "../types.json#/components/schemas/IdempotencyKey" + "allOf": [ + { "$ref": "../types.json#/components/schemas/IdempotencyKey" }, + { "description": "Optional, but strongly recommended. See Idempotency." } + ] } }, "required": ["checkNumber"], @@ -75,34 +89,46 @@ "properties": { "minAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "Optional. The amount (in cents) above which a payment will be stopped. At least one originatorName or minAmount must be provided." }, "originatorName": { "type": "array", "items": { "type": "string" - } + }, + "description": "Optional. The name of the originator of the payment to look for in payments to stop. At least one originatorName or minAmount must be provided." }, "direction": { "type": "string", - "default": "debit" + "default": "debit", + "description": "Debit only." }, "expiration": { "type": "string", - "format": "date" + "format": "date", + "description": "Optional. Date only (e.g. \"2001-08-15\")." }, "isMultiUse": { - "type": "boolean" + "type": "boolean", + "description": "Optional. Available only for ACH Stop Payments. False by default." }, "description": { "type": "string", - "maxLength": 255 + "maxLength": 255, + "description": "Up to 255 characters" }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional. See Tags." } + ] }, "idempotencyKey": { - "$ref": "../types.json#/components/schemas/IdempotencyKey" + "allOf": [ + { "$ref": "../types.json#/components/schemas/IdempotencyKey" }, + { "description": "Optional, but strongly recommended. See Idempotency." } + ] } }, "required": ["direction", "description"] diff --git a/schemas/payment/payment.json b/schemas/payment/payment.json index 3be1ba9..2955e0b 100644 --- a/schemas/payment/payment.json +++ b/schemas/payment/payment.json @@ -7,20 +7,24 @@ "properties": { "routingNumber": { "type": "string", - "pattern": "^\\d{9}$" + "pattern": "^\\d{9}$", + "description": "The routing number of the counterparty's financial institution." }, "accountNumber": { "type": "string", - "pattern": "^\\d{1,17}$" + "pattern": "^\\d{1,17}$", + "description": "The account number of the counterparty." }, "accountType": { "type": "string", - "enum": ["Checking", "Savings", "Loan"] + "enum": ["Checking", "Savings", "Loan"], + "description": "The type of account for the counterparty." }, "name": { "type": "string", "minLength": 1, - "maxLength": 50 + "maxLength": 50, + "description": "The name of the counterparty." } }, "additionalProperties": false, @@ -37,19 +41,25 @@ "properties": { "routingNumber": { "type": "string", - "pattern": "^\\d{9}$" + "pattern": "^\\d{9}$", + "description": "Valid 9-digit ABA routing transit number." }, "accountNumber": { "type": "string", - "maxLength": 17 + "maxLength": 17, + "description": "Bank account number." }, "name": { "type": "string", "minLength": 1, - "maxLength": 50 + "maxLength": 50, + "description": "The account holder's name (whether an individual or a business, maximum of 50 characters)." }, "address": { - "$ref": "../types.json#/components/schemas/Address" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Address" }, + { "description": "The address of the counterparty." } + ] } }, "additionalProperties": false, @@ -238,20 +248,24 @@ }, "direction": { "type": "string", - "enum": ["Credit", "Debit"] + "enum": ["Credit", "Debit"], + "description": "The direction in which the funds flow. In the context of ACH payment origination, 'Debit': the payment 'pulls' funds from the counterparty account. 'Credit': the payment 'pushes' funds to the counterparty account." }, "description": { "type": "string", "minLength": 1, - "maxLength": 50 + "maxLength": 50, + "description": "Payment description (maximum of 10 characters), also known as Company Entry Description, this will show up on statement of the counterparty." }, "addenda": { "type": "string", "minLength": 1, - "maxLength": 80 + "maxLength": 80, + "description": "Optional, additional payment description (maximum of 80 characters), not all institutions present that." }, "counterparty": { - "$ref": "#/components/schemas/PaymentCounterparty" + "$ref": "#/components/schemas/PaymentCounterparty", + "description": "The party on the other side of the ACH payment." }, "tags": { "$ref": "../types.json#/components/schemas/Tags" @@ -264,8 +278,10 @@ "Clearing", "Sent", "Canceled", + "PendingReview", "Returned" - ] + ], + "description": "Payment status. Possible values include: 'Rejected': Based on validity and risk checks, Unit has decided to reject the payment and not process it. 'Pending': Waiting to be processed or transmitted to the payment network. 'Canceled': The payment was canceled by the client / end-customer before being sent to the network. 'PendingReview': The payment is waiting to be manually reviewed, typically due to a high level of risk associated with that payment. 'Clearing': In certain types of payments, once the funds are received by Unit, we hold on to them for a period, on your behalf, before releasing them to the end customer. 'Sent': The payment has been fully processed. 'Returned': The payment was processed but the network or the receiving bank returned the payment." }, "settlementDate": { "type": "string", @@ -279,19 +295,22 @@ "format": "date" }, "secCode": { - "type": "string" + "type": "string", + "description": "Standard Entry Class (SEC) code used in all ACH payments to identify certain types of ACH payments." }, "traceNumber": { "type": "string" }, "sameDay": { - "type": "boolean" + "type": "boolean", + "description": "Same-day ACH enables your clients to send and receive funds using ACH the same day the payment is created." }, "counterpartyVerificationMethod": { "type": "string" }, "clearingDaysOverride": { - "type": "integer" + "type": "integer", + "description": "The amount of days it will take an Originated ACH debit to clear and funds to become available in a deposit account." } }, "required": [ @@ -324,6 +343,7 @@ "$ref": "./payment.json#/components/schemas/Payment" }, { + "description": "Book payments are free and instant fund transfers between two accounts under your organization. Book payments from wallets to deposit accounts are available, but book payments from deposit accounts to wallet accounts are not permitted at this time.", "type": "object", "properties": { "attributes": { @@ -336,16 +356,19 @@ "amount": { "type": "integer", "minimum": 1, - "format": "int64" + "format": "int64", + "description": "The amount (in cents)." }, "direction": { "type": "string", - "enum": ["Credit", "Debit"] + "enum": ["Credit"], + "description": "The direction of book payment is always 'Credit', moving funds from 'account' to 'counterpartyAccount'." }, "description": { "type": "string", "minLength": 1, - "maxLength": 80 + "maxLength": 80, + "description": "Payment description (maximum of 80 characters), this will show up on statement of the counterparty." }, "status": { "type": "string", @@ -355,17 +378,23 @@ "Clearing", "Sent", "Canceled", + "PendingReview", "Returned" - ] + ], + "description": "Payment status. Possible values include: 'Rejected': Based on validity and risk checks, Unit has decided to reject the payment and not process it. 'Pending': Waiting to be processed or transmitted to the payment network. 'Canceled': The payment was canceled by the client / end-customer before being sent to the network. 'PendingReview': The payment is waiting to be manually reviewed, typically due to a high level of risk associated with that payment. 'Clearing': In certain types of payments, once the funds are received by Unit, we hold on to them for a period, on your behalf, before releasing them to the end customer. 'Sent': The payment has been fully processed. 'Returned': The payment was processed but the network or the receiving bank returned the payment." }, "transactionSummaryOverride": { - "type": "string" + "type": "string", + "maxLength": 100, + "description": "Optional. If this field is populated, its contents will be returned as the bookTransaction's summary field (maximum of 100 characters)." }, "reason": { - "type": "string" + "type": "string", + "description": "In case of rejection, this field will contain the reason why the payment was rejected. Possible rejection reasons: 'InsufficientFunds': The available balance isn't enough to cover the value of the payment. 'AccountClosed': The counterparty account has been closed. 'AccountFrozen': The counterparty account is frozen." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "$ref": "../types.json#/components/schemas/Tags", + "description": "Optional. See https://www.unit.co/docs/api/#tags." } }, "required": [ @@ -411,19 +440,25 @@ "amount": { "type": "integer", "minimum": 1, - "format": "int64" + "format": "int64", + "description": "The amount (in cents)." }, "direction": { "type": "string", - "enum": ["Credit"] + "enum": ["Credit"], + "description": "The direction of wire payment is always 'Credit', moving funds from the Unit 'account' to the 'counterparty' account." }, "description": { "type": "string", "minLength": 1, - "maxLength": 50 + "maxLength": 50, + "description": "Payment description (maximum of 50 characters), this will show up on statement of the counterparty." }, "counterparty": { - "$ref": "./payment.json#/components/schemas/WirePaymentCounterparty" + "allOf": [ + { "$ref": "./payment.json#/components/schemas/WirePaymentCounterparty" }, + { "description": "The party on the other side of the Wire payment." } + ] }, "status": { "type": "string", @@ -433,15 +468,18 @@ "Clearing", "Sent", "Canceled", + "PendingReview", "Returned" - ] + ], + "description": "Payment status. Possible values include: 'Rejected': Based on validity and risk checks, Unit has decided to reject the payment and not process it. 'Pending': Waiting to be processed or transmitted to the payment network. 'Canceled': The payment was canceled by the client / end-customer before being sent to the network. 'PendingReview': The payment is waiting to be manually reviewed, typically due to a high level of risk associated with that payment. 'Clearing': In certain types of payments, once the funds are received by Unit, we hold on to them for a period, on your behalf, before releasing them to the end customer. 'Sent': The payment has been fully processed. 'Returned': The payment was processed but the network or the receiving bank returned the payment." }, "settlementDate": { "type": "string", "format": "date" }, "reason": { - "type": "string" + "type": "string", + "description": "In case of rejection, this field will contain the reason why the payment was rejected. Possible rejection reasons: 'AccountFrozen': The counterparty account is frozen. 'SuspectedFraud': The payment is suspected to be fraudulent. 'InsufficientFunds': The available balance isn't enough to cover the value of the wire. 'Invalid Routing Number': The counterparty routing number is not valid. 'Wire Rejected': The counterparty rejected the wire payment. 'AccountClosed': The counterparty account has been closed. 'ClientRequest': The client has requested the wire payment to be rejected." }, "imadOmad": { "type": "object", @@ -453,6 +491,12 @@ "type": "string" } } + }, + "tags": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional. See Tags. Tags that will be copied to any transaction that this payment creates (see Tag Inheritance)." } + ] } }, "required": [ @@ -548,6 +592,7 @@ }, "Payment": { "title": "Payment Resource", + "description": "Payments in Unit represent requests to move funds that are initiated by the end customer. Payments are not final, and do not necessarily materialize into an actual movement of funds - they have a lifecycle that depends on the payment type. Book payments are free and instant fund transfers between two accounts under your organization, typically used for moving funds between two accounts that belong to the same or different end-customers, moving funds from clearing accounts to end-customer accounts, or moving funds from your organization's operational account to an end-customer account.", "type": "object", "properties": { "type": { diff --git a/schemas/payment/paymentsPaths.json b/schemas/payment/paymentsPaths.json index 3b34721..187e5b8 100644 --- a/schemas/payment/paymentsPaths.json +++ b/schemas/payment/paymentsPaths.json @@ -36,16 +36,42 @@ "$ref": "./recurringPayment.json#/components/schemas/RecurringPayment" } } + }, + "UnitBulkPaymentsResponse": { + "type": "object", + "title": "Unit Bulk Payments Response", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "bulkPayments" + ] + }, + "attributes": { + "type": "object", + "properties": { + "bulkId": { + "type": "string" + } + } + } + } + } + } } } }, "getAndCreatePayments": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getPaymentsList", - - "summary": "Get List Payments", - "description": "Get List Payments from API ", + "summary": "List Payments", + "description": "List payments resources. Filtering, paging and sorting can be applied.", "parameters": [ { "$ref": "../types.json#/components/schemas/PageQuery" @@ -59,13 +85,16 @@ "type": "object", "properties": { "accountId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified account id." }, "customerId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified customer id." }, "counterpartyAccountId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the Payments by the account id of the specified counterparty." }, "status": { "type": "array", @@ -75,12 +104,13 @@ "Rejected", "Pending", "Canceled", - "Pending Review", + "PendingReview", "Clearing", "Sent", "Returned" ] - } + }, + "description": "Optional. Filter Payments by ACH Status. Usage example: filter[status][0]=Pending&filter[status][1]=PendingReview" }, "type": { "type": "array", @@ -91,44 +121,61 @@ "BookPayment", "WirePayment" ] - } + }, + "description": "Optional. Filter Payments by Payment type. such as (AchPayment, BookPayment or WirePayment). Usage example: filter[type][0]=AchPayment&filter[type][1]=WirePayment" }, "direction": { "type": "array", "items": { "type": "string", - "enum": ["Debit", "Credit"] - } + "enum": [ + "Debit", + "Credit" + ] + }, + "description": "Optional. Filter Payments by direction (Debit, Credit). Usage example: filter[direction][0]=Debit" }, "since": { - "type": "string" + "type": "string", + "format": "date-time", + "description": "Optional. Filters the Payments that occurred after the specified date. e.g. 2020-01-13T16:01:19.346Z" }, "until": { - "type": "string" + "type": "string", + "format": "date-time", + "description": "Optional. Filters the Payments that occurred before the specified date. e.g. 2020-01-02T20:06:23.486Z" }, "fromAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "Optional. Filters the Payments that have an amount that is higher or equal to the specified amount (in cents). e.g. 5000" }, "toAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "Optional. Filters the Payments that have an amount that is lower or equal to the specified amount (in cents). e.g. 7000" }, "recurringPaymentId": { - "type": "integer" + "type": "string", + "description": "Optional. Filters the results by the specified recurring payment id." }, "feature": { "type": "array", "items": { "type": "string", - "enum": ["SameDay", "RecurringPayment"] - } + "enum": [ + "SameDay", + "RecurringPayment" + ] + }, + "description": "Optional. Filter Payments by Payment feature (SameDay, RecurringPayment). Usage example: filter[feature][0]=SameDay" }, "tags": { "type": "object", "additionalProperties": { "type": "string" - } + }, + "description": "Optional. Filter Payments by Tags." } } } @@ -138,14 +185,16 @@ "in": "query", "schema": { "type": "string" - } + }, + "description": "Optional. A comma-separated list of related resources to include in the response. Related resources include: customer, account, transaction. See Getting Related Resources at https://www.unit.co/docs/api/about-jsonapi/#intro-getting-related-resources" }, { "name": "sort", "in": "query", "schema": { "type": "string" - } + }, + "description": "Optional. Leave empty or provide sort=createdAt for ascending order. Provide sort=-createdAt (leading minus sign) for descending order." } ], "responses": { @@ -173,13 +222,17 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "createPayment", - "summary": "Create a Payment", "description": "Create a Payment via API ", "requestBody": { @@ -203,15 +256,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "getAndUpdatePayment": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getPayment", - "parameters": [ { "schema": { @@ -223,15 +280,16 @@ "description": "ID of the payment to get" }, { - "name": "included", + "name": "include", "in": "query", "schema": { "type": "string" - } + }, + "description": "Optional. A comma-separated list of related resources to include in the response. Related resources include: customer, account, transaction. See Getting Related Resources at https://www.unit.co/docs/api/about-jsonapi/#intro-getting-related-resources" } ], "summary": "Get Payment by Id", - "description": "Get a Payment from API ", + "description": "Get a payment by id.", "responses": { "200": { "description": "Successful Response", @@ -251,13 +309,17 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "patch": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "updatePayment", - "summary": "Update Payment", "description": "Update an Payment via API ", "parameters": [ @@ -292,15 +354,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "cancelPayment": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "cancelPayment", - "parameters": [ { "schema": { @@ -313,7 +379,7 @@ } ], "summary": "Cancel a Payment by Id", - "description": "Cancel a Payment via API ", + "description": "Allows cancellation of a Wire payment that has been posted but not yet sent to the Federal Reserve for processing and settlement. Only payments with a status of 'Pending' or 'PendingReview' are eligible for cancellation. Upon successful cancellation, a PaymentCanceledTransaction is created, crediting the end-customer for the funds initially debited during the wire's creation.", "requestBody": { "description": "Pass empty object in order for content-type to be aquired correctly", "required": true, @@ -336,15 +402,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "listReceivedPayments": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getReceivedPaymentsList", - "parameters": [ { "$ref": "../types.json#/components/schemas/PageQuery" @@ -358,10 +428,12 @@ "type": "object", "properties": { "accountId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified account id." }, "customerId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified customer id." }, "status": { "type": "array", @@ -375,33 +447,43 @@ "Returned", "Completed" ] - } + }, + "description": "Optional. Filter Received Payments by ReceivedPayment Status. Usage example: filter[status][0]=Pending&filter[status][1]=Advanced. Cannot be stated with includeCompleted." }, "since": { - "type": "string" + "type": "string", + "format": "date", + "description": "Optional. Filters before the specified date. e.g. 2021-06-01" }, "until": { - "type": "string" + "type": "string", + "format": "date", + "description": "Optional. Filters after the specified date. e.g. 2021-07-01" }, "fromAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "Optional. Filters the Received Payment that have an amount that is higher or equal to the specified amount (in cents). e.g. 5000" }, "toAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "Optional. Filters the Received Payment that have an amount that is lower or equal to the specified amount (in cents). e.g. 7000" }, "includeCompleted": { - "type": "boolean" + "type": "boolean", + "description": "Optional. Filter to include ReceivedPayment with Status 'Completed', default False. Cannot be stated with filter[status][]" }, "canBeReprocessed": { - "type": "boolean" + "type": "boolean", + "description": "Optional. If set to true, returns only Received Payments that can be reprocessed. If set to false only returns Received Payments that can't be reprocessed." }, "tags": { "type": "object", "additionalProperties": { "type": "string" - } + }, + "description": "Optional. Filter received payments by Tags." } } } @@ -411,18 +493,20 @@ "in": "query", "schema": { "type": "string" - } + }, + "description": "Optional. A comma-separated list of related resources to include in the response. Related resources include: customer, account. See https://www.unit.co/docs/api/about-jsonapi/#intro-getting-related-resources" }, { "name": "sort", "in": "query", "schema": { "type": "string" - } + }, + "description": "Optional. Leave empty or provide sort=createdAt for ascending order. Provide sort=-createdAt (leading minus sign) for descending order." } ], - "summary": "Get Received Payments List", - "description": "Get Received Payments from API ", + "summary": "List Received Payments", + "description": "List received payments. Filtering, paging and sorting can be applied.", "responses": { "200": { "description": "Successful Response", @@ -448,15 +532,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "receivedPayments": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getReceivedPayment", - "parameters": [ { "schema": { @@ -468,15 +556,16 @@ "description": "ID of the payment to get" }, { - "name": "included", + "name": "include", "in": "query", "schema": { "type": "string" - } + }, + "description": "Optional. A comma-separated list of related resources to include in the response. Related resources include: customer, account. See https://www.unit.co/docs/api/about-jsonapi/#intro-getting-related-resources" } ], "summary": "Get Received Payment by Id", - "description": "Get a Received Payment from API ", + "description": "Get a received payment by id.", "responses": { "200": { "description": "Successful Response", @@ -496,14 +585,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "patch": { - "tags": ["unit"], - + "tags": [ + "unit" + ], + "operationId": "updateReceivedPayment", "summary": "Update Received Payment", - "description": "Update a Received Payment via API ", + "description": "Update a Received Payment.", "parameters": [ { "schema": { @@ -536,15 +630,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "advanceReceivedPayment": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "advanceReceivedPayment", - "parameters": [ { "schema": { @@ -556,8 +654,8 @@ "description": "ID of the payment to advance" } ], - "summary": "Advance Received Payment by Id", - "description": "Advance a Received Payment via API ", + "summary": "Advance Received Payment", + "description": "Advance a Received Payment. In order to use this API, you must implement the Advance Received Payment capability. Only received payments that are in status `Pending` can be advanced.", "responses": { "200": { "description": "Successful Response", @@ -568,15 +666,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "reprocessReceivedPayment": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "reprocessReceivedPayment", - "parameters": [ { "schema": { @@ -585,11 +687,11 @@ "name": "paymentId", "in": "path", "required": true, - "description": "ID of the payment to advance" + "description": "ID of the payment to reprocess" } ], - "summary": "Reprocess Received Payment by Id", - "description": "Reprocess a Received Payment via API ", + "summary": "Reprocess Received Payment", + "description": "Reprocess a Received ACH Debit Payment in case it was `MarkedForReturn` due to `InsufficientFunds`. The reprocess functionality is disabled by default. If you would like to enable it, please contact Unit. Only received payments that are in status `MarkedForReturn` can be reprocessed.", "responses": { "200": { "description": "Successful Response", @@ -600,49 +702,68 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "returnReceivedAchTransaction": { "post": { - "tags": ["unit"], - "operationId": "reprocessReceivedPayment", - + "tags": [ + "unit" + ], + "operationId": "returnReceivedAchTransaction", + "summary": "Return Received ACH Transaction", "parameters": [ { "schema": { "type": "string" }, - "name": "paymentId", + "name": "transactionId", "in": "path", "required": true, - "description": "ID of the payment to advance" + "description": "ID of the transaction to return" } ], - "summary": "Reprocess Received Payment by Id", - "description": "Reprocess a Received Payment via API ", + "requestBody": { + "description": "Pass empty object in order for content-type to be aquired correctly", + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "./returnReceivedAchTransaction.json#/components/schemas/ReturnReceivedAchTransactionRequest" + } + } + } + }, + "description": "Return Received ACH Transaction via API ", "responses": { "200": { "description": "Successful Response", "content": { "application/vnd.api+json; charset=utf-8": { "schema": { - "$ref": "#/components/schemas/UnitReceivedPaymentResponse" + "$ref": "#/components/schemas/UnitReturnedReceivedAchTransactionResponse" } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "recurringPayments": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getRecurringPaymentsList", - - "summary": "Get Recurring Payments List", - "description": "Get Recurring Payments List from API ", + "summary": "List Recurring Payments", + "description": "List recurring payments resources. Filtering, paging and sorting can be applied.", "parameters": [ { "$ref": "../types.json#/components/schemas/PageQuery" @@ -656,16 +777,24 @@ "type": "object", "properties": { "accountId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified account id." }, "customerId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified customer id." }, "status": { "type": "array", "items": { - "type": "string" - } + "type": "string", + "enum": [ + "Active", + "Completed", + "Disabled" + ] + }, + "description": "Optional. Filter recurring payments by status (Active, Completed or Disabled). Usage example: filter[status][0]=Active" }, "type": { "type": "array", @@ -676,19 +805,28 @@ "recurringDebitAchPayment", "recurringCreditBookPayment" ] - } + }, + "description": "Optional. Filter recurring payments by Recurring Payment type. such as (RecurringCreditAchPayment, RecurringCreditBookPayment). Usage example: filter[type][0]=RecurringCreditAchPayment&filter[type][1]=RecurringCreditBookPayment" }, "fromStartTime": { - "type": "string" + "type": "string", + "format": "date", + "description": "Optional. Filters the Recurring Payments that their start time occurred after the specified date. e.g. 2022-06-13" }, "toStartTime": { - "type": "string" + "type": "string", + "format": "date", + "description": "Optional. Filters the Recurring Payments that their start time occurred before the specified date. e.g. 2022-05-13" }, "fromEndTime": { - "type": "string" + "type": "string", + "format": "date", + "description": "Optional. Filters the Recurring Payments that their end time occurred after the specified date. e.g. 2022-06-13" }, "toEndTime": { - "type": "string" + "type": "string", + "format": "date", + "description": "Optional. Filters the Recurring Payments that their end time occurred before the specified date. e.g. 2022-05-13" } } } @@ -698,7 +836,8 @@ "in": "query", "schema": { "type": "string" - } + }, + "description": "Optional. Leave empty or provide sort=createdAt for ascending order. Provide sort=-createdAt (leading minus sign) for descending order." } ], "responses": { @@ -723,13 +862,17 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "createRecurringPayment", - "summary": "Create Recurring Payment", "description": "Create a Recurring Payment via API ", "requestBody": { @@ -753,16 +896,20 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "getRecurringPayment": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getRecurringPayment", - - "summary": "Get Recurring Payment", + "summary": "Get by Id", "parameters": [ { "schema": { @@ -774,7 +921,7 @@ "description": "ID of the payment to get" } ], - "description": "Get Recurring Payment from API ", + "description": "Get a recurring payment by id.", "responses": { "200": { "description": "Successful Response", @@ -785,15 +932,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "disableRecurringPayment": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "disableRecurringPayment", - "summary": "Disable Recurring Payment", "parameters": [ { @@ -818,7 +969,7 @@ } } }, - "description": "Disable Recurring Payment via API ", + "description": "The status is set to Disabled when a recurring payment is turned off. It can be reverted to Active by enabling the recurring payment.", "responses": { "200": { "description": "Successful Response", @@ -829,15 +980,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "enableRecurringPayment": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "enableRecurringPayment", - "summary": "Enable Recurring Payment", "parameters": [ { @@ -862,7 +1017,7 @@ } } }, - "description": "Enable Recurring Payment via API ", + "description": "Change a Disabled recurring payment status back to Active. Recurring payments that are in status Completed or Deleted cannot be enabled.", "responses": { "200": { "description": "Successful Response", @@ -873,25 +1028,29 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, - "returnReceivedACHTransaction": { + "deleteRecurringPayment": { "post": { - "tags": ["unit"], - "operationId": "returnReceivedACHTransaction", - - "summary": "Return Received ACH Transaction", + "tags": [ + "unit" + ], + "operationId": "deleteRecurringPayment", + "summary": "Delete Recurring Payment", "parameters": [ { "schema": { "type": "string" }, - "name": "transactionId", + "name": "paymentId", "in": "path", "required": true, - "description": "ID of the transaction to return" + "description": "ID of the payment to delete" } ], "requestBody": { @@ -900,24 +1059,112 @@ "content": { "application/vnd.api+json": { "schema": { - "$ref": "./returnReceivedACHTransaction.json#/components/schemas/ReturnReceivedACHTransactionRequest" + "type": "object", + "nullable": true } } } }, - "description": "Return Received ACH Transaction via API ", + "description": "Delete Recurring Payment via API. This action is irreversible, unlike the Disable status.", "responses": { "200": { "description": "Successful Response", "content": { "application/vnd.api+json; charset=utf-8": { "schema": { - "$ref": "#/components/schemas/UnitReturnedReceivedAchTransactionResponse" + "$ref": "#/components/schemas/UnitRecurringPaymentResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "createBulkPayments": { + "post": { + "tags": [ + "unit" + ], + "operationId": "createBulkPayments", + "summary": "Create Bulk Payment", + "description": "Bulk payments can contain multiple payment creation requests from different types (ACH, Book, Wire). It is highly recommended to attach to each payment creation request an idempotency key. This will ensure no creation duplication. Bulk is an asynchronous process. The immediate response will be the bulkId (generated by Unit). Once all payments creations in bulk are finished a bulkPayments.finished webhook event is sent by Unit. If not supplied, Unit will generate idempotency key as 'bulkId indexInBulk' combination.", + "requestBody": { + "description": "Create Bulk Payments Request", + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "./createPayments.json#/components/schemas/CreatePaymentsRequest" + } + } + } + }, + "responses": { + "201": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitBulkPaymentsResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "clearAchDebitPayment": { + "post": { + "tags": [ + "unit" + ], + "operationId": "clearAchDebitPayment", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "paymentId", + "in": "path", + "required": true, + "description": "ID of the payment to clear" + } + ], + "summary": "Clear ACH Debit Payment", + "description": "Clears an ACH debit payment while in `clearing` status. Overrides the original clearing period, making funds available immediately. Requires the Dynamic Clearing Period feature to be enabled.", + "requestBody": { + "description": "Pass empty object in order for content-type to be aquired correctly", + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "type": "object", + "nullable": true + } + } + } + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitPaymentResponse" } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/payment/receivedPayment.json b/schemas/payment/receivedPayment.json index fa1bdc6..1106560 100644 --- a/schemas/payment/receivedPayment.json +++ b/schemas/payment/receivedPayment.json @@ -28,6 +28,7 @@ }, "ReceivedPayment": { "title": "Received Payment Resource", + "description": "A Received Payment resource is created when an incoming ACH is processed. The initial status and the lifecycle of the Received Payments may vary according to different factors that may lead to one of two final statuses: `Completed` or `Returned`", "type": "object", "properties": { "type": { @@ -43,7 +44,8 @@ "properties": { "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the received payment was created" }, "status": { "type": "string", @@ -54,57 +56,70 @@ "MarkedForReturn", "Returned", "Completed" - ] + ], + "description": "The status of the received payment. Possible values: 'Pending': The received payment was created with a future completion date. Pending payments can be advanced. 'Advanced': The received-payment was advanced by the client. Once the completion date arrives, the status will change to Completed and the client will be repaid. 'PendingReview': The received payment is pending for a review by Unit. 'MarkedForReturn': The received payment was rejected and is waiting to be returned to the originating bank. It is marked for return to indicate that the transaction has been unsuccessful and needs to be processed in the opposite direction. 'Returned': The received payment was returned. 'Completed': The received payment was completed. This happens once the payment completion date arrives. If the payment was previously advanced, the client will automatically be repaid." }, "amount": { "type": "integer", "minimum": 1, - "format": "int64" + "format": "int64", + "description": "The amount of the received payment (in cents)" }, "completionDate": { - "type": "string" + "type": "string", + "format": "date", + "description": "The date when the received payment will be completed" }, "direction": { "type": "string", - "enum": ["Debit", "Credit"] + "enum": ["Debit", "Credit"], + "description": "The direction of the received payment (Debit or Credit)" }, "wasAdvanced": { - "type": "boolean" + "type": "boolean", + "description": "Indicates if the received payment was advanced" }, "isAdvanceable": { - "type": "boolean" - }, - "isAdvaceable": { - "type": "boolean" + "type": "boolean", + "description": "Indicates if the received payment can be advanced" }, "companyName": { - "type": "string" + "type": "string", + "description": "The name of the company that sent the payment" }, "counterpartyRoutingNumber": { - "type": "string" + "type": "string", + "description": "The routing number of the counterparty's financial institution" }, "description": { - "type": "string" + "type": "string", + "description": "Payment description" }, "addenda": { - "type": "string" + "type": "string", + "description": "Additional payment description" }, "traceNumber": { - "type": "string" + "type": "string", + "description": "The trace number of the received payment" }, "secCode": { "type": "string", "minLength": 3, - "maxLength": 3 + "maxLength": 3, + "description": "Standard Entry Class (SEC) code used in all ACH payments to identify certain types of ACH payments." }, "returnReason": { - "type": "string" + "type": "string", + "description": "The reason for the return, if the payment was returned" }, "receivingEntityName": { - "type": "string" + "type": "string", + "description": "The name of the entity receiving the payment" }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "$ref": "../types.json#/components/schemas/Tags", + "description": "Optional. See https://www.unit.co/docs/api/#tags." } }, "required": [ diff --git a/schemas/payment/recurringPayment.json b/schemas/payment/recurringPayment.json index a90cf23..a5a73f7 100644 --- a/schemas/payment/recurringPayment.json +++ b/schemas/payment/recurringPayment.json @@ -76,44 +76,53 @@ "properties": { "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the recurring payment was created." }, "updatedAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the recurring payment was last updated." }, "amount": { "type": "integer", "minimum": 1, - "format": "int64" + "format": "int64", + "description": "The amount (in cents)." }, "description": { "type": "string", "minLength": 1, - "maxLength": 10 + "maxLength": 10, + "description": "Payment description (maximum of 10 characters), also known as Company Entry Description, this will show up on the statement of the counterparty." }, "addenda": { "type": "string", "minLength": 1, - "maxLength": 80 + "maxLength": 80, + "description": "Optional, additional payment description (maximum of 80 characters), not all institutions present that." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "$ref": "../types.json#/components/schemas/Tags", + "description": "Optional. See Tags. Tags that will be copied to any transaction that this payment creates (see Tag Inheritance)." }, "status": { "type": "string", "enum": [ - "Pending", "Active", "Completed", - "Disabled" - ] + "Disabled", + "Deleted" + ], + "description": "The status of the recurring payment. Active: The status is set to Active when a recurring payment is created. Completed: The status changes to Completed once the recurring payment's end date has passed. Disabled: The status is set to Disabled when a recurring payment is turned off. It can be reverted to Active by enabling the recurring payment. Deleted: The status is set to Deleted when a recurring payment is removed. This action is irreversible, unlike the Disabled status." }, "schedule": { - "$ref": "../types.json#/components/schemas/ResponseSchedule" + "$ref": "../types.json#/components/schemas/ResponseSchedule", + "description": "The schedule details of the recurring payment. All times must be in the future." }, "numberOfPayments": { - "type": "integer" + "type": "integer", + "description": "The number of payments that have been executed from this recurring payment schedule." } }, "required": [ @@ -150,52 +159,63 @@ "properties": { "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the recurring payment was created." }, "updatedAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the recurring payment was last updated." }, "amount": { "type": "integer", "minimum": 1, - "format": "int64" + "format": "int64", + "description": "The amount (in cents)." }, "description": { "type": "string", "minLength": 1, - "maxLength": 10 + "maxLength": 10, + "description": "Payment description (maximum of 10 characters), also known as Company Entry Description, this will show up on the statement of the counterparty." }, "addenda": { "type": "string", "minLength": 1, - "maxLength": 80 + "maxLength": 80, + "description": "Optional, additional payment description (maximum of 80 characters), not all institutions present that." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "$ref": "../types.json#/components/schemas/Tags", + "description": "Optional. See Tags. Tags that will be copied to any transaction that this payment creates (see Tag Inheritance)." }, "status": { "type": "string", "enum": [ - "Pending", "Active", "Completed", - "Disabled" - ] + "Disabled", + "Deleted" + ], + "description": "The status of the recurring payment. Active: The status is set to Active when a recurring payment is created. Completed: The status changes to Completed once the recurring payment's end date has passed. Disabled: The status is set to Disabled when a recurring payment is turned off. It can be reverted to Active by enabling the recurring payment. Deleted: The status is set to Deleted when a recurring payment is removed. This action is irreversible, unlike the Disabled status." }, "schedule": { - "$ref": "../types.json#/components/schemas/ResponseSchedule" + "$ref": "../types.json#/components/schemas/ResponseSchedule", + "description": "The schedule details of the recurring payment. All times must be in the future." }, "numberOfPayments": { - "type": "integer" + "type": "integer", + "description": "The number of payments that have been executed from this recurring payment schedule." }, "verifyCounterpartyBalance": { "type": "boolean", - "default": false + "default": false, + "description": "The payment will not be processed and will be rejected if the counterparty does not have enough funds." }, "sameDay": { "type": "boolean", - "default": false + "default": false, + "description": "Optional field to mark this payment as a Same Day ACH payment (higher cost). The payment will be processed on the day that it is sent, rather than the next day." } }, "required": [ @@ -232,39 +252,47 @@ "properties": { "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the recurring payment was created." }, "updatedAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "The date and time when the recurring payment was last updated." }, "amount": { "type": "integer", "minimum": 1, - "format": "int64" + "format": "int64", + "description": "The amount (in cents)." }, "description": { "type": "string", "minLength": 1, - "maxLength": 80 + "maxLength": 80, + "description": "Payment description (maximum of 80 characters)." }, "status": { "type": "string", "enum": [ - "Pending", "Active", "Completed", - "Disabled" - ] + "Disabled", + "Deleted" + ], + "description": "The status of the recurring payment. Active: The status is set to Active when a recurring payment is created. Completed: The status changes to Completed once the recurring payment's end date has passed. Disabled: The status is set to Disabled when a recurring payment is turned off. It can be reverted to Active by enabling the recurring payment. Deleted: The status is set to Deleted when a recurring payment is removed. This action is irreversible, unlike the Disabled status." }, "schedule": { - "$ref": "../types.json#/components/schemas/ResponseSchedule" + "$ref": "../types.json#/components/schemas/ResponseSchedule", + "description": "The schedule details of the recurring payment. All times must be in the future." }, "numberOfPayments": { - "type": "integer" + "type": "integer", + "description": "The number of payments that have been executed from this recurring payment schedule." }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "$ref": "../types.json#/components/schemas/Tags", + "description": "Optional. See Tags. Tags that will be copied to any transaction that this payment creates (see Tag Inheritance)." } }, "required": [ @@ -290,6 +318,7 @@ "RecurringPayment": { "title": "Recurring Payment Resource", "type": "object", + "description": "Recurring Payments allows you to create and execute future payments (at the moment only Credit ACH, Debit ACH, and Credit Book Payments are supported) according to defined patterns, so different use cases like subscriptions, savings, rent payments and many more are supported. When creating a Recurring Payment, you can set a schedule and control the start time and frequency of the creation of future payments (monthly or weekly intervals are supported).", "properties": { "type": { "type": "string", diff --git a/schemas/payment/returnReceivedACHTransaction.json b/schemas/payment/returnReceivedACHTransaction.json index 5effd62..048d081 100644 --- a/schemas/payment/returnReceivedACHTransaction.json +++ b/schemas/payment/returnReceivedACHTransaction.json @@ -47,7 +47,7 @@ "IncorrectlyCodedOutboundInternationalPayment" ] }, - "ReturnReceivedACHTransactionRelationships": { + "ReturnReceivedAchTransactionRelationships": { "allOf": [ { "title": "Create Atm Deposit Simulation Relationships", @@ -58,7 +58,7 @@ } ] }, - "ReturnReceivedACHTransactionRequest": { + "ReturnReceivedAchTransactionRequest": { "type": "object", "properties": { "data": { @@ -79,7 +79,7 @@ "required": ["reason"] }, "relationships": { - "$ref": "#/components/schemas/ReturnReceivedACHTransactionRelationships" + "$ref": "#/components/schemas/ReturnReceivedAchTransactionRelationships" } }, "required": ["type", "attributes", "relationships"] diff --git a/schemas/payment/sendWireDrawdown.json b/schemas/payment/sendWireDrawdown.json new file mode 100644 index 0000000..93ef431 --- /dev/null +++ b/schemas/payment/sendWireDrawdown.json @@ -0,0 +1,45 @@ +{ + "components": { + "schemas": { + "SendWireDrawdown": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["sendWireDrawdown"] + }, + "attributes": { + "type": "object", + "properties": { + "idempotencyKey": { + "type": "string", + "description": "See Idempotency at https://www.unit.co/docs/api/#intro-idempotency." + }, + "tags": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional, See Tags at https://www.unit.co/docs/api/#tags. Tags for the Wire Payment." } + ] + } + }, + "required": ["idempotencyKey"], + "additionalProperties": false + } + }, + "required": ["type", "attributes"], + "additionalProperties": false + }, + "SendWireDrawdownRequest": { + "title": "Send Wire Drawdown", + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/SendWireDrawdown" + } + }, + "additionalProperties": false, + "required": ["data"] + } + } + } +} \ No newline at end of file diff --git a/schemas/payment/stopPayment.json b/schemas/payment/stopPayment.json index 33e9f6a..22267d8 100644 --- a/schemas/payment/stopPayment.json +++ b/schemas/payment/stopPayment.json @@ -9,7 +9,10 @@ "additionalProperties": false }, { - "$ref": "../relationships.json#/components/schemas/AccountRelationship" + "allOf": [ + { "$ref": "../relationships.json#/components/schemas/AccountRelationship" }, + { "description": "The account that payments will be stopped for." } + ] }, { "$ref": "../relationships.json#/components/schemas/CustomerRelationship" @@ -43,7 +46,10 @@ "additionalProperties": false }, { - "$ref": "../relationships.json#/components/schemas/AccountRelationship" + "allOf": [ + { "$ref": "../relationships.json#/components/schemas/AccountRelationship" }, + { "description": "The account that payments will be stopped for." } + ] }, { "$ref": "../relationships.json#/components/schemas/CustomerRelationship" @@ -55,7 +61,8 @@ }, "CheckStopPaymentStatus": { "type": "string", - "enum": ["Active", "Disabled"] + "enum": ["Active", "Disabled"], + "description": "The possible status values are: Active - The Stop Payment is active and will stop incoming check payments that fits its criteria. Disabled - The Stop Payment is disabled and it will not stop any check payments." }, "AchStopPaymentDisableReason": { "type": "string", @@ -70,24 +77,34 @@ "properties": { "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "ISO8601 timestamp when the stop payment was created" }, "updatedAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "ISO8601 timestamp when the stop payment was last updated" }, "amount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "Optional. The amount (in cents) to look on payments to stop." }, "status": { - "$ref": "#/components/schemas/CheckStopPaymentStatus" + "allOf": [ + { "$ref": "#/components/schemas/CheckStopPaymentStatus" }, + { "description": "Status of the stop payment (Active or Disabled)" } + ] }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional. See Tags." } + ] }, "checkNumber": { - "type": "string" + "type": "string", + "description": "The check number to look on a check payment to stop." } }, "required": [ @@ -113,44 +130,64 @@ "properties": { "createdAt": { "type": "string", - "format": "date" + "format": "date", + "description": "ISO8601 date when the stop payment was created" }, "updatedAt": { "type": "string", - "format": "date" + "format": "date", + "description": "ISO8601 date when the stop payment was last updated" }, "minAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "Optional. The amount (in cents) above which a payment will be stopped. At least one originatorName or minAmount must be provided." }, "originatorName": { "type": "array", "items": { "type": "string" - } + }, + "description": "Optional. The name of the originator of the payment to look for in payments to stop. At least one originatorName or minAmount must be provided." }, "direction": { "type": "string", - "default": "debit" + "default": "debit", + "description": "Debit only." }, "expiration": { "type": "string", - "format": "date" + "format": "date", + "description": "Optional. Date only (e.g. \"2001-08-15\")." }, "isMultiUse": { - "type": "boolean" + "type": "boolean", + "description": "Optional. Available only for ACH Stop Payments. False by default." }, "description": { - "type": "string" + "type": "string", + "description": "Up to 255 characters" }, "disableReason": { "$ref": "#/components/schemas/AchStopPaymentDisableReason" }, + "status": { + "allOf": [ + { "$ref": "#/components/schemas/CheckStopPaymentStatus" }, + { "description": "Status of the stop payment (Active or Disabled)" } + ] + }, "idempotencyKey": { - "$ref": "../types.json#/components/schemas/IdempotencyKey" + "allOf": [ + { "$ref": "../types.json#/components/schemas/IdempotencyKey" }, + { "description": "Optional, but strongly recommended. See Idempotency." } + ] }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional. See Tags." } + ] } }, "required": [ @@ -160,6 +197,7 @@ "expiration", "isMultiUse", "description", + "status", "tags" ], "additionalProperties": false diff --git a/schemas/payment/stopPaymentPaths.json b/schemas/payment/stopPaymentPaths.json index a889dec..65cbbd7 100644 --- a/schemas/payment/stopPaymentPaths.json +++ b/schemas/payment/stopPaymentPaths.json @@ -1,7 +1,7 @@ { "components": { "schemas": { - "StopPaymentResponse": { + "UnitStopPaymentResponse": { "type": "object", "properties": { "data": { @@ -9,7 +9,7 @@ } } }, - "StopPaymentListResponse": { + "UnitStopPaymentListResponse": { "type": "object", "properties": { "data": { @@ -17,6 +17,9 @@ "items": { "$ref": "./stopPayment.json#/components/schemas/StopPayment" } + }, + "meta": { + "$ref": "../types.json#/components/schemas/PaginationMeta" } } } @@ -25,7 +28,9 @@ "stopPayments": { "post": { "summary": "Create Stop Payment", - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "createStopPayment", "requestBody": { "required": true, @@ -38,21 +43,26 @@ } }, "responses": { - "200": { - "description": "OK", + "201": { + "description": "Created", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/StopPaymentResponse" + "$ref": "#/components/schemas/UnitStopPaymentResponse" } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "get": { "summary": "Get a list of stop payments", - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getStopPaymentsList", "parameters": [ { @@ -65,17 +75,23 @@ "type": "object", "properties": { "accountId": { - "type": "string" + "type": "string", + "description": "Filter by account ID" }, "customerId": { - "type": "string" + "type": "string", + "description": "Filter by customer ID" }, "status": { "type": "array", "items": { "type": "string", - "enum": ["Active", "Disabled"] - } + "enum": [ + "Active", + "Disabled" + ] + }, + "description": "Filter by status (Active, Disabled). Usage example: filter[status][0]=Disabled" }, "tags": { "type": "object", @@ -84,21 +100,60 @@ } }, "since": { - "type": "string" + "type": "string", + "description": "Optional. Filters before the specified date. e.g. 2021-06-01" }, "until": { - "type": "string" + "type": "string", + "description": "Optional. Filters after the specified date. e.g. 2021-07-01" }, "fromAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "Optional. Filters the Check Stop Payments that have an amount that is higher or equal to the specified amount (in cents). e.g. 5000" }, "toAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "Optional. Filters the Stop Payments that have an amount that is lower or equal to the specified amount (in cents). e.g. 7000" + }, + "noAmount": { + "type": "boolean", + "description": "Optional. If set to true, returns only Stop Payments with no amount. If set to false only returns Stop Payments with amount" + }, + "fromMinAmount": { + "type": "integer", + "format": "int64", + "description": "Optional. Filters ACH stop Payments that have minAmount higher than the specified amount (cents)." + }, + "toMinAmount": { + "type": "integer", + "format": "int64", + "description": "Optional. Filters ACH stop Payments that have minAmount lower than the specified amount (cents)." + }, + "noMinAmount": { + "type": "boolean", + "description": "Optional. If set to true, returns only ACH Stop Payments with no minAmount. If set to false only returns Stop Payments with minAmount" + }, + "originatorName": { + "type": "string", + "description": "Optional." + }, + "noOriginatorName": { + "type": "boolean", + "description": "Optional." }, "checkNumber": { - "type": "string" + "type": "string", + "description": "Optional. Filter Stop Payments by check number (trimming leading zeros)." + }, + "type": { + "type": "string", + "enum": [ + "checkStopPayment", + "achStopPayment" + ], + "description": "Optional. Either checkStopPayment or achStopPayment" } } } @@ -108,7 +163,8 @@ "in": "query", "schema": { "type": "string" - } + }, + "description": "Optional. Leave empty or provide sort=createdAt for ascending order. Provide sort=-createdAt (leading minus sign) for descending order." } ], "responses": { @@ -117,10 +173,13 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/StopPaymentListResponse" + "$ref": "#/components/schemas/UnitStopPaymentListResponse" } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } @@ -128,7 +187,9 @@ "stopPayment": { "get": { "summary": "Get details of a specific stop payment", - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getStopPayment", "parameters": [ { @@ -147,19 +208,24 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/StopPaymentResponse" + "$ref": "#/components/schemas/UnitStopPaymentResponse" } } } }, "404": { "description": "Stop payment not found" + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, - "post": { + "patch": { "summary": "Update a stop payment", - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "updateStopPayment", "parameters": [ { @@ -188,13 +254,16 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/StopPaymentResponse" + "$ref": "#/components/schemas/UnitStopPaymentResponse" } } } }, "404": { "description": "Stop payment not found" + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } @@ -202,7 +271,9 @@ "disableStopPayment": { "post": { "summary": "Disable a stop payment", - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "disableStopPayment", "parameters": [ { @@ -221,15 +292,18 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/StopPaymentResponse" + "$ref": "#/components/schemas/UnitStopPaymentResponse" } } } }, "404": { "description": "Stop payment not found" + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/payment/updatePayment.json b/schemas/payment/updatePayment.json index 9f29515..459b8be 100644 --- a/schemas/payment/updatePayment.json +++ b/schemas/payment/updatePayment.json @@ -18,7 +18,8 @@ "$ref": "../types.json#/components/schemas/Tags" }, "clearingDaysOverride": { - "type": "integer" + "type": "integer", + "description": "Only supports ACH Payments with direction Debit in status PendingReview or Pending. See https://www.unit.co/docs/api/ach-origination/#dynamic-clearing-period-ach-debit" } }, "additionalProperties": false @@ -64,7 +65,8 @@ "title": "Update Book Payment Attributes", "properties": { "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "$ref": "../types.json#/components/schemas/Tags", + "description": "See https://www.unit.co/docs/api/#updating-tags." } }, "additionalProperties": false diff --git a/schemas/payment/updateStopPayment.json b/schemas/payment/updateStopPayment.json index caa8727..1af3ae2 100644 --- a/schemas/payment/updateStopPayment.json +++ b/schemas/payment/updateStopPayment.json @@ -5,14 +5,30 @@ "title": "Update Ach Stop Payment", "type": "object", "properties": { - "tags": { - "$ref": "../types.json#/components/schemas/Tags" - }, - "expiration": { + "type": { "type": "string", - "format": "date" + "enum": ["achStopPayment"], + "default": "achStopPayment" + }, + "attributes": { + "type": "object", + "properties": { + "tags": { + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional. See Updating Tags." } + ] + }, + "expiration": { + "type": "string", + "format": "date", + "description": "Optional. Date only (e.g. \"2026-08-15\")." + } + }, + "additionalProperties": false } }, + "required": ["type", "attributes"], "additionalProperties": false }, "UpdateStopPaymentRequest": { diff --git a/schemas/payment/wireDrawdown.json b/schemas/payment/wireDrawdown.json new file mode 100644 index 0000000..21dd9f3 --- /dev/null +++ b/schemas/payment/wireDrawdown.json @@ -0,0 +1,149 @@ +{ + "components": { + "schemas": { + "WireDrawdown": { + "type": "object", + "title": "Wire Drawdown Resource", + "description": "Wire drawdowns, also known as reverse wires, are a type of wire payment where funds are pulled from an account to a counterparty's account.\n\nThis is the opposite of a standard wire payment, where funds are pushed from one account to the counterparty's account.\n\nCurrently, we only support receiving wire drawdown requests (incoming drawdown), not originating them. This means that you can receive a drawdown request from another party's account, and choose to approve it and send the funds, but you cannot initiate a request to pull funds from another party's account.\n\nAvailability varies by bank partner.", + "properties": { + "type": { + "type": "string", + "enum": ["wireDrawdown"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "attributes": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "format": "date-time", + "description": "The date and time when the wire drawdown was created." + }, + "amount": { + "type": "integer", + "format": "int64", + "description": "The amount of the wire drawdown in cents." + }, + "direction": { + "type": "string", + "enum": ["Incoming"], + "description": "The direction of the wire drawdown." + }, + "counterparty": { + "type": "object", + "description": "Information about the counterparty.", + "properties": { + "name": { + "type": "string", + "description": "The name of the counterparty." + }, + "routingNumber": { + "type": "string", + "description": "The routing number of the counterparty's bank." + }, + "accountNumber": { + "type": "string", + "description": "The account number of the counterparty." + } + }, + "required": ["name", "routingNumber", "accountNumber"], + "additionalProperties": false + }, + "imad": { + "type": "string", + "description": "Input Message Accountability Data (IMAD) - a unique identifier for the incoming wire drawdown message." + }, + "omad": { + "type": "string", + "description": "Output Message Accountability Data (OMAD) - a unique identifier for the outgoing wire drawdown message." + }, + "description": { + "type": "string", + "description": "Description for the wire drawdown." + }, + "senderReference": { + "type": "string", + "description": "Reference information from the sender." + } + }, + "required": ["createdAt", "amount", "direction", "counterparty"], + "additionalProperties": false + }, + "relationships": { + "type": "object", + "properties": { + "account": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["account"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + }, + "customer": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["customer"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + }, + "drawdownPayment": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["payment"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, + "required": ["type", "id", "attributes", "relationships"], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/schemas/payment/wireDrawdownPaths.json b/schemas/payment/wireDrawdownPaths.json new file mode 100644 index 0000000..3b86fb9 --- /dev/null +++ b/schemas/payment/wireDrawdownPaths.json @@ -0,0 +1,187 @@ +{ + "components": { + "schemas": { + "UnitWireDrawdownResponse": { + "type": "object", + "title": "Unit Wire Drawdown Response", + "properties": { + "data": { + "$ref": "./wireDrawdown.json#/components/schemas/WireDrawdown" + } + } + } + } + }, + "getWireDrawdown": { + "get": { + "tags": [ + "unit" + ], + "operationId": "getWireDrawdown", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "wireDrawdownId", + "in": "path", + "required": true, + "description": "ID of the wire drawdown to get" + }, + { + "name": "include", + "in": "query", + "schema": { + "type": "string" + }, + "description": "Optional. A comma-separated list of related resources to include in the response. Related resources include: customer, account. See Getting Related Resources at https://www.unit.co/docs/api/about-jsonapi/#intro-getting-related-resources" + } + ], + "summary": "Get Wire Drawdown by Id", + "description": "Get a wire drawdown by id.", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "title": "Unit Wire Drawdown Response With Included", + "type": "object", + "properties": { + "data": { + "$ref": "./wireDrawdown.json#/components/schemas/WireDrawdown" + }, + "included": { + "$ref": "../types.json#/components/schemas/IncludedResource" + } + } + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "listWireDrawdowns": { + "get": { + "tags": [ + "unit" + ], + "operationId": "listWireDrawdowns", + "parameters": [ + { + "$ref": "../types.json#/components/schemas/PageQuery" + }, + { + "name": "filter", + "in": "query", + "style": "deepObject", + "allowReserved": true, + "schema": { + "type": "object", + "properties": { + "accountId": { + "type": "string", + "description": "Optional. Filters the results by the specified account id." + }, + "customerId": { + "type": "string", + "description": "Optional. Filters the results by the specified customer id." + } + } + } + }, + { + "name": "include", + "in": "query", + "schema": { + "type": "string" + }, + "description": "Optional. A comma-separated list of related resources to include in the response. Related resources include: customer, account. See Getting Related Resources at https://www.unit.co/docs/api/about-jsonapi/#intro-getting-related-resources" + } + ], + "summary": "List Wire Drawdowns", + "description": "List wire drawdowns resources. Filtering and paging can be applied.", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "title": "Unit Wire Drawdowns List Response", + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "./wireDrawdown.json#/components/schemas/WireDrawdown" + } + }, + "included": { + "$ref": "../types.json#/components/schemas/IncludedResource" + }, + "meta": { + "$ref": "../types.json#/components/schemas/PaginationMeta" + } + } + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "sendWireDrawdown": { + "post": { + "tags": [ + "unit" + ], + "operationId": "sendWireDrawdown", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "wireDrawdownId", + "in": "path", + "required": true, + "description": "ID of the wire drawdown to send" + } + ], + "requestBody": { + "description": "Send Wire Drawdown Request", + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "./sendWireDrawdown.json#/components/schemas/SendWireDrawdownRequest" + } + } + } + }, + "summary": "Send Drawdown Payment", + "description": "Send a wire payment in response to a drawdown request. The API will create a Wire Payment as a response to the drawdown request. You can observe the drawdownPayment relationship to retrieve the Payment Identifier.", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitWireDrawdownResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + } +} \ No newline at end of file diff --git a/schemas/receivables/receivable.json b/schemas/receivables/receivable.json new file mode 100644 index 0000000..40bfab5 --- /dev/null +++ b/schemas/receivables/receivable.json @@ -0,0 +1,259 @@ +{ + "components": { + "schemas": { + "BankReceivable": { + "type": "object", + "title": "Bank Receivable", + "properties": { + "type": { + "type": "string", + "enum": ["bankReceivable"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "attributes": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "format": "date-time", + "description": "ISO8601 date time." + }, + "updatedAt": { + "type": "string", + "format": "date-time", + "description": "ISO8601 date time." + }, + "version": { + "type": "integer", + "description": "The version of the receivable." + }, + "originalAmount": { + "type": "integer", + "format": "int64", + "description": "The original amount of the receivable (in cents)." + }, + "remainingAmount": { + "type": "integer", + "format": "int64", + "description": "The remaining amount of the receivable (in cents)." + }, + "purchaseDueDate": { + "type": "string", + "format": "date", + "description": "The due date for purchasing the receivable." + }, + "repaymentStatus": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["notRepaid", "partiallyRepaid", "fullyRepaid"] + } + }, + "required": ["type"], + "description": "The repayment status of the receivable." + } + }, + "required": ["createdAt", "updatedAt", "version", "originalAmount", "remainingAmount", "purchaseDueDate", "repaymentStatus"], + "additionalProperties": false + }, + "relationships": { + "$ref": "#/components/schemas/ReceivableRelationships" + } + }, + "required": ["type", "id", "attributes", "relationships"], + "additionalProperties": false + }, + "OrgReceivable": { + "type": "object", + "title": "Organization Receivable", + "properties": { + "type": { + "type": "string", + "enum": ["orgReceivable"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "attributes": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "format": "date-time", + "description": "ISO8601 date time." + }, + "updatedAt": { + "type": "string", + "format": "date-time", + "description": "ISO8601 date time." + }, + "version": { + "type": "integer", + "description": "The version of the receivable." + }, + "originalAmount": { + "type": "integer", + "format": "int64", + "description": "The original amount of the receivable (in cents)." + }, + "remainingAmount": { + "type": "integer", + "format": "int64", + "description": "The remaining amount of the receivable (in cents)." + }, + "purchaseDueDate": { + "type": "string", + "format": "date", + "description": "The due date for purchasing the receivable." + }, + "repaymentStatus": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["notRepaid", "partiallyRepaid", "fullyRepaid"] + } + }, + "required": ["type"], + "description": "The repayment status of the receivable." + } + }, + "required": ["createdAt", "updatedAt", "version", "originalAmount", "remainingAmount", "purchaseDueDate", "repaymentStatus"], + "additionalProperties": false + }, + "relationships": { + "$ref": "#/components/schemas/ReceivableRelationships" + } + }, + "required": ["type", "id", "attributes", "relationships"], + "additionalProperties": false + }, + "CapitalPartnerReceivable": { + "type": "object", + "title": "Capital Partner Receivable", + "properties": { + "type": { + "type": "string", + "enum": ["capitalPartnerReceivable"] + }, + "id": { + "$ref": "../types.json#/components/schemas/Identifier" + }, + "attributes": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "format": "date-time", + "description": "ISO8601 date time." + }, + "updatedAt": { + "type": "string", + "format": "date-time", + "description": "ISO8601 date time." + }, + "version": { + "type": "integer", + "description": "The version of the receivable." + }, + "originalAmount": { + "type": "integer", + "format": "int64", + "description": "The original amount of the receivable (in cents)." + }, + "remainingAmount": { + "type": "integer", + "format": "int64", + "description": "The remaining amount of the receivable (in cents)." + }, + "purchaseDueDate": { + "type": "string", + "format": "date", + "description": "The due date for purchasing the receivable." + }, + "repaymentStatus": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["notRepaid", "partiallyRepaid", "fullyRepaid"] + } + }, + "required": ["type"], + "description": "The repayment status of the receivable." + } + }, + "required": ["createdAt", "updatedAt", "version", "originalAmount", "remainingAmount", "purchaseDueDate", "repaymentStatus"], + "additionalProperties": false + }, + "relationships": { + "$ref": "#/components/schemas/ReceivableRelationships" + } + }, + "required": ["type", "id", "attributes", "relationships"], + "additionalProperties": false + }, + "ReceivableRelationships": { + "type": "object", + "properties": { + "customer": { + "$ref": "../relationships.json#/components/schemas/CustomerRelationship" + }, + "account": { + "$ref": "../relationships.json#/components/schemas/AccountRelationship" + }, + "transaction": { + "$ref": "../relationships.json#/components/schemas/TransactionRelationship" + }, + "lendingProgram": { + "$ref": "../relationships.json#/components/schemas/LendingProgramRelationship" + } + }, + "required": ["customer", "account", "transaction", "lendingProgram"], + "additionalProperties": false + }, + "Receivable": { + "title": "Receivable Resource", + "type": "object", + "oneOf": [ + { + "$ref": "#/components/schemas/BankReceivable" + }, + { + "$ref": "#/components/schemas/OrgReceivable" + }, + { + "$ref": "#/components/schemas/CapitalPartnerReceivable" + } + ] + }, + "ReceivablesBalance": { + "type": "object", + "title": "Receivables Balance", + "properties": { + "type": { + "type": "string", + "enum": ["receivablesBalance"] + }, + "attributes": { + "type": "object", + "properties": { + "pendingPurchaseReceivablesAmount": { + "type": "integer", + "format": "int64", + "description": "The total amount of receivables pending purchase (in cents)." + } + }, + "required": ["pendingPurchaseReceivablesAmount"], + "additionalProperties": false + } + }, + "required": ["type", "attributes"], + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/schemas/receivables/receivablesPaths.json b/schemas/receivables/receivablesPaths.json new file mode 100644 index 0000000..e8a7ebc --- /dev/null +++ b/schemas/receivables/receivablesPaths.json @@ -0,0 +1,176 @@ +{ + "components": { + "schemas": { + "UnitReceivableResponse": { + "type": "object", + "title": "Unit Receivable Response", + "properties": { + "data": { + "$ref": "./receivable.json#/components/schemas/Receivable" + } + } + }, + "UnitReceivableListResponse": { + "type": "object", + "title": "Unit Receivable List Response", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "./receivable.json#/components/schemas/Receivable" + } + }, + "meta": { + "$ref": "../types.json#/components/schemas/PaginationMeta" + } + } + }, + "UnitReceivablesBalanceResponse": { + "type": "object", + "title": "Unit Receivables Balance Response", + "properties": { + "data": { + "$ref": "./receivable.json#/components/schemas/ReceivablesBalance" + } + } + } + } + }, + "receivable": { + "get": { + "tags": ["unit"], + "operationId": "getReceivable", + "summary": "Get a receivable by id", + "description": "Get a receivable resource by id.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "id", + "in": "path", + "required": true, + "description": "ID of the receivable to get" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitReceivableResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "receivables": { + "get": { + "tags": ["unit"], + "operationId": "listReceivables", + "summary": "List receivables resources", + "description": "List receivables resources. Paging can be applied.", + "parameters": [ + { + "$ref": "../types.json#/components/schemas/PageQuery" + }, + { + "name": "filter", + "in": "query", + "style": "deepObject", + "allowReserved": true, + "schema": { + "type": "object", + "properties": { + "customerId": { + "type": "string", + "description": "Optional. Filters the results by the specified customer id." + }, + "receivableType": { + "type": "string", + "enum": ["bankReceivable", "orgReceivable", "capitalPartnerReceivable"], + "description": "Optional. Filters the results by one of the following receivable types [\"bankReceivable\", \"orgReceivable\", \"capitalPartnerReceivable\"]" + }, + "repaymentStatusType": { + "type": "string", + "enum": ["notRepaid", "partiallyRepaid", "fullyRepaid"], + "description": "Optional. Filters the results by one of the following repayment status types [\"notRepaid\", \"partiallyRepaid\", \"fullyRepaid\"]" + }, + "purchaseDueDate": { + "type": "string", + "format": "date", + "description": "Optional. Filters the results by the specified purchase due date e.g. 2023-05-25" + } + } + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitReceivableListResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "receivablesBalance": { + "get": { + "tags": ["unit"], + "operationId": "getReceivablesBalance", + "summary": "Get receivables balance report", + "description": "Get receivables balance report resource. The resource contains information on the receivables balance that is due to be purchased by the specific date or on within specific number of days from today", + "parameters": [ + { + "name": "filter", + "in": "query", + "style": "deepObject", + "allowReserved": true, + "schema": { + "type": "object", + "properties": { + "purchaseDueDate": { + "type": "string", + "format": "date", + "description": "Optional. Filters the results by the receivable purchase due date." + }, + "daysUntilPurchase": { + "type": "string", + "description": "Optional. Filters the results by days until purchase" + } + } + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UnitReceivablesBalanceResponse" + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + } +} \ No newline at end of file diff --git a/schemas/relationships.json b/schemas/relationships.json index 71f7903..1a099f5 100644 --- a/schemas/relationships.json +++ b/schemas/relationships.json @@ -234,6 +234,60 @@ }, "additionalProperties": false }, + "BatchAccountRelationship": { + "type": "object", + "properties": { + "batchAccount": { + "type": "object", + "title": "Batch Account Relationship", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["batchAccount"] + }, + "id": { + "$ref": "./types.json#/components/schemas/Identifier" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + } + } + }, + "CustomerDepositAccountRelationship": { + "type": "object", + "properties": { + "receiver": { + "type": "object", + "title": "Customer Deposit Account Relationship", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["depositAccount"] + }, + "id": { + "$ref": "./types.json#/components/schemas/Identifier" + } + }, + "required": ["type", "id"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + } + } + }, "DocumentsRelationship": { "type": "object", "properties": { @@ -1147,6 +1201,60 @@ "additionalProperties": false } } + }, + "LendingProgramRelationship": { + "type": "object", + "properties": { + "lendingProgram": { + "type": "object", + "title": "Lending Program Relationship", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "$ref": "./types.json#/components/schemas/Identifier" + }, + "type": { + "type": "string", + "enum": ["lendingProgram"] + } + }, + "additionalProperties": false, + "required": ["id", "type"] + } + }, + "additionalProperties": false, + "required": ["data"] + } + } + }, + "CreditApplicationRelationship": { + "type": "object", + "properties": { + "creditApplication": { + "type": "object", + "title": "Credit Application Relationship", + "properties": { + "data": { + "type": "object", + "properties": { + "id": { + "$ref": "./types.json#/components/schemas/Identifier" + }, + "type": { + "type": "string", + "enum": ["creditApplication"] + } + }, + "additionalProperties": false, + "required": ["id", "type"] + } + }, + "additionalProperties": false, + "required": ["data"] + } + } } } } diff --git a/schemas/repayment/createRepayment.json b/schemas/repayment/createRepayment.json index 40b8cdc..9373787 100644 --- a/schemas/repayment/createRepayment.json +++ b/schemas/repayment/createRepayment.json @@ -79,13 +79,24 @@ "type": "object", "properties": { "description": { - "type": "string" + "type": "string", + "description": "Repayment description (maximum of 80 characters), this will show up on statement of the counterparty." }, "amount": { - "type": "number" + "type": "number", + "description": "The amount (cents) to repay." }, "transactionSummaryOverride": { - "type": "string" + "type": "string", + "description": "If this field is populated, its contents will be returned as the bookTransaction's summary field (maximum of 100 characters)." + }, + "tags": { + "type": "object", + "description": "Optional. See Tags (https://www.unit.co/docs/api/#tags)." + }, + "idempotencyKey": { + "type": "string", + "description": "Optional. See Idempotency (https://www.unit.co/docs/api/#intro-idempotency)." } }, "required": ["description", "amount"], @@ -110,13 +121,24 @@ "type": "object", "properties": { "description": { - "type": "string" + "type": "string", + "description": "Repayment description (maximum of 80 characters), this will show up on statement of the counterparty." }, "amount": { - "type": "number" + "type": "number", + "description": "The amount (cents) to repay." }, "transactionSummaryOverride": { - "type": "string" + "type": "string", + "description": "If this field is populated, its contents will be returned as the bookTransaction's summary field (maximum of 100 characters)." + }, + "tags": { + "type": "object", + "description": "Optional. See Tags (https://www.unit.co/docs/api/#tags)." + }, + "idempotencyKey": { + "type": "string", + "description": "Optional. See Idempotency (https://www.unit.co/docs/api/#intro-idempotency)." } }, "required": ["description", "amount"], @@ -140,19 +162,32 @@ "type": "object", "properties": { "description": { - "type": "string" + "type": "string", + "description": "Repayment description (maximum of 80 characters), this will show up on statement of the counterparty." }, "amount": { - "type": "number" + "type": "number", + "description": "The amount (cents) to repay." }, "addenda": { - "type": "string" + "type": "string", + "description": "Additional information about the payment." }, "sameDay": { - "type": "boolean" + "type": "boolean", + "description": "Indicates if the payment should be processed as a same-day ACH transaction." }, "secCode": { - "type": "string" + "type": "string", + "description": "The Standard Entry Class (SEC) code for the transaction." + }, + "tags": { + "type": "object", + "description": "Optional. See Tags (https://www.unit.co/docs/api/#tags)." + }, + "idempotencyKey": { + "type": "string", + "description": "Optional. See Idempotency (https://www.unit.co/docs/api/#intro-idempotency)." } }, "required": ["description", "amount"], @@ -177,19 +212,32 @@ "type": "object", "properties": { "description": { - "type": "string" + "type": "string", + "description": "Repayment description (maximum of 80 characters), this will show up on statement of the counterparty." }, "amount": { - "type": "number" + "type": "number", + "description": "The amount (cents) to repay." }, "addenda": { - "type": "string" + "type": "string", + "description": "Additional information about the payment." }, "sameDay": { - "type": "boolean" + "type": "boolean", + "description": "Indicates if the payment should be processed as a same-day ACH transaction." }, "secCode": { - "type": "string" + "type": "string", + "description": "The Standard Entry Class (SEC) code for the transaction." + }, + "tags": { + "type": "object", + "description": "Optional. See Tags (https://www.unit.co/docs/api/#tags)." + }, + "idempotencyKey": { + "type": "string", + "description": "Optional. See Idempotency (https://www.unit.co/docs/api/#intro-idempotency)." } }, "required": ["description", "amount"], diff --git a/schemas/repayment/recurring-repayment/createRecurringRepayment.json b/schemas/repayment/recurring-repayment/createRecurringRepayment.json index f2db9b6..5cbe2c0 100644 --- a/schemas/repayment/recurring-repayment/createRecurringRepayment.json +++ b/schemas/repayment/recurring-repayment/createRecurringRepayment.json @@ -93,12 +93,14 @@ "description": { "type": "string", "minLength": 1, - "maxLength": 80 + "maxLength": 80, + "description": "Repayment description (maximum of 80 characters), this will show up on the statement of the counterparty." }, "transactionSummaryOverride": { "type": "string", "minLength": 1, - "maxLength": 100 + "maxLength": 100, + "description": "Optional. If this field is populated, its contents will be returned as the bookTransaction's summary field (maximum of 100 characters)." }, "idempotencyKey": { "type": "string", @@ -134,7 +136,8 @@ "description": { "type": "string", "minLength": 1, - "maxLength": 10 + "maxLength": 50, + "description": "Repayment description (maximum of 50 characters). This will show up on the statement of the counterparty." }, "addenda": { "type": "string", @@ -144,7 +147,8 @@ "idempotencyKey": { "type": "string", "minLength": 1, - "maxLength": 255 + "maxLength": 255, + "description": "Optional. See https://www.unit.co/docs/#intro-idempotency." }, "sameDay": { "type": "boolean" @@ -153,7 +157,10 @@ "type": "string" }, "tags": { - "$ref": "../../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../../types.json#/components/schemas/Tags" }, + { "description": "Optional. See https://www.unit.co/docs/#tags. Tags that will be copied to any transaction that this recurring repayment creates (see https://www.unit.co/docs/#tag-inheritance)." } + ] } }, "required": ["description"], diff --git a/schemas/repayment/recurring-repayment/recurringRepayment.json b/schemas/repayment/recurring-repayment/recurringRepayment.json index bd066e6..6c3a541 100644 --- a/schemas/repayment/recurring-repayment/recurringRepayment.json +++ b/schemas/repayment/recurring-repayment/recurringRepayment.json @@ -3,7 +3,8 @@ "schemas": { "RecurringRepaymentStatus": { "type": "string", - "enum": ["Active", "Disabled"] + "enum": ["Active", "Disabled"], + "description": "Recurring Repayments have a `status` attribute, which represents their current status. Active - Upon creation, the status will be set to Active. Disabled - When recurring repayment has been disabled, the status will be set to Disabled." }, "RecurringRepaymentRelationshipsBase": { "type": "object", @@ -223,22 +224,31 @@ }, "description": { "type": "string", - "maxLength": 50 + "maxLength": 50, + "description": "Repayment description (maximum of 50 characters). This will show up on the statement of the counterparty." }, "addenda": { "type": "string", - "maxLength": 80 + "maxLength": 80, + "description": "Optional, additional repayment description (maximum of 80 characters), not all institutions present that in payment description." }, "sameDay": { "type": "boolean", - "default": "false" + "default": "false", + "description": "Optional, default is false. See https://www.unit.co/docs/api/ach-origination/#same-day-ach." + }, + "secCode": { + "type": "string", + "description": "Optional. See https://www.unit.co/docs/api/ach-origination/#use-a-custom-sec-code." }, - "secCode": { "type": "string" }, "numberOfRepayments": { "type": "integer" }, "tags": { - "$ref": "../../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../../types.json#/components/schemas/Tags" }, + { "description": "Optional. See https://www.unit.co/docs/#tags. Tags that will be copied to any transaction that this recurring repayment creates (see https://www.unit.co/docs/#tag-inheritance)." } + ] }, "status": { "$ref": "#/components/schemas/RecurringRepaymentStatus" @@ -288,14 +298,19 @@ }, "description": { "type": "string", - "maxLength": 50 + "maxLength": 50, + "description": "Repayment description (maximum of 80 characters), this will show up on the statement of the counterparty." }, "transactionSummaryOverride": { "type": "string", - "maxLength": 100 + "maxLength": 100, + "description": "Optional. If this field is populated, its contents will be returned as the bookTransaction's summary field (maximum of 100 characters)." }, "tags": { - "$ref": "../../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../../types.json#/components/schemas/Tags" }, + { "description": "Optional. See https://www.unit.co/docs/#tags." } + ] }, "numberOfRepayments": { "type": "integer" @@ -461,7 +476,7 @@ "recurringAchRepayment", "recurringBookRepayment", "recurringCapitalPartnerAchRepayment", - "recurrinCapitalPartnerBookRepayment" + "recurringCapitalPartnerBookRepayment" ] } }, diff --git a/schemas/repayment/recurring-repayment/recurringRepaymentPaths.json b/schemas/repayment/recurring-repayment/recurringRepaymentPaths.json index 40e43b8..ec97b3e 100644 --- a/schemas/repayment/recurring-repayment/recurringRepaymentPaths.json +++ b/schemas/repayment/recurring-repayment/recurringRepaymentPaths.json @@ -14,7 +14,9 @@ }, "recurringRepayments": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getRecurringRepaymentsList", "summary": "Get List Recurring Repayments", "description": "Get List Recurring Repayments from API ", @@ -40,7 +42,10 @@ "type": "array", "items": { "type": "string", - "enum": ["Active", "Disabled"] + "enum": [ + "Active", + "Disabled" + ] } }, "fromStartTime": { @@ -59,7 +64,10 @@ "in": "query", "schema": { "type": "string", - "enum": ["createdAt", "-createdAt"] + "enum": [ + "createdAt", + "-createdAt" + ] } } ], @@ -88,11 +96,16 @@ }, "401": { "$ref": "../../types.json#/components/schemas/DefaultError" + }, + "default": { + "$ref": "../../types.json#/components/schemas/DefaultError" } } }, "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "createRecurringRepayment", "summary": "Create a Recurring Repayment", "description": "Create a Recurring Repayment via API", @@ -126,7 +139,9 @@ }, "recurringRepayment": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getRecurringRepayment", "parameters": [ { @@ -158,13 +173,18 @@ } } } + }, + "default": { + "$ref": "../../types.json#/components/schemas/DefaultError" } } } }, "disableRecurringRepayment": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "disableRecurringRepayment", "parameters": [ { @@ -208,13 +228,18 @@ } } } + }, + "default": { + "$ref": "../../types.json#/components/schemas/DefaultError" } } } }, "enableRecurringRepayment": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "enableRecurringRepayment", "parameters": [ { @@ -258,8 +283,11 @@ } } } + }, + "default": { + "$ref": "../../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/repayment/repayment.json b/schemas/repayment/repayment.json index 819991c..ef02a0d 100644 --- a/schemas/repayment/repayment.json +++ b/schemas/repayment/repayment.json @@ -158,7 +158,7 @@ "$ref": "../relationships.json#/components/schemas/CustomerRelationship" }, { - "$ref": "../relationships.json#/components/schemas/ReccuringRepaymentRelationship" + "$ref": "../relationships.json#/components/schemas/RecurringRepaymentRelationship" }, { "$ref": "../relationships.json#/components/schemas/CounterpartyRelationship" @@ -167,6 +167,7 @@ }, "BookRepaymentStatus": { "type": "string", + "description": "Repayments share the status of the payment type they resulted in (Book or ACH debit). When the Repayment status changes, a repayment.statusChanged event will be raised.", "enum": ["Sent", "Rejected"] }, "BookRepayment": { @@ -179,19 +180,28 @@ "type": "object", "properties": { "createdAt": { - "type": "string" + "type": "string", + "description": "The date and time when the repayment was created." }, "updatedAt": { - "type": "string" + "type": "string", + "description": "The date and time when the repayment was last updated." }, "amount": { - "type": "number" + "type": "number", + "description": "The amount of the repayment in cents." }, "status": { - "$ref": "#/components/schemas/BookRepaymentStatus" + "allOf": [ + { "$ref": "#/components/schemas/BookRepaymentStatus" }, + { "description": "The status of the repayment. Possible values for Book Repayments are: Sent - The repayment has been completed and the funds have been debited from the counterparty, deposited into the account, and the creditAccount balance has been updated. Rejected - The repayment has been rejected, either because the amount exceeds the balance of the creditAccount, or because the book payment has been rejected." } + ] }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional key-value pairs associated with the repayment." } + ] } }, "required": [ @@ -219,19 +229,28 @@ "type": "object", "properties": { "createdAt": { - "type": "string" + "type": "string", + "description": "The date and time when the repayment was created." }, "updatedAt": { - "type": "string" + "type": "string", + "description": "The date and time when the repayment was last updated." }, "amount": { - "type": "number" + "type": "number", + "description": "The amount of the repayment in cents." }, "status": { - "$ref": "#/components/schemas/BookRepaymentStatus" + "allOf": [ + { "$ref": "#/components/schemas/BookRepaymentStatus" }, + { "description": "The status of the capital partner book repayment." } + ] }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional key-value pairs associated with the repayment." } + ] } }, "required": [ @@ -251,6 +270,7 @@ }, "AchRepaymentStatus": { "type": "string", + "description": "Repayments share the status of the payment type they resulted in (Book or ACH debit). When the Repayment status changes, a repayment.statusChanged event will be raised.", "enum": [ "Pending", "PendingReview", @@ -271,19 +291,28 @@ "type": "object", "properties": { "createdAt": { - "type": "string" + "type": "string", + "description": "The date and time when the repayment was created." }, "updatedAt": { - "type": "string" + "type": "string", + "description": "The date and time when the repayment was last updated." }, "amount": { - "type": "number" + "type": "number", + "description": "The amount of the repayment in cents." }, "status": { - "$ref": "#/components/schemas/AchRepaymentStatus" + "allOf": [ + { "$ref": "#/components/schemas/AchRepaymentStatus" }, + { "description": "The status of the repayment. Possible values for ACH Repayments are: Pending - The repayment and associated payment have been created, but have not yet been transmitted to the ACH network. PendingReview - The ACH debit payment has been sent to manual review in cases of elevated fraud risk. Clearing - The funds have been debited from the counterparty and are now in clearing to mitigate the risk of ACH debit fraud. Sent - The funds have been cleared and released to the account. The creditAccount balance has been updated. Returned - The bank that the funds were pulled from has returned the ACH payment. The funds have been returned from the account to the counterparty and the creditAccount balance has been updated. Rejected - The repayment has been rejected, either because the amount exceeds the balance of the creditAccount, or because the ACH has been rejected. Canceled - The ACH payment has been canceled." } + ] }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional key-value pairs associated with the repayment." } + ] } }, "required": [ @@ -311,19 +340,28 @@ "type": "object", "properties": { "createdAt": { - "type": "string" + "type": "string", + "description": "The date and time when the repayment was created." }, "updatedAt": { - "type": "string" + "type": "string", + "description": "The date and time when the repayment was last updated." }, "amount": { - "type": "number" + "type": "number", + "description": "The amount of the repayment in cents." }, "status": { - "$ref": "#/components/schemas/AchRepaymentStatus" + "allOf": [ + { "$ref": "#/components/schemas/AchRepaymentStatus" }, + { "description": "The status of the capital partner ACH repayment." } + ] }, "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "Optional key-value pairs associated with the repayment." } + ] } }, "required": [ @@ -343,6 +381,7 @@ }, "Repayment": { "title": "Repayment Resource", + "description": "Repayments represent payments made towards a loan. Repayments from a deposit account on the same bank on the Unit platform can be made using book repayment, whereas repayments from accounts on other banks, would be made using ACH debit repayments. Once you create a repayment, a repayment.created event will be raised.", "type": "object", "properties": { "id": { diff --git a/schemas/repayment/repaymentPaths.json b/schemas/repayment/repaymentPaths.json index 3acfb20..1a814df 100644 --- a/schemas/repayment/repaymentPaths.json +++ b/schemas/repayment/repaymentPaths.json @@ -14,10 +14,12 @@ }, "repayments": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getRepaymentsList", "summary": "Get List Repayments", - "description": "Get List Repayments from API ", + "description": "List repayments resources. Filtering, paging and sorting can be applied.", "parameters": [ { "$ref": "../types.json#/components/schemas/PageQuery" @@ -31,36 +33,82 @@ "type": "object", "properties": { "accountId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified account id." }, "creditAccountId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified credit account id." + }, + "recurringRepaymentId": { + "type": "string", + "description": "Optional. Filters the result according to the associated Recurring Repayment id" }, "customerId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified customer id." }, "status": { "type": "array", + "description": "Optional. Filter repayments by status (Pending, PendingReview, Returned, Sent or Rejected). Usage example: filter[status][0]=Active", "items": { "type": "string", "enum": [ "Pending", "PendingReview", + "Clearing", "Returned", "Sent", - "Rejected" + "Rejected", + "Canceled" ] } }, "type": { "type": "array", + "description": "Optional. Filter repayments by Repayment type. such as (AchRepayment, BookRepayment). Usage example: filter[type][0]=AchRepayment&filter[type][1]=BookRepayment", "items": { "type": "string", - "enum": ["AchRepayment", "BookRepayment"] + "enum": [ + "AchRepayment", + "BookRepayment", + "capitalPartnerAchRepayment", + "capitalPartnerBookRepayment" + ] } + }, + "since": { + "type": "string", + "format": "date-time", + "description": "Optional. Filters Repayments that occurred _after_ the specified date. e.g. 2020-01-13T16:01:19.346Z" + }, + "until": { + "type": "string", + "format": "date-time", + "description": "Optional. Filters the Repayments that occurred _before_ the specified date. e.g. 2020-01-02T20:06:23.486Z" } } } + }, + { + "name": "sort", + "in": "query", + "description": "Optional. Leave empty or provide sort=createdAt for ascending order. Provide sort=-createdAt (leading minus sign) for descending order.", + "schema": { + "type": "string", + "enum": [ + "createdAt", + "-createdAt" + ] + } + }, + { + "name": "include", + "in": "query", + "description": "Optional. A comma-separated list of related resources to include in the response.", + "schema": { + "type": "string" + } } ], "responses": { @@ -78,8 +126,25 @@ "$ref": "./repayment.json#/components/schemas/Repayment" } }, + "included": { + "allOf": [ + { + "$ref": "../types.json#/components/schemas/IncludedResource" + }, + { + "description": "Array of resources requested by the include query parameter." + } + ] + }, "meta": { - "$ref": "../types.json#/components/schemas/PaginationMeta" + "allOf": [ + { + "$ref": "../types.json#/components/schemas/PaginationMeta" + }, + { + "description": "Pagination data includes offset, limit and total (estimated total items)." + } + ] } } } @@ -88,15 +153,19 @@ }, "401": { "$ref": "../types.json#/components/schemas/DefaultError" + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "createRepayment", - "summary": "Create a Repayment", - "description": "Create a Repayment via API ", + "description": "Creates a repayment for a credit account. Book Repayment creation requests support Idempotency, ensuring that performing multiple identical requests will have the same result as a single request.", "requestBody": { "description": "Create a Repayment Request", "required": true, @@ -127,9 +196,10 @@ }, "repayment": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getRepayment", - "parameters": [ { "schema": { @@ -143,13 +213,14 @@ { "name": "include", "in": "query", + "description": "Optional. A comma-separated list of related resources to include in the response.", "schema": { "type": "string" } } ], "summary": "Get Repayment by Id", - "description": "Get an Repayment from API ", + "description": "Get a repayment by id.", "responses": { "200": { "description": "Successful Response", @@ -160,8 +231,11 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/reward/rewardPaths.json b/schemas/reward/rewardPaths.json index 3faa195..60902e0 100644 --- a/schemas/reward/rewardPaths.json +++ b/schemas/reward/rewardPaths.json @@ -1,9 +1,10 @@ { "rewards": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "createReward", - "summary": "Create Reward", "description": "Create a Reward via API ", "requestBody": { @@ -33,13 +34,17 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getRewardsList", - "summary": "Get Rewards List", "description": "Get Rewards List from API ", "parameters": [ @@ -121,15 +126,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "getReward": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getReward", - "parameters": [ { "schema": { @@ -159,8 +168,11 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/simulation/simulationPaths.json b/schemas/simulation/simulationPaths.json index cf5dbfa..698c443 100644 --- a/schemas/simulation/simulationPaths.json +++ b/schemas/simulation/simulationPaths.json @@ -1,9 +1,10 @@ { "createAtmDeposit": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "createAtmDepositSimulation", - "summary": "Create Atm Deposit Simulation", "description": "Create Atm Deposit Simulation via API ", "requestBody": { @@ -27,13 +28,18 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "activateCard": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "parameters": [ { "schema": { @@ -51,15 +57,19 @@ "responses": { "201": { "description": "Successful Response" + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "receivedPaymentTransaction": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "createACHReceivedPaymentTransactionSimulation", - "summary": "Create ACH Received Payment Transaction Simulation", "description": "Create ACH Received Payment Transaction Simulation via API ", "requestBody": { @@ -83,15 +93,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "createIncomingAchPayment": { "post": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "createIncomingAchPaymentSimulation", - "summary": "Create Incoming ACH Payment Simulation", "description": "Create Incoming ACH Payment Simulation via API ", "requestBody": { @@ -115,8 +129,11 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/statement/statement.json b/schemas/statement/statement.json index 1a6ec56..12b5305 100644 --- a/schemas/statement/statement.json +++ b/schemas/statement/statement.json @@ -17,6 +17,7 @@ "Statement": { "title": "Statement", "type": "object", + "description": "Statements are generated automatically and gradually at start of each month, and providing them to your customer is a regulatory requirement. This allow your customers to keep track of money movements and act on any fraudulent charges or mistakes.", "properties": { "type": { "type": "string", @@ -29,9 +30,11 @@ "type": "object", "properties": { "period": { - "type": "string" + "type": "string", + "description": "The period for which the statement was generated, in YYYY-MM format." } - } + }, + "required": ["period"] }, "relationships": { "$ref": "#/components/schemas/StatementRelationships" diff --git a/schemas/statement/statementPaths.json b/schemas/statement/statementPaths.json index 30c1ed8..38e3adb 100644 --- a/schemas/statement/statementPaths.json +++ b/schemas/statement/statementPaths.json @@ -1,10 +1,12 @@ { "getStatements": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getStatementsList", - "summary": "Get List Statements", - "description": "Get List Statements from API ", + "summary": "List Statements", + "description": "List statement resources. Filtering and paging can be applied.", "parameters": [ { "$ref": "../types.json#/components/schemas/PageQuery" @@ -18,13 +20,23 @@ "type": "object", "properties": { "accountId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified account id." + }, + "accountIds[]": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Optional. Filters the results by the specified account ids. Usage example: filter[accountIds][0]=10000&filter[accountIds][1]=10001" }, "customerId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified customer id." }, "period": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results for a specific month. e.g. 2021-01" } } } @@ -34,7 +46,8 @@ "in": "query", "schema": { "type": "string" - } + }, + "description": "Optional. Leave empty or provide sort=period for ascending order. Provide sort=-period (leading minus sign) for descending order." } ], "responses": { @@ -44,27 +57,34 @@ "application/vnd.api+json; charset=utf-8": { "schema": { "type": "object", - "title": "Unit Statements Response", + "title": "Unit Statements List Response", "properties": { "data": { "type": "array", "items": { "$ref": "./statement.json#/components/schemas/Statement" } + }, + "meta": { + "$ref": "../types.json#/components/schemas/PaginationMeta" } } } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "getStatementHtml": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getStatementHtml", - "parameters": [ { "schema": { @@ -74,29 +94,62 @@ "in": "path", "required": true, "description": "ID of the statement to get" + }, + { + "name": "filter", + "in": "query", + "style": "deepObject", + "allowReserved": true, + "schema": { + "type": "object", + "properties": { + "customerId": { + "type": "string", + "description": "Optional. Verify that the statements belongs to the customer." + } + } + } + }, + { + "name": "language", + "in": "query", + "schema": { + "type": "string", + "enum": [ + "en", + "es" + ], + "default": "en" + }, + "description": "Optional. Select the statement language. en - English, es - Spanish" } ], - "summary": "Get HTML Statement by Id", - "description": "Get a HTML Statement from API ", + "summary": "Get HTML by Id", + "description": "Get a statement HTML output by id.", "responses": { "200": { "description": "Successful Response", "content": { "text/html": { "schema": { - "type": "string" + "type": "string", + "title": "Unit Statement HTML Response" } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "getStatementPdf": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getStatementPdf", - "parameters": [ { "schema": { @@ -106,10 +159,38 @@ "in": "path", "required": true, "description": "ID of the statement to get" + }, + { + "name": "filter", + "in": "query", + "style": "deepObject", + "allowReserved": true, + "schema": { + "type": "object", + "properties": { + "customerId": { + "type": "string", + "description": "Optional. Verify that the statements belongs to the customer." + } + } + } + }, + { + "name": "language", + "in": "query", + "schema": { + "type": "string", + "enum": [ + "en", + "es" + ], + "default": "en" + }, + "description": "Optional. Select the statement language. en - English, es - Spanish" } ], - "summary": "Get PDF Statement by Id", - "description": "Get a PDF Statement from API ", + "summary": "Get PDF by Id", + "description": "Get a statement PDF output by id.", "responses": { "200": { "description": "Successful Response", @@ -117,19 +198,24 @@ "application/pdf": { "schema": { "type": "string", - "format": "binary" + "format": "binary", + "title": "Unit Statement PDF Response" } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "getStatementBankPdf": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getStatementBankPdf", - "summary": "Get Bank verification PDF", "parameters": [ { @@ -140,9 +226,18 @@ "in": "path", "required": true, "description": "ID of the account to get" + }, + { + "name": "includeProofOfFunds", + "in": "query", + "schema": { + "type": "boolean", + "default": false + }, + "description": "Optional. include customer proof of funds" } ], - "description": "Get Get Bank verification PDF from API ", + "description": "Customers may be required, for various reasons, to provide proof that they hold a bank account with a certain financial institution. This is typically provided by the bank in a letter called \"Bank verification letter\", which includes the customer, account and financial institution information. If the customer is required to prove availability of funds, the letter may also include the available balance on the account.", "responses": { "200": { "description": "Successful Response", @@ -150,12 +245,16 @@ "application/pdf": { "schema": { "type": "string", - "format": "binary" + "format": "binary", + "title": "Unit Bank Verification PDF Response" } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/tax-forms/taxForm.json b/schemas/tax-forms/taxForm.json index 750fe9c..e99ea99 100644 --- a/schemas/tax-forms/taxForm.json +++ b/schemas/tax-forms/taxForm.json @@ -2,7 +2,9 @@ "components": { "schemas": { "TaxForm": { + "title": "Tax Form", "type": "object", + "description": "Some tax forms are generated automatically at the start of each year, and providing them to your customers is a regulatory requirement. While Unit generates some tax forms in line with detailed regulatory requirements, you are responsible for following all IRS and regulatory guidelines and distributing those forms to your customers.", "properties": { "type": { "type": "string", @@ -15,10 +17,14 @@ "type": "object", "properties": { "formType": { - "type": "string" + "type": "string", + "description": "The type of tax form, e.g. 1099-INT." }, "taxYear": { - "$ref": "../types.json#/components/schemas/Year" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Year" }, + { "description": "The tax year for which the form was generated, in YYYY format." } + ] } }, "required": ["formType", "taxYear"] diff --git a/schemas/tax-forms/taxFormsPaths.json b/schemas/tax-forms/taxFormsPaths.json index d678edc..3fedd0c 100644 --- a/schemas/tax-forms/taxFormsPaths.json +++ b/schemas/tax-forms/taxFormsPaths.json @@ -1,10 +1,12 @@ { "taxForms": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getTaxFormsList", - "summary": "Get Tax Forms List ", - "description": "Get Tax Forms List from API ", + "summary": "List Tax Forms", + "description": "List tax form resources per tax year. Filtering and paging can be applied.", "parameters": [ { "$ref": "../types.json#/components/schemas/PageQuery" @@ -18,22 +20,26 @@ "type": "object", "properties": { "customerId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified customer id." }, "accountId": { - "type": "string" + "type": "string", + "description": "Optional. Filters the results by the specified account id." }, - "taxYear": { + "taxYears": { "type": "array", "items": { "$ref": "../types.json#/components/schemas/Year" - } + }, + "description": "Optional. Returns the available tax forms for one or more tax years. e.g. Usage example: filter[taxYears][0]=2023" }, "taxFormTypes": { "type": "array", "items": { "type": "string" - } + }, + "description": "Optional. Usage example: filter[taxFormsType][0]=1099-INT" } } } @@ -58,13 +64,18 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "getTaxForm": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getTaxForm", "parameters": [ { @@ -74,11 +85,11 @@ "name": "taxFormId", "in": "path", "required": true, - "description": "ID of the reward to get" + "description": "ID of the tax form to get" } ], "summary": "Get Tax Form by Id", - "description": "Get a Tax Form from API ", + "description": "Get a tax form by id.", "responses": { "200": { "description": "Successful Response", @@ -95,15 +106,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "getTaxFormPdf": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getTaxFormPdf", - "parameters": [ { "schema": { @@ -112,11 +127,11 @@ "name": "taxFormId", "in": "path", "required": true, - "description": "ID of the reward to get" + "description": "ID of the tax form to get" } ], - "summary": "Get Tax Form pdf by Id", - "description": "Get a Tax Form pdf from API ", + "summary": "Get Tax Form PDF by Id", + "description": "Get a tax form PDF file by id.", "responses": { "200": { "description": "Successful Response", @@ -128,8 +143,11 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/token/apiToken.json b/schemas/token/apiToken.json index 3a0548d..be76cfb 100644 --- a/schemas/token/apiToken.json +++ b/schemas/token/apiToken.json @@ -18,25 +18,50 @@ "properties": { "createdAt": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "Date and time when the Org API token was created." }, "description": { - "type": "string" + "type": "string", + "description": "A description of the Org API token." }, "expiration": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "Expiration date of the Org API token." }, "token": { - "type": "string" + "type": "string", + "description": "The token value returned only when creating a new token." }, "sourceIp": { - "type": "string" + "type": "string", + "description": "A comma separated list of IP addresses that are allowed to use the Org API token (no spaces allowed)." } }, "required": ["createdAt"] } } + }, + "RestrictedResource": { + "type": "object", + "title": "Restricted Resource", + "description": "Restrict token to one or more specific resources. To one or many cards and/or to one or many accounts (cards under it, payments, transactions). See [Restricted Resources](https://www.unit.co/docs/api/resources/#restricted-resources).", + "properties": { + "type": { + "type": "string", + "enum": ["card", "account"], + "description": "The type of resource to restrict access to." + }, + "ids": { + "type": "array", + "description": "The identifiers of the resources to restrict access to.", + "items": { + "$ref": "../types.json#/components/schemas/Identifier" + } + } + }, + "required": ["type", "ids"] } } } diff --git a/schemas/token/createApiToken.json b/schemas/token/createApiToken.json index 0853425..2992570 100644 --- a/schemas/token/createApiToken.json +++ b/schemas/token/createApiToken.json @@ -17,41 +17,34 @@ "type": "object", "properties": { "scope": { - "type": "string" + "type": "string", + "description": "list of [Scopes](https://www.unit.co/docs/api/#scopes) separated by spaces." }, "description": { - "type": "string" + "type": "string", + "description": "A description of the Org API token." }, "expiration": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "Expiration date of the Org API token." }, "sourceIp": { - "type": "string" + "type": "string", + "description": "Optional. A comma separated list of IP addresses that are allowed to use the Org API token (no spaces allowed)." }, "resources": { "type": "array", "minItems": 1, + "description": "Optional. Restrict token to one or more specific resources. To one or many cards and/or to one or many accounts (cards under it, payments, transactions). See [Restricted Resources](https://www.unit.co/docs/api/resources/#restricted-resources).", "items": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": ["card", "account"] - }, - "ids": { - "type": "array", - "items": { - "$ref": "../types.json#/components/schemas/Identifier" - } - } - } + "$ref": "./apiToken.json#/components/schemas/RestrictedResource" }, "nullable": true } }, "additionalProperties": false, - "required": ["description", "expiration"] + "required": ["description", "expiration", "scope"] } }, "additionalProperties": false, diff --git a/schemas/token/createCustomerToken.json b/schemas/token/createCustomerToken.json index c512527..7660a8d 100644 --- a/schemas/token/createCustomerToken.json +++ b/schemas/token/createCustomerToken.json @@ -16,41 +16,37 @@ "type": "object", "properties": { "scope": { - "type": "string" + "type": "string", + "description": "list of Scopes separated by spaces." }, "verificationToken": { - "type": "string" + "type": "string", + "description": "Required if scope includes a scope which require two-factor authentication. Received as a response from Create Customer Token Verification." }, "jwtToken": { - "type": "string" + "type": "string", + "description": "Required if scope includes a scope which require two-factor authentication. Should be in a valid JWT structure." }, "expiresIn": { - "type": "integer" + "type": "integer", + "description": "Optional. The lifetime of the token (in seconds). Maximum value is 86400 (24 hours). Default value is also 24 hours.", + "maximum": 86400 }, "verificationCode": { - "type": "string" + "type": "string", + "description": "Required if the scope attribute includes a scope which requires two-factor authentication. 6 digits code sent to the customer through the desired channel." }, "resources": { "type": "array", "minItems": 1, "items": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": ["card", "account"] - }, - "ids": { - "type": "array", - "items": { - "$ref": "../types.json#/components/schemas/Identifier" - } - } - } - } + "$ref": "../token/apiToken.json#/components/schemas/RestrictedResource" + }, + "description": "Optional. Restrict token to one or more specific resources. To one or many cards and/or to one or many accounts (cards under it, payments, transactions). See [Restricted Resources](https://www.unit.co/docs/api/resources/#restricted-resources)." }, "upgradableScope": { - "type": "string" + "type": "string", + "description": "Optional. list of Scopes separated by spaces. The customer will be able to upgrade the token to the scopes you provide here. customer-token-write scope is required when setting this attribute." } } } diff --git a/schemas/token/createCustomerTokenVerification.json b/schemas/token/createCustomerTokenVerification.json index 40d9e28..1dc88f5 100644 --- a/schemas/token/createCustomerTokenVerification.json +++ b/schemas/token/createCustomerTokenVerification.json @@ -17,15 +17,18 @@ "properties": { "channel": { "type": "string", - "enum": ["sms", "call"] + "enum": ["sms", "call"], + "description": "Send a verification code to the customer through one of the following channels - sms or call." }, "phone": { - "$ref": "../types.json#/components/schemas/Phone" + "$ref": "../types.json#/components/schemas/Phone", + "description": "Optional. This allows providing the phone number of one of the customer's authorized users. The provided phone must match an authorized user phone and will be used in the One Time Password (OTP) authentication process instead of the business customer contact's phone." }, "appHash": { "type": "string", "minLength": 11, - "maxLength": 11 + "maxLength": 11, + "description": "Optional. For sms verifications only, 11-character hash string that identifies your app. Appended at the end of your verification SMS body the way that client-side SMS Retriever API expects." }, "language": { "type": "string", @@ -71,7 +74,8 @@ "th", "tr", "vi" - ] + ], + "description": "Optional. Select the verification language using a 2-letters code. Default is English. See Localization Options in the documentation for the supported languages and their 2-letters code." } }, "required": ["channel"], diff --git a/schemas/token/customerToken.json b/schemas/token/customerToken.json index e4986f9..3749b1a 100644 --- a/schemas/token/customerToken.json +++ b/schemas/token/customerToken.json @@ -14,10 +14,12 @@ "type": "object", "properties": { "token": { - "type": "string" + "type": "string", + "description": "The token issued for the customer." }, "expiresIn": { - "type": "integer" + "type": "integer", + "description": "The lifetime of the token (in seconds)." } } } diff --git a/schemas/token/customerTokenVerification.json b/schemas/token/customerTokenVerification.json index d238e4e..40f3832 100644 --- a/schemas/token/customerTokenVerification.json +++ b/schemas/token/customerTokenVerification.json @@ -14,12 +14,13 @@ "type": "object", "properties": { "verificationToken": { - "type": "string" + "type": "string", + "description": "The generated verification token . It should be passed back to Create Customer Bearer Token along with the verification code the customer received on the specified channel" } } } }, - "required": ["type", "id", "attributes"], + "required": ["type", "attributes"], "additionalProperties": false } } diff --git a/schemas/token/tokenPaths.json b/schemas/token/tokenPaths.json index 645a5fa..fb8b56d 100644 --- a/schemas/token/tokenPaths.json +++ b/schemas/token/tokenPaths.json @@ -16,7 +16,7 @@ "get": { "tags": ["unit"], "operationId": "getApiTokensList", - "summary": "Get List Org API Tokens", + "summary": "List Org API Tokens", "parameters": [ { "schema": { @@ -25,10 +25,10 @@ "name": "userId", "in": "path", "required": true, - "description": "ID of the user to revoke token" + "description": "ID of the user to list tokens for" } ], - "description": "Get List Org API Tokens from API ", + "description": "List Org API Token resources.", "responses": { "200": { "description": "Successful Response", @@ -48,6 +48,9 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, @@ -55,7 +58,7 @@ "tags": ["unit"], "operationId": "createApiToken", "summary": "Create Org API Token", - "description": "Create an Org API Token via API ", + "description": "Creates an Org API token.", "parameters": [ { "schema": { @@ -88,6 +91,9 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } @@ -116,8 +122,8 @@ "description": "ID of the token to revoke" } ], - "summary": "Get Reward by Id", - "description": "Get a Reward from API ", + "summary": "Revoke Org API Token", + "description": "Revoke an Org API Token.", "responses": { "200": { "description": "Successful Response", @@ -134,6 +140,9 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } @@ -154,7 +163,7 @@ } ], "summary": "Create Customer Token", - "description": "Create a Customer Token via API ", + "description": "Create a bearer token for a particular customer. The returned token can be used in the `Authorization` header as a secure alternative to the broader API token. A Customer Token can only interact with resources under a particular customer. As an example, calling List Transactions with a customer bearer token will return only transactions within accounts under that particular customer.", "requestBody": { "description": "Create Customer Token Request", "required": true, @@ -182,6 +191,9 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } @@ -190,7 +202,6 @@ "post": { "tags": ["unit"], "operationId": "createCustomerTokenVerification", - "parameters": [ { "schema": { @@ -203,7 +214,7 @@ } ], "summary": "Create Customer Token Verification", - "description": "Create a Customer Token Verification via API ", + "description": "In order to increase security and prevent token theft, Unit supports two-factor authentication when creating a customer token. When creating a customer token that contains a scope which requires two-factor authentication, it is required to first create a verification challenge that will be sent to the customer. The challenge is a six digits code and is valid for 10 minutes after its creation.", "requestBody": { "description": "Create Customer Token Verification Request", "required": true, @@ -231,6 +242,9 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } diff --git a/schemas/transaction/transactionPaths.json b/schemas/transaction/transactionPaths.json index d0073bb..0bfc21f 100644 --- a/schemas/transaction/transactionPaths.json +++ b/schemas/transaction/transactionPaths.json @@ -1,10 +1,12 @@ { "listTransactions": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getTransactionsList", "summary": "Get List Transactions", - "description": "Get List Transactions from API ", + "description": "Get a list of transactions. A transaction is an individual entry that represents a financial movement within an account. The `Transaction` resource represents a confirmed financial transaction that were posted to the account, including its source, amount, and direction.", "parameters": [ { "$ref": "../types.json#/components/schemas/PageQuery" @@ -18,55 +20,73 @@ "type": "object", "properties": { "accountId": { - "type": "string" + "type": "string", + "description": "Filter by Account id." }, "customerId": { - "type": "string" + "type": "string", + "description": "Filter by Customer id." }, "query": { - "type": "string" + "type": "string", + "description": "Full text search query. If the field should contain a space, we follow the [Full-Text Search Rules](https://www.unit.co/docs/api/#full-text-search)." }, "tags": { "type": "object", + "description": "Filter Transactions by [Tags](https://www.unit.co/docs/api/#tags).", "additionalProperties": { "type": "string" } }, "since": { - "type": "string" + "type": "string", + "format": "date-time", + "description": "Filters the Transactions that occurred _after_ the specified date. e.g. 2020-01-13T16:01:19.346Z" }, "until": { - "type": "string" + "type": "string", + "format": "date-time", + "description": "Filters the Transactions that occurred _before_ the specified date. e.g. 2020-01-02T20:06:23.486Z" }, "cardId": { - "type": "string" + "type": "string", + "description": "Filters the results by the specified card id." }, "excludeFees": { - "type": "boolean" + "type": "boolean", + "description": "Filter Fee type Transactions." }, "type": { "type": "array", + "description": "Filter Transactions by Transaction type. Possible values include: OriginatedAch, ReceivedAch, ReturnedAch, DishonoredAch, Book, Purchase, Atm, Fee, Reversal, CardTransaction, BatchRelease, Wire, ReturnedWire, Dispute, Adjustment, Interest, Reward, CheckDeposit, ReturnedCheckDeposit, PaymentCanceled, CustomerRepayment.", "items": { "type": "string" } }, "direction": { "type": "array", + "description": "Filter Transactions by direction (Debit, Credit).", "items": { "type": "string", - "enum": ["Debit", "Credit"] + "enum": [ + "Debit", + "Credit" + ] } }, "fromAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "Filters the Transactions that have an amount that is _higher or equal to_ the specified amount (in cents). e.g. 5000" }, "toAmount": { "type": "integer", - "format": "int64" + "format": "int64", + "description": "Filters the Transactions that have an amount that is _lower or equal to_ the specified amount (in cents). e.g. 7000" }, "accountType": { - "type": "string" + "type": "string", + "description": "Filter Transactions by account type (deposit, credit)." } } } @@ -74,13 +94,16 @@ { "name": "sort", "in": "query", + "description": "Optional. Leave empty or provide sort=createdAt for ascending order. Provide sort=-createdAt (leading minus sign) for descending order.", "schema": { - "type": "string" + "type": "string", + "default": "sort=createdAt" } }, { "name": "include", "in": "query", + "description": "Optional. A comma-separated list of related resources to include in the response. Related resources include: customer, account. See [Getting Related Resources](https://www.unit.co/docs/api/about-jsonapi/#intro-getting-related-resources)", "schema": { "type": "string" } @@ -102,24 +125,42 @@ } }, "included": { - "$ref": "../types.json#/components/schemas/IncludedResource" + "allOf": [ + { + "$ref": "../types.json#/components/schemas/IncludedResource" + }, + { + "description": "Array of resources requested by the include query parameter." + } + ] }, "meta": { - "$ref": "../types.json#/components/schemas/PaginationMeta" + "allOf": [ + { + "$ref": "../types.json#/components/schemas/PaginationMeta" + }, + { + "description": "Optional. Will be defined only when filtered by customer or account id. Pagination data includes offset, limit and total (estimated total items)." + } + ] } } } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } }, "transaction": { "get": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "getTransaction", - "parameters": [ { "schema": { @@ -141,7 +182,7 @@ } ], "summary": "Get Transaction by Id", - "description": "Get a Transaction from API ", + "description": "Get a Transaction from API", "responses": { "200": { "description": "Successful Response", @@ -161,15 +202,19 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, "patch": { - "tags": ["unit"], + "tags": [ + "unit" + ], "operationId": "updateTransaction", - - "summary": "Update Transaction", - "description": "Update a Transaction via API ", + "summary": "Update Tags Transaction", + "description": "Update Tags Transaction", "parameters": [ { "schema": { @@ -217,8 +262,64 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" + } + } + } + }, + "transactionById": { + "patch": { + "tags": [ + "unit" + ], + "operationId": "updateTransactionById", + "summary": "Update Transaction", + "description": "Update Transaction. This endpoint supports updating Book Transaction and Chargeback Transaction.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "transactionId", + "in": "path", + "required": true, + "description": "ID of the transaction to update" + } + ], + "requestBody": { + "description": "Update Transaction Request", + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "./updateTransaction.json#/components/schemas/UpdateTransactionRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json": { + "schema": { + "type": "object", + "title": "Unit Transaction Response", + "properties": { + "data": { + "$ref": "./transaction.json#/components/schemas/Transaction" + } + } + } + } + } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } } -} +} \ No newline at end of file diff --git a/schemas/transaction/updateTransaction.json b/schemas/transaction/updateTransaction.json index a2901da..60e45b5 100644 --- a/schemas/transaction/updateTransaction.json +++ b/schemas/transaction/updateTransaction.json @@ -26,7 +26,10 @@ "type": "object", "properties": { "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "See [Updating Tags](https://www.unit.co/docs/api/#updating-tags)." } + ] } }, "additionalProperties": false, @@ -49,10 +52,14 @@ "type": "object", "properties": { "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "See [Updating Tags](https://www.unit.co/docs/api/#updating-tags)." } + ] }, "summary": { - "type": "string" + "type": "string", + "description": "Summary of the transaction." } }, "additionalProperties": false @@ -77,10 +84,14 @@ "type": "object", "properties": { "tags": { - "$ref": "../types.json#/components/schemas/Tags" + "allOf": [ + { "$ref": "../types.json#/components/schemas/Tags" }, + { "description": "See [Updating Tags](https://www.unit.co/docs/api/#updating-tags)." } + ] }, "summary": { - "type": "string" + "type": "string", + "description": "Summary of the transaction." } }, "additionalProperties": false diff --git a/schemas/types.json b/schemas/types.json index 1955d0f..22c0039 100644 --- a/schemas/types.json +++ b/schemas/types.json @@ -61,6 +61,34 @@ "type": "string", "nullable": true }, + "TotalAccruedInterest": { + "title": "Total Accrued Interest", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["totalAccruedInterest"] + }, + "attributes": { + "type": "object", + "properties": { + "amount": { + "type": "integer", + "description": "The sum of customer accrued interest (in cents) for a given period of time." + } + }, + "required": [ + "amount" + ], + "additionalProperties": false + } + }, + "required": [ + "type", + "attributes" + ], + "additionalProperties": false + }, "Contact": { "title": "Contact", "type": "object", @@ -170,22 +198,27 @@ "type": "object", "properties": { "name": { - "type": "string" + "type": "string", + "description": "The name of the merchant." }, "type": { - "type": "integer" + "type": "integer", + "description": "The 4-digit ISO 18245 merchant category code (MCC)." }, "category": { - "type": "string" + "type": "string", + "description": "The merchant category." }, "location": { - "type": "string" + "type": "string", + "description": "The location of the merchant." }, "id": { - "type": "string" + "type": "string", + "description": "The merchant ID." } }, - "required": ["name", "type", "category"], + "required": ["name", "type"], "additionalProperties": false }, "PlaidProcessorToken": { @@ -197,36 +230,134 @@ "AuthorizedUser": { "title": "Authorized User", "type": "object", + "description": "Authorized Users represent individuals that have full access to the Customer's financials - they are able to authenticate and create a Customer Token and initiate any activity on behalf of the customer. This feature is used mostly in Business customers and Sole Proprietors, where the customer is a Business that can have multiple individuals managing its financials. Additionally, Authorized Users have access to all customer accounts through exchange networks, such as Plaid, enabling seamless financial data integration.", "properties": { - "fullName": { - "$ref": "#/components/schemas/FullName" + "type": { + "type": "string", + "enum": ["authorizedUser"] }, - "email": { - "$ref": "#/components/schemas/Email" + "id": { + "type": "string" }, - "phone": { - "$ref": "#/components/schemas/Phone" + "attributes": { + "type": "object", + "properties": { + "fullName": { + "$ref": "#/components/schemas/FullName" + }, + "email": { + "$ref": "#/components/schemas/Email" + }, + "phone": { + "$ref": "#/components/schemas/Phone" + }, + "jwtSubject": { + "$ref": "#/components/schemas/JwtSubject" + }, + "status": { + "type": "string", + "enum": ["Enabled", "Disabled"], + "description": "Status of the authorized user, either Enabled or Disabled." + }, + "createdAt": { + "type": "string", + "format": "date-time", + "description": "The date and time when the authorized user was created." + }, + "evaluationStatus": { + "type": "string", + "enum": ["Evaluated"], + "description": "The evaluation status of the authorized user." + }, + "evaluationId": { + "type": "string", + "description": "The ID of the evaluation." + }, + "alertId": { + "type": "string", + "description": "The ID of the alert." + } + }, + "required": ["fullName", "email", "phone"] }, - "jwtSubject": { - "$ref": "#/components/schemas/JwtSubject" + "relationships": { + "type": "object", + "properties": { + "customer": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["customer"] + }, + "id": { + "type": "string" + } + } + } + } + }, + "org": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["org"] + }, + "id": { + "type": "string" + } + } + } + } + }, + "banks": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["banks"] + }, + "id": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } } }, - "additionalProperties": false, - "required": ["fullName", "email", "phone"] + "additionalProperties": false }, "DeviceFingerprint": { "type": "object", "properties": { "provider": { "type": "string", - "enum": ["iovation"] + "enum": ["iovation"], + "description": "The name of the device fingerprint provider." }, "value": { - "type": "string" + "type": "string", + "description": "The device fingerprint string value (e.g. Iovation blackbox)." } }, "additionalProperties": false, - "required": ["provider", "value"] + "required": ["provider", "value"], + "description": "A Device fingerprint is a way to combine certain attributes of a device (operating system, IP address, device language settings etc.) in order to identify unique devices." }, "PaginationMeta": { "type": "object", @@ -572,24 +703,26 @@ "required": ["fullName"] }, "IncludedResource": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "attributes": { - "type": "object" - }, - "relationships": { - "type": "object" - } + "oneOf": [ + { + "$ref": "../schemas/account/account.json#/components/schemas/Account" + }, + { + "$ref": "../schemas/customer/customer.json#/components/schemas/Customer" + }, + { + "$ref": "../schemas/application/application.json#/components/schemas/Application" + }, + { + "$ref": "../schemas/transaction/transaction.json#/components/schemas/Transaction" + }, + { + "$ref": "../schemas/card/card.json#/components/schemas/Card" + }, + { + "$ref": "../schemas/card/mobileWalletPayload.json#/components/schemas/MobileWalletPayload" } - } + ] }, "BaseWeeklySchedule": { "title": "Weekly Schedule", @@ -597,24 +730,29 @@ "properties": { "startTime": { "type": "string", - "format": "date" + "format": "date", + "description": "Optional. The start date for the recurring payment schedule. If not provided, defaults to the current date." }, "endTime": { "type": "string", - "format": "date" + "format": "date", + "description": "Optional. The end date for the recurring payment schedule. If not provided, the recurring payment will run until manually disabled." }, "dayOfMonth": { "type": "integer", "minimum": -5, - "maximum": 28 + "maximum": 28, + "description": "Specifies the day of the month when the payment should be executed. Values 1-28 are specific calendar days. Negative values count backward from the end of the month (-1 is the last day, -2 is the second-to-last day, etc.)." }, "nextScheduledAction": { "type": "string", - "format": "date" + "format": "date", + "description": "The next date when the payment will be executed according to the schedule." }, "totalNumberOfPayments": { "type": "integer", - "minimum": 1 + "minimum": 1, + "description": "Optional. The total number of payments to be executed. If not provided, the payments will continue until the end date or until the recurring payment is disabled." } }, "additionalProperties": false, @@ -625,16 +763,19 @@ "properties": { "startTime": { "type": "string", - "format": "date" + "format": "date", + "description": "Optional. The start date for the recurring payment schedule. If not provided, defaults to the current date." }, "endTime": { "type": "string", - "format": "date" + "format": "date", + "description": "Optional. The end date for the recurring payment schedule. If not provided, the recurring payment will run until manually disabled." }, "dayOfMonth": { "type": "integer", "minimum": -5, - "maximum": 28 + "maximum": 28, + "description": "Specifies the day of the month when the payment should be executed. Values 1-28 are specific calendar days. Negative values count backward from the end of the month (-1 is the last day, -2 is the second-to-last day, etc.)." }, "dayOfWeek": { "type": "string", @@ -646,11 +787,13 @@ "Thursday", "Friday", "Saturday" - ] + ], + "description": "Specifies the day of the week when the payment should be executed." }, "totalNumberOfPayments": { "type": "integer", - "minimum": 1 + "minimum": 1, + "description": "Optional. The total number of payments to be executed. If not provided, the payments will continue until the end date or until the recurring payment is disabled." } }, "additionalProperties": false @@ -665,7 +808,8 @@ "interval": { "type": "string", "enum": ["Weekly"], - "default": "Weekly" + "default": "Weekly", + "description": "Specifies the frequency of the recurring payment as weekly." } }, "required": ["interval"] @@ -684,7 +828,8 @@ "interval": { "type": "string", "enum": ["Monthly"], - "default": "Monthly" + "default": "Monthly", + "description": "Specifies the frequency of the recurring payment as monthly." } }, "required": ["interval"] @@ -693,6 +838,7 @@ }, "Schedule": { "title": "Schedule", + "description": "The schedule will determine details about the patterns (frequency and execution time) of the future payments that are part of the Recurring Payments. Times in Recurring Payments are in EST.", "oneOf": [ { "$ref": "#/components/schemas/WeeklySchedule" }, { "$ref": "#/components/schemas/MonthlySchedule" } @@ -729,10 +875,12 @@ }, "ResponseSchedule": { "type": "object", + "description": "The schedule in the response resource will include additional fields compared to the input fields that were passed by the user initially. In case the start time was not defined, the start time will be set to the current time. In case the end time was not set, the recurring payment will run until it is manually disabled. Recurring payments will be executed by the end of each day.", "properties": { "interval": { "type": "string", - "enum": ["Weekly", "Monthly"] + "enum": ["Weekly", "Monthly"], + "description": "Specifies the frequency of the recurring payment." } }, "discriminator": { @@ -752,6 +900,16 @@ "type": "string", "minLength": 1, "maxLength": 255 + }, + "LendingProgramType": { + "type": "string", + "title": "Lending Program Type", + "description": "The type of a lending program.", + "enum": [ + "BankSponsoredBusinessChargeCard", + "ClientSponsoredBusinessChargeCard", + "ReceivablesRetention" + ] } } } diff --git a/schemas/webhook/updateWebhook.json b/schemas/webhook/updateWebhook.json index 867405d..72851af 100644 --- a/schemas/webhook/updateWebhook.json +++ b/schemas/webhook/updateWebhook.json @@ -8,19 +8,52 @@ "type": "object", "properties": { "type": { - "type": "string" + "type": "string", + "enum": ["webhook"], + "default": "webhook" }, "attributes": { "type": "object", "properties": { + "label": { + "type": "string", + "description": "A label describing the webhook." + }, + "url": { + "type": "string", + "description": "The URL of the webhook endpoint." + }, + "contentType": { + "type": "string", + "enum": ["Json", "JsonAPI"], + "description": "The type of content you wish to receive. Either Json or JsonAPI." + }, + "token": { + "type": "string", + "description": "The secret token (see https://www.unit.co/docs/api/webhooks/#securing-your-webhooks)." + }, + "includeResources": { + "type": "boolean", + "description": "Indicates whether to include full resource in events payload.", + "default": false + }, + "subscriptionType": { + "type": "string", + "enum": ["All", "OnlyAuthorizationRequest", "NotAuthorizationRequest"], + "description": "Optional. specify the subscription type. Default: All. Either 'All' or 'OnlyAuthorizationRequest' or 'NotAuthorizationRequest'(see https://www.unit.co/docs/api/webhooks/#subscription-types).", + "default": "All" + }, "tags": { "$ref": "../types.json#/components/schemas/Tags" } - } + }, + "additionalProperties": false } - } + }, + "required": ["type", "attributes"] } - } + }, + "required": ["data"] } } } diff --git a/schemas/webhook/webhook.json b/schemas/webhook/webhook.json index e3a7dd0..8bb586b 100644 --- a/schemas/webhook/webhook.json +++ b/schemas/webhook/webhook.json @@ -21,27 +21,41 @@ "format": "date-time" }, "label": { - "type": "string" + "type": "string", + "description": "A label describing the webhook." }, "url": { - "type": "string" + "type": "string", + "description": "The URL of the webhook endpoint." }, "status": { - "type": "string" + "type": "string", + "enum": ["Enabled", "Disabled", "Unavailable"] }, "contentType": { "type": "string", - "enum": ["Json", "JsonAPI"] + "enum": ["Json", "JsonAPI"], + "description": "The type of content you wish to receive. Either Json or JsonAPI." }, "deliveryMode": { "type": "string", - "enum": ["AtMostOnce", "AtLeastOnce"] + "enum": ["AtMostOnce", "AtLeastOnce"], + "description": "The attempted delivery mode of the webhook. Either AtMostOnce or AtLeastOnce." }, "token": { - "type": "string" + "type": "string", + "description": "The secret token (see https://www.unit.co/docs/api/webhooks/#securing-your-webhooks)." + }, + "includeResources": { + "type": "boolean", + "default": false, + "description": "Optional. Default: false. Indicates whether to include full resource in events payload." }, "subscriptionType": { - "type": "string" + "type": "string", + "enum": ["All", "OnlyAuthorizationRequest", "NotAuthorizationRequest"], + "default": "All", + "description": "Optional. specify the subscription type. Default: All. Either 'All' or 'OnlyAuthorizationRequest' or 'NotAuthorizationRequest'(see https://www.unit.co/docs/api/webhooks/#subscription-types)." } } } diff --git a/schemas/webhook/webhookPaths.json b/schemas/webhook/webhookPaths.json index aba1a22..83e5b31 100644 --- a/schemas/webhook/webhookPaths.json +++ b/schemas/webhook/webhookPaths.json @@ -16,9 +16,8 @@ "get": { "tags": ["unit"], "operationId": "getWebhooksList", - - "summary": "Get List Webhooks", - "description": "Get List Webhooks from API ", + "summary": "List Webhooks", + "description": "List webhook resources. Paging can be applied.", "parameters": [ { "$ref": "../types.json#/components/schemas/PageQuery" @@ -32,16 +31,22 @@ "type": "object", "properties": { "since": { - "type": "string" + "type": "string", + "format": "date-time", + "description": "Optional. Filters the results that occurred after the specified date. e.g. 2020-01-13T16:01:19.346Z" }, "until": { - "type": "string" + "type": "string", + "format": "date-time", + "description": "Optional. Filters the results that occurred before the specified date. e.g. 2020-01-02T20:06:23.486Z" }, "fromId": { - "type": "integer" + "type": "integer", + "description": "Optional. Filters the results that have an id that is higher or equal to the specified id. e.g. 17421" }, "toId": { - "type": "integer" + "type": "integer", + "description": "Optional. Filters the results that have an id that is lower or equal to the specified id. e.g. 17432" } } } @@ -51,7 +56,8 @@ "in": "query", "schema": { "type": "string" - } + }, + "description": "Optional. Sort order for results." } ], "responses": { @@ -73,6 +79,9 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, @@ -80,7 +89,7 @@ "tags": ["unit"], "operationId": "createWebhook", "summary": "Create Webhook", - "description": "Create a Webhook via API ", + "description": "Creates a webhook. A new webhook will not be created if there are already 100 webhooks with the status 'Enabled'. Please disable existing webhooks to proceed. Occurs only in the Sandbox environment.", "requestBody": { "description": "Create Webhook Request Body", "required": true, @@ -101,37 +110,47 @@ "type": "object", "properties": { "label": { - "type": "string" + "type": "string", + "description": "A label describing the webhook." }, "url": { - "type": "string" + "type": "string", + "description": "The URL of the webhook endpoint." }, "token": { - "type": "string" + "type": "string", + "description": "The secret token (see https://www.unit.co/docs/api/webhooks/#securing-your-webhooks)." }, "contentType": { "type": "string", - "enum": ["Json", "JsonAPI"] + "enum": ["Json", "JsonAPI"], + "description": "The type of content you wish to receive. Either Json or JsonAPI." }, "deliveryMode": { - "type": "string" + "type": "string", + "enum": ["AtMostOnce", "AtLeastOnce"], + "description": "The attempted delivery mode of the webhook. Either AtMostOnce or AtLeastOnce." }, "includeResources": { - "type": "boolean" + "type": "boolean", + "default": false, + "description": "Optional. Default: false. Indicates whether to include full resource in events payload." }, "subscriptionType": { "type": "string", "enum": [ "All", - "OnlyAuthorizationRequest" - ] + "OnlyAuthorizationRequest", + "NotAuthorizationRequest" + ], + "default": "All", + "description": "Optional. specify the subscription type. Default: All. Either 'All' or 'OnlyAuthorizationRequest' or 'NotAuthorizationRequest'(see https://www.unit.co/docs/api/webhooks/#subscription-types)." } }, "additionalProperties": false, "required": [ "label", "url", - "token", "contentType", "deliveryMode" ] @@ -153,6 +172,9 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } @@ -161,7 +183,6 @@ "get": { "tags": ["unit"], "operationId": "getWebhook", - "parameters": [ { "schema": { @@ -173,8 +194,8 @@ "description": "ID of the webhook to get" } ], - "summary": "Get Webhook Id", - "description": "Get a Webhook from API ", + "summary": "Get Webhook by Id", + "description": "Get a webhook resource by id.", "responses": { "200": { "description": "Successful Response", @@ -185,6 +206,9 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } }, @@ -192,7 +216,7 @@ "tags": ["unit"], "operationId": "updateWebhook", "summary": "Update Webhook", - "description": "Update a Webhook via API ", + "description": "Update a webhook.", "parameters": [ { "schema": { @@ -216,7 +240,7 @@ } }, "responses": { - "201": { + "200": { "description": "Successful Response", "content": { "application/vnd.api+json": { @@ -225,6 +249,9 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } @@ -233,7 +260,6 @@ "post": { "tags": ["unit"], "operationId": "enableWebhook", - "summary": "Enable Webhook", "parameters": [ { @@ -246,7 +272,7 @@ "description": "ID of the webhook to enable" } ], - "description": "Enable a Webhook via API ", + "description": "Enable a webhook. A webhook cannot be enabled if there are already 100 webhooks with the status 'Enabled'. Please disable an existing webhook before enabling a new one. Occurs only in the Sandbox environment.", "responses": { "200": { "description": "Successful Response", @@ -257,6 +283,9 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } @@ -265,8 +294,7 @@ "post": { "tags": ["unit"], "operationId": "disableWebhook", - - "summary": "Disable a Webhook", + "summary": "Disable Webhook", "parameters": [ { "schema": { @@ -278,7 +306,7 @@ "description": "ID of the webhook to disable" } ], - "description": "Disable a Webhook via API ", + "description": "Disable a webhook. Webhooks that have been disabled or become `Unavailable` due to inactivity may be enabled.", "responses": { "200": { "description": "Successful Response", @@ -289,6 +317,9 @@ } } } + }, + "default": { + "$ref": "../types.json#/components/schemas/DefaultError" } } } diff --git a/scripts/common.ts b/scripts/common.ts new file mode 100644 index 0000000..391229e --- /dev/null +++ b/scripts/common.ts @@ -0,0 +1,24 @@ +export type Parameter = { + name: string, + in?: "query" | string, + style?: "deepObject" | string, + $ref?: string +} + +export type Operation = { + operationId: string; + parameters?: Parameter[] +} + +export type BundledSchema = { + paths: { + [key: string]: { + [key: string]: Operation + } + } + components?: { + parameters?: { + [key: string]: Parameter + } + } +} diff --git a/scripts/java/addVersionHeaderToApiClient.ts b/scripts/java/addVersionHeaderToApiClient.ts index 97ec169..92462c9 100644 --- a/scripts/java/addVersionHeaderToApiClient.ts +++ b/scripts/java/addVersionHeaderToApiClient.ts @@ -1,4 +1,5 @@ -import { getPathCmdParameter, loadDotenv, openJavaFile } from "./utils"; +import { loadDotenv } from "../utils"; +import { getJavaPathCmdParameter, openJavaFile } from "./javaUtils"; import fs from "fs"; function addVersionHeadersToApiClient(data: string): string { @@ -32,7 +33,7 @@ function execute() { try { console.log("Adding version header to ApiClient..."); - const path = getPathCmdParameter(); + const path = getJavaPathCmdParameter(); const data = openJavaFile(path); const processedData = addVersionHeadersToApiClient(data); console.log("Added version header to ApiClient!"); diff --git a/scripts/java/fixFileRelatedGetRequests.ts b/scripts/java/fixFileRelatedGetRequests.ts index 8a87d80..ad7b378 100644 --- a/scripts/java/fixFileRelatedGetRequests.ts +++ b/scripts/java/fixFileRelatedGetRequests.ts @@ -1,5 +1,5 @@ import fs from "fs"; -import { getPathCmdParameter, openJavaFile } from "./utils"; +import { getJavaPathCmdParameter, openJavaFile } from "./javaUtils"; function fixFileRelatedGetRequests(data: string): string { const mainFunctionNameRegex = /(File )(get|download)/gm; @@ -76,7 +76,7 @@ import java.net.URI;` function execute() { try { console.log("Fixing file related get requests..."); - const path = getPathCmdParameter(); + const path = getJavaPathCmdParameter(); const data = openJavaFile(path); const processedData = fixFileRelatedGetRequests(data); console.log("Fixed file related get requests!"); diff --git a/scripts/java/javaUtils.ts b/scripts/java/javaUtils.ts new file mode 100644 index 0000000..4dc7ea5 --- /dev/null +++ b/scripts/java/javaUtils.ts @@ -0,0 +1,9 @@ +import { openFile, getPathCmdParameter as getGenericPathCmdParameter } from "../utils"; + +export function openJavaFile(path: string): string { + return openFile(path, "java"); +} + +export function getJavaPathCmdParameter(): string { + return getGenericPathCmdParameter("java"); +} diff --git a/scripts/java/utils.ts b/scripts/java/utils.ts deleted file mode 100644 index 3862452..0000000 --- a/scripts/java/utils.ts +++ /dev/null @@ -1,31 +0,0 @@ -import fs from "fs"; -import dotenv from "dotenv"; - -export function loadDotenv() { - dotenv.config(); -} - -export function openJavaFile(path: string): string { - if (!path.includes(".java")) { - throw new Error("Path must lead to a java file!"); - } - - return fs.readFileSync(path, "utf-8"); -} - -export function getPathCmdParameter(): string { - const pathArg = process.argv.find((val) => val.includes("--path=")); - - if (pathArg == null) { - throw new Error( - `Undefined path! Don't forget to specify the path, e.g. "...fixFileRelatedGetRequests.ts ./TargetFile.java"` - ); - } - - const path = pathArg?.replace("--path=", ""); - if (!path.includes(".java")) { - throw new Error("Path must lead to a java file!"); - } - - return path; -} diff --git a/scripts/python/fixDeepObjectQueryParams.ts b/scripts/python/fixDeepObjectQueryParams.ts new file mode 100644 index 0000000..8c9bb30 --- /dev/null +++ b/scripts/python/fixDeepObjectQueryParams.ts @@ -0,0 +1,172 @@ +import fs from "fs"; +import { openPythonFile, getPythonPathCmdParameter } from "./pythonUtils"; +import { getPathCmdParameter, openJsonFile } from "../utils"; +import { BundledSchema } from "../common"; + +function fixDeepObjectQueryParamsApiClient(data: string): string { + const apiClientParamSerializerRegex = /_host=None,\s+_request_auth=None/gm; + const queryParamsConditionalRegex = /query_params,\s+collection_formats/gm; + const toQueryParamsRegex = /def parameters_to_url_query\(self, params, collection_formats\):/gm; + const toQueryParamsDocsRegex = /(def parameters_to_url_query[\s\S]*?)(:param dict collection_formats: Parameter collection formats)/gm; + const toQueryParamsConditionalRegex = /(def parameters_to_url_query[\s\S]*?)(if isinstance\(v, dict\):\s+v = json\.dumps\(v\))/gm; + const toQueryParamsFormatsRegex = /(def parameters_to_url_query[\s\S]*?)(if k in collection_formats:)/gm; + + let processedData = data; + + processedData = processedData.replace( + apiClientParamSerializerRegex, + match => `${match},\n deep_object_names=None` + ); + + processedData = processedData.replace( + queryParamsConditionalRegex, + match => `${match},\n deep_object_names` + ); + + processedData = processedData.replace( + toQueryParamsRegex, + `def parameters_to_url_query(self, params, collection_formats, deep_objects_names):\n` + ); + + processedData = processedData.replace( + toQueryParamsDocsRegex, + (_, prefix, docString) => `${prefix}${docString}\n :param list[str] deep_objects_names: Names of deep objects to properly detect and serialize them` + ); + + processedData = processedData.replace( + toQueryParamsConditionalRegex, + (_, prefix) => `${prefix}if k not in deep_objects_names and isinstance(v, dict):\n v = json.dumps(v)` + ); + + processedData = processedData.replace( + toQueryParamsFormatsRegex, + (_, prefix) => `${prefix}if k in deep_objects_names and isinstance(v, dict): + for key in v: + if isinstance(v[key], list): + for index, item in enumerate(v[key]): + new_params.append((f"{k}[{key}][{index}]", item)) + else: + new_params.append((f"{k}[{key}]", v[key])) + elif k in collection_formats:` + ); + + return processedData; +} + +function operationIdToPythonFunction(operationId: string): string { + return '_' + operationId.replace(/([A-Z])/g, '_$1').toLowerCase() + '_serialize'; +} + +function resolveRefParameter(schema: BundledSchema, refPath: string): any { + const path = refPath.replace('#/', '').split('/'); + + let current: any = schema; + for (const segment of path) { + if (current[segment] === undefined) { + return null; + } + current = current[segment]; + } + + return current; +} + +function findDeepObjectParameters(openApiData: string): Map { + const bundledSchema = JSON.parse(openApiData) as BundledSchema; + const result = new Map(); + + const deepObjectReusableParams = new Set(); + if (bundledSchema.components && bundledSchema.components.parameters) { + for (const paramName in bundledSchema.components.parameters) { + const param = bundledSchema.components.parameters[paramName]; + if (param.style === 'deepObject' && param.in === 'query' && param.name) { + deepObjectReusableParams.add(paramName); + } + } + } + + for (const path in bundledSchema.paths) { + const pathObj = bundledSchema.paths[path]; + + for (const method in pathObj) { + const operation = pathObj[method]; + + if (operation.operationId) { + const functionName = operationIdToPythonFunction(operation.operationId); + const deepObjectParams: string[] = []; + + if (operation.parameters) { + for (const param of operation.parameters) { + // Handle direct parameter definition + if (param.style === 'deepObject' && param.in === 'query' && param.name) { + deepObjectParams.push(param.name); + } + // Handle $ref to a parameter + else if (param.$ref) { + const resolvedParam = resolveRefParameter(bundledSchema, param.$ref); + if (resolvedParam && resolvedParam.style === 'deepObject' && resolvedParam.in === 'query' && resolvedParam.name) { + deepObjectParams.push(resolvedParam.name); + } + } + } + } + + if (deepObjectParams.length > 0) { + result.set(functionName, deepObjectParams); + } + } + } + } + + const totalParamCount = Array.from(result.values()).reduce((sum, params) => sum + params.length, 0); + + console.log("Found deep object parameters:", Array.from(result.entries()), + `\nFunctions with deep objects: ${result.size}, Total parameters: ${totalParamCount}`); + return result; +} + +function fixDeepObjectQueryParamsUnitApi(data: string, openApiData: string): string { + const deepObjectMap = findDeepObjectParameters(openApiData); + + let processedData = data; + + deepObjectMap.forEach((paramNames, functionName) => { + const functionRegex = new RegExp(`def ${functionName}\\([\\s\\S]*?return self\\.api_client\\.param_serialize\\([\\s\\S]*?_host=_host,\\s+_request_auth=_request_auth\\s+\\)`, 'g'); + + processedData = processedData.replace(functionRegex, (match) => { + if (match.includes('deep_object_names=')) { + return match; + } + + const deepObjectNames = JSON.stringify(paramNames); + return match.replace(/\s+\)$/, `,\n deep_object_names=${deepObjectNames}\n )`); + }); + }); + + return processedData; +} + +function execute() { + try { + console.log("Fixing deep object query parameters in api_client.py..."); + const path = getPythonPathCmdParameter(); + const apiClientData = openPythonFile(path); + const processedData = fixDeepObjectQueryParamsApiClient(apiClientData); + console.log("Fixed deep object query parameters in api_client.py!"); + + console.log("Fixing deep object query parameters in unit api..."); + const schemaPath = getPathCmdParameter("json", "schema"); + const openApiData = openJsonFile(schemaPath); + const unitApiPath = getPythonPathCmdParameter("unit-api"); + const unitApiData = openPythonFile(unitApiPath); + const processedUnitApiData = fixDeepObjectQueryParamsUnitApi(unitApiData, openApiData); + console.log("Fixed deep object query parameters in unit api!"); + + fs.writeFileSync(path, processedData); + fs.writeFileSync(unitApiPath, processedUnitApiData); + } catch (e) { + console.error(e); + } +} + +execute(); diff --git a/scripts/python/pythonUtils.ts b/scripts/python/pythonUtils.ts new file mode 100644 index 0000000..3431ba5 --- /dev/null +++ b/scripts/python/pythonUtils.ts @@ -0,0 +1,9 @@ +import { openFile, getPathCmdParameter as getGenericPathCmdParameter } from "../utils"; + +export function openPythonFile(path: string): string { + return openFile(path, "py"); +} + +export function getPythonPathCmdParameter(pathArgName = "path"): string { + return getGenericPathCmdParameter("py", pathArgName); +} \ No newline at end of file diff --git a/scripts/utils.ts b/scripts/utils.ts new file mode 100644 index 0000000..a2d54d2 --- /dev/null +++ b/scripts/utils.ts @@ -0,0 +1,36 @@ +import dotenv from "dotenv"; +import fs from "fs"; + +export function loadDotenv() { + dotenv.config(); +} + +export function openFile(path: string, fileType: string): string { + if (!path.includes(`.${fileType}`)) { + throw new Error(`Path must lead to a ${fileType} file!`); + } + + return fs.readFileSync(path, "utf-8"); +} + +export function getPathCmdParameter(fileType: string, pathArgName = "path"): string { + const pathArg = process.argv.find((val) => val.includes(`--${pathArgName}=`)); + + if (pathArg == null) { + throw new Error( + `Undefined path! Don't forget to specify the path, e.g. "...fixFileRelatedGetRequests.ts ./TargetFile.${fileType}"` + ); + } + + const path = pathArg?.replace(`--${pathArgName}=`, ""); + console.log(pathArgName, path); + if (!path.includes(`.${fileType}`)) { + throw new Error(`Path must lead to a ${fileType} file!`); + } + + return path; +} + +export function openJsonFile(path: string): string { + return openFile(path, "json"); +} \ No newline at end of file diff --git a/unit/e2e_tests/python/account_test.py b/unit/e2e_tests/python/account_test.py index 4f4b487..73b8ef4 100644 --- a/unit/e2e_tests/python/account_test.py +++ b/unit/e2e_tests/python/account_test.py @@ -3,10 +3,9 @@ from helpers.helpers import create_api_client, create_individual_application_request, \ create_business_application_request -from swagger_client import CreateApplicationApi, CreateAnAccountApi, \ - CreateDepositAccountAttributes, CreateDepositAccountRelationships, CreateDepositAccount, GetListAccountsApi, \ - GetAccountApi, CloseAnAccountApi, ReopenAnAccountApi, FreezeAnAccountApi, UnfreezeAccountApi, \ - CreateCreditAccountAttributes, CreateCreditAccount +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi +from dist.pythonsdk.openapi_client.models import CreateDepositAccountAttributes, CreateDepositAccountRelationships, CreateCreditAccountAttributes, \ + CreateCreditAccount, CreateDepositAccount class TestAccountApi(unittest.TestCase): @@ -20,11 +19,16 @@ def tearDown(self): pass def create_individual_customer(self): - app = CreateApplicationApi(self.api_client).execute(create_individual_application_request()).data + # Ensure that create_individual_application_request() returns the correct type + application_request = create_individual_application_request() + + # Pass the application_request directly to create_application + app = UnitApi.create_application(self.api_client).execute(application_request).data + return app.relationships.customer.data.id def create_business_customer(self): - app = CreateApplicationApi(self.api_client).execute(create_business_application_request()).data + app = UnitApi.create_application(self.api_client).execute(create_business_application_request()).data return app.relationships.customer.data.id def create_deposit_account(self): @@ -35,7 +39,7 @@ def create_deposit_account(self): "id": customer_id}}) req = CreateDepositAccount("depositAccount", attributes, relationships) - response = CreateAnAccountApi(self.api_client).execute({"data": req}) + response = UnitApi.create_account(self.api_client).execute({"data": req}) return response.data def create_credit_account_for_business(self): @@ -45,7 +49,7 @@ def create_credit_account_for_business(self): "id": customer_id}}) req = CreateCreditAccount("creditAccount", attributes, relationships) - response = CreateAnAccountApi(self.api_client).execute({"data": req}) + response = UnitApi.create_account(self.api_client).execute({"data": req}) return response.data @@ -61,7 +65,7 @@ def create_deposit_account_for_business(self): "id": customer_id}}) req = CreateDepositAccount("depositAccount", attributes, relationships) - response = CreateAnAccountApi(self.api_client).execute({"data": req}) + response = UnitApi.create_account(self.api_client).execute({"data": req}) return response.data def test_create_deposit_account(self): @@ -75,22 +79,22 @@ def test_create_business_deposit_account(self): assert account.type == "depositAccount" def test_list_accounts(self): - res = GetListAccountsApi(self.api_client).execute() #no unit response type + res = UnitApi.get_accounts_list(self.api_client).execute() #no unit response type for acc in res.data: assert acc.type == "depositAccount" def test_list_accounts(self): - res = GetListAccountsApi(self.api_client).execute() #no unit response type + res = UnitApi.get_accounts_list(self.api_client).execute() #no unit response type for acc in res.data: assert acc.type == "depositAccount" - response_account = GetAccountApi(self.api_client).execute(acc.id).data + response_account = UnitApi.get_account(self.api_client).execute(acc.id).data assert acc.type == response_account.type assert acc.id == response_account.id def close_account(self, close_reason="Fraud"): account_id = self.create_deposit_account().id - account = CloseAnAccountApi(self.api_client).execute({"data": { + account = UnitApi.close_account(self.api_client).execute({"data": { "type": "depositAccountClose", "attributes": { "reason": close_reason @@ -111,7 +115,7 @@ def test_reopen_account(self): account = self.close_account("ByCustomer") assert account.type == "depositAccount" - reopen_account = ReopenAnAccountApi(self.api_client).execute(account.id).data + reopen_account = UnitApi.reopen_account(self.api_client).execute(account.id).data assert reopen_account.id == account.id assert reopen_account.type == "depositAccount" assert reopen_account.attributes.status == "Open" @@ -121,7 +125,7 @@ def freeze_account(self): freeze_reason_text = "This is a test - SDK" - account = FreezeAnAccountApi(self.api_client).execute({"data": { + account = UnitApi.freeze_account(self.api_client).execute({"data": { "type": "accountFreeze", "attributes": { "reason": "Other", @@ -143,7 +147,7 @@ def test_unfreeze_account(self): account = self.freeze_account() assert account.type == "depositAccount" - reopen_account = UnfreezeAccountApi(self.api_client).execute(account.id).data + reopen_account = UnitApi.unfreeze_account(self.api_client).execute(account.id).data assert reopen_account.id == account.id assert reopen_account.type == "depositAccount" assert reopen_account.attributes.status == "Open" diff --git a/unit/e2e_tests/python/application_form_test.py b/unit/e2e_tests/python/application_form_test.py index 234aaa3..9cb28e6 100644 --- a/unit/e2e_tests/python/application_form_test.py +++ b/unit/e2e_tests/python/application_form_test.py @@ -1,20 +1,19 @@ import unittest -from e2e_tests.python.helpers.helpers import create_api_client -from swagger_client import GetListApplicationFormsApi - +from helpers.helpers import create_api_client +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi class TestApplicationFormApi(unittest.TestCase): """ApplicationFormApi unit test stubs""" def setUp(self): self.api_client = create_api_client() + self.unit_api = UnitApi(self.api_client) # Instantiate UnitApi with ApiClient def tearDown(self): pass def test_get_list_application_forms(self): - response = GetListApplicationFormsApi(self.api_client).execute() + response = self.unit_api.get_application_forms_list().execute() for w in response.data: assert w.type == "applicationForm" - diff --git a/unit/e2e_tests/python/application_test.py b/unit/e2e_tests/python/application_test.py index 25cef21..8d8c850 100644 --- a/unit/e2e_tests/python/application_test.py +++ b/unit/e2e_tests/python/application_test.py @@ -3,13 +3,12 @@ import base64 import unittest -from e2e_tests.python.helpers.helpers import create_api_client, create_individual_application_request,\ +from helpers.helpers import create_api_client, create_individual_application_request,\ create_business_application_request -from swagger_client import GetListApplicationsApi, CreateApplicationApi, CreateSoleProprietorApplication, \ - CreateSoleProprietorApplicationAttributes, Address, FullName, Phone, \ - CreateTrustApplication, CreateTrustApplicationAttributes, Grantor, Trustee, Beneficiary, TrustContact, \ - UploadAPNGDocumentForAnApplicationApi, UploadAJPEGDocumentForAnApplicationApi, UploadAPDFDocumentForAnApplicationApi -from swagger_client.api.get_application_api import GetApplicationApi # noqa: E501 +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi +from dist.pythonsdk.openapi_client.models import CreateDepositAccountAttributes, CreateDepositAccountRelationships, CreateCreditAccountAttributes, \ + CreateCreditAccount, CreateDepositAccount, Address, Phone, FullName, CreateSoleProprietorApplicationAttributes, \ + CreateSoleProprietorApplication ApplicationTypes = ["individualApplication", "businessApplication", "trustApplication"] @@ -24,12 +23,12 @@ def tearDown(self): pass def create_individual_application(self, ssn="721074426"): - app = CreateApplicationApi(self.api_client).execute(create_individual_application_request(ssn)) + app = UnitApi.create_application(self.api_client).execute(create_individual_application_request(ssn)) return app.data def create_individual_application_with_included(self, ssn="721074426"): - app = CreateApplicationApi(self.api_client).execute(create_individual_application_request(ssn)) + app = UnitApi.create_application(self.api_client).execute(create_individual_application_request(ssn)) return app @@ -39,7 +38,7 @@ def test_create_individual_application(self): assert res.type == "individualApplication" def test_find_application_by_id(self): - get_application_api = GetApplicationApi(self.api_client) + get_application_api = UnitApi.get_application(self.api_client) app = self.create_individual_application() res = get_application_api.execute(app.id).data @@ -48,7 +47,7 @@ def test_find_application_by_id(self): assert res.id == app.id def create_business_application(self): - app = CreateApplicationApi(self.api_client).execute(create_business_application_request()) + app = UnitApi.create_application(self.api_client).execute(create_business_application_request()) return app.data @@ -57,13 +56,13 @@ def test_create_business_application(self): assert response.type == "businessApplication" def test_list_applications(self): - res = GetListApplicationsApi(self.api_client).execute() + res = UnitApi.get_applications_list(self.api_client).execute() for app in res.data: assert app.type in ApplicationTypes def test_list_and_get_applications(self): - res = GetListApplicationsApi(self.api_client).execute() - get_application_api = GetApplicationApi(self.api_client) + res = UnitApi.get_applications_list(self.api_client).execute() + get_application_api = UnitApi.get_application(self.api_client) for app in res.data: assert app.type in ApplicationTypes @@ -79,7 +78,7 @@ def test_upload_png_document(self): image_file = open("unit_photo.png", 'rb').read() - res = UploadAPNGDocumentForAnApplicationApi(self.api_client).execute(image_file.decode('latin-1'), application_id, document_id) + res = UnitApi.upload_application_document_file(self.api_client).execute(image_file.decode('latin-1'), application_id, document_id) assert res.data.type == "document" def test_upload_jpg_document(self): @@ -90,7 +89,7 @@ def test_upload_jpg_document(self): image_file = open("Unit_Logo.jpg", "r", encoding='latin-1').read() - res = UploadAJPEGDocumentForAnApplicationApi(self.api_client).execute(str(image_file), application_id, document_id) + res = UnitApi.upload_application_document_file(self.api_client).execute(str(image_file), application_id, document_id) assert res.data.type == "document" def test_upload_pdf_document(self): @@ -101,70 +100,8 @@ def test_upload_pdf_document(self): image_file = open("sample.pdf", "r").read() - res = UploadAPDFDocumentForAnApplicationApi(self.api_client).execute(str(image_file), application_id, document_id) + res = UnitApi.upload_application_document_file(self.api_client).execute(str(image_file), application_id, document_id) assert res.data.type == "document" - def test_create_sole_proprietor_application(self): - address = Address(street="1600 Pennsylvania Avenue Northwest", city="Washington", state="CA", - postal_code="20500", - country="US") - attr = CreateSoleProprietorApplicationAttributes(FullName("Peter", "Parker"), "jone.doe1@unit-finance.com", - Phone("1", "2025550108"), "721074426", - address=address, date_of_birth="2001-08-10", - dba="Piedpiper Inc", ein="123456789", - annual_income="Between50kAnd100k", - source_of_income="EmploymentOrPayrollIncome", - annual_revenue="Between100kAnd200k", - sole_proprietorship=True, - number_of_employees="Between5And10", - business_vertical="TechnologyMediaOrTelecom", - jwt_subject="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9fQ") - - req = {"data": CreateSoleProprietorApplication(attributes=attr)} - - app = CreateApplicationApi(self.api_client).execute(req) - - assert app.data.type == "individualApplication" - - def test_create_trust_application(self): - address = Address(street="1600 Pennsylvania Avenue Northwest", city="Washington", state="CA", - postal_code="20500", - country="US") - full_name = FullName("Richard", "Hendricks") - - attr = CreateTrustApplicationAttributes("Trust me Inc.", "CA", "Revocable", "Salary", "123456789", - Grantor(full_name, "richard@piedpiper.com", - Phone("1", "2025550108"), "000000002", - date_of_birth="2000-01-01", address=address), - [Trustee(full_name, "richard@piedpiper.com", address=address, - date_of_birth="2000-01-01", ssn="000000002", - phone=Phone("1", "2025550108"))], - [Beneficiary(FullName("Dinesh","Chugtai"), "2000-01-01"), - Beneficiary(FullName("Gilfoyle","Unknown"), "2000-01-01")], - TrustContact(FullName("Jared","Dann"), "jared@piedpiper.com", - Phone("1", "2025550108"), - address=Address("5230 Newell Rd", "", "Palo Alto", "CA", - "94303"))) - - req = {"data": CreateTrustApplication(attributes=attr)} - - app = CreateApplicationApi(self.api_client).execute(req) - - assert app.data.type == "trustApplication" - - if __name__ == '__main__': - unittest.main() - - # def test_update_individual_application(): - # app = create_individual_application() - # updated = client.applications.update(PatchApplicationRequest(app.data.id, tags={"patch": "test-patch"})) - # assert updated.data.type == "individualApplication" - # - # def test_update_business_application(): - # app = create_business_application() - # updated = client.applications.update(PatchApplicationRequest(app.data.id, "businessApplication", - # tags={"patch": "test-patch"})) - # assert updated.data.type == "businessApplication" - diff --git a/unit/e2e_tests/python/authorization_request_test.py b/unit/e2e_tests/python/authorization_request_test.py index 5777dda..cc7952b 100644 --- a/unit/e2e_tests/python/authorization_request_test.py +++ b/unit/e2e_tests/python/authorization_request_test.py @@ -2,8 +2,8 @@ import unittest -from e2e_tests.python.helpers.helpers import create_api_client -from swagger_client import GetAuthorizationRequestApi, GetListAuthorizationRequestsApi +from helpers.helpers import create_api_client +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi class TestAuthorizationRequestsApi(unittest.TestCase): @@ -16,13 +16,13 @@ def tearDown(self): pass def test_list_authorization_requests(self): - res = GetListAuthorizationRequestsApi(self.api_client).execute() + res = UnitApi.get_authorizations_list(self.api_client).execute() for app in res.data: assert "AuthorizationRequest" in app.type def test_list_and_get_authorization_requests(self): - res = GetListAuthorizationRequestsApi(self.api_client).execute() - get_application_request_api = GetAuthorizationRequestApi(self.api_client) + res = UnitApi.get_authorizations_list(self.api_client).execute() + get_application_request_api = UnitApi.get_authorization_request(self.api_client) for app in res.data: assert "AuthorizationRequest" in app.type diff --git a/unit/e2e_tests/python/card_test.py b/unit/e2e_tests/python/card_test.py index 2944a8f..93b75f6 100644 --- a/unit/e2e_tests/python/card_test.py +++ b/unit/e2e_tests/python/card_test.py @@ -1,9 +1,16 @@ import os import unittest -from e2e_tests.python.helpers.helpers import * -from swagger_client import * - +from helpers.helpers import create_api_client, create_individual_application_request, \ + create_business_application_request, create_address +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi +from dist.pythonsdk.openapi_client.models import Address, CardLevelLimits, \ + CreateCardRelationships, Relationship, RelationshipData, CreateDepositAccountAttributes, \ + CreateDepositAccountRelationships, CreateDepositAccount, CreateIndividualDebitCardRequestAttributes, \ +CreateIndividualDebitCardRequest, CreateBusinessDebitCardRequestAttributes, \ +CreateBusinessDebitCardRequest, FullName, Phone, CreateBusinessVirtualDebitCardRequestAttributes,\ +CreateBusinessVirtualDebitCardRequest, CreateIndividualVirtualDebitCardRequestAttributes, CreateIndividualVirtualDebitCardRequest, \ + UpdateIndividualDebitCardAttributes, UpdateIndividualDebitCard card_types = ["individualDebitCard", "businessDebitCard", "individualVirtualDebitCard", "businessVirtualDebitCard", "businessCreditCard", "businessVirtualCreditCard"] @@ -11,7 +18,7 @@ headers = { "content-type": "application/vnd.api+json", "authorization": f"Bearer {os.environ.get('TOKEN')}", - "user-agent": "unit-python-sdk" + "user-agent": "unit-pythonsdk" } address = Address("5230 Newell Rd", city="Palo Alto", state="CA", postal_code="94303") @@ -32,7 +39,7 @@ def create_card_relationships(self, account_id: str, _type="depositAccount"): def card_list(self): - return GetListOfCardsApi(self.api_client).execute().data + return UnitApi.get_cards_list(self.api_client).execute().data def test_card_list(self): res = self.card_list() @@ -40,36 +47,36 @@ def test_card_list(self): assert card.type in card_types def test_card_list_and_get(self): - res = GetListOfCardsApi(self.api_client).execute() + res = UnitApi.get_cards_list(self.api_client).execute() assert res.included is None for card in res.data: assert card.type in card_types - response_card = GetCardApi(self.api_client).execute(card.id).data + response_card = UnitApi.get_card(self.api_client).execute(card.id).data assert card.id == response_card.id assert card.type == response_card.type def test_card_list_with_filters(self): - res = GetListOfCardsApi(self.api_client).execute(filter_status=["Active"], include="customer") + res = UnitApi.get_cards_list(self.api_client).execute(filter_status=["Active"], include="customer") assert res.included is not None for card in res.data: assert card.type in card_types assert card.attributes.status == "Active" - response_card = GetCardApi(self.api_client).execute(card.id).data + response_card = UnitApi.get_card(self.api_client).execute(card.id).data assert card.id == response_card.id assert card.type == response_card.type assert card.attributes.status == response_card.attributes.status assert card.attributes.created_at == response_card.attributes.created_at def create_individual_customer(self): - app = CreateApplicationApi(self.api_client).execute(create_individual_application_request()).data + app = UnitApi.create_application(self.api_client).execute(create_individual_application_request()).data return app.relationships.customer.data.id def create_business_customer(self): - app = CreateApplicationApi(self.api_client).execute(create_business_application_request()).data + app = UnitApi.create_application(self.api_client).execute(create_business_application_request()).data return app.relationships.customer.data.id def create_deposit_account(self): @@ -80,7 +87,7 @@ def create_deposit_account(self): "id": customer_id}}) req = CreateDepositAccount(attributes=attributes, relationships=relationships) - response = CreateAnAccountApi(self.api_client).execute({"data": req}) + response = UnitApi.create_account(self.api_client).execute({"data": req}) return response.data def create_deposit_account_for_business(self): @@ -91,15 +98,15 @@ def create_deposit_account_for_business(self): "id": customer_id}}) req = CreateDepositAccount(attributes=attributes, relationships=relationships) - response = CreateAnAccountApi(self.api_client).execute({"data": req}) + response = UnitApi.create_account(self.api_client).execute({"data": req}) return response.data def create_individual_debit_card(self): account_id = self.create_deposit_account().id - attributes = CreateIndividualDebitCardAttributes(address, limits=limits) - req = CreateIndividualDebitCard(attributes=attributes, relationships=self.create_card_relationships(account_id)) + attributes = CreateIndividualDebitCardRequestAttributes(address, limits=limits) + req = CreateIndividualDebitCardRequest(attributes=attributes, relationships=self.create_card_relationships(account_id)) - card = CreateACardApi(self.api_client).execute({"data": req}).data + card = UnitApi.create_card(self.api_client).execute({"data": req}).data return card def test_create_individual_debit_card(self): @@ -109,12 +116,12 @@ def test_create_individual_debit_card(self): def create_business_debit_card(self): account_id = self.create_deposit_account_for_business().id - attributes = CreateBusinessDebitCardAttributes(address, address, FullName("Richard", "Hendricks"), - Phone("1", "5555555555"), "richard@piedpiper.com", "2001-08-10", + attributes = CreateBusinessDebitCardRequestAttributes(address, address, FullName(first="Richard", last="Hendricks"), + Phone(country_code="1", number="5555555555"), "richard@piedpiper.com", "2001-08-10", limits=limits) - req = CreateBusinessDebitCard(attributes=attributes, relationships=self.create_card_relationships(account_id)) + req = CreateBusinessDebitCardRequest(attributes=attributes, relationships=self.create_card_relationships(account_id)) - card = CreateACardApi(self.api_client).execute({"data": req}).data + card = UnitApi.create_card(self.api_client).execute({"data": req}).data return card def test_create_business_debit_card(self): @@ -124,12 +131,12 @@ def test_create_business_debit_card(self): def create_business_virtual_debit_card(self): account_id = self.create_deposit_account_for_business().id - attributes = CreateBusinessVirtualDebitCardAttributes(address, FullName("Richard", "Hendricks"), + attributes = CreateBusinessVirtualDebitCardRequestAttributes(address, FullName("Richard", "Hendricks"), Phone("1", "5555555555"), "richard@piedpiper.com", "2001-08-10", limits=limits) - req = CreateBusinessVirtualDebitCard(attributes=attributes, relationships=self.create_card_relationships(account_id)) + req = CreateBusinessVirtualDebitCardRequest(attributes=attributes, relationships=self.create_card_relationships(account_id)) - card = CreateACardApi(self.api_client).execute({"data": req}).data + card = UnitApi.create_card(self.api_client).execute({"data": req}).data return card def test_create_business_virtual_debit_card(self): @@ -139,11 +146,11 @@ def test_create_business_virtual_debit_card(self): def create_individual_virtual_debit_card(self): account_id = self.create_deposit_account().id - attributes = CreateIndividualVirtualDebitCardAttributes(limits=limits) - req = CreateIndividualVirtualDebitCard(attributes=attributes, + attributes = CreateIndividualVirtualDebitCardRequestAttributes(limits=limits) + req = CreateIndividualVirtualDebitCardRequest(attributes=attributes, relationships=self.create_card_relationships(account_id)) - card = CreateACardApi(self.api_client).execute({"data": req}).data + card = UnitApi.create_card(self.api_client).execute({"data": req}).data return card def test_create_individual_virtual_debit_card(self): @@ -153,14 +160,14 @@ def test_create_individual_virtual_debit_card(self): def test_freeze_and_unfreeze_card(self): card = self.create_individual_debit_card() assert card.type == "individualDebitCard" - response = FreezeACardApi(self.api_client).execute(card.id).data + response = UnitApi.freeze_card(self.api_client).execute(card.id).data assert response.attributes.status == "Frozen" - response = UnfreezeACardApi(self.api_client).execute(card.id).data + response = UnitApi.unfreeze_card(self.api_client).execute(card.id).data assert response.attributes.status != "Frozen" def test_close_card(self): card = self.create_individual_debit_card() - response = CloseACardApi(self.api_client).execute(card.id).data + response = UnitApi.close_card(self.api_client).execute(card.id).data assert response.attributes.status == "ClosedByCustomer" # def test_replace_card(self): @@ -172,15 +179,15 @@ def test_close_card(self): def test_get_debit_card(self): card = self.create_individual_debit_card() - response = GetCardApi(self.api_client).execute(card.id) + response = UnitApi.get_card(self.api_client).execute(card.id) assert response.data.type in card_types def test_update_individual_card(self): card = self.create_individual_debit_card() _address = create_address("1818 Pennsylvania Avenue Northwest", "Washington", "CA", "21500", "US") - _attributes = PatchIndividualDebitCardAttributes(shipping_address=_address, tags={"test": "updated"}) - request = PatchIndividualDebitCard(type="individualDebitCard",attributes=_attributes) - response = UpdateCardApi(self.api_client).execute(card_id=card.id,body={"data": request}) + _attributes = UpdateIndividualDebitCardAttributes(shipping_address=_address, tags={"test": "updated"}) + request = UpdateIndividualDebitCard(type="individualDebitCard",attributes=_attributes) + response = UnitApi.update_card(self.api_client).execute(card_id=card.id,body={"data": request}) assert response.data.type == "individualDebitCard" def test_get_pin_status(self): @@ -191,7 +198,7 @@ def test_get_pin_status(self): if card_status == "active": card_id = card.id if card_id: - pin_status = GetCardPINStatusApi(self.api_client).execute(card_id=card_id) + pin_status = UnitApi.get_card_pin_status(self.api_client).execute(card_id=card_id) assert pin_status.type == "pinStatus" diff --git a/unit/e2e_tests/python/customer_test.py b/unit/e2e_tests/python/customer_test.py index 70d965f..841262d 100644 --- a/unit/e2e_tests/python/customer_test.py +++ b/unit/e2e_tests/python/customer_test.py @@ -1,7 +1,8 @@ import os import unittest -from e2e_tests.python.helpers.helpers import * -from swagger_client import * +from helpers.helpers import * +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi +from dist.pythonsdk.openapi_client.models import * CustomerTypes = ["individualCustomer", "businessCustomer"] @@ -30,12 +31,12 @@ def tearDown(self): pass def list_customers(self): - return GetListCustomersApi(self.api_client).execute() + return UnitApi.get_customers_list(self.api_client).execute() def test_get_customer(self): customers = self.list_customers() for customer in customers.data: - GetCustomerApi(self.api_client).execute(customer.id) + UnitApi.get_customer(self.api_client).execute(customer.id) assert customer.type in CustomerTypes def test_list_customers(self): @@ -48,7 +49,7 @@ def get_customer(self, customer_type='individualCustomer'): for customer in customers.data: if customer.type == customer_type: - return GetCustomerApi(self.api_client).execute(customer.id) + return UnitApi.get_customer(self.api_client).execute(customer.id) return None @@ -57,7 +58,7 @@ def test_update_individual_customer(self): _attributes = UpdateIndividualCustomerAttributes(address=_address, tags={"test": "updated"}) request = UpdateIndividualCustomer(type="individualCustomer", attributes=_attributes) - response = UpdateCustomerApi(self.api_client).execute(customer_id=self.get_customer().data.id, body={"data": request}) + response = UnitApi.update_customer(self.api_client).execute(customer_id=self.get_customer().data.id, body={"data": request}) assert response.data.type == "individualCustomer" if __name__ == '__main__': diff --git a/unit/e2e_tests/python/helpers/helpers.py b/unit/e2e_tests/python/helpers/helpers.py index 641b0bc..a921563 100644 --- a/unit/e2e_tests/python/helpers/helpers.py +++ b/unit/e2e_tests/python/helpers/helpers.py @@ -2,7 +2,8 @@ import os from dotenv import load_dotenv from datetime import date, timedelta -from swagger_client import configuration, api_client, Address, CreateIndividualApplicationAttributes, FullName, Phone \ +from dist.pythonsdk.openapi_client import (configuration, api_client) +from dist.pythonsdk.openapi_client.models import Address, CreateIndividualApplicationAttributes, FullName, Phone \ , CreateIndividualApplication, CreateBusinessApplication, CreateBusinessApplicationAttributes, BeneficialOwner, \ Contact, Officer, CreateBeneficialOwner @@ -32,14 +33,18 @@ def create_individual_application_request(ssn="721074426"): address = Address(street="1600 Pennsylvania Avenue Northwest", city="Washington", state="CA", postal_code="20500", country="US") - attr = CreateIndividualApplicationAttributes(FullName("Peter", "Parker"), "jone.doe1@unit-finance.com", - Phone("1", "2025550108"), ssn, + attr = CreateIndividualApplicationAttributes(full_name = FullName(first="Peter", last="Parker"),email = "jone.doe1@unit-finance.com", + phone =Phone(country_code = "1", number = "2025550108"), ssn = ssn, address=address, date_of_birth="2001-08-10", idempotency_key=str(uuid.uuid1()), jwt_subject="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9fQ", occupation="ArchitectOrEngineer") - return {"data": CreateIndividualApplication(attributes=attr)} + individual_application = CreateIndividualApplication( + type='individualApplication', # This must exactly match the expected enum value + attributes=attr # This should be an instance of CreateIndividualApplicationAttributes + ) + return {"data": individual_application} def create_business_application_request(): diff --git a/unit/e2e_tests/python/payment_test.py b/unit/e2e_tests/python/payment_test.py index 8b9301b..969d172 100644 --- a/unit/e2e_tests/python/payment_test.py +++ b/unit/e2e_tests/python/payment_test.py @@ -1,12 +1,8 @@ import unittest -from e2e_tests.helpers import create_api_client, create_individual_application_request, create_relationship, \ - create_counterparty_dto, create_wire_counterparty_dto -from swagger_client import CreateBookPayment, CreateBookPaymentAttributes, \ - CreateBookPaymentRelationships, CreateDepositAccountAttributes, CreateDepositAccountRelationships, \ - CreateDepositAccount, CreateAnAccountApi, CreateAPaymentApi, CreateApplicationApi, CreateAchPayment, \ - CreateAchPaymentAttributes, CreateAchPaymentRelationships, Address, CreateWirePayment, CreateWirePaymentAttributes, \ - CreateAchPaymentPlaid, CreateAchPaymentPlaidAttributes +from helpers.helpers import * +from dist.pythonsdk.openapi_client.models import * +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi class TestPaymentApi(unittest.TestCase): @@ -19,7 +15,7 @@ def tearDown(self): pass def create_individual_customer(self): - app = CreateApplicationApi(self.api_client).create_application(create_individual_application_request()).data + app = UnitApi.create_application(self.api_client).create_application(create_individual_application_request()).data return app.relationships.customer.data.id def create_deposit_account(self): @@ -30,7 +26,7 @@ def create_deposit_account(self): "id": customer_id}}) req = CreateDepositAccount("depositAccount", attributes, relationships) - response = CreateAnAccountApi(self.api_client).create_account({"data": req}) + response = UnitApi.create_account(self.api_client).create_account({"data": req}) return response.data.id # def test_get_payments_list(self): @@ -55,7 +51,7 @@ def test_create_book_payment(self): relationships = CreateBookPaymentRelationships(create_relationship("depositAccount", id1), create_relationship("depositAccount", id2)) req = CreateBookPayment("bookPayment", attributes, relationships) - res = CreateAPaymentApi(self.api_client).execute({"data": req}) + res = UnitApi.create_payment(self.api_client).execute({"data": req}) assert res.data.type == "bookPayment" @@ -67,7 +63,7 @@ def test_create_inline_ach_payment(self): relationships = CreateAchPaymentRelationships(create_relationship("depositAccount", account_id)) req = CreateAchPayment("achPayment", attributes, relationships) - res = CreateAPaymentApi(self.api_client).execute({"data": req}) + res = UnitApi.create_payment(self.api_client).execute({"data": req}) assert res.data.type == "achPayment" @@ -82,7 +78,7 @@ def test_create_wire_payment(self): req = CreateWirePayment("wirePayment", attributes, relationships) - res = CreateAPaymentApi(self.api_client).execute({"data": req}) + res = UnitApi.create_payment(self.api_client).execute({"data": req}) assert res.data.type == "wirePayment" @@ -95,7 +91,7 @@ def test_create_verified_ach_payment(self): relationships = CreateAchPaymentRelationships(create_relationship("depositAccount", account_id)) req = CreateAchPaymentPlaid("achPayment", attributes, relationships) - res = CreateAPaymentApi(self.api_client).execute({"data": req}) + res = UnitApi.create_payment(self.api_client).execute({"data": req}) assert res.data.type == "achPayment" diff --git a/unit/e2e_tests/python/repayment_test.py b/unit/e2e_tests/python/repayment_test.py index c6ba7a3..fe5f7b7 100644 --- a/unit/e2e_tests/python/repayment_test.py +++ b/unit/e2e_tests/python/repayment_test.py @@ -2,13 +2,9 @@ import unittest -from e2e_tests.python.helpers.helpers import create_api_client -from swagger_client import GetListRepaymentsApi, GetRepaymentApi, CreateBookRepaymentRelationships, Relationship, \ - RelationshipData -from swagger_client.api import CreateARepaymentApi -from swagger_client.models.create_book_repayment import CreateBookRepayment -from swagger_client.models.create_book_repayment_attributes import CreateBookRepaymentAttributes -from swagger_client.models.repayments_body import RepaymentsBody +from helpers.helpers import * +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi +from dist.pythonsdk.openapi_client.models import * class TestRepaymentsApi(unittest.TestCase): @@ -21,13 +17,13 @@ def tearDown(self): pass def test_list_repayments(self): - res = GetListRepaymentsApi(self.api_client).execute() + res = UnitApi.get_repayments_list(self.api_client).execute() for app in res.data: assert "Repayment" in app.type def test_list_and_get_repayments(self): - res = GetListRepaymentsApi(self.api_client).execute() - get_repayment_api = GetRepaymentApi(self.api_client) + res = UnitApi.get_repayments_list(self.api_client).execute() + get_repayment_api = UnitApi.get_repayment(self.api_client) for app in res.data: assert "Repayment" in app.type @@ -42,8 +38,8 @@ def test_create_book_repayment(self): Relationship(RelationshipData("1538445", "creditAccount")), Relationship(RelationshipData("447232", "account"))) data = CreateBookRepayment(attributes=attr, relationships=relationships) - body = RepaymentsBody(data) - res = CreateARepaymentApi(self.api_client).execute(body) + # body = RepaymentsBody(data) + res = UnitApi.create_repayment(self.api_client).execute(data) assert res.data.type == "bookRepayment" diff --git a/unit/e2e_tests/python/statement_test.py b/unit/e2e_tests/python/statement_test.py index 96086e4..06890fa 100644 --- a/unit/e2e_tests/python/statement_test.py +++ b/unit/e2e_tests/python/statement_test.py @@ -1,8 +1,8 @@ import unittest -from e2e_tests.python.helpers.helpers import create_api_client -from swagger_client import GetListStatementsApi, GetStatementPDFApi, GetStatementHTMLApi - +from helpers.helpers import * +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi +from dist.pythonsdk.openapi_client.models import * class TestStatementApi(unittest.TestCase): """StatementAPI unit test stubs""" @@ -14,18 +14,18 @@ def tearDown(self): pass def test_list_and_get_statements(self): - statements = GetListStatementsApi(self.api_client).execute().data + statements = UnitApi.get_statements_list(self.api_client).execute().data for s in statements: assert s.type == "accountStatementDTO" - pdf_statement = GetStatementPDFApi(self.api_client).execute(s.id) + pdf_statement = UnitApi.get_statement_pdf(self.api_client).execute(s.id) assert "PDF" in pdf_statement # account_id = s.relationships["account"].id # pdf_response = client.statements.get_bank_verification(account_id).data - html_statement = GetStatementHTMLApi(self.api_client).execute(s.id) + html_statement = UnitApi.get_statement_html(self.api_client).execute(s.id) assert "" in html_statement if __name__ == '__main__': diff --git a/unit/e2e_tests/python/transaction_test.py b/unit/e2e_tests/python/transaction_test.py index 2554d95..f36f484 100644 --- a/unit/e2e_tests/python/transaction_test.py +++ b/unit/e2e_tests/python/transaction_test.py @@ -1,8 +1,8 @@ import unittest -from e2e_tests.python.helpers.helpers import create_api_client -from swagger_client import GetListTransactionsApi - +from helpers.helpers import * +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi +from dist.pythonsdk.openapi_client.models import * class TestTransactionApi(unittest.TestCase): """TransactionApi unit test stubs""" @@ -14,7 +14,7 @@ def tearDown(self): pass def test_get_list_transactions(self): - response = GetListTransactionsApi(self.api_client).execute() + response = UnitApi.get_transactions_list(self.api_client).execute() for t in response.data: assert "Transaction" in t.type # res = GetPaymentApi(self.api_client).execute(p.id).data diff --git a/unit/e2e_tests/python/webhook_test.py b/unit/e2e_tests/python/webhook_test.py index ec4270d..25c4b20 100644 --- a/unit/e2e_tests/python/webhook_test.py +++ b/unit/e2e_tests/python/webhook_test.py @@ -1,9 +1,8 @@ import unittest -from e2e_tests.python.helpers.helpers import create_api_client -from swagger_client import GetListWebhooksApi, CreateWebhookApi -from swagger_client.models.webhooks_data import WebhooksData -from swagger_client.models.webhooks_data_attributes import WebhooksDataAttributes +from helpers.helpers import * +from dist.pythonsdk.openapi_client.api.unit_api import UnitApi +from dist.pythonsdk.openapi_client.models import * class TestWebhookApi(unittest.TestCase): @@ -16,15 +15,15 @@ def tearDown(self): pass def test_get_list_webhooks(self): - response = GetListWebhooksApi(self.api_client).execute() + response = UnitApi.get_webhooks_list(self.api_client).execute() for w in response.data: assert w.type == "webhook" def test_create_webhook(self): - body = WebhooksData(attributes=WebhooksDataAttributes( + body = CreateWebhook(attributes=CreateWebhookDataAttributes( "some label", "https://webhook.site/81ee6b53-fde4-4b7d-85a0-0b6249a4488d", "myToken", "Json", "AtLeastOnce", False, "OnlyAuthorizationRequest")) - response = CreateWebhookApi(self.api_client).execute({"data": body}) + response = UnitApi.create_webhook(self.api_client).execute({"data": body}) assert response.data.type == "webhook"