Skip to content

Commit

Permalink
Add changes for bookings and structure
Browse files Browse the repository at this point in the history
- add new credit card entity for booking
- add mobile phone in structure details
- add notes for booking
- remove required phone in guest details
  • Loading branch information
alberto committed May 8, 2013
1 parent 2d9fda1 commit 809cd4b
Show file tree
Hide file tree
Showing 16 changed files with 439 additions and 13 deletions.
38 changes: 38 additions & 0 deletions sql/locanda.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1029,4 +1029,42 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

--
-- Table structure for table `creditCard`
--

DROP TABLE IF EXISTS `creditCard`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `creditCard` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`cardType` varchar(45) DEFAULT NULL,
`cardNumber` varchar(45) DEFAULT NULL,
`expMonth` tinyint(4) DEFAULT NULL,
`expYear` smallint(6) DEFAULT NULL,
`firstName` varchar(255) DEFAULT NULL,
`lastName` varchar(255) DEFAULT NULL,
`securityCode` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `creditCard`
--

LOCK TABLES `creditCard` WRITE;
/*!40000 ALTER TABLE `creditCard` DISABLE KEYS */;
/*!40000 ALTER TABLE `creditCard` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2013-04-18 16:38:58
27 changes: 25 additions & 2 deletions src/action/BookingAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.commons.lang.time.DateUtils;

import model.Adjustment;
import model.CreditCard;
import model.ExtraItem;
import model.Booking;
import model.Extra;
Expand All @@ -49,6 +50,7 @@

import service.BookingService;
import service.ConventionService;
import service.CreditCardService;
import service.ExtraService;
import service.GroupLeaderService;
import service.GuestService;
Expand Down Expand Up @@ -99,6 +101,9 @@ public class BookingAction extends ActionSupport implements SessionAware,UserAwa
private GroupLeaderService groupLeaderService = null;
@Autowired
private HousedService housedService = null;
@Autowired
private CreditCardService creditCardService = null;

private static Logger logger = Logger.getLogger(Logger.class);

@Actions({
Expand Down Expand Up @@ -393,6 +398,7 @@ public String saveUpdateBooking(){
Guest booker = null;
Booking booking = null;
Convention convention = null;
CreditCard creditCard = null;

if(!this.checkBookingDates(this.getIdStructure())){
return ERROR;
Expand Down Expand Up @@ -429,9 +435,12 @@ public String saveUpdateBooking(){

booking.setId_room(this.getBooking().getRoom().getId());

convention = booking.getConvention();
convention = this.getBooking().getConvention();
booking.setId_convention(convention.getId());
booking.setNotes(this.getBooking().getNotes());
creditCard = this.getBooking().getCreditCard();
booking.setCreditCard(creditCard);
logger.info("****** carta di credito " + creditCard.getCardType());
booking.setStatus(this.getBooking().getStatus());
booking.setId_structure(this.getIdStructure());

Expand All @@ -456,6 +465,7 @@ public String goAddNewBookingFromPlanner() {
Integer numNights = 0;
Double roomSubtotal = 0.0;
Booking booking = null;
CreditCard creditCard = new CreditCard();

booking = new Booking();
this.getSession().put("booking", booking);
Expand All @@ -470,6 +480,8 @@ public String goAddNewBookingFromPlanner() {
defaultConvention = this.getConventionService().findConventionsByIdStructure(this.getIdStructure()).get(0);
booking.setConvention(defaultConvention);

booking.setCreditCard(creditCard);

roomSubtotal = this.getBookingService().calculateRoomSubtotalForBooking(this.getIdStructure(),booking);
booking.setRoomSubtotal(roomSubtotal);

Expand All @@ -493,12 +505,15 @@ public String goAddNewBookingFromPlanner() {
public String goAddNewBooking() {
Convention defaultConvention = null;
Booking booking = null;
CreditCard creditCard = new CreditCard();

booking = new Booking();
this.getSession().put("booking", booking);

defaultConvention = this.getConventionService().findConventionsByIdStructure(this.getIdStructure()).get(0);
booking.setConvention(defaultConvention);
booking.setCreditCard(creditCard);

this.setBooking(booking);

this.setRooms(this.getRoomService().findRoomsByIdStructure(this.getIdStructure()));
Expand Down Expand Up @@ -569,7 +584,7 @@ public String goUpdateBooking() {

paymentsSubtotal = this.getBooking().calculatePaymentsSubtotal();
this.setPaymentsSubtotal(paymentsSubtotal);

this.updateListNumGuests(booking);
return SUCCESS;
}
Expand Down Expand Up @@ -1014,6 +1029,14 @@ public void setHousedService(HousedService housedService) {
this.housedService = housedService;
}

public CreditCardService getCreditCardService() {
return creditCardService;
}

public void setCreditCardService(CreditCardService creditCardService) {
this.creditCardService = creditCardService;
}

public String getDateStart() {
return dateStart;
}
Expand Down
12 changes: 12 additions & 0 deletions src/global_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@ createAccountSuccess = Account created successfully

createAccountSuccessMessage = Congratulation! Your account has been created successfully. Now you are able to log in to locanda by using the following data

creditCard = Credit Card

creditCardNumber = Card number

creditCardType = Card Type

creditCardExpirationDate = Expiration Date

creditCardSecurityCode = Security Code

customer = Customer

customizeLayout = Customize Layout
Expand Down Expand Up @@ -357,6 +367,8 @@ mobile = Mobile

monday = Monday

month = Month

name = Name

new = New
Expand Down
12 changes: 12 additions & 0 deletions src/global_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,16 @@ createAccountSuccess = Cuenta creada correctamente

createAccountSuccessMessage = Felicidades! Tu cuenta ha sido creada. Puede acceder al sistema utilizando estos datos:

creditCard = Tarjeta de crédito

creditCardNumber = Número de tarjeta

creditCardType = Tipo de tarjeta

creditCardExpirationDate = Fecha de vencimiento

creditCardSecurityCode = Código de Seguridad

customer = Cliente

customizeLayout = Personaliza tu distribuci\u00F3n
Expand Down Expand Up @@ -319,6 +329,8 @@ mobile = Mobile

monday = Lunes

month = Mes

name = Nombre

new = Nuevo
Expand Down
12 changes: 12 additions & 0 deletions src/global_it.properties
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@ createAccountSuccess = Account creato con successo

createAccountSuccessMessage = Complimenti! Account creato con successo. Ora puoi accedere al sistema utilizzando le seguenti credenziali:

creditCard = Carta di credito

creditCardNumber = Numero Carta

creditCardType = Tipo Carta

creditCardExpirationDate = Data Scadenza

creditCardSecurityCode = CVV

customer = Cliente

customizeLayout = Personalizza il Layout
Expand Down Expand Up @@ -359,6 +369,8 @@ mobile = Cellulare

monday = Luned\u00EC

month = Mese

name = Nome

new = Nuova
Expand Down
9 changes: 9 additions & 0 deletions src/model/Booking.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class Booking implements Serializable{
private List<Guest> guests = null;
private Convention convention = null;
private List<ExtraItem> extraItems;
private CreditCard creditCard = null;
private Integer id_structure = null;
private Integer id_convention = null;
private Integer id_room = null;
Expand Down Expand Up @@ -344,6 +345,14 @@ public Convention getConvention() {
public void setConvention(Convention convention) {
this.convention = convention;
}
public CreditCard getCreditCard() {
return creditCard;
}

public void setCreditCard(CreditCard creditCard) {
this.creditCard = creditCard;
}

public List<ExtraItem> getExtraItems() {
return extraItems;
}
Expand Down
98 changes: 98 additions & 0 deletions src/model/CreditCard.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package model;

import java.io.Serializable;

import javax.xml.bind.annotation.XmlRootElement;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;

public class CreditCard implements Serializable {
private Integer id;
private String cardType;
private String cardNumber;
private Integer expMonth;
private Integer expYear;
private String securityCode;
private String firstName;
private String lastName;
private Integer id_booking;

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
CreditCard other = (CreditCard) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCardType() {
return cardType;
}
public void setCardType(String cardType) {
this.cardType = cardType;
}
public String getCardNumber() {
return cardNumber;
}
public void setCardNumber(String cardNumber) {
this.cardNumber = cardNumber;
}
public Integer getExpMonth() {
return expMonth;
}
public void setExpMonth(Integer expMonth) {
this.expMonth = expMonth;
}
public Integer getExpYear() {
return expYear;
}
public void setExpYear(Integer expYear) {
this.expYear = expYear;
}
public String getSecurityCode() {
return securityCode;
}
public void setSecurityCode(String securityCode) {
this.securityCode = securityCode;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public Integer getId_booking() {
return id_booking;
}
public void setId_booking(Integer id_booking) {
this.id_booking = id_booking;
}

}
27 changes: 27 additions & 0 deletions src/persistence/mybatis/mappers/CreditCardMapper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*******************************************************************************
*
* Copyright 2013 - Sardegna Ricerche, Distretto ICT, Pula, Italy
*
* Licensed under the EUPL, Version 1.1.
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://www.osor.eu/eupl
*
* Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and limitations under the Licence.
* In case of controversy the competent court is the Court of Cagliari (Italy).
*******************************************************************************/
package persistence.mybatis.mappers;

import model.CreditCard;

public interface CreditCardMapper {
public CreditCard findCreditCardById(Integer id);
public CreditCard findCreditCardByIdBooking(Integer id_booking);
public Integer updateCreditCard(CreditCard creditCard);
public Integer insertCreditCard(CreditCard creditCard);
public Integer deleteCreditCard(Integer id);
public Integer deleteCreditCardByIdBooking(Integer id_booking);
}
Loading

0 comments on commit 809cd4b

Please sign in to comment.