|
|
@@ -163,6 +163,10 @@ public class ReceiptBillGatewayTest {
|
|
|
downloads++;
|
|
|
if (mode.equals("file401")) return new BillHttp.Reply(401,
|
|
|
"<Error><Code>AccessDenied</Code><Message>Request has expired</Message><Resource>private-file</Resource></Error>".getBytes(UTF_8));
|
|
|
+ if ("cloudpnr".equals(mode)) {
|
|
|
+ assertEquals("https://file.cloudpnr.com/test?Signature=a%2Bb%3D", uri.toASCIIString());
|
|
|
+ return new BillHttp.Reply(200, zip("Charge_payment.csv", ADA_CSV, UTF_8));
|
|
|
+ }
|
|
|
if (uri.getHost().equals("jarvisfile.oss-cn-shanghai.aliyuncs.com")) return new BillHttp.Reply(200, zip("Charge_payment.csv", ADA_CSV, UTF_8));
|
|
|
assertEquals("billdownload.cloud.alipay.com", uri.getHost());
|
|
|
return new BillHttp.Reply(200, zip((mode.equals("foreignName") ? OTHER : PID) + "_业务明细.csv", mode.equals("foreignHeader") ? ALI_CSV.replace(PID, OTHER) : ALI_CSV, Charset.forName("GBK")));
|
|
|
@@ -201,6 +205,8 @@ public class ReceiptBillGatewayTest {
|
|
|
verify("SHA1withRSA", AdapayCore.apiBase + exchange.getRequestURI() + body,
|
|
|
exchange.getRequestHeaders().getFirst("Signature"));
|
|
|
String data = "{\"status\":\"succeeded\",\"prod_mode\":true,\"bill_download_url\":\"https://jarvisfile.oss-cn-shanghai.aliyuncs.com/test\"}";
|
|
|
+ if ("cloudpnr".equals(mode)) data = data.replace("jarvisfile.oss-cn-shanghai.aliyuncs.com/test",
|
|
|
+ "file.cloudpnr.com/test?Signature=a%2Bb%3D");
|
|
|
if ("unconfirmedHost".equals(mode)) data = data.replace("jarvisfile.oss-cn-shanghai.aliyuncs.com/test",
|
|
|
"files.example.org/private-file?Signature=private-signature");
|
|
|
if ("pending".equals(mode)) data = "{\"status\":\"pending\",\"prod_mode\":true}";
|
|
|
@@ -309,6 +315,16 @@ public class ReceiptBillGatewayTest {
|
|
|
assertEquals(1, downloads);
|
|
|
}
|
|
|
|
|
|
+ @Test public void huifuReadsSignedBillFromCloudpnrFileHost() throws Exception {
|
|
|
+ mode = "cloudpnr";
|
|
|
+ ReceiptBillDto bill = fetch("101", "HUIFU", DAY);
|
|
|
+ assertEquals(bill.getMessage(), "READY", bill.getStatus());
|
|
|
+ assertEquals(1, downloads);
|
|
|
+ assertEquals(1, bill.getEntries().size());
|
|
|
+ assertEquals("order", bill.getEntries().get(0).getOrderNo());
|
|
|
+ assertNull(bill.getAvailableBalance());
|
|
|
+ }
|
|
|
+
|
|
|
@Test public void huifuIdentifiesUnconfirmedDownloadDomainWithoutExposingSignedUrl() throws Exception {
|
|
|
mode = "unconfirmedHost";
|
|
|
ReceiptBillDto bill = fetch("101", "HUIFU", DAY);
|