@@ -841,6 +841,75 @@ public String testParseRefundNotifyV3Result(HttpServletRequest request, HttpServ
841841 return WxPayNotifyV3Response .success ("成功" );
842842 }
843843
844+ /**
845+ * 商家转账批次回调通知
846+ * https://pay.weixin.qq.com/docs/merchant/apis/batch-transfer-to-balance/transfer-batch-callback-notice.html
847+ *
848+ * @return
849+ * @throws Exception
850+ */
851+ @ Test
852+ public String parseTransferBatchesNotifyV3Result () throws Exception {
853+
854+ String body = "{\n " +
855+ " \" id\" : \" 1c8192d8-aba1-5898-a79c-7d3abb72eabe\" ,\n " +
856+ " \" create_time\" : \" 2023-08-16T16:43:27+08:00\" ,\n " +
857+ " \" resource_type\" : \" encrypt-resource\" ,\n " +
858+ " \" event_type\" : \" MCHTRANSFER.BATCH.FINISHED\" ,\n " +
859+ " \" summary\" : \" 商家转账批次完成通知\" ,\n " +
860+ " \" resource\" : {\n " +
861+ " \" original_type\" : \" mch_payment\" ,\n " +
862+ " \" algorithm\" : \" AEAD_AES_256_GCM\" ,\n " +
863+ " \" ciphertext\" : \" zTBf6DDPzZSoIBkoLFkC+ho97QrqnT6UU/ADM0tJP07ITaFPek4vofQjmclLUof78NqrPcJs5OIBl+gnKKJ4xCxcDmDnZZHvev5o1pk4gwtJIFIDxbq3piDr4Wq6cZpvGPPQTYC8YoVRTdVeeN+EcuklRrmaFzv8wCTSdI9wFJ9bsxtLedhq4gpkKqN5fbSguQg9JFsX3OJeT7KPfRd6SD1gu4Lpw5gwxthfOHcYsjM/eY5gaew8zzpN6mMUEJ1HqkNuQgOguHBxFnqFPiMz+Iadw7X38Yz+IgfUkOhN1iuvMhGYKbwKJ7rTiBVvGGpF6Wse1zFKgSiTLH2RnUAMkkHmxqk+JhbQKZpSWr6O8BfhHO1OKg7hpcHZtOJKNMjIF62WYDVf36w1h8h5fg==\" ,\n " +
864+ " \" associated_data\" : \" mch_payment\" ,\n " +
865+ " \" nonce\" : \" DdF3UJVNQaKT\" \n " +
866+ " }\n " +
867+ "}" ;
868+ WxPayTransferBatchesNotifyV3Result transferBatchesNotifyV3Body = GSON .fromJson (body , WxPayTransferBatchesNotifyV3Result .class );
869+ log .info (GSON .toJson (transferBatchesNotifyV3Body ));
870+
871+ // 处理业务逻辑 ...
872+
873+ return WxPayNotifyV3Response .success ("成功" );
874+ }
875+
876+ // 测试
877+ public static void main (String [] args ){
878+ String body = "{\n " +
879+ " \" id\" : \" 1c8192d8-aba1-5898-a79c-7d3abb72eabe\" ,\n " +
880+ " \" create_time\" : \" 2023-08-16T16:43:27+08:00\" ,\n " +
881+ " \" resource_type\" : \" encrypt-resource\" ,\n " +
882+ " \" event_type\" : \" MCHTRANSFER.BATCH.FINISHED\" ,\n " +
883+ " \" summary\" : \" 商家转账批次完成通知\" ,\n " +
884+ " \" resource\" : {\n " +
885+ " \" original_type\" : \" mch_payment\" ,\n " +
886+ " \" algorithm\" : \" AEAD_AES_256_GCM\" ,\n " +
887+ " \" ciphertext\" : \" zTBf6DDPzZSoIBkoLFkC+ho97QrqnT6UU/ADM0tJP07ITaFPek4vofQjmclLUof78NqrPcJs5OIBl+gnKKJ4xCxcDmDnZZHvev5o1pk4gwtJIFIDxbq3piDr4Wq6cZpvGPPQTYC8YoVRTdVeeN+EcuklRrmaFzv8wCTSdI9wFJ9bsxtLedhq4gpkKqN5fbSguQg9JFsX3OJeT7KPfRd6SD1gu4Lpw5gwxthfOHcYsjM/eY5gaew8zzpN6mMUEJ1HqkNuQgOguHBxFnqFPiMz+Iadw7X38Yz+IgfUkOhN1iuvMhGYKbwKJ7rTiBVvGGpF6Wse1zFKgSiTLH2RnUAMkkHmxqk+JhbQKZpSWr6O8BfhHO1OKg7hpcHZtOJKNMjIF62WYDVf36w1h8h5fg==\" ,\n " +
888+ " \" associated_data\" : \" mch_payment\" ,\n " +
889+ " \" nonce\" : \" DdF3UJVNQaKT\" \n " +
890+ " }\n " +
891+ "}" ;
892+ OriginNotifyResponse transferBatchesNotifyV3Body = GSON .fromJson (body , OriginNotifyResponse .class );
893+ log .info (GSON .toJson (transferBatchesNotifyV3Body ));
894+
895+ String decryptNotifyResult = "{\n " +
896+ " \" out_batch_no\" : \" bfatestnotify000033\" ,\n " +
897+ " \" batch_id\" : \" 131000007026709999520922023081519403795655\" ,\n " +
898+ " \" batch_status\" : \" FINISHED\" ,\n " +
899+ " \" total_num\" : 2,\n " +
900+ " \" total_amount\" : 200,\n " +
901+ " \" success_amount\" : 100,\n " +
902+ " \" success_num\" : 1,\n " +
903+ " \" fail_amount\" : 100,\n " +
904+ " \" fail_num\" : 1,\n " +
905+ " \" mchid\" : \" 2483775951\" ,\n " +
906+ " \" update_time\" : \" 2023-08-15T20:33:22+08:00\" \n " +
907+ "}" ;
908+ WxPayTransferBatchesNotifyV3Result .DecryptNotifyResult notifyResult = GSON .fromJson (decryptNotifyResult , WxPayTransferBatchesNotifyV3Result .DecryptNotifyResult .class );
909+ log .info (GSON .toJson (notifyResult ));
910+
911+ }
912+
844913 @ Test
845914 public void testWxPayNotifyV3Response () {
846915 System .out .println (WxPayNotifyV3Response .success ("success" ));
0 commit comments