@atomixdesign/nodepay-ezidebit
Version:
Nodepay strategy for the Ezidebit payment gateway.
172 lines (171 loc) • 8.95 kB
JavaScript
;
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.CustomerDetailsDTO = 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 CustomerDetailsDTO = /** @class */ (function () {
function CustomerDetailsDTO(customerDetails) {
log("building " + this.constructor.name);
log({ customerDetails: customerDetails });
this.YourSystemReference = customerDetails.YourSystemReference;
this.NewYourSystemReference = customerDetails.NewYourSystemReference;
this.YourGeneralReference = customerDetails.YourGeneralReference;
this.LastName = customerDetails.LastName;
this.FirstName = customerDetails.FirstName;
this.AddressLine1 = customerDetails.AddressLine1;
this.AddressLine2 = customerDetails.AddressLine2;
this.AddressSuburb = customerDetails.AddressSuburb;
this.AddressState = customerDetails.AddressState;
this.AddressPostCode = customerDetails.AddressPostCode;
this.EmailAddress = customerDetails.EmailAddress;
this.MobilePhoneNumber = customerDetails.MobilePhoneNumber;
this.SmsPaymentReminder = customerDetails.SmsPaymentReminder;
this.SmsFailedNotification = customerDetails.SmsFailedNotification;
this.SmsExpiredCard = customerDetails.SmsExpiredCard;
this.Username = customerDetails.Username;
}
__decorate([
class_validator_1.MaxLength(50, {
message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.FieldTooLong, 'YourSystemReference'),
}),
__metadata("design:type", String)
], CustomerDetailsDTO.prototype, "YourSystemReference", void 0);
__decorate([
class_validator_1.MaxLength(50, {
message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.FieldTooLong, 'NewYourSystemReference'),
}),
__metadata("design:type", String)
], CustomerDetailsDTO.prototype, "NewYourSystemReference", 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)
], CustomerDetailsDTO.prototype, "YourGeneralReference", 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)
], CustomerDetailsDTO.prototype, "LastName", 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)
], CustomerDetailsDTO.prototype, "FirstName", void 0);
__decorate([
class_validator_1.IsOptional(),
class_validator_1.MaxLength(30, {
message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.FieldTooLong, 'AddressLine1'),
}),
__metadata("design:type", Object)
], CustomerDetailsDTO.prototype, "AddressLine1", void 0);
__decorate([
class_validator_1.IsOptional(),
class_validator_1.MaxLength(30, {
message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.FieldTooLong, 'AddressLine2'),
}),
__metadata("design:type", Object)
], CustomerDetailsDTO.prototype, "AddressLine2", void 0);
__decorate([
class_validator_1.IsOptional(),
class_validator_1.MaxLength(20, {
message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.FieldTooLong, 'AddressSuburb'),
}),
__metadata("design:type", Object)
], CustomerDetailsDTO.prototype, "AddressSuburb", void 0);
__decorate([
class_validator_1.IsOptional(),
class_validator_1.MaxLength(3, {
message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.FieldTooLong, 'AddressState'),
}),
__metadata("design:type", Object)
], CustomerDetailsDTO.prototype, "AddressState", void 0);
__decorate([
class_validator_1.IsOptional(),
class_validator_1.IsNumberString(undefined, {
message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.NotANumber, 'AddressPostCode'),
}),
class_validator_1.MaxLength(4, {
message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.FieldTooLong, 'AddressPostCode'),
}),
__metadata("design:type", Object)
], CustomerDetailsDTO.prototype, "AddressPostCode", 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)
], CustomerDetailsDTO.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)
], CustomerDetailsDTO.prototype, "MobilePhoneNumber", 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)
], CustomerDetailsDTO.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)
], CustomerDetailsDTO.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)
], CustomerDetailsDTO.prototype, "SmsExpiredCard", void 0);
__decorate([
class_validator_1.IsOptional(),
class_validator_1.MaxLength(50, {
message: validation_1.ErrorFactory.getErrorMessage(validation_1.ErrorType.FieldTooLong, 'Username'),
}),
__metadata("design:type", Object)
], CustomerDetailsDTO.prototype, "Username", void 0);
return CustomerDetailsDTO;
}());
exports.CustomerDetailsDTO = CustomerDetailsDTO;