Commit d3588770 by giaogiao

修复paygo通道

parent 346342bd
package com.library.service.Impl; package com.library.service.Impl;
import com.library.TopUp.Statel.SeatelSentUtils;
import com.library.TopUp.cellcard.CellcardSentUtils;
import com.library.TopUp.mefont.MetfoneSentUtils;
import com.library.TopUp.model.ResultsModel; import com.library.TopUp.model.ResultsModel;
import com.library.TopUp.smart.SmartSentUtils;
import com.library.config.NameValue; import com.library.config.NameValue;
import com.library.mapper.AutomaticQueueMapper; import com.library.mapper.AutomaticQueueMapper;
import com.library.mapper.CurrencyMapper; import com.library.mapper.CurrencyMapper;
import com.library.model.AutomaticQueueModel; import com.library.model.AutomaticQueueModel;
import com.library.model.OrderLogModel; import com.library.model.OrderLogModel;
import com.library.model.OrderModel; import com.library.model.OrderModel;
import com.library.model.SegmentModel;
import com.library.service.AutomaticCodeService; import com.library.service.AutomaticCodeService;
import com.library.util.Paygo24Utils; import com.library.util.Paygo24Utils;
import com.library.util.TransformationTools; import com.library.util.TransformationTools;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -22,10 +22,6 @@ import java.util.Date; ...@@ -22,10 +22,6 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service @Service
@Transactional @Transactional
...@@ -117,25 +113,25 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService { ...@@ -117,25 +113,25 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService {
Map<String, Object> map = this.automaticQueueMapper.selectSegment(phoneThree); Map<String, Object> map = this.automaticQueueMapper.selectSegment(phoneThree);
//1.先判断这是哪个公司的充值订单,然后发起充值 //1.先判断这是哪个公司的充值订单,然后发起充值
//
SegmentModel segmentModel = (SegmentModel)TransformationTools.ToObjectOne(SegmentModel.class, map); // SegmentModel segmentModel = (SegmentModel)TransformationTools.ToObjectOne(SegmentModel.class, map);
if (segmentModel.getOperator().equals("Cellcard")) { // if (segmentModel.getOperator().equals("Cellcard")) {
//Cellcard的手机号,则选择Cellcard公司的api发起充值 // //Cellcard的手机号,则选择Cellcard公司的api发起充值
//
resultsModel = CellcardSentUtils.sentTopUp(automaticQueueModel.getOrder_phone(), top_up_datetime, automaticQueueModel.getOrder_money().intValue()); // resultsModel = CellcardSentUtils.sentTopUp(automaticQueueModel.getOrder_phone(), top_up_datetime, automaticQueueModel.getOrder_money().intValue());
resultsModel.setTopUpNum(top_up_datetime); // resultsModel.setTopUpNum(top_up_datetime);
} else if (segmentModel.getOperator().equals("Metfone")) { // } else if (segmentModel.getOperator().equals("Metfone")) {
resultsModel = MetfoneSentUtils.sentTopUp(automaticQueueModel.getOrder_phone(), automaticQueueModel.getOrder_money().intValue(), top_up_datetime); // resultsModel = MetfoneSentUtils.sentTopUp(automaticQueueModel.getOrder_phone(), automaticQueueModel.getOrder_money().intValue(), top_up_datetime);
resultsModel.setTopUpNum(top_up_datetime); // resultsModel.setTopUpNum(top_up_datetime);
} else if (segmentModel.getOperator().equals("Smart")) { // } else if (segmentModel.getOperator().equals("Smart")) {
resultsModel = SmartSentUtils.sentTopUp(automaticQueueModel.getOrder_phone(), automaticQueueModel.getOrder_money().intValue(), top_up_datetime); // resultsModel = SmartSentUtils.sentTopUp(automaticQueueModel.getOrder_phone(), automaticQueueModel.getOrder_money().intValue(), top_up_datetime);
resultsModel.setTopUpNum(top_up_datetime); // resultsModel.setTopUpNum(top_up_datetime);
} else if (segmentModel.getOperator().equals("Seatel")) { // } else if (segmentModel.getOperator().equals("Seatel")) {
resultsModel = SeatelSentUtils.sentTopUp(automaticQueueModel.getOrder_phone(), automaticQueueModel.getOrder_money().intValue()); // resultsModel = SeatelSentUtils.sentTopUp(automaticQueueModel.getOrder_phone(), automaticQueueModel.getOrder_money().intValue());
//
//这个不用返回订单num,里面已经做了处理 // //这个不用返回订单num,里面已经做了处理
//
} else { // } else {
Paygo24Utils paygo = new Paygo24Utils(); Paygo24Utils paygo = new Paygo24Utils();
String result = paygo.payment(automaticQueueModel.getOrder_phone(), automaticQueueModel.getSegment_id(), automaticQueueModel.getOrder_money()); String result = paygo.payment(automaticQueueModel.getOrder_phone(), automaticQueueModel.getSegment_id(), automaticQueueModel.getOrder_money());
resultsModel = new ResultsModel(); resultsModel = new ResultsModel();
...@@ -147,7 +143,7 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService { ...@@ -147,7 +143,7 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService {
} }
resultsModel.setTopUpNum(top_up_datetime); resultsModel.setTopUpNum(top_up_datetime);
} // }
return resultsModel; return resultsModel;
} catch (Exception var10) { } catch (Exception var10) {
......
...@@ -25,7 +25,7 @@ import java.util.UUID; ...@@ -25,7 +25,7 @@ import java.util.UUID;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
public class PaygoTest { public class PaygoUtils {
// test // test
...@@ -36,19 +36,30 @@ public class PaygoTest { ...@@ -36,19 +36,30 @@ public class PaygoTest {
// prod // prod
private static final String mAddress = "https://processing2.paygo24.com/paygoservice.asmx"; private static final String mAddress = "https://processing2.paygo24.com/paygoservice.asmx";
private static final String mUsername = "451717"; private static final String mUsername = "451717";
// iWoQosQ+z9YFXqKuyPyRNg==
private static final String mPassword = encodePass("Ws8GsJZu"); private static final String mPassword = encodePass("Ws8GsJZu");
public static void main(String[] args) { public static void main(String[] args) {
// 3 CELLCARD 012885610
// 2 SMART 098375667
// 4 metfone 0887038371
top_up("0887038371");
}
private static void top_up(String mAccount) {
Date now = new Date(); Date now = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
SimpleDateFormat ticket_format = new SimpleDateFormat("HHmmss"); SimpleDateFormat ticket_format = new SimpleDateFormat("HHmmss");
SimpleDateFormat format3339 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); SimpleDateFormat format3339 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
PaygoTest test = new PaygoTest(); PaygoUtils test = new PaygoUtils();
Payment payment = new Payment(); Payment payment = new Payment();
payment.setId(UUID.randomUUID().toString()); payment.setId(UUID.randomUUID().toString());
payment.setAccount("098375667");
payment.setServiceId("2"); payment.setAccount(mAccount);
payment.setServiceId("4");
payment.setCommission("0.00"); payment.setCommission("0.00");
payment.setValue("1.00"); payment.setValue("1.00");
payment.setTicket(ticket_format.format(now)); payment.setTicket(ticket_format.format(now));
...@@ -58,7 +69,7 @@ public class PaygoTest { ...@@ -58,7 +69,7 @@ public class PaygoTest {
payment.setCurrency("USD"); payment.setCurrency("USD");
payment.setPaymentTool("1"); payment.setPaymentTool("1");
List<Payment.PaymentParam> params = new ArrayList<>(); List<Payment.PaymentParam> params = new ArrayList<>();
params.add(new Payment.PaymentParam("account", "098375667")); params.add(new Payment.PaymentParam("account", mAccount));
//account parameter //account parameter
payment.setParams(params); payment.setParams(params);
try { try {
...@@ -90,9 +101,8 @@ public class PaygoTest { ...@@ -90,9 +101,8 @@ public class PaygoTest {
} catch (Exception ex) { } catch (Exception ex) {
Logger.getLogger(PaygoTest.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(PaygoUtils.class.getName()).log(Level.SEVERE, null, ex);
} }
} }
private static final String encodePass(String pass) { private static final String encodePass(String pass) {
......
...@@ -77,7 +77,7 @@ public class Paygo24Utils { ...@@ -77,7 +77,7 @@ public class Paygo24Utils {
public static void main(String[] args) { public static void main(String[] args) {
Paygo24Utils paygo24Utils = new Paygo24Utils(); Paygo24Utils paygo24Utils = new Paygo24Utils();
String result = paygo24Utils.payment("0887038371", 4, new BigDecimal(1.0)); String result = paygo24Utils.payment("098375667", 2, new BigDecimal(1.0));
System.out.println("result:"+result); System.out.println("result:"+result);
} }
......
...@@ -3,11 +3,5 @@ ...@@ -3,11 +3,5 @@
hasPrintlnUrl=true hasPrintlnUrl=true
phone.regularly=^1(3[0-9]|4[57]|5[0-35-9]|7[0135678]|8[0-9])\\d{8}$ phone.regularly=^1(3[0-9]|4[57]|5[0-35-9]|7[0135678]|8[0-9])\\d{8}$
test.account=11,15 test.account=11,15
#paygo.pointid=46
#paygo.password=4QrcOUm6Wau+VuBX8g+IPg==
#wcRvX9plNOAb95br0y4vVQ==
paygo.pointid=326386
paygo.password=5TNO+4kpAXtphf1eIlGCLw==
paygo.test.is=true
paygo.start.is=true
sms.domestic.submail=false sms.domestic.submail=false
\ No newline at end of file
#jdbc.driverClassName=com.mysql.jdbc.Driver #jdbc.driverClassName=com.mysql.jdbc.Driver
#jdbc.url=jdbc:mysql://localhost:3306/comb_top?useUnicode=true&characterEncoding=utf8&autoReconnect=true #jdbc.url=jdbc:mysql://localhost:3306/comb_top?useUnicode=true&characterEncoding=utf8&autoReconnect=true
#本地
#jdbc.username=root #jdbc.username=root
#jdbc.password=123 #jdbc.password=123
...@@ -11,7 +12,12 @@ ...@@ -11,7 +12,12 @@
jdbc.driverClassName=com.mysql.jdbc.Driver jdbc.driverClassName=com.mysql.jdbc.Driver
#jdbc.url=jdbc:mysql://localhost:3306/discuz?useUnicode=true&characterEncoding=utf8&autoReconnect=true
jdbc.url=jdbc:mysql://localhost:3306/recharge_sys?useUnicode=true&characterEncoding=utf8&autoReconnect=true jdbc.url=jdbc:mysql://localhost:3306/recharge_sys?useUnicode=true&characterEncoding=utf8&autoReconnect=true
jdbc.username=recharge_sys jdbc.username=recharge_sys
#正式
jdbc.password=cK2bPBkwLtKNeGRc jdbc.password=cK2bPBkwLtKNeGRc
# 测试外网
#jdbc.password=FEeDirZZ4EP8rADM
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment