From: Tang Cheng Date: Wed, 17 Jul 2019 11:47:03 +0000 (+0800) Subject: 定义了 AgentPayService X-Git-Tag: 1.0.0^2~31 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=331822dd668d7b4cb6425999cb3a75c292860acb;p=epayment%2Ffood_payapi.git 定义了 AgentPayService --- diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/AgentCode.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/AgentCode.java index a203a67a..66c15796 100644 --- a/payapi/src/main/java/com/supwisdom/dlpay/agent/AgentCode.java +++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/AgentCode.java @@ -4,9 +4,9 @@ public enum AgentCode { SUCCESS("success", "成功"), FAIL("fail", "交易失败"), REFNO_NOT_EXISTS("refno_not_exists", "指定流水不存在"), - ILLEGAL_DATA("illege_data", "数据不合法,不能交易"), + ILLEGAL_DATA("illegal_data", "数据不合法,不能交易"), SERVER_INTERNAL_ERROR("server_internal_error", "交易系统错误"), - NEED_QUERY("need_query", "交易未完成,请查询"), + REQUIRE_QUERY("require_query", "交易未完成,请查询"), WAIT_NOTIFY("wait_notify", "交易已发起,等待通知"), SHORT_OF_BALANCE("short_of_balance", "余额不足"), COMMON_ERROR("common_error", "其它错误"); diff --git a/payapi/src/main/java/com/supwisdom/dlpay/agent/citizencard/YnrccUtil.java b/payapi/src/main/java/com/supwisdom/dlpay/agent/citizencard/YnrccUtil.java index 5b287635..7aa5e958 100644 --- a/payapi/src/main/java/com/supwisdom/dlpay/agent/citizencard/YnrccUtil.java +++ b/payapi/src/main/java/com/supwisdom/dlpay/agent/citizencard/YnrccUtil.java @@ -72,7 +72,7 @@ public class YnrccUtil { errcode.add(Pair.of(AgentCode.ILLEGAL_DATA, new YnrccRespCode("0407", "非大理市民卡,不允许交易"))); errcode.add(Pair.of(AgentCode.FAIL, new YnrccRespCode("0408", "同一请求流水号不允许重复提交"))); errcode.add(Pair.of(AgentCode.COMMON_ERROR, new YnrccRespCode("4444", "其他错误"))); - errcode.add(Pair.of(AgentCode.NEED_QUERY, new YnrccRespCode(CODE_EXCEPTION, "待查询"))); + errcode.add(Pair.of(AgentCode.REQUIRE_QUERY, new YnrccRespCode(CODE_EXCEPTION, "待查询"))); errcode.add(Pair.of(AgentCode.SERVER_INTERNAL_ERROR, new YnrccRespCode(PARAM_CONFIG_ERROR, "{message}"))); errcode.add(Pair.of(AgentCode.SERVER_INTERNAL_ERROR, new YnrccRespCode(PARAM_VALUE_ERROR, "{message}"))); } diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/alipay_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/alipay_service.kt new file mode 100644 index 00000000..eeecae9d --- /dev/null +++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/alipay_service.kt @@ -0,0 +1,25 @@ +package com.supwisdom.dlpay.agent.service + +import com.supwisdom.dlpay.agent.AgentPayService +import com.supwisdom.dlpay.agent.AgentResponse +import com.supwisdom.dlpay.api.domain.TTransactionMain +import org.springframework.stereotype.Component + +@Component("alipayAgent") +class AlipayAgentService : AgentPayService { + override fun pay(transaction: TTransactionMain?): AgentResponse { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun cancel(transaction: TTransactionMain?): AgentResponse { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun refund(transaction: TTransactionMain?): AgentResponse { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun query(transaction: TTransactionMain?): AgentResponse { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } +} \ No newline at end of file diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/balance_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/balance_service.kt new file mode 100644 index 00000000..592153a0 --- /dev/null +++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/balance_service.kt @@ -0,0 +1,33 @@ +package com.supwisdom.dlpay.agent.service + +import com.supwisdom.dlpay.agent.AgentCode +import com.supwisdom.dlpay.agent.AgentPayService +import com.supwisdom.dlpay.agent.AgentResponse +import com.supwisdom.dlpay.api.domain.TTransactionMain +import org.springframework.stereotype.Component + +@Component("balanceAgent") +class BalanceAgentService : AgentPayService { + private val responseCode = AgentResponse().apply { + code = AgentCode.SUCCESS + agentCode = "0" + agentMsg = "成功" + agentRefno = "" + } + + override fun pay(transaction: TTransactionMain): AgentResponse { + return responseCode + } + + override fun cancel(transaction: TTransactionMain): AgentResponse { + return responseCode + } + + override fun refund(transaction: TTransactionMain): AgentResponse { + return responseCode + } + + override fun query(transaction: TTransactionMain): AgentResponse { + return responseCode + } +} \ No newline at end of file diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/swykt_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/swykt_service.kt new file mode 100644 index 00000000..ed323c37 --- /dev/null +++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/swykt_service.kt @@ -0,0 +1,25 @@ +package com.supwisdom.dlpay.agent.service + +import com.supwisdom.dlpay.agent.AgentPayService +import com.supwisdom.dlpay.agent.AgentResponse +import com.supwisdom.dlpay.api.domain.TTransactionMain +import org.springframework.stereotype.Component + +@Component("swyktv5Agent") +class SWYktV5AgentService : AgentPayService { + override fun pay(transaction: TTransactionMain?): AgentResponse { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun cancel(transaction: TTransactionMain?): AgentResponse { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun refund(transaction: TTransactionMain?): AgentResponse { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun query(transaction: TTransactionMain?): AgentResponse { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } +} \ No newline at end of file diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/wanxiao_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/wanxiao_service.kt new file mode 100644 index 00000000..06aa907e --- /dev/null +++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/wanxiao_service.kt @@ -0,0 +1,25 @@ +package com.supwisdom.dlpay.agent.service + +import com.supwisdom.dlpay.agent.AgentPayService +import com.supwisdom.dlpay.agent.AgentResponse +import com.supwisdom.dlpay.api.domain.TTransactionMain +import org.springframework.stereotype.Component + +@Component("wanxiaoAgent") +class WanxiaoAgentService : AgentPayService { + override fun pay(transaction: TTransactionMain?): AgentResponse { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun cancel(transaction: TTransactionMain?): AgentResponse { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun refund(transaction: TTransactionMain?): AgentResponse { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun query(transaction: TTransactionMain?): AgentResponse { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } +} \ No newline at end of file diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/weichat_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/weichat_service.kt new file mode 100644 index 00000000..a6869b5c --- /dev/null +++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/weichat_service.kt @@ -0,0 +1,25 @@ +package com.supwisdom.dlpay.agent.service + +import com.supwisdom.dlpay.agent.AgentPayService +import com.supwisdom.dlpay.agent.AgentResponse +import com.supwisdom.dlpay.api.domain.TTransactionMain +import org.springframework.stereotype.Component + +@Component("wechatpayAgent") +class WeChatPayAgentService : AgentPayService { + override fun pay(transaction: TTransactionMain?): AgentResponse { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun cancel(transaction: TTransactionMain?): AgentResponse { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun refund(transaction: TTransactionMain?): AgentResponse { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun query(transaction: TTransactionMain?): AgentResponse { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } +} \ No newline at end of file diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt index 4261f6c8..55f0697d 100644 --- a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt +++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt @@ -5,13 +5,10 @@ import com.supwisdom.dlpay.agent.AgentPayService import com.supwisdom.dlpay.api.* import com.supwisdom.dlpay.api.bean.* import com.supwisdom.dlpay.api.service.* -import com.supwisdom.dlpay.agent.service.CitizencardPayService import com.supwisdom.dlpay.exception.TransactionCheckException import com.supwisdom.dlpay.framework.ResponseBodyBuilder import com.supwisdom.dlpay.framework.service.SystemUtilService import com.supwisdom.dlpay.framework.util.* -import com.supwisdom.dlpay.agent.citizencard.YnrccUtil -import com.supwisdom.dlpay.agent.service.CitizenCardPayAgent import org.springframework.beans.factory.annotation.Autowired import org.springframework.context.ApplicationContext import org.springframework.http.ResponseEntity @@ -203,7 +200,11 @@ class ConsumeAPIController { fun createAgentService(sourceType: String): AgentPayService { return applicationContext.getBean(sourceType + "Agent")?.let { - it as AgentPayService + if (it is AgentPayService) { + it + } else { + null + } } ?: throw TransactionCheckException(TradeErrorCode.BUSINESS_DEAL_ERROR, "支付类型<$sourceType>未定义") } @@ -228,7 +229,7 @@ class ConsumeAPIController { } - AgentCode.NEED_QUERY -> { + AgentCode.REQUIRE_QUERY -> { //去查询 citizencardQueryResultTask.queryResult(dtl.refno, 0) return ResponseEntity.ok(ResponseBodyBuilder.create() @@ -278,7 +279,7 @@ class ConsumeAPIController { return ResponseEntity.ok(ResponseBodyBuilder.create() .success(PayReverseResponse(cancelTrans.refno), "交易撤销成功")) } - AgentCode.NEED_QUERY -> { + AgentCode.REQUIRE_QUERY -> { //待查询 citizencardQueryResultTask.queryResult(cancelTrans.refno, 0) return ResponseEntity.ok(ResponseBodyBuilder.create() @@ -333,7 +334,7 @@ class ConsumeAPIController { return ResponseEntity.ok(ResponseBodyBuilder.create() .success(PayReverseResponse(refundTrans.refno), "交易撤销成功")) } - AgentCode.NEED_QUERY -> { + AgentCode.REQUIRE_QUERY -> { //待查询 citizencardQueryResultTask.queryResult(refundTrans.refno, 0) return ResponseEntity.ok(ResponseBodyBuilder.create() diff --git a/payapi/src/main/resources/data.sql b/payapi/src/main/resources/data.sql index a9878e1b..5752950a 100644 --- a/payapi/src/main/resources/data.sql +++ b/payapi/src/main/resources/data.sql @@ -449,7 +449,7 @@ INSERT INTO "tb_sourcetype" ("sourcetype_id", "sourcetype", "checkable", "paydes VALUES ('F0CA47ADC0F24DFCA0D95DF4136CC2D0', 'thirdpart', 'f', '其他第三方支付', 't', 't', 'f', 'f', 'f', '{tenantid}'); INSERT INTO "tb_sourcetype" ("sourcetype_id", "sourcetype", "checkable", "paydesc", "enable", "charge_enable", "consume_enable", "anonymous_enable", "reversable", "tenantid") -VALUES ('F5B344726FA24BD896E70DEE3D3F46CA', 'yktpay', 't', '一卡通支付', 't', 't', 't', 't', 't', '{tenantid}'); +VALUES ('F5B344726FA24BD896E70DEE3D3F46CA', 'swyktv5', 't', '一卡通支付', 't', 't', 't', 't', 't', '{tenantid}'); INSERT INTO "tb_sourcetype" ("sourcetype_id", "sourcetype", "checkable", "paydesc", "enable", "charge_enable", "consume_enable", "anonymous_enable", "reversable", "tenantid") VALUES ('28EE54CD3B044CC197D6C5B0E309F8B8', 'alipay', 't', '支付宝', 't', 't', 't', 't', 'f', '{tenantid}'); @@ -459,13 +459,13 @@ VALUES ('DAEF88B54B684347B2B83940C38C7671', 'wechat', 't', '微信支付', 't', -- 支付方式 INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid") -VALUES ('1', 'yktpay','appid','模板','100005', 't', '{tenantid}'); +VALUES ('1', 'swyktv5','appid','模板','100005', 't', '{tenantid}'); INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid") -VALUES ('2', 'yktpay','appkey','模板','adc4ac6822fd462780f878b86cb94688', 't', '{tenantid}'); +VALUES ('2', 'swyktv5','appkey','模板','adc4ac6822fd462780f878b86cb94688', 't', '{tenantid}'); INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid") -VALUES ('3', 'yktpay','orderurl','模板','http://172.28.201.101:9116/epayapi/services/thirdparty/common/pay', 't', '{tenantid}'); +VALUES ('3', 'swyktv5','orderurl','模板','http://172.28.201.101:9116/epayapi/services/thirdparty/common/pay', 't', '{tenantid}'); INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid") -VALUES ('4', 'yktpay','reverseurl','模板','http://172.28.201.101:9116/epayapi/services/thirdparty/common/payreverse', 't', '{tenantid}'); +VALUES ('4', 'swyktv5','reverseurl','模板','http://172.28.201.101:9116/epayapi/services/thirdparty/common/payreverse', 't', '{tenantid}'); INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid") VALUES ('5', 'alipay', 'alipay.gateway', '支付宝网关地址', 'https://openapi.alipay.com/gateway.do', 't', '{tenantid}'); INSERT INTO TB_SOURCETYPE_CONFIG (ID, SOURCETYPE,CONFIGID,CONFIG_NAME,CONFIG_VALUE,GLOBALFLAG, "tenantid")