# Conflicts: # pom.xml # src/main/ui/static/payment/partner/templates/partners.html # src/test/java/au/com/royalpay/payment/manage/citypartner/core/impls/GatewayApplicationMerchantDemoTest.javamaster
commit
17b5075d94
@ -0,0 +1,155 @@
|
||||
<style>
|
||||
.cen table {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.cen table th {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
<section class="content">
|
||||
<div class="nav-tabs-custom">
|
||||
<ul class="nav nav-tabs">
|
||||
<li ui-sref-active="active">
|
||||
<a style="font-size: 30px;">RP商户类别交易趋势统计</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="box box-warning">
|
||||
<div class="box-header">
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group col-xs-12">
|
||||
<label class="control-label col-xs-4 col-sm-2">Date Range</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="form-control-static form-inline">
|
||||
<div style="display: inline-block">
|
||||
<input class="form-control" id="date-from-input" ng-model="params.from"
|
||||
uib-datepicker-popup size="15" placeholder="From"
|
||||
is-open="dateBegin.open" ng-click="dateBegin.open=true"
|
||||
datepicker-options="{maxDate:params.end}">
|
||||
</div>
|
||||
<div style="display: inline-block;margin: 0 10px;">
|
||||
~
|
||||
</div>
|
||||
<div style="display: inline-block">
|
||||
<input class="form-control" id="date-to-input" ng-model="params.to"
|
||||
uib-datepicker-popup size="15" placeholder="To"
|
||||
is-open="dateTo.open" ng-click="dateTo.open=true"
|
||||
datepicker-options="{minDate:params.begin,maxDate:today}">
|
||||
</div>
|
||||
|
||||
<div style="display: inline-block">
|
||||
<input style="margin-left: 20px;"
|
||||
class="form-control" id="royalpayindustry"
|
||||
name="royalpayindustry" readonly
|
||||
ng-value="params.industry|partner_royalpay_industry"
|
||||
multi-level-select-popup="royalpayindustry"
|
||||
on-select="onRoyalPayIndustrySelect($selected)"
|
||||
chose-one-level="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-control-static form-inline">
|
||||
<div class="btn-group">
|
||||
<a role="button" class="btn btn-default btn-sm"
|
||||
ng-click="chooseToday()">Today</a>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<a role="button" class="btn btn-default btn-sm"
|
||||
ng-click="chooseYesterday()">Yesterday</a>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<a role="button" class="btn btn-default btn-sm"
|
||||
ng-click="chooseLast7Days()">Last 7 Days</a>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<a role="button" class="btn btn-default btn-sm" ng-click="thisMonth()">This
|
||||
Month</a>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<a role="button" class="btn btn-default btn-sm" ng-click="lastMonth()">Last
|
||||
Month</a>
|
||||
</div>
|
||||
<button class="btn btn-success" type="button" ng-click="doAnalysis()">
|
||||
<i class="fa fa-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12" style="text-align: center">
|
||||
<loadingbar ng-if="future_loading"></loadingbar>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row cen">
|
||||
<div class="col-sm-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<span style="font-weight: 900;" ng-if="params.royalpay_label">[{{params.royalpay_label}}]</span>
|
||||
行业总交易量</div>
|
||||
<div class="box-body">
|
||||
<div class="chart" echarts="amountAnalysis" style="height: 300px"
|
||||
chart-setter="choseDayEchart($chart)"
|
||||
ng-class="{nodata:amountAnalysis.nodata}"></div>
|
||||
<div class="chart" echarts="ordersAnalysis" style="height: 300px"
|
||||
chart-setter="choseDayEchart($chart)"
|
||||
ng-class="{nodata:ordersAnalysis.nodata}"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cen" ng-if="chooseDay">
|
||||
<div class="col-sm-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
[<span style="font-weight: 900;">{{chooseDay}}{{params.royalpay_label}}</span>]
|
||||
行业Top交易额商户列表</div>
|
||||
<div class="box-body">
|
||||
<div class="box-body table-responsive">
|
||||
<table class="table table-bordered table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Client Moniker</th>
|
||||
<th>Short Name</th>
|
||||
<th>Total Amount</th>
|
||||
<th>Orders</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="partner in partners">
|
||||
<td ng-bind="partner.client_moniker"></td>
|
||||
<td ng-bind="partner.short_name"></td>
|
||||
<td ng-bind="partner.total_amount|currency:''"></td>
|
||||
<td ng-bind="partner.orders"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<uib-pagination class="pagination"
|
||||
total-items="pagination.totalCount"
|
||||
boundary-links="true"
|
||||
ng-model="pagination.page"
|
||||
items-per-page="pagination.limit"
|
||||
max-size="10"
|
||||
ng-change="loadTopTransPartners()"
|
||||
previous-text="‹"
|
||||
next-text="›"
|
||||
first-text="«"
|
||||
last-text="»"></uib-pagination>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total Pages:{{pagination.totalPages}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
@ -1,199 +0,0 @@
|
||||
package au.com.royalpay.payment.manage.citypartner.core.impls;
|
||||
|
||||
import au.com.royalpay.payment.manage.citypartner.core.CityPartnerPrizeService;
|
||||
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
|
||||
import cn.yixblog.platform.http.HttpRequestGenerator;
|
||||
import cn.yixblog.platform.http.HttpRequestResult;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.*;
|
||||
|
||||
import static au.com.royalpay.payment.tools.codec.RSACrypt.loadPrivateKey;
|
||||
|
||||
/**
|
||||
* Created by wangning on 09/01/2018.
|
||||
*/
|
||||
@SpringBootTest
|
||||
public class CityPartnerPrizeServiceImplTest {
|
||||
|
||||
static String PRIKEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCdIiy3fFUrZx4X0aIU37PGzViqG03yRDprSk2tqhORnAiZL3sLNFsjmy2FR4+84bksp2VxIc+rMot+4iFIAmpK50t6qj2Fz7sOO5DMSN0pRN9flIqQ1RFKYnIQN+BymfJ9bXbMN2aN+sbfZzZRTAZPtJuES9JIrmUDi4NwNeqBSjhflUqlyYx3ejMx2CrxHAS+35W5fAK88e//9SQiMdKHzNPFl4vXtCMqTY7Mk7febLfsG0aaRVMM/QOeT57sszB3Wib3wUFi9xGsqdqLi0skAWc4QmOGOoue7uvieghFWZXETfFN/K3wSz5TzVS55ma2u3KOkn8/M4E7J96RHzAPAgMBAAECggEAet+ueA0RzM7mCVo0lH4Z5uvM2bhgS4Ju7Fc+Rv8oLkUFtEQcw7Y9TqqZ/g7np5wbYX/FI6J88jKkQqQxwk2hMNGNhG57jZfTfl217QlNaGgjBGrzsC3tR22UJHqNWRBpPwvKSgdIet4PhcMABrKcfNeOhPWFirBU7WC7d5OxvUdA3oCnZXZ7nGxgyX06actjb3GhIUybi4DJosCY3NkBsUXWLh45Kmm8IfJv29cd+VrIBn5i1+mMd6hECmiN03ToH9dc3o1aS4YGJirvkf1q1oiJJMT7exacuZiTrRfUh+NIemm8oaBYJj9PMcy5PEtS/ZyJe7jzDEnbV71i5dnkAQKBgQDhXej3o3KyvP9h/nwH/gifK/Urai0u/SB6CScb8c0xzHoQhomjNaaHHKX82j8zDYMvg7yNWHEo5WdCEcenvjO4OWkbhL9brBJnpN5QyfPtjijUh/8PFNKu/NP0PISkFjuAOp+LVgMRgrfQL/wu1/zp6jgsAXckauUIBNITZPTWrwKBgQCyffLy1Cc1tSovzXchty7TLU49IzNZQ3keMEy8MWw6YFS5PGUSEixtjvsAuzoYMg6w7F/LxK8jMfOcDPza1AJUQIByXPoZs4jm31j6EPjPYP+ocQ04Ji+OOcbR5TOlFamNMnjQNlTqpEmNYpQcKp8AOyGm0dSMHe7YUKqzaymUoQKBgQDNQ4aL/s/aIjAM5ge8E9FwgE4GY+eRc7Wf0TRQzHSTVeUbph44jAYH67z3RyTm7/i7TyZuKs6ua/sXfzA1BRUARzIHgWn1Kg19Xvmp5bcJeECSCufxqYqXHOpD+tboyOMa0Mo903JqAYA/22S6mbjeqJjO4+rLPZ0rJ5DbX0ltOwKBgA+3rYwaiHVfRZ69/g6W/eWUqL4TenMS0PiKkkdEJt6hGvTQz6methDTtWCkHAKDbe3ActMTt8RmoqgMMLvoTWgz4duwOknHGHgUFNa4ZeCFDx47Dknyet+QUOSsxTZ1SN/pIOBc2G9tFhkAJECytBumGVmCQrAv9pdPyyhPeHLhAoGATvtEmi3oYPQtoy8qDEhI8wCXrrKIZh2a7ahRjt8B056HZ26EjalKg2Yz+5WTRbS6Bgr8ZN+12wRl7CbjWyr+loOEsMTjAuJoxGDo9bm936IqvmwVlEdLkOoMoFnJY6OFiVqWmLIXHr56+z2ShryZVPc59gdLxNRA+ZJMF5kY27s=";
|
||||
private final String IMG_AGGREGATE_FILE = "https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=95272786,3986826432&fm=26&gp=0.jpg";
|
||||
|
||||
@Resource
|
||||
private CityPartnerPrizeService cityPartnerPrizeService;
|
||||
|
||||
@Test
|
||||
public void generateAgent() throws Exception {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generate() throws Exception {
|
||||
cityPartnerPrizeService.generate("2017-06");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void applicationMerchant() throws Exception {
|
||||
JSONObject companyInfo = new JSONObject() {{
|
||||
put("company_name", "gateway partner test1");
|
||||
put("short_name", "gateway partner test1");
|
||||
put("store_name", "gateway partner test1");
|
||||
put("business_name", "gateway partner test1");
|
||||
put("business_structure", "Company");
|
||||
put("acn", "123456789");
|
||||
put("company_phone", "123456789");
|
||||
put("logo_url", "http://n.sinaimg.cn/sinacn15/435/w640h595/20181010/403e-hkrzvkw4936423.jpg");
|
||||
}};
|
||||
JSONObject contactInfo = new JSONObject() {{
|
||||
put("contact_person", "person1");
|
||||
put("contact_phone", "1231231");
|
||||
put("contact_email", "1qq@qq.com");
|
||||
put("contact_job", "Direct");
|
||||
put("address", "测试住址1");
|
||||
put("suburb", "测试区1");
|
||||
put("postcode", "测试code1");
|
||||
put("state", "测试state1");
|
||||
put("country", "AU");
|
||||
put("registered_address", "测试住址2");
|
||||
put("registered_suburb", "测试区2");
|
||||
put("registered_postcode", "测试code2");
|
||||
put("registered_state", "测试state2");
|
||||
put("timezone", "Australia/West");
|
||||
}};
|
||||
JSONObject ClientLegalConfig = new JSONObject() {{
|
||||
put("legal_representative_person", "person2");
|
||||
put("legal_representative_phone", "1231231");
|
||||
put("legal_representative_email", "1qq@qq.com");
|
||||
put("legal_representative_job", "Direct");
|
||||
}};
|
||||
JSONObject clientPayConfig = new JSONObject() {{
|
||||
put("client_pay_type", "2");
|
||||
put("client_pay_desc", "201");
|
||||
put("royalpay_industry", "10001");
|
||||
put("company_photo", "https://c-ssl.duitang.com/uploads/item/201812/10/20181210170153_xPUVk.jpeg");
|
||||
put("store_photo", "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3199241964,979639112&fm=26&gp=0.jpg");
|
||||
put("company_website", "https://11.com");
|
||||
}};
|
||||
JSONObject settleConfig = new JSONObject() {{
|
||||
put("swift_code", "2");
|
||||
put("bsb_no", "033385");
|
||||
put("account_no", "21213131");
|
||||
put("account_name", "dasdasdasd");
|
||||
put("clean_days", "2");
|
||||
put("wechat_rate", "1.2");
|
||||
put("alipay_rate", "1.2");
|
||||
put("alipay_online_rate", "1.2");
|
||||
put("transaction_fee", "0");
|
||||
put("active_time", "2020-02-06 00:00:00");
|
||||
put("expire_time", "2021-02-06 00:00:00");
|
||||
}};
|
||||
|
||||
JSONObject complianceInfo = new JSONObject() {{
|
||||
put("id_type", "pastport");
|
||||
put("id_title", "Direct");
|
||||
put("id_title_description", "test");
|
||||
put("bank_statement", "https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=820350352,1683018569&fm=26&gp=0.jpg");
|
||||
put("certificate_of_registration", "http://i2.w.yun.hjfile.cn/doc/201404/00662ef619754b749200eecdf3671c3a.jpg");
|
||||
put("id_file", "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2284543896,2456565772&fm=26&gp=0.jpg");
|
||||
put("utility_bill", "http://i0.sinaimg.cn/ent/v/2009-08-22/U2389P28T3D2664490F346DT20090822015510.JPG");
|
||||
}};
|
||||
|
||||
|
||||
JSONObject params = new JSONObject() {{
|
||||
put("apply_id", "orgapply1");
|
||||
put("notify_url", "http://127.0.0.1:9002/sys/partners/7CMV/qrcode");
|
||||
put("company_info", companyInfo);
|
||||
put("contact_info", contactInfo);
|
||||
put("legal_info", ClientLegalConfig);
|
||||
put("pay_info", clientPayConfig);
|
||||
put("settle_info", settleConfig);
|
||||
put("compliance_file_info", complianceInfo);
|
||||
}};
|
||||
String originUrl = "http://127.0.0.1:5000/api/v1.0/org_gateway/partner/AXLCEXDDMB/merchant/application";
|
||||
String url = addSignUrl(originUrl, params, PRIKEY);
|
||||
HttpRequestGenerator gen = new HttpRequestGenerator(url, RequestMethod.POST);
|
||||
gen.setJSONEntity(params);
|
||||
gen.setTimeout(10000);
|
||||
HttpRequestResult result = gen.execute();
|
||||
if (result.isSuccess()) {
|
||||
System.out.println(result.getResponseContentJSONObj().toJSONString());
|
||||
}else {
|
||||
System.out.println(result.getResponseContentString());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryMerchantStatus() throws Exception{
|
||||
String partnerCode = "PHQ3";
|
||||
String originUrl = "http://127.0.0.1:5000/api/v1.0/org_gateway/partner/AXLCEXDDMB/merchant/" + partnerCode + "/status";
|
||||
String url = addSignUrl(originUrl, null, PRIKEY);
|
||||
HttpRequestGenerator gen = new HttpRequestGenerator(url, RequestMethod.GET);
|
||||
HttpRequestResult result = gen.execute();
|
||||
if (result.isSuccess()) {
|
||||
System.out.println(result.getResponseContentJSONObj().toJSONString());
|
||||
}else {
|
||||
System.out.println(result.getResponseContentString());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateFile() throws Exception{
|
||||
String originUrl = "http://127.0.0.1:5000/api/v1.0/org_gateway/partner/AXLCEXDDMB/attachment/files";
|
||||
String url = addSignUrl(originUrl, null, PRIKEY);
|
||||
File file = new File("/Users/luoyang/Downloads/banner_eshop.jpg");
|
||||
InputStream stream = new FileInputStream(file);
|
||||
HttpRequestGenerator gen = new HttpRequestGenerator(url, RequestMethod.POST);
|
||||
gen.setTimeout(10000);
|
||||
gen.initFileEntity().attachFile("file", "banner_eshop.jpg", stream);
|
||||
HttpRequestResult result = gen.execute();
|
||||
if (result.isSuccess()) {
|
||||
System.out.println(result.getResponseContentJSONObj().toJSONString());
|
||||
}else {
|
||||
System.out.println(result.getResponseContentString());
|
||||
}
|
||||
}
|
||||
|
||||
private String sign(byte[] source, String privateKey) {
|
||||
try {
|
||||
PrivateKey priKey = loadPrivateKey(new ByteArrayInputStream(privateKey.getBytes(StandardCharsets.UTF_8)));
|
||||
Signature signature = Signature.getInstance("SHA256withRSA");
|
||||
signature.initSign(priKey);
|
||||
signature.update(source);
|
||||
byte[] signed = signature.sign();
|
||||
return Base64.encodeBase64URLSafeString(signed);
|
||||
} catch (NoSuchAlgorithmException | SignatureException | InvalidKeyException e) {
|
||||
//shall never happen
|
||||
throw new ServerErrorException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private String addSignUrl(String originUrl, JSONObject params, String priKey) {
|
||||
if (params == null) {
|
||||
params = new JSONObject();
|
||||
}
|
||||
String nonceStr = RandomStringUtils.random(15, true, true);
|
||||
params.put("url", originUrl);
|
||||
params.put("sign_type", "RSA2");
|
||||
params.put("nonce_str", nonceStr);
|
||||
String signStr = sign(JSONObject.toJSONBytes(params, SerializerFeature.MapSortField), priKey);
|
||||
originUrl += ("?nonce_str=" + nonceStr);
|
||||
originUrl += "&sign_type=RSA2";
|
||||
originUrl += "&sign=" + signStr;
|
||||
return originUrl;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in new issue