/**
* @throws Exception
*
*/
public PaymentMethodViewBean buildViewBeanPaymentMethod(final RequestData requestData, final AbstractPaymentGateway paymentGateway) throws Exception {
final PaymentMethodViewBean paymentMethodViewBean = new PaymentMethodViewBean();
paymentMethodViewBean.setCode(paymentGateway.getCode());
paymentMethodViewBean.setName(paymentGateway.getName());
paymentMethodViewBean.setDescription(paymentGateway.getDescription());
final Set<PaymentGatewayOption> paymentGatewayOptions = paymentGateway.getOptions();
if(Hibernate.isInitialized(paymentGatewayOptions) && paymentGatewayOptions != null){
for (Iterator<PaymentGatewayOption> iterator = paymentGatewayOptions.iterator(); iterator.hasNext();) {
PaymentGatewayOption paymentGatewayOption = (PaymentGatewayOption) iterator.next();
paymentMethodViewBean.getPaymentMethodOptions().add(buildViewBeanPaymentMethodOption(requestData, paymentGatewayOption));
}
}
return paymentMethodViewBean;
}