|
|
|
@@ -3,7 +3,9 @@ package com.iformall.service.pay; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
|
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.enums.EnumPayWay; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.service.pay.impl.WxPayAdapterService; |
|
|
|
|
|
|
|
/** |
|
|
|
@@ -14,7 +16,7 @@ public class PayServiceFactory { |
|
|
|
|
|
|
|
private static Map<Integer,PayAdapterService> serviceMap = new ConcurrentHashMap<Integer, PayAdapterService>(); |
|
|
|
|
|
|
|
public static PayAdapterService getPayAdapterService(Integer type) { |
|
|
|
public static PayAdapterService getPayAdapterService(Integer type) throws MallinkException{ |
|
|
|
if (serviceMap.containsKey(type)) { |
|
|
|
return serviceMap.get(type); |
|
|
|
}else { |
|
|
|
@@ -26,6 +28,10 @@ public class PayServiceFactory { |
|
|
|
} |
|
|
|
serviceMap.put(type, payService); |
|
|
|
} |
|
|
|
return serviceMap.get(type); |
|
|
|
PayAdapterService service = serviceMap.get(type); |
|
|
|
if (null == service) { |
|
|
|
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"payType["+type+"] 支付service未找到"); |
|
|
|
} |
|
|
|
return service; |
|
|
|
} |
|
|
|
} |