[pal-cvs 2955] [699] supported e-collect.

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2007年 11月 9日 (金) 18:00:33 JST


Revision: 699
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=699
Author:   shinsuke
Date:     2007-11-09 18:00:33 +0900 (Fri, 09 Nov 2007)

Log Message:
-----------
supported e-collect.

Added Paths:
-----------
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/fee/impl/ECollectPaymentCalculator.java


-------------- next part --------------
Added: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/fee/impl/ECollectPaymentCalculator.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/fee/impl/ECollectPaymentCalculator.java	2007-11-09 09:00:16 UTC (rev 698)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/fee/impl/ECollectPaymentCalculator.java	2007-11-09 09:00:33 UTC (rev 699)
@@ -0,0 +1,115 @@
+package jp.sf.pal.pompei.fee.impl;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+
+import jp.sf.pal.pompei.PompeiConstants;
+import jp.sf.pal.pompei.exentity.AddressBook;
+import jp.sf.pal.pompei.exentity.CustomerBasket;
+import jp.sf.pal.pompei.fee.FeeCalculator;
+
+public class ECollectPaymentCalculator implements FeeCalculator {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = -8969173998476815297L;
+
+    public static final String CASH = "CASH";
+
+    public static final String CREDITCARD = "CREDITCARD";
+
+    private String type;
+
+    public BigDecimal calculate(List<CustomerBasket> list,
+            AddressBook deliveryAddressBook, Map<String, Object> informationMap) {
+
+        if (CASH.equals(getType())) {
+            return calculateForCash(list, deliveryAddressBook, informationMap);
+        } else if (CREDITCARD.equals(getType())) {
+            return calculateForCreditcard(list, deliveryAddressBook,
+                    informationMap);
+        }
+
+        return new BigDecimal(0);
+    }
+
+    protected BigDecimal calculateForCash(List<CustomerBasket> list,
+            AddressBook deliveryAddressBook, Map<String, Object> informationMap) {
+        return calculateCharge(list, deliveryAddressBook, informationMap).add(
+                calculateFiscal(list, deliveryAddressBook, informationMap));
+    }
+
+    protected BigDecimal calculateForCreditcard(List<CustomerBasket> list,
+            AddressBook deliveryAddressBook, Map<String, Object> informationMap) {
+        return calculateCharge(list, deliveryAddressBook, informationMap);
+    }
+
+    protected BigDecimal calculateCharge(List<CustomerBasket> list,
+            AddressBook deliveryAddressBook, Map<String, Object> informationMap) {
+        BigDecimal subTotalPrice = (BigDecimal) informationMap
+                .get(PompeiConstants.SUB_TOTAL_PRICE);
+        //    代引金額    代引手数料(税込)
+        //    1万円まで   315円
+        //    3万円まで   420円
+        //    10万円まで  630円
+        //    30万円まで  1,050円
+        //    50万円まで  2,100円
+        //    100万円まで     3,150円
+        //    100万円を超える場合     4,200円
+        if (subTotalPrice.compareTo(BigDecimal.valueOf(10000)) <= 0) {
+            return BigDecimal.valueOf(315);
+        } else if (subTotalPrice.compareTo(BigDecimal.valueOf(30000)) <= 0) {
+            return BigDecimal.valueOf(420);
+        } else if (subTotalPrice.compareTo(BigDecimal.valueOf(100000)) <= 0) {
+            return BigDecimal.valueOf(630);
+        } else if (subTotalPrice.compareTo(BigDecimal.valueOf(300000)) <= 0) {
+            return BigDecimal.valueOf(1050);
+        } else if (subTotalPrice.compareTo(BigDecimal.valueOf(500000)) <= 0) {
+            return BigDecimal.valueOf(2100);
+        } else if (subTotalPrice.compareTo(BigDecimal.valueOf(1000000)) <= 0) {
+            return BigDecimal.valueOf(3150);
+        }
+        return BigDecimal.valueOf(4200);
+    }
+
+    protected BigDecimal calculateFiscal(List<CustomerBasket> list,
+            AddressBook deliveryAddressBook, Map<String, Object> informationMap) {
+        BigDecimal subTotalPrice = (BigDecimal) informationMap
+                .get(PompeiConstants.SUB_TOTAL_PRICE);
+        //        消費税を除いた代引金額     収入印紙代相当額
+        //        3万円以上〜100万円以下   200円
+        //        200万円以下     400円
+        //        300万円以下     600円
+        //        500万円以下     1,000円
+        if (subTotalPrice.compareTo(BigDecimal.valueOf(30000)) < 0) {
+            return BigDecimal.valueOf(0);
+        } else if (subTotalPrice.compareTo(BigDecimal.valueOf(1000000)) <= 0) {
+            return BigDecimal.valueOf(200);
+        } else if (subTotalPrice.compareTo(BigDecimal.valueOf(2000000)) <= 0) {
+            return BigDecimal.valueOf(400);
+        } else if (subTotalPrice.compareTo(BigDecimal.valueOf(3000000)) <= 0) {
+            return BigDecimal.valueOf(600);
+        } else if (subTotalPrice.compareTo(BigDecimal.valueOf(5000000)) <= 0) {
+            return BigDecimal.valueOf(1000);
+        }
+        //TODO ?
+        return BigDecimal.valueOf(1000);
+    }
+
+    /**
+     * @return the type
+     */
+    public String getType() {
+        return type;
+    }
+
+    /**
+     * @param type the type to set
+     */
+    public void setType(String type) {
+        this.type = type;
+    }
+
+}


Property changes on: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/fee/impl/ECollectPaymentCalculator.java
___________________________________________________________________
Name: svn:eol-style
   + native


pal-cvs メーリングリストの案内
Back to archive index