Skip to content
This repository has been archived by the owner on Oct 15, 2019. It is now read-only.

Commit

Permalink
Special in ticket
Browse files Browse the repository at this point in the history
  • Loading branch information
Zenedith committed Mar 6, 2016
1 parent b511332 commit 1a7d779
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 17 deletions.
23 changes: 16 additions & 7 deletions lib/model/response/ticketDetailsResponse.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
var TicketDetailsResponse = function TicketDetailsResponse(id,
code,
purchaseOrderNumber,
amount,
date,
pointOfSale,
taxRegistrationNumber,
trade) {
code,
purchaseOrderNumber,
amount,
date,
special,
pointOfSale,
taxRegistrationNumber,
trade) {
this.id = id;
this.code = code;
this.purchaseOrderNumber = purchaseOrderNumber;
this.amount = amount;
this.date = date;
this.special = special;
this.pointOfSale = pointOfSale;
this.taxRegistrationNumber = taxRegistrationNumber;
this.trade = trade;
Expand All @@ -22,6 +24,7 @@ var TicketDetailsResponseBuilder = function TicketDetailsResponseBuilder() {
this.purchaseOrderNumber = null;
this.amount = null;
this.date = null;
this.special = null;
this.pointOfSale = null;
this.taxRegistrationNumber = null;
this.trade = null;
Expand Down Expand Up @@ -53,6 +56,11 @@ var TicketDetailsResponseBuilder = function TicketDetailsResponseBuilder() {
return self;
};

this.withSpecial = function withSpecial(special) {
self.special = special;
return self;
};

this.withPointOfSale = function withPointOfSale(pointOfSale) {
self.pointOfSale = pointOfSale;
return self;
Expand All @@ -75,6 +83,7 @@ var TicketDetailsResponseBuilder = function TicketDetailsResponseBuilder() {
self.purchaseOrderNumber,
self.amount,
self.date,
self.special,
self.pointOfSale,
self.taxRegistrationNumber,
self.trade
Expand Down
25 changes: 19 additions & 6 deletions lib/model/response/ticketResponse.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
var TicketResponse = function TicketResponse(id, code, purchaseOrderNumber, amount, date) {
var TicketResponse = function TicketResponse(id,
code,
purchaseOrderNumber,
amount,
date,
special) {
this.id = id;
this.code = code;
this.purchaseOrderNumber = purchaseOrderNumber;
this.amount = amount;
this.date = date;
this.special = special;
};

var TicketResponseBuilder = function TicketResponseBuilder() {
Expand All @@ -12,6 +18,7 @@ var TicketResponseBuilder = function TicketResponseBuilder() {
this.purchaseOrderNumber = null;
this.amount = null;
this.date = null;
this.special = null;

var self = this;

Expand Down Expand Up @@ -40,14 +47,20 @@ var TicketResponseBuilder = function TicketResponseBuilder() {
return self;
};

this.withSpecial = function withSpecial(special) {
self.special = special;
return self;
};


this.build = function build() {
return new TicketResponse(
self.id,
self.code,
self.purchaseOrderNumber,
self.amount,
self.date
self.id,
self.code,
self.purchaseOrderNumber,
self.amount,
self.date,
self.special
);
};

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "receipts-model",
"version": "1.2.0",
"version": "1.3.0",
"description": "Receipts model.",
"main": "./index.js",
"dependencies": {
Expand Down Expand Up @@ -38,6 +38,6 @@
"node": ">=5.6.0"
},
"readmeFilename": "README.md",
"_id": "receipts-model@1.2.0",
"_from": "receipts-model@^1.2.0"
"_id": "receipts-model@1.3.0",
"_from": "receipts-model@^1.3.0"
}
5 changes: 5 additions & 0 deletions test/model/response/ticketDetailsResponseTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe('ticketDetailsResponse model test', function () {
var purchaseOrderNumber = 'purchaseOrderNumber';
var amount = 'amount';
var date = 'date';
var special = 'special';
var pointOfSale = 'pointOfSale';
var taxRegistrationNumber = 'taxRegistrationNumber';
var trade = 'trade';
Expand All @@ -21,6 +22,7 @@ describe('ticketDetailsResponse model test', function () {
purchaseOrderNumber,
amount,
date,
special,
pointOfSale,
taxRegistrationNumber,
trade
Expand All @@ -32,6 +34,7 @@ describe('ticketDetailsResponse model test', function () {
ticketDetailsResponseModel.purchaseOrderNumber.should.be.equal(purchaseOrderNumber);
ticketDetailsResponseModel.amount.should.be.equal(amount);
ticketDetailsResponseModel.date.should.be.equal(date);
ticketDetailsResponseModel.special.should.be.equal(special);
ticketDetailsResponseModel.pointOfSale.should.be.equal(pointOfSale);
ticketDetailsResponseModel.taxRegistrationNumber.should.be.equal(taxRegistrationNumber);
ticketDetailsResponseModel.trade.should.be.equal(trade);
Expand All @@ -47,6 +50,7 @@ describe('ticketDetailsResponse model test', function () {
.withPurchaseOrderNumber(purchaseOrderNumber)
.withAmount(amount)
.withDate(date)
.withSpecial(special)
.withPointOfSale(pointOfSale)
.withTaxRegistrationNumber(taxRegistrationNumber)
.withTrade(trade)
Expand All @@ -58,6 +62,7 @@ describe('ticketDetailsResponse model test', function () {
ticketDetailsResponseModel.purchaseOrderNumber.should.be.equal(purchaseOrderNumber);
ticketDetailsResponseModel.amount.should.be.equal(amount);
ticketDetailsResponseModel.date.should.be.equal(date);
ticketDetailsResponseModel.special.should.be.equal(special);
ticketDetailsResponseModel.pointOfSale.should.be.equal(pointOfSale);
ticketDetailsResponseModel.taxRegistrationNumber.should.be.equal(taxRegistrationNumber);
ticketDetailsResponseModel.trade.should.be.equal(trade);
Expand Down
7 changes: 6 additions & 1 deletion test/model/response/ticketResponseTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe('ticketResponse model test', function () {
var purchaseOrderNumber = 'purchaseOrderNumber';
var amount = 'amount';
var date = 'date';
var special = 'special';

it('should create model', function (done) {

Expand All @@ -17,7 +18,8 @@ describe('ticketResponse model test', function () {
code,
purchaseOrderNumber,
amount,
date
date,
special
);

should.exist(ticketResponseModel);
Expand All @@ -26,6 +28,7 @@ describe('ticketResponse model test', function () {
ticketResponseModel.purchaseOrderNumber.should.be.equal(purchaseOrderNumber);
ticketResponseModel.amount.should.be.equal(amount);
ticketResponseModel.date.should.be.equal(date);
ticketResponseModel.special.should.be.equal(special);
done();
});

Expand All @@ -37,6 +40,7 @@ describe('ticketResponse model test', function () {
.withPurchaseOrderNumber(purchaseOrderNumber)
.withAmount(amount)
.withDate(date)
.withSpecial(special)
.build();

should.exist(ticketResponseModel);
Expand All @@ -45,6 +49,7 @@ describe('ticketResponse model test', function () {
ticketResponseModel.purchaseOrderNumber.should.be.equal(purchaseOrderNumber);
ticketResponseModel.amount.should.be.equal(amount);
ticketResponseModel.date.should.be.equal(date);
ticketResponseModel.special.should.be.equal(special);
done();
});

Expand Down

0 comments on commit 1a7d779

Please sign in to comment.