@felloh-org/lambda-wrapper 1.0.16 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/seed/create-schema.js +2 -0
- package/dist/entity/bank/account/index.js +10 -0
- package/dist/entity/bank/disbursal/index.js +69 -6
- package/dist/entity/bank/index.js +3 -3
- package/dist/entity/bank/ledger/index.js +151 -0
- package/dist/entity/bank/settled-transaction/index.js +97 -0
- package/dist/entity/index.js +5 -1
- package/dist/entity/payment/index.js +5 -1
- package/dist/entity/payment/organisation-payment-provider/index.js +131 -0
- package/dist/entity/{bank/beneficiary-organisation → payment/payment-provider}/index.js +17 -30
- package/dist/entity/payment/transaction/index.js +34 -7
- package/dist/entity/total-processing/index.js +16 -0
- package/dist/entity/total-processing/transaction/index.js +126 -0
- package/dist/entity/total-processing/transaction-metadata/index.js +138 -0
- package/dist/entity/trust-payments/batch/index.js +85 -0
- package/dist/entity/trust-payments/chargeback/index.js +128 -0
- package/dist/entity/trust-payments/index.js +20 -0
- package/dist/entity/{bank/beneficiary-provider → trust-payments/merchant}/index.js +28 -27
- package/dist/entity/trust-payments/transaction/index.js +152 -0
- package/dist/entity/user/organisation/index.js +2 -6
- package/dist/entity/user/user/index.js +1 -3
- package/dist/index.js +100 -36
- package/dist/migration/bank/1642313073694-bank-initial.js +0 -10
- package/dist/migration/bank/1645101410250-bank_disbursal.js +28 -0
- package/dist/migration/bank/1645102501719-bank_disbursal_unique.js +17 -0
- package/dist/migration/bank/1645103420324-ledger.js +19 -0
- package/dist/migration/bank/1645103864454-ledger-defaults.js +15 -0
- package/dist/migration/bank/1645108723739-bank-settled-transaction.js +19 -0
- package/dist/migration/payment/1643717852114-payment-providers.js +19 -0
- package/dist/migration/payment/1643718714719-payment-providers-method.js +15 -0
- package/dist/migration/payment/1643719203328-payment-providers-method.js +22 -0
- package/dist/migration/payment/1644395533722-transaction_provider.js +15 -0
- package/dist/migration/payment/1644396011044-transaction_provider_ref.js +13 -0
- package/dist/migration/total-processing/1644309449035-tpro_transactions.js +13 -0
- package/dist/migration/total-processing/1644411639660-total_processing_entity.js +13 -0
- package/dist/migration/total-processing/1644842797566-relations.js +19 -0
- package/dist/migration/total-processing/1644926407236-tp_rec_nullable.js +13 -0
- package/dist/migration/total-processing/1644933594682-tp_rec_status.js +13 -0
- package/dist/migration/total-processing/1645010756173-tp_transaction_metadata.js +15 -0
- package/dist/migration/trust-payments/1644016335590-tp_merchants.js +13 -0
- package/dist/migration/trust-payments/1644018105481-tp_add_batch.js +15 -0
- package/dist/migration/trust-payments/1644020330502-tp_transaction.js +17 -0
- package/dist/migration/trust-payments/1644791277717-chargeback.js +15 -0
- package/dist/model/response/index.js +25 -32
- package/dist/model/response/status-codes.js +66 -0
- package/dist/service/request.js +5 -10
- package/dist/wrapper/index.js +7 -6
- package/package.json +2 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const { MigrationInterface, QueryRunner } = require("typeorm");
|
|
2
|
+
|
|
3
|
+
module.exports = class paymentProviders1643717852114 {
|
|
4
|
+
name = 'paymentProviders1643717852114'
|
|
5
|
+
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`CREATE TABLE "payment"."payment_provider" ("id" character varying NOT NULL, "name" character varying(150), "created_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_ea94f42b6c88e9191c3649d7522" PRIMARY KEY ("id"))`);
|
|
8
|
+
await queryRunner.query(`CREATE TABLE "payment"."organisation_payment_provider" ("id" character varying NOT NULL, "public_key" character varying(150) NOT NULL, "secret_key" character varying(150) NOT NULL, "secret_key_last_four" character varying(4) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "organisation_id" character varying(150), "payment_provider_id" character varying, CONSTRAINT "PK_a93e055dd547e7dc766ec5c479e" PRIMARY KEY ("id"))`);
|
|
9
|
+
await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider" ADD CONSTRAINT "FK_9f9a8ea0f2070a0fbedeb7ad479" FOREIGN KEY ("organisation_id") REFERENCES "user"."organisation"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
10
|
+
await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider" ADD CONSTRAINT "FK_6da7749fe18d2fe152386ca5fba" FOREIGN KEY ("payment_provider_id") REFERENCES "payment"."payment_provider"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async down(queryRunner) {
|
|
14
|
+
await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider" DROP CONSTRAINT "FK_6da7749fe18d2fe152386ca5fba"`);
|
|
15
|
+
await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider" DROP CONSTRAINT "FK_9f9a8ea0f2070a0fbedeb7ad479"`);
|
|
16
|
+
await queryRunner.query(`DROP TABLE "payment"."organisation_payment_provider"`);
|
|
17
|
+
await queryRunner.query(`DROP TABLE "payment"."payment_provider"`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const { MigrationInterface, QueryRunner } = require("typeorm");
|
|
2
|
+
|
|
3
|
+
module.exports = class paymentProvidersMethod1643718714719 {
|
|
4
|
+
name = 'paymentProvidersMethod1643718714719'
|
|
5
|
+
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider" ADD "transaction_method_id" character varying`);
|
|
8
|
+
await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider" ADD CONSTRAINT "FK_aec28078d75db2aa44771525702" FOREIGN KEY ("transaction_method_id") REFERENCES "payment"."transaction_method"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async down(queryRunner) {
|
|
12
|
+
await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider" DROP CONSTRAINT "FK_aec28078d75db2aa44771525702"`);
|
|
13
|
+
await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider" DROP COLUMN "transaction_method_id"`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const { MigrationInterface, QueryRunner } = require("typeorm");
|
|
2
|
+
|
|
3
|
+
module.exports = class paymentProvidersMethod1643719203328 {
|
|
4
|
+
name = 'paymentProvidersMethod1643719203328'
|
|
5
|
+
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider" DROP CONSTRAINT "FK_aec28078d75db2aa44771525702"`);
|
|
8
|
+
await queryRunner.query(`CREATE TABLE "payment"."organisation_payment_provider_method" ("organisation_payment_provider_id" character varying NOT NULL, "transaction_method_id" character varying NOT NULL, CONSTRAINT "PK_4f6c5cf6446d30c2291180d6dd3" PRIMARY KEY ("organisation_payment_provider_id", "transaction_method_id"))`);
|
|
9
|
+
await queryRunner.query(`CREATE INDEX "IDX_1027b1f5301948b2c8dc512101" ON "payment"."organisation_payment_provider_method" ("organisation_payment_provider_id") `);
|
|
10
|
+
await queryRunner.query(`CREATE INDEX "IDX_5c73d00c542e73bc44fc84f5e1" ON "payment"."organisation_payment_provider_method" ("transaction_method_id") `);
|
|
11
|
+
await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider" DROP COLUMN "transaction_method_id"`);
|
|
12
|
+
await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider_method" ADD CONSTRAINT "FK_1027b1f5301948b2c8dc5121017" FOREIGN KEY ("organisation_payment_provider_id") REFERENCES "payment"."organisation_payment_provider"("id") ON DELETE CASCADE ON UPDATE CASCADE`);
|
|
13
|
+
await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider_method" ADD CONSTRAINT "FK_5c73d00c542e73bc44fc84f5e1e" FOREIGN KEY ("transaction_method_id") REFERENCES "payment"."transaction_method"("id") ON DELETE CASCADE ON UPDATE CASCADE`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async down(queryRunner) {
|
|
17
|
+
await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider_method" DROP CONSTRAINT "FK_5c73d00c542e73bc44fc84f5e1e"`);
|
|
18
|
+
await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider_method" DROP CONSTRAINT "FK_1027b1f5301948b2c8dc5121017"`);;
|
|
19
|
+
await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider" ADD "transaction_method_id" character varying`);
|
|
20
|
+
await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider" ADD CONSTRAINT "FK_aec28078d75db2aa44771525702" FOREIGN KEY ("transaction_method_id") REFERENCES "payment"."transaction_method"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const { MigrationInterface, QueryRunner } = require("typeorm");
|
|
2
|
+
|
|
3
|
+
module.exports = class transactionProvider1644395533722 {
|
|
4
|
+
name = 'transactionProvider1644395533722'
|
|
5
|
+
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE "payment"."transaction" ADD "payment_provider_id" character varying`);
|
|
8
|
+
await queryRunner.query(`ALTER TABLE "payment"."transaction" ADD CONSTRAINT "FK_b745b49a000a5bd3f0f734464f1" FOREIGN KEY ("payment_provider_id") REFERENCES "payment"."payment_provider"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async down(queryRunner) {
|
|
12
|
+
await queryRunner.query(`ALTER TABLE "payment"."transaction" DROP CONSTRAINT "FK_b745b49a000a5bd3f0f734464f1"`);
|
|
13
|
+
await queryRunner.query(`ALTER TABLE "payment"."transaction" DROP COLUMN "payment_provider_id"`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const { MigrationInterface, QueryRunner } = require("typeorm");
|
|
2
|
+
|
|
3
|
+
module.exports = class transactionProviderRef1644396011044 {
|
|
4
|
+
name = 'transactionProviderRef1644396011044'
|
|
5
|
+
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE "payment"."transaction" ADD "provider_reference" character varying(250)`);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async down(queryRunner) {
|
|
11
|
+
await queryRunner.query(`ALTER TABLE "payment"."transaction" DROP COLUMN "provider_reference"`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const { MigrationInterface, QueryRunner } = require("typeorm");
|
|
2
|
+
|
|
3
|
+
module.exports = class tproTransactions1644309449035 {
|
|
4
|
+
name = 'tproTransactions1644309449035'
|
|
5
|
+
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`CREATE TABLE "total_processing"."transaction" ("ndc" character varying NOT NULL, "risk_score" character varying(2) NOT NULL, "amount" integer NOT NULL, "currency" character varying(5) NOT NULL, "reconciliation_id" character varying(30) NOT NULL, "merchant_account_id" character varying(50) NOT NULL, "processing_time" TIMESTAMP NOT NULL, "merchant_name" character varying(1500) NOT NULL, CONSTRAINT "PK_e8f5b58f1647a179840dc613ec3" PRIMARY KEY ("ndc"))`);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async down(queryRunner) {
|
|
11
|
+
await queryRunner.query(`DROP TABLE "total_processing"."transaction"`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const { MigrationInterface, QueryRunner } = require("typeorm");
|
|
2
|
+
|
|
3
|
+
module.exports = class totalProcessingEntity1644411639660 {
|
|
4
|
+
name = 'totalProcessingEntity1644411639660'
|
|
5
|
+
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE "total_processing"."transaction" ADD "entity_id" character varying(50)`);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async down(queryRunner) {
|
|
11
|
+
await queryRunner.query(`ALTER TABLE "total_processing"."transaction" DROP COLUMN "entity_id"`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const { MigrationInterface, QueryRunner } = require("typeorm");
|
|
2
|
+
|
|
3
|
+
module.exports = class relations1644842797566 {
|
|
4
|
+
name = 'relations1644842797566'
|
|
5
|
+
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE "user"."user_organisation" DROP CONSTRAINT "FK_81c4608739c8cf71fa1f96e11ae"`);
|
|
8
|
+
await queryRunner.query(`ALTER TABLE "user"."user_organisation" DROP CONSTRAINT "FK_d9628e009b6d71bf677c04f8494"`);
|
|
9
|
+
await queryRunner.query(`ALTER TABLE "user"."user_organisation" ADD CONSTRAINT "FK_d9628e009b6d71bf677c04f8494" FOREIGN KEY ("organisation_id") REFERENCES "user"."organisation"("id") ON DELETE CASCADE ON UPDATE CASCADE`);
|
|
10
|
+
await queryRunner.query(`ALTER TABLE "user"."user_organisation" ADD CONSTRAINT "FK_81c4608739c8cf71fa1f96e11ae" FOREIGN KEY ("user_id") REFERENCES "user"."user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async down(queryRunner) {
|
|
14
|
+
await queryRunner.query(`ALTER TABLE "user"."user_organisation" DROP CONSTRAINT "FK_81c4608739c8cf71fa1f96e11ae"`);
|
|
15
|
+
await queryRunner.query(`ALTER TABLE "user"."user_organisation" DROP CONSTRAINT "FK_d9628e009b6d71bf677c04f8494"`);
|
|
16
|
+
await queryRunner.query(`ALTER TABLE "user"."user_organisation" ADD CONSTRAINT "FK_d9628e009b6d71bf677c04f8494" FOREIGN KEY ("organisation_id") REFERENCES "user"."organisation"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
17
|
+
await queryRunner.query(`ALTER TABLE "user"."user_organisation" ADD CONSTRAINT "FK_81c4608739c8cf71fa1f96e11ae" FOREIGN KEY ("user_id") REFERENCES "user"."user"("id") ON DELETE CASCADE ON UPDATE CASCADE`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const { MigrationInterface, QueryRunner } = require("typeorm");
|
|
2
|
+
|
|
3
|
+
module.exports = class tpRecNullable1644926407236 {
|
|
4
|
+
name = 'tpRecNullable1644926407236'
|
|
5
|
+
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE "total_processing"."transaction" ALTER COLUMN "reconciliation_id" DROP NOT NULL`);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async down(queryRunner) {
|
|
11
|
+
await queryRunner.query(`ALTER TABLE "total_processing"."transaction" ALTER COLUMN "reconciliation_id" SET NOT NULL`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const { MigrationInterface, QueryRunner } = require("typeorm");
|
|
2
|
+
|
|
3
|
+
module.exports = class tpRecStatus1644933594682 {
|
|
4
|
+
name = 'tpRecStatus1644933594682'
|
|
5
|
+
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE "total_processing"."transaction" ADD "status" integer`);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async down(queryRunner) {
|
|
11
|
+
await queryRunner.query(`ALTER TABLE "total_processing"."transaction" DROP COLUMN "status"`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const { MigrationInterface, QueryRunner } = require("typeorm");
|
|
2
|
+
|
|
3
|
+
module.exports = class tpTransactionMetadata1645010756173 {
|
|
4
|
+
name = 'tpTransactionMetadata1645010756173'
|
|
5
|
+
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`CREATE TABLE "total_processing"."transaction_metadata" ("card_type" character varying(20), "bin_type" character varying(20), "payment_brand" character varying(20), "payment_type" character varying(10), "issuing_country" character varying(10), "currency" character varying(10), "last_four_digits" character varying(4), "cardholder_name" character varying(150), "created_at" TIMESTAMP NOT NULL DEFAULT now(), "ndc" character varying NOT NULL, CONSTRAINT "PK_3d46223f35eba1a34e2fe7f6778" PRIMARY KEY ("ndc"))`);
|
|
8
|
+
await queryRunner.query(`ALTER TABLE "total_processing"."transaction_metadata" ADD CONSTRAINT "FK_3d46223f35eba1a34e2fe7f6778" FOREIGN KEY ("ndc") REFERENCES "total_processing"."transaction"("ndc") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async down(queryRunner) {
|
|
12
|
+
await queryRunner.query(`ALTER TABLE "total_processing"."transaction_metadata" DROP CONSTRAINT "FK_3d46223f35eba1a34e2fe7f6778"`);
|
|
13
|
+
await queryRunner.query(`DROP TABLE "total_processing"."transaction_metadata"`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const { MigrationInterface, QueryRunner } = require("typeorm");
|
|
2
|
+
|
|
3
|
+
module.exports = class tpMerchants1644016335590 {
|
|
4
|
+
name = 'tpMerchants1644016335590'
|
|
5
|
+
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`CREATE TABLE "trust_payments"."merchant" ("merchant_number" character varying(150) NOT NULL, "mid" character varying(150) NOT NULL, "name" character varying(150) NOT NULL, "status" character varying(20) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_f6dece295160ada4ae4b5035503" PRIMARY KEY ("merchant_number"))`);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async down(queryRunner) {
|
|
11
|
+
await queryRunner.query(`DROP TABLE "trust_payments"."merchant"`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const { MigrationInterface, QueryRunner } = require("typeorm");
|
|
2
|
+
|
|
3
|
+
module.exports = class tpAddBatch1644018105481 {
|
|
4
|
+
name = 'tpAddBatch1644018105481'
|
|
5
|
+
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`CREATE TABLE "trust_payments"."batch" ("bank_reference" character varying NOT NULL, "amount" integer NOT NULL, "posting_date" date NOT NULL, "currency" character varying(5) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "merchant_number" character varying(150), CONSTRAINT "PK_2764676698c90f2ac84d9255436" PRIMARY KEY ("bank_reference"))`);
|
|
8
|
+
await queryRunner.query(`ALTER TABLE "trust_payments"."batch" ADD CONSTRAINT "FK_f41b6b9d92dac3770ea3f3b0e1b" FOREIGN KEY ("merchant_number") REFERENCES "trust_payments"."merchant"("merchant_number") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async down(queryRunner) {
|
|
12
|
+
await queryRunner.query(`ALTER TABLE "trust_payments"."batch" DROP CONSTRAINT "FK_f41b6b9d92dac3770ea3f3b0e1b"`);
|
|
13
|
+
await queryRunner.query(`DROP TABLE "trust_payments"."batch"`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const { MigrationInterface, QueryRunner } = require("typeorm");
|
|
2
|
+
|
|
3
|
+
module.exports = class tpTransaction1644020330502 {
|
|
4
|
+
name = 'tpTransaction1644020330502'
|
|
5
|
+
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`CREATE TABLE "trust_payments"."transaction" ("id" character varying NOT NULL, "created" date NOT NULL, "time" character varying(10) NOT NULL, "card_number" character varying(30) NOT NULL, "card_type" character varying(30) NOT NULL, "capture_method" character varying(40) NOT NULL, "auth_code" character varying(15) NOT NULL, "currency" character varying(5) NOT NULL, "amount" integer NOT NULL, "merchant_reference" character varying(40) NOT NULL, "bank_reference" character varying, "merchant_number" character varying(150), CONSTRAINT "PK_89eadb93a89810556e1cbcd6ab9" PRIMARY KEY ("id"))`);
|
|
8
|
+
await queryRunner.query(`ALTER TABLE "trust_payments"."transaction" ADD CONSTRAINT "FK_b64d908fd041c3e7c66451774ad" FOREIGN KEY ("bank_reference") REFERENCES "trust_payments"."batch"("bank_reference") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
9
|
+
await queryRunner.query(`ALTER TABLE "trust_payments"."transaction" ADD CONSTRAINT "FK_a72a7fc3b87d80557ce9196e808" FOREIGN KEY ("merchant_number") REFERENCES "trust_payments"."merchant"("merchant_number") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async down(queryRunner) {
|
|
13
|
+
await queryRunner.query(`ALTER TABLE "trust_payments"."transaction" DROP CONSTRAINT "FK_a72a7fc3b87d80557ce9196e808"`);
|
|
14
|
+
await queryRunner.query(`ALTER TABLE "trust_payments"."transaction" DROP CONSTRAINT "FK_b64d908fd041c3e7c66451774ad"`);
|
|
15
|
+
await queryRunner.query(`DROP TABLE "trust_payments"."transaction"`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const { MigrationInterface, QueryRunner } = require("typeorm");
|
|
2
|
+
|
|
3
|
+
module.exports = class chargeback1644791277717 {
|
|
4
|
+
name = 'chargeback1644791277717'
|
|
5
|
+
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`CREATE TABLE "trust_payments"."chargeback" ("id" character varying NOT NULL, "received_date" date, "status" character varying(20) NOT NULL, "reason" character varying(100) NOT NULL, "amount" integer NOT NULL, "due_date" date NOT NULL, "posting_date" date NOT NULL, "merchant_reference" character varying(100) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "merchant_number" character varying(150), CONSTRAINT "PK_b8733f1a59eed2643b7a879a915" PRIMARY KEY ("id"))`);
|
|
8
|
+
await queryRunner.query(`ALTER TABLE "trust_payments"."chargeback" ADD CONSTRAINT "FK_c3dff25d1fef4447e34b92e82d2" FOREIGN KEY ("merchant_number") REFERENCES "trust_payments"."merchant"("merchant_number") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async down(queryRunner) {
|
|
12
|
+
await queryRunner.query(`ALTER TABLE "trust_payments"."chargeback" DROP CONSTRAINT "FK_c3dff25d1fef4447e34b92e82d2"`);
|
|
13
|
+
await queryRunner.query(`DROP TABLE "trust_payments"."chargeback"`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.RESPONSE_HEADERS =
|
|
6
|
+
exports.default = exports.RESPONSE_HEADERS = void 0;
|
|
7
7
|
|
|
8
8
|
var _uuid = require("uuid");
|
|
9
9
|
|
|
10
10
|
var _ = _interopRequireDefault(require(".."));
|
|
11
11
|
|
|
12
|
+
var _statusCodes = _interopRequireDefault(require("./status-codes"));
|
|
13
|
+
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
15
|
|
|
14
16
|
/**
|
|
@@ -22,19 +24,11 @@ const RESPONSE_HEADERS = {
|
|
|
22
24
|
'Access-Control-Allow-Credentials': true // Required for cookies, authorization headers with HTTPS
|
|
23
25
|
|
|
24
26
|
};
|
|
25
|
-
/**
|
|
26
|
-
* Default message provided as part of response
|
|
27
|
-
*
|
|
28
|
-
* @type {string}
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
exports.RESPONSE_HEADERS = RESPONSE_HEADERS;
|
|
32
|
-
const DEFAULT_MESSAGE = 'success';
|
|
33
27
|
/**
|
|
34
28
|
* class ResponseModel
|
|
35
29
|
*/
|
|
36
30
|
|
|
37
|
-
exports.
|
|
31
|
+
exports.RESPONSE_HEADERS = RESPONSE_HEADERS;
|
|
38
32
|
|
|
39
33
|
class Index extends _.default {
|
|
40
34
|
/**
|
|
@@ -42,16 +36,16 @@ class Index extends _.default {
|
|
|
42
36
|
*
|
|
43
37
|
* @param data
|
|
44
38
|
* @param code
|
|
45
|
-
* @param message
|
|
46
39
|
*/
|
|
47
|
-
constructor(data = null, code =
|
|
40
|
+
constructor(data = null, code = 200) {
|
|
48
41
|
super();
|
|
49
42
|
this.body = {
|
|
50
43
|
data: data !== null ? data : {},
|
|
51
44
|
errors: {},
|
|
52
45
|
meta: {
|
|
53
46
|
code: code !== null ? code : {},
|
|
54
|
-
|
|
47
|
+
reason: _statusCodes.default[code].reason,
|
|
48
|
+
message: _statusCodes.default[code].message,
|
|
55
49
|
request_id: (0, _uuid.v4)()
|
|
56
50
|
}
|
|
57
51
|
};
|
|
@@ -86,48 +80,47 @@ class Index extends _.default {
|
|
|
86
80
|
|
|
87
81
|
|
|
88
82
|
setCode(code) {
|
|
83
|
+
this.body.meta.reason = _statusCodes.default[code].reason;
|
|
84
|
+
this.body.meta.message = _statusCodes.default[code].message;
|
|
89
85
|
this.code = code;
|
|
90
86
|
this.body.meta.code = code;
|
|
91
87
|
}
|
|
92
88
|
/**
|
|
93
|
-
*
|
|
94
|
-
* @param key
|
|
95
|
-
* @param value
|
|
89
|
+
* Get errors
|
|
96
90
|
*/
|
|
97
91
|
|
|
98
92
|
|
|
99
|
-
|
|
100
|
-
this.body.
|
|
93
|
+
getErrors() {
|
|
94
|
+
return this.body.errors;
|
|
101
95
|
}
|
|
102
96
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* @returns {*}
|
|
97
|
+
* Set errors
|
|
98
|
+
* @param errors
|
|
106
99
|
*/
|
|
107
100
|
|
|
108
101
|
|
|
109
|
-
|
|
110
|
-
|
|
102
|
+
setErrors(errors) {
|
|
103
|
+
this.body.errors = errors;
|
|
111
104
|
}
|
|
112
105
|
/**
|
|
113
|
-
* Set
|
|
114
|
-
*
|
|
115
|
-
* @param
|
|
106
|
+
* Set a meta variable
|
|
107
|
+
* @param key
|
|
108
|
+
* @param value
|
|
116
109
|
*/
|
|
117
110
|
|
|
118
111
|
|
|
119
|
-
|
|
120
|
-
this.body.
|
|
112
|
+
setMetaVariable(key, value) {
|
|
113
|
+
this.body.meta[key] = value;
|
|
121
114
|
}
|
|
122
115
|
/**
|
|
123
|
-
* Get
|
|
116
|
+
* Get Status Code
|
|
124
117
|
*
|
|
125
|
-
* @returns {
|
|
118
|
+
* @returns {*}
|
|
126
119
|
*/
|
|
127
120
|
|
|
128
121
|
|
|
129
|
-
|
|
130
|
-
return this.
|
|
122
|
+
getCode() {
|
|
123
|
+
return this.code;
|
|
131
124
|
}
|
|
132
125
|
/**
|
|
133
126
|
* Geneate a response
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const ERRORS = {
|
|
8
|
+
200: {
|
|
9
|
+
reason: 'OK',
|
|
10
|
+
message: 'The request was successful'
|
|
11
|
+
},
|
|
12
|
+
201: {
|
|
13
|
+
reason: 'Created',
|
|
14
|
+
message: 'The request was successful, and a new resource was created'
|
|
15
|
+
},
|
|
16
|
+
204: {
|
|
17
|
+
reason: 'No Content',
|
|
18
|
+
message: 'The request was successful, but there is no response to send back'
|
|
19
|
+
},
|
|
20
|
+
400: {
|
|
21
|
+
reason: 'Bad Request',
|
|
22
|
+
message: 'The request was invalid, for example due to missing headers'
|
|
23
|
+
},
|
|
24
|
+
401: {
|
|
25
|
+
reason: 'Unauthorized',
|
|
26
|
+
message: 'An access token was not provided, or the provided token was invalid'
|
|
27
|
+
},
|
|
28
|
+
403: {
|
|
29
|
+
reason: 'Forbidden',
|
|
30
|
+
message: 'A valid access token was provided, but it did not have sufficient permissions'
|
|
31
|
+
},
|
|
32
|
+
404: {
|
|
33
|
+
reason: 'Not Found',
|
|
34
|
+
message: 'The requested resource does not exist'
|
|
35
|
+
},
|
|
36
|
+
406: {
|
|
37
|
+
reason: 'Not Acceptable',
|
|
38
|
+
message: 'The response type you requested with your Accept header is not supported'
|
|
39
|
+
},
|
|
40
|
+
422: {
|
|
41
|
+
reason: 'Unprocessable Entity',
|
|
42
|
+
message: 'A validation error occurred'
|
|
43
|
+
},
|
|
44
|
+
429: {
|
|
45
|
+
reason: 'Too Many Requests',
|
|
46
|
+
message: 'You made too many requests to the API in a short period of time'
|
|
47
|
+
},
|
|
48
|
+
500: {
|
|
49
|
+
reason: 'Internal Server Error',
|
|
50
|
+
message: 'Something went wrong on our side. Contact support or try again later.'
|
|
51
|
+
},
|
|
52
|
+
502: {
|
|
53
|
+
reason: 'Bad Gateway',
|
|
54
|
+
message: 'The server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request.'
|
|
55
|
+
},
|
|
56
|
+
503: {
|
|
57
|
+
reason: 'Service Unavailable',
|
|
58
|
+
message: 'The server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay. Try again later.'
|
|
59
|
+
},
|
|
60
|
+
504: {
|
|
61
|
+
reason: 'Gateway Timeout',
|
|
62
|
+
message: 'The server, while acting as a gateway or proxy, did not receive a timely response from an upstream server it needed to access in order to complete the request. Try again later.'
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
var _default = ERRORS;
|
|
66
|
+
exports.default = _default;
|
package/dist/service/request.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.REQUEST_TYPES = exports.HTTP_METHODS_WITH_PAYLOADS = exports.HTTP_METHODS_WITHOUT_PAYLOADS =
|
|
6
|
+
exports.default = exports.REQUEST_TYPES = exports.HTTP_METHODS_WITH_PAYLOADS = exports.HTTP_METHODS_WITHOUT_PAYLOADS = void 0;
|
|
7
7
|
|
|
8
8
|
var _querystring = _interopRequireDefault(require("querystring"));
|
|
9
9
|
|
|
@@ -36,17 +36,12 @@ const REQUEST_TYPES = {
|
|
|
36
36
|
exports.REQUEST_TYPES = REQUEST_TYPES;
|
|
37
37
|
const HTTP_METHODS_WITHOUT_PAYLOADS = [REQUEST_TYPES.DELETE, REQUEST_TYPES.GET, REQUEST_TYPES.HEAD, REQUEST_TYPES.OPTIONS];
|
|
38
38
|
exports.HTTP_METHODS_WITHOUT_PAYLOADS = HTTP_METHODS_WITHOUT_PAYLOADS;
|
|
39
|
-
const HTTP_METHODS_WITH_PAYLOADS = [REQUEST_TYPES.PATCH, REQUEST_TYPES.POST, REQUEST_TYPES.PUT];
|
|
40
|
-
|
|
41
|
-
exports.HTTP_METHODS_WITH_PAYLOADS = HTTP_METHODS_WITH_PAYLOADS;
|
|
42
|
-
const ERROR_TYPES = {
|
|
43
|
-
VALIDATION_ERROR: new _response.default({}, 400, 'required fields are missing')
|
|
44
|
-
};
|
|
39
|
+
const HTTP_METHODS_WITH_PAYLOADS = [REQUEST_TYPES.PATCH, REQUEST_TYPES.POST, REQUEST_TYPES.PUT];
|
|
45
40
|
/**
|
|
46
41
|
* RequestService class
|
|
47
42
|
*/
|
|
48
43
|
|
|
49
|
-
exports.
|
|
44
|
+
exports.HTTP_METHODS_WITH_PAYLOADS = HTTP_METHODS_WITH_PAYLOADS;
|
|
50
45
|
|
|
51
46
|
class Request extends _dependencyAware.default {
|
|
52
47
|
/**
|
|
@@ -262,8 +257,8 @@ class Request extends _dependencyAware.default {
|
|
|
262
257
|
resolve();
|
|
263
258
|
} else {
|
|
264
259
|
Logger.label('request-validation-failed');
|
|
265
|
-
const validationErrorResponse =
|
|
266
|
-
validationErrorResponse.
|
|
260
|
+
const validationErrorResponse = new _response.default({}, 422);
|
|
261
|
+
validationErrorResponse.setErrors(validation);
|
|
267
262
|
reject(validationErrorResponse);
|
|
268
263
|
}
|
|
269
264
|
});
|
package/dist/wrapper/index.js
CHANGED
|
@@ -82,12 +82,13 @@ const handleError = (di, error, throwError = false) => {
|
|
|
82
82
|
return new Error(error);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
};
|
|
90
|
-
|
|
85
|
+
if (error instanceof _response.default) {
|
|
86
|
+
return error.generate();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const response = new _response.default({}, error.code || 500);
|
|
90
|
+
response.setErrors(error.body || {});
|
|
91
|
+
return response.generate();
|
|
91
92
|
};
|
|
92
93
|
/**
|
|
93
94
|
* Lambda Wrapper.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@felloh-org/lambda-wrapper",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"description": "Lambda wrapper for all Felloh Serverless Projects",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"orm:migration:generate": "rm -rf dist && yarn build:orm && ./node_modules/.bin/typeorm migration:generate -o -n",
|
|
11
11
|
"orm:migration:run": "rm -rf dist && yarn build:orm && ./node_modules/.bin/typeorm migration:run",
|
|
12
12
|
"orm:schema:create": "babel-node ./cli/seed/create-schema.js",
|
|
13
|
+
"orm:revert": "rm -rf dist && yarn build:orm && ./node_modules/.bin/typeorm migration:revert",
|
|
13
14
|
"orm:seed": "babel-node ./cli/seed/index.js",
|
|
14
15
|
"start": "yarn build -w",
|
|
15
16
|
"test": "jest --coverage"
|