UNPKG

@atomixdesign/nodepay-ezidebit

Version:

Nodepay strategy for the Ezidebit payment gateway.

146 lines (145 loc) 7.46 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseDebitDTO = void 0; var class_validator_1 = require("class-validator"); var validation_1 = require("@atomixdesign/nodepay-core/build/validation"); var debug_1 = __importDefault(require("debug")); var log = debug_1.default('nodepay:ezidebit'); /** @internal */ var BaseDebitDTO = /** @class */ (function () { function BaseDebitDTO(baseDebit) { log("building " + this.constructor.name); log({ baseDebit: baseDebit }); this.YourSystemReference = baseDebit.YourSystemReference; this.LastName = baseDebit.LastName; this.PaymentReference = baseDebit.PaymentReference; this.PaymentAmountInCents = baseDebit.PaymentAmountInCents; this.DebitDate = baseDebit.DebitDate; this.SmsPaymentReminder = baseDebit.SmsPaymentReminder; this.SmsFailedNotification = baseDebit.SmsFailedNotification; this.SmsExpiredCard = baseDebit.SmsExpiredCard; this.Username = baseDebit.Username; this.YourGeneralReference = baseDebit.YourGeneralReference; this.FirstName = baseDebit.FirstName; this.EmailAddress = baseDebit.EmailAddress; this.MobilePhoneNumber = baseDebit.MobilePhoneNumber; } __decorate([ class_validator_1.IsNotEmpty({ message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.NotEmpty, 'YourSystemReference'), }), class_validator_1.MaxLength(50, { message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.FieldTooLong, 'YourSystemReference'), }), __metadata("design:type", String) ], BaseDebitDTO.prototype, "YourSystemReference", void 0); __decorate([ class_validator_1.IsNotEmpty({ message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.NotEmpty, 'LastName'), }), class_validator_1.MaxLength(60, { message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.FieldTooLong, 'LastName'), }), __metadata("design:type", String) ], BaseDebitDTO.prototype, "LastName", void 0); __decorate([ class_validator_1.MaxLength(50, { message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.FieldTooLong, 'PaymentReference'), }), __metadata("design:type", String) ], BaseDebitDTO.prototype, "PaymentReference", void 0); __decorate([ class_validator_1.Min(200, { message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.ValueTooLow, 'PaymentAmountInCents'), }), class_validator_1.IsNumber(undefined, { message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.NotANumber, 'PaymentAmountInCents'), }), __metadata("design:type", Number) ], BaseDebitDTO.prototype, "PaymentAmountInCents", void 0); __decorate([ class_validator_1.IsNotEmpty({ message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.NotEmpty, 'DebitDate'), }), __metadata("design:type", String) ], BaseDebitDTO.prototype, "DebitDate", void 0); __decorate([ class_validator_1.IsNotEmpty({ message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.NotEmpty, 'SmsPaymentReminder'), }), class_validator_1.IsIn(['YES', 'NO'], { message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.NotInAllowedSet, 'SmsPaymentReminder'), }), __metadata("design:type", String) ], BaseDebitDTO.prototype, "SmsPaymentReminder", void 0); __decorate([ class_validator_1.IsNotEmpty({ message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.NotEmpty, 'SmsFailedNotification'), }), class_validator_1.IsIn(['YES', 'NO'], { message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.NotInAllowedSet, 'SmsFailedNotification'), }), __metadata("design:type", String) ], BaseDebitDTO.prototype, "SmsFailedNotification", void 0); __decorate([ class_validator_1.IsNotEmpty({ message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.NotEmpty, 'SmsExpiredCard'), }), class_validator_1.IsIn(['YES', 'NO'], { message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.NotInAllowedSet, 'SmsExpiredCard'), }), __metadata("design:type", String) ], BaseDebitDTO.prototype, "SmsExpiredCard", void 0); __decorate([ class_validator_1.IsOptional(), __metadata("design:type", Object) ], BaseDebitDTO.prototype, "Username", void 0); __decorate([ class_validator_1.IsOptional(), class_validator_1.MaxLength(50, { message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.FieldTooLong, 'YourGeneralReference'), }), __metadata("design:type", Object) ], BaseDebitDTO.prototype, "YourGeneralReference", void 0); __decorate([ class_validator_1.IsOptional(), class_validator_1.MaxLength(30, { message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.FieldTooLong, 'FirstName'), }), __metadata("design:type", Object) ], BaseDebitDTO.prototype, "FirstName", void 0); __decorate([ class_validator_1.IsOptional(), class_validator_1.MaxLength(255, { message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.FieldTooLong, 'EmailAddress'), }), class_validator_1.IsEmail(undefined, { message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.NotAnEmail, 'EmailAddress'), }), __metadata("design:type", Object) ], BaseDebitDTO.prototype, "EmailAddress", void 0); __decorate([ class_validator_1.IsOptional(), class_validator_1.MaxLength(10, { message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.FieldTooLong, 'MobilePhoneNumber'), }), class_validator_1.IsMobilePhone('en-AU', undefined, { message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.NotAMobilePhone, 'MobilePhoneNumber'), }), __metadata("design:type", Object) ], BaseDebitDTO.prototype, "MobilePhoneNumber", void 0); return BaseDebitDTO; }()); exports.BaseDebitDTO = BaseDebitDTO;