@lomray/microservice-payment-stripe
Version:
Stripe payment microservice based on NodeJS & inverted json.
96 lines (92 loc) • 3.62 kB
JavaScript
;
var tslib = require('tslib');
var microserviceHelpers = require('@lomray/microservice-helpers');
var classValidator = require('class-validator');
var classValidatorJsonschema = require('class-validator-jsonschema');
var typeorm = require('typeorm');
var customer = require('./customer.js');
var isLastCardDigitsValid = require('../helpers/validators/is-last-card-digits-valid.js');
let BankAccount = class BankAccount {
};
tslib.__decorate([
typeorm.PrimaryGeneratedColumn('uuid'),
classValidator.Allow(),
tslib.__metadata("design:type", String)
], BankAccount.prototype, "id", void 0);
tslib.__decorate([
typeorm.Index('IDX_card_userId', ['userId']),
typeorm.Column({ type: 'varchar', length: 36 }),
classValidator.Length(1, 36),
tslib.__metadata("design:type", String)
], BankAccount.prototype, "userId", void 0);
tslib.__decorate([
classValidatorJsonschema.JSONSchema({
description: 'Last 4 digits',
example: '4242',
}),
typeorm.Index('IDX_bank_account_lastDigits', ['lastDigits']),
typeorm.Column({ type: 'varchar', length: 4 }),
isLastCardDigitsValid(),
classValidator.Length(1, 4),
tslib.__metadata("design:type", String)
], BankAccount.prototype, "lastDigits", void 0);
tslib.__decorate([
typeorm.Index('IDX_bank_account_bankName', ['bankName']),
typeorm.Column({ type: 'varchar', length: 100, default: null }),
microserviceHelpers.IsUndefinable(),
classValidator.Length(1, 100),
tslib.__metadata("design:type", Object)
], BankAccount.prototype, "bankName", void 0);
tslib.__decorate([
typeorm.Column({ type: 'varchar', length: 100, default: null }),
microserviceHelpers.IsNullable(),
microserviceHelpers.IsUndefinable(),
classValidator.Length(1, 100),
tslib.__metadata("design:type", Object)
], BankAccount.prototype, "holderName", void 0);
tslib.__decorate([
classValidatorJsonschema.JSONSchema({
description: "If it's the first attached user bank account it should be default",
}),
typeorm.Column({ type: 'boolean', default: false }),
microserviceHelpers.IsUndefinable(),
classValidator.IsBoolean(),
tslib.__metadata("design:type", Boolean)
], BankAccount.prototype, "isDefault", void 0);
tslib.__decorate([
typeorm.Column({ type: 'boolean', default: false }),
classValidator.IsBoolean(),
microserviceHelpers.IsUndefinable(),
tslib.__metadata("design:type", Boolean)
], BankAccount.prototype, "isInstantPayoutAllowed", void 0);
tslib.__decorate([
typeorm.Column({ type: 'json', default: {} }),
classValidator.IsObject(),
microserviceHelpers.IsUndefinable(),
tslib.__metadata("design:type", Object)
], BankAccount.prototype, "params", void 0);
tslib.__decorate([
microserviceHelpers.IsTypeormDate(),
typeorm.CreateDateColumn(),
tslib.__metadata("design:type", Date)
], BankAccount.prototype, "createdAt", void 0);
tslib.__decorate([
microserviceHelpers.IsTypeormDate(),
typeorm.UpdateDateColumn(),
tslib.__metadata("design:type", Date)
], BankAccount.prototype, "updatedAt", void 0);
tslib.__decorate([
typeorm.ManyToOne('Customer', 'bankAccounts', { onDelete: 'CASCADE' }),
typeorm.JoinColumn({ name: 'userId' }),
tslib.__metadata("design:type", customer)
], BankAccount.prototype, "customer", void 0);
BankAccount = tslib.__decorate([
classValidatorJsonschema.JSONSchema({
properties: {
customer: { $ref: '#/definitions/Customer' },
},
}),
typeorm.Entity()
], BankAccount);
var BankAccount$1 = BankAccount;
module.exports = BankAccount$1;