add app client QRcode

master
wangning 7 years ago
parent 7f40f73ad6
commit e7f2bfb302

@ -1,14 +1,15 @@
package au.com.royalpay.payment.manage.appclient.core;
import java.math.BigDecimal;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean;
import au.com.royalpay.payment.manage.appclient.beans.AppQueryBean;
import au.com.royalpay.payment.manage.notice.beans.NoticeInfo;
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean;
import com.alibaba.fastjson.JSONObject;
import java.math.BigDecimal;
import java.util.List;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
/**
@ -118,4 +119,6 @@ public interface RetailAppService {
void changeManualSettle(JSONObject device,boolean manual_settle);
JSONObject getTradeCommonDateNew(JSONObject device, AppQueryBean appQueryBean);
JSONObject getQrcode(JSONObject device, QRCodeConfig config,int client_id);
}

@ -41,9 +41,11 @@ import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import au.com.royalpay.payment.tools.locale.LocaleSupport;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import au.com.royalpay.payment.tools.utils.QRCodeUtils;
import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
import com.alibaba.fastjson.JSON;
@ -229,6 +231,21 @@ public class RetailAppServiceImp implements RetailAppService {
return res;
}
@Override
public JSONObject getQrcode(JSONObject device, QRCodeConfig config,int client_id) {
JSONObject client = merchantInfoProvider.getClientInfo(client_id);
String url = PlatformEnvironment.getEnv().concatUrl("/api/payment/v1.0/partners/" + client.getString("client_moniker"));
if (config.isCNY()) {
url += "_CNY";
}
url += config.extension();
JSONObject res = new JSONObject();
res.put("url", url);
res.put("qrcode", QRCodeUtils.qrcodeImageCode(url, 250, false));
res.put("qrcode_board", merchantInfoProvider.getQrCodeBoard(client, config));
return res;
}
@Override
public void updateClient(JSONObject device, AppClientBean appClientBean) {
String clientType = device.getString("client_type");

@ -20,6 +20,7 @@ import au.com.royalpay.payment.tools.device.advise.AppClientController;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.http.HttpUtils;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
@ -44,6 +45,8 @@ import java.util.Map;
import javax.annotation.Resource;
import javax.validation.Valid;
import static au.com.royalpay.payment.tools.CommonConsts.RETAIL_DEVICE;
/**
* Created by yishuqian on 28/03/2017.
*/
@ -433,4 +436,11 @@ public class RetailAppController {
retailAppService.changeManualSettle(device,data.getBoolean("manual_settle"));
}
@RequestMapping(value = "/qrcode", method = RequestMethod.GET)
public JSONObject getQrcode(@ModelAttribute(RETAIL_DEVICE) JSONObject device,@RequestParam(required = false) int client_id, QRCodeConfig config) {
if(client_id==0){
client_id = device.getIntValue("client_id");
}
return retailAppService.getQrcode(device,config,client_id);
}
}

Loading…
Cancel
Save