public static Coupon newCoupon(String batchId, String id, Integer fee){ Coupon c = new Coupon(); c.batchId = batchId; c.id = id; c.fee = fee; return c; }
private void setCoupons(WePayOrder order, Map<String, Object> orderData) { if (order != null && order.getCouponCount() != null && order.getCouponCount() > 0){ List<Coupon> coupons = new ArrayList<>(); Coupon coupon; for (int couponIndex = 0; couponIndex < order.getCouponCount(); couponIndex++){ coupon = Coupon.newCoupon( (String)orderData.get(WepayField.COUPON_BATCH_ID + "_" + couponIndex), (String) orderData.get(WepayField.COUPON_ID + "_" + couponIndex), Integer.parseInt((String) orderData.get(WepayField.COUPON_FEE + "_" + couponIndex)) ); coupons.add(coupon); } order.setCoupons(coupons); } }
private void setCoupons(WePayOrder order, Map<String, Object> orderData) { if (order != null && order.getCouponCount() != null && order.getCouponCount() > 0){ List<Coupon> coupons = new ArrayList<>(); Coupon coupon; for (int couponIndex = 0; couponIndex < order.getCouponCount(); couponIndex++){ coupon = Coupon.newCoupon( (String)orderData.get(WepayField.COUPON_BATCH_ID + "_" + couponIndex), (String) orderData.get(WepayField.COUPON_ID + "_" + couponIndex), Integer.parseInt((String) orderData.get(WepayField.COUPON_FEE + "_" + couponIndex)) ); coupons.add(coupon); } order.setCoupons(coupons); } }
public static Coupon newCoupon(String batchId, String id, Integer fee){ Coupon c = new Coupon(); c.batchId = batchId; c.id = id; c.fee = fee; return c; }
Coupon couponItem; for (int couponItemIndex = 0; couponItemIndex < couponRefundCount; couponItemIndex++){ couponItem = Coupon.newCoupon( (String) refundData.get(WepayField.COUPON_REFUND_BATCH_ID + "_" + refundItemIndex + "_" + couponItemIndex), (String) refundData.get(WepayField.COUPON_REFUND_ID + "_" + refundItemIndex + "_" + couponItemIndex),
couponReader: function () { var self = this , coupon = new Coupon(); coupon.fetch({success: function (model, response) { Cart.add(model); }); }
Coupon couponItem; for (int couponItemIndex = 0; couponItemIndex < couponRefundCount; couponItemIndex++){ couponItem = Coupon.newCoupon( (String) refundData.get(WepayField.COUPON_REFUND_BATCH_ID + "_" + refundItemIndex + "_" + couponItemIndex), (String) refundData.get(WepayField.COUPON_REFUND_ID + "_" + refundItemIndex + "_" + couponItemIndex),
List<Coupon> couponsList = new ArrayList<>(); JSONArray coupons = json .getJSONArray(TAG_COUPONS); // JSON Array for (JSONObject coupon : (Iterable<JSONObject>) coupons) { String text = coupon.get("text"); couponsList.add(new Coupon(text)); }
final GenericRawResults<Coupon> results = couponDao.queryRaw("SELECT " + "product_table.product_id AS id, " + "product_table.store_id AS storeId " + " FROM coupon_table " + "JOIN product_table ON coupon_table.store_id = product_table.store_id " + "WHERE product_table.store_id = 1", new RawRowMapper<Coupon>() { @Override public Coupon mapRow(String[] columnNames, String[] resultColumns) throws SQLException { final Integer productId = Integer.parseInt(resultColumns[0]); final Integer storeId = Integer.parseInt(resultColumns[1]); final Product product = new Product(); product.setId(productId); product.setStoreId(storeId); final Coupon coupon = new Coupon(); coupon.setProduct(product); return coupon; } }); final Coupon coupon = results.getResults().get(0); final Product product = coupon.getProduct(); System.out.println("Product id is " + product.getId() + " , Store id is " + product.getStoreId());
Coupon coupon = new Coupon(jsonObject.getString(KEY_TITLE), jsonObject.getString(KEY_NAME), jsonObject.getString(KEY_CODE),
Coupon newCoupon = new Coupon(sc.next(), sc.nextDouble()); coupons.add(i, newCoupon); sc.nextLine();