Package in.juspay.model

Examples of in.juspay.model.PromotionCondition


        CreatePromotionRequest promotionRequest = new CreatePromotionRequest();
        promotionRequest.setOrderId(orderId);

        promotionRequest.setDiscountAmount(1.00);
        List<PromotionCondition> promotionConditions = new ArrayList<PromotionCondition>();
        PromotionCondition promotionCondition = new PromotionCondition();
        promotionCondition.setDimension("card_number");
        promotionCondition.setValue("4242424242424242");
        promotionConditions.add(promotionCondition);
        promotionRequest.setPromotionConditions(promotionConditions);

        CreatePromotionResponse promotionResponse = juspayService.createPromotion(promotionRequest);
        assertTrue(promotionResponse.isSuccess());
View Full Code Here


        ArrayList<JSONObject> conditions = (ArrayList<JSONObject>) jsonObject.get("conditions");
        ArrayList<JSONObject> rules = (ArrayList<JSONObject>) jsonObject.get("rules");

        List<PromotionCondition> promotionConditions = new ArrayList<PromotionCondition>();
        for(JSONObject jsonCondition : (conditions != null ? conditions : rules)) {
            PromotionCondition promotionCondition = new PromotionCondition();
            promotionCondition.setDimension((String) jsonCondition.get("dimension"));
            promotionCondition.setValue((String) jsonCondition.get("value"));
            promotionConditions.add(promotionCondition);
        }
        promotion.setPromotionConditions(promotionConditions);
        return promotion;
    }
View Full Code Here

        CreatePromotionRequest promotionRequest = new CreatePromotionRequest();
        promotionRequest.setOrderId(orderId);

        promotionRequest.setDiscountAmount(1.00);
        List<PromotionCondition> promotionConditions = new ArrayList<PromotionCondition>();
        PromotionCondition promotionCondition = new PromotionCondition();
        promotionCondition.setDimension("card_number");
        promotionCondition.setValue("4242424242424242");
        promotionConditions.add(promotionCondition);
        promotionRequest.setPromotionConditions(promotionConditions);

        CreatePromotionResponse promotionResponse = juspayService.createPromotion(promotionRequest);
        assertTrue(promotionResponse.isSuccess());
View Full Code Here

    public CreatePromotionResponse createPromotion(CreatePromotionRequest createPromotionRequest) {
        LinkedHashMap<String, String> params = new LinkedHashMap<String, String>();
        params.put("order_id", createPromotionRequest.getOrderId());
        params.put("discount_amount", Double.valueOf(createPromotionRequest.getDiscountAmount()).toString());
        for(int i=0; i < createPromotionRequest.getPromotionConditions().size(); i++) {
            PromotionCondition condition = createPromotionRequest.getPromotionConditions().get(i);
            params.put("dimensions[" + i + "]", condition.getDimension());
            params.put("values[" + i + "]", condition.getValue());
        }
        String serializedParams = serializeParams(params);
        String url = baseUrl + "/promotions";

        String response = makeServiceCall(url, serializedParams);
View Full Code Here

TOP

Related Classes of in.juspay.model.PromotionCondition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.