@Test
 public void testAddCommon() {
   final AbstractOrderEntryModel abstractOrderEntryModel = mock(AbstractOrderEntryModel.class);
   given(cartModel.getCode()).willReturn(CART_CODE);
   given(cartModel.getEntries()).willReturn(Collections.singletonList(abstractOrderEntryModel));
   subsOrderPopulator.addCommon(cartModel, cartData);
   Assert.assertEquals(Integer.valueOf(1), cartData.getTotalItems());
 }
  @Override
  public void process(final CXML input, final CartModel output) {
    final String cartCode = output.getCode();
    LOG.debug(String.format("Placing an order for cart with code: %s", cartCode));

    try {
      final OrderData orderData = b2bCheckoutFlowFacade.placeOrder();
      LOG.debug(String.format("Order with code %s was placed.", orderData.getCode()));
    } catch (final InvalidCartException e) {
      throw new PunchOutException(PunchOutResponseCode.CONFLICT, "Unable to checkout", e);
    }
  }
  /*
   * (non-Javadoc)
   *
   * @see in.com.v2kart.ccavenuepaymentintegration.services.CreateCCAvenuePaymentRequestStrategy#createPaymentRequest (java.lang.String,
   * java.lang.String, java.lang.String, de.hybris.platform.core.model.user.CustomerModel, java.lang.String, java.lang.String,
   * de.hybris.platform.commercefacades.user.data.AddressData, java.lang.String, java.lang.String, java.lang.String)
   */
  @Override
  public CCAvenuePaymentRequest createPaymentRequest(
      final String requestUrl,
      final String successUrl,
      final String cancelUrl,
      final CustomerModel customer,
      final String merchantKey,
      final String enforcedPaymentMethod,
      final AddressData addressData,
      final String currency,
      final String language,
      final String phoneNumber) {
    final CartModel cartModel = getCartService().getSessionCart();
    if (cartModel == null) {
      return null;
    }

    final CCAvenuePaymentRequest request = new CCAvenuePaymentRequest();
    request.setRequestUrl(requestUrl);
    request.setCancelUrl(cancelUrl);
    request.setRedirectUrl(successUrl);
    request.setAmount(String.valueOf(cartModel.getTotalPrice()));
    request.setCurrency(currency);
    request.setLanguage(language);
    request.setMerchantId(merchantKey);
    request.setOrderId(cartModel.getCode() + "_" + System.currentTimeMillis());
    request.setPaymentOption(paymentOptionMappings.get(enforcedPaymentMethod));

    if (addressData != null) {
      request.setCustomerBillToData(getCustomerBillToData(addressData));
    } else {
      final AddressModel address = cartModel.getDeliveryAddress();
      request.setCustomerBillToData(getCustomerBillToDataConverter().convert(address));
    }
    request
        .getCustomerBillToData()
        .setBillToEmail(getCustomerEmailResolutionService().getEmailForCustomer(customer));
    request.getCustomerBillToData().setBillToPhoneNumber(phoneNumber);
    final CountryModel countryModel =
        getCommonI18NService().getCountry(PaymentProperties.INDIA_COUNTRY_ISO);
    request.getCustomerBillToData().setBillToCountry(countryModel.getName());
    return request;
  }