From 925909f05f2b15131a47ad965a6b18417c86308a Mon Sep 17 00:00:00 2001 From: Yixian Date: Wed, 23 Feb 2022 11:38:34 +0800 Subject: [PATCH 1/4] aggregate poster log --- .../manage/merchants/core/impls/ClientManagerImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index c67591083..80a971ad0 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -2700,12 +2700,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid public void writeAggregatePoster(JSONObject manager, String clientMoniker, OutputStream ous) { JSONObject client = clientDetail(manager, clientMoniker); try { - logger.debug("downloading aggregate poster from {}", clientMoniker); + String url = PlatformEnvironment.getEnv().concatUrl("/static/images/new_aggregate_poster.png"); + logger.debug("downloading aggregate poster from {}--{}", clientMoniker, url); HttpRequestResult boardBackgroundResult = new HttpRequestGenerator( - PlatformEnvironment.getEnv().concatUrl("/static/images/new_aggregate_poster.png"), RequestMethod.GET).execute(); + url, RequestMethod.GET).execute(); if (boardBackgroundResult.isSuccess()) { InputStream ins = boardBackgroundResult.getResponseContentStream(); BufferedImage background = ImageIO.read(ins); + logger.debug("aggregate image size {}x{}", background.getWidth(), background.getHeight()); IOUtils.closeQuietly(ins); ImageIO.write(background, "jpeg", ous); ous.flush(); From 0cf077e73c646d4a2562717a67a41c52d4cb673d Mon Sep 17 00:00:00 2001 From: Yixian Date: Wed, 23 Feb 2022 11:55:35 +0800 Subject: [PATCH 2/4] aggregate poster log --- .../core/impls/ClientManagerImpl.java | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 80a971ad0..8f672722b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -2705,13 +2705,22 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid HttpRequestResult boardBackgroundResult = new HttpRequestGenerator( url, RequestMethod.GET).execute(); if (boardBackgroundResult.isSuccess()) { - InputStream ins = boardBackgroundResult.getResponseContentStream(); - BufferedImage background = ImageIO.read(ins); - logger.debug("aggregate image size {}x{}", background.getWidth(), background.getHeight()); - IOUtils.closeQuietly(ins); - ImageIO.write(background, "jpeg", ous); - ous.flush(); - IOUtils.closeQuietly(ous); + try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) { + InputStream ins = boardBackgroundResult.getResponseContentStream(); + BufferedImage background = ImageIO.read(ins); + IOUtils.closeQuietly(ins); + logger.debug("aggregate image size {}x{}", background.getWidth(), background.getHeight()); + BufferedImage img = new BufferedImage(background.getWidth(), background.getHeight(), BufferedImage.TYPE_3BYTE_BGR); + Graphics g = img.getGraphics(); + g.drawImage(background, 0, 0, null); + g.dispose(); + ImageIO.write(img, "jpeg", bos); + bos.flush(); + byte[] imageBytes = bos.toByteArray(); + logger.debug("aggregate image length {}", imageBytes.length); + ous.write(imageBytes); + IOUtils.closeQuietly(ous); + } } else { logger.error("get aggregate poster file failed:[{}]-{}", boardBackgroundResult.getStatusCode(), boardBackgroundResult.getResponseContentString(), boardBackgroundResult.getException()); From 297ea65d7d0d45cd0324f5fe44159d3d19defd66 Mon Sep 17 00:00:00 2001 From: Yixian Date: Thu, 3 Mar 2022 16:54:22 +0800 Subject: [PATCH 3/4] en channel add AlipayPlus --- src/document/openapi/en/components_order.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/document/openapi/en/components_order.yml b/src/document/openapi/en/components_order.yml index 682cd86f2..e9f7a5617 100644 --- a/src/document/openapi/en/components_order.yml +++ b/src/document/openapi/en/components_order.yml @@ -51,6 +51,7 @@ orderWithChannel: enum: - Alipay - Wechat + - AlipayPlus type: object required: - channel From 4aabbc7f5bf0ac918fe0de285dd2ccdadd4d5fb3 Mon Sep 17 00:00:00 2001 From: ycfxx Date: Fri, 4 Mar 2022 14:39:50 +0800 Subject: [PATCH 4/4] upgrade app api --- .../auth/domain/service/ShopifyRequestValidator.java | 6 ++++-- .../shopify/auth/web/ShopifyAuthTemplateController.java | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/shopify/auth/domain/service/ShopifyRequestValidator.java b/src/main/java/au/com/royalpay/payment/manage/shopify/auth/domain/service/ShopifyRequestValidator.java index cf90d7473..6a37029d0 100644 --- a/src/main/java/au/com/royalpay/payment/manage/shopify/auth/domain/service/ShopifyRequestValidator.java +++ b/src/main/java/au/com/royalpay/payment/manage/shopify/auth/domain/service/ShopifyRequestValidator.java @@ -21,9 +21,11 @@ public class ShopifyRequestValidator { return HmacVerificationUtil.hmacSHA256(message.toString(),clientSecret,parameter.getHmac()); } - public boolean verifyPermission(String shopifyStoreHost, String hmac, String timestamp) { + public boolean verifyPermission(String shop, String hmac, String timestamp, String host) { StringBuilder message =new StringBuilder(); - message.append("shop=").append(shopifyStoreHost) + message + .append("host=").append(host) + .append("&shop=").append(shop) .append("×tamp=").append(timestamp); return HmacVerificationUtil.hmacSHA256(message.toString(),clientSecret,hmac); } diff --git a/src/main/java/au/com/royalpay/payment/manage/shopify/auth/web/ShopifyAuthTemplateController.java b/src/main/java/au/com/royalpay/payment/manage/shopify/auth/web/ShopifyAuthTemplateController.java index c57b68a81..29c1f22d0 100644 --- a/src/main/java/au/com/royalpay/payment/manage/shopify/auth/web/ShopifyAuthTemplateController.java +++ b/src/main/java/au/com/royalpay/payment/manage/shopify/auth/web/ShopifyAuthTemplateController.java @@ -38,13 +38,14 @@ public class ShopifyAuthTemplateController { */ @GetMapping("/auth") @ShopifyEndpoint - public String shopifyStorePermission(@RequestParam("shop") String shop, - @RequestParam("hmac") String hmac, + public String shopifyStorePermission(@RequestParam("hmac") String hmac, + @RequestParam("host") String host, + @RequestParam("shop") String shop, @RequestParam("timestamp") String timestamp) { if (!Pattern.matches("^[a-zA-Z0-9][a-zA-Z0-9\\-]*\\.myshopify\\.com", shop)) { throw new BadRequestException("Parameter shop is invalid."); } - if (!shopifyRequestValidator.verifyPermission(shop, hmac, timestamp)) { + if (!shopifyRequestValidator.verifyPermission(shop, hmac, timestamp,host)) { throw new ShopifyRequestVerifyException("This request parameters is invalid"); } ShopifyPermissionURL shopifyPermissionURL = shopifyMerchantAuthApplication.getShopifyPermissionUrl(shop);