OrigenNetwork
Docs

Installation · origen_banking

1. Database

The resource ships with an auto-migrator (autodb). On the first start it reads database.sql from the resource root and creates any missing table automatically, so no manual SQL import is required.

The migrator runs in non-destructive mode: it creates missing tables and columns, but never drops anything that exists in your database and is absent from database.sql.

If you prefer to create the schema manually, run the following SQL before starting the resource:

sql
CREATE TABLE `origen_banking_banks` (
  `id` VARCHAR(64) NOT NULL,
  `name` VARCHAR(128) NOT NULL DEFAULT 'Banco',
  `balance` BIGINT NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
CREATE TABLE `origen_banking_accounts` (
  `id` VARCHAR(64) NOT NULL,
  `owner` VARCHAR(64) NOT NULL,
  `name` VARCHAR(128) NOT NULL DEFAULT 'Cuenta',
  `balance` BIGINT NOT NULL DEFAULT 0,
  `bank` VARCHAR(64) DEFAULT NULL,
  `default` TINYINT(1) NOT NULL DEFAULT 0,
  `shared` TINYINT(1) NOT NULL DEFAULT 0,
  `usersAccess` LONGTEXT DEFAULT '{}',
  `loans` LONGTEXT DEFAULT '[]',
  `cards` LONGTEXT DEFAULT '[]',
  PRIMARY KEY (`id`),
  KEY `idx_owner` (`owner`),
  KEY `idx_bank` (`bank`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
CREATE TABLE `origen_banking_transactions` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `account` VARCHAR(64) NOT NULL,
  `amount` BIGINT NOT NULL DEFAULT 0,
  `type` TINYINT UNSIGNED NOT NULL DEFAULT 0,
  `third` VARCHAR(64) DEFAULT NULL,
  `detail` VARCHAR(255) DEFAULT NULL,
  `initiated_by` VARCHAR(50) NULL DEFAULT 'system',
  `channel` VARCHAR(20) NULL DEFAULT 'banco',
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_account` (`account`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
CREATE TABLE `origen_banking_loans` (
  `id`                 VARCHAR(64)  NOT NULL,
  `account`            VARCHAR(64)  NOT NULL,
  `bank`               VARCHAR(64)  NOT NULL,
  `owner`              VARCHAR(64)  NOT NULL DEFAULT '',
  `type`               VARCHAR(24)  NOT NULL DEFAULT 'personal',
  `principal`          BIGINT       NOT NULL,
  `interest_rate`      DECIMAL(6,3) NOT NULL,
  `installments`       INT UNSIGNED NOT NULL,
  `paid`               INT UNSIGNED NOT NULL DEFAULT 0,
  `installment_amount` BIGINT       NOT NULL,
  `frequency`          INT UNSIGNED NOT NULL,
  `next_payment`       BIGINT       NOT NULL DEFAULT 0,
  `status`             VARCHAR(16)  NOT NULL DEFAULT 'active',
  `collateral`         VARCHAR(128) DEFAULT NULL,
  `missed`             INT UNSIGNED NOT NULL DEFAULT 0,
  `pending_disbursement` BIGINT     NOT NULL DEFAULT 0,
  `reject_reason`      VARCHAR(255) DEFAULT NULL,
  `created_at`         TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_account` (`account`),
  KEY `idx_owner` (`owner`),
  KEY `idx_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

2. server.cfg

Add the resource after its dependencies:

cfg
ensure ox_lib
ensure oxmysql
ensure origen_banking

3. Loan approval permissions

Loans above Config.Loans.AutoApproveUnder go into a manual approval queue. Two independent permission paths can approve them:

By job — configured in config/main.lua:

lua
Config.Loans.ApprovalJob   = 'banker'
Config.Loans.ApprovalGrade = 2

By ACE — add the permission in your server.cfg:

cfg
add_ace group.admin origen_banking.approve allow

Anyone with either permission can run /loansadmin to open the bank NUI directly on the approval queue. Set Config.Loans.ApprovalCommand = '' to disable the command.


4. Discord webhook (optional)

Open config/server/webhooks.lua and set your webhook URL:

lua
Config.Webhook = {
    banking = "https://discord.com/api/webhooks/..."
}

Deposits, withdrawals and transfers are logged. Transfers above $50,000 are sent with an @everyone mention.


5. Language

Set the resource language in config/main.lua. Translation files live in locales/.

lua
Config.Language = 'en' -- 'es' | 'en'