}
@Override
public Referenced unwrap(HttpServletRequest request, ApplicationContext context) {
SecureOrderPaymentService securePaymentInfoService = (SecureOrderPaymentService) context.getBean("blSecureOrderPaymentService");
if (CreditCardPayment.class.getName().equals(this.type)) {
CreditCardPayment paymentInfo = (CreditCardPayment) securePaymentInfoService.create(PaymentType.CREDIT_CARD);
paymentInfo.setId(this.id);
paymentInfo.setReferenceNumber(this.referenceNumber);
paymentInfo.setPan(this.pan);
paymentInfo.setCvvCode(this.cvvCode);
paymentInfo.setExpirationMonth(this.expirationMonth);
paymentInfo.setExpirationYear(this.expirationYear);
return paymentInfo;
}
if (BankAccountPayment.class.getName().equals(this.type)) {
BankAccountPayment paymentInfo = (BankAccountPayment) securePaymentInfoService.create(PaymentType.BANK_ACCOUNT);
paymentInfo.setId(this.id);
paymentInfo.setReferenceNumber(this.referenceNumber);
paymentInfo.setAccountNumber(this.accountNumber);
paymentInfo.setRoutingNumber(this.routingNumber);
return paymentInfo;
}
if (GiftCardPayment.class.getName().equals(this.type)) {
GiftCardPayment paymentInfo = (GiftCardPayment) securePaymentInfoService.create(PaymentType.GIFT_CARD);
paymentInfo.setId(this.id);
paymentInfo.setReferenceNumber(this.referenceNumber);
paymentInfo.setPan(this.pan);
paymentInfo.setPin(this.pin);