From 6458d08381dd1a6f4be4538e17bfe24a0e43c163 Mon Sep 17 00:00:00 2001 From: RHQYZ Date: Tue, 25 Jan 2022 13:24:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(tenpayv2):=20=E6=96=B0=E5=A2=9E=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../YesOrNoNullableBooleanConverter.cs | 12 +- .../FlattenNArrayObjectConverterBase.cs | 115 ++++- .../YesOrNoNullableBooleanConverter.cs | 2 +- .../FlattenNArrayObjectConverterBase.cs | 183 ++++++- .../Events/OrderEvent.cs | 213 ++++++++ .../Events/PAPContractEvent.cs | 99 ++++ .../Events/PAPOrderEvent.cs | 178 +++++++ .../Events/RefundEventRequestInfo.cs | 121 +++++ .../WechatTenpayEventDecryptionException.cs | 24 + .../WechatTenpayEventVerificationException.cs | 24 + .../WechatTenpayRequestSignatureException.cs | 24 + ...atTenpayClientEventDecryptionExtensions.cs | 58 +++ ...TenpayClientEventVerificationExtensions.cs | 63 +++ ...hatTenpayClientExecuteDepositExtensions.cs | 164 ++++++ ...echatTenpayClientExecuteFraudExtensions.cs | 32 ++ .../WechatTenpayClientExecutePAPExtensions.cs | 132 +++++ ...TenpayClientExecutePAPPartnerExtensions.cs | 114 +++++ .../WechatTenpayClientExecutePayExtensions.cs | 225 +++++++++ ...hatTenpayClientExecutePayITILExtensions.cs | 11 + ...ePayMarketingTransfersRedPackExtensions.cs | 93 ++++ ...PayMarketingTransfersTransferExtensions.cs | 49 ++ ...utePayServicePartnerTransfersExtensions.cs | 49 ++ ...WechatTenpayClientExecuteRiskExtensions.cs | 30 ++ ...enpayClientExecuteSubMerchantExtensions.cs | 50 ++ ...echatTenpayClientExecuteToolsExtensions.cs | 20 + ...ayClientExecuteVehiclePartnerExtensions.cs | 68 +++ .../WechatTenpayClientParameterExtensions.cs | 472 ++++++++++++++++++ .../Models/Deposit/ConsumeDepositRequest.cs | 83 +++ .../Models/Deposit/ConsumeDepositResponse.cs | 73 +++ .../Deposit/CreateDepositFacePayRequest.cs | 194 +++++++ .../Deposit/CreateDepositFacePayResponse.cs | 9 + .../Deposit/CreateDepositMicroPayRequest.cs | 201 ++++++++ .../Deposit/CreateDepositMicroPayResponse.cs | 167 +++++++ .../Deposit/CreateDepositRefundRequest.cs | 104 ++++ .../Deposit/CreateDepositRefundResponse.cs | 120 +++++ .../CreateDepositUnifiedOrderRequest.cs | 205 ++++++++ .../CreateDepositUnifiedOrderResponse.cs | 64 +++ .../Models/Deposit/GetDepositOrderRequest.cs | 60 +++ .../Models/Deposit/GetDepositOrderResponse.cs | 189 +++++++ .../Models/Deposit/GetDepositRefundRequest.cs | 60 +++ .../Deposit/GetDepositRefundResponse.cs | 193 +++++++ .../Deposit/ReverseDepositOrderRequest.cs | 60 +++ .../Deposit/ReverseDepositOrderResponse.cs | 36 ++ .../Models/Fraud/GetRiskPublicKeyRequest.cs | 32 ++ .../Models/Fraud/GetRiskPublicKeyResponse.cs | 29 ++ ...MerchantCustomsCustomDeclarationRequest.cs | 18 + ...erchantCustomsCustomDeclarationResponse.cs | 14 + ...MerchantCustomsCustomDeclarationRequest.cs | 14 + ...erchantCustomsCustomDeclarationResponse.cs | 20 +- ...MerchantCustomsCustomDeclarationRequest.cs | 14 + ...erchantCustomsCustomDeclarationResponse.cs | 14 + .../Models/PAP/Contract/ApplyPAPPayRequest.cs | 128 +++++ .../PAP/Contract/ApplyPAPPayResponse.cs | 22 + .../Contract/CreateContractOrderRequest.cs | 192 +++++++ .../Contract/CreateContractOrderResponse.cs | 113 +++++ .../Contract/DeletePAPPayContractRequest.cs | 72 +++ .../Contract/DeletePAPPayContractResponse.cs | 71 +++ .../PAP/Contract/GetPAPPayContractRequest.cs | 53 ++ .../PAP/Contract/GetPAPPayContractResponse.cs | 121 +++++ .../PAP/CreatePAPPayH5EntrustWebRequest.cs | 89 ++++ .../PAP/CreatePAPPayH5EntrustWebResponse.cs | 29 ++ .../PAP/CreatePAPPayPreEntrustWebRequest.cs | 83 +++ .../PAP/CreatePAPPayPreEntrustWebResponse.cs | 31 ++ .../Contract/ApplyPAPPayPartnerRequest.cs | 22 + .../Contract/ApplyPAPPayPartnerResponse.cs | 22 + .../GetPAPPayPartnerContractRequest.cs | 22 + .../GetPAPPayPartnerContractResponse.cs | 22 + .../CreatePAPPayPartnerH5EntrustWebRequest.cs | 72 +++ ...CreatePAPPayPartnerH5EntrustWebResponse.cs | 9 + ...CreatePAPPayPartnerPreEntrustWebRequest.cs | 22 + ...reatePAPPayPartnerPreEntrustWebResponse.cs | 22 + .../Models/Pay/Bill/DownloadPayBillRequest.cs | 57 +++ .../Pay/Bill/DownloadPayBillResponse.cs | 27 + .../Pay/Bill/DownloadPayFundFlowRequest.cs | 53 ++ .../Pay/Bill/DownloadPayFundFlowResponse.cs | 27 + .../Models/Pay/ClosePayOrderRequest.cs | 43 ++ .../Models/Pay/ClosePayOrderResponse.cs | 36 ++ .../Models/Pay/CreatePayMicroPayRequest.cs | 138 +---- .../Models/Pay/CreatePayMicroPayResponse.cs | 29 +- .../Models/Pay/CreatePayRefundRequest.cs | 101 ++++ .../Models/Pay/CreatePayRefundResponse.cs | 182 +++++++ .../Pay/CreatePayUnifiedOrderRequest.cs | 340 +++++++++++++ .../Pay/CreatePayUnifiedOrderResponse.cs | 64 +++ .../Models/Pay/GetPayOrderRequest.cs | 50 ++ .../Models/Pay/GetPayOrderResponse.cs | 307 ++++++++++++ .../Models/Pay/GetPayRefundRequest.cs | 71 +++ .../Models/Pay/GetPayRefundResponse.cs | 192 +++++++ .../Models/Pay/ReversePayOrderRequest.cs | 43 ++ .../Models/Pay/ReversePayOrderResponse.cs | 45 ++ .../PayITIL/SubmitPayITILReportRequest.cs | 76 ++- .../PayITIL/SubmitPayITILReportResponse.cs | 270 +--------- ...PayMarketingTransfersRedPackInfoRequest.cs | 37 ++ ...ayMarketingTransfersRedPackInfoResponse.cs | 177 +++++++ ...ayMarketingTransfersGroupRedPackRequest.cs | 124 +++++ ...yMarketingTransfersGroupRedPackResponse.cs | 58 +++ ...etingTransfersMiniProgramRedPackRequest.cs | 96 ++++ ...tingTransfersMiniProgramRedPackResponse.cs | 58 +++ ...SendPayMarketingTransfersRedPackRequest.cs | 116 +++++ ...endPayMarketingTransfersRedPackResponse.cs | 51 ++ ...ketingTransfersPromotionTransferRequest.cs | 102 ++++ ...etingTransfersPromotionTransferResponse.cs | 54 ++ ...ayMarketingTransfersTransferInfoRequest.cs | 29 ++ ...yMarketingTransfersTransferInfoResponse.cs | 99 ++++ ...ServicePartnerTransfersPayToBankRequest.cs | 65 +++ ...ervicePartnerTransfersPayToBankResponse.cs | 52 ++ ...icePartnerTransfersPayToBankInfoRequest.cs | 29 ++ ...cePartnerTransfersPayToBankInfoResponse.cs | 100 ++++ .../Models/Risk/QueryRiskViolationRequest.cs | 75 +++ .../Models/Risk/QueryRiskViolationResponse.cs | 111 ++++ .../AddSubMerchantDevelopConfigRequest.cs | 43 ++ .../AddSubMerchantDevelopConfigResponse.cs | 22 + .../GetSubMerchantDevelopConfigRequest.cs | 29 ++ .../GetSubMerchantDevelopConfigResponse.cs | 99 ++++ .../Tools/ToolsAuthCodeToOpenIdRequest.cs | 14 + .../Tools/ToolsAuthCodeToOpenIdResponse.cs | 14 + .../Models/Tools/ToolsShortUrlRequest.cs | 43 ++ .../Models/Tools/ToolsShortUrlResponse.cs | 43 ++ .../ApplyVehiclePartnerPayRequest.cs | 294 +++++++++++ .../ApplyVehiclePartnerPayResponse.cs | 43 ++ .../GetVehiclePartnerPayStateRequest.cs | 91 ++++ .../GetVehiclePartnerPayStateResponse.cs | 131 +++++ .../NotifyVehiclePartnerPayRequest.cs | 168 +++++++ .../NotifyVehiclePartnerPayResponse.cs | 50 ++ ...KIT.FlurlHttpClient.Wechat.TenpayV2.csproj | 6 +- .../Utilities/AESUtility.cs | 52 ++ .../Utilities/Internal/JsonUtility.cs | 428 +--------------- .../Utilities/Internal/RequestSigner.cs | 45 ++ .../Utilities/Internal/XmlUtility.cs | 24 +- .../WechatTenpayClient.cs | 43 +- .../WechatTenpayEvent.cs | 102 ++++ .../WechatTenpayRequest.cs | 14 +- .../WechatTenpayResponse.cs | 30 +- ...WechatTenpayClientExecuteBillExtensions.cs | 2 +- ...yClientExecuteMerchantServiceExtensions.cs | 2 +- .../WechatTenpayClientExecutePAPExtensions.cs | 36 ++ ...TenpayClientExecutePartnerPAPExtensions.cs | 36 ++ .../PAPPay/NotifyPAPPayContractsRequest.cs | 57 +++ .../PAPPay/NotifyPAPPayContractsResponse.cs | 9 + .../NotifyPartnerPAPPayContractsRequest.cs | 57 +++ .../NotifyPartnerPAPPayContractsResponse.cs | 9 + .../EventSamples/OrderEvent.json | 24 + .../EventSamples/PAPContractEvent.json | 13 + .../EventSamples/PAPOrderEvent.json | 21 + .../EventSamples/RefundEventRequestInfo.json | 15 + .../Deposit/ConsumeDepositRequest.json | 11 + .../Deposit/ConsumeDepositResponse.json | 14 + .../Deposit/CreateDepositFacePayRequest.json | 17 + .../Deposit/CreateDepositFacePayResponse.json | 21 + .../Deposit/CreateDepositMicroPayRequest.json | 16 + .../CreateDepositMicroPayResponse.json | 21 + .../Deposit/CreateDepositRefundRequest.json | 13 + .../Deposit/CreateDepositRefundResponse.json | 14 + .../CreateDepositUnifiedOrderRequest.json | 16 + .../CreateDepositUnifiedOrderResponse.json | 11 + .../Deposit/GetDepositOrderRequest.json | 8 + .../Deposit/GetDepositOrderResponse.json | 21 + .../Deposit/GetDepositRefundRequest.json | 8 + .../Deposit/GetDepositRefundResponse.json | 15 + .../Deposit/ReverseDepositOrderRequest.json | 8 + .../Deposit/ReverseDepositOrderResponse.json | 9 + .../Fraud/GetRiskPublicKeyRequest.json | 6 + .../Fraud/GetRiskPublicKeyResponse.json | 7 + .../PAP/Contract/ApplyPAPPayRequest.json | 12 + .../PAP/Contract/ApplyPAPPayResponse.json | 9 + .../Contract/DeletePAPPayContractRequest.json | 9 + .../DeletePAPPayContractResponse.json | 8 + .../Contract/GetPAPPayContractRequest.json | 7 + .../Contract/GetPAPPayContractResponse.json | 21 + .../PAP/CreateContractOrderRequest.json | 21 + .../PAP/CreateContractOrderResponse.json | 12 + .../PAP/CreatePAPPayPreEntrustWebRequest.json | 13 + .../CreatePAPPayPreEntrustWebResponse.json | 10 + .../Contract/ApplyPAPPayPartnerRequest.json | 14 + .../Contract/ApplyPAPPayPartnerResponse.json | 10 + .../GetPAPPayPartnerContractRequest.json | 8 + .../GetPAPPayPartnerContractResponse.json | 22 + ...eatePAPPayPartnerPreEntrustWebRequest.json | 15 + ...atePAPPayPartnerPreEntrustWebResponse.json | 12 + .../Pay/ClosePayOrderRequest.json | 8 + .../Pay/ClosePayOrderResponse.json | 11 + .../Pay/CreatePayRefundRequest.json | 12 + .../Pay/CreatePayRefundResponse.json | 15 + .../Pay/CreatePayUnifiedOrderRequest.json | 16 + .../Pay/CreatePayUnifiedOrderResponse.json | 12 + .../ModelSamples/Pay/GetPayOrderRequest.json | 9 + .../ModelSamples/Pay/GetPayOrderResponse.json | 26 + .../ModelSamples/Pay/GetPayRefundRequest.json | 7 + .../Pay/GetPayRefundResponse.json | 15 + .../Pay/ReversePayOrderRequest.json | 8 + .../Pay/ReversePayOrderResponse.json | 12 + ...yMarketingTransfersRedPackInfoRequest.json | 8 + ...MarketingTransfersRedPackInfoResponse.json | 30 ++ ...MarketingTransfersGroupRedPackRequest.json | 18 + ...arketingTransfersGroupRedPackResponse.json | 12 + ...ingTransfersMiniProgramRedPackRequest.json | 15 + ...ngTransfersMiniProgramRedPackResponse.json | 14 + ...ndPayMarketingTransfersRedPackRequest.json | 17 + ...dPayMarketingTransfersRedPackResponse.json | 12 + ...tingTransfersPromotionTransferRequest.json | 13 + ...ingTransfersPromotionTransferResponse.json | 10 + ...MarketingTransfersTransferInfoRequest.json | 7 + ...arketingTransfersTransferInfoResponse.json | 15 + ...rvicePartnerTransfersPayToBankRequest.json | 11 + ...vicePartnerTransfersPayToBankResponse.json | 13 + ...ePartnerTransfersPayToBankInfoRequest.json | 6 + ...PartnerTransfersPayToBankInfoResponse.json | 16 + .../Risk/QueryRiskViolationRequest.json | 8 + .../Risk/QueryRiskViolationResponse.json | 5 + .../AddSubMerchantDevelopConfigRequest.json | 8 + .../AddSubMerchantDevelopConfigResponse.json | 8 + .../GetSubMerchantDevelopConfigRequest.json | 6 + .../GetSubMerchantDevelopConfigResponse.json | 6 + .../ApplyVehiclePartnerPayRequest.json | 16 + .../ApplyVehiclePartnerPayResponse.json | 10 + .../GetVehiclePartnerPayStateRequest.json | 11 + .../GetVehiclePartnerPayStateResponse.json | 11 + .../NotifyVehiclePartnerPayRequest.json | 10 + .../NotifyVehiclePartnerPayResponse.json | 11 + ...ttpClient.Wechat.TenpayV2.UnitTests.csproj | 3 +- .../TestCase_AESUtilityTests.cs | 21 + .../TestCase_ApiExecuteExecutePayTests.cs | 27 + .../TestCase_CodeReviewAnalyzer.cs | 12 + .../TestCase_EventVerificationTests.cs | 19 + .../TestCase_JsonConverterTests.cs | 14 +- .../TestCase_RequestSignTests.cs | 49 ++ .../TestClients.cs | 3 +- .../appsettings.local.json | 2 +- .../PAPPay/NotifyPAPPayContractsRequest.json | 8 + .../PAPPay/NotifyPAPPayContractsResponse.json | 1 + .../NotifyPartnerPAPPayContractsRequest.json | 10 + .../NotifyPartnerPAPPayContractsResponse.json | 1 + ...tyTests.cs => TestCase_AESUtilityTests.cs} | 0 ...tyTests.cs => TestCase_RSAUtilityTests.cs} | 0 .../CodeStyleUtil.cs | 30 +- 234 files changed, 11734 insertions(+), 891 deletions(-) create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Events/OrderEvent.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Events/PAPContractEvent.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Events/PAPOrderEvent.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Events/RefundEventRequestInfo.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Exceptions/WechatTenpayEventDecryptionException.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Exceptions/WechatTenpayEventVerificationException.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Exceptions/WechatTenpayRequestSignatureException.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientEventDecryptionExtensions.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientEventVerificationExtensions.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteDepositExtensions.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteFraudExtensions.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePAPExtensions.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePAPPartnerExtensions.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePayMarketingTransfersRedPackExtensions.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePayMarketingTransfersTransferExtensions.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePayServicePartnerTransfersExtensions.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteRiskExtensions.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteSubMerchantExtensions.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteVehiclePartnerExtensions.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientParameterExtensions.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/ConsumeDepositRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/ConsumeDepositResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositFacePayRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositFacePayResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositMicroPayRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositMicroPayResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositRefundRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositRefundResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositUnifiedOrderRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositUnifiedOrderResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/GetDepositOrderRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/GetDepositOrderResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/GetDepositRefundRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/GetDepositRefundResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/ReverseDepositOrderRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/ReverseDepositOrderResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Fraud/GetRiskPublicKeyRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Fraud/GetRiskPublicKeyResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/ApplyPAPPayRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/ApplyPAPPayResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/CreateContractOrderRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/CreateContractOrderResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/DeletePAPPayContractRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/DeletePAPPayContractResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/GetPAPPayContractRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/GetPAPPayContractResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/CreatePAPPayH5EntrustWebRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/CreatePAPPayH5EntrustWebResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/CreatePAPPayPreEntrustWebRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/CreatePAPPayPreEntrustWebResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/Contract/ApplyPAPPayPartnerRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/Contract/ApplyPAPPayPartnerResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/Contract/GetPAPPayPartnerContractRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/Contract/GetPAPPayPartnerContractResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/CreatePAPPayPartnerH5EntrustWebRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/CreatePAPPayPartnerH5EntrustWebResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/CreatePAPPayPartnerPreEntrustWebRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/CreatePAPPayPartnerPreEntrustWebResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/Bill/DownloadPayBillRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/Bill/DownloadPayBillResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/Bill/DownloadPayFundFlowRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/Bill/DownloadPayFundFlowResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/ClosePayOrderRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/ClosePayOrderResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayRefundRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayRefundResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayUnifiedOrderRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayUnifiedOrderResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/GetPayOrderRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/GetPayOrderResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/GetPayRefundRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/GetPayRefundResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/ReversePayOrderRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/ReversePayOrderResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/GetPayMarketingTransfersRedPackInfoRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/GetPayMarketingTransfersRedPackInfoResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersGroupRedPackRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersGroupRedPackResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersMiniProgramRedPackRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersMiniProgramRedPackResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersRedPackRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersRedPackResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersTransfer/CreatePayMarketingTransfersPromotionTransferRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersTransfer/CreatePayMarketingTransfersPromotionTransferResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersTransfer/GetPayMarketingTransfersTransferInfoRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersTransfer/GetPayMarketingTransfersTransferInfoResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayServicePartnerTransfers/CreatePayServicePartnerTransfersPayToBankRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayServicePartnerTransfers/CreatePayServicePartnerTransfersPayToBankResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayServicePartnerTransfers/GetPayServicePartnerTransfersPayToBankInfoRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayServicePartnerTransfers/GetPayServicePartnerTransfersPayToBankInfoResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Risk/QueryRiskViolationRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Risk/QueryRiskViolationResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/SubMerchant/AddSubMerchantDevelopConfigRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/SubMerchant/AddSubMerchantDevelopConfigResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/SubMerchant/GetSubMerchantDevelopConfigRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/SubMerchant/GetSubMerchantDevelopConfigResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Tools/ToolsShortUrlRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Tools/ToolsShortUrlResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/ApplyVehiclePartnerPayRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/ApplyVehiclePartnerPayResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/GetVehiclePartnerPayStateRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/GetVehiclePartnerPayStateResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/NotifyVehiclePartnerPayRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/NotifyVehiclePartnerPayResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Utilities/AESUtility.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Utilities/Internal/RequestSigner.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayEvent.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecutePAPExtensions.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecutePartnerPAPExtensions.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PAPPay/NotifyPAPPayContractsRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PAPPay/NotifyPAPPayContractsResponse.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PartnerPAPPay/NotifyPartnerPAPPayContractsRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PartnerPAPPay/NotifyPartnerPAPPayContractsResponse.cs create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/EventSamples/OrderEvent.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/EventSamples/PAPContractEvent.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/EventSamples/PAPOrderEvent.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/EventSamples/RefundEventRequestInfo.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/ConsumeDepositRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/ConsumeDepositResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositFacePayRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositFacePayResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositMicroPayRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositMicroPayResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositRefundRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositRefundResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositUnifiedOrderRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositUnifiedOrderResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/GetDepositOrderRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/GetDepositOrderResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/GetDepositRefundRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/GetDepositRefundResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/ReverseDepositOrderRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/ReverseDepositOrderResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Fraud/GetRiskPublicKeyRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Fraud/GetRiskPublicKeyResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/ApplyPAPPayRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/ApplyPAPPayResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/DeletePAPPayContractRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/DeletePAPPayContractResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/GetPAPPayContractRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/GetPAPPayContractResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/CreateContractOrderRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/CreateContractOrderResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/CreatePAPPayPreEntrustWebRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/CreatePAPPayPreEntrustWebResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/Contract/ApplyPAPPayPartnerRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/Contract/ApplyPAPPayPartnerResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/Contract/GetPAPPayPartnerContractRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/Contract/GetPAPPayPartnerContractResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/CreatePAPPayPartnerPreEntrustWebRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/CreatePAPPayPartnerPreEntrustWebResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/ClosePayOrderRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/ClosePayOrderResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/CreatePayRefundRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/CreatePayRefundResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/CreatePayUnifiedOrderRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/CreatePayUnifiedOrderResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/GetPayOrderRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/GetPayOrderResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/GetPayRefundRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/GetPayRefundResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/ReversePayOrderRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/ReversePayOrderResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/GetPayMarketingTransfersRedPackInfoRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/GetPayMarketingTransfersRedPackInfoResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersGroupRedPackRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersGroupRedPackResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersMiniProgramRedPackRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersMiniProgramRedPackResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersRedPackRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersRedPackResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersTransfer/CreatePayMarketingTransfersPromotionTransferRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersTransfer/CreatePayMarketingTransfersPromotionTransferResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersTransfer/GetPayMarketingTransfersTransferInfoRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersTransfer/GetPayMarketingTransfersTransferInfoResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayServicePartnerTransfers/CreatePayServicePartnerTransfersPayToBankRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayServicePartnerTransfers/CreatePayServicePartnerTransfersPayToBankResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayServicePartnerTransfers/GetPayServicePartnerTransfersPayToBankInfoRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayServicePartnerTransfers/GetPayServicePartnerTransfersPayToBankInfoResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Risk/QueryRiskViolationRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Risk/QueryRiskViolationResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/SubMerchant/AddSubMerchantDevelopConfigRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/SubMerchant/AddSubMerchantDevelopConfigResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/SubMerchant/GetSubMerchantDevelopConfigRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/SubMerchant/GetSubMerchantDevelopConfigResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/ApplyVehiclePartnerPayRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/ApplyVehiclePartnerPayResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/GetVehiclePartnerPayStateRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/GetVehiclePartnerPayStateResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/NotifyVehiclePartnerPayRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/NotifyVehiclePartnerPayResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_AESUtilityTests.cs create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_ApiExecuteExecutePayTests.cs create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_EventVerificationTests.cs create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_RequestSignTests.cs create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/PAPPay/NotifyPAPPayContractsRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/PAPPay/NotifyPAPPayContractsResponse.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/PartnerPAPPay/NotifyPartnerPAPPayContractsRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/PartnerPAPPay/NotifyPartnerPAPPayContractsResponse.json rename test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/{TestCase_AesUtilityTests.cs => TestCase_AESUtilityTests.cs} (100%) rename test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/{TestCase_RsaUtilityTests.cs => TestCase_RSAUtilityTests.cs} (100%) diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Converters/Internal/Newtonsoft.Json/Boolean/YesOrNoNullableBooleanConverter.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Converters/Internal/Newtonsoft.Json/Boolean/YesOrNoNullableBooleanConverter.cs index 7be9f420..f6d23e81 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Converters/Internal/Newtonsoft.Json/Boolean/YesOrNoNullableBooleanConverter.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Converters/Internal/Newtonsoft.Json/Boolean/YesOrNoNullableBooleanConverter.cs @@ -14,17 +14,17 @@ namespace Newtonsoft.Json.Converters get { return true; } } - public override bool? ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, bool? existingValue, bool hasExistingValue, Newtonsoft.Json.JsonSerializer serializer) + public override bool? ReadJson(JsonReader reader, Type objectType, bool? existingValue, bool hasExistingValue, JsonSerializer serializer) { - if (reader.TokenType == Newtonsoft.Json.JsonToken.Null) + if (reader.TokenType == JsonToken.Null) { return existingValue; } - else if (reader.TokenType == Newtonsoft.Json.JsonToken.Boolean) + else if (reader.TokenType == JsonToken.Boolean) { return serializer.Deserialize(reader); } - else if (reader.TokenType == Newtonsoft.Json.JsonToken.String) + else if (reader.TokenType == JsonToken.String) { string? value = serializer.Deserialize(reader); if (value == null) @@ -36,10 +36,10 @@ namespace Newtonsoft.Json.Converters return false; } - throw new Newtonsoft.Json.JsonReaderException(); + throw new JsonReaderException(); } - public override void WriteJson(Newtonsoft.Json.JsonWriter writer, bool? value, Newtonsoft.Json.JsonSerializer serializer) + public override void WriteJson(JsonWriter writer, bool? value, JsonSerializer serializer) { if (value.HasValue) writer.WriteValue(value.Value ? "Y" : "N"); diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Converters/Internal/Newtonsoft.Json/Object/FlattenNArrayObjectConverterBase.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Converters/Internal/Newtonsoft.Json/Object/FlattenNArrayObjectConverterBase.cs index 59673084..6068cb57 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Converters/Internal/Newtonsoft.Json/Object/FlattenNArrayObjectConverterBase.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Converters/Internal/Newtonsoft.Json/Object/FlattenNArrayObjectConverterBase.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Reflection; using System.Text.RegularExpressions; using Newtonsoft.Json.Linq; +using Newtonsoft.Json.Serialization; namespace Newtonsoft.Json.Converters { @@ -24,13 +25,16 @@ namespace Newtonsoft.Json.Converters public Type PropertyType { get { return PropertyInfo.PropertyType; } } - public bool IsNArrayProperty { get; } + public bool PropertyIsNArray { get; } - public InnerTypedJsonProperty(string propertyName, PropertyInfo propertyInfo, bool isNArrayProperty) + public JsonConverter? JsonConverter { get; } + + public InnerTypedJsonProperty(string propertyName, PropertyInfo propertyInfo, bool propertyIsNArray, JsonConverter? jsonConverter) { PropertyName = propertyName; PropertyInfo = propertyInfo; - IsNArrayProperty = isNArrayProperty; + PropertyIsNArray = propertyIsNArray; + JsonConverter = jsonConverter; } } @@ -58,7 +62,7 @@ namespace Newtonsoft.Json.Converters else if (reader.TokenType == JsonToken.StartObject) { InnerTypedJsonProperty[] typedJsonProperties = GetTypedJsonProperties(objectType); - if (typedJsonProperties.Count(p => p.IsNArrayProperty) != 1) + if (typedJsonProperties.Count(p => p.PropertyIsNArray) != 1) throw new JsonSerializationException("The number of `$n` properties must be only one."); JObject jObject = JObject.Load(reader); @@ -70,22 +74,29 @@ namespace Newtonsoft.Json.Converters if (typedJsonProperty != null) { // 处理普通属性 - object? value = serializer is null ? - jObject[typedJsonProperty.PropertyName]?.ToObject(typedJsonProperty.PropertyType) : - jObject[typedJsonProperty.PropertyName]?.ToObject(typedJsonProperty.PropertyType, serializer); + JsonSerializer tmpSerializer = serializer; + if (typedJsonProperty.JsonConverter != null) + { + tmpSerializer = JsonSerializer.CreateDefault(serializer.ExtractSerializerSettings()); + tmpSerializer.Converters.Add(typedJsonProperty.JsonConverter); + } + + object? value = jObject[typedJsonProperty.PropertyName]?.ToObject(typedJsonProperty.PropertyType, tmpSerializer); typedJsonProperty.PropertyInfo.SetValue(tObject, value); } else if (TryMatchNArrayIndex(jKey.Name, out int index)) { // 处理 $n 属性 - InnerTypedJsonProperty narrayJsonProperty = typedJsonProperties.Single(e => e.IsNArrayProperty); + InnerTypedJsonProperty narrayJsonProperty = typedJsonProperties.Single(e => e.PropertyIsNArray); object? value = narrayJsonProperty.PropertyInfo.GetValue(tObject); + JsonSerializer tmpSerializer = serializer; + Array array = CreateOrExpandNArray(value, narrayJsonProperty.PropertyType.GetElementType()!, index + 1); - object? element = CreateOrUpdateNArrayElement(array, index, jKey.Name, jKey.Value, serializer); + object? element = CreateOrUpdateNArrayElement(array, index, jKey.Name, jKey.Value, tmpSerializer); narrayJsonProperty.PropertyInfo.SetValue(tObject, array); } - else if (serializer?.MissingMemberHandling == MissingMemberHandling.Error) + else if (serializer.MissingMemberHandling == MissingMemberHandling.Error) { throw new JsonSerializationException($"Could not find member `{jKey.Name}` on object of type `{objectType.Name}`."); } @@ -105,7 +116,61 @@ namespace Newtonsoft.Json.Converters return; } - throw new NotImplementedException(); + writer.WriteStartObject(); + + JsonObjectContract jsonContract = (JsonObjectContract)serializer.ContractResolver.ResolveContract(value.GetType()); + foreach (JsonProperty jsonProperty in jsonContract.Properties) + { + if (jsonProperty.Ignored) + continue; + if (!(jsonProperty.ShouldSerialize == null || jsonProperty.ShouldSerialize(value))) + continue; + + string propertyKey = jsonProperty.PropertyName; + object? propertyValue = jsonProperty.ValueProvider.GetValue(value); + if (propertyValue is null) + { + if (serializer.NullValueHandling == NullValueHandling.Ignore) + continue; + } + + if (!PROPERTY_NAME_NARRAY.Equals(propertyKey)) + { + // 处理普通属性 + writer.WritePropertyName(propertyKey); + + if (jsonProperty.Converter != null && jsonProperty.Converter.CanWrite) + { + jsonProperty.Converter.WriteJson(writer, propertyValue, serializer); + } + else + { + serializer.Serialize(writer, propertyValue); + } + } + else + { + // 处理 $n 属性 + if (propertyValue is null) + continue; + + JArray jArray = JArray.FromObject(propertyValue); + for (int i = 0, len = jArray.Count; i < len; i++) + { + JToken? jSubToken = jArray[i]; + if (jSubToken == null) + continue; + + foreach (JProperty jSubKey in jSubToken) + { + writer.WritePropertyName(jSubKey.Name.Replace(PROPERTY_WILDCARD_NARRAY_ELEMENT, i.ToString())); + serializer.Serialize(writer, jSubKey.Value); + } + } + } + } + + writer.WriteEndObject(); } private static InnerTypedJsonProperty[] GetTypedJsonProperties(Type type) @@ -119,19 +184,30 @@ namespace Newtonsoft.Json.Converters { typedJsonProperties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public) .Where(p => - (p.CanRead && !p.GetCustomAttributes(inherit: true).Any()) && - (p.CanWrite || p.GetCustomAttributes(inherit: true).Any()) - ) + { + if (p.CanWrite || p.GetCustomAttributes(inherit: true).Any()) + { + return !p.GetCustomAttributes(inherit: false).Any(); + } + + return false; + }) .Select(p => { string name = p.GetCustomAttribute(inherit: true)?.PropertyName ?? p.Name; + JsonConverter? converter = p.GetCustomAttributes(inherit: true) + .OrderByDescending(attr => attr.IsDefaultAttribute()) + .Select(attr => (JsonConverter)Activator.CreateInstance(attr.ConverterType, attr.ConverterParameters)!) + .FirstOrDefault(); return new InnerTypedJsonProperty ( propertyName: name, propertyInfo: p, - isNArrayProperty: PROPERTY_NAME_NARRAY.Equals(name) && p.PropertyType.IsArray && p.PropertyType.GetElementType()!.IsClass + propertyIsNArray: PROPERTY_NAME_NARRAY.Equals(name) && p.PropertyType.IsArray && p.PropertyType.GetElementType()!.IsClass, + jsonConverter: converter ); }) + .OrderBy(e => e.PropertyInfo.GetCustomAttribute(inherit: true)?.Order) .ToArray(); _mappedTypeJsonProperties[mappedTypeKey] = typedJsonProperties; } @@ -174,7 +250,7 @@ namespace Newtonsoft.Json.Converters return src; } - private static object CreateOrUpdateNArrayElement(Array array, int index, string jKey, JToken? jValue, JsonSerializer? serializer = null) + private static object CreateOrUpdateNArrayElement(Array array, int index, string jKey, JToken? jValue, JsonSerializer serializer) { if (array == null) throw new ArgumentNullException(nameof(array)); if (index < 0) throw new ArgumentOutOfRangeException(nameof(index)); @@ -205,11 +281,10 @@ namespace Newtonsoft.Json.Converters .SingleOrDefault(p => string.Equals(p.PropertyName.Replace(PROPERTY_WILDCARD_NARRAY_ELEMENT, index.ToString()), jKey)); if (typedJsonProperty != null) { - serializer = serializer ?? JsonSerializer.CreateDefault(); - foreach (JsonConverterAttribute attribute in typedJsonProperty.PropertyInfo.GetCustomAttributes(inherit: true)) + if (typedJsonProperty.JsonConverter != null) { - JsonConverter converter = (JsonConverter)Activator.CreateInstance(attribute.ConverterType, attribute.ConverterParameters)!; - serializer.Converters.Add(converter); + serializer = JsonSerializer.CreateDefault(serializer.ExtractSerializerSettings()); + serializer.Converters.Add(typedJsonProperty.JsonConverter); } object? obj = jValue?.ToObject(typedJsonProperty.PropertyType, serializer); diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Converters/Internal/System.Text.Json/Boolean/YesOrNoNullableBooleanConverter.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Converters/Internal/System.Text.Json/Boolean/YesOrNoNullableBooleanConverter.cs index 1060d326..025aef5b 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Converters/Internal/System.Text.Json/Boolean/YesOrNoNullableBooleanConverter.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Converters/Internal/System.Text.Json/Boolean/YesOrNoNullableBooleanConverter.cs @@ -18,7 +18,7 @@ namespace System.Text.Json.Converters { return false; } - else if (reader.TokenType == System.Text.Json.JsonTokenType.String) + else if (reader.TokenType == JsonTokenType.String) { string? value = reader.GetString(); if (value == null) diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Converters/Internal/System.Text.Json/Object/FlattenNArrayObjectConverterBase.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Converters/Internal/System.Text.Json/Object/FlattenNArrayObjectConverterBase.cs index c0db7526..b64c31da 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Converters/Internal/System.Text.Json/Object/FlattenNArrayObjectConverterBase.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Converters/Internal/System.Text.Json/Object/FlattenNArrayObjectConverterBase.cs @@ -1,6 +1,8 @@ using System.Collections; +using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Text.Json.Nodes; using System.Text.Json.Serialization; using System.Text.RegularExpressions; @@ -23,13 +25,16 @@ namespace System.Text.Json.Converters public Type PropertyType { get { return PropertyInfo.PropertyType; } } - public bool IsNArrayProperty { get; } + public bool PropertyIsNArray { get; } - public InnerTypedJsonProperty(string propertyName, PropertyInfo propertyInfo, bool isNArrayProperty) + public JsonConverter? JsonConverter { get; } + + public InnerTypedJsonProperty(string propertyName, PropertyInfo propertyInfo, bool propertyIsNArray, JsonConverter? jsonConverter) { PropertyName = propertyName; PropertyInfo = propertyInfo; - IsNArrayProperty = isNArrayProperty; + PropertyIsNArray = propertyIsNArray; + JsonConverter = jsonConverter; } } @@ -47,7 +52,7 @@ namespace System.Text.Json.Converters else if (reader.TokenType == JsonTokenType.StartObject) { InnerTypedJsonProperty[] typedJsonProperties = GetTypedJsonProperties(typeToConvert); - if (typedJsonProperties.Count(p => p.IsNArrayProperty) != 1) + if (typedJsonProperties.Count(p => p.PropertyIsNArray) != 1) throw new JsonException("The number of `$n` properties must be only one."); JsonElement jElement = JsonDocument.ParseValue(ref reader).RootElement.Clone(); @@ -59,19 +64,26 @@ namespace System.Text.Json.Converters if (typedJsonProperty != null) { // 处理普通属性 - object? value = options is null ? - JsonSerializer.Deserialize(jKey.Value, typedJsonProperty.PropertyType, options) : - JsonSerializer.Deserialize(jKey.Value, typedJsonProperty.PropertyType, options); + JsonSerializerOptions tmpOptions = options; + if (typedJsonProperty.JsonConverter != null) + { + tmpOptions = new JsonSerializerOptions(options); + tmpOptions.Converters.Add(typedJsonProperty.JsonConverter); + } + + object? value = JsonSerializer.Deserialize(jKey.Value, typedJsonProperty.PropertyType, tmpOptions); typedJsonProperty.PropertyInfo.SetValue(tObject, value); } else if (TryMatchNArrayIndex(jKey.Name, out int index)) { // 处理 $n 属性 - InnerTypedJsonProperty narrayJsonProperty = typedJsonProperties.Single(e => e.IsNArrayProperty); + InnerTypedJsonProperty narrayJsonProperty = typedJsonProperties.Single(e => e.PropertyIsNArray); object? value = narrayJsonProperty.PropertyInfo.GetValue(tObject); + JsonSerializerOptions tmpOptions = options; + Array array = CreateOrExpandNArray(value, narrayJsonProperty.PropertyType.GetElementType()!, index + 1); - object? element = CreateOrUpdateNArrayElement(array, index, jKey.Name, jKey.Value, options); + object? element = CreateOrUpdateNArrayElement(array, index, jKey.Name, jKey.Value, tmpOptions); narrayJsonProperty.PropertyInfo.SetValue(tObject, array); } } @@ -89,7 +101,109 @@ namespace System.Text.Json.Converters return; } - throw new NotImplementedException(); + writer.WriteStartObject(); + + foreach (InnerTypedJsonProperty typedJsonProperty in GetTypedJsonProperties(value.GetType())) + { + if (!typedJsonProperty.PropertyIsNArray) + { + // 处理普通属性 + string propertyKey = typedJsonProperty.PropertyName; + object? propertyValue = typedJsonProperty.PropertyInfo.GetValue(value); + if (propertyValue is null) + { + if (options.DefaultIgnoreCondition == JsonIgnoreCondition.Always || options.DefaultIgnoreCondition == JsonIgnoreCondition.WhenWritingNull) + continue; + } + else if (propertyValue == (propertyValue.GetType().IsValueType ? Activator.CreateInstance(propertyValue.GetType()) : null)) + { + if (options.DefaultIgnoreCondition == JsonIgnoreCondition.Always || options.DefaultIgnoreCondition == JsonIgnoreCondition.WhenWritingDefault) + continue; + } + + JsonSerializerOptions tmpOptions = options; + JsonConverter? tmpConverter = typedJsonProperty.JsonConverter; + if (tmpConverter != null) + { + tmpOptions = new JsonSerializerOptions(options); + tmpOptions.Converters.Add(tmpConverter); + } + + if (tmpConverter != null && CheckTypeIsSubclassOf(tmpConverter.GetType(), typeof(TextualObjectInJsonFormatConverterBase<>))) + { + // TODO: 优化 + tmpOptions.Converters.Remove(tmpConverter); + writer.WritePropertyName(propertyKey); + writer.WriteStringValue(JsonSerializer.Serialize(propertyValue, tmpOptions)); + } + else + { + writer.WritePropertyName(propertyKey); + writer.WriteRawValue(JsonSerializer.Serialize(propertyValue, tmpOptions), skipInputValidation: true); + } + } + else + { + // 处理 $n 属性 + Array? array = (Array?)typedJsonProperty.PropertyInfo.GetValue(value); + if (array is null) + continue; + + for (int i = 0, len = array.Length; i < len; i++) + { + object? element = array.GetValue(i); + if (element is null) + continue; + + JsonSerializerOptions tmpOptions = options; + JsonConverter? tmpConverter = GetTypedJsonConverter(element.GetType()); + if (tmpConverter != null) + { + tmpOptions = new JsonSerializerOptions(options); + tmpOptions.Converters.Add(tmpConverter); + } + + JsonObject jSubObject = JsonSerializer.SerializeToNode(element, tmpOptions)!.AsObject(); + foreach (KeyValuePair jSubKey in jSubObject) + { + writer.WritePropertyName(jSubKey.Key.Replace(PROPERTY_WILDCARD_NARRAY_ELEMENT, i.ToString())); + writer.WriteRawValue(jSubKey.Value?.ToJsonString(tmpOptions)!, skipInputValidation: true); + } + } + } + } + + writer.WriteEndObject(); + } + + private static JsonConverter? GetTypedJsonConverter(MemberInfo? memberInfo) + { + if (memberInfo == null) + return null; + + return memberInfo.GetCustomAttributes(inherit: true) + .OrderByDescending(attr => attr.IsDefaultAttribute()) + .Select(attr => + { + JsonConverter? converter = null; + + if (memberInfo is Type type) + { + converter = attr.CreateConverter(type); + } + else if (memberInfo is PropertyInfo propertyInfo) + { + converter = attr.CreateConverter(propertyInfo.PropertyType); + } + + if (converter == null && attr.ConverterType != null) + { + converter = (JsonConverter)Activator.CreateInstance(attr.ConverterType)!; + } + + return converter; + }) + .FirstOrDefault(converter => converter != null); } private static InnerTypedJsonProperty[] GetTypedJsonProperties(Type type) @@ -103,19 +217,31 @@ namespace System.Text.Json.Converters { typedJsonProperties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public) .Where(p => - (p.CanRead && !p.GetCustomAttributes(inherit: true).Any()) && - (p.CanWrite || p.GetCustomAttributes(inherit: true).Any()) - ) + { + if (p.CanWrite || p.GetCustomAttributes(inherit: true).Any()) + { + return !p.GetCustomAttributes(inherit: false).Any(); + } + + return false; + }) .Select(p => { string name = p.GetCustomAttribute(inherit: true)?.Name ?? p.Name; + if (name.Equals("modify_time_$n")) + { + var cs = p.GetCustomAttributes(inherit: true); + } + return new InnerTypedJsonProperty ( propertyName: name, propertyInfo: p, - isNArrayProperty: PROPERTY_NAME_NARRAY.Equals(name) && p.PropertyType.IsArray && p.PropertyType.GetElementType()!.IsClass + propertyIsNArray: PROPERTY_NAME_NARRAY.Equals(name) && p.PropertyType.IsArray && p.PropertyType.GetElementType()!.IsClass, + jsonConverter: GetTypedJsonConverter(p) ); }) + .OrderBy(e => e.PropertyInfo.GetCustomAttribute(inherit: true)?.Order) .ToArray(); _mappedTypeJsonProperties[mappedTypeKey] = typedJsonProperties; } @@ -123,6 +249,26 @@ namespace System.Text.Json.Converters return typedJsonProperties; } + private static bool CheckTypeIsSubclassOf(Type type, Type generic) + { + bool IsTheRawGenericType(Type test) + => generic == (test.IsGenericType ? test.GetGenericTypeDefinition() : test); + + bool isTheRawGenericType = type.GetInterfaces().Any(IsTheRawGenericType); + if (isTheRawGenericType) + return true; + + Type? tmp = type; + while (tmp != null && tmp != typeof(object)) + { + isTheRawGenericType = IsTheRawGenericType(tmp); + if (isTheRawGenericType) return true; + tmp = tmp.BaseType; + } + + return false; + } + private static bool TryMatchNArrayIndex(string key, out int index) { Regex regex = new Regex(@"(_)(\d+)", RegexOptions.Compiled); @@ -158,7 +304,7 @@ namespace System.Text.Json.Converters return src; } - private static object CreateOrUpdateNArrayElement(Array array, int index, string jKey, JsonElement jValue, JsonSerializerOptions? serializerOptions = null) + private static object CreateOrUpdateNArrayElement(Array array, int index, string jKey, JsonElement jValue, JsonSerializerOptions serializerOptions) { if (array == null) throw new ArgumentNullException(nameof(array)); if (index < 0) throw new ArgumentOutOfRangeException(nameof(index)); @@ -189,11 +335,10 @@ namespace System.Text.Json.Converters .SingleOrDefault(p => string.Equals(p.PropertyName.Replace(PROPERTY_WILDCARD_NARRAY_ELEMENT, index.ToString()), jKey)); if (typedJsonProperty != null) { - serializerOptions = (serializerOptions == null) ? new JsonSerializerOptions() : new JsonSerializerOptions(serializerOptions); - foreach (JsonConverterAttribute attribute in typedJsonProperty.PropertyInfo.GetCustomAttributes(inherit: true)) + if (typedJsonProperty.JsonConverter != null) { - JsonConverter converter = (JsonConverter)Activator.CreateInstance(attribute.ConverterType!); - serializerOptions.Converters.Add(converter!); + serializerOptions = new JsonSerializerOptions(serializerOptions); + serializerOptions.Converters.Add(typedJsonProperty.JsonConverter); } object? obj = JsonSerializer.Deserialize(jValue, typedJsonProperty.PropertyType, serializerOptions)!; diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Events/OrderEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Events/OrderEvent.cs new file mode 100644 index 00000000..e37dfaeb --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Events/OrderEvent.cs @@ -0,0 +1,213 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Events +{ + /// + /// 表示退款结果通知的模型。 + /// + [Newtonsoft.Json.JsonConverter(typeof(Converters.EventClassNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.EventClassSystemTextJsonConverter))] + public class OrderEvent : WechatTenpayEvent + { + public static new class Types + { + public class Coupon + { + /// + /// 获取或设置代金券 ID。 + /// + [Newtonsoft.Json.JsonProperty("coupon_id_$n")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_id_$n")] + public string CouponId { get; set; } = default!; + + /// + /// 获取或设置代金券类型。 + /// + [Newtonsoft.Json.JsonProperty("coupon_type_$n")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_type_$n")] + public string CouponType { get; set; } = default!; + + /// + /// 获取或设置代金券金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("coupon_fee_$n")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_fee_$n")] + public int CouponFee { get; set; } + } + } + + internal static class Converters + { + internal class EventClassNewtonsoftJsonConverter : Newtonsoft.Json.Converters.FlattenNArrayObjectConverterBase + { + } + + internal class EventClassSystemTextJsonConverter : System.Text.Json.Converters.FlattenNArrayObjectConverterBase + { + } + } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置终端设备号。 + /// + [Newtonsoft.Json.JsonProperty("device_info")] + [System.Text.Json.Serialization.JsonPropertyName("device_info")] + public string? DeviceInfo { get; set; } + + /// + /// 获取或设置用户唯一标识。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string OpenId { get; set; } = default!; + + /// + /// 获取或设置用户是否订阅该公众号标识。 + /// + [Newtonsoft.Json.JsonProperty("is_subscribe")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.YesOrNoNullableBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("is_subscribe")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.YesOrNoNullableBooleanConverter))] + public bool? IsSubscribed { get; set; } + + /// + /// 获取或设置用户在子商户下的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("sub_openid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_openid")] + public string? SubOpenId { get; set; } + + /// + /// 获取或设置交易状态。 + /// + [Newtonsoft.Json.JsonProperty("trade_state")] + [System.Text.Json.Serialization.JsonPropertyName("trade_state")] + public string TradeState { get; set; } = default!; + + /// + /// 获取或设置交易状态描述。 + /// + [Newtonsoft.Json.JsonProperty("trade_state_desc")] + [System.Text.Json.Serialization.JsonPropertyName("trade_state_desc")] + public string TradeStateDescription { get; set; } = default!; + + /// + /// 获取或设置交易类型。 + /// + [Newtonsoft.Json.JsonProperty("trade_type")] + [System.Text.Json.Serialization.JsonPropertyName("trade_type")] + public string TradeType { get; set; } = default!; + + /// + /// 获取或设置付款银行。 + /// + [Newtonsoft.Json.JsonProperty("bank_type")] + [System.Text.Json.Serialization.JsonPropertyName("bank_type")] + public string BankType { get; set; } = default!; + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置货币类型。 + /// + [Newtonsoft.Json.JsonProperty("fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("fee_type")] + public string? FeeType { get; set; } + + /// + /// 获取或设置应结订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("settlement_total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("settlement_total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? SettlementFee { get; set; } + + /// + /// 获取或设置代金券金额。 + /// + [Newtonsoft.Json.JsonProperty("coupon_fee")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CouponFee { get; set; } + + /// + /// 获取或设置代金券使用数量。 + /// + [Newtonsoft.Json.JsonProperty("coupon_count")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_count")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CouponCount { get; set; } + + /// + /// 获取或设置代金券使用列表。 + /// + [Newtonsoft.Json.JsonProperty(Newtonsoft.Json.Converters.FlattenNArrayObjectConverterBase.PROPERTY_NAME_NARRAY)] + [System.Text.Json.Serialization.JsonPropertyName(System.Text.Json.Converters.FlattenNArrayObjectConverterBase.PROPERTY_NAME_NARRAY)] + public Types.Coupon[]? CouponList { get; set; } + + /// + /// 获取或设置现金支付金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("cash_fee")] + [System.Text.Json.Serialization.JsonPropertyName("cash_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CashFee { get; set; } + + /// + /// 获取或设置现金支付货币类型。 + /// + [Newtonsoft.Json.JsonProperty("cash_fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("cash_fee_type")] + public string? CashFeeType { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = default!; + + /// + /// 获取或设置微信支付订单号。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string TransactionId { get; set; } = default!; + + /// + /// 获取或设置附加数据。 + /// + [Newtonsoft.Json.JsonProperty("attach")] + [System.Text.Json.Serialization.JsonPropertyName("attach")] + public string? Attachment { get; set; } + + /// + /// 获取或设置支付完成时间。 + /// + [Newtonsoft.Json.JsonProperty("time_end")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("time_end")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + public DateTimeOffset? EndTime { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Events/PAPContractEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Events/PAPContractEvent.cs new file mode 100644 index 00000000..7db49ba6 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Events/PAPContractEvent.cs @@ -0,0 +1,99 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Events +{ + /// + /// 表示扣款服务签约、解约结果通知的模型。 + /// + public class PAPContractEvent : WechatTenpayEvent + { + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置模板 ID。 + /// + [Newtonsoft.Json.JsonProperty("plan_id")] + [System.Text.Json.Serialization.JsonPropertyName("plan_id")] + public int PlanId { get; set; } + + /// + /// 获取或设置签约协议号。 + /// + [Newtonsoft.Json.JsonProperty("contract_code")] + [System.Text.Json.Serialization.JsonPropertyName("contract_code")] + public string ContractCode { get; set; } = default!; + + /// + /// 获取或设置委托代扣协议 ID。 + /// + [Newtonsoft.Json.JsonProperty("contract_id")] + [System.Text.Json.Serialization.JsonPropertyName("contract_id")] + public string ContractId { get; set; } = default!; + + /// + /// 获取或设置用户唯一标识。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string OpenId { get; set; } = default!; + + /// + /// 获取或设置用户在子商户下的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("sub_openid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_openid")] + public string? SubOpenId { get; set; } + + /// + /// 获取或设置变更类型。 + /// + [Newtonsoft.Json.JsonProperty("change_type")] + [System.Text.Json.Serialization.JsonPropertyName("change_type")] + public string ChangeType { get; set; } = default!; + + /// + /// 获取或设置请求序列号。 + /// + [Newtonsoft.Json.JsonProperty("request_serial")] + [System.Text.Json.Serialization.JsonPropertyName("request_serial")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public long RequestSerialNumber { get; set; } + + /// + /// 获取或设置协议解约方式。 + /// + [Newtonsoft.Json.JsonProperty("contract_termination_mode")] + [System.Text.Json.Serialization.JsonPropertyName("contract_termination_mode")] + public int? TerminationMode { get; set; } + + /// + /// 获取或设置操作时间。 + /// + [Newtonsoft.Json.JsonProperty("operate_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RegularDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("operate_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RegularDateTimeOffsetConverter))] + public DateTimeOffset OperateTime { get; set; } + + /// + /// 获取或设置协议到期时间。 + /// + [Newtonsoft.Json.JsonProperty("contract_expired_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RegularNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("contract_expired_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RegularNullableDateTimeOffsetConverter))] + public DateTimeOffset? ContractExpireTime { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Events/PAPOrderEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Events/PAPOrderEvent.cs new file mode 100644 index 00000000..12d9988b --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Events/PAPOrderEvent.cs @@ -0,0 +1,178 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Events +{ + /// + /// 表示扣款服务扣款结果通知的模型。 + /// + [Newtonsoft.Json.JsonConverter(typeof(Converters.EventClassNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.EventClassSystemTextJsonConverter))] + public class PAPOrderEvent : WechatTenpayEvent + { + public static new class Types + { + public class Coupon : OrderEvent.Types.Coupon + { + } + } + + internal static class Converters + { + internal class EventClassNewtonsoftJsonConverter : Newtonsoft.Json.Converters.FlattenNArrayObjectConverterBase + { + } + + internal class EventClassSystemTextJsonConverter : System.Text.Json.Converters.FlattenNArrayObjectConverterBase + { + } + } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置终端设备号。 + /// + [Newtonsoft.Json.JsonProperty("device_info")] + [System.Text.Json.Serialization.JsonPropertyName("device_info")] + public string? DeviceInfo { get; set; } + + /// + /// 获取或设置用户唯一标识。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string OpenId { get; set; } = default!; + + /// + /// 获取或设置用户是否订阅该公众号标识。 + /// + [Newtonsoft.Json.JsonProperty("is_subscribe")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.YesOrNoNullableBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("is_subscribe")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.YesOrNoNullableBooleanConverter))] + public bool? IsSubscribed { get; set; } + + /// + /// 获取或设置用户在子商户下的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("sub_openid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_openid")] + public string? SubOpenId { get; set; } + + /// + /// 获取或设置交易状态。 + /// + [Newtonsoft.Json.JsonProperty("trade_state")] + [System.Text.Json.Serialization.JsonPropertyName("trade_state")] + public string TradeState { get; set; } = default!; + + /// + /// 获取或设置付款银行。 + /// + [Newtonsoft.Json.JsonProperty("bank_type")] + [System.Text.Json.Serialization.JsonPropertyName("bank_type")] + public string BankType { get; set; } = default!; + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置货币类型。 + /// + [Newtonsoft.Json.JsonProperty("fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("fee_type")] + public string? FeeType { get; set; } + + /// + /// 获取或设置代金券金额。 + /// + [Newtonsoft.Json.JsonProperty("coupon_fee")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CouponFee { get; set; } + + /// + /// 获取或设置代金券使用数量。 + /// + [Newtonsoft.Json.JsonProperty("coupon_count")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_count")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CouponCount { get; set; } + + /// + /// 获取或设置代金券使用列表。 + /// + [Newtonsoft.Json.JsonProperty(Newtonsoft.Json.Converters.FlattenNArrayObjectConverterBase.PROPERTY_NAME_NARRAY)] + [System.Text.Json.Serialization.JsonPropertyName(System.Text.Json.Converters.FlattenNArrayObjectConverterBase.PROPERTY_NAME_NARRAY)] + public Types.Coupon[]? CouponList { get; set; } + + /// + /// 获取或设置现金支付金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("cash_fee")] + [System.Text.Json.Serialization.JsonPropertyName("cash_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CashFee { get; set; } + + /// + /// 获取或设置现金支付货币类型。 + /// + [Newtonsoft.Json.JsonProperty("cash_fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("cash_fee_type")] + public string? CashFeeType { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = default!; + + /// + /// 获取或设置微信支付订单号。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string TransactionId { get; set; } = default!; + + /// + /// 获取或设置附加数据。 + /// + [Newtonsoft.Json.JsonProperty("attach")] + [System.Text.Json.Serialization.JsonPropertyName("attach")] + public string? Attachment { get; set; } + + /// + /// 获取或设置支付完成时间。 + /// + [Newtonsoft.Json.JsonProperty("time_end")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("time_end")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + public DateTimeOffset? EndTime { get; set; } + + /// + /// 获取或设置委托代扣协议 ID。 + /// + [Newtonsoft.Json.JsonProperty("contract_id")] + [System.Text.Json.Serialization.JsonPropertyName("contract_id")] + public string ContractId { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Events/RefundEventRequestInfo.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Events/RefundEventRequestInfo.cs new file mode 100644 index 00000000..ecbc9746 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Events/RefundEventRequestInfo.cs @@ -0,0 +1,121 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Events +{ + /// + /// 表示退款结果通知的数据。 + /// + public class RefundEventRequestInfo : WechatTenpayEvent.Types.IDecryptedRequestInfo + { + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = default!; + + /// + /// 获取或设置微信支付订单号。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string TransactionId { get; set; } = default!; + + /// + /// 获取或设置out_refund_no。 + /// + [Newtonsoft.Json.JsonProperty("out_refund_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_refund_no")] + public string OutRefundNumber { get; set; } = default!; + + /// + /// 获取或设置微信退款单号。 + /// + [Newtonsoft.Json.JsonProperty("refund_id")] + [System.Text.Json.Serialization.JsonPropertyName("refund_id")] + public string RefundId { get; set; } = default!; + + /// + /// 获取或设置退款状态。 + /// + [Newtonsoft.Json.JsonProperty("refund_status")] + [System.Text.Json.Serialization.JsonPropertyName("refund_status")] + public string RefundStatus { get; set; } = default!; + + /// + /// 获取或设置退款资金来源。 + /// + [Newtonsoft.Json.JsonProperty("refund_account")] + [System.Text.Json.Serialization.JsonPropertyName("refund_account")] + public string? RefundAccount { get; set; } + + /// + /// 获取或设置退款入账账户。 + /// + [Newtonsoft.Json.JsonProperty("refund_recv_accout")] + [System.Text.Json.Serialization.JsonPropertyName("refund_recv_accout")] + public string? RefundReceiveAccount { get; set; } + + /// + /// 获取或设置退款发起来源。 + /// + [Newtonsoft.Json.JsonProperty("refund_request_source")] + [System.Text.Json.Serialization.JsonPropertyName("refund_request_source")] + public string? RefundRequestSource { get; set; } + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置退款金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("refund_fee")] + [System.Text.Json.Serialization.JsonPropertyName("refund_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int RefundFee { get; set; } + + /// + /// 获取或设置应结订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("settlement_total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("settlement_total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? SettlementTotalFee { get; set; } + + /// + /// 获取或设置应结退款金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("settlement_refund_fee")] + [System.Text.Json.Serialization.JsonPropertyName("settlement_refund_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? SettlementRefundFee { get; set; } + + /// + /// 获取或设置退款成功时间。 + /// + [Newtonsoft.Json.JsonProperty("success_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("success_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + public DateTimeOffset? SuccessTime { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Exceptions/WechatTenpayEventDecryptionException.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Exceptions/WechatTenpayEventDecryptionException.cs new file mode 100644 index 00000000..6873c7ab --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Exceptions/WechatTenpayEventDecryptionException.cs @@ -0,0 +1,24 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Exceptions +{ + public class WechatTenpayEventDecryptionException : WechatTenpayException + { + /// + internal WechatTenpayEventDecryptionException() + { + } + + /// + internal WechatTenpayEventDecryptionException(string message) + : base(message) + { + } + + /// + internal WechatTenpayEventDecryptionException(string message, Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Exceptions/WechatTenpayEventVerificationException.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Exceptions/WechatTenpayEventVerificationException.cs new file mode 100644 index 00000000..61d4f095 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Exceptions/WechatTenpayEventVerificationException.cs @@ -0,0 +1,24 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Exceptions +{ + public class WechatTenpayEventVerificationException : WechatTenpayException + { + /// + internal WechatTenpayEventVerificationException() + { + } + + /// + internal WechatTenpayEventVerificationException(string message) + : base(message) + { + } + + /// + internal WechatTenpayEventVerificationException(string message, Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Exceptions/WechatTenpayRequestSignatureException.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Exceptions/WechatTenpayRequestSignatureException.cs new file mode 100644 index 00000000..1112c128 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Exceptions/WechatTenpayRequestSignatureException.cs @@ -0,0 +1,24 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Exceptions +{ + public class WechatTenpayRequestSignatureException : WechatTenpayException + { + /// + internal WechatTenpayRequestSignatureException() + { + } + + /// + internal WechatTenpayRequestSignatureException(string message) + : base(message) + { + } + + /// + internal WechatTenpayRequestSignatureException(string message, Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientEventDecryptionExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientEventDecryptionExtensions.cs new file mode 100644 index 00000000..39e6a8e2 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientEventDecryptionExtensions.cs @@ -0,0 +1,58 @@ +using System; +using System.Text; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 +{ + /// + /// 为 提供回调通知事件敏感数据解密的扩展方法。 + /// + public static class WechatTenpayClientEventDecryptionExtensions + { + /// + /// 反序列化得到 对象。 + /// + /// + /// + /// + public static WechatTenpayEvent DeserializeEvent(this WechatTenpayClient client, string callbackXml) + { + if (client == null) throw new ArgumentNullException(nameof(client)); + if (string.IsNullOrEmpty(callbackXml)) throw new ArgumentNullException(callbackXml); + + string callbackJson = Utilities.XmlUtility.ConvertToJson(callbackXml); + return client.JsonSerializer.Deserialize(callbackJson); + } + + /// + /// 返回序列化并解密事件数据中被加密的信息。 + /// + /// + /// + /// + /// + public static T DecryptEventRequestInfo(this WechatTenpayClient client, WechatTenpayEvent callback) + where T : WechatTenpayEvent.Types.IDecryptedRequestInfo, new() + { + if (client == null) throw new ArgumentNullException(nameof(client)); + if (callback == null) throw new ArgumentNullException(nameof(callback)); + + string key = Utilities.MD5Utility.Hash(client.Credentials.MerchantSecret).ToLower(); + string plainJson; + + try + { + string plainXml = Utilities.AESUtility.DecryptWithECB( + encodingKey: Convert.ToBase64String(Encoding.UTF8.GetBytes(key)), + encodingCipherText: callback.EncryptedRequestInfo + ); + plainJson = Utilities.XmlUtility.ConvertToJson(plainXml); + } + catch (Exception ex) + { + throw new Exceptions.WechatTenpayEventDecryptionException("Decrypt event resource failed. Please see the `InnerException` for more details.", ex); + } + + return client.JsonSerializer.Deserialize(plainJson); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientEventVerificationExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientEventVerificationExtensions.cs new file mode 100644 index 00000000..b9479dfa --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientEventVerificationExtensions.cs @@ -0,0 +1,63 @@ +using System; +using System.Linq; +using System.Xml; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 +{ + /// + /// 为 提供回调通知事件签名验证的扩展方法。 + /// + public static class WechatTenpayClientEventVerificationExtensions + { + /// + /// 验证回调通知事件签名。 + /// + /// + /// 微信回调通知中请求正文。 + /// + /// + public static bool VerifyEventSignature(this WechatTenpayClient client, string callbackBody) + { + return VerifyEventSignature(client, callbackBody, out _); + } + + /// + /// 验证回调通知事件签名。 + /// + /// + /// 微信回调通知中请求正文。 + /// + /// + /// + public static bool VerifyEventSignature(this WechatTenpayClient client, string callbackBody, out Exception? error) + { + if (client == null) throw new ArgumentNullException(nameof(client)); + if (callbackBody == null) throw new ArgumentNullException(nameof(callbackBody)); + + try + { + + XmlDocument xmlDocument = new XmlDocument(); + xmlDocument.LoadXml(callbackBody); + + XmlNode xmlNode = xmlDocument.ChildNodes.OfType().Single(); + string? signType = xmlNode["sign_type"]?.InnerText; + string? expectedSign = xmlNode["sign"]?.InnerText; + xmlNode["sign"]?.RemoveAll(); + + string xml = xmlDocument.InnerXml; + string json = Utilities.XmlUtility.ConvertToJson(xml); + string signData = Utilities.JsonUtility.ParseToSortedQueryString(json); + string actualSign = Utilities.RequestSigner.SignFromSortedQueryString(signData, client.Credentials.MerchantSecret, signType); + + error = null; + return string.Equals(expectedSign, actualSign, StringComparison.OrdinalIgnoreCase); + } + catch (Exception ex) + { + error = new Exceptions.WechatTenpayEventVerificationException("Verify signature of event failed. Please see the `InnerException` for more details.", ex); + return false; + } + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteDepositExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteDepositExtensions.cs new file mode 100644 index 00000000..d84889ae --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteDepositExtensions.cs @@ -0,0 +1,164 @@ +using System; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 +{ + public static class WechatTenpayClientExecuteDepositExtensions + { + /// + /// 异步调用 [POST] /deposit/unifiedorder 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/deposit_sl.php?chapter=27_7&index=1 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/deposit_sl.php?chapter=27_8&index=3 + /// + /// + /// + /// + /// + public static async Task ExecuteCreateDepositUnifiedOrderAsync(this WechatTenpayClient client, Models.CreateDepositUnifiedOrderRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "deposit", "unifiedorder"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /deposit/micropay 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/deposit_sl.php?chapter=27_1&index=6 + /// + /// + /// + /// + /// + public static async Task ExecuteCreateDepositMicroPayAsync(this WechatTenpayClient client, Models.CreateDepositMicroPayRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "deposit", "micropay"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /deposit/facepay 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/deposit_sl.php?chapter=27_0&index=5 + /// + /// + /// + /// + /// + public static async Task ExecuteCreateDepositFacePayAsync(this WechatTenpayClient client, Models.CreateDepositFacePayRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "deposit", "facepay"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /deposit/orderquery 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/deposit_sl.php?chapter=27_2&index=7 + /// + /// + /// + /// + /// + public static async Task ExecuteGetDepositOrderAsync(this WechatTenpayClient client, Models.GetDepositOrderRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "deposit", "orderquery"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /deposit/reverse 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/deposit_sl.php?chapter=27_3&index=8 + /// + /// + /// + /// + /// + public static async Task ExecuteReverseDepositOrderAsync(this WechatTenpayClient client, Models.ReverseDepositOrderRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "deposit", "reverse"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /deposit/consume 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/deposit_sl.php?chapter=27_4&index=9 + /// + /// + /// + /// + /// + public static async Task ExecuteConsumeDepositAsync(this WechatTenpayClient client, Models.ConsumeDepositRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "deposit", "consume"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /deposit/refund 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/deposit_sl.php?chapter=27_5&index=10 + /// + /// + /// + /// + /// + public static async Task ExecuteCreateDepositRefundAsync(this WechatTenpayClient client, Models.CreateDepositRefundRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "deposit", "refund"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /deposit/refundquery 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/deposit_sl.php?chapter=27_6&index=11 + /// + /// + /// + /// + /// + public static async Task ExecuteGetDepositRefundAsync(this WechatTenpayClient client, Models.GetDepositRefundRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "deposit", "refundquery"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteFraudExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteFraudExtensions.cs new file mode 100644 index 00000000..dfb387f6 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteFraudExtensions.cs @@ -0,0 +1,32 @@ +using System; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Flurl; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 +{ + public static class WechatTenpayClientExecuteFraudExtensions + { + /// + /// 异步调用 [POST] /risk/getpublickey 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay_yhk.php?chapter=24_7&index=4 + /// + /// + /// + /// + /// + public static async Task ExecuteGetRiskPublicKeyAsync(this WechatTenpayClient client, Models.GetRiskPublicKeyRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "risk", "getpublickey"); + flurlReq.Url = Url.Parse("https://fraud.mch.weixin.qq.com/risk/getpublickey"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePAPExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePAPExtensions.cs new file mode 100644 index 00000000..ec1c5aca --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePAPExtensions.cs @@ -0,0 +1,132 @@ +using System; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 +{ + public static class WechatTenpayClientExecutePAPExtensions + { + /// + /// 异步调用 [POST] /papay/preentrustweb 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_2.shtml + /// + /// + /// + /// + /// + public static async Task ExecuteCreatePAPPayPreEntrustWebAsync(this WechatTenpayClient client, Models.CreatePAPPayPreEntrustWebRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (request.Timestamp == null) + request.Timestamp = DateTimeOffset.Now.ToLocalTime().ToUnixTimeSeconds(); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "papay", "preentrustweb"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /papay/h5entrustweb 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_4.shtml + /// + /// + /// + /// + /// + public static async Task ExecuteCreatePAPPayH5EntrustWebAsync(this WechatTenpayClient client, Models.CreatePAPPayH5EntrustWebRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (request.Timestamp == null) + request.Timestamp = DateTimeOffset.Now.ToLocalTime().ToUnixTimeSeconds(); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Get, "papay", "h5entrustweb"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /pay/contractorder 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_5.shtml + /// + /// + /// + /// + /// + public static async Task ExecuteCreateContractOrderAsync(this WechatTenpayClient client, Models.CreateContractOrderRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "pay", "contractorder"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /pay/pappayapply 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_8.shtml + /// + /// + /// + /// + /// + public static async Task ExecuteApplyPAPPayAsync(this WechatTenpayClient client, Models.ApplyPAPPayRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "pay", "pappayapply"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /papay/deletecontract 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_9.shtml + /// REF" https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter5_9.shtml + /// + /// + /// + /// + /// + public static async Task ExecuteDeletePAPPayContractAsync(this WechatTenpayClient client, Models.DeletePAPPayContractRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "papay", "deletecontract"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /papay/querycontract 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_7.shtml + /// + /// + /// + /// + /// + public static async Task ExecuteGetPAPPayContractAsync(this WechatTenpayClient client, Models.GetPAPPayContractRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "papay", "querycontract"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePAPPartnerExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePAPPartnerExtensions.cs new file mode 100644 index 00000000..6637c70d --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePAPPartnerExtensions.cs @@ -0,0 +1,114 @@ +using System; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 +{ + public static class WechatTenpayClientExecutePAPPartnerExtensions + { + /// + /// 异步调用 [POST] /papay/partner/preentrustweb 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter5_2.shtml + /// + /// + /// + /// + /// + public static async Task ExecuteCreatePAPPayPartnerPreEntrustWebAsync(this WechatTenpayClient client, Models.CreatePAPPayPartnerPreEntrustWebRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (request.Timestamp == null) + request.Timestamp = DateTimeOffset.Now.ToLocalTime().ToUnixTimeSeconds(); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "papay", "partner", "preentrustweb"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [GET] /papay/partner/h5entrustweb 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter5_4.shtml + /// + /// + /// + /// + /// + public static async Task ExecuteCreatePAPPayPartnerH5EntrustWebAsync(this WechatTenpayClient client, Models.CreatePAPPayPartnerH5EntrustWebRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (request.Timestamp == null) + request.Timestamp = DateTimeOffset.Now.ToLocalTime().ToUnixTimeSeconds(); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Get, "papay", "partner", "h5entrustweb") + .SetQueryParam("appid", request.AppId) + .SetQueryParam("mch_id", request.MerchantId) + .SetQueryParam("sub_appid", request.SubAppId) + .SetQueryParam("sub_mch_id", request.SubMerchantId) + .SetQueryParam("plan_id", request.PlanId) + .SetQueryParam("contract_code", request.ContractCode) + .SetQueryParam("request_serial", request.RequestSerialNumber) + .SetQueryParam("contract_display_account", request.ContractDisplayAccount) + .SetQueryParam("notify_url", request.NotifyUrl) + .SetQueryParam("version", request.Version) + .SetQueryParam("sign", request.Signature) + .SetQueryParam("timestamp", request.Timestamp) + .SetQueryParam("clientip", request.ClientIp) + .SetQueryParam("deviceid", request.DeviceId) + .SetQueryParam("mobile", request.UserMobile) + .SetQueryParam("email", request.UserEmail) + .SetQueryParam("qq", request.UserQQ) + .SetQueryParam("openid", request.OpenId) + .SetQueryParam("creid", request.IDCardNumber) + .SetQueryParam("outerid", request.OuterId) + .SetQueryParam("return_appid", request.ReturnAppId); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /pay/partner/pappayapply 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter5_8.shtml + /// + /// + /// + /// + /// + public static async Task ExecuteApplyPAPPayPartnerAsync(this WechatTenpayClient client, Models.ApplyPAPPayPartnerRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "pay", "partner", "pappayapply"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /papay/partner/querycontract 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter5_7.shtml + /// + /// + /// + /// + /// + public static async Task ExecuteGetPAPPayPartnerContractAsync(this WechatTenpayClient client, Models.GetPAPPayPartnerContractRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "papay", "partner", "querycontract"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePayExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePayExtensions.cs index 77385b95..382b0c04 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePayExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePayExtensions.cs @@ -8,6 +8,34 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 { public static class WechatTenpayClientExecutePayExtensions { + /// + /// 异步调用 [POST] /pay/unifiedorder 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/jsapi_sl.php?chapter=9_1 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=9_1 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_1&index=1 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/H5.php?chapter=9_1&index=1 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_1 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/jsapi_sl.php?chapter=9_1 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/native_sl.php?chapter=9_1 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app_sl.php?chapter=9_1&index=1 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/H5_sl.php?chapter=9_1&index=1 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_sl_api.php?chapter=9_1 + /// + /// + /// + /// + /// + public static async Task ExecuteCreatePayUnifiedOrderAsync(this WechatTenpayClient client, Models.CreatePayUnifiedOrderRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "pay", "unifiedorder"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + /// /// 异步调用 [POST] /pay/micropay 接口。 /// REF: https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_10&index=1 @@ -28,5 +56,202 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); } + + /// + /// 异步调用 [POST] /pay/orderquery 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_02 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_2 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=9_2 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_2&index=4 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/H5.php?chapter=9_2&index=2 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_2 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/micropay_sl.php?chapter=9_02 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/jsapi_sl.php?chapter=9_2 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/native_sl.php?chapter=9_2 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app_sl.php?chapter=9_2&index=4 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/H5_sl.php?chapter=9_2&index=2 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_sl_api.php?chapter=9_2 + /// + /// + /// + /// + /// + public static async Task ExecuteGetPayOrderAsync(this WechatTenpayClient client, Models.GetPayOrderRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "pay", "orderquery"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /secapi/pay/reverse 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/micropay_sl.php?chapter=9_11&index=3 + /// + /// + /// + /// + /// + public static async Task ExecuteReversePayOrderAsync(this WechatTenpayClient client, Models.ReversePayOrderRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "secapi", "pay", "reverse"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /pay/closeorder 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_3 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=9_3 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_3&index=5 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/H5.php?chapter=9_3&index=3 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_3 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/jsapi_sl.php?chapter=9_3 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/native_sl.php?chapter=9_3 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app_sl.php?chapter=9_3&index=5 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/H5_sl.php?chapter=9_3&index=3 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_sl_api.php?chapter=9_3 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter4_6.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter5_17.shtml + /// + /// + /// + /// + /// + public static async Task ExecuteClosePayOrderAsync(this WechatTenpayClient client, Models.ClosePayOrderRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "pay", "closeorder"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /secapi/pay/refund 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_4 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=9_4 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_4&index=6 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/H5.php?chapter=9_4&index=4 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_4 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/jsapi_sl.php?chapter=9_4 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/native_sl.php?chapter=9_4 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app_sl.php?chapter=9_4&index=6 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/H5_sl.php?chapter=9_4&index=4 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_sl_api.php?chapter=9_4 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter4_3.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter5_13.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/vehicle_v2_sl.php?chapter=9_4&index=5&p=202 + /// + /// + /// + /// + /// + public static async Task ExecuteCreatePayRefundAsync(this WechatTenpayClient client, Models.CreatePayRefundRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "secapi", "pay", "refund"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /pay/refundquery 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_5 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=9_5 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_5&index=7 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/H5.php?chapter=9_5&index=5 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_5 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/jsapi_sl.php?chapter=9_5 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/native_sl.php?chapter=9_5 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app_sl.php?chapter=9_5&index=7 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/H5_sl.php?chapter=9_5&index=5 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_sl_api.php?chapter=9_5 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter4_4.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter5_14.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/vehicle_v2_sl.php?chapter=9_5&index=6&p=202 + /// + /// + /// + /// + /// + public static async Task ExecuteGetPayRefundAsync(this WechatTenpayClient client, Models.GetPayRefundRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "pay", "refundquery"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /pay/downloadbill 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_6 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_6 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=9_6 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_6&index=8 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/H5.php?chapter=9_6&index=6 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_6 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/jsapi_sl.php?chapter=9_6 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/native_sl.php?chapter=9_6 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app_sl.php?chapter=9_6&index=8 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/H5_sl.php?chapter=9_6&index=6 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_sl_api.php?chapter=9_6 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter4_1.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter5_11.shtml + /// REF: https://pay.weixin.qq.com/wiki/doc/api/vehicle_v2_sl.php?chapter=9_6&index=3&p=202 + /// + /// + /// + /// + /// + public static async Task ExecuteDownloadPayBillAsync(this WechatTenpayClient client, Models.DownloadPayBillRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "pay", "downloadbill"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /pay/downloadfundflow 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_18&index=7 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_18&index=7 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=9_18&index=7 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_18&index=9 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/H5.php?chapter=9_18&index=7 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_18&index=7 + /// + /// + /// + /// + /// + public static async Task ExecuteDownloadPayFundFlowAsync(this WechatTenpayClient client, Models.DownloadPayFundFlowRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "pay", "downloadfundflow"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePayITILExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePayITILExtensions.cs index 693f6696..9814e929 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePayITILExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePayITILExtensions.cs @@ -11,6 +11,17 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 /// /// 异步调用 [POST] /payitil/report 接口。 /// REF: https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_14&index=8 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_8&index=9 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=9_8&index=9 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_8&index=10 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/H5.php?chapter=9_8&index=9 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_8&index=9 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/micropay_sl.php?chapter=9_14&index=7 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/jsapi_sl.php?chapter=9_8 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/native_sl.php?chapter=9_8 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app_sl.php?chapter=9_8&index=10 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/H5_sl.php?chapter=9_8&index=9 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_sl_api.php?chapter=9_8&index=9 /// /// /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePayMarketingTransfersRedPackExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePayMarketingTransfersRedPackExtensions.cs new file mode 100644 index 00000000..541137b2 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePayMarketingTransfersRedPackExtensions.cs @@ -0,0 +1,93 @@ +using System; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 +{ + public static class WechatTenpayClientExecutePayMarketingTransfersRedPackExtensions + { + /// + /// 异步调用 [POST] /mmpaymkttransfers/sendredpack 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_4&index=3 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon_sl.php?chapter=13_4&index=3 + /// + /// + /// + /// + /// + public static async Task ExecuteSendPayMarketingTransfersRedPackAsync(this WechatTenpayClient client, Models.SendPayMarketingTransfersRedPackRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "mmpaymkttransfers", "sendredpack"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /mmpaymkttransfers/sendgroupredpack 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_5&index=4 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon_sl.php?chapter=13_5&index=4 + /// + /// + /// + /// + /// + public static async Task ExecuteSendPayMarketingTransfersGroupRedPackAsync(this WechatTenpayClient client, Models.SendPayMarketingTransfersGroupRedPackRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "mmpaymkttransfers", "sendgroupredpack"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /mmpaymkttransfers/sendminiprogramhb 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon_xcx.php?chapter=18_2&index=3 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon_sl.php?chapter=18_2&index=3 + /// + /// + /// + /// + /// + public static async Task ExecuteSendPayMarketingTransfersMiniProgramRedPackAsync(this WechatTenpayClient client, Models.SendPayMarketingTransfersMiniProgramRedPackRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "mmpaymkttransfers", "sendminiprogramhb"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /mmpaymkttransfers/gethbinfo 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_6&index=5 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon_xcx.php?chapter=18_6&index=5 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon_sl.php?chapter=13_6&index=5 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon_sl.php?chapter=18_6&index=5 + /// + /// + /// + /// + /// + public static async Task ExecuteGetPayMarketingTransfersRedPackInfoAsync(this WechatTenpayClient client, Models.GetPayMarketingTransfersRedPackInfoRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "mmpaymkttransfers", "gethbinfo"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePayMarketingTransfersTransferExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePayMarketingTransfersTransferExtensions.cs new file mode 100644 index 00000000..cb819ad1 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePayMarketingTransfersTransferExtensions.cs @@ -0,0 +1,49 @@ +using System; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 +{ + public static class WechatTenpayClientExecutePayMarketingTransfersTransferExtensions + { + /// + /// 异步调用 [POST] /mmpaymkttransfers/promotion/transfers 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_2 + /// + /// + /// + /// + /// + public static async Task ExecuteCreatePayMarketingTransfersPromotionTransferAsync(this WechatTenpayClient client, Models.CreatePayMarketingTransfersPromotionTransferRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "mmpaymkttransfers", "promotion", "transfers"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /mmpaymkttransfers/gettransferinfo 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_3 + /// + /// + /// + /// + /// + public static async Task ExecuteGetPayMarketingTransfersTransferInfoAsync(this WechatTenpayClient client, Models.GetPayMarketingTransfersTransferInfoRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "mmpaymkttransfers", "gettransferinfo"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePayServicePartnerTransfersExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePayServicePartnerTransfersExtensions.cs new file mode 100644 index 00000000..4bbdab0f --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecutePayServicePartnerTransfersExtensions.cs @@ -0,0 +1,49 @@ +using System; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 +{ + public static class WechatTenpayClientExecutePayServicePartnerTransfersExtensions + { + /// + /// 异步调用 [POST] /mmpaysptrans/pay_bank 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay_yhk.php?chapter=24_2 + /// + /// + /// + /// + /// + public static async Task ExecuteCreatePayServicePartnerTransfersPayToBankAsync(this WechatTenpayClient client, Models.CreatePayServicePartnerTransfersPayToBankRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "mmpaysptrans", "pay_bank"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /mmpaysptrans/query_bank 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay_yhk.php?chapter=24_3 + /// + /// + /// + /// + /// + public static async Task ExecuteGetPayServicePartnerTransfersPayToBankInfoAsync(this WechatTenpayClient client, Models.GetPayServicePartnerTransfersPayToBankInfoRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "mmpaysptrans", "query_bank"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteRiskExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteRiskExtensions.cs new file mode 100644 index 00000000..54c46bf2 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteRiskExtensions.cs @@ -0,0 +1,30 @@ +using System; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 +{ + public static class WechatTenpayClientExecuteRiskExtensions + { + /// + /// 异步调用 [POST] /risk/getviolation 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/mch_bank.php?chapter=9_28&index=1&p=902 + /// + /// + /// + /// + /// + public static async Task ExecuteQueryRiskViolationAsync(this WechatTenpayClient client, Models.QueryRiskViolationRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "risk", "getviolation"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteSubMerchantExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteSubMerchantExtensions.cs new file mode 100644 index 00000000..c8dc2034 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteSubMerchantExtensions.cs @@ -0,0 +1,50 @@ +using System; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 +{ + public static class WechatTenpayClientExecuteSubMerchantExtensions + { + /// + /// 异步调用 [POST] /secapi/mch/addsubdevconfig 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/mch_bank.php?chapter=9_24_2&index=1&p=901 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/mch_bank.php?chapter=9_24_3&index=2&p=901 + /// + /// + /// + /// + /// + public static async Task ExecuteAddSubMerchantDevelopConfigAsync(this WechatTenpayClient client, Models.AddSubMerchantDevelopConfigRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "secapi", "mch", "addsubdevconfig"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /secapi/mch/querysubdevconfig 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/mch_bank.php?chapter=9_25&index=3&p=901 + /// + /// + /// + /// + /// + public static async Task ExecuteGetSubMerchantDevelopConfigAsync(this WechatTenpayClient client, Models.GetSubMerchantDevelopConfigRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "secapi", "mch", "querysubdevconfig"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteToolsExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteToolsExtensions.cs index c89f4877..6e0e6a77 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteToolsExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteToolsExtensions.cs @@ -27,5 +27,25 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); } + + /// + /// 异步调用 [POST] /tools/shorturl 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=9_9&index=10 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/native_sl.php?chapter=9_9 + /// + /// + /// + /// + /// + public static async Task ExecuteToolsShortUrlAsync(this WechatTenpayClient client, Models.ToolsShortUrlRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "tools", "shorturl"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteVehiclePartnerExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteVehiclePartnerExtensions.cs new file mode 100644 index 00000000..35b6fc97 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteVehiclePartnerExtensions.cs @@ -0,0 +1,68 @@ +using System; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 +{ + public static class WechatTenpayClientExecuteVehiclePartnerExtensions + { + /// + /// 异步调用 [POST] /vehicle/partnerpay/notification 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/vehicle_v2_sl.php?chapter=20_992&index=1&p=202 + /// + /// + /// + /// + /// + public static async Task ExecuteNotifyVehiclePartnerPayAsync(this WechatTenpayClient client, Models.NotifyVehiclePartnerPayRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "vehicle", "partnerpay", "notification"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /vehicle/partnerpay/payapply 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/vehicle_v2_sl.php?chapter=20_982&index=2&p=202 + /// + /// + /// + /// + /// + public static async Task ExecuteApplyVehiclePartnerPayAsync(this WechatTenpayClient client, Models.ApplyVehiclePartnerPayRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "vehicle", "partnerpay", "payapply"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /vehicle/partnerpay/querystate 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/vehicle_v2_sl.php?chapter=20_93&index=9&p=202 + /// + /// + /// + /// + /// + public static async Task ExecuteGetVehiclePartnerPayStateAsync(this WechatTenpayClient client, Models.GetVehiclePartnerPayStateRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "vehicle", "partnerpay", "querystate"); + + return await client.SendRequestWithXmlAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientParameterExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientParameterExtensions.cs new file mode 100644 index 00000000..b605ccb8 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientParameterExtensions.cs @@ -0,0 +1,472 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Web; +using Flurl; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 +{ + /// + /// 为 提供调起支付签名的扩展方法。 + /// + public static class WechatTenpayClientParameterExtensions + { + private const string BASE_URL = "https://api.mch.weixin.qq.com"; + + /// + /// 生成客户端小程序调起领取红包所需的参数字典。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon_xcx.php?chapter=18_3&index=4 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon_sl.php?chapter=18_3&index=4 + /// + /// + /// + /// + public static IDictionary GenerateParametersForJsapiSendBusinessRedPack(this WechatTenpayClient client, string packageString) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (packageString is null) throw new ArgumentNullException(nameof(packageString)); + + string timestamp = DateTimeOffset.Now.ToLocalTime().ToUnixTimeSeconds().ToString(); + string nonce = Guid.NewGuid().ToString("N"); + string signType = Constants.SignTypes.MD5; + string signData = $"timeStamp={timestamp}&nonceStr={nonce}&package={packageString}&signType={signType}"; + string sign = Utilities.RequestSigner.SignFromSortedQueryString(signData, client.Credentials.MerchantSecret, signType); + + return new ReadOnlyDictionary(new Dictionary() + { + { "timeStamp", timestamp }, + { "nonceStr", nonce }, + { "package", HttpUtility.UrlEncode(packageString) }, + { "signType", signType }, + { "paySign", sign } + }); + } + + /// + /// 生成客户端 JSAPI 调起支付所需的参数字典。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_7&index=6 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/jsapi_sl.php?chapter=7_7&index=6 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/deposit_sl.php?chapter=7_7&index=2&p=27 + /// + /// + /// + /// + /// + /// + public static IDictionary GenerateParametersForJsapiGetBrandPayRequest(this WechatTenpayClient client, string appId, string prepayId, string? signType) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (prepayId is null) throw new ArgumentNullException(nameof(prepayId)); + + signType = signType ?? Constants.SignTypes.MD5; + + string timestamp = DateTimeOffset.Now.ToLocalTime().ToUnixTimeSeconds().ToString(); + string nonce = Guid.NewGuid().ToString("N"); + string package = $"prepay_id={prepayId}"; + string signData = $"appId={appId}&timeStamp={timestamp}&nonceStr={nonce}&package={package}&signType={signType}"; + string sign = Utilities.RequestSigner.SignFromSortedQueryString(signData, client.Credentials.MerchantSecret, signType); + + return new ReadOnlyDictionary(new Dictionary() + { + { "appId", appId }, + { "timeStamp", timestamp }, + { "nonceStr", nonce }, + { "package", package }, + { "signType", signType }, + { "paySign", sign } + }); + } + + /// + /// 生成客户端 App 调起支付所需的参数字典。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_12&index=2 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app_sl.php?chapter=9_12&index=2 + /// + /// + /// + /// + /// + /// + /// + public static IDictionary GenerateParametersForAppGetBrandPayRequest(this WechatTenpayClient client, string merchantId, string appId, string prepayId, string? signType) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (prepayId is null) throw new ArgumentNullException(nameof(prepayId)); + + signType = signType ?? Constants.SignTypes.MD5; + + string timestamp = DateTimeOffset.Now.ToLocalTime().ToUnixTimeSeconds().ToString(); + string nonce = Guid.NewGuid().ToString("N"); + string partnerId = merchantId; + string package = "Sign=WXPay"; + string signData = $"appid={appId}×tamp={timestamp}&noncestr={nonce}&package={package}&partnerid={partnerId}&prepayid={prepayId}&signType={signType}"; + string sign = Utilities.RequestSigner.SignFromSortedQueryString(signData, client.Credentials.MerchantSecret, signType); + + return new ReadOnlyDictionary(new Dictionary() + { + { "appid", appId }, + { "partnerid", partnerId }, + { "prepayid", prepayId }, + { "package", package }, + { "noncestr", nonce }, + { "timestamp", timestamp }, + { "sign", sign } + }); + } + + /// + /// 生成客户端 App 调起支付所需的参数字典。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_12&index=2 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app_sl.php?chapter=9_12&index=2 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/deposit_sl.php?chapter=27_9&index=4 + /// + /// + /// + /// + /// + /// + public static IDictionary GenerateParametersForAppGetBrandPayRequest(this WechatTenpayClient client, string appId, string prepayId, string? signType) + { + return GenerateParametersForAppGetBrandPayRequest(client, merchantId: client.Credentials.MerchantId, appId: appId, prepayId: prepayId, signType: signType); + } + + /// + /// 生成客户端小程序调起支付所需的参数字典。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_7&index=5 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_sl_api.php?chapter=7_7&index=5 + /// + /// + /// + /// + /// + /// + public static IDictionary GenerateParametersForMiniProgramRequestPayment(this WechatTenpayClient client, string appId, string prepayId, string? signType) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (prepayId is null) throw new ArgumentNullException(nameof(prepayId)); + + signType = signType ?? Constants.SignTypes.MD5; + + string timestamp = DateTimeOffset.Now.ToLocalTime().ToUnixTimeSeconds().ToString(); + string nonce = Guid.NewGuid().ToString("N"); + string package = $"prepay_id={prepayId}"; + string signData = $"appId={appId}&timeStamp={timestamp}&nonceStr={nonce}&package={package}&signType={signType}"; + string sign = Utilities.RequestSigner.SignFromSortedQueryString(signData, client.Credentials.MerchantSecret, signType); + + return new ReadOnlyDictionary(new Dictionary() + { + { "timeStamp", timestamp }, + { "nonceStr", nonce }, + { "package", package }, + { "signType", signType }, + { "paySign", sign } + }); + } + + /// + /// 生成客户端公众号唤起微信委托代扣的 URL。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_1.shtml + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static string GenerateParameterizedUrlForMediaPlatformPAPPayEntrustWeb(this WechatTenpayClient client, string appId, int planId, string contractCode, long requestSerialNumber, string contractDisplayAccount, string notifyUrl, bool? requireReturnWeb) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + + string version = "1.0"; + string timestamp = DateTimeOffset.Now.ToLocalTime().ToUnixTimeSeconds().ToString(); + IDictionary paramsMap = new Dictionary() + { + { "appid", appId }, + { "mch_id", client.Credentials.MerchantId }, + { "plan_id", planId.ToString() }, + { "contract_code", contractCode }, + { "request_serial", requestSerialNumber.ToString() }, + { "contract_display_account", contractDisplayAccount }, + { "notify_url", notifyUrl }, + { "version", version }, + { "timestamp", timestamp }, + { "return_web", requireReturnWeb.HasValue ? requireReturnWeb.Value ? "1" : "0" : null } + }; + string sign = Utilities.RequestSigner.Sign(paramsMap, client.Credentials.MerchantSecret, Constants.SignTypes.MD5); + + return new Url(BASE_URL) + .AppendPathSegments("papay", "entrustweb") + .SetQueryParams(paramsMap) + .SetQueryParam("sign", sign) + .ToString(); + } + + /// + /// 生成客户端公众号唤起微信委托代扣的 URL。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter5_1.shtml + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static string GenerateParameterizedUrlForMediaPlatformPAPPayPartnerEntrustWeb(this WechatTenpayClient client, string appId, string subMerchantId, string? subAppId, int planId, string contractCode, long requestSerialNumber, string contractDisplayAccount, string notifyUrl, bool? requireReturnWeb) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + + string version = "1.0"; + string timestamp = DateTimeOffset.Now.ToLocalTime().ToUnixTimeSeconds().ToString(); + IDictionary paramsMap = new Dictionary() + { + { "appid", appId }, + { "mch_id", client.Credentials.MerchantId }, + { "sub_appid", subAppId }, + { "sub_mch_id", subMerchantId }, + { "plan_id", planId.ToString() }, + { "contract_code", contractCode }, + { "request_serial", requestSerialNumber.ToString() }, + { "contract_display_account", contractDisplayAccount }, + { "notify_url", notifyUrl }, + { "version", version }, + { "timestamp", timestamp }, + { "return_web", requireReturnWeb.HasValue ? requireReturnWeb.Value ? "1" : "0" : null } + }; + string sign = Utilities.RequestSigner.Sign(paramsMap, client.Credentials.MerchantSecret, Constants.SignTypes.MD5); + + return new Url(BASE_URL) + .AppendPathSegments("papay", "partner", "entrustweb") + .SetQueryParams(paramsMap) + .SetQueryParam("sign", sign) + .ToString(); + } + + /// + /// 生成客户端小程序唤起微信委托代扣页面所需的参数字典。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_3.shtml + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static IDictionary GenerateParametersForMiniProgramPAPPayEntrust(this WechatTenpayClient client, string appId, int planId, string contractCode, long requestSerialNumber, string contractDisplayAccount, string notifyUrl, string? outerId) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + + string timestamp = DateTimeOffset.Now.ToLocalTime().ToUnixTimeSeconds().ToString(); + IDictionary paramsMap = new Dictionary() + { + { "appid", appId }, + { "mch_id", client.Credentials.MerchantId }, + { "plan_id", planId.ToString() }, + { "contract_code", contractCode }, + { "request_serial", requestSerialNumber.ToString() }, + { "contract_display_account", contractDisplayAccount }, + { "notify_url", notifyUrl }, + { "timestamp", timestamp }, + { "outerid", outerId } + }; + paramsMap["sign"] = Utilities.RequestSigner.Sign(paramsMap, client.Credentials.MerchantSecret, Constants.SignTypes.MD5); + + return new ReadOnlyDictionary(paramsMap!); + } + + /// + /// 生成客户端小程序唤起微信委托代扣页面所需的参数字典。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter5_3.shtml + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static IDictionary GenerateParametersForMiniProgramPAPPayEntrust(this WechatTenpayClient client, string appId, string subMerchantId, string? subAppId, int planId, string contractCode, long requestSerialNumber, string contractDisplayAccount, string notifyUrl, string clientIp, string? deviceId, string? userMobile, string? userEmail, string? userQQ, string? openId, string? idCardNumber, string? outerId) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + + string timestamp = DateTimeOffset.Now.ToLocalTime().ToUnixTimeSeconds().ToString(); + IDictionary paramsMap = new Dictionary() + { + { "appid", appId }, + { "mch_id", client.Credentials.MerchantId }, + { "sub_appid", subAppId }, + { "sub_mch_id", subMerchantId }, + { "plan_id", planId.ToString() }, + { "contract_code", contractCode }, + { "request_serial", requestSerialNumber.ToString() }, + { "contract_display_account", contractDisplayAccount }, + { "notify_url", notifyUrl }, + { "timestamp", timestamp }, + { "clientip", clientIp }, + { "deviceid", deviceId }, + { "mobile", userMobile }, + { "email", userEmail }, + { "qq", userQQ }, + { "openid", openId }, + { "creid", idCardNumber }, + { "outerid", outerId } + }; + paramsMap["sign"] = Utilities.RequestSigner.Sign(paramsMap, client.Credentials.MerchantSecret, Constants.SignTypes.MD5); + + return new ReadOnlyDictionary(paramsMap!); + } + + /// + /// 生成客户端小程序唤起开通车主服务页面所需的参数字典。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/vehicle_v2_sl.php?chapter=20_101&index=10&p=202 + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static IDictionary GenerateParametersForMiniProgramVehiclePAPPayPartnerAuth(this WechatTenpayClient client, string appId, string subMerchantId, string? subAppId, string? openId, string? subOpenId, string tradeScene, string? plateNumber, string? channelType) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + + string nonce = Guid.NewGuid().ToString("N"); + string signType = Constants.SignTypes.HMAC_SHA256; + IDictionary paramsMap = new Dictionary() + { + { "nonce_str", nonce }, + { "appid", appId }, + { "mch_id", client.Credentials.MerchantId }, + { "sub_appid", subAppId }, + { "sub_mch_id", subMerchantId }, + { "sign_type", signType }, + { "openid", openId }, + { "sub_openid", subOpenId }, + { "trade_scene", tradeScene }, + { "plate_number", plateNumber }, + { "channel_type", channelType } + }; + paramsMap["sign"] = Utilities.RequestSigner.Sign(paramsMap, client.Credentials.MerchantSecret, signType); + + return new ReadOnlyDictionary(paramsMap!); + } + + /// + /// 生成客户端 App 唤起开通车主服务页面所需的参数字典。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/vehicle_v2_sl.php?chapter=20_101&index=10&p=202 + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static IDictionary GenerateParametersForAppVehiclePAPPayPartnerAuth(this WechatTenpayClient client, string appId, string subMerchantId, string? subAppId, string? openId, string? subOpenId, string tradeScene, string? plateNumber, string? channelType) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + + return GenerateParametersForMiniProgramVehiclePAPPayPartnerAuth( + client, + appId: appId, + subMerchantId: subMerchantId, + subAppId: subAppId, + openId: openId, + subOpenId: subOpenId, + tradeScene: tradeScene, + plateNumber: plateNumber, + channelType: channelType + ); + } + + /// + /// 生成客户端小程序唤起免密支付升级无感支付页面所需的参数字典。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/vehicle_v2_sl.php?chapter=20_102&index=11&p=202 + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static IDictionary GenerateParametersForMiniProgramVehiclePAPPayPartnerNoSensePayment(this WechatTenpayClient client, string appId, string subMerchantId, string? subAppId, string? openId, string? plateNumber) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + + string nonce = Guid.NewGuid().ToString("N"); + string signType = Constants.SignTypes.HMAC_SHA256; + IDictionary paramsMap = new Dictionary() + { + { "nonce_str", nonce }, + { "appid", appId }, + { "mch_id", client.Credentials.MerchantId }, + { "sub_appid", subAppId }, + { "sub_mch_id", subMerchantId }, + { "sign_type", signType }, + { "openid", openId }, + { "plate_number", plateNumber } + }; + paramsMap["sign"] = Utilities.RequestSigner.Sign(paramsMap, client.Credentials.MerchantSecret, signType); + + return new ReadOnlyDictionary(paramsMap!); + } + + /// + /// 生成客户端 App 唤起免密支付升级无感支付页面所需的参数字典。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/vehicle_v2_sl.php?chapter=20_101&index=10&p=202 + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static IDictionary GenerateParametersForAppVehiclePAPPayPartnerNoSensePayment(this WechatTenpayClient client, string appId, string subMerchantId, string? subAppId, string? openId, string? plateNumber) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + + return GenerateParametersForMiniProgramVehiclePAPPayPartnerNoSensePayment( + client, + appId: appId, + subMerchantId: subMerchantId, + subAppId: subAppId, + openId: openId, + plateNumber: plateNumber + ); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/ConsumeDepositRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/ConsumeDepositRequest.cs new file mode 100644 index 00000000..6d50e7ed --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/ConsumeDepositRequest.cs @@ -0,0 +1,83 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /deposit/consume 接口的请求。 + /// + public class ConsumeDepositRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商户订单号。与字段 二选一。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string? OutTradeNumber { get; set; } + + /// + /// 获取或设置微信支付订单号。与字段 二选一。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string? TransactionId { get; set; } + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置货币类型。 + /// + [Newtonsoft.Json.JsonProperty("fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("fee_type")] + public string? FeeType { get; set; } + + /// + /// 获取或设置押金消费金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("consume_fee")] + [System.Text.Json.Serialization.JsonPropertyName("consume_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int ConsumeFee { get; set; } + + /// + /// + /// 默认值: + /// + [Newtonsoft.Json.JsonProperty("sign_type")] + [System.Text.Json.Serialization.JsonPropertyName("sign_type")] +#pragma warning disable CS8765 + public override string SignType { get; set; } = Constants.SignTypes.HMAC_SHA256; +#pragma warning restore CS8765 + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/ConsumeDepositResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/ConsumeDepositResponse.cs new file mode 100644 index 00000000..a0de5a90 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/ConsumeDepositResponse.cs @@ -0,0 +1,73 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /deposit/consume 接口的响应。 + /// + public class ConsumeDepositResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = default!; + + /// + /// 获取或设置微信支付订单号。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string TransactionId { get; set; } = default!; + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置货币类型。 + /// + [Newtonsoft.Json.JsonProperty("fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("fee_type")] + public string? FeeType { get; set; } + + /// + /// 获取或设置押金消费金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("consume_fee")] + [System.Text.Json.Serialization.JsonPropertyName("consume_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int ConsumeFee { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositFacePayRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositFacePayRequest.cs new file mode 100644 index 00000000..8c64ffa2 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositFacePayRequest.cs @@ -0,0 +1,194 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /deposit/facepay 接口的请求。 + /// + public class CreateDepositFacePayRequest : WechatTenpaySignableRequest + { + public static class Types + { + public class Detail : CreatePayUnifiedOrderRequest.Types.Detail + { + } + + public class Scene : CreatePayUnifiedOrderRequest.Types.Scene + { + } + } + + internal static class Converters + { + internal class RequestPropertyDetailNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class RequestPropertyDetailSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class RequestPropertySceneNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class RequestPropertySceneSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置是否押金支付。 + /// + [Newtonsoft.Json.JsonProperty("deposit")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.YesOrNoBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("deposit")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.YesOrNoBooleanConverter))] + public bool IsDeposit { get; set; } + + /// + /// 获取或设置商品描述。 + /// + [Newtonsoft.Json.JsonProperty("body")] + [System.Text.Json.Serialization.JsonPropertyName("body")] + public string Body { get; set; } = string.Empty; + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = string.Empty; + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置货币类型。 + /// + [Newtonsoft.Json.JsonProperty("fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("fee_type")] + public string? FeeType { get; set; } + + /// + /// 获取或设置用户的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string? OpenId { get; set; } + + /// + /// 获取或设置授权码。 + /// + [Newtonsoft.Json.JsonProperty("face_code")] + [System.Text.Json.Serialization.JsonPropertyName("face_code")] + public string? FaceCode { get; set; } + + /// + /// 获取或设置附加数据。 + /// + [Newtonsoft.Json.JsonProperty("attach")] + [System.Text.Json.Serialization.JsonPropertyName("attach")] + public string? Attachment { get; set; } + + /// + /// 获取或设置终端设备号。 + /// + [Newtonsoft.Json.JsonProperty("device_info")] + [System.Text.Json.Serialization.JsonPropertyName("device_info")] + public string? DeviceInfo { get; set; } + + /// + /// 获取或设置用户终端 IP。 + /// + [Newtonsoft.Json.JsonProperty("spbill_create_ip")] + [System.Text.Json.Serialization.JsonPropertyName("spbill_create_ip")] + public string ClientIp { get; set; } = string.Empty; + + /// + /// 获取或设置指定付款方式编码。 + /// + [Newtonsoft.Json.JsonProperty("limit_pay")] + [System.Text.Json.Serialization.JsonPropertyName("limit_pay")] + public string? LimitPayCode { get; set; } + + /// + /// 获取或设置交易起始时间。 + /// + [Newtonsoft.Json.JsonProperty("time_start")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("time_start")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + public DateTimeOffset? StartTime { get; set; } + + /// + /// 获取或设置交易结束时间。 + /// + [Newtonsoft.Json.JsonProperty("time_expire")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("time_expire")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + public DateTimeOffset? ExpireTime { get; set; } + + /// + /// 获取或设置商品信息。 + /// + [Newtonsoft.Json.JsonProperty("detail")] + [Newtonsoft.Json.JsonConverter(typeof(Converters.RequestPropertyDetailNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonPropertyName("detail")] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.RequestPropertyDetailSystemTextJsonConverter))] + public Types.Detail? Detail { get; set; } + + /// + /// 获取或设置场景信息。 + /// + [Newtonsoft.Json.JsonProperty("scene_info")] + [Newtonsoft.Json.JsonConverter(typeof(Converters.RequestPropertySceneNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonPropertyName("scene_info")] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.RequestPropertySceneSystemTextJsonConverter))] + public Types.Scene? Scene { get; set; } + + /// + /// + /// 默认值: + /// + [Newtonsoft.Json.JsonProperty("sign_type")] + [System.Text.Json.Serialization.JsonPropertyName("sign_type")] +#pragma warning disable CS8765 + public override string SignType { get; set; } = Constants.SignTypes.HMAC_SHA256; +#pragma warning restore CS8765 + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositFacePayResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositFacePayResponse.cs new file mode 100644 index 00000000..94e92a3b --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositFacePayResponse.cs @@ -0,0 +1,9 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /deposit/facepay 接口的响应。 + /// + public class CreateDepositFacePayResponse : CreateDepositMicroPayResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositMicroPayRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositMicroPayRequest.cs new file mode 100644 index 00000000..2196ee72 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositMicroPayRequest.cs @@ -0,0 +1,201 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /deposit/micropay 接口的请求。 + /// + public class CreateDepositMicroPayRequest : WechatTenpaySignableRequest + { + public static class Types + { + public class Detail : CreatePayUnifiedOrderRequest.Types.Detail + { + } + + public class Scene : CreatePayUnifiedOrderRequest.Types.Scene + { + } + } + + internal static class Converters + { + internal class RequestPropertyDetailNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class RequestPropertyDetailSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class RequestPropertySceneNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class RequestPropertySceneSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置是否押金支付。 + /// + [Newtonsoft.Json.JsonProperty("deposit")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.YesOrNoBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("deposit")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.YesOrNoBooleanConverter))] + public bool IsDeposit { get; set; } + + /// + /// 获取或设置商品描述。 + /// + [Newtonsoft.Json.JsonProperty("body")] + [System.Text.Json.Serialization.JsonPropertyName("body")] + public string Body { get; set; } = string.Empty; + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = string.Empty; + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置货币类型。 + /// + [Newtonsoft.Json.JsonProperty("fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("fee_type")] + public string? FeeType { get; set; } + + /// + /// 获取或设置用户的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string? OpenId { get; set; } + + /// + /// 获取或设置授权码。 + /// + [Newtonsoft.Json.JsonProperty("auth_code")] + [System.Text.Json.Serialization.JsonPropertyName("auth_code")] + public string? AuthCode { get; set; } + + /// + /// 获取或设置附加数据。 + /// + [Newtonsoft.Json.JsonProperty("attach")] + [System.Text.Json.Serialization.JsonPropertyName("attach")] + public string? Attachment { get; set; } + + /// + /// 获取或设置终端设备号。 + /// + [Newtonsoft.Json.JsonProperty("device_info")] + [System.Text.Json.Serialization.JsonPropertyName("device_info")] + public string? DeviceInfo { get; set; } + + /// + /// 获取或设置用户终端 IP。 + /// + [Newtonsoft.Json.JsonProperty("spbill_create_ip")] + [System.Text.Json.Serialization.JsonPropertyName("spbill_create_ip")] + public string ClientIp { get; set; } = string.Empty; + + /// + /// 获取或设置商品 ID。 + /// + [Newtonsoft.Json.JsonProperty("product_id")] + [System.Text.Json.Serialization.JsonPropertyName("product_id")] + public string? ProductId { get; set; } + + /// + /// 获取或设置指定付款方式编码。 + /// + [Newtonsoft.Json.JsonProperty("limit_pay")] + [System.Text.Json.Serialization.JsonPropertyName("limit_pay")] + public string? LimitPayCode { get; set; } + + /// + /// 获取或设置交易起始时间。 + /// + [Newtonsoft.Json.JsonProperty("time_start")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("time_start")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + public DateTimeOffset? StartTime { get; set; } + + /// + /// 获取或设置交易结束时间。 + /// + [Newtonsoft.Json.JsonProperty("time_expire")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("time_expire")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + public DateTimeOffset? ExpireTime { get; set; } + + /// + /// 获取或设置商品信息。 + /// + [Newtonsoft.Json.JsonProperty("detail")] + [Newtonsoft.Json.JsonConverter(typeof(Converters.RequestPropertyDetailNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonPropertyName("detail")] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.RequestPropertyDetailSystemTextJsonConverter))] + public Types.Detail? Detail { get; set; } + + /// + /// 获取或设置场景信息。 + /// + [Newtonsoft.Json.JsonProperty("scene_info")] + [Newtonsoft.Json.JsonConverter(typeof(Converters.RequestPropertySceneNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonPropertyName("scene_info")] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.RequestPropertySceneSystemTextJsonConverter))] + public Types.Scene? Scene { get; set; } + + /// + /// + /// 默认值: + /// + [Newtonsoft.Json.JsonProperty("sign_type")] + [System.Text.Json.Serialization.JsonPropertyName("sign_type")] +#pragma warning disable CS8765 + public override string SignType { get; set; } = Constants.SignTypes.HMAC_SHA256; +#pragma warning restore CS8765 + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositMicroPayResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositMicroPayResponse.cs new file mode 100644 index 00000000..f333fc61 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositMicroPayResponse.cs @@ -0,0 +1,167 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /deposit/micropay 接口的响应。 + /// + public class CreateDepositMicroPayResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置终端设备号。 + /// + [Newtonsoft.Json.JsonProperty("device_info")] + [System.Text.Json.Serialization.JsonPropertyName("device_info")] + public string? DeviceInfo { get; set; } + + /// + /// 获取或设置用户的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string OpenId { get; set; } = default!; + + /// + /// 获取或设置用户是否订阅该公众号标识。 + /// + [Newtonsoft.Json.JsonProperty("is_subscribe")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.YesOrNoBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("is_subscribe")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.YesOrNoBooleanConverter))] + public bool IsSubscribed { get; set; } + + /// + /// 获取或设置用户在子商户下的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("sub_openid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_openid")] + public string? SubOpenId { get; set; } + + /// + /// 获取或设置用户是否订阅子商户公众号标识。 + /// + [Newtonsoft.Json.JsonProperty("sub_is_subscribe")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.YesOrNoNullableBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("sub_is_subscribe")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.YesOrNoNullableBooleanConverter))] + public bool? IsSubSubscribed { get; set; } + + /// + /// 获取或设置交易类型。 + /// + [Newtonsoft.Json.JsonProperty("trade_type")] + [System.Text.Json.Serialization.JsonPropertyName("trade_type")] + public string TradeType { get; set; } = default!; + + /// + /// 获取或设置付款银行。 + /// + [Newtonsoft.Json.JsonProperty("bank_type")] + [System.Text.Json.Serialization.JsonPropertyName("bank_type")] + public string BankType { get; set; } = default!; + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置货币类型。 + /// + [Newtonsoft.Json.JsonProperty("fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("fee_type")] + public string? FeeType { get; set; } + + /// + /// 获取或设置应结订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("settlement_total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("settlement_total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? SettlementFee { get; set; } + + /// + /// 获取或设置代金券金额。 + /// + [Newtonsoft.Json.JsonProperty("coupon_fee")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CouponFee { get; set; } + + /// + /// 获取或设置现金支付金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("cash_fee")] + [System.Text.Json.Serialization.JsonPropertyName("cash_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CashFee { get; set; } + + /// + /// 获取或设置现金支付货币类型。 + /// + [Newtonsoft.Json.JsonProperty("cash_fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("cash_fee_type")] + public string? CashFeeType { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = default!; + + /// + /// 获取或设置微信支付订单号。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string TransactionId { get; set; } = default!; + + /// + /// 获取或设置附加数据。 + /// + [Newtonsoft.Json.JsonProperty("attach")] + [System.Text.Json.Serialization.JsonPropertyName("attach")] + public string? Attachment { get; set; } + + /// + /// 获取或设置支付完成时间。 + /// + [Newtonsoft.Json.JsonProperty("time_end")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("time_end")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + public DateTimeOffset? EndTime { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositRefundRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositRefundRequest.cs new file mode 100644 index 00000000..64d0316b --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositRefundRequest.cs @@ -0,0 +1,104 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /deposit/refund 接口的请求。 + /// + public class CreateDepositRefundRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = string.Empty; + + /// + /// 获取或设置微信支付订单号。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string TransactionId { get; set; } = string.Empty; + + /// + /// 获取或设置商户退款单号。 + /// + [Newtonsoft.Json.JsonProperty("out_refund_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_refund_no")] + public string OutRefundNumber { get; set; } = string.Empty; + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置退款金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("refund_fee")] + [System.Text.Json.Serialization.JsonPropertyName("refund_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int RefundFee { get; set; } + + /// + /// 获取或设置退款货币类型。 + /// + [Newtonsoft.Json.JsonProperty("refund_fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("refund_fee_type")] + public string? RefundFeeType { get; set; } + + /// + /// 获取或设置退款原因。 + /// + [Newtonsoft.Json.JsonProperty("refund_desc")] + [System.Text.Json.Serialization.JsonPropertyName("refund_desc")] + public string? Description { get; set; } + + /// + /// 获取或设置退款资金来源。 + /// + [Newtonsoft.Json.JsonProperty("refund_account")] + [System.Text.Json.Serialization.JsonPropertyName("refund_account")] + public string? RefundAccount { get; set; } + + /// + /// + /// 默认值: + /// + [Newtonsoft.Json.JsonProperty("sign_type")] + [System.Text.Json.Serialization.JsonPropertyName("sign_type")] +#pragma warning disable CS8765 + public override string SignType { get; set; } = Constants.SignTypes.HMAC_SHA256; +#pragma warning restore CS8765 + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositRefundResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositRefundResponse.cs new file mode 100644 index 00000000..dc761193 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositRefundResponse.cs @@ -0,0 +1,120 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /deposit/refund 接口的响应。 + /// + public class CreateDepositRefundResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = default!; + + /// + /// 获取或设置微信支付订单号。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string TransactionId { get; set; } = default!; + + /// + /// 获取或设置微信退款单号。 + /// + [Newtonsoft.Json.JsonProperty("refund_id")] + [System.Text.Json.Serialization.JsonPropertyName("refund_id")] + public string RefundId { get; set; } = default!; + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置货币类型。 + /// + [Newtonsoft.Json.JsonProperty("fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("fee_type")] + public string? FeeType { get; set; } + + /// + /// 获取或设置退款金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("refund_fee")] + [System.Text.Json.Serialization.JsonPropertyName("refund_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int RefundFee { get; set; } + + /// + /// 获取或设置应结订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("settlement_total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("settlement_total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? SettlementTotalFee { get; set; } + + /// + /// 获取或设置应结退款金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("settlement_refund_fee")] + [System.Text.Json.Serialization.JsonPropertyName("settlement_refund_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? SettlementRefundFee { get; set; } + + /// + /// 获取或设置代金券退款金额。 + /// + [Newtonsoft.Json.JsonProperty("coupon_refund_fee")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_refund_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CouponRefundFee { get; set; } + + /// + /// 获取或设置现金支付金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("cash_fee")] + [System.Text.Json.Serialization.JsonPropertyName("cash_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CashFee { get; set; } + + /// + /// 获取或设置现金退款金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("cash_refund_fee")] + [System.Text.Json.Serialization.JsonPropertyName("cash_refund_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CashRefundFee { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositUnifiedOrderRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositUnifiedOrderRequest.cs new file mode 100644 index 00000000..406ac864 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositUnifiedOrderRequest.cs @@ -0,0 +1,205 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /deposit/unifiedorder 接口的请求。 + /// + public class CreateDepositUnifiedOrderRequest : WechatTenpaySignableRequest + { + public static class Types + { + public class Detail : CreatePayUnifiedOrderRequest.Types.Detail + { + } + + public class Scene : CreatePayUnifiedOrderRequest.Types.Scene + { + } + } + + internal static class Converters + { + internal class RequestPropertyDetailNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class RequestPropertyDetailSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class RequestPropertySceneNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class RequestPropertySceneSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商品描述。 + /// + [Newtonsoft.Json.JsonProperty("body")] + [System.Text.Json.Serialization.JsonPropertyName("body")] + public string Body { get; set; } = string.Empty; + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = string.Empty; + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置货币类型。 + /// + [Newtonsoft.Json.JsonProperty("fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("fee_type")] + public string? FeeType { get; set; } + + /// + /// 获取或设置用户的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string? OpenId { get; set; } + + /// + /// 获取或设置用户在子商户下的 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_openid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_openid")] + public string? SubOpenId { get; set; } + + /// + /// 获取或设置附加数据。 + /// + [Newtonsoft.Json.JsonProperty("attach")] + [System.Text.Json.Serialization.JsonPropertyName("attach")] + public string? Attachment { get; set; } + + /// + /// 获取或设置终端设备号。 + /// + [Newtonsoft.Json.JsonProperty("device_info")] + [System.Text.Json.Serialization.JsonPropertyName("device_info")] + public string? DeviceInfo { get; set; } + + /// + /// 获取或设置用户终端 IP。 + /// + [Newtonsoft.Json.JsonProperty("spbill_create_ip")] + [System.Text.Json.Serialization.JsonPropertyName("spbill_create_ip")] + public string ClientIp { get; set; } = string.Empty; + + /// + /// 获取或设置交易类型。 + /// + [Newtonsoft.Json.JsonProperty("trade_type")] + [System.Text.Json.Serialization.JsonPropertyName("trade_type")] + public string TradeType { get; set; } = string.Empty; + + /// + /// 获取或设置通知地址。 + /// + [Newtonsoft.Json.JsonProperty("notify_url")] + [System.Text.Json.Serialization.JsonPropertyName("notify_url")] + public string? NotifyUrl { get; set; } + + /// + /// 获取或设置商品 ID。 + /// + [Newtonsoft.Json.JsonProperty("product_id")] + [System.Text.Json.Serialization.JsonPropertyName("product_id")] + public string? ProductId { get; set; } + + /// + /// 获取或设置指定付款方式编码。 + /// + [Newtonsoft.Json.JsonProperty("limit_pay")] + [System.Text.Json.Serialization.JsonPropertyName("limit_pay")] + public string? LimitPayCode { get; set; } + + /// + /// 获取或设置交易起始时间。 + /// + [Newtonsoft.Json.JsonProperty("time_start")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("time_start")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + public DateTimeOffset? StartTime { get; set; } + + /// + /// 获取或设置交易结束时间。 + /// + [Newtonsoft.Json.JsonProperty("time_expire")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("time_expire")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + public DateTimeOffset? ExpireTime { get; set; } + + /// + /// 获取或设置商品信息。 + /// + [Newtonsoft.Json.JsonProperty("detail")] + [Newtonsoft.Json.JsonConverter(typeof(Converters.RequestPropertyDetailNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonPropertyName("detail")] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.RequestPropertyDetailSystemTextJsonConverter))] + public Types.Detail? Detail { get; set; } + + /// + /// 获取或设置场景信息。 + /// + [Newtonsoft.Json.JsonProperty("scene_info")] + [Newtonsoft.Json.JsonConverter(typeof(Converters.RequestPropertySceneNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonPropertyName("scene_info")] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.RequestPropertySceneSystemTextJsonConverter))] + public Types.Scene? Scene { get; set; } + + /// + /// 获取或设置是否开放电子发票入口。 + /// + [Newtonsoft.Json.JsonProperty("receipt")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.YesOrNoNullableBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("receipt")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.YesOrNoNullableBooleanConverter))] + public bool? IsReceiptOpen { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositUnifiedOrderResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositUnifiedOrderResponse.cs new file mode 100644 index 00000000..6eae9611 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/CreateDepositUnifiedOrderResponse.cs @@ -0,0 +1,64 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /deposit/unifiedorder 接口的响应。 + /// + public class CreateDepositUnifiedOrderResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置终端设备号。 + /// + [Newtonsoft.Json.JsonProperty("device_info")] + [System.Text.Json.Serialization.JsonPropertyName("device_info")] + public string? DeviceInfo { get; set; } + + /// + /// 获取或设置交易类型。 + /// + [Newtonsoft.Json.JsonProperty("trade_type")] + [System.Text.Json.Serialization.JsonPropertyName("trade_type")] + public string TradeType { get; set; } = default!; + + /// + /// 获取或设置预支付交易会话标识。 + /// + [Newtonsoft.Json.JsonProperty("prepay_id")] + [System.Text.Json.Serialization.JsonPropertyName("prepay_id")] + public string PrepayId { get; set; } = default!; + + /// + /// 获取或设置二维码链接。 + /// + [Newtonsoft.Json.JsonProperty("code_url")] + [System.Text.Json.Serialization.JsonPropertyName("code_url")] + public string? CodeUrl { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/GetDepositOrderRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/GetDepositOrderRequest.cs new file mode 100644 index 00000000..9ba31fc5 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/GetDepositOrderRequest.cs @@ -0,0 +1,60 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /deposit/orderquery 接口的请求。 + /// + public class GetDepositOrderRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商户订单号。与字段 二选一。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string? OutTradeNumber { get; set; } + + /// + /// 获取或设置微信支付订单号。与字段 二选一。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string? TransactionId { get; set; } + + /// + /// + /// 默认值: + /// + [Newtonsoft.Json.JsonProperty("sign_type")] + [System.Text.Json.Serialization.JsonPropertyName("sign_type")] +#pragma warning disable CS8765 + public override string SignType { get; set; } = Constants.SignTypes.HMAC_SHA256; +#pragma warning restore CS8765 + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/GetDepositOrderResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/GetDepositOrderResponse.cs new file mode 100644 index 00000000..ee9fa37b --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/GetDepositOrderResponse.cs @@ -0,0 +1,189 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /deposit/orderquery 接口的响应。 + /// + public class GetDepositOrderResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置终端设备号。 + /// + [Newtonsoft.Json.JsonProperty("device_info")] + [System.Text.Json.Serialization.JsonPropertyName("device_info")] + public string? DeviceInfo { get; set; } + + /// + /// 获取或设置用户的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string OpenId { get; set; } = default!; + + /// + /// 获取或设置用户是否订阅该公众号标识。 + /// + [Newtonsoft.Json.JsonProperty("is_subscribe")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.YesOrNoBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("is_subscribe")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.YesOrNoBooleanConverter))] + public bool IsSubscribed { get; set; } + + /// + /// 获取或设置用户在子商户下的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("sub_openid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_openid")] + public string? SubOpenId { get; set; } + + /// + /// 获取或设置用户是否订阅子商户公众号标识。 + /// + [Newtonsoft.Json.JsonProperty("sub_is_subscribe")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.YesOrNoNullableBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("sub_is_subscribe")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.YesOrNoNullableBooleanConverter))] + public bool? IsSubSubscribed { get; set; } + + /// + /// 获取或设置交易状态。 + /// + [Newtonsoft.Json.JsonProperty("trade_state")] + [System.Text.Json.Serialization.JsonPropertyName("trade_state")] + public string TradeState { get; set; } = default!; + + /// + /// 获取或设置交易状态描述。 + /// + [Newtonsoft.Json.JsonProperty("trade_state_desc")] + [System.Text.Json.Serialization.JsonPropertyName("trade_state_desc")] + public string TradeStateDescription { get; set; } = default!; + + /// + /// 获取或设置交易类型。 + /// + [Newtonsoft.Json.JsonProperty("trade_type")] + [System.Text.Json.Serialization.JsonPropertyName("trade_type")] + public string TradeType { get; set; } = default!; + + /// + /// 获取或设置付款银行。 + /// + [Newtonsoft.Json.JsonProperty("bank_type")] + [System.Text.Json.Serialization.JsonPropertyName("bank_type")] + public string BankType { get; set; } = default!; + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置货币类型。 + /// + [Newtonsoft.Json.JsonProperty("fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("fee_type")] + public string? FeeType { get; set; } + + /// + /// 获取或设置应结订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("settlement_total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("settlement_total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? SettlementFee { get; set; } + + /// + /// 获取或设置代金券金额。 + /// + [Newtonsoft.Json.JsonProperty("coupon_fee")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CouponFee { get; set; } + + /// + /// 获取或设置现金支付金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("cash_fee")] + [System.Text.Json.Serialization.JsonPropertyName("cash_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CashFee { get; set; } + + /// + /// 获取或设置现金支付货币类型。 + /// + [Newtonsoft.Json.JsonProperty("cash_fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("cash_fee_type")] + public string? CashFeeType { get; set; } + + /// + /// 获取或设置押金消费金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("consume_fee")] + [System.Text.Json.Serialization.JsonPropertyName("consume_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int ConsumeFee { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = default!; + + /// + /// 获取或设置微信支付订单号。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string TransactionId { get; set; } = default!; + + /// + /// 获取或设置附加数据。 + /// + [Newtonsoft.Json.JsonProperty("attach")] + [System.Text.Json.Serialization.JsonPropertyName("attach")] + public string? Attachment { get; set; } + + /// + /// 获取或设置支付完成时间。 + /// + [Newtonsoft.Json.JsonProperty("time_end")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("time_end")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + public DateTimeOffset? EndTime { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/GetDepositRefundRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/GetDepositRefundRequest.cs new file mode 100644 index 00000000..0572d555 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/GetDepositRefundRequest.cs @@ -0,0 +1,60 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /deposit/refundquery 接口的请求。 + /// + public class GetDepositRefundRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商户退款单号。与字段 二选一。 + /// + [Newtonsoft.Json.JsonProperty("out_refund_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_refund_no")] + public string? OutRefundNumber { get; set; } + + /// + /// 获取或设置微信退款单号。与字段 二选一。 + /// + [Newtonsoft.Json.JsonProperty("refund_id")] + [System.Text.Json.Serialization.JsonPropertyName("refund_id")] + public string? RefundId { get; set; } + + /// + /// + /// 默认值: + /// + [Newtonsoft.Json.JsonProperty("sign_type")] + [System.Text.Json.Serialization.JsonPropertyName("sign_type")] +#pragma warning disable CS8765 + public override string SignType { get; set; } = Constants.SignTypes.HMAC_SHA256; +#pragma warning restore CS8765 + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/GetDepositRefundResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/GetDepositRefundResponse.cs new file mode 100644 index 00000000..17583e14 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/GetDepositRefundResponse.cs @@ -0,0 +1,193 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /deposit/refundquery 接口的响应。 + /// + [Newtonsoft.Json.JsonConverter(typeof(Converters.ResponseClassNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.ResponseClassSystemTextJsonConverter))] + public class GetDepositRefundResponse : WechatTenpaySignableResponse + { + public static class Types + { + public class Refund + { + /// + /// 获取或设置微信退款单号。 + /// + [Newtonsoft.Json.JsonProperty("refund_id_$n")] + [System.Text.Json.Serialization.JsonPropertyName("refund_id_$n")] + public string RefundId { get; set; } = default!; + + /// + /// 获取或设置退款渠道。 + /// + [Newtonsoft.Json.JsonProperty("refund_channel_$n")] + [System.Text.Json.Serialization.JsonPropertyName("refund_channel_$n")] + public string? RefundChannel { get; set; } + + /// + /// 获取或设置退款状态。 + /// + [Newtonsoft.Json.JsonProperty("refund_status_$n")] + [System.Text.Json.Serialization.JsonPropertyName("refund_status_$n")] + public string RefundStatus { get; set; } = default!; + + /// + /// 获取或设置退款资金来源。 + /// + [Newtonsoft.Json.JsonProperty("refund_account_$n")] + [System.Text.Json.Serialization.JsonPropertyName("refund_account_$n")] + public string? RefundAccount { get; set; } + + /// + /// 获取或设置退款入账账户。 + /// + [Newtonsoft.Json.JsonProperty("refund_recv_accout_$n")] + [System.Text.Json.Serialization.JsonPropertyName("refund_recv_accout_$n")] + public string? RefundReceiveAccount { get; set; } + + /// + /// 获取或设置退款金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("refund_fee_$n")] + [System.Text.Json.Serialization.JsonPropertyName("refund_fee_$n")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int RefundFee { get; set; } + + /// + /// 获取或设置应结退款金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("settlement_refund_fee_$n")] + [System.Text.Json.Serialization.JsonPropertyName("settlement_refund_fee_$n")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? SettlementRefundFee { get; set; } + + /// + /// 获取或设置代金券退款金额。 + /// + [Newtonsoft.Json.JsonProperty("coupon_refund_fee_$n")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_refund_fee_$n")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CouponRefundFee { get; set; } + + /// + /// 获取或设置现金退款金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("cash_refund_fee_$n")] + [System.Text.Json.Serialization.JsonPropertyName("cash_refund_fee_$n")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CashRefundFee { get; set; } + + /// + /// 获取或设置退款成功时间。 + /// + [Newtonsoft.Json.JsonProperty("refund_success_time_$n")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("refund_success_time_$n")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + public DateTimeOffset? SuccessTime { get; set; } + } + } + + internal static class Converters + { + internal class ResponseClassNewtonsoftJsonConverter : Newtonsoft.Json.Converters.FlattenNArrayObjectConverterBase + { + } + + internal class ResponseClassSystemTextJsonConverter : System.Text.Json.Converters.FlattenNArrayObjectConverterBase + { + } + } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = default!; + + /// + /// 获取或设置微信支付订单号。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string TransactionId { get; set; } = default!; + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置货币类型。 + /// + [Newtonsoft.Json.JsonProperty("fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("fee_type")] + public string? FeeType { get; set; } + + /// + /// 获取或设置应结订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("settlement_total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("settlement_total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? SettlementTotalFee { get; set; } + + /// + /// 获取或设置现金支付金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("cash_fee")] + [System.Text.Json.Serialization.JsonPropertyName("cash_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CashFee { get; set; } + + /// + /// 获取或设置记录列表。 + /// + [Newtonsoft.Json.JsonProperty(Newtonsoft.Json.Converters.FlattenNArrayObjectConverterBase.PROPERTY_NAME_NARRAY)] + [System.Text.Json.Serialization.JsonPropertyName(System.Text.Json.Converters.FlattenNArrayObjectConverterBase.PROPERTY_NAME_NARRAY)] + public Types.Refund[] RefundList { get; set; } = default!; + + /// + /// 获取或设置记录总数。 + /// + [Newtonsoft.Json.JsonProperty("refund_count")] + [System.Text.Json.Serialization.JsonPropertyName("refund_count")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalRefundCount { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/ReverseDepositOrderRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/ReverseDepositOrderRequest.cs new file mode 100644 index 00000000..5c30121d --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/ReverseDepositOrderRequest.cs @@ -0,0 +1,60 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /deposit/reverse 接口的请求。 + /// + public class ReverseDepositOrderRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商户订单号。与字段 二选一。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string? OutTradeNumber { get; set; } + + /// + /// 获取或设置微信支付订单号。与字段 二选一。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string? TransactionId { get; set; } + + /// + /// + /// 默认值: + /// + [Newtonsoft.Json.JsonProperty("sign_type")] + [System.Text.Json.Serialization.JsonPropertyName("sign_type")] +#pragma warning disable CS8765 + public override string SignType { get; set; } = Constants.SignTypes.HMAC_SHA256; +#pragma warning restore CS8765 + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/ReverseDepositOrderResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/ReverseDepositOrderResponse.cs new file mode 100644 index 00000000..cc8233e6 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Deposit/ReverseDepositOrderResponse.cs @@ -0,0 +1,36 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /deposit/reverse 接口的响应。 + /// + public class ReverseDepositOrderResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Fraud/GetRiskPublicKeyRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Fraud/GetRiskPublicKeyRequest.cs new file mode 100644 index 00000000..b7458a63 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Fraud/GetRiskPublicKeyRequest.cs @@ -0,0 +1,32 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /risk/getpublickey 接口的请求。 + /// + public class GetRiskPublicKeyRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? AppId { get; set; } + + /// + /// + /// 默认值: + /// + [Newtonsoft.Json.JsonProperty("sign_type")] + [System.Text.Json.Serialization.JsonPropertyName("sign_type")] +#pragma warning disable CS8765 + public override string SignType { get; set; } = Constants.SignTypes.MD5; +#pragma warning restore CS8765 + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Fraud/GetRiskPublicKeyResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Fraud/GetRiskPublicKeyResponse.cs new file mode 100644 index 00000000..5d262538 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Fraud/GetRiskPublicKeyResponse.cs @@ -0,0 +1,29 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /risk/getpublickey 接口的响应。 + /// + public class GetRiskPublicKeyResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? AppId { get; set; } + + /// + /// 获取或设置 RSA 公钥。 + /// + [Newtonsoft.Json.JsonProperty("pub_key")] + [System.Text.Json.Serialization.JsonPropertyName("pub_key")] + public string PublicKey { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/CreateMerchantCustomsCustomDeclarationRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/CreateMerchantCustomsCustomDeclarationRequest.cs index b94a6bb3..09b9280d 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/CreateMerchantCustomsCustomDeclarationRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/CreateMerchantCustomsCustomDeclarationRequest.cs @@ -5,6 +5,20 @@ /// public class CreateMerchantCustomsCustomDeclarationRequest : WechatTenpaySignableRequest { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + /// /// 获取或设置商户订单号。 /// @@ -45,6 +59,7 @@ /// [Newtonsoft.Json.JsonProperty("duty")] [System.Text.Json.Serialization.JsonPropertyName("duty")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] public int? Duty { get; set; } /// @@ -66,6 +81,7 @@ /// [Newtonsoft.Json.JsonProperty("order_fee")] [System.Text.Json.Serialization.JsonPropertyName("order_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] public int? OrderFee { get; set; } /// @@ -73,6 +89,7 @@ /// [Newtonsoft.Json.JsonProperty("transport_fee")] [System.Text.Json.Serialization.JsonPropertyName("transport_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] public int? TransportFee { get; set; } /// @@ -80,6 +97,7 @@ /// [Newtonsoft.Json.JsonProperty("product_fee")] [System.Text.Json.Serialization.JsonPropertyName("product_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] public int? ProductFee { get; set; } /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/CreateMerchantCustomsCustomDeclarationResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/CreateMerchantCustomsCustomDeclarationResponse.cs index fc991b94..3d2ecc21 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/CreateMerchantCustomsCustomDeclarationResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/CreateMerchantCustomsCustomDeclarationResponse.cs @@ -7,6 +7,20 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models /// public class CreateMerchantCustomsCustomDeclarationResponse : WechatTenpaySignableResponse { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + /// /// 获取或设置状态码。 /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/QueryMerchantCustomsCustomDeclarationRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/QueryMerchantCustomsCustomDeclarationRequest.cs index 46d0cbeb..6cf94f43 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/QueryMerchantCustomsCustomDeclarationRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/QueryMerchantCustomsCustomDeclarationRequest.cs @@ -5,6 +5,20 @@ /// public class QueryMerchantCustomsCustomDeclarationRequest : WechatTenpaySignableRequest { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + /// /// 获取或设置商户订单号。 /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/QueryMerchantCustomsCustomDeclarationResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/QueryMerchantCustomsCustomDeclarationResponse.cs index 2804ad0b..8a2064da 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/QueryMerchantCustomsCustomDeclarationResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/QueryMerchantCustomsCustomDeclarationResponse.cs @@ -53,6 +53,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models /// [Newtonsoft.Json.JsonProperty("duty_$n")] [System.Text.Json.Serialization.JsonPropertyName("duty_$n")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] public int? Duty { get; set; } /// @@ -74,6 +75,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models /// [Newtonsoft.Json.JsonProperty("transport_fee_$n")] [System.Text.Json.Serialization.JsonPropertyName("transport_fee_$n")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] public int? TransportFee { get; set; } /// @@ -81,6 +83,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models /// [Newtonsoft.Json.JsonProperty("product_fee_$n")] [System.Text.Json.Serialization.JsonPropertyName("product_fee_$n")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] public int? ProductFee { get; set; } /// @@ -119,6 +122,20 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models } } + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + /// /// 获取或设置微信支付订单号。 /// @@ -138,7 +155,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models /// [Newtonsoft.Json.JsonProperty("count")] [System.Text.Json.Serialization.JsonPropertyName("count")] - public int RecordCount { get; set; } + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalRecordCount { get; set; } /// /// 获取或设置验核机构。 diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/RedeclareMerchantCustomsCustomDeclarationRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/RedeclareMerchantCustomsCustomDeclarationRequest.cs index 9101f11f..e230f698 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/RedeclareMerchantCustomsCustomDeclarationRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/RedeclareMerchantCustomsCustomDeclarationRequest.cs @@ -5,6 +5,20 @@ /// public class RedeclareMerchantCustomsCustomDeclarationRequest : WechatTenpaySignableRequest { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + /// /// 获取或设置商户订单号。 /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/RedeclareMerchantCustomsCustomDeclarationResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/RedeclareMerchantCustomsCustomDeclarationResponse.cs index 66b6a5bc..4fb7c16b 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/RedeclareMerchantCustomsCustomDeclarationResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/MerchantCustoms/RedeclareMerchantCustomsCustomDeclarationResponse.cs @@ -7,6 +7,20 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models /// public class RedeclareMerchantCustomsCustomDeclarationResponse : WechatTenpaySignableResponse { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + /// /// 获取或设置状态码。 /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/ApplyPAPPayRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/ApplyPAPPayRequest.cs new file mode 100644 index 00000000..2525848b --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/ApplyPAPPayRequest.cs @@ -0,0 +1,128 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /pay/pappayapply 接口的请求。 + /// + public class ApplyPAPPayRequest : WechatTenpaySignableRequest + { + public static class Types + { + public class Scene : CreatePayUnifiedOrderRequest.Types.Scene + { + } + } + + internal static class Converters + { + internal class RequestPropertySceneNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class RequestPropertySceneSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置商品描述。 + /// + [Newtonsoft.Json.JsonProperty("body")] + [System.Text.Json.Serialization.JsonPropertyName("body")] + public string Body { get; set; } = string.Empty; + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = string.Empty; + + /// + /// 获取或设置委托代扣协议 ID。 + /// + [Newtonsoft.Json.JsonProperty("contract_id")] + [System.Text.Json.Serialization.JsonPropertyName("contract_id")] + public string ContractId { get; set; } = string.Empty; + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置货币类型。 + /// + [Newtonsoft.Json.JsonProperty("fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("fee_type")] + public string? FeeType { get; set; } + + /// + /// 获取或设置附加数据。 + /// + [Newtonsoft.Json.JsonProperty("attach")] + [System.Text.Json.Serialization.JsonPropertyName("attach")] + public string? Attachment { get; set; } + + /// + /// 获取或设置用户终端 IP。 + /// + [Newtonsoft.Json.JsonProperty("spbill_create_ip")] + [System.Text.Json.Serialization.JsonPropertyName("spbill_create_ip")] + public string? ClientIp { get; set; } + + /// + /// 获取或设置交易类型。 + /// 默认值:PAP + /// + [Newtonsoft.Json.JsonProperty("trade_type")] + [System.Text.Json.Serialization.JsonPropertyName("trade_type")] + public string TradeType { get; set; } = "PAP"; + + /// + /// 获取或设置订单优惠标记。 + /// + [Newtonsoft.Json.JsonProperty("goods_tag")] + [System.Text.Json.Serialization.JsonPropertyName("goods_tag")] + public string? GoodsTag { get; set; } + + /// + /// 获取或设置通知地址。 + /// + [Newtonsoft.Json.JsonProperty("notify_url")] + [System.Text.Json.Serialization.JsonPropertyName("notify_url")] + public string? NotifyUrl { get; set; } + + /// + /// 获取或设置商品信息。 + /// + [Newtonsoft.Json.JsonProperty("detail")] + [System.Text.Json.Serialization.JsonPropertyName("detail")] + public string? Detail { get; set; } + + /// + /// 获取或设置场景信息。 + /// + [Newtonsoft.Json.JsonProperty("scene_info")] + [Newtonsoft.Json.JsonConverter(typeof(Converters.RequestPropertySceneNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonPropertyName("scene_info")] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.RequestPropertySceneSystemTextJsonConverter))] + public Types.Scene? Scene { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/ApplyPAPPayResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/ApplyPAPPayResponse.cs new file mode 100644 index 00000000..9934d6fb --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/ApplyPAPPayResponse.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /pay/pappayapply 接口的响应。 + /// + public class ApplyPAPPayResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/CreateContractOrderRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/CreateContractOrderRequest.cs new file mode 100644 index 00000000..449fcdcf --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/CreateContractOrderRequest.cs @@ -0,0 +1,192 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /pay/contractorder 接口的请求。 + /// + public class CreateContractOrderRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置签约商户号。 + /// + [Newtonsoft.Json.JsonProperty("contract_mchid")] + [System.Text.Json.Serialization.JsonPropertyName("contract_mchid")] + public string ContractMerchantId { get; set; } = string.Empty; + + /// + /// 获取或设置签约 AppId。 + /// + [Newtonsoft.Json.JsonProperty("contract_appid")] + [System.Text.Json.Serialization.JsonPropertyName("contract_appid")] + public string ContractAppId { get; set; } = string.Empty; + + /// + /// 获取或设置商品描述。 + /// + [Newtonsoft.Json.JsonProperty("body")] + [System.Text.Json.Serialization.JsonPropertyName("body")] + public string Body { get; set; } = string.Empty; + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = string.Empty; + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置货币类型。 + /// + [Newtonsoft.Json.JsonProperty("fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("fee_type")] + public string? FeeType { get; set; } + + /// + /// 获取或设置用户的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string? OpenId { get; set; } + + /// + /// 获取或设置附加数据。 + /// + [Newtonsoft.Json.JsonProperty("attach")] + [System.Text.Json.Serialization.JsonPropertyName("attach")] + public string? Attachment { get; set; } + + /// + /// 获取或设置终端设备号。 + /// + [Newtonsoft.Json.JsonProperty("device_info")] + [System.Text.Json.Serialization.JsonPropertyName("device_info")] + public string? DeviceInfo { get; set; } + + /// + /// 获取或设置用户终端 IP。 + /// + [Newtonsoft.Json.JsonProperty("spbill_create_ip")] + [System.Text.Json.Serialization.JsonPropertyName("spbill_create_ip")] + public string? ClientIp { get; set; } + + /// + /// 获取或设置交易类型。 + /// + [Newtonsoft.Json.JsonProperty("trade_type")] + [System.Text.Json.Serialization.JsonPropertyName("trade_type")] + public string TradeType { get; set; } = string.Empty; + + /// + /// 获取或设置订单优惠标记。 + /// + [Newtonsoft.Json.JsonProperty("goods_tag")] + [System.Text.Json.Serialization.JsonPropertyName("goods_tag")] + public string? GoodsTag { get; set; } + + /// + /// 获取或设置通知地址。 + /// + [Newtonsoft.Json.JsonProperty("notify_url")] + [System.Text.Json.Serialization.JsonPropertyName("notify_url")] + public string? NotifyUrl { get; set; } + + /// + /// 获取或设置商品 ID。 + /// + [Newtonsoft.Json.JsonProperty("product_id")] + [System.Text.Json.Serialization.JsonPropertyName("product_id")] + public string? ProductId { get; set; } + + /// + /// 获取或设置指定付款方式编码。 + /// + [Newtonsoft.Json.JsonProperty("limit_pay")] + [System.Text.Json.Serialization.JsonPropertyName("limit_pay")] + public string? LimitPayCode { get; set; } + + /// + /// 获取或设置交易起始时间。 + /// + [Newtonsoft.Json.JsonProperty("time_start")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("time_start")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + public DateTimeOffset? StartTime { get; set; } + + /// + /// 获取或设置交易结束时间。 + /// + [Newtonsoft.Json.JsonProperty("time_expire")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("time_expire")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + public DateTimeOffset? ExpireTime { get; set; } + + /// + /// 获取或设置商品信息。 + /// + [Newtonsoft.Json.JsonProperty("detail")] + [System.Text.Json.Serialization.JsonPropertyName("detail")] + public string? Detail { get; set; } + + /// + /// 获取或设置模板 ID。 + /// + [Newtonsoft.Json.JsonProperty("plan_id")] + [System.Text.Json.Serialization.JsonPropertyName("plan_id")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int PlanId { get; set; } + + /// + /// 获取或设置签约协议号。 + /// + [Newtonsoft.Json.JsonProperty("contract_code")] + [System.Text.Json.Serialization.JsonPropertyName("contract_code")] + public string ContractCode { get; set; } = string.Empty; + + /// + /// 获取或设置请求序列号。 + /// + [Newtonsoft.Json.JsonProperty("request_serial")] + [System.Text.Json.Serialization.JsonPropertyName("request_serial")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public long RequestSerialNumber { get; set; } + + /// + /// 获取或设置用户账户展示名称。 + /// + [Newtonsoft.Json.JsonProperty("contract_display_account")] + [System.Text.Json.Serialization.JsonPropertyName("contract_display_account")] + public string ContractDisplayAccount { get; set; } = string.Empty; + + /// + /// 获取或设置签约通知地址。 + /// + [Newtonsoft.Json.JsonProperty("contract_notify_url")] + [System.Text.Json.Serialization.JsonPropertyName("contract_notify_url")] + public string? ContractNotifyUrl { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/CreateContractOrderResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/CreateContractOrderResponse.cs new file mode 100644 index 00000000..177f46db --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/CreateContractOrderResponse.cs @@ -0,0 +1,113 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /pay/contractorder 接口的响应。 + /// + public class CreateContractOrderResponse : WechatTenpaySignableResponse + { + /// + /// 获取或设置预签约结果。 + /// + [Newtonsoft.Json.JsonProperty("contract_result_code")] + [System.Text.Json.Serialization.JsonPropertyName("contract_result_code")] + public string? ContractResultCode { get; set; } + + /// + /// 获取或设置预签约错误代码。 + /// + [Newtonsoft.Json.JsonProperty("contract_err_code")] + [System.Text.Json.Serialization.JsonPropertyName("contract_err_code")] + public string? ContractErrorCode { get; set; } + + /// + /// 获取或设置预签约错误描述。 + /// + [Newtonsoft.Json.JsonProperty("contract_err_code_des")] + [System.Text.Json.Serialization.JsonPropertyName("contract_err_code_des")] + public string? ContractErrorCodeDescription { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = default!; + + /// + /// 获取或设置交易类型。 + /// + [Newtonsoft.Json.JsonProperty("trade_type")] + [System.Text.Json.Serialization.JsonPropertyName("trade_type")] + public string TradeType { get; set; } = default!; + + /// + /// 获取或设置预支付交易会话标识。 + /// + [Newtonsoft.Json.JsonProperty("prepay_id")] + [System.Text.Json.Serialization.JsonPropertyName("prepay_id")] + public string PrepayId { get; set; } = default!; + + /// + /// 获取或设置二维码链接。 + /// + [Newtonsoft.Json.JsonProperty("code_url")] + [System.Text.Json.Serialization.JsonPropertyName("code_url")] + public string? CodeUrl { get; set; } + + /// + /// 获取或设置支付跳转链接。 + /// + [Newtonsoft.Json.JsonProperty("mweb_url")] + [System.Text.Json.Serialization.JsonPropertyName("mweb_url")] + public string? MobileWebUrl { get; set; } + + /// + /// 获取或设置模板 ID。 + /// + [Newtonsoft.Json.JsonProperty("plan_id")] + [System.Text.Json.Serialization.JsonPropertyName("plan_id")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? PlanId { get; set; } + + /// + /// 获取或设置签约协议号。 + /// + [Newtonsoft.Json.JsonProperty("contract_code")] + [System.Text.Json.Serialization.JsonPropertyName("contract_code")] + public string? ContractCode { get; set; } + + /// + /// 获取或设置请求序列号。 + /// + [Newtonsoft.Json.JsonProperty("request_serial")] + [System.Text.Json.Serialization.JsonPropertyName("request_serial")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public long? RequestSerialNumber { get; set; } + + /// + /// 获取或设置用户账户展示名称。 + /// + [Newtonsoft.Json.JsonProperty("contract_display_account")] + [System.Text.Json.Serialization.JsonPropertyName("contract_display_account")] + public string? ContractDisplayAccount { get; set; } + + public override bool IsSuccessful() + { + return base.IsSuccessful() && "SUCCESS".Equals(ContractResultCode) && string.IsNullOrEmpty(ContractErrorCode); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/DeletePAPPayContractRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/DeletePAPPayContractRequest.cs new file mode 100644 index 00000000..d8120b68 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/DeletePAPPayContractRequest.cs @@ -0,0 +1,72 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /papay/deletecontract 接口的请求。 + /// + public class DeletePAPPayContractRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置接口版本号。 + /// 默认值:1.0 + /// + [Newtonsoft.Json.JsonProperty("version")] + [System.Text.Json.Serialization.JsonPropertyName("version")] + public string Version { get; set; } = "1.0"; + + /// + /// 获取或设置模板 ID。 + /// + [Newtonsoft.Json.JsonProperty("plan_id")] + [System.Text.Json.Serialization.JsonPropertyName("plan_id")] + public int? PlanId { get; set; } + + /// + /// 获取或设置签约协议号。 + /// + [Newtonsoft.Json.JsonProperty("contract_code")] + [System.Text.Json.Serialization.JsonPropertyName("contract_code")] + public string? Contract { get; set; } + + /// + /// 获取或设置委托代扣协议 ID。 + /// + [Newtonsoft.Json.JsonProperty("contract_id")] + [System.Text.Json.Serialization.JsonPropertyName("contract_id")] + public string? ContractId { get; set; } + + /// + /// 获取或设置解约备注。 + /// + [Newtonsoft.Json.JsonProperty("contract_termination_remark")] + [System.Text.Json.Serialization.JsonPropertyName("contract_termination_remark")] + public string TerminationRemark { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/DeletePAPPayContractResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/DeletePAPPayContractResponse.cs new file mode 100644 index 00000000..e738e0e2 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/DeletePAPPayContractResponse.cs @@ -0,0 +1,71 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /papay/deletecontract 接口的响应。 + /// + public class DeletePAPPayContractResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置接口版本号。 + /// + [Newtonsoft.Json.JsonProperty("version")] + [System.Text.Json.Serialization.JsonPropertyName("version")] + public string Version { get; set; } = default!; + + /// + /// 获取或设置模板 ID。 + /// + [Newtonsoft.Json.JsonProperty("plan_id")] + [System.Text.Json.Serialization.JsonPropertyName("plan_id")] + public int PlanId { get; set; } + + /// + /// 获取或设置签约协议号。 + /// + [Newtonsoft.Json.JsonProperty("contract_code")] + [System.Text.Json.Serialization.JsonPropertyName("contract_code")] + public string ContractCode { get; set; } = default!; + + /// + /// 获取或设置委托代扣协议 ID。 + /// + [Newtonsoft.Json.JsonProperty("contract_id")] + [System.Text.Json.Serialization.JsonPropertyName("contract_id")] + public string ContractId { get; set; } = default!; + + /// + /// 获取或设置解约备注。 + /// + [Newtonsoft.Json.JsonProperty("contract_termination_remark")] + [System.Text.Json.Serialization.JsonPropertyName("contract_termination_remark")] + public string TerminationRemark { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/GetPAPPayContractRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/GetPAPPayContractRequest.cs new file mode 100644 index 00000000..060d88d8 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/GetPAPPayContractRequest.cs @@ -0,0 +1,53 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /papay/querycontract 接口的请求。 + /// + public class GetPAPPayContractRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置接口版本号。 + /// 默认值:1.0 + /// + [Newtonsoft.Json.JsonProperty("version")] + [System.Text.Json.Serialization.JsonPropertyName("version")] + public string Version { get; set; } = "1.0"; + + /// + /// 获取或设置模板 ID。 + /// + [Newtonsoft.Json.JsonProperty("plan_id")] + [System.Text.Json.Serialization.JsonPropertyName("plan_id")] + public int? PlanId { get; set; } + + /// + /// 获取或设置签约协议号。 + /// + [Newtonsoft.Json.JsonProperty("contract_code")] + [System.Text.Json.Serialization.JsonPropertyName("contract_code")] + public string? Contract { get; set; } + + /// + /// 获取或设置委托代扣协议 ID。 + /// + [Newtonsoft.Json.JsonProperty("contract_id")] + [System.Text.Json.Serialization.JsonPropertyName("contract_id")] + public string? ContractId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/GetPAPPayContractResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/GetPAPPayContractResponse.cs new file mode 100644 index 00000000..1564c2a8 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/Contract/GetPAPPayContractResponse.cs @@ -0,0 +1,121 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /papay/querycontract 接口的响应。 + /// + public class GetPAPPayContractResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置用户的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string OpenId { get; set; } = default!; + + /// + /// 获取或设置用户在子商户下的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("sub_openid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_openid")] + public string? SubOpenId { get; set; } + + /// + /// 获取或设置模板 ID。 + /// + [Newtonsoft.Json.JsonProperty("plan_id")] + [System.Text.Json.Serialization.JsonPropertyName("plan_id")] + public int PlanId { get; set; } + + /// + /// 获取或设置签约协议号。 + /// + [Newtonsoft.Json.JsonProperty("contract_code")] + [System.Text.Json.Serialization.JsonPropertyName("contract_code")] + public string Contract { get; set; } = default!; + + /// + /// 获取或设置委托代扣协议 ID。 + /// + [Newtonsoft.Json.JsonProperty("contract_id")] + [System.Text.Json.Serialization.JsonPropertyName("contract_id")] + public string ContractId { get; set; } = default!; + + /// + /// 获取或设置请求序列号。 + /// + [Newtonsoft.Json.JsonProperty("request_serial")] + [System.Text.Json.Serialization.JsonPropertyName("request_serial")] + public long RequestSerialNumber { get; set; } + + /// + /// 获取或设置用户账户展示名称。 + /// + [Newtonsoft.Json.JsonProperty("contract_display_account")] + [System.Text.Json.Serialization.JsonPropertyName("contract_display_account")] + public string ContractDisplayAccount { get; set; } = default!; + + /// + /// 获取或设置协议状态。 + /// + [Newtonsoft.Json.JsonProperty("contract_state")] + [System.Text.Json.Serialization.JsonPropertyName("contract_state")] + public string ContractState { get; set; } = default!; + + /// + /// 获取或设置协议签署时间。 + /// + [Newtonsoft.Json.JsonProperty("contract_signed_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RegularDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("contract_signed_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RegularDateTimeOffsetConverter))] + public DateTimeOffset ContractSignTime { get; set; } = default!; + + /// + /// 获取或设置协议到期时间。 + /// + [Newtonsoft.Json.JsonProperty("contract_expired_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RegularDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("contract_expired_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RegularDateTimeOffsetConverter))] + public DateTimeOffset ContractExpireTime { get; set; } = default!; + + /// + /// 获取或设置协议解约方式。 + /// + [Newtonsoft.Json.JsonProperty("contract_termination_mode")] + [System.Text.Json.Serialization.JsonPropertyName("contract_termination_mode")] + public int? TerminationMode { get; set; } + + /// + /// 获取或设置协议解约备注。 + /// + [Newtonsoft.Json.JsonProperty("contract_termination_remark")] + [System.Text.Json.Serialization.JsonPropertyName("contract_termination_remark")] + public string? TerminationRemark { get; set; } + + /// + /// 获取或设置协议解约时间。 + /// + [Newtonsoft.Json.JsonProperty("contract_terminated_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RegularNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("contract_terminated_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RegularNullableDateTimeOffsetConverter))] + public DateTimeOffset? ContractTerminateTime { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/CreatePAPPayH5EntrustWebRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/CreatePAPPayH5EntrustWebRequest.cs new file mode 100644 index 00000000..2bda618a --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/CreatePAPPayH5EntrustWebRequest.cs @@ -0,0 +1,89 @@ +/* @codestyle-disable no-jsonable-property-in-request-get */ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [GET] /papay/h5entrustweb 接口的请求。 + /// + public class CreatePAPPayH5EntrustWebRequest : WechatTenpaySignableRequest + { + /// + /// 获取或设置接口版本号。 + /// 默认值:1.0 + /// + [Newtonsoft.Json.JsonProperty("version")] + [System.Text.Json.Serialization.JsonPropertyName("version")] + public string Version { get; set; } = "1.0"; + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置模板 ID。 + /// + [Newtonsoft.Json.JsonProperty("plan_id")] + [System.Text.Json.Serialization.JsonPropertyName("plan_id")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int PlanId { get; set; } + + /// + /// 获取或设置签约协议号。 + /// + [Newtonsoft.Json.JsonProperty("contract_code")] + [System.Text.Json.Serialization.JsonPropertyName("contract_code")] + public string ContractCode { get; set; } = string.Empty; + + /// + /// 获取或设置请求序列号。 + /// + [Newtonsoft.Json.JsonProperty("request_serial")] + [System.Text.Json.Serialization.JsonPropertyName("request_serial")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public long RequestSerialNumber { get; set; } + + /// + /// 获取或设置用户账户展示名称。 + /// + [Newtonsoft.Json.JsonProperty("contract_display_account")] + [System.Text.Json.Serialization.JsonPropertyName("contract_display_account")] + public string ContractDisplayAccount { get; set; } = string.Empty; + + /// + /// 获取或设置通知地址。 + /// + [Newtonsoft.Json.JsonProperty("notify_url")] + [System.Text.Json.Serialization.JsonPropertyName("notify_url")] + public string? NotifyUrl { get; set; } + + /// + /// 获取或设置时间戳。如果不指定将由系统自动生成。 + /// + [Newtonsoft.Json.JsonProperty("timestamp")] + [System.Text.Json.Serialization.JsonPropertyName("timestamp")] + public long? Timestamp { get; set; } + + /// + /// 获取或设置客户端 IP。 + /// + [Newtonsoft.Json.JsonProperty("clientip")] + [System.Text.Json.Serialization.JsonPropertyName("clientip")] + public string? ClientIp { get; set; } + + /// + /// 获取或设置回调应用的 AppId。 + /// + [Newtonsoft.Json.JsonProperty("return_appid")] + [System.Text.Json.Serialization.JsonPropertyName("return_appid")] + public string? ReturnAppId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/CreatePAPPayH5EntrustWebResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/CreatePAPPayH5EntrustWebResponse.cs new file mode 100644 index 00000000..566a74f0 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/CreatePAPPayH5EntrustWebResponse.cs @@ -0,0 +1,29 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [GET] /papay/h5entrustweb 接口的响应。 + /// + public class CreatePAPPayH5EntrustWebResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? AppId { get; set; } + + /// + /// 获取或设置签约页面 URL。 + /// + [Newtonsoft.Json.JsonProperty("redirect_url")] + [System.Text.Json.Serialization.JsonPropertyName("redirect_url")] + public string RedirectUrl { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/CreatePAPPayPreEntrustWebRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/CreatePAPPayPreEntrustWebRequest.cs new file mode 100644 index 00000000..3b9d8034 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/CreatePAPPayPreEntrustWebRequest.cs @@ -0,0 +1,83 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /papay/preentrustweb 接口的请求。 + /// + public class CreatePAPPayPreEntrustWebRequest : WechatTenpaySignableRequest + { + /// + /// 获取或设置接口版本号。 + /// 默认值:1.0 + /// + [Newtonsoft.Json.JsonProperty("version")] + [System.Text.Json.Serialization.JsonPropertyName("version")] + public string Version { get; set; } = "1.0"; + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置模板 ID。 + /// + [Newtonsoft.Json.JsonProperty("plan_id")] + [System.Text.Json.Serialization.JsonPropertyName("plan_id")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int PlanId { get; set; } + + /// + /// 获取或设置签约协议号。 + /// + [Newtonsoft.Json.JsonProperty("contract_code")] + [System.Text.Json.Serialization.JsonPropertyName("contract_code")] + public string ContractCode { get; set; } = string.Empty; + + /// + /// 获取或设置请求序列号。 + /// + [Newtonsoft.Json.JsonProperty("request_serial")] + [System.Text.Json.Serialization.JsonPropertyName("request_serial")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public long RequestSerialNumber { get; set; } + + /// + /// 获取或设置用户账户展示名称。 + /// + [Newtonsoft.Json.JsonProperty("contract_display_account")] + [System.Text.Json.Serialization.JsonPropertyName("contract_display_account")] + public string ContractDisplayAccount { get; set; } = string.Empty; + + /// + /// 获取或设置通知地址。 + /// + [Newtonsoft.Json.JsonProperty("notify_url")] + [System.Text.Json.Serialization.JsonPropertyName("notify_url")] + public string? NotifyUrl { get; set; } + + /// + /// 获取或设置时间戳。如果不指定将由系统自动生成。 + /// + [Newtonsoft.Json.JsonProperty("timestamp")] + [System.Text.Json.Serialization.JsonPropertyName("timestamp")] + public long? Timestamp { get; set; } + + /// + /// 获取或设置是否返回 App。 + /// + [Newtonsoft.Json.JsonProperty("return_app")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.YesOrNoNullableBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("return_app")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.YesOrNoNullableBooleanConverter))] + public bool? RequireReturnApp { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/CreatePAPPayPreEntrustWebResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/CreatePAPPayPreEntrustWebResponse.cs new file mode 100644 index 00000000..a02bb1f1 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAP/CreatePAPPayPreEntrustWebResponse.cs @@ -0,0 +1,31 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /papay/preentrustweb 接口的响应。 + /// + public class CreatePAPPayPreEntrustWebResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置预签约 ID。 + /// + [Newtonsoft.Json.JsonProperty("pre_entrustweb_id")] + [System.Text.Json.Serialization.JsonPropertyName("pre_entrustweb_id")] + public string PreEntrustWebId { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/Contract/ApplyPAPPayPartnerRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/Contract/ApplyPAPPayPartnerRequest.cs new file mode 100644 index 00000000..e7972cec --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/Contract/ApplyPAPPayPartnerRequest.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /pay/partner/pappayapply 接口的请求。 + /// + public class ApplyPAPPayPartnerRequest : ApplyPAPPayRequest + { + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string SubMerchantId { get; set; } = string.Empty; + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/Contract/ApplyPAPPayPartnerResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/Contract/ApplyPAPPayPartnerResponse.cs new file mode 100644 index 00000000..a67b624e --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/Contract/ApplyPAPPayPartnerResponse.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /pay/partner/pappayapply 接口的响应。 + /// + public class ApplyPAPPayPartnerResponse : ApplyPAPPayResponse + { + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string SubMerchantId { get; set; } = default!; + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/Contract/GetPAPPayPartnerContractRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/Contract/GetPAPPayPartnerContractRequest.cs new file mode 100644 index 00000000..5f777ae6 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/Contract/GetPAPPayPartnerContractRequest.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /papay/partner/querycontract 接口的请求。 + /// + public class GetPAPPayPartnerContractRequest : GetPAPPayContractRequest + { + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string SubMerchantId { get; set; } = string.Empty; + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/Contract/GetPAPPayPartnerContractResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/Contract/GetPAPPayPartnerContractResponse.cs new file mode 100644 index 00000000..fe24e32c --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/Contract/GetPAPPayPartnerContractResponse.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /papay/partner/querycontract 接口的响应。 + /// + public class GetPAPPayPartnerContractResponse : GetPAPPayContractResponse + { + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string SubMerchantId { get; set; } = default!; + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/CreatePAPPayPartnerH5EntrustWebRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/CreatePAPPayPartnerH5EntrustWebRequest.cs new file mode 100644 index 00000000..93b0b351 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/CreatePAPPayPartnerH5EntrustWebRequest.cs @@ -0,0 +1,72 @@ +/* @codestyle-disable no-jsonable-property-in-request-get */ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [GET] /papay/partner/h5entrustweb 接口的请求。 + /// + public class CreatePAPPayPartnerH5EntrustWebRequest : CreatePAPPayH5EntrustWebRequest + { + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置设备 ID。 + /// + [Newtonsoft.Json.JsonProperty("deviceid")] + [System.Text.Json.Serialization.JsonPropertyName("deviceid")] + public string? DeviceId { get; set; } + + /// + /// 获取或设置用户手机号码。 + /// + [Newtonsoft.Json.JsonProperty("mobile")] + [System.Text.Json.Serialization.JsonPropertyName("mobile")] + public string? UserMobile { get; set; } + + /// + /// 获取或设置用户邮箱地址。 + /// + [Newtonsoft.Json.JsonProperty("email")] + [System.Text.Json.Serialization.JsonPropertyName("email")] + public string? UserEmail { get; set; } + + /// + /// 获取或设置用户 QQ 号。 + /// + [Newtonsoft.Json.JsonProperty("qq")] + [System.Text.Json.Serialization.JsonPropertyName("qq")] + public string? UserQQ { get; set; } + + /// + /// 获取或设置用户的 OpenID。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string? OpenId { get; set; } + + /// + /// 获取或设置用户的身份证号。 + /// + [Newtonsoft.Json.JsonProperty("creid")] + [System.Text.Json.Serialization.JsonPropertyName("creid")] + public string? IDCardNumber { get; set; } + + /// + /// 获取或设置商户侧用户标识。 + /// + [Newtonsoft.Json.JsonProperty("outerid")] + [System.Text.Json.Serialization.JsonPropertyName("outerid")] + public string? OuterId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/CreatePAPPayPartnerH5EntrustWebResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/CreatePAPPayPartnerH5EntrustWebResponse.cs new file mode 100644 index 00000000..6a50e505 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/CreatePAPPayPartnerH5EntrustWebResponse.cs @@ -0,0 +1,9 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [GET] /papay/partner/h5entrustweb 接口的响应。 + /// + public class CreatePAPPayPartnerH5EntrustWebResponse : CreatePAPPayH5EntrustWebResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/CreatePAPPayPartnerPreEntrustWebRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/CreatePAPPayPartnerPreEntrustWebRequest.cs new file mode 100644 index 00000000..d0830b3c --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/CreatePAPPayPartnerPreEntrustWebRequest.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /papay/partner/preentrustweb 接口的请求。 + /// + public class CreatePAPPayPartnerPreEntrustWebRequest : CreatePAPPayPreEntrustWebRequest + { + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/CreatePAPPayPartnerPreEntrustWebResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/CreatePAPPayPartnerPreEntrustWebResponse.cs new file mode 100644 index 00000000..7a7fdc21 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PAPPartner/CreatePAPPayPartnerPreEntrustWebResponse.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /papay/partner/preentrustweb 接口的响应。 + /// + public class CreatePAPPayPartnerPreEntrustWebResponse : CreatePAPPayPreEntrustWebResponse + { + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/Bill/DownloadPayBillRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/Bill/DownloadPayBillRequest.cs new file mode 100644 index 00000000..8aea7837 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/Bill/DownloadPayBillRequest.cs @@ -0,0 +1,57 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /pay/downloadbill 接口的请求。 + /// + public class DownloadPayBillRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置账单日期(格式:yyyyMMdd)。 + /// + [Newtonsoft.Json.JsonProperty("bill_date")] + [System.Text.Json.Serialization.JsonPropertyName("bill_date")] + public string BillDateString { get; set; } = string.Empty; + + /// + /// 获取或设置账单类型。 + /// + [Newtonsoft.Json.JsonProperty("bill_type")] + [System.Text.Json.Serialization.JsonPropertyName("bill_type")] + public string? BillType { get; set; } + + /// + /// 获取或设置压缩方式。 + /// + [Newtonsoft.Json.JsonProperty("tar_type")] + [System.Text.Json.Serialization.JsonPropertyName("tar_type")] + public string? TarType { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/Bill/DownloadPayBillResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/Bill/DownloadPayBillResponse.cs new file mode 100644 index 00000000..ba27bc7d --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/Bill/DownloadPayBillResponse.cs @@ -0,0 +1,27 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /pay/downloadbill 接口的响应。 + /// + public class DownloadPayBillResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? AppId { get; set; } + + public override bool IsSuccessful() + { + return base.IsSuccessful() && RawBytes?.Length > 0; + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/Bill/DownloadPayFundFlowRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/Bill/DownloadPayFundFlowRequest.cs new file mode 100644 index 00000000..3b8bfa78 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/Bill/DownloadPayFundFlowRequest.cs @@ -0,0 +1,53 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /pay/downloadfundflow 接口的请求。 + /// + public class DownloadPayFundFlowRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置账单日期(格式:yyyyMMdd)。 + /// + [Newtonsoft.Json.JsonProperty("bill_date")] + [System.Text.Json.Serialization.JsonPropertyName("bill_date")] + public string BillDateString { get; set; } = string.Empty; + + /// + /// 获取或设置资金账户类型。 + /// + [Newtonsoft.Json.JsonProperty("account_type")] + [System.Text.Json.Serialization.JsonPropertyName("account_type")] + public string? AccountType { get; set; } + + /// + /// 获取或设置压缩方式。 + /// + [Newtonsoft.Json.JsonProperty("tar_type")] + [System.Text.Json.Serialization.JsonPropertyName("tar_type")] + public string? TarType { get; set; } + + /// + /// + /// 默认值: + /// + [Newtonsoft.Json.JsonProperty("sign_type")] + [System.Text.Json.Serialization.JsonPropertyName("sign_type")] +#pragma warning disable CS8765 + public override string SignType { get; set; } = Constants.SignTypes.HMAC_SHA256; +#pragma warning restore CS8765 + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/Bill/DownloadPayFundFlowResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/Bill/DownloadPayFundFlowResponse.cs new file mode 100644 index 00000000..28dec86f --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/Bill/DownloadPayFundFlowResponse.cs @@ -0,0 +1,27 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /pay/downloadfundflow 接口的响应。 + /// + public class DownloadPayFundFlowResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? AppId { get; set; } + + public override bool IsSuccessful() + { + return base.IsSuccessful() && RawBytes?.Length > 0; + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/ClosePayOrderRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/ClosePayOrderRequest.cs new file mode 100644 index 00000000..3912d3bf --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/ClosePayOrderRequest.cs @@ -0,0 +1,43 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /pay/closeorder 接口的请求。 + /// + public class ClosePayOrderRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/ClosePayOrderResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/ClosePayOrderResponse.cs new file mode 100644 index 00000000..b4949a06 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/ClosePayOrderResponse.cs @@ -0,0 +1,36 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /pay/closeorder 接口的响应。 + /// + public class ClosePayOrderResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayMicroPayRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayMicroPayRequest.cs index 8e37736f..f92887aa 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayMicroPayRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayMicroPayRequest.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models { @@ -10,132 +9,30 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models { public static class Types { - public class Detail + public class Detail : CreatePayUnifiedOrderRequest.Types.Detail { - public static class Types - { - public class GoodsDetail - { - /// - /// 获取或设置商户侧商品编码。 - /// - [Newtonsoft.Json.JsonProperty("goods_id")] - [System.Text.Json.Serialization.JsonPropertyName("goods_id")] - public string MerchantGoodsId { get; set; } = string.Empty; - - /// - /// 获取或设置微信侧商品编码。 - /// - [Newtonsoft.Json.JsonProperty("wxpay_goods_id")] - [System.Text.Json.Serialization.JsonPropertyName("wxpay_goods_id")] - public string? WechatpayGoodsId { get; set; } - - /// - /// 获取或设置商品分类。 - /// - [Newtonsoft.Json.JsonProperty("goods_category")] - [System.Text.Json.Serialization.JsonPropertyName("goods_category")] - public string? GoodsCategory { get; set; } - - /// - /// 获取或设置商品名称。 - /// - [Newtonsoft.Json.JsonProperty("goods_name")] - [System.Text.Json.Serialization.JsonPropertyName("goods_name")] - public string? GoodsName { get; set; } - - /// - /// 获取或设置商品数量。 - /// - [Newtonsoft.Json.JsonProperty("quantity")] - [System.Text.Json.Serialization.JsonPropertyName("quantity")] - public int Quantity { get; set; } - - /// - /// 获取或设置商品单价(单位:分)。 - /// - [Newtonsoft.Json.JsonProperty("price")] - [System.Text.Json.Serialization.JsonPropertyName("price")] - public int Price { get; set; } - - /// - /// 获取或设置商品描述。 - /// - [Newtonsoft.Json.JsonProperty("body")] - [System.Text.Json.Serialization.JsonPropertyName("body")] - public string? Body { get; set; } - } - } - - /// - /// 获取或设置订单原价(单位:分)。 - /// - [Newtonsoft.Json.JsonProperty("cost_price")] - [System.Text.Json.Serialization.JsonPropertyName("cost_price")] - public int? CostPrice { get; set; } - - /// - /// 获取或设置商品小票 ID。 - /// - [Newtonsoft.Json.JsonProperty("receipt_id")] - [System.Text.Json.Serialization.JsonPropertyName("receipt_id")] - public string? ReceiptId { get; set; } - - /// - /// 获取或设置单品列表。 - /// - [Newtonsoft.Json.JsonProperty("goods_detail")] - [System.Text.Json.Serialization.JsonPropertyName("goods_detail")] - public List? GoodsList { get; set; } } - public class Scene + public class Scene : CreatePayUnifiedOrderRequest.Types.Scene { - /// - /// 获取或设置门店编号。 - /// - [Newtonsoft.Json.JsonProperty("id")] - [System.Text.Json.Serialization.JsonPropertyName("id")] - public string StoreId { get; set; } = string.Empty; - - /// - /// 获取或设置门店名称。 - /// - [Newtonsoft.Json.JsonProperty("name")] - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string? StoreName { get; set; } - - /// - /// 获取或设置地区编码。 - /// - [Newtonsoft.Json.JsonProperty("area_code")] - [System.Text.Json.Serialization.JsonPropertyName("area_code")] - public string? StoreAreaCode { get; set; } - - /// - /// 获取或设置详细地址。 - /// - [Newtonsoft.Json.JsonProperty("address")] - [System.Text.Json.Serialization.JsonPropertyName("address")] - public string? StoreAddress { get; set; } } } internal static class Converters { - internal class ResponsePropertyDetailNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase + internal class RequestPropertyDetailNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase { } - internal class ResponsePropertyDetailSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase + internal class RequestPropertyDetailSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase { } - internal class ResponsePropertySceneNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase + internal class RequestPropertySceneNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase { } - internal class ResponsePropertySceneSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase + internal class RequestPropertySceneSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase { } } @@ -147,6 +44,20 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models [System.Text.Json.Serialization.JsonPropertyName("version")] public string? Version { get; set; } + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + /// /// 获取或设置子商户号。 /// @@ -180,6 +91,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models /// [Newtonsoft.Json.JsonProperty("total_fee")] [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] public int TotalFee { get; set; } /// @@ -253,18 +165,18 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models /// 获取或设置商品信息。 /// [Newtonsoft.Json.JsonProperty("detail")] - [Newtonsoft.Json.JsonConverter(typeof(Converters.ResponsePropertyDetailNewtonsoftJsonConverter))] + [Newtonsoft.Json.JsonConverter(typeof(Converters.RequestPropertyDetailNewtonsoftJsonConverter))] [System.Text.Json.Serialization.JsonPropertyName("detail")] - [System.Text.Json.Serialization.JsonConverter(typeof(Converters.ResponsePropertyDetailSystemTextJsonConverter))] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.RequestPropertyDetailSystemTextJsonConverter))] public Types.Detail? Detail { get; set; } /// /// 获取或设置场景信息。 /// [Newtonsoft.Json.JsonProperty("scene_info")] - [Newtonsoft.Json.JsonConverter(typeof(Converters.ResponsePropertySceneNewtonsoftJsonConverter))] + [Newtonsoft.Json.JsonConverter(typeof(Converters.RequestPropertySceneNewtonsoftJsonConverter))] [System.Text.Json.Serialization.JsonPropertyName("scene_info")] - [System.Text.Json.Serialization.JsonConverter(typeof(Converters.ResponsePropertySceneSystemTextJsonConverter))] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.RequestPropertySceneSystemTextJsonConverter))] public Types.Scene? Scene { get; set; } /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayMicroPayResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayMicroPayResponse.cs index 09ffd55c..a1190602 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayMicroPayResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayMicroPayResponse.cs @@ -27,6 +27,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models /// [Newtonsoft.Json.JsonProperty("quantity")] [System.Text.Json.Serialization.JsonPropertyName("quantity")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] public int Quantity { get; set; } /// @@ -34,6 +35,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models /// [Newtonsoft.Json.JsonProperty("price")] [System.Text.Json.Serialization.JsonPropertyName("price")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] public int Price { get; set; } /// @@ -41,6 +43,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models /// [Newtonsoft.Json.JsonProperty("discount_amount")] [System.Text.Json.Serialization.JsonPropertyName("discount_amount")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] public int DiscountAmount { get; set; } /// @@ -85,6 +88,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models /// [Newtonsoft.Json.JsonProperty("amount")] [System.Text.Json.Serialization.JsonPropertyName("amount")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] public int Amount { get; set; } /// @@ -99,6 +103,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models /// [Newtonsoft.Json.JsonProperty("wxpay_contribute")] [System.Text.Json.Serialization.JsonPropertyName("wxpay_contribute")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] public int? WechatpayContribute { get; set; } /// @@ -106,6 +111,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models /// [Newtonsoft.Json.JsonProperty("merchant_contribute")] [System.Text.Json.Serialization.JsonPropertyName("merchant_contribute")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] public int? MerchantContribute { get; set; } /// @@ -113,6 +119,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models /// [Newtonsoft.Json.JsonProperty("other_contribute")] [System.Text.Json.Serialization.JsonPropertyName("other_contribute")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] public int? OtherContribute { get; set; } /// @@ -135,6 +142,20 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models } } + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + /// /// 获取或设置子商户号。 /// @@ -191,6 +212,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models /// [Newtonsoft.Json.JsonProperty("total_fee")] [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] public int TotalFee { get; set; } /// @@ -205,6 +227,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models /// [Newtonsoft.Json.JsonProperty("settlement_total_fee")] [System.Text.Json.Serialization.JsonPropertyName("settlement_total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] public int? SettlementFee { get; set; } /// @@ -212,14 +235,16 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models /// [Newtonsoft.Json.JsonProperty("coupon_fee")] [System.Text.Json.Serialization.JsonPropertyName("coupon_fee")] - public int? FouponFee { get; set; } + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CouponFee { get; set; } /// /// 获取或设置现金支付金额(单位:分)。 /// [Newtonsoft.Json.JsonProperty("cash_fee")] [System.Text.Json.Serialization.JsonPropertyName("cash_fee")] - public int CashFee { get; set; } + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CashFee { get; set; } /// /// 获取或设置现金支付货币类型。 diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayRefundRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayRefundRequest.cs new file mode 100644 index 00000000..247a004f --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayRefundRequest.cs @@ -0,0 +1,101 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /secapi/pay/refund 接口的请求。 + /// + public class CreatePayRefundRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商户订单号。与字段 二选一。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string? OutTradeNumber { get; set; } + + /// + /// 获取或设置微信支付订单号。与字段 二选一。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string? TransactionId { get; set; } + + /// + /// 获取或设置商户退款单号。 + /// + [Newtonsoft.Json.JsonProperty("out_refund_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_refund_no")] + public string OutRefundNumber { get; set; } = string.Empty; + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置退款金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("refund_fee")] + [System.Text.Json.Serialization.JsonPropertyName("refund_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int RefundFee { get; set; } + + /// + /// 获取或设置货币类型。 + /// + [Newtonsoft.Json.JsonProperty("refund_fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("refund_fee_type")] + public string? RefundFeeType { get; set; } + + /// + /// 获取或设置退款原因。 + /// + [Newtonsoft.Json.JsonProperty("refund_desc")] + [System.Text.Json.Serialization.JsonPropertyName("refund_desc")] + public string? Description { get; set; } + + /// + /// 获取或设置通知地址。 + /// + [Newtonsoft.Json.JsonProperty("notify_url")] + [System.Text.Json.Serialization.JsonPropertyName("notify_url")] + public string? NotifyUrl { get; set; } + + /// + /// 获取或设置退款资金来源。 + /// + [Newtonsoft.Json.JsonProperty("refund_account")] + [System.Text.Json.Serialization.JsonPropertyName("refund_account")] + public string? RefundAccount { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayRefundResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayRefundResponse.cs new file mode 100644 index 00000000..8eb694d3 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayRefundResponse.cs @@ -0,0 +1,182 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /secapi/pay/refund 接口的响应。 + /// + [Newtonsoft.Json.JsonConverter(typeof(Converters.ResponseClassNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.ResponseClassSystemTextJsonConverter))] + public class CreatePayRefundResponse : WechatTenpaySignableResponse + { + public static class Types + { + public class Coupon + { + /// + /// 获取或设置代金券 ID。 + /// + [Newtonsoft.Json.JsonProperty("coupon_refund_id_$n")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_refund_id_$n")] + public string CouponId { get; set; } = default!; + + /// + /// 获取或设置代金券类型。 + /// + [Newtonsoft.Json.JsonProperty("coupon_type_$n")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_type_$n")] + public string CouponType { get; set; } = default!; + + /// + /// 获取或设置代金券金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("coupon_refund_fee_$n")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_refund_fee_$n")] + public int CouponFee { get; set; } + } + } + + internal static class Converters + { + internal class ResponseClassNewtonsoftJsonConverter : Newtonsoft.Json.Converters.FlattenNArrayObjectConverterBase + { + } + + internal class ResponseClassSystemTextJsonConverter : System.Text.Json.Converters.FlattenNArrayObjectConverterBase + { + } + } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = default!; + + /// + /// 获取或设置微信支付订单号。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string TransactionId { get; set; } = default!; + + /// + /// 获取或设置商户退款单号。 + /// + [Newtonsoft.Json.JsonProperty("out_refund_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_refund_no")] + public string OutRefundNumber { get; set; } = default!; + + /// + /// 获取或设置微信退款单号。 + /// + [Newtonsoft.Json.JsonProperty("refund_id")] + [System.Text.Json.Serialization.JsonPropertyName("refund_id")] + public string RefundId { get; set; } = default!; + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置货币类型。 + /// + [Newtonsoft.Json.JsonProperty("fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("fee_type")] + public string? FeeType { get; set; } + + /// + /// 获取或设置退款金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("refund_fee")] + [System.Text.Json.Serialization.JsonPropertyName("refund_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int RefundFee { get; set; } + + /// + /// 获取或设置应结订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("settlement_total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("settlement_total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? SettlementTotalFee { get; set; } + + /// + /// 获取或设置应结退款金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("settlement_refund_fee")] + [System.Text.Json.Serialization.JsonPropertyName("settlement_refund_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? SettlementRefundFee { get; set; } + + /// + /// 获取或设置代金券退款金额。 + /// + [Newtonsoft.Json.JsonProperty("coupon_refund_fee")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_refund_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CouponRefundFee { get; set; } + + /// + /// 获取或设置代金券退款数量。 + /// + [Newtonsoft.Json.JsonProperty("coupon_refund_count")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_refund_count")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CouponRefundCount { get; set; } + + /// + /// 获取或设置代金券退款列表。 + /// + [Newtonsoft.Json.JsonProperty(Newtonsoft.Json.Converters.FlattenNArrayObjectConverterBase.PROPERTY_NAME_NARRAY)] + [System.Text.Json.Serialization.JsonPropertyName(System.Text.Json.Converters.FlattenNArrayObjectConverterBase.PROPERTY_NAME_NARRAY)] + public Types.Coupon[]? CouponRefundList { get; set; } + + /// + /// 获取或设置现金支付金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("cash_fee")] + [System.Text.Json.Serialization.JsonPropertyName("cash_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CashFee { get; set; } + + /// + /// 获取或设置现金退款金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("cash_refund_fee")] + [System.Text.Json.Serialization.JsonPropertyName("cash_refund_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CashRefundFee { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayUnifiedOrderRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayUnifiedOrderRequest.cs new file mode 100644 index 00000000..3c5fed13 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayUnifiedOrderRequest.cs @@ -0,0 +1,340 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /pay/unifiedorder 接口的请求。 + /// + public class CreatePayUnifiedOrderRequest : WechatTenpaySignableRequest + { + public static class Types + { + public class Detail + { + public static class Types + { + public class GoodsDetail + { + /// + /// 获取或设置商户侧商品编码。 + /// + [Newtonsoft.Json.JsonProperty("goods_id")] + [System.Text.Json.Serialization.JsonPropertyName("goods_id")] + public string MerchantGoodsId { get; set; } = string.Empty; + + /// + /// 获取或设置微信侧商品编码。 + /// + [Newtonsoft.Json.JsonProperty("wxpay_goods_id")] + [System.Text.Json.Serialization.JsonPropertyName("wxpay_goods_id")] + public string? WechatpayGoodsId { get; set; } + + /// + /// 获取或设置商品分类。 + /// + [Newtonsoft.Json.JsonProperty("goods_category")] + [System.Text.Json.Serialization.JsonPropertyName("goods_category")] + public string? GoodsCategory { get; set; } + + /// + /// 获取或设置商品名称。 + /// + [Newtonsoft.Json.JsonProperty("goods_name")] + [System.Text.Json.Serialization.JsonPropertyName("goods_name")] + public string? GoodsName { get; set; } + + /// + /// 获取或设置商品数量。 + /// + [Newtonsoft.Json.JsonProperty("quantity")] + [System.Text.Json.Serialization.JsonPropertyName("quantity")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int Quantity { get; set; } + + /// + /// 获取或设置商品单价(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("price")] + [System.Text.Json.Serialization.JsonPropertyName("price")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int Price { get; set; } + + /// + /// 获取或设置商品描述。 + /// + [Newtonsoft.Json.JsonProperty("body")] + [System.Text.Json.Serialization.JsonPropertyName("body")] + public string? Body { get; set; } + } + } + + /// + /// 获取或设置订单原价(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("cost_price")] + [System.Text.Json.Serialization.JsonPropertyName("cost_price")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CostPrice { get; set; } + + /// + /// 获取或设置商品小票 ID。 + /// + [Newtonsoft.Json.JsonProperty("receipt_id")] + [System.Text.Json.Serialization.JsonPropertyName("receipt_id")] + public string? ReceiptId { get; set; } + + /// + /// 获取或设置单品列表。 + /// + [Newtonsoft.Json.JsonProperty("goods_detail")] + [System.Text.Json.Serialization.JsonPropertyName("goods_detail")] + public List? GoodsList { get; set; } + } + + public class Scene + { + public static class Types + { + public class Store + { + /// + /// 获取或设置门店编号。 + /// + [Newtonsoft.Json.JsonProperty("id")] + [System.Text.Json.Serialization.JsonPropertyName("id")] + public string Id { get; set; } = string.Empty; + + /// + /// 获取或设置门店名称。 + /// + [Newtonsoft.Json.JsonProperty("name")] + [System.Text.Json.Serialization.JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// 获取或设置地区编码。 + /// + [Newtonsoft.Json.JsonProperty("area_code")] + [System.Text.Json.Serialization.JsonPropertyName("area_code")] + public string? AreaCode { get; set; } + + /// + /// 获取或设置详细地址。 + /// + [Newtonsoft.Json.JsonProperty("address")] + [System.Text.Json.Serialization.JsonPropertyName("address")] + public string? Address { get; set; } + } + } + + /// + /// 获取或设置门店信息。 + /// + [Newtonsoft.Json.JsonProperty("store_info")] + [System.Text.Json.Serialization.JsonPropertyName("store_info")] + public Types.Store? Store { get; set; } + } + } + + internal static class Converters + { + internal class RequestPropertyDetailNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class RequestPropertyDetailSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class RequestPropertySceneNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class RequestPropertySceneSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商品描述。 + /// + [Newtonsoft.Json.JsonProperty("body")] + [System.Text.Json.Serialization.JsonPropertyName("body")] + public string Body { get; set; } = string.Empty; + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = string.Empty; + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置货币类型。 + /// + [Newtonsoft.Json.JsonProperty("fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("fee_type")] + public string? FeeType { get; set; } + + /// + /// 获取或设置用户的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string? OpenId { get; set; } + + /// + /// 获取或设置用户在子商户下的 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_openid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_openid")] + public string? SubOpenId { get; set; } + + /// + /// 获取或设置附加数据。 + /// + [Newtonsoft.Json.JsonProperty("attach")] + [System.Text.Json.Serialization.JsonPropertyName("attach")] + public string? Attachment { get; set; } + + /// + /// 获取或设置终端设备号。 + /// + [Newtonsoft.Json.JsonProperty("device_info")] + [System.Text.Json.Serialization.JsonPropertyName("device_info")] + public string? DeviceInfo { get; set; } + + /// + /// 获取或设置用户终端 IP。 + /// + [Newtonsoft.Json.JsonProperty("spbill_create_ip")] + [System.Text.Json.Serialization.JsonPropertyName("spbill_create_ip")] + public string ClientIp { get; set; } = string.Empty; + + /// + /// 获取或设置交易类型。 + /// + [Newtonsoft.Json.JsonProperty("trade_type")] + [System.Text.Json.Serialization.JsonPropertyName("trade_type")] + public string TradeType { get; set; } = string.Empty; + + /// + /// 获取或设置订单优惠标记。 + /// + [Newtonsoft.Json.JsonProperty("goods_tag")] + [System.Text.Json.Serialization.JsonPropertyName("goods_tag")] + public string? GoodsTag { get; set; } + + /// + /// 获取或设置通知地址。 + /// + [Newtonsoft.Json.JsonProperty("notify_url")] + [System.Text.Json.Serialization.JsonPropertyName("notify_url")] + public string? NotifyUrl { get; set; } + + /// + /// 获取或设置商品 ID。 + /// + [Newtonsoft.Json.JsonProperty("product_id")] + [System.Text.Json.Serialization.JsonPropertyName("product_id")] + public string? ProductId { get; set; } + + /// + /// 获取或设置指定付款方式编码。 + /// + [Newtonsoft.Json.JsonProperty("limit_pay")] + [System.Text.Json.Serialization.JsonPropertyName("limit_pay")] + public string? LimitPayCode { get; set; } + + /// + /// 获取或设置交易起始时间。 + /// + [Newtonsoft.Json.JsonProperty("time_start")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("time_start")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + public DateTimeOffset? StartTime { get; set; } + + /// + /// 获取或设置交易结束时间。 + /// + [Newtonsoft.Json.JsonProperty("time_expire")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("time_expire")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + public DateTimeOffset? ExpireTime { get; set; } + + /// + /// 获取或设置商品信息。 + /// + [Newtonsoft.Json.JsonProperty("detail")] + [Newtonsoft.Json.JsonConverter(typeof(Converters.RequestPropertyDetailNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonPropertyName("detail")] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.RequestPropertyDetailSystemTextJsonConverter))] + public Types.Detail? Detail { get; set; } + + /// + /// 获取或设置场景信息。 + /// + [Newtonsoft.Json.JsonProperty("scene_info")] + [Newtonsoft.Json.JsonConverter(typeof(Converters.RequestPropertySceneNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonPropertyName("scene_info")] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.RequestPropertySceneSystemTextJsonConverter))] + public Types.Scene? Scene { get; set; } + + /// + /// 获取或设置是否分账。 + /// + [Newtonsoft.Json.JsonProperty("profit_sharing")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.YesOrNoNullableBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("profit_sharing")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.YesOrNoNullableBooleanConverter))] + public bool? IsProfitSharing { get; set; } + + /// + /// 获取或设置是否开放电子发票入口。 + /// + [Newtonsoft.Json.JsonProperty("receipt")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.YesOrNoNullableBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("receipt")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.YesOrNoNullableBooleanConverter))] + public bool? IsReceiptOpen { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayUnifiedOrderResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayUnifiedOrderResponse.cs new file mode 100644 index 00000000..67389b1a --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/CreatePayUnifiedOrderResponse.cs @@ -0,0 +1,64 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /pay/unifiedorder 接口的响应。 + /// + public class CreatePayUnifiedOrderResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置终端设备号。 + /// + [Newtonsoft.Json.JsonProperty("device_info")] + [System.Text.Json.Serialization.JsonPropertyName("device_info")] + public string? DeviceInfo { get; set; } + + /// + /// 获取或设置交易类型。 + /// + [Newtonsoft.Json.JsonProperty("trade_type")] + [System.Text.Json.Serialization.JsonPropertyName("trade_type")] + public string TradeType { get; set; } = default!; + + /// + /// 获取或设置预支付交易会话标识。 + /// + [Newtonsoft.Json.JsonProperty("prepay_id")] + [System.Text.Json.Serialization.JsonPropertyName("prepay_id")] + public string PrepayId { get; set; } = default!; + + /// + /// 获取或设置二维码链接。 + /// + [Newtonsoft.Json.JsonProperty("code_url")] + [System.Text.Json.Serialization.JsonPropertyName("code_url")] + public string? CodeUrl { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/GetPayOrderRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/GetPayOrderRequest.cs new file mode 100644 index 00000000..11155d91 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/GetPayOrderRequest.cs @@ -0,0 +1,50 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /pay/orderquery 接口的请求。 + /// + public class GetPayOrderRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商户订单号。与字段 二选一。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string? OutTradeNumber { get; set; } + + /// + /// 获取或设置微信订单号。与字段 二选一。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string? TransactionId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/GetPayOrderResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/GetPayOrderResponse.cs new file mode 100644 index 00000000..065ad34c --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/GetPayOrderResponse.cs @@ -0,0 +1,307 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /pay/orderquery 接口的响应。 + /// + [Newtonsoft.Json.JsonConverter(typeof(Converters.ResponseClassNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.ResponseClassSystemTextJsonConverter))] + public class GetPayOrderResponse : WechatTenpaySignableResponse + { + public static class Types + { + public class Coupon + { + /// + /// 获取或设置代金券 ID。 + /// + [Newtonsoft.Json.JsonProperty("coupon_id_$n")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_id_$n")] + public string CouponId { get; set; } = default!; + + /// + /// 获取或设置代金券类型。 + /// + [Newtonsoft.Json.JsonProperty("coupon_type_$n")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_type_$n")] + public string CouponType { get; set; } = default!; + + /// + /// 获取或设置代金券金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("coupon_fee_$n")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_fee_$n")] + public int CouponFee { get; set; } + } + + public class Detail + { + public static class Types + { + public class DiscountDetail + { + /// + /// 获取或设置商品编码。 + /// + [Newtonsoft.Json.JsonProperty("goods_id")] + [System.Text.Json.Serialization.JsonPropertyName("goods_id")] + public string GoodsId { get; set; } = default!; + + /// + /// 获取或设置商品名称。 + /// + [Newtonsoft.Json.JsonProperty("goods_name")] + [System.Text.Json.Serialization.JsonPropertyName("goods_name")] + public string GoodsName { get; set; } = default!; + + /// + /// 获取或设置代金券批次 ID。 + /// + [Newtonsoft.Json.JsonProperty("coupon_batch_id")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_batch_id")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalStringConverter))] + public string CouponBatchId { get; set; } = default!; + + /// + /// 获取或设置代金券 ID。 + /// + [Newtonsoft.Json.JsonProperty("coupon_id")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_id")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalStringConverter))] + public string CouponId { get; set; } = default!; + + /// + /// 获取或设置代金券支付金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("coupon_fee")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int CouponFee { get; set; } + } + } + + /// + /// 获取或设置单品优惠列表。 + /// + [Newtonsoft.Json.JsonProperty("discount_detail")] + [System.Text.Json.Serialization.JsonPropertyName("discount_detail")] + public Types.DiscountDetail[]? DiscountList { get; set; } + } + } + + internal static class Converters + { + internal class ResponseClassNewtonsoftJsonConverter : Newtonsoft.Json.Converters.FlattenNArrayObjectConverterBase + { + } + + internal class ResponseClassSystemTextJsonConverter : System.Text.Json.Converters.FlattenNArrayObjectConverterBase + { + } + + internal class ResponsePropertyDetailNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class ResponsePropertyDetailSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置终端设备号。 + /// + [Newtonsoft.Json.JsonProperty("device_info")] + [System.Text.Json.Serialization.JsonPropertyName("device_info")] + public string? DeviceInfo { get; set; } + + /// + /// 获取或设置用户唯一标识。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string OpenId { get; set; } = default!; + + /// + /// 获取或设置用户是否订阅该公众号标识。 + /// + [Newtonsoft.Json.JsonProperty("is_subscribe")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.YesOrNoBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("is_subscribe")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.YesOrNoBooleanConverter))] + public bool IsSubscribed { get; set; } + + /// + /// 获取或设置用户在子商户下的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("sub_openid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_openid")] + public string? SubOpenId { get; set; } + + /// + /// 获取或设置用户是否订阅子商户公众号标识。 + /// + [Newtonsoft.Json.JsonProperty("sub_is_subscribe")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.YesOrNoNullableBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("sub_is_subscribe")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.YesOrNoNullableBooleanConverter))] + public bool? IsSubSubscribed { get; set; } + + /// + /// 获取或设置交易状态。 + /// + [Newtonsoft.Json.JsonProperty("trade_state")] + [System.Text.Json.Serialization.JsonPropertyName("trade_state")] + public string TradeState { get; set; } = default!; + + /// + /// 获取或设置交易状态描述。 + /// + [Newtonsoft.Json.JsonProperty("trade_state_desc")] + [System.Text.Json.Serialization.JsonPropertyName("trade_state_desc")] + public string TradeStateDescription { get; set; } = default!; + + /// + /// 获取或设置交易类型。 + /// + [Newtonsoft.Json.JsonProperty("trade_type")] + [System.Text.Json.Serialization.JsonPropertyName("trade_type")] + public string TradeType { get; set; } = default!; + + /// + /// 获取或设置付款银行。 + /// + [Newtonsoft.Json.JsonProperty("bank_type")] + [System.Text.Json.Serialization.JsonPropertyName("bank_type")] + public string BankType { get; set; } = default!; + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置货币类型。 + /// + [Newtonsoft.Json.JsonProperty("fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("fee_type")] + public string? FeeType { get; set; } + + /// + /// 获取或设置应结订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("settlement_total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("settlement_total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? SettlementFee { get; set; } + + /// + /// 获取或设置代金券金额。 + /// + [Newtonsoft.Json.JsonProperty("coupon_fee")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CouponFee { get; set; } + + /// + /// 获取或设置代金券使用数量。 + /// + [Newtonsoft.Json.JsonProperty("coupon_count")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_count")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CouponCount { get; set; } + + /// + /// 获取或设置代金券使用列表。 + /// + [Newtonsoft.Json.JsonProperty(Newtonsoft.Json.Converters.FlattenNArrayObjectConverterBase.PROPERTY_NAME_NARRAY)] + [System.Text.Json.Serialization.JsonPropertyName(System.Text.Json.Converters.FlattenNArrayObjectConverterBase.PROPERTY_NAME_NARRAY)] + public Types.Coupon[]? CouponList { get; set; } + + /// + /// 获取或设置现金支付金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("cash_fee")] + [System.Text.Json.Serialization.JsonPropertyName("cash_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CashFee { get; set; } + + /// + /// 获取或设置现金支付货币类型。 + /// + [Newtonsoft.Json.JsonProperty("cash_fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("cash_fee_type")] + public string? CashFeeType { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = default!; + + /// + /// 获取或设置微信支付订单号。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string TransactionId { get; set; } = default!; + + /// + /// 获取或设置附加数据。 + /// + [Newtonsoft.Json.JsonProperty("attach")] + [System.Text.Json.Serialization.JsonPropertyName("attach")] + public string? Attachment { get; set; } + + /// + /// 获取或设置支付完成时间。 + /// + [Newtonsoft.Json.JsonProperty("time_end")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("time_end")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + public DateTimeOffset? EndTime { get; set; } + + /// + /// 获取或设置商品信息。 + /// + [Newtonsoft.Json.JsonProperty("detail")] + [Newtonsoft.Json.JsonConverter(typeof(Converters.ResponsePropertyDetailNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonPropertyName("detail")] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.ResponsePropertyDetailSystemTextJsonConverter))] + public Types.Detail? Detail { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/GetPayRefundRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/GetPayRefundRequest.cs new file mode 100644 index 00000000..b2f10762 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/GetPayRefundRequest.cs @@ -0,0 +1,71 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /pay/refundquery 接口的请求。 + /// + public class GetPayRefundRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商户订单号。与字段 四选一。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string? OutTradeNumber { get; set; } + + /// + /// 获取或设置微信支付订单号。与字段 四选一。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string? TransactionId { get; set; } + + /// + /// 获取或设置商户退款单号。与字段 四选一。 + /// + [Newtonsoft.Json.JsonProperty("out_refund_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_refund_no")] + public string? OutRefundNumber { get; set; } + + /// + /// 获取或设置微信退款单号。与字段 四选一。 + /// + [Newtonsoft.Json.JsonProperty("refund_id")] + [System.Text.Json.Serialization.JsonPropertyName("refund_id")] + public string? RefundId { get; set; } + + /// + /// 获取或设置分页起始位置。 + /// + [Newtonsoft.Json.JsonProperty("offset")] + [System.Text.Json.Serialization.JsonPropertyName("offset")] + public int? Offset { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/GetPayRefundResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/GetPayRefundResponse.cs new file mode 100644 index 00000000..59f1f0fa --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/GetPayRefundResponse.cs @@ -0,0 +1,192 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /pay/refundquery 接口的响应。 + /// + [Newtonsoft.Json.JsonConverter(typeof(Converters.ResponseClassNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.ResponseClassSystemTextJsonConverter))] + public class GetPayRefundResponse : WechatTenpaySignableResponse + { + public static class Types + { + public class Refund + { + /// + /// 获取或设置商户退款单号。 + /// + [Newtonsoft.Json.JsonProperty("out_refund_no_$n")] + [System.Text.Json.Serialization.JsonPropertyName("out_refund_no_$n")] + public string OutRefundId { get; set; } = default!; + + /// + /// 获取或设置微信退款单号。 + /// + [Newtonsoft.Json.JsonProperty("refund_id_$n")] + [System.Text.Json.Serialization.JsonPropertyName("refund_id_$n")] + public string RefundId { get; set; } = default!; + + /// + /// 获取或设置退款渠道。 + /// + [Newtonsoft.Json.JsonProperty("refund_channel_$n")] + [System.Text.Json.Serialization.JsonPropertyName("refund_channel_$n")] + public string? RefundChannel { get; set; } + + /// + /// 获取或设置退款状态。 + /// + [Newtonsoft.Json.JsonProperty("refund_status_$n")] + [System.Text.Json.Serialization.JsonPropertyName("refund_status_$n")] + public string RefundStatus { get; set; } = default!; + + /// + /// 获取或设置退款资金来源。 + /// + [Newtonsoft.Json.JsonProperty("refund_account_$n")] + [System.Text.Json.Serialization.JsonPropertyName("refund_account_$n")] + public string? RefundAccount { get; set; } + + /// + /// 获取或设置退款入账账户。 + /// + [Newtonsoft.Json.JsonProperty("refund_recv_accout_$n")] + [System.Text.Json.Serialization.JsonPropertyName("refund_recv_accout_$n")] + public string? RefundReceiveAccount { get; set; } + + /// + /// 获取或设置退款金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("refund_fee_$n")] + [System.Text.Json.Serialization.JsonPropertyName("refund_fee_$n")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int RefundFee { get; set; } + + /// + /// 获取或设置应结退款金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("settlement_refund_fee_$n")] + [System.Text.Json.Serialization.JsonPropertyName("settlement_refund_fee_$n")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? SettlementRefundFee { get; set; } + + /// + /// 获取或设置代金券退款金额。 + /// + [Newtonsoft.Json.JsonProperty("coupon_refund_fee_$n")] + [System.Text.Json.Serialization.JsonPropertyName("coupon_refund_fee_$n")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CouponRefundFee { get; set; } + + /// + /// 获取或设置退款成功时间。 + /// + [Newtonsoft.Json.JsonProperty("refund_success_time_$n")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("refund_success_time_$n")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + public DateTimeOffset? SuccessTime { get; set; } + } + } + + internal static class Converters + { + internal class ResponseClassNewtonsoftJsonConverter : Newtonsoft.Json.Converters.FlattenNArrayObjectConverterBase + { + } + + internal class ResponseClassSystemTextJsonConverter : System.Text.Json.Converters.FlattenNArrayObjectConverterBase + { + } + } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = default!; + + /// + /// 获取或设置微信支付订单号。 + /// + [Newtonsoft.Json.JsonProperty("transaction_id")] + [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] + public string TransactionId { get; set; } = default!; + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置货币类型。 + /// + [Newtonsoft.Json.JsonProperty("fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("fee_type")] + public string? FeeType { get; set; } + + /// + /// 获取或设置应结订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("settlement_total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("settlement_total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? SettlementTotalFee { get; set; } + + /// + /// 获取或设置现金支付金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("cash_fee")] + [System.Text.Json.Serialization.JsonPropertyName("cash_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CashFee { get; set; } + + /// + /// 获取或设置记录列表。 + /// + [Newtonsoft.Json.JsonProperty(Newtonsoft.Json.Converters.FlattenNArrayObjectConverterBase.PROPERTY_NAME_NARRAY)] + [System.Text.Json.Serialization.JsonPropertyName(System.Text.Json.Converters.FlattenNArrayObjectConverterBase.PROPERTY_NAME_NARRAY)] + public Types.Refund[] RefundList { get; set; } = default!; + + /// + /// 获取或设置记录总数。 + /// + [Newtonsoft.Json.JsonProperty("total_refund_count")] + [System.Text.Json.Serialization.JsonPropertyName("total_refund_count")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalRefundCount { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/ReversePayOrderRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/ReversePayOrderRequest.cs new file mode 100644 index 00000000..b89fb3c5 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/ReversePayOrderRequest.cs @@ -0,0 +1,43 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /secapi/pay/reverse 接口的请求。 + /// + public class ReversePayOrderRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/ReversePayOrderResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/ReversePayOrderResponse.cs new file mode 100644 index 00000000..742a02fc --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Pay/ReversePayOrderResponse.cs @@ -0,0 +1,45 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /secapi/pay/reverse 接口的响应。 + /// + public class ReversePayOrderResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置是否需要重调。 + /// + [Newtonsoft.Json.JsonProperty("recall")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.YesOrNoBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("recall")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.YesOrNoBooleanConverter))] + public bool RequireRecall { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayITIL/SubmitPayITILReportRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayITIL/SubmitPayITILReportRequest.cs index 0c7f7338..5fcb7f16 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayITIL/SubmitPayITILReportRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayITIL/SubmitPayITILReportRequest.cs @@ -64,6 +64,20 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models } } + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + /// /// 获取或设置终端设备号。 /// @@ -79,12 +93,61 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models public string UserIp { get; set; } = string.Empty; /// - /// 获取或设置订单优惠标记。 + /// 获取或设置接口 URL。 /// [Newtonsoft.Json.JsonProperty("interface_url")] [System.Text.Json.Serialization.JsonPropertyName("interface_url")] public string InterfaceUrl { get; set; } = string.Empty; + /// + /// 获取或设置接口耗时(单位:毫秒)。 + /// + [Newtonsoft.Json.JsonProperty("execute_time_")] + [System.Text.Json.Serialization.JsonPropertyName("execute_time_")] + public int? InterfaceCostTime { get; set; } + + /// + /// 获取或设置接口返回状态码。 + /// + [Newtonsoft.Json.JsonProperty("return_code")] + [System.Text.Json.Serialization.JsonPropertyName("return_code")] + public string? ReturnCode { get; set; } + + /// + /// 获取或设置接口返回状态码描述。 + /// + [Newtonsoft.Json.JsonProperty("return_msg")] + [System.Text.Json.Serialization.JsonPropertyName("return_msg")] + public string? ReturnMessage { get; set; } + + /// + /// 获取或设置接口业务结果。 + /// + [Newtonsoft.Json.JsonProperty("result_code")] + [System.Text.Json.Serialization.JsonPropertyName("result_code")] + public string? ResultCode { get; set; } + + /// + /// 获取或设置接口错误代码。 + /// + [Newtonsoft.Json.JsonProperty("err_code")] + [System.Text.Json.Serialization.JsonPropertyName("err_code")] + public string? ErrorCode { get; set; } + + /// + /// 获取或设置接口错误代码描述。 + /// + [Newtonsoft.Json.JsonProperty("err_code_des")] + [System.Text.Json.Serialization.JsonPropertyName("err_code_des")] + public string? ErrorCodeDescription { get; set; } + + /// + /// 获取或设置上报的商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string? OutTradeNumber { get; set; } + /// /// 获取或设置上报交易数据列表。 /// @@ -92,6 +155,15 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models [Newtonsoft.Json.JsonConverter(typeof(Converters.ResponsePropertyTradeListNewtonsoftJsonConverter))] [System.Text.Json.Serialization.JsonPropertyName("trades")] [System.Text.Json.Serialization.JsonConverter(typeof(Converters.ResponsePropertyTradeListSystemTextJsonConverter))] - public IList TradeList { get; set; } = new List(); + public IList? TradeList { get; set; } + + /// + /// 获取或设置商户上报时间。 + /// + [Newtonsoft.Json.JsonProperty("time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + public DateTimeOffset? ReportTime { get; set; } } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayITIL/SubmitPayITILReportResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayITIL/SubmitPayITILReportResponse.cs index 728e1a87..5d1302ab 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayITIL/SubmitPayITILReportResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayITIL/SubmitPayITILReportResponse.cs @@ -1,270 +1,22 @@ -using System; - -namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models { /// /// 表示 [POST] /payitil/report 接口的响应。 /// public class SubmitPayITILReportResponse : WechatTenpaySignableResponse { - public static class Types - { - public class Promotion - { - public static class Types - { - public class GoodsDetail - { - /// - /// 获取或设置商品编码。 - /// - [Newtonsoft.Json.JsonProperty("goods_id")] - [System.Text.Json.Serialization.JsonPropertyName("goods_id")] - public string GoodsId { get; set; } = default!; - - /// - /// 获取或设置商品数量。 - /// - [Newtonsoft.Json.JsonProperty("quantity")] - [System.Text.Json.Serialization.JsonPropertyName("quantity")] - public int Quantity { get; set; } - - /// - /// 获取或设置商品单价(单位:分)。 - /// - [Newtonsoft.Json.JsonProperty("price")] - [System.Text.Json.Serialization.JsonPropertyName("price")] - public int Price { get; set; } - - /// - /// 获取或设置商品优惠金额(单位:分)。 - /// - [Newtonsoft.Json.JsonProperty("discount_amount")] - [System.Text.Json.Serialization.JsonPropertyName("discount_amount")] - public int DiscountAmount { get; set; } - - /// - /// 获取或设置商品备注。 - /// - [Newtonsoft.Json.JsonProperty("goods_remark")] - [System.Text.Json.Serialization.JsonPropertyName("goods_remark")] - public string? GoodsRemark { get; set; } - } - } - - /// - /// 获取或设置券或者立减优惠 ID。 - /// - [Newtonsoft.Json.JsonProperty("promotion_id")] - [System.Text.Json.Serialization.JsonPropertyName("promotion_id")] - public string PromotionId { get; set; } = default!; - - /// - /// 获取或设置优惠名称。 - /// - [Newtonsoft.Json.JsonProperty("name")] - [System.Text.Json.Serialization.JsonPropertyName("name")] - public string? Name { get; set; } - - /// - /// 获取或设置优惠范围。 - /// - [Newtonsoft.Json.JsonProperty("scope")] - [System.Text.Json.Serialization.JsonPropertyName("scope")] - public string? Scope { get; set; } - - /// - /// 获取或设置优惠类型。 - /// - [Newtonsoft.Json.JsonProperty("type")] - [System.Text.Json.Serialization.JsonPropertyName("type")] - public string? Type { get; set; } - - /// - /// 获取或设置优惠券面额(单位:分)。 - /// - [Newtonsoft.Json.JsonProperty("amount")] - [System.Text.Json.Serialization.JsonPropertyName("amount")] - public int Amount { get; set; } - - /// - /// 获取或设置活动 ID。 - /// - [Newtonsoft.Json.JsonProperty("activity_id")] - [System.Text.Json.Serialization.JsonPropertyName("activity_id")] - public string? ActivityId { get; set; } - - /// - /// 获取或设置微信出资(单位:分)。 - /// - [Newtonsoft.Json.JsonProperty("wxpay_contribute")] - [System.Text.Json.Serialization.JsonPropertyName("wxpay_contribute")] - public int? WechatpayContribute { get; set; } - - /// - /// 获取或设置商户出资(单位:分)。 - /// - [Newtonsoft.Json.JsonProperty("merchant_contribute")] - [System.Text.Json.Serialization.JsonPropertyName("merchant_contribute")] - public int? MerchantContribute { get; set; } - - /// - /// 获取或设置其他出资(单位:分)。 - /// - [Newtonsoft.Json.JsonProperty("other_contribute")] - [System.Text.Json.Serialization.JsonPropertyName("other_contribute")] - public int? OtherContribute { get; set; } - - /// - /// 获取或设置单品列表。 - /// - [Newtonsoft.Json.JsonProperty("goods_detail")] - [System.Text.Json.Serialization.JsonPropertyName("goods_detail")] - public Types.GoodsDetail[]? GoodsList { get; set; } - } - } - - internal static class Converters - { - internal class ResponsePropertyPromotionListNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase - { - } - - internal class ResponsePropertyPromotionListSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase - { - } - } + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? MerchantId { get; set; } /// - /// 获取或设置子商户号。 + /// /// - [Newtonsoft.Json.JsonProperty("sub_mch_id")] - [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] - public string? SubMerchantId { get; set; } - - /// - /// 获取或设置子商户 AppId。 - /// - [Newtonsoft.Json.JsonProperty("sub_appid")] - [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] - public string? SubAppId { get; set; } - - /// - /// 获取或设置终端设备号。 - /// - [Newtonsoft.Json.JsonProperty("device_info")] - [System.Text.Json.Serialization.JsonPropertyName("device_info")] - public string? DeviceInfo { get; set; } - - /// - /// 获取或设置用户唯一标识。 - /// - [Newtonsoft.Json.JsonProperty("openid")] - [System.Text.Json.Serialization.JsonPropertyName("openid")] - public string OpenId { get; set; } = default!; - - /// - /// 获取或设置用户是否订阅该公众号标识。 - /// - [Newtonsoft.Json.JsonProperty("is_subscribe")] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.YesOrNoBooleanConverter))] - [System.Text.Json.Serialization.JsonPropertyName("is_subscribe")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.YesOrNoBooleanConverter))] - public bool IsSubscribed { get; set; } - - /// - /// 获取或设置交易类型。 - /// - [Newtonsoft.Json.JsonProperty("trade_type")] - [System.Text.Json.Serialization.JsonPropertyName("trade_type")] - public string TradeType { get; set; } = default!; - - /// - /// 获取或设置付款银行。 - /// - [Newtonsoft.Json.JsonProperty("bank_type")] - [System.Text.Json.Serialization.JsonPropertyName("bank_type")] - public string BankType { get; set; } = default!; - - /// - /// 获取或设置订单金额(单位:分)。 - /// - [Newtonsoft.Json.JsonProperty("total_fee")] - [System.Text.Json.Serialization.JsonPropertyName("total_fee")] - public int TotalFee { get; set; } - - /// - /// 获取或设置货币类型。 - /// - [Newtonsoft.Json.JsonProperty("fee_type")] - [System.Text.Json.Serialization.JsonPropertyName("fee_type")] - public string? FeeType { get; set; } - - /// - /// 获取或设置应结订单金额(单位:分)。 - /// - [Newtonsoft.Json.JsonProperty("settlement_total_fee")] - [System.Text.Json.Serialization.JsonPropertyName("settlement_total_fee")] - public int? SettlementFee { get; set; } - - /// - /// 获取或设置代金券金额。 - /// - [Newtonsoft.Json.JsonProperty("coupon_fee")] - [System.Text.Json.Serialization.JsonPropertyName("coupon_fee")] - public int? FouponFee { get; set; } - - /// - /// 获取或设置现金支付金额(单位:分)。 - /// - [Newtonsoft.Json.JsonProperty("cash_fee")] - [System.Text.Json.Serialization.JsonPropertyName("cash_fee")] - public int CashFee { get; set; } - - /// - /// 获取或设置现金支付货币类型。 - /// - [Newtonsoft.Json.JsonProperty("cash_fee_type")] - [System.Text.Json.Serialization.JsonPropertyName("cash_fee_type")] - public string? CashFeeType { get; set; } - - /// - /// 获取或设置商户订单号。 - /// - [Newtonsoft.Json.JsonProperty("out_trade_no")] - [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] - public string OutTradeNumber { get; set; } = default!; - - /// - /// 获取或设置微信支付订单号。 - /// - [Newtonsoft.Json.JsonProperty("transaction_id")] - [System.Text.Json.Serialization.JsonPropertyName("transaction_id")] - public string TransactionId { get; set; } = default!; - - /// - /// 获取或设置附加数据。 - /// - [Newtonsoft.Json.JsonProperty("attach")] - [System.Text.Json.Serialization.JsonPropertyName("attach")] - public string? Attachment { get; set; } - - /// - /// 获取或设置支付完成时间。 - /// - [Newtonsoft.Json.JsonProperty("time_end")] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] - [System.Text.Json.Serialization.JsonPropertyName("time_end")] - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] - public DateTimeOffset? EndTime { get; set; } - - /// - /// 获取或设置优惠信息。 - /// - [Newtonsoft.Json.JsonProperty("promotion_detail")] - [Newtonsoft.Json.JsonConverter(typeof(Converters.ResponsePropertyPromotionListNewtonsoftJsonConverter))] - [System.Text.Json.Serialization.JsonPropertyName("promotion_detail")] - [System.Text.Json.Serialization.JsonConverter(typeof(Converters.ResponsePropertyPromotionListSystemTextJsonConverter))] - public Types.Promotion[]? PromotionList { get; set; } + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? AppId { get; set; } } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/GetPayMarketingTransfersRedPackInfoRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/GetPayMarketingTransfersRedPackInfoRequest.cs new file mode 100644 index 00000000..e671fd7d --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/GetPayMarketingTransfersRedPackInfoRequest.cs @@ -0,0 +1,37 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /mmpaymkttransfers/gethbinfo 接口的请求。 + /// + public class GetPayMarketingTransfersRedPackInfoRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("mch_billno")] + [System.Text.Json.Serialization.JsonPropertyName("mch_billno")] + public string MerchantBillId { get; set; } = string.Empty; + + /// + /// 获取或设置订单类型。 + /// 默认值:MCHT + /// + [Newtonsoft.Json.JsonProperty("bill_type")] + [System.Text.Json.Serialization.JsonPropertyName("bill_type")] + public string BillType { get; set; } = "MCHT"; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/GetPayMarketingTransfersRedPackInfoResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/GetPayMarketingTransfersRedPackInfoResponse.cs new file mode 100644 index 00000000..d3a2d2e1 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/GetPayMarketingTransfersRedPackInfoResponse.cs @@ -0,0 +1,177 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /mmpaymkttransfers/gethbinfo 接口的响应。 + /// + public class GetPayMarketingTransfersRedPackInfoResponse : WechatTenpaySignableResponse + { + public static class Types + { + public class ReceiverList + { + /// + /// 获取或设置红包领取列表。 + /// + [Newtonsoft.Json.JsonProperty("hbinfo")] + [System.Text.Json.Serialization.JsonPropertyName("hbinfo")] + public ReceiverItem[] Items { get; set; } = default!; + } + + public class ReceiverItem + { + /// + /// 获取或设置用户的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string OpenId { get; set; } = default!; + + /// + /// 获取或设置金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("amount")] + [System.Text.Json.Serialization.JsonPropertyName("amount")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int Amount { get; set; } + + /// + /// 获取或设置领取时间。 + /// + [Newtonsoft.Json.JsonProperty("rcv_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RegularDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("rcv_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RegularDateTimeOffsetConverter))] + public DateTimeOffset ReceiveTime { get; set; } + } + } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置商户定单号。 + /// + [Newtonsoft.Json.JsonProperty("mch_billno")] + [System.Text.Json.Serialization.JsonPropertyName("mch_billno")] + public string PartnerTradeNumber { get; set; } = default!; + + /// + /// 获取或设置微信红包订单号。 + /// + [Newtonsoft.Json.JsonProperty("detail_id")] + [System.Text.Json.Serialization.JsonPropertyName("detail_id")] + public string PaymentNumber { get; set; } = default!; + + /// + /// 获取或设置转账状态。 + /// + [Newtonsoft.Json.JsonProperty("status")] + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } = default!; + + /// + /// 获取或设置发放类型。 + /// + [Newtonsoft.Json.JsonProperty("send_type")] + [System.Text.Json.Serialization.JsonPropertyName("send_type")] + public string SendType { get; set; } = default!; + + /// + /// 获取或设置红包类型。 + /// + [Newtonsoft.Json.JsonProperty("hb_type")] + [System.Text.Json.Serialization.JsonPropertyName("hb_type")] + public string RedPackType { get; set; } = default!; + + /// + /// 获取或设置红包金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_amount")] + [System.Text.Json.Serialization.JsonPropertyName("total_amount")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalAmount { get; set; } + + /// + /// 获取或设置红包数量。 + /// 默认值:1 + /// + [Newtonsoft.Json.JsonProperty("total_num")] + [System.Text.Json.Serialization.JsonPropertyName("total_num")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalCount { get; set; } = 1; + + /// + /// 获取或设置红包祝福语。 + /// + [Newtonsoft.Json.JsonProperty("wishing")] + [System.Text.Json.Serialization.JsonPropertyName("wishing")] + public string? Wishing { get; set; } + + /// + /// 获取或设置活动名称。 + /// + [Newtonsoft.Json.JsonProperty("act_name")] + [System.Text.Json.Serialization.JsonPropertyName("act_name")] + public string? ActivityName { get; set; } + + /// + /// 获取或设置备注。 + /// + [Newtonsoft.Json.JsonProperty("remark")] + [System.Text.Json.Serialization.JsonPropertyName("remark")] + public string? Remark { get; set; } + + /// + /// 获取或设置红包发送时间。 + /// + [Newtonsoft.Json.JsonProperty("send_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RegularDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("send_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RegularDateTimeOffsetConverter))] + public DateTimeOffset SendTime { get; set; } + + /// + /// 获取或设置红包退款时间。 + /// + [Newtonsoft.Json.JsonProperty("refund_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RegularNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("refund_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RegularNullableDateTimeOffsetConverter))] + public DateTimeOffset? RefundTime { get; set; } + + /// + /// 获取或设置红包退款金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("refund_amount")] + [System.Text.Json.Serialization.JsonPropertyName("refund_amount")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int RefundAmount { get; set; } + + /// + /// 获取或设置失败原因。 + /// + [Newtonsoft.Json.JsonProperty("reason")] + [System.Text.Json.Serialization.JsonPropertyName("reason")] + public string? FailReason { get; set; } + + /// + /// 获取或设置红包领取列表。 + /// + [Newtonsoft.Json.JsonProperty("hblist")] + [System.Text.Json.Serialization.JsonPropertyName("hblist")] + public Types.ReceiverList ReceiverList { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersGroupRedPackRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersGroupRedPackRequest.cs new file mode 100644 index 00000000..318e7f01 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersGroupRedPackRequest.cs @@ -0,0 +1,124 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /mmpaymkttransfers/sendgroupredpack 接口的请求。 + /// + public class SendPayMarketingTransfersGroupRedPackRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("wxappid")] + [System.Text.Json.Serialization.JsonPropertyName("wxappid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("msgappid")] + [System.Text.Json.Serialization.JsonPropertyName("msgappid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("mch_billno")] + [System.Text.Json.Serialization.JsonPropertyName("mch_billno")] + public string MerchantBillNumber { get; set; } = string.Empty; + + /// + /// 获取或设置接受红包的种子用户 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("re_openid")] + [System.Text.Json.Serialization.JsonPropertyName("re_openid")] + public string OpenId { get; set; } = string.Empty; + + /// + /// 获取或设置红包发送者名称。 + /// + [Newtonsoft.Json.JsonProperty("send_name")] + [System.Text.Json.Serialization.JsonPropertyName("send_name")] + public string? SenderName { get; set; } + + /// + /// 获取或设置红包金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_amount")] + [System.Text.Json.Serialization.JsonPropertyName("total_amount")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalAmount { get; set; } + + /// + /// 获取或设置红包数量。 + /// 默认值:1 + /// + [Newtonsoft.Json.JsonProperty("total_num")] + [System.Text.Json.Serialization.JsonPropertyName("total_num")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalCount { get; set; } = 1; + + /// + /// 获取或设置红包金额设置方式。 + /// 默认值:ALL_RAND + /// + [Newtonsoft.Json.JsonProperty("amt_type")] + [System.Text.Json.Serialization.JsonPropertyName("amt_type")] + public string AmountType { get; set; } = "ALL_RAND"; + + /// + /// 获取或设置红包祝福语。 + /// + [Newtonsoft.Json.JsonProperty("wishing")] + [System.Text.Json.Serialization.JsonPropertyName("wishing")] + public string? Wishing { get; set; } + + /// + /// 获取或设置用户终端 IP。 + /// + [Newtonsoft.Json.JsonProperty("client_ip")] + [System.Text.Json.Serialization.JsonPropertyName("client_ip")] + public string ClientIp { get; set; } = string.Empty; + + /// + /// 获取或设置活动名称。 + /// + [Newtonsoft.Json.JsonProperty("act_name")] + [System.Text.Json.Serialization.JsonPropertyName("act_name")] + public string? ActivityName { get; set; } + + /// + /// 获取或设置备注。 + /// + [Newtonsoft.Json.JsonProperty("remark")] + [System.Text.Json.Serialization.JsonPropertyName("remark")] + public string? Remark { get; set; } + + /// + /// 获取或设置场景 ID。 + /// + [Newtonsoft.Json.JsonProperty("scene_id")] + [System.Text.Json.Serialization.JsonPropertyName("scene_id")] + public string? SceneId { get; set; } + + /// + /// 获取或设置活动风控信息。 + /// + [Newtonsoft.Json.JsonProperty("risk_info")] + [System.Text.Json.Serialization.JsonPropertyName("risk_info")] + public string? RiskInfo { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersGroupRedPackResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersGroupRedPackResponse.cs new file mode 100644 index 00000000..8a7ee656 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersGroupRedPackResponse.cs @@ -0,0 +1,58 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /mmpaymkttransfers/sendgroupredpack 接口的响应。 + /// + public class SendPayMarketingTransfersGroupRedPackResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("wxappid")] + [System.Text.Json.Serialization.JsonPropertyName("wxappid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("mch_billno")] + [System.Text.Json.Serialization.JsonPropertyName("mch_billno")] + public string MerchantBillNumber { get; set; } = default!; + + /// + /// 获取或设置商户付款单号。 + /// + [Newtonsoft.Json.JsonProperty("partner_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("partner_trade_no")] + public string PartnerTradeNumber { get; set; } = default!; + + /// + /// 获取或设置接受红包的种子用户 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("re_openid")] + [System.Text.Json.Serialization.JsonPropertyName("re_openid")] + public string OpenId { get; set; } = default!; + + /// + /// 获取或设置红包金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_amount")] + [System.Text.Json.Serialization.JsonPropertyName("total_amount")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalAmount { get; set; } + + /// + /// 获取或设置微信红包订单号。 + /// + [Newtonsoft.Json.JsonProperty("send_listid")] + [System.Text.Json.Serialization.JsonPropertyName("send_listid")] + public string PaymentNumber { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersMiniProgramRedPackRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersMiniProgramRedPackRequest.cs new file mode 100644 index 00000000..a581744a --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersMiniProgramRedPackRequest.cs @@ -0,0 +1,96 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /mmpaymkttransfers/sendminiprogramhb 接口的请求。 + /// + public class SendPayMarketingTransfersMiniProgramRedPackRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("wxappid")] + [System.Text.Json.Serialization.JsonPropertyName("wxappid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("mch_billno")] + [System.Text.Json.Serialization.JsonPropertyName("mch_billno")] + public string MerchantBillNumber { get; set; } = string.Empty; + + /// + /// 获取或设置接受红包的用户 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("re_openid")] + [System.Text.Json.Serialization.JsonPropertyName("re_openid")] + public string OpenId { get; set; } = string.Empty; + + /// + /// 获取或设置红包发送者名称。 + /// + [Newtonsoft.Json.JsonProperty("send_name")] + [System.Text.Json.Serialization.JsonPropertyName("send_name")] + public string? SenderName { get; set; } + + /// + /// 获取或设置红包金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_amount")] + [System.Text.Json.Serialization.JsonPropertyName("total_amount")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalAmount { get; set; } + + /// + /// 获取或设置红包数量。 + /// 默认值:1 + /// + [Newtonsoft.Json.JsonProperty("total_num")] + [System.Text.Json.Serialization.JsonPropertyName("total_num")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalCount { get; set; } = 1; + + /// + /// 获取或设置红包祝福语。 + /// + [Newtonsoft.Json.JsonProperty("wishing")] + [System.Text.Json.Serialization.JsonPropertyName("wishing")] + public string? Wishing { get; set; } + + /// + /// 获取或设置活动名称。 + /// + [Newtonsoft.Json.JsonProperty("act_name")] + [System.Text.Json.Serialization.JsonPropertyName("act_name")] + public string? ActivityName { get; set; } + + /// + /// 获取或设置备注。 + /// + [Newtonsoft.Json.JsonProperty("remark")] + [System.Text.Json.Serialization.JsonPropertyName("remark")] + public string? Remark { get; set; } + + /// + /// 获取或设置场景 ID。 + /// + [Newtonsoft.Json.JsonProperty("scene_id")] + [System.Text.Json.Serialization.JsonPropertyName("scene_id")] + public string? SceneId { get; set; } + + /// + /// 获取或设置通知用户形式。 + /// 默认值:MINI_PROGRAM_JSAPI + /// + [Newtonsoft.Json.JsonProperty("notify_way")] + [System.Text.Json.Serialization.JsonPropertyName("notify_way")] + public string NotifyWay { get; set; } = "MINI_PROGRAM_JSAPI"; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersMiniProgramRedPackResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersMiniProgramRedPackResponse.cs new file mode 100644 index 00000000..0d35a038 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersMiniProgramRedPackResponse.cs @@ -0,0 +1,58 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /mmpaymkttransfers/sendminiprogramhb 接口的响应。 + /// + public class SendPayMarketingTransfersMiniProgramRedPackResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("wxappid")] + [System.Text.Json.Serialization.JsonPropertyName("wxappid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("mch_billno")] + [System.Text.Json.Serialization.JsonPropertyName("mch_billno")] + public string MerchantBillNumber { get; set; } = default!; + + /// + /// 获取或设置接受红包的用户 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("re_openid")] + [System.Text.Json.Serialization.JsonPropertyName("re_openid")] + public string OpenId { get; set; } = default!; + + /// + /// 获取或设置红包金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_amount")] + [System.Text.Json.Serialization.JsonPropertyName("total_amount")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalAmount { get; set; } + + /// + /// 获取或设置微信红包订单号。 + /// + [Newtonsoft.Json.JsonProperty("send_listid")] + [System.Text.Json.Serialization.JsonPropertyName("send_listid")] + public string PaymentNumber { get; set; } = default!; + + /// + /// 获取或设置 JSAPI 参数。 + /// + [Newtonsoft.Json.JsonProperty("package")] + [System.Text.Json.Serialization.JsonPropertyName("package")] + public string PackageString { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersRedPackRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersRedPackRequest.cs new file mode 100644 index 00000000..af482d3b --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersRedPackRequest.cs @@ -0,0 +1,116 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /mmpaymkttransfers/sendredpack 接口的请求。 + /// + public class SendPayMarketingTransfersRedPackRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("wxappid")] + [System.Text.Json.Serialization.JsonPropertyName("wxappid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("msgappid")] + [System.Text.Json.Serialization.JsonPropertyName("msgappid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("mch_billno")] + [System.Text.Json.Serialization.JsonPropertyName("mch_billno")] + public string MerchantBillNumber { get; set; } = string.Empty; + + /// + /// 获取或设置接受红包的用户 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("re_openid")] + [System.Text.Json.Serialization.JsonPropertyName("re_openid")] + public string OpenId { get; set; } = string.Empty; + + /// + /// 获取或设置红包发送者名称。 + /// + [Newtonsoft.Json.JsonProperty("send_name")] + [System.Text.Json.Serialization.JsonPropertyName("send_name")] + public string? SenderName { get; set; } + + /// + /// 获取或设置红包金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_amount")] + [System.Text.Json.Serialization.JsonPropertyName("total_amount")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalAmount { get; set; } + + /// + /// 获取或设置红包数量。 + /// 默认值:1 + /// + [Newtonsoft.Json.JsonProperty("total_num")] + [System.Text.Json.Serialization.JsonPropertyName("total_num")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalCount { get; set; } = 1; + + /// + /// 获取或设置红包祝福语。 + /// + [Newtonsoft.Json.JsonProperty("wishing")] + [System.Text.Json.Serialization.JsonPropertyName("wishing")] + public string? Wishing { get; set; } + + /// + /// 获取或设置用户终端 IP。 + /// + [Newtonsoft.Json.JsonProperty("client_ip")] + [System.Text.Json.Serialization.JsonPropertyName("client_ip")] + public string ClientIp { get; set; } = string.Empty; + + /// + /// 获取或设置活动名称。 + /// + [Newtonsoft.Json.JsonProperty("act_name")] + [System.Text.Json.Serialization.JsonPropertyName("act_name")] + public string? ActivityName { get; set; } + + /// + /// 获取或设置备注。 + /// + [Newtonsoft.Json.JsonProperty("remark")] + [System.Text.Json.Serialization.JsonPropertyName("remark")] + public string? Remark { get; set; } + + /// + /// 获取或设置场景 ID。 + /// + [Newtonsoft.Json.JsonProperty("scene_id")] + [System.Text.Json.Serialization.JsonPropertyName("scene_id")] + public string? SceneId { get; set; } + + /// + /// 获取或设置活动风控信息。 + /// + [Newtonsoft.Json.JsonProperty("risk_info")] + [System.Text.Json.Serialization.JsonPropertyName("risk_info")] + public string? RiskInfo { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersRedPackResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersRedPackResponse.cs new file mode 100644 index 00000000..89d5bdd4 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersRedPack/SendPayMarketingTransfersRedPackResponse.cs @@ -0,0 +1,51 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /mmpaymkttransfers/sendredpack 接口的响应。 + /// + public class SendPayMarketingTransfersRedPackResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("wxappid")] + [System.Text.Json.Serialization.JsonPropertyName("wxappid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("mch_billno")] + [System.Text.Json.Serialization.JsonPropertyName("mch_billno")] + public string MerchantBillNumber { get; set; } = default!; + + /// + /// 获取或设置接受红包的用户 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("re_openid")] + [System.Text.Json.Serialization.JsonPropertyName("re_openid")] + public string OpenId { get; set; } = default!; + + /// + /// 获取或设置红包金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_amount")] + [System.Text.Json.Serialization.JsonPropertyName("total_amount")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalAmount { get; set; } + + /// + /// 获取或设置微信红包订单号。 + /// + [Newtonsoft.Json.JsonProperty("send_listid")] + [System.Text.Json.Serialization.JsonPropertyName("send_listid")] + public string PaymentNumber { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersTransfer/CreatePayMarketingTransfersPromotionTransferRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersTransfer/CreatePayMarketingTransfersPromotionTransferRequest.cs new file mode 100644 index 00000000..19204159 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersTransfer/CreatePayMarketingTransfersPromotionTransferRequest.cs @@ -0,0 +1,102 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /mmpaymkttransfers/promotion/transfers 接口的请求。 + /// + public class CreatePayMarketingTransfersPromotionTransferRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mchid")] + [System.Text.Json.Serialization.JsonPropertyName("mchid")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_appid")] + [System.Text.Json.Serialization.JsonPropertyName("mch_appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置商户付款单号。 + /// + [Newtonsoft.Json.JsonProperty("partner_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("partner_trade_no")] + public string PartnerTradeNumber { get; set; } = string.Empty; + + /// + /// 获取或设置用户的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string OpenId { get; set; } = string.Empty; + + /// + /// 获取或设置终端设备号。 + /// + [Newtonsoft.Json.JsonProperty("device_info")] + [System.Text.Json.Serialization.JsonPropertyName("device_info")] + public string? DeviceInfo { get; set; } + + /// + /// 获取或设置金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("amount")] + [System.Text.Json.Serialization.JsonPropertyName("amount")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int Amount { get; set; } + + /// + /// 获取或设置备注。 + /// + [Newtonsoft.Json.JsonProperty("desc")] + [System.Text.Json.Serialization.JsonPropertyName("desc")] + public string? Description { get; set; } + + /// + /// 获取或设置校验用户姓名选项。 + /// 默认值:FORCE_CHECK + /// + [Newtonsoft.Json.JsonProperty("check_name")] + [System.Text.Json.Serialization.JsonPropertyName("check_name")] + public string CheckNameType { get; set; } = "FORCE_CHECK"; + + /// + /// 获取或设置收款用户姓名。 + /// + [Newtonsoft.Json.JsonProperty("re_user_name")] + [System.Text.Json.Serialization.JsonPropertyName("re_user_name")] + public string? UserName { get; set; } + + /// + /// 获取或设置用户终端 IP。 + /// + [Newtonsoft.Json.JsonProperty("spbill_create_ip")] + [System.Text.Json.Serialization.JsonPropertyName("spbill_create_ip")] + public string ClientIp { get; set; } = string.Empty; + + /// + /// 获取或设置付款场景。 + /// + [Newtonsoft.Json.JsonProperty("scene")] + [System.Text.Json.Serialization.JsonPropertyName("scene")] + public string? Scene { get; set; } + + /// + /// 获取或设置品牌 ID。 + /// + [Newtonsoft.Json.JsonProperty("brand_id")] + [System.Text.Json.Serialization.JsonPropertyName("brand_id")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? BrandId { get; set; } + + /// + /// 获取或设置消息模板 ID。 + /// + [Newtonsoft.Json.JsonProperty("finder_template_id")] + [System.Text.Json.Serialization.JsonPropertyName("finder_template_id")] + public string? FinderTemplateId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersTransfer/CreatePayMarketingTransfersPromotionTransferResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersTransfer/CreatePayMarketingTransfersPromotionTransferResponse.cs new file mode 100644 index 00000000..e88b909e --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersTransfer/CreatePayMarketingTransfersPromotionTransferResponse.cs @@ -0,0 +1,54 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /mmpaymkttransfers/promotion/transfers 接口的响应。 + /// + public class CreatePayMarketingTransfersPromotionTransferResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mchid")] + [System.Text.Json.Serialization.JsonPropertyName("mchid")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_appid")] + [System.Text.Json.Serialization.JsonPropertyName("mch_appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置商户付款单号。 + /// + [Newtonsoft.Json.JsonProperty("partner_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("partner_trade_no")] + public string PartnerTradeNumber { get; set; } = default!; + + /// + /// 获取或设置微信付款单号。 + /// + [Newtonsoft.Json.JsonProperty("payment_no")] + [System.Text.Json.Serialization.JsonPropertyName("payment_no")] + public string PaymentNumber { get; set; } = default!; + + /// + /// 获取或设置付款成功时间。 + /// + [Newtonsoft.Json.JsonProperty("payment_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RegularNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("payment_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RegularNullableDateTimeOffsetConverter))] + public DateTimeOffset? SuccessTime { get; set; } + + /// + /// 获取或设置终端设备号。 + /// + [Newtonsoft.Json.JsonProperty("device_info")] + [System.Text.Json.Serialization.JsonPropertyName("device_info")] + public string? DeviceInfo { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersTransfer/GetPayMarketingTransfersTransferInfoRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersTransfer/GetPayMarketingTransfersTransferInfoRequest.cs new file mode 100644 index 00000000..08e23789 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersTransfer/GetPayMarketingTransfersTransferInfoRequest.cs @@ -0,0 +1,29 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /mmpaymkttransfers/gettransferinfo 接口的请求。 + /// + public class GetPayMarketingTransfersTransferInfoRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置商户付款单号。 + /// + [Newtonsoft.Json.JsonProperty("partner_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("partner_trade_no")] + public string PartnerTradeNumber { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersTransfer/GetPayMarketingTransfersTransferInfoResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersTransfer/GetPayMarketingTransfersTransferInfoResponse.cs new file mode 100644 index 00000000..a88ed0a5 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayMarketingTransfersTransfer/GetPayMarketingTransfersTransferInfoResponse.cs @@ -0,0 +1,99 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /mmpaymkttransfers/gettransferinfo 接口的响应。 + /// + public class GetPayMarketingTransfersTransferInfoResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置商户付款单号。 + /// + [Newtonsoft.Json.JsonProperty("partner_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("partner_trade_no")] + public string PartnerTradeNumber { get; set; } = default!; + + /// + /// 获取或设置微信付款单号。 + /// + [Newtonsoft.Json.JsonProperty("detail_id")] + [System.Text.Json.Serialization.JsonPropertyName("detail_id")] + public string PaymentNumber { get; set; } = default!; + + /// + /// 获取或设置金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("payment_amount")] + [System.Text.Json.Serialization.JsonPropertyName("payment_amount")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int Amount { get; set; } + + /// + /// 获取或设置终端设备号。 + /// + [Newtonsoft.Json.JsonProperty("desc")] + [System.Text.Json.Serialization.JsonPropertyName("desc")] + public string? Description { get; set; } + + /// + /// 获取或设置用户的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string OpenId { get; set; } = default!; + + /// + /// 获取或设置收款用户姓名。 + /// + [Newtonsoft.Json.JsonProperty("transfer_name")] + [System.Text.Json.Serialization.JsonPropertyName("transfer_name")] + public string? UserName { get; set; } + + /// + /// 获取或设置转账状态。 + /// + [Newtonsoft.Json.JsonProperty("status")] + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } = default!; + + /// + /// 获取或设置转账时间。 + /// + [Newtonsoft.Json.JsonProperty("transfer_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RegularDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("transfer_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RegularDateTimeOffsetConverter))] + public DateTimeOffset TransferTime { get; set; } + + /// + /// 获取或设置付款成功时间。 + /// + [Newtonsoft.Json.JsonProperty("payment_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RegularNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("payment_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RegularNullableDateTimeOffsetConverter))] + public DateTimeOffset? SuccessTime { get; set; } + + /// + /// 获取或设置失败原因。 + /// + [Newtonsoft.Json.JsonProperty("reason")] + [System.Text.Json.Serialization.JsonPropertyName("reason")] + public string? FailReason { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayServicePartnerTransfers/CreatePayServicePartnerTransfersPayToBankRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayServicePartnerTransfers/CreatePayServicePartnerTransfersPayToBankRequest.cs new file mode 100644 index 00000000..23bb3192 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayServicePartnerTransfers/CreatePayServicePartnerTransfersPayToBankRequest.cs @@ -0,0 +1,65 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /mmpaysptrans/pay_bank 接口的请求。 + /// + public class CreatePayServicePartnerTransfersPayToBankRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? AppId { get; set; } + + /// + /// 获取或设置商户付款单号。 + /// + [Newtonsoft.Json.JsonProperty("partner_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("partner_trade_no")] + public string PartnerTradeNumber { get; set; } = string.Empty; + + /// + /// 获取或设置金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("amount")] + [System.Text.Json.Serialization.JsonPropertyName("amount")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int Amount { get; set; } + + /// + /// 获取或设置备注。 + /// + [Newtonsoft.Json.JsonProperty("desc")] + [System.Text.Json.Serialization.JsonPropertyName("desc")] + public string? Description { get; set; } + + /// + /// 获取或设置收款方银行卡号(需使用平台提供的 RSA 公钥加密)。 + /// + [Newtonsoft.Json.JsonProperty("enc_bank_no")] + [System.Text.Json.Serialization.JsonPropertyName("enc_bank_no")] + public string EncryptedBankNumber { get; set; } = string.Empty; + + /// + /// 获取或设置收款方用户名(需使用平台提供的 RSA 公钥加密)。 + /// + [Newtonsoft.Json.JsonProperty("enc_true_name")] + [System.Text.Json.Serialization.JsonPropertyName("enc_true_name")] + public string EncryptedUserName { get; set; } = string.Empty; + + /// + /// 获取或设置收款方开户行。 + /// + [Newtonsoft.Json.JsonProperty("bank_code")] + [System.Text.Json.Serialization.JsonPropertyName("bank_code")] + public string BankCode { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayServicePartnerTransfers/CreatePayServicePartnerTransfersPayToBankResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayServicePartnerTransfers/CreatePayServicePartnerTransfersPayToBankResponse.cs new file mode 100644 index 00000000..7b1f4b26 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayServicePartnerTransfers/CreatePayServicePartnerTransfersPayToBankResponse.cs @@ -0,0 +1,52 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /mmpaysptrans/pay_bank 接口的响应。 + /// + public class CreatePayServicePartnerTransfersPayToBankResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? AppId { get; set; } + + /// + /// 获取或设置商户付款单号。 + /// + [Newtonsoft.Json.JsonProperty("partner_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("partner_trade_no")] + public string PartnerTradeNumber { get; set; } = default!; + + /// + /// 获取或设置金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("amount")] + [System.Text.Json.Serialization.JsonPropertyName("amount")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int Amount { get; set; } + + /// + /// 获取或设置微信付款单号。 + /// + [Newtonsoft.Json.JsonProperty("payment_no")] + [System.Text.Json.Serialization.JsonPropertyName("payment_no")] + public string PaymentNumber { get; set; } = default!; + + /// + /// 获取或设置手续费金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("cmms_amt")] + [System.Text.Json.Serialization.JsonPropertyName("cmms_amt")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int CMMSAmount { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayServicePartnerTransfers/GetPayServicePartnerTransfersPayToBankInfoRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayServicePartnerTransfers/GetPayServicePartnerTransfersPayToBankInfoRequest.cs new file mode 100644 index 00000000..1b04080d --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayServicePartnerTransfers/GetPayServicePartnerTransfersPayToBankInfoRequest.cs @@ -0,0 +1,29 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /mmpaysptrans/query_bank 接口的请求。 + /// + public class GetPayServicePartnerTransfersPayToBankInfoRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? AppId { get; set; } + + /// + /// 获取或设置商户付款单号。 + /// + [Newtonsoft.Json.JsonProperty("partner_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("partner_trade_no")] + public string PartnerTradeNumber { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayServicePartnerTransfers/GetPayServicePartnerTransfersPayToBankInfoResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayServicePartnerTransfers/GetPayServicePartnerTransfersPayToBankInfoResponse.cs new file mode 100644 index 00000000..1ee5746c --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/PayServicePartnerTransfers/GetPayServicePartnerTransfersPayToBankInfoResponse.cs @@ -0,0 +1,100 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /mmpaysptrans/query_bank 接口的响应。 + /// + public class GetPayServicePartnerTransfersPayToBankInfoResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? AppId { get; set; } + + /// + /// 获取或设置商户付款单号。 + /// + [Newtonsoft.Json.JsonProperty("partner_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("partner_trade_no")] + public string PartnerTradeNumber { get; set; } = default!; + + /// + /// 获取或设置金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("amount")] + [System.Text.Json.Serialization.JsonPropertyName("amount")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int Amount { get; set; } + + /// + /// 获取或设置微信付款单号。 + /// + [Newtonsoft.Json.JsonProperty("payment_no")] + [System.Text.Json.Serialization.JsonPropertyName("payment_no")] + public string PaymentNumber { get; set; } = default!; + + /// + /// 获取或设置收款方银行卡号的 MD5 哈希值。 + /// + [Newtonsoft.Json.JsonProperty("bank_no_md5")] + [System.Text.Json.Serialization.JsonPropertyName("bank_no_md5")] + public string BankNumberMD5Value { get; set; } = default!; + + /// + /// 获取或设置收款方用户名的 MD5 哈希值。 + /// + [Newtonsoft.Json.JsonProperty("true_name_md5")] + [System.Text.Json.Serialization.JsonPropertyName("true_name_md5")] + public string UserNameMD5Value { get; set; } = default!; + + /// + /// 获取或设置手续费金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("cmms_amt")] + [System.Text.Json.Serialization.JsonPropertyName("cmms_amt")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int CMMSAmount { get; set; } + + /// + /// 获取或设置转账状态。 + /// + [Newtonsoft.Json.JsonProperty("status")] + [System.Text.Json.Serialization.JsonPropertyName("status")] + public string Status { get; set; } = default!; + + /// + /// 获取或设置下单时间。 + /// + [Newtonsoft.Json.JsonProperty("create_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RegularDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("create_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RegularDateTimeOffsetConverter))] + public DateTimeOffset CreateTime { get; set; } + + /// + /// 获取或设置转账成功时间。 + /// + [Newtonsoft.Json.JsonProperty("pay_succ_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RegularNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("pay_succ_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RegularNullableDateTimeOffsetConverter))] + public DateTimeOffset? SuccessTime { get; set; } + + /// + /// 获取或设置失败原因。 + /// + [Newtonsoft.Json.JsonProperty("reason")] + [System.Text.Json.Serialization.JsonPropertyName("reason")] + public string? FailReason { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Risk/QueryRiskViolationRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Risk/QueryRiskViolationRequest.cs new file mode 100644 index 00000000..238fc433 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Risk/QueryRiskViolationRequest.cs @@ -0,0 +1,75 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /risk/getviolation 接口的请求。 + /// + public class QueryRiskViolationRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? AppId { get; set; } + + /// + /// 获取或设置开始时间。 + /// + [Newtonsoft.Json.JsonProperty("begin_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RegularDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("begin_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RegularDateTimeOffsetConverter))] + public DateTimeOffset BeginTime { get; set; } + + /// + /// 获取或设置结束时间。 + /// + [Newtonsoft.Json.JsonProperty("end_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RegularDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("end_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RegularDateTimeOffsetConverter))] + public DateTimeOffset EndTime { get; set; } + + /// + /// 获取或设置分页每页数量。 + /// 默认值:10 + /// + [Newtonsoft.Json.JsonProperty("page_size")] + [System.Text.Json.Serialization.JsonPropertyName("page_size")] + public int PageSize { get; set; } = 10; + + /// + /// 获取或设置分页页码。 + /// 默认值:1 + /// + [Newtonsoft.Json.JsonProperty("page_index")] + [System.Text.Json.Serialization.JsonPropertyName("page_index")] + public int PageNumber { get; set; } = 1; + + /// + /// (使用默认值即可,无需修改) + /// + [Newtonsoft.Json.JsonProperty("violation_records_format")] + [System.Text.Json.Serialization.JsonPropertyName("violation_records_format")] + public string Format { get; set; } = "json"; + + /// + /// + /// 默认值: + /// + [Newtonsoft.Json.JsonProperty("sign_type")] + [System.Text.Json.Serialization.JsonPropertyName("sign_type")] +#pragma warning disable CS8765 + public override string SignType { get; set; } = Constants.SignTypes.HMAC_SHA256; +#pragma warning restore CS8765 + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Risk/QueryRiskViolationResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Risk/QueryRiskViolationResponse.cs new file mode 100644 index 00000000..9591e432 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Risk/QueryRiskViolationResponse.cs @@ -0,0 +1,111 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /risk/getviolation 接口的响应。 + /// + public class QueryRiskViolationResponse : WechatTenpaySignableResponse + { + public static class Types + { + public class ViolationList + { + /// + /// 获取或设置违规记录列表。 + /// + [Newtonsoft.Json.JsonProperty("violation_records")] + [System.Text.Json.Serialization.JsonPropertyName("violation_records")] + public ViolationItem[] Items { get; set; } = default!; + + /// + /// 获取或设置违规记录总数量。 + /// + [Newtonsoft.Json.JsonProperty("total_size")] + [System.Text.Json.Serialization.JsonPropertyName("total_size")] + public int TotalCount { get; set; } + } + + public class ViolationItem + { + /// + /// 获取或设置特约商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string SubMerchantId { get; set; } = default!; + + /// + /// 获取或设置公司名称。 + /// + [Newtonsoft.Json.JsonProperty("company_name")] + [System.Text.Json.Serialization.JsonPropertyName("company_name")] + public string CompanyName { get; set; } = default!; + + /// + /// 获取或设置违规类型。 + /// + [Newtonsoft.Json.JsonProperty("illegal_type")] + [System.Text.Json.Serialization.JsonPropertyName("illegal_type")] + public string IllegalType { get; set; } = default!; + + /// + /// 获取或设置处理方式。 + /// + [Newtonsoft.Json.JsonProperty("handle_method")] + [System.Text.Json.Serialization.JsonPropertyName("handle_method")] + public string HandleMethod { get; set; } = default!; + + /// + /// 获取或设置处理状态。 + /// + [Newtonsoft.Json.JsonProperty("handle_state")] + [System.Text.Json.Serialization.JsonPropertyName("handle_state")] + public string HandleState { get; set; } = default!; + + /// + /// 获取或设置处罚时间。 + /// + [Newtonsoft.Json.JsonProperty("punish_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RegularDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("punish_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RegularDateTimeOffsetConverter))] + public DateTimeOffset PunishTime { get; set; } + } + } + + internal static class Converters + { + internal class ResponsePropertyViolationListNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class ResponsePropertyViolationListSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + } + + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? AppId { get; set; } + + /// + /// 获取或设置违规记录列表。 + /// + [Newtonsoft.Json.JsonProperty("violation_records")] + [Newtonsoft.Json.JsonConverter(typeof(Converters.ResponsePropertyViolationListNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonPropertyName("violation_records")] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.ResponsePropertyViolationListSystemTextJsonConverter))] + public Types.ViolationList ViolationList { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/SubMerchant/AddSubMerchantDevelopConfigRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/SubMerchant/AddSubMerchantDevelopConfigRequest.cs new file mode 100644 index 00000000..5539dddd --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/SubMerchant/AddSubMerchantDevelopConfigRequest.cs @@ -0,0 +1,43 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /secapi/mch/addsubdevconfig 接口的请求。 + /// + public class AddSubMerchantDevelopConfigRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置特约商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置关联 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置授权目录。 + /// + [Newtonsoft.Json.JsonProperty("jsapi_path")] + [System.Text.Json.Serialization.JsonPropertyName("jsapi_path")] + public string? JsapiPath { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/SubMerchant/AddSubMerchantDevelopConfigResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/SubMerchant/AddSubMerchantDevelopConfigResponse.cs new file mode 100644 index 00000000..0a36c503 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/SubMerchant/AddSubMerchantDevelopConfigResponse.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /secapi/mch/addsubdevconfig 接口的响应。 + /// + public class AddSubMerchantDevelopConfigResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? AppId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/SubMerchant/GetSubMerchantDevelopConfigRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/SubMerchant/GetSubMerchantDevelopConfigRequest.cs new file mode 100644 index 00000000..069ecb06 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/SubMerchant/GetSubMerchantDevelopConfigRequest.cs @@ -0,0 +1,29 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /secapi/mch/querysubdevconfig 接口的请求。 + /// + public class GetSubMerchantDevelopConfigRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置特约商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/SubMerchant/GetSubMerchantDevelopConfigResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/SubMerchant/GetSubMerchantDevelopConfigResponse.cs new file mode 100644 index 00000000..2169fbbe --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/SubMerchant/GetSubMerchantDevelopConfigResponse.cs @@ -0,0 +1,99 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /secapi/mch/querysubdevconfig 接口的响应。 + /// + public class GetSubMerchantDevelopConfigResponse : WechatTenpaySignableResponse + { + public static class Types + { + public class AppIdConfigList + { + /// + /// 获取或设置 AppId 列表。 + /// + [Newtonsoft.Json.JsonProperty("appid_config_list")] + [System.Text.Json.Serialization.JsonPropertyName("appid_config_list")] + public AppIdConfigItem[] Items { get; set; } = default!; + } + + public class AppIdConfigItem + { + /// + /// 获取或设置关联 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string SubAppId { get; set; } = default!; + + /// + /// 获取或设置关注特约商户公众号的 AppId。 + /// + [Newtonsoft.Json.JsonProperty("subscribe_appid")] + [System.Text.Json.Serialization.JsonPropertyName("subscribe_appid")] + public string? SubscribeAppId { get; set; } + } + + public class JsapiPathList + { + /// + /// 获取或设置授权目录列表。 + /// + [Newtonsoft.Json.JsonProperty("jsapi_path_list")] + [System.Text.Json.Serialization.JsonPropertyName("jsapi_path_list")] + public string[] Items { get; set; } = default!; + } + } + + internal static class Converters + { + internal class ResponsePropertyAppIdConfigListNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class ResponsePropertyAppIdConfigListSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class ResponsePropertyJsapiPathListNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class ResponsePropertyJsapiPathListSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + } + + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public override string? AppId { get; set; } + + /// + /// 获取或设置关联 AppId 列表。 + /// + [Newtonsoft.Json.JsonProperty("appid_config_list")] + [Newtonsoft.Json.JsonConverter(typeof(Converters.ResponsePropertyAppIdConfigListNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonPropertyName("appid_config_list")] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.ResponsePropertyAppIdConfigListSystemTextJsonConverter))] + public Types.AppIdConfigList AppIdConfigList { get; set; } = default!; + + /// + /// 获取或设置授权目录列表。 + /// + [Newtonsoft.Json.JsonProperty("jsapi_path_list")] + [Newtonsoft.Json.JsonConverter(typeof(Converters.ResponsePropertyJsapiPathListNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonPropertyName("jsapi_path_list")] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.ResponsePropertyJsapiPathListSystemTextJsonConverter))] + public Types.JsapiPathList JsapiPathList { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Tools/ToolsAuthCodeToOpenIdRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Tools/ToolsAuthCodeToOpenIdRequest.cs index 381a4a5b..f4b6a15c 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Tools/ToolsAuthCodeToOpenIdRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Tools/ToolsAuthCodeToOpenIdRequest.cs @@ -5,6 +5,20 @@ /// public class ToolsAuthCodeToOpenIdRequest : WechatTenpaySignableRequest { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + /// /// 获取或设置子商户号。 /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Tools/ToolsAuthCodeToOpenIdResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Tools/ToolsAuthCodeToOpenIdResponse.cs index 824ae978..edf058b1 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Tools/ToolsAuthCodeToOpenIdResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Tools/ToolsAuthCodeToOpenIdResponse.cs @@ -5,6 +5,20 @@ /// public class ToolsAuthCodeToOpenIdResponse : WechatTenpaySignableResponse { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + /// /// 获取或设置子商户号。 /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Tools/ToolsShortUrlRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Tools/ToolsShortUrlRequest.cs new file mode 100644 index 00000000..310e9ddc --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Tools/ToolsShortUrlRequest.cs @@ -0,0 +1,43 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /tools/shorturl 接口的请求。 + /// + public class ToolsShortUrlRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置长链接。 + /// + [Newtonsoft.Json.JsonProperty("long_url")] + [System.Text.Json.Serialization.JsonPropertyName("long_url")] + public string LongUrl { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Tools/ToolsShortUrlResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Tools/ToolsShortUrlResponse.cs new file mode 100644 index 00000000..55df7e15 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/Tools/ToolsShortUrlResponse.cs @@ -0,0 +1,43 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /tools/shorturl 接口的响应。 + /// + public class ToolsShortUrlResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string? SubMerchantId { get; set; } + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置短链接。 + /// + [Newtonsoft.Json.JsonProperty("short_url")] + [System.Text.Json.Serialization.JsonPropertyName("short_url")] + public string ShortUrl { get; set; } = default!; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/ApplyVehiclePartnerPayRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/ApplyVehiclePartnerPayRequest.cs new file mode 100644 index 00000000..ff93da7f --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/ApplyVehiclePartnerPayRequest.cs @@ -0,0 +1,294 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /vehicle/partnerpay/payapply 接口的请求。 + /// + public class ApplyVehiclePartnerPayRequest : WechatTenpaySignableRequest + { + public static class Types + { + public class Scene + { + public static class Types + { + public class Data : NotifyVehiclePartnerPayRequest.Types.Scene.Types.Data + { + /// + /// 获取或设置出场时间。 + /// + [Newtonsoft.Json.JsonProperty("end_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("end_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextNullableDateTimeOffsetConverter))] + public DateTimeOffset? EndTime { get; set; } + + /// + /// 获取或设置支持的扣费方式。 + /// + [Newtonsoft.Json.JsonProperty("support_deduct_mode")] + [System.Text.Json.Serialization.JsonPropertyName("support_deduct_mode")] + public string? SupportDeductMode { get; set; } + + /// + /// 获取或设置发起扣费方式。 + /// + [Newtonsoft.Json.JsonProperty("deduct_mode")] + [System.Text.Json.Serialization.JsonPropertyName("deduct_mode")] + public string? DeductMode { get; set; } + + /// + /// 获取或设置计费时长(单位:秒)。 + /// + [Newtonsoft.Json.JsonProperty("charging_time")] + [System.Text.Json.Serialization.JsonPropertyName("charging_time")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? ChargingTime { get; set; } + + /// + /// 获取或设置加油站名称。 + /// + [Newtonsoft.Json.JsonProperty("gas_station")] + [System.Text.Json.Serialization.JsonPropertyName("gas_station")] + public string? GasStation { get; set; } + + /// + /// 获取或设置油品标号名。 + /// + [Newtonsoft.Json.JsonProperty("gas_label_name")] + [System.Text.Json.Serialization.JsonPropertyName("gas_label_name")] + public string? GasLabelName { get; set; } + + /// + /// 获取或设置油品类型名称。 + /// + [Newtonsoft.Json.JsonProperty("gas_type")] + [System.Text.Json.Serialization.JsonPropertyName("gas_type")] + public string? GasType { get; set; } + + /// + /// 获取或设置油品标准。 + /// + [Newtonsoft.Json.JsonProperty("gas_standard")] + [System.Text.Json.Serialization.JsonPropertyName("gas_standard")] + public string? GasStandard { get; set; } + + /// + /// 获取或设置油量(单位:毫升)。 + /// + [Newtonsoft.Json.JsonProperty("gas_amount")] + [System.Text.Json.Serialization.JsonPropertyName("gas_amount")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? GasAmount { get; set; } + + /// + /// 获取或设置油枪号。 + /// + [Newtonsoft.Json.JsonProperty("gas_gun_no")] + [System.Text.Json.Serialization.JsonPropertyName("gas_gun_no")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? GasGunNumber { get; set; } + + /// + /// 获取或设置入口名称。 + /// + [Newtonsoft.Json.JsonProperty("entrance_name")] + [System.Text.Json.Serialization.JsonPropertyName("entrance_name")] + public string? EntranceName { get; set; } + + /// + /// 获取或设置出口名称。 + /// + [Newtonsoft.Json.JsonProperty("exit_name")] + [System.Text.Json.Serialization.JsonPropertyName("exit_name")] + public string? ExitName { get; set; } + + /// + /// 获取或设置核载人数。 + /// + [Newtonsoft.Json.JsonProperty("carrying_capacity")] + [System.Text.Json.Serialization.JsonPropertyName("carrying_capacity")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? CarryingCapacity { get; set; } + + /// + /// 获取或设置核载区间。 + /// + [Newtonsoft.Json.JsonProperty("carrying_range")] + [System.Text.Json.Serialization.JsonPropertyName("carrying_range")] + public string? CarryingRangeString { get; set; } + + /// + /// 获取或设置通道类型。 + /// + [Newtonsoft.Json.JsonProperty("channel_type")] + [System.Text.Json.Serialization.JsonPropertyName("channel_type")] + public string? ChannelType { get; set; } + } + } + + /// + /// 获取或设置场景信息。 + /// + [Newtonsoft.Json.JsonProperty("scene_info")] + [System.Text.Json.Serialization.JsonPropertyName("scene_info")] + public Types.Data Data { get; set; } = new Types.Data(); + } + } + + internal static class Converters + { + internal class RequestPropertySceneNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class RequestPropertySceneSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string SubMerchantId { get; set; } = string.Empty; + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置接口版本号。 + /// 默认值:3.0 + /// + [Newtonsoft.Json.JsonProperty("version")] + [System.Text.Json.Serialization.JsonPropertyName("version")] + public string Version { get; set; } = "3.0"; + + /// + /// 获取或设置商品描述。 + /// + [Newtonsoft.Json.JsonProperty("body")] + [System.Text.Json.Serialization.JsonPropertyName("body")] + public string Body { get; set; } = string.Empty; + + /// + /// 获取或设置商户订单号。 + /// + [Newtonsoft.Json.JsonProperty("out_trade_no")] + [System.Text.Json.Serialization.JsonPropertyName("out_trade_no")] + public string OutTradeNumber { get; set; } = string.Empty; + + /// + /// 获取或设置订单金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("total_fee")] + [System.Text.Json.Serialization.JsonPropertyName("total_fee")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int TotalFee { get; set; } + + /// + /// 获取或设置货币类型。 + /// + [Newtonsoft.Json.JsonProperty("fee_type")] + [System.Text.Json.Serialization.JsonPropertyName("fee_type")] + public string? FeeType { get; set; } + + /// + /// 获取或设置用户的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string? OpenId { get; set; } + + /// + /// 获取或设置交易类型。 + /// 默认值:PAP + /// + [Newtonsoft.Json.JsonProperty("trade_type")] + [System.Text.Json.Serialization.JsonPropertyName("trade_type")] + public string TradeType { get; set; } = "PAP"; + + /// + /// 获取或设置交易场景值。 + /// + [Newtonsoft.Json.JsonProperty("trade_scene")] + [System.Text.Json.Serialization.JsonPropertyName("trade_scene")] + public string TradeScene { get; set; } = string.Empty; + + /// + /// 获取或设置附加数据。 + /// + [Newtonsoft.Json.JsonProperty("attach")] + [System.Text.Json.Serialization.JsonPropertyName("attach")] + public string? Attachment { get; set; } + + /// + /// 获取或设置用户终端 IP。 + /// + [Newtonsoft.Json.JsonProperty("spbill_create_ip")] + [System.Text.Json.Serialization.JsonPropertyName("spbill_create_ip")] + public string ClientIp { get; set; } = string.Empty; + + /// + /// 获取或设置订单优惠标记。 + /// + [Newtonsoft.Json.JsonProperty("goods_tag")] + [System.Text.Json.Serialization.JsonPropertyName("goods_tag")] + public string? GoodsTag { get; set; } + + /// + /// 获取或设置通知地址。 + /// + [Newtonsoft.Json.JsonProperty("notify_url")] + [System.Text.Json.Serialization.JsonPropertyName("notify_url")] + public string NotifyUrl { get; set; } = string.Empty; + + /// + /// 获取或设置场景信息。 + /// + [Newtonsoft.Json.JsonProperty("scene_info")] + [Newtonsoft.Json.JsonConverter(typeof(Converters.RequestPropertySceneNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonPropertyName("scene_info")] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.RequestPropertySceneSystemTextJsonConverter))] + public Types.Scene? Scene { get; set; } + + /// + /// 获取或设置是否分账。 + /// + [Newtonsoft.Json.JsonProperty("profit_sharing")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.YesOrNoNullableBooleanConverter))] + [System.Text.Json.Serialization.JsonPropertyName("profit_sharing")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.YesOrNoNullableBooleanConverter))] + public bool? IsProfitSharing { get; set; } + + /// + /// + /// 默认值: + /// + [Newtonsoft.Json.JsonProperty("sign_type")] + [System.Text.Json.Serialization.JsonPropertyName("sign_type")] +#pragma warning disable CS8765 + public override string SignType { get; set; } = Constants.SignTypes.HMAC_SHA256; +#pragma warning restore CS8765 + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/ApplyVehiclePartnerPayResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/ApplyVehiclePartnerPayResponse.cs new file mode 100644 index 00000000..3ab2b742 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/ApplyVehiclePartnerPayResponse.cs @@ -0,0 +1,43 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /vehicle/partnerpay/payapply 接口的响应。 + /// + public class ApplyVehiclePartnerPayResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string SubMerchantId { get; set; } = default!; + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置终端设备号。 + /// + [Newtonsoft.Json.JsonProperty("device_info")] + [System.Text.Json.Serialization.JsonPropertyName("device_info")] + public string? DeviceInfo { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/GetVehiclePartnerPayStateRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/GetVehiclePartnerPayStateRequest.cs new file mode 100644 index 00000000..0e8894cc --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/GetVehiclePartnerPayStateRequest.cs @@ -0,0 +1,91 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /vehicle/partnerpay/querystate 接口的请求。 + /// + public class GetVehiclePartnerPayStateRequest : WechatTenpaySignableRequest + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string SubMerchantId { get; set; } = string.Empty; + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置接口版本号。 + /// 默认值:3.0 + /// + [Newtonsoft.Json.JsonProperty("version")] + [System.Text.Json.Serialization.JsonPropertyName("version")] + public string Version { get; set; } = "3.0"; + + /// + /// 获取或设置交易场景值。 + /// + [Newtonsoft.Json.JsonProperty("trade_scene")] + [System.Text.Json.Serialization.JsonPropertyName("trade_scene")] + public string TradeScene { get; set; } = string.Empty; + + /// + /// 获取或设置跳转场景。 + /// + [Newtonsoft.Json.JsonProperty("jump_scene")] + [System.Text.Json.Serialization.JsonPropertyName("jump_scene")] + public string? JumpScene { get; set; } + + /// + /// 获取或设置用户的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string? OpenId { get; set; } + + /// + /// 获取或设置用户在子商户下的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("sub_openid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_openid")] + public string? SubOpenId { get; set; } + + /// + /// 获取或设置车牌号。 + /// + [Newtonsoft.Json.JsonProperty("plate_number")] + [System.Text.Json.Serialization.JsonPropertyName("plate_number")] + public string? PlateNumber { get; set; } + + /// + /// + /// 默认值: + /// + [Newtonsoft.Json.JsonProperty("sign_type")] + [System.Text.Json.Serialization.JsonPropertyName("sign_type")] +#pragma warning disable CS8765 + public override string SignType { get; set; } = Constants.SignTypes.HMAC_SHA256; +#pragma warning restore CS8765 + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/GetVehiclePartnerPayStateResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/GetVehiclePartnerPayStateResponse.cs new file mode 100644 index 00000000..db1b64b3 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/GetVehiclePartnerPayStateResponse.cs @@ -0,0 +1,131 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /vehicle/partnerpay/querystate 接口的响应。 + /// + public class GetVehiclePartnerPayStateResponse : WechatTenpaySignableResponse + { + public static class Types + { + public class PlateNumberInfo + { + public static class Types + { + public class Data + { + /// + /// 获取或设置车牌号。 + /// + [Newtonsoft.Json.JsonProperty("plate_number")] + [System.Text.Json.Serialization.JsonPropertyName("plate_number")] + public string PlateNumber { get; set; } = default!; + + /// + /// 获取或设置车牌通道标识。 + /// + [Newtonsoft.Json.JsonProperty("channel_type")] + [System.Text.Json.Serialization.JsonPropertyName("channel_type")] + public string? ChannelType { get; set; } + + /// + /// 获取或设置常用车牌标志。 + /// + [Newtonsoft.Json.JsonProperty("common_use_flag")] + [System.Text.Json.Serialization.JsonPropertyName("common_use_flag")] + public string? CommonUseFlag { get; set; } + } + } + + /// + /// 获取或设置车牌号信息。 + /// + [Newtonsoft.Json.JsonProperty("plate_number_info")] + [System.Text.Json.Serialization.JsonPropertyName("plate_number_info")] + public Types.Data Data { get; set; } = default!; + } + } + + internal static class Converters + { + internal class ResponsePropertyPlateNumberInfoNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class ResponsePropertyPlateNumberInfoSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string SubMerchantId { get; set; } = default!; + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置用户状态。 + /// + [Newtonsoft.Json.JsonProperty("user_state")] + [System.Text.Json.Serialization.JsonPropertyName("user_state")] + public string UserState { get; set; } = default!; + + /// + /// 获取或设置发起扣费方式。 + /// + [Newtonsoft.Json.JsonProperty("deduct_mode")] + [System.Text.Json.Serialization.JsonPropertyName("deduct_mode")] + public string? DeductMode { get; set; } + + /// + /// 获取或设置用户的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string? OpenId { get; set; } + + /// + /// 获取或设置用户在子商户下的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("sub_openid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_openid")] + public string? SubOpenId { get; set; } + + /// + /// 获取或设置跳转路径。 + /// + [Newtonsoft.Json.JsonProperty("path")] + [System.Text.Json.Serialization.JsonPropertyName("path")] + public string? JumpPath { get; set; } + + /// + /// 获取或设置车牌号信息。 + /// + [Newtonsoft.Json.JsonProperty("plate_number_info")] + [Newtonsoft.Json.JsonConverter(typeof(Converters.ResponsePropertyPlateNumberInfoNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonPropertyName("plate_number_info")] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.ResponsePropertyPlateNumberInfoSystemTextJsonConverter))] + public Types.PlateNumberInfo? PlateNumberInfo { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/NotifyVehiclePartnerPayRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/NotifyVehiclePartnerPayRequest.cs new file mode 100644 index 00000000..737ec91a --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/NotifyVehiclePartnerPayRequest.cs @@ -0,0 +1,168 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /vehicle/partnerpay/notification 接口的请求。 + /// + public class NotifyVehiclePartnerPayRequest : WechatTenpaySignableRequest + { + public static class Types + { + public class Scene + { + public static class Types + { + public class Data + { + /// + /// 获取或设置入场时间。 + /// + [Newtonsoft.Json.JsonProperty("start_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.PureDigitalTextDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("start_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.PureDigitalTextDateTimeOffsetConverter))] + public DateTimeOffset StartTime { get; set; } + + /// + /// 获取或设置车牌号。 + /// + [Newtonsoft.Json.JsonProperty("plate_number")] + [System.Text.Json.Serialization.JsonPropertyName("plate_number")] + public string? PlateNumber { get; set; } + + /// + /// 获取或设置车辆类型。 + /// + [Newtonsoft.Json.JsonProperty("car_type")] + [System.Text.Json.Serialization.JsonPropertyName("car_type")] + public string? CarType { get; set; } + + /// + /// 获取或设置停车场名称。 + /// + [Newtonsoft.Json.JsonProperty("parking_name")] + [System.Text.Json.Serialization.JsonPropertyName("parking_name")] + public string? ParkingName { get; set; } + + /// + /// 获取或设置车位编号。 + /// + [Newtonsoft.Json.JsonProperty("space_number")] + [System.Text.Json.Serialization.JsonPropertyName("space_number")] + public string? SpaceNumber { get; set; } + + /// + /// 获取或设置免费时长(单位:秒)。 + /// + [Newtonsoft.Json.JsonProperty("free_time")] + [System.Text.Json.Serialization.JsonPropertyName("free_time")] + [System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)] + public int? FreeDuration { get; set; } + + /// + /// 获取或设置用户的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("openid")] + [System.Text.Json.Serialization.JsonPropertyName("openid")] + public string? OpenId { get; set; } + + /// + /// 获取或设置用户在子商户下的 OpenId。 + /// + [Newtonsoft.Json.JsonProperty("sub_openid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_openid")] + public string? SubOpenId { get; set; } + + /// + /// 获取或设置通知地址。 + /// + [Newtonsoft.Json.JsonProperty("notify_url")] + [System.Text.Json.Serialization.JsonPropertyName("notify_url")] + public string? NotifyUrl { get; set; } + } + } + + /// + /// 获取或设置停车信息。 + /// + [Newtonsoft.Json.JsonProperty("scene_info")] + [System.Text.Json.Serialization.JsonPropertyName("scene_info")] + public Types.Data Data { get; set; } = new Types.Data(); + } + } + + internal static class Converters + { + internal class RequestPropertySceneNewtonsoftJsonConverter : Newtonsoft.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + + internal class RequestPropertySceneSystemTextJsonConverter : System.Text.Json.Converters.TextualObjectInJsonFormatConverterBase + { + } + } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string SubMerchantId { get; set; } = string.Empty; + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置接口版本号。 + /// 默认值:3.0 + /// + [Newtonsoft.Json.JsonProperty("version")] + [System.Text.Json.Serialization.JsonPropertyName("version")] + public string Version { get; set; } = "3.0"; + + /// + /// 获取或设置交易场景值。 + /// + [Newtonsoft.Json.JsonProperty("trade_scene")] + [System.Text.Json.Serialization.JsonPropertyName("trade_scene")] + public string TradeScene { get; set; } = string.Empty; + + /// + /// 获取或设置场景信息。 + /// + [Newtonsoft.Json.JsonProperty("scene_info")] + [Newtonsoft.Json.JsonConverter(typeof(Converters.RequestPropertySceneNewtonsoftJsonConverter))] + [System.Text.Json.Serialization.JsonPropertyName("scene_info")] + [System.Text.Json.Serialization.JsonConverter(typeof(Converters.RequestPropertySceneSystemTextJsonConverter))] + public Types.Scene? Scene { get; set; } + + /// + /// + /// 默认值: + /// + [Newtonsoft.Json.JsonProperty("sign_type")] + [System.Text.Json.Serialization.JsonPropertyName("sign_type")] +#pragma warning disable CS8765 + public override string SignType { get; set; } = Constants.SignTypes.HMAC_SHA256; +#pragma warning restore CS8765 + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/NotifyVehiclePartnerPayResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/NotifyVehiclePartnerPayResponse.cs new file mode 100644 index 00000000..9bddf27d --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/VehiclePartner/NotifyVehiclePartnerPayResponse.cs @@ -0,0 +1,50 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models +{ + /// + /// 表示 [POST] /vehicle/partnerpay/notification 接口的响应。 + /// + public class NotifyVehiclePartnerPayResponse : WechatTenpaySignableResponse + { + /// + /// + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + /// + /// + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mch_id")] + public string SubMerchantId { get; set; } = default!; + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppId { get; set; } + + /// + /// 获取或设置用户状态。 + /// + [Newtonsoft.Json.JsonProperty("user_state")] + [System.Text.Json.Serialization.JsonPropertyName("user_state")] + public string UserState { get; set; } = default!; + + /// + /// 获取或设置发起扣费方式。 + /// + [Newtonsoft.Json.JsonProperty("deduct_mode")] + [System.Text.Json.Serialization.JsonPropertyName("deduct_mode")] + public string? DeductMode { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/SKIT.FlurlHttpClient.Wechat.TenpayV2.csproj b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/SKIT.FlurlHttpClient.Wechat.TenpayV2.csproj index b190b90e..13f33520 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/SKIT.FlurlHttpClient.Wechat.TenpayV2.csproj +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/SKIT.FlurlHttpClient.Wechat.TenpayV2.csproj @@ -1,7 +1,7 @@ - net47; netstandard2.0; net5.0; net6.0 + net461; netstandard2.0; net5.0; net6.0 8.0 enable true @@ -14,8 +14,8 @@ MIT https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat Flurl.Http Wechat Weixin MicroMessage Tenpay WechatPay WeixinPay Wxpay 微信 微信支付 微信商户 - 1.0.0-beta - 基于 Flurl.Http 的微信支付 API v2 版客户端,支持直连商户、服务商模式,仅包含微信支付未提供 v3 版 API 的部分功能。如需微信支付 v3 版 API 客户端,欢迎使用 `SKIT.FlurlHttpClient.Wechat.TenpayV3`。 + 1.0.0-beta.1 + 基于 Flurl.Http 的微信支付 API v2 版客户端,支持普通商户、境内服务商、银行服务商模式,仅包含微信支付未提供 v3 版 API 的部分功能。如需微信支付 v3 版 API 客户端,欢迎使用 `SKIT.FlurlHttpClient.Wechat.TenpayV3`。 Fu Diwei git https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Utilities/AESUtility.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Utilities/AESUtility.cs new file mode 100644 index 00000000..a95abd28 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Utilities/AESUtility.cs @@ -0,0 +1,52 @@ +using System; +using System.Security.Cryptography; +using System.Text; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Utilities +{ + /// + /// AES 算法工具类。 + /// + public static class AESUtility + { + /// + /// 基于 ECB 模式解密数据。 + /// + /// AES 密钥字节数组。 + /// 待解密数据字节数组。 + /// 解密后的数据字节数组。 + public static byte[] DecryptWithECB(byte[] keyBytes, byte[] cipherBytes) + { + if (keyBytes == null) throw new ArgumentNullException(nameof(keyBytes)); + if (cipherBytes == null) throw new ArgumentNullException(nameof(cipherBytes)); + + using (SymmetricAlgorithm aes = Aes.Create()) + { + aes.Mode = CipherMode.ECB; + aes.Padding = PaddingMode.PKCS7; + aes.Key = keyBytes; + + using ICryptoTransform transform = aes.CreateDecryptor(); + return transform.TransformFinalBlock(cipherBytes, 0, cipherBytes.Length); + } + } + + /// + /// 基于 ECB 模式解密数据。 + /// + /// 经 Base64 编码后的 AES 密钥。 + /// 经 Base64 编码后的待解密数据。 + /// 解密后的文本数据。 + public static string DecryptWithECB(string encodingKey, string encodingCipherText) + { + if (encodingKey == null) throw new ArgumentNullException(nameof(encodingKey)); + if (encodingCipherText == null) throw new ArgumentNullException(nameof(encodingCipherText)); + + byte[] plainBytes = DecryptWithECB( + keyBytes: Convert.FromBase64String(encodingKey), + cipherBytes: Convert.FromBase64String(encodingCipherText) + ); + return Encoding.UTF8.GetString(plainBytes); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Utilities/Internal/JsonUtility.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Utilities/Internal/JsonUtility.cs index 12ae8f66..bbb1ef2e 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Utilities/Internal/JsonUtility.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Utilities/Internal/JsonUtility.cs @@ -1,431 +1,37 @@ -using System; -using System.Collections; -using System.IO; -using System.Linq; -using System.Reflection; +using System.Linq; using System.Text; -using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Utilities { - [Obsolete] - internal static partial class JsonUtility + internal static class JsonUtility { - public const string PROPERTY_WILDCARD_NARRAY_ELEMENT = "$n"; - public const string PROPERTY_NAME_NARRAY = "#n"; - - private static bool TryMatchNArrayIndex(string key, out int index) + internal static string ParseToSortedQueryString(string json) { - Regex regex = new Regex(@"(_)(\d+)", RegexOptions.Compiled); - if (regex.IsMatch(key)) - { - string str = regex.Match(key).Groups[2].Value; - index = int.Parse(str); - return true; - } + if (string.IsNullOrEmpty(json)) + return string.Empty; - index = -1; - return false; - } - - private static Array CreateOrExpandNArray(object? array, Type elementType, int capacity) - { - if (elementType == null) throw new ArgumentNullException(nameof(elementType)); - if (capacity <= 0) throw new ArgumentOutOfRangeException(nameof(capacity)); - - if (array == null) - { - return Array.CreateInstance(elementType, capacity); - } - - Array src = (Array)array; - if (src.Length < capacity) - { - Array dst = Array.CreateInstance(elementType, capacity); - Array.Copy(src, dst, src.Length); - return dst; - } - - return src; - } - - private static object CreateOrUpdateNArrayElement(Array array, Type elementType, int index, string key, object value, params object?[]? args) - { - if (array == null) throw new ArgumentNullException(nameof(array)); - if (elementType == null) throw new ArgumentNullException(nameof(elementType)); - - static object AppendNArrayElement(Array array, Type elementType, int index) - { - object? element = array.GetValue(index); - if (element == null) - { - if (elementType.IsAbstract || elementType.IsInterface) - { - throw new NotSupportedException(); - } - else if (elementType.IsArray) - { - element = Array.CreateInstance(elementType, 0); - } - else - { - element = Activator.CreateInstance(elementType); - } - } - - array.SetValue(element, index); - return element!; - } - - object? element = AppendNArrayElement(array, elementType, index); - - if (value is Newtonsoft.Json.Linq.JToken jToken) - { - var props = GetTypedNewtonsoftJsonProperties(elementType); - var prop = props.SingleOrDefault(p => string.Equals(p.PropertyName.Replace(PROPERTY_WILDCARD_NARRAY_ELEMENT, index.ToString()), key)); - if (prop != null) - { - Newtonsoft.Json.JsonSerializer? serializer = args?.FirstOrDefault() as Newtonsoft.Json.JsonSerializer; - if (serializer == null) - { - serializer = Newtonsoft.Json.JsonSerializer.CreateDefault(); - } - - foreach (Newtonsoft.Json.JsonConverterAttribute attribute in prop.PropertyInfo.GetCustomAttributes(inherit: true)) - { - Newtonsoft.Json.JsonConverter converter = (Newtonsoft.Json.JsonConverter)Activator.CreateInstance(attribute.ConverterType, attribute.ConverterParameters); - serializer.Converters.Add(converter); - } - - object tmp = jToken.ToObject(prop.PropertyType, serializer); - prop.PropertyInfo.SetValue(element, tmp); - } - } - else if (value is System.Text.Json.JsonElement jElement) - { - var props = GetTypedSystemTextJsonProperties(elementType); - var prop = props.SingleOrDefault(p => string.Equals(p.PropertyName.Replace(PROPERTY_WILDCARD_NARRAY_ELEMENT, index.ToString()), key)); - if (prop != null) - { - System.Text.Json.JsonSerializerOptions? options = (args?.FirstOrDefault() as System.Text.Json.JsonSerializerOptions); - if (options == null) - { - options = new System.Text.Json.JsonSerializerOptions(); - } - else - { - options = new System.Text.Json.JsonSerializerOptions(options); - } - - foreach (System.Text.Json.Serialization.JsonConverterAttribute attribute in prop.PropertyInfo.GetCustomAttributes(inherit: true)) - { - System.Text.Json.Serialization.JsonConverter converter = (System.Text.Json.Serialization.JsonConverter)Activator.CreateInstance(attribute.ConverterType!); - options.Converters.Add(converter!); - } - - object tmp = System.Text.Json.JsonSerializer.Deserialize(jElement, prop.PropertyType, options)!; - prop.PropertyInfo.SetValue(element, tmp); - } - } - else - { - throw new NotSupportedException(); - } - - return element; - } - - public static string SerializeWhenHasNArray(T obj, Newtonsoft.Json.JsonSerializer? serializer = null) - where T : class, new() - { - if (obj == null) throw new ArgumentNullException(nameof(obj)); - - static Newtonsoft.Json.Linq.JToken Flatten(Newtonsoft.Json.Linq.JToken jToken) - { - if (jToken.Type == Newtonsoft.Json.Linq.JTokenType.Array) - { - foreach (Newtonsoft.Json.Linq.JToken? jSubToken in jToken) - { - if (jSubToken == null) - continue; - - Flatten(jSubToken); - } - } - else if (jToken.Type == Newtonsoft.Json.Linq.JTokenType.Object) - { - string[] keys = ((Newtonsoft.Json.Linq.JObject)jToken).Properties().Select(p => p.Name).ToArray(); - foreach (string key in keys) - { - if (!PROPERTY_NAME_NARRAY.Equals(key)) - continue; - - int i = 0; - foreach (Newtonsoft.Json.Linq.JToken? jSubToken in jToken[key]) - { - if (jSubToken == null) - continue; - - foreach (Newtonsoft.Json.Linq.JProperty jSubKey in jSubToken) - { - jToken[jSubKey.Name.Replace(PROPERTY_WILDCARD_NARRAY_ELEMENT, i.ToString())] = jSubKey.Value; - } - - i++; - } - } - - jToken[PROPERTY_NAME_NARRAY]?.Parent?.Remove(); - } - - return jToken; - } - - //StringBuilder stringBuilder = new StringBuilder(); - //using TextWriter stringWriter = new StringWriter(stringBuilder); - //serializer = serializer ?? Newtonsoft.Json.JsonSerializer.CreateDefault(); - //serializer.Serialize(stringWriter, obj, typeof(T)); - //string rawJson = stringBuilder.ToString(); - - //Newtonsoft.Json.Linq.JToken jToken = Newtonsoft.Json.Linq.JToken.Parse(rawJson); - //return Flatten(jToken).ToString(serializer.Formatting); - - // TODO - return default!; - } - - public static T DeserializeWhenHasNArray(ref Newtonsoft.Json.Linq.JObject jObject, Newtonsoft.Json.JsonSerializer? serializer = null) - where T : class, new() - { - var props = GetTypedNewtonsoftJsonProperties(typeof(T)); - if (props.Count(p => p.IsNArrayProperty) != 1) - throw new Newtonsoft.Json.JsonException("The number of `$n` properties must be only one."); - - T result = new T(); - foreach (Newtonsoft.Json.Linq.JProperty jKey in jObject.Properties()) - { - var prop = props.SingleOrDefault(e => e.PropertyName == jKey.Name); - if (prop != null) - { - // ͨ - object? value = serializer is null ? - jObject[prop.PropertyName]?.ToObject(prop.PropertyType) : - jObject[prop.PropertyName]?.ToObject(prop.PropertyType, serializer); - prop.PropertyInfo.SetValue(result, value); - } - else if (TryMatchNArrayIndex(jKey.Name, out int index)) - { - // $n - var narrProp = props.Single(e => e.IsNArrayProperty); - object? value = narrProp.PropertyInfo.GetValue(result); - - Array array = CreateOrExpandNArray(value, narrProp.PropertyType.GetElementType()!, index + 1); - object? element = CreateOrUpdateNArrayElement(array, narrProp.PropertyType.GetElementType()!, index, jKey.Name, jKey.Value, serializer); - narrProp.PropertyInfo.SetValue(result, array); - } - else if (serializer?.MissingMemberHandling == Newtonsoft.Json.MissingMemberHandling.Error) - { - throw new Newtonsoft.Json.JsonSerializationException($"Could not find member `{jKey.Name}` on object of type `{typeof(T).Name}`."); - } - } - return result; - } - - public static string SerializeWhenHasNArray(T obj, System.Text.Json.JsonSerializerOptions? options = null) - where T : class, new() - { - if (obj == null) throw new ArgumentNullException(nameof(obj)); - - if (obj == null) throw new ArgumentNullException(nameof(obj)); - - static System.Text.Json.Nodes.JsonNode Flatten( - System.Text.Json.Nodes.JsonNode jNode, - System.Text.Json.JsonSerializerOptions jsonSerializerOptions, - System.Text.Json.JsonDocumentOptions jsonDocumentOptions, - System.Text.Json.Nodes.JsonNodeOptions jsonNodeOptions) - { - if (jNode is System.Text.Json.Nodes.JsonArray jNodeAsArray) - { - foreach (System.Text.Json.Nodes.JsonNode? jSubNode in jNodeAsArray) - { - if (jSubNode == null) - continue; - - Flatten(jSubNode, jsonSerializerOptions, jsonDocumentOptions, jsonNodeOptions); - } - } - else if (jNode is System.Text.Json.Nodes.JsonObject jNodeAsObject) - { - string[] keys = jNodeAsObject.Select(e => e.Key).ToArray(); - foreach (string key in keys) - { - if (!PROPERTY_NAME_NARRAY.Equals(key)) - continue; - - int i = 0; - foreach (System.Text.Json.Nodes.JsonObject? jSubNode in jNodeAsObject[key]!.AsArray()) - { - if (jSubNode == null) - continue; - - foreach (var jSubKey in jSubNode) - { - string? json = jSubKey.Value?.ToJsonString(jsonSerializerOptions); - if (json != null) - jNodeAsObject[jSubKey.Key.Replace(PROPERTY_WILDCARD_NARRAY_ELEMENT, i.ToString())] = System.Text.Json.Nodes.JsonNode.Parse(json, jsonNodeOptions, jsonDocumentOptions); - } - - i++; - } - } - - jNodeAsObject.Remove(PROPERTY_NAME_NARRAY); - } - - return jNode; - } - - // NOTICE: Ϊ JsonConverter Եʣﲻʹ Newtonsoft.Json лݹѭ StringBuilder stringBuilder = new StringBuilder(); - using TextWriter stringWriter = new StringWriter(stringBuilder); - Newtonsoft.Json.JsonSerializer serializer = Newtonsoft.Json.JsonSerializer.CreateDefault(); - serializer.Serialize(stringWriter, obj, typeof(T)); - string rawJson = stringBuilder.ToString(); - System.Text.Json.JsonSerializerOptions jsonSerializerOptions = options ?? new System.Text.Json.JsonSerializerOptions(); - System.Text.Json.JsonDocumentOptions jsonDocumentOptions = new System.Text.Json.JsonDocumentOptions() + JObject jObject = JsonConvert.DeserializeObject(json); + JProperty[] jProps = jObject.Properties().OrderBy(p => p.Name).ToArray(); + foreach (JProperty jProp in jProps) { - AllowTrailingCommas = jsonSerializerOptions.AllowTrailingCommas, - CommentHandling = jsonSerializerOptions.ReadCommentHandling, - MaxDepth = jsonSerializerOptions.MaxDepth - }; - System.Text.Json.Nodes.JsonNodeOptions jsonNodeOptions = new System.Text.Json.Nodes.JsonNodeOptions() - { - PropertyNameCaseInsensitive = jsonSerializerOptions.PropertyNameCaseInsensitive - }; - System.Text.Json.Nodes.JsonNode jNode = System.Text.Json.Nodes.JsonNode.Parse(rawJson, jsonNodeOptions, jsonDocumentOptions)!; - return Flatten(jNode, jsonSerializerOptions, jsonDocumentOptions, jsonNodeOptions) - .ToJsonString(new System.Text.Json.JsonSerializerOptions() + if (jProp.Value.Type == JTokenType.Null) { - WriteIndented = jsonSerializerOptions.WriteIndented, - Encoder = jsonSerializerOptions.Encoder - }); - } - - public static T DeserializeWhenHasNArray(ref System.Text.Json.JsonElement jElement, System.Text.Json.JsonSerializerOptions? options = null) - where T : class, new() - { - var props = GetTypedSystemTextJsonProperties(typeof(T)); - if (props.Count(p => p.IsNArrayProperty) != 1) - throw new System.Text.Json.JsonException("The number of `$n` properties must be only one."); - - T result = new T(); - foreach (System.Text.Json.JsonProperty jKey in jElement.EnumerateObject()) - { - var prop = props.SingleOrDefault(e => e.PropertyName == jKey.Name); - if (prop != null) - { - // ͨ - object? value = options is null ? - System.Text.Json.JsonSerializer.Deserialize(jKey.Value, prop.PropertyType, options) : - System.Text.Json.JsonSerializer.Deserialize(jKey.Value, prop.PropertyType, options); - prop.PropertyInfo.SetValue(result, value); + continue; } - else if (TryMatchNArrayIndex(jKey.Name, out int index)) + else if (jProp.Value.Type == JTokenType.String) { - // $n - var narrProp = props.Single(e => e.IsNArrayProperty); - object? value = narrProp.PropertyInfo.GetValue(result); - - Array array = CreateOrExpandNArray(value, narrProp.PropertyType.GetElementType()!, index + 1); - object? element = CreateOrUpdateNArrayElement(array, narrProp.PropertyType.GetElementType()!, index, jKey.Name, jKey.Value, options); - narrProp.PropertyInfo.SetValue(result, array); + if (string.IsNullOrEmpty((string)jProp.Value)) + continue; } - } - return result; - } - } - internal partial class JsonUtility - { - private sealed class InnerTypedJsonProperty - { - public string PropertyName { get; } - - public PropertyInfo PropertyInfo { get; } - - public Type PropertyType { get { return PropertyInfo.PropertyType; } } - - public bool IsNArrayProperty { get; } - - public InnerTypedJsonProperty(string propertyName, PropertyInfo propertyInfo, bool isNArrayProperty) - { - PropertyName = propertyName; - PropertyInfo = propertyInfo; - IsNArrayProperty = isNArrayProperty; - } - } - - private static readonly Hashtable _mappedTypeJsonProperties = new Hashtable(); - - private static InnerTypedJsonProperty[] GetTypedNewtonsoftJsonProperties(Type type) - { - if (type == null) throw new ArgumentNullException(nameof(type)); - - string skey = "Newtosoft.Json:" + (type.AssemblyQualifiedName ?? type.GetHashCode().ToString()); - var props = (InnerTypedJsonProperty[]?)_mappedTypeJsonProperties[skey]; - if (props == null) - { - props = type.GetProperties(BindingFlags.Instance | BindingFlags.Public) - .Where(p => - (p.CanRead && !p.GetCustomAttributes(inherit: true).Any()) && - (p.CanWrite || p.GetCustomAttributes(inherit: true).Any()) - ) - .Select(p => - { - string name = p.GetCustomAttribute(inherit: true)?.PropertyName ?? p.Name; - return new InnerTypedJsonProperty - ( - propertyName: name, - propertyInfo: p, - isNArrayProperty: PROPERTY_NAME_NARRAY.Equals(name) && p.PropertyType.IsArray && p.PropertyType.GetElementType()!.IsClass - ); - }) - .ToArray(); - _mappedTypeJsonProperties[skey] = props; + stringBuilder.Append($"{jProp.Name}={jProp.Value}&"); } - return props; - } - - private static InnerTypedJsonProperty[] GetTypedSystemTextJsonProperties(Type type) - { - if (type == null) throw new ArgumentNullException(nameof(type)); - - string skey = "System.Text.Json:" + (type.AssemblyQualifiedName ?? type.GetHashCode().ToString()); - var props = (InnerTypedJsonProperty[]?)_mappedTypeJsonProperties[skey]; - if (props == null) - { - props = type.GetProperties(BindingFlags.Instance | BindingFlags.Public) - .Where(p => - (p.CanRead && !p.GetCustomAttributes(inherit: true).Any()) && - (p.CanWrite || p.GetCustomAttributes(inherit: true).Any()) - ) - .Select(p => - { - string name = p.GetCustomAttribute(inherit: true)?.Name ?? p.Name; - return new InnerTypedJsonProperty - ( - propertyName: name, - propertyInfo: p, - isNArrayProperty: PROPERTY_NAME_NARRAY.Equals(name) && p.PropertyType.IsArray && p.PropertyType.GetElementType()!.IsClass - ); - }) - .ToArray(); - _mappedTypeJsonProperties[skey] = props; - } - - return props; + return stringBuilder.ToString().TrimEnd('&'); } } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Utilities/Internal/RequestSigner.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Utilities/Internal/RequestSigner.cs new file mode 100644 index 00000000..67ade4c9 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Utilities/Internal/RequestSigner.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Utilities +{ + internal static class RequestSigner + { + public static string Sign(IDictionary paramsMap, string secret, string? signType) + { + if (paramsMap == null) throw new ArgumentNullException(nameof(paramsMap)); + + IDictionary sortedParamsMap = new SortedDictionary(paramsMap, StringComparer.OrdinalIgnoreCase); + string sortedQueryString = string.Join("&", sortedParamsMap.Where(e => !string.IsNullOrEmpty(e.Value)).Select(e => $"{e.Key}={e.Value}")); + return SignFromSortedQueryString(sortedQueryString, secret, signType); + } + + public static string SignFromJson(string json, string secret, string? signType) + { + return SignFromSortedQueryString(JsonUtility.ParseToSortedQueryString(json), secret, signType); + } + + public static string SignFromSortedQueryString(string queryString, string secret, string? signType) + { + signType = signType ?? Constants.SignTypes.MD5; + queryString = queryString + $"&key={secret}"; + + switch (signType) + { + case Constants.SignTypes.MD5: + { + return MD5Utility.Hash(queryString).ToUpper(); + } + + case Constants.SignTypes.HMAC_SHA256: + { + return HMACUtility.HashWithSHA256(secret, queryString).ToUpper(); + } + + default: + throw new NotSupportedException("Unsupported sign type."); + } + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Utilities/Internal/XmlUtility.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Utilities/Internal/XmlUtility.cs index 1e072f1a..d22b9eb7 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Utilities/Internal/XmlUtility.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Utilities/Internal/XmlUtility.cs @@ -1,5 +1,8 @@ -using System.Xml; +using System.Linq; +using System.Xml; +using System.Xml.Linq; using Newtonsoft.Json; +using Newtonsoft.Json.Linq; namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Utilities { @@ -7,15 +10,24 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Utilities { public static string ConvertFromJson(string json) { - XmlDocument xmlDocument = JsonConvert.DeserializeXmlNode(json); - return xmlDocument.InnerXml; + XmlDocument xmlDocument = JsonConvert.DeserializeXmlNode(json, "xml"); + string xml = xmlDocument.InnerXml; + return xml; } public static string ConvertToJson(string xml) { - XmlDocument xmlDocument = new XmlDocument(); - xmlDocument.LoadXml(xml); - return JsonConvert.SerializeXmlNode(xmlDocument); + XElement xElement = XElement.Parse(xml); + XCData[] xCDatas = xElement.DescendantNodes().OfType().ToArray(); + foreach (XCData xCData in xCDatas) + { + xCData.Parent!.Add(xCData.Value); + xCData.Remove(); + } + + JObject jObject = JsonConvert.DeserializeObject(JsonConvert.SerializeXNode(xElement)); + string json = (jObject.First as JProperty)?.Value?.ToString(Newtonsoft.Json.Formatting.None) ?? "{}"; + return json; } } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayClient.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayClient.cs index 1c464457..1e18cb6c 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayClient.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayClient.cs @@ -38,6 +38,33 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 ); } + /// + /// 用指定的微信商户号和微信商户 API 密钥初始化 类的新实例。 + /// + /// 微信商户号。 + /// 微信商户 API 密钥。 + public WechatTenpayClient(string merchantId, string merchantSecret) + : this(new WechatTenpayClientOptions() { MerchantId = merchantId, MerchantSecret = merchantSecret }) + { + if (merchantId == null) throw new ArgumentNullException(nameof(merchantId)); + if (merchantSecret == null) throw new ArgumentNullException(nameof(merchantSecret)); + } + + /// + /// 用指定的微信商户号、微信商户 API 密钥和微信商户证书内容初始化 类的新实例。 + /// + /// 微信商户号。 + /// 微信商户 API 密钥。 + /// 微信商户 API 证书内容字节数组。 + /// 微信商户 API 证书导入密码。 + public WechatTenpayClient(string merchantId, string merchantSecret, byte[] merchantCertificateBytes, string? merchantCertificatePassword = null) + : this(new WechatTenpayClientOptions() { MerchantId = merchantId, MerchantSecret = merchantSecret, MerchantCertificateBytes = merchantCertificateBytes, MerchantCertificatePassword = merchantCertificatePassword }) + { + if (merchantId == null) throw new ArgumentNullException(nameof(merchantId)); + if (merchantSecret == null) throw new ArgumentNullException(nameof(merchantSecret)); + if (merchantCertificateBytes == null) throw new ArgumentNullException(nameof(merchantCertificateBytes)); + } + /// /// 使用当前客户端生成一个新的 对象。 /// @@ -73,10 +100,18 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 if (signableRequest.Signature == null) { - string signType = signableRequest.SignType ?? Constants.SignTypes.MD5; - - // TODO: 生成签名算法 - throw new NotImplementedException(); + try + { + signableRequest.Signature = Utilities.RequestSigner.SignFromJson( + json: JsonSerializer.Serialize(signableRequest), + secret: Credentials.MerchantSecret, + signType: signableRequest.SignType + ); + } + catch (Exception ex) + { + throw new Exceptions.WechatTenpayRequestSignatureException("Generate signature of request failed. Please see the `InnerException` for more details.", ex); + } } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayEvent.cs new file mode 100644 index 00000000..320f1bb5 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayEvent.cs @@ -0,0 +1,102 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 +{ + /// + /// 表示微信支付 API 回调通知事件的基类。 + /// + [Serializable] + public class WechatTenpayEvent + { + public static class Types + { + public interface IDecryptedRequestInfo + { + } + } + + /// + /// 获取或设置微信支付回调的状态码。 + /// + [Newtonsoft.Json.JsonProperty("return_code")] + [System.Text.Json.Serialization.JsonPropertyName("return_code")] + public string ReturnCode { get; set; } = default!; + + /// + /// 获取或设置微信支付回调的状态描述。 + /// + [Newtonsoft.Json.JsonProperty("return_msg")] + [System.Text.Json.Serialization.JsonPropertyName("return_msg")] + public string ReturnMessage { get; set; } = default!; + + /// + /// 获取微信支付 API 返回的错误码。 + /// + [Newtonsoft.Json.JsonProperty("err_code")] + [System.Text.Json.Serialization.JsonPropertyName("err_code")] + public string? ErrorCode { get; set; } + + /// + /// 获取微信支付 API 返回的状态描述。 + /// + [Newtonsoft.Json.JsonProperty("err_code_des")] + [System.Text.Json.Serialization.JsonPropertyName("err_code_des")] + public string? ErrorCodeDescription { get; set; } + + /// + /// 获取或设置业务结果。 + /// + [Newtonsoft.Json.JsonProperty("result_code")] + [System.Text.Json.Serialization.JsonPropertyName("result_code")] + public string? ResultCode { get; set; } + + /// + /// 获取或设置业务结果描述。 + /// + [Newtonsoft.Json.JsonProperty("result_msg")] + [System.Text.Json.Serialization.JsonPropertyName("result_msg")] + public string? ResultMessage { get; set; } + + /// + /// 获取或设置微信支付回调的商户号。 + /// + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public string? MerchantId { get; set; } + + /// + /// 获取或设置微信支付回调的 AppId。 + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public string? AppId { get; set; } + + /// + /// 获取或设置微信支付回调的随机字符串。 + /// + [Newtonsoft.Json.JsonProperty("nonce_str")] + [System.Text.Json.Serialization.JsonPropertyName("nonce_str")] + public string? NonceString { get; set; } + + /// + /// 获取或设置签名类型。 + /// + [Newtonsoft.Json.JsonProperty("sign_type")] + [System.Text.Json.Serialization.JsonPropertyName("sign_type")] + public string? SignType { get; set; } + + /// + /// 获取或设置签名。 + /// + [Newtonsoft.Json.JsonProperty("sign")] + [System.Text.Json.Serialization.JsonPropertyName("sign")] + public string? Signature { get; set; } + + /// + /// 获取或设置 Base64 编码后的加密信息。 + /// + [Newtonsoft.Json.JsonProperty("req_info")] + [System.Text.Json.Serialization.JsonPropertyName("req_info")] + public string? EncryptedRequestInfo { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayRequest.cs index 748b706f..fd58389f 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayRequest.cs @@ -13,18 +13,18 @@ public virtual int? Timeout { get; set; } /// - /// 获取或设置微信商户号。如果不指定将使用构造 时的 参数。 + /// 获取或设置微信商户号。请不要手动赋值,默认将使用构造 时的 参数。 /// - [Newtonsoft.Json.JsonProperty("mch_id")] - [System.Text.Json.Serialization.JsonPropertyName("mch_id")] - public string? MerchantId { get; set; } + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public abstract string? MerchantId { get; set; } /// /// 获取或设置微信 AppId。如果不指定将使用构造 时的 参数。 /// - [Newtonsoft.Json.JsonProperty("appid")] - [System.Text.Json.Serialization.JsonPropertyName("appid")] - public string? AppId { get; set; } + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public abstract string? AppId { get; set; } } /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayResponse.cs index 9359e6df..92ddd62c 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayResponse.cs @@ -90,19 +90,26 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 [System.Text.Json.Serialization.JsonPropertyName("result_code")] public virtual string? ResultCode { get; set; } + /// + /// 获取或设置业务结果描述。 + /// + [Newtonsoft.Json.JsonProperty("result_msg")] + [System.Text.Json.Serialization.JsonPropertyName("result_msg")] + public virtual string? ResultMessage { get; set; } + /// /// 获取或设置微信商户号。 /// - [Newtonsoft.Json.JsonProperty("mch_id")] - [System.Text.Json.Serialization.JsonPropertyName("mch_id")] - public virtual string? MerchantId { get; set; } + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public abstract string? MerchantId { get; set; } /// /// 获取或设置微信 AppId。 /// - [Newtonsoft.Json.JsonProperty("appid")] - [System.Text.Json.Serialization.JsonPropertyName("appid")] - public virtual string? AppId { get; set; } + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public abstract string? AppId { get; set; } /// /// 获取一个值,该值指示调用微信 API 是否成功(即 HTTP 状态码为 200、且 return_code 值 SUCCESS)。 @@ -110,13 +117,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2 /// public virtual bool IsSuccessful() { - bool ret = RawStatus == 200 && "SUCCESS".Equals(ReturnCode) && string.IsNullOrEmpty(ErrorCode); - if (ret) - { - return string.IsNullOrEmpty(ResultCode) || "SUCCESS".Equals(ResultCode); - } - - return false; + bool ret1 = RawStatus == 200 && "SUCCESS".Equals(ReturnCode); + bool ret2 = string.IsNullOrEmpty(ErrorCode) || "0".Equals(ErrorCode); + bool ret3 = string.IsNullOrEmpty(ResultCode) || "SUCCESS".Equals(ResultCode); + return ret1 && ret2 && ret3; } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteBillExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteBillExtensions.cs index f6a280fc..d70aee3a 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteBillExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteBillExtensions.cs @@ -155,7 +155,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 IFlurlRequest flurlReq = client .CreateRequest(request, HttpMethod.Get, request.DownloadUrl); - flurlReq.Url = new Url(new Uri(request.DownloadUrl)); + flurlReq.Url = Url.Parse(request.DownloadUrl); return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteMerchantServiceExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteMerchantServiceExtensions.cs index 3d472ea6..583c5290 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteMerchantServiceExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteMerchantServiceExtensions.cs @@ -273,7 +273,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 IFlurlRequest flurlReq = client .CreateRequest(request, HttpMethod.Get, request.DownloadUrl); - flurlReq.Url = new Url(new Uri(request.DownloadUrl)); + flurlReq.Url = Url.Parse(request.DownloadUrl); return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecutePAPExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecutePAPExtensions.cs new file mode 100644 index 00000000..0e312377 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecutePAPExtensions.cs @@ -0,0 +1,36 @@ +using System; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 +{ + /// + /// 为 提供扣款服务(直连商户)相关的 API 扩展方法。 + /// + public static class WechatTenpayClientExecutePAPExtensions + { + /// + /// 异步调用 [POST] /papay/contracts/{contract_id}/notify 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_10.shtml + /// + /// + /// + /// + /// + public static async Task ExecuteNotifyPAPPayContractsAsync(this WechatTenpayClient client, Models.NotifyPAPPayContractsRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (request.MerchantId == null) + request.MerchantId = client.Credentials.MerchantId; + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "papay", "contracts", request.ContractId, "notify"); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecutePartnerPAPExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecutePartnerPAPExtensions.cs new file mode 100644 index 00000000..9cc8c77a --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecutePartnerPAPExtensions.cs @@ -0,0 +1,36 @@ +using System; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 +{ + /// + /// 为 提供扣款服务(服务商)相关的 API 扩展方法。 + /// + public static class WechatTenpayClientExecutePartnerPAPExtensions + { + /// + /// 异步调用 [POST] /partner-papay/contracts/{contract_id}/notify 接口。 + /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter5_15.shtml + /// + /// + /// + /// + /// + public static async Task ExecuteNotifyPartnerPAPPayContractsAsync(this WechatTenpayClient client, Models.NotifyPartnerPAPPayContractsRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + if (request.MerchantId == null) + request.MerchantId = client.Credentials.MerchantId; + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Post, "partner-papay", "contracts", request.ContractId, "notify"); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PAPPay/NotifyPAPPayContractsRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PAPPay/NotifyPAPPayContractsRequest.cs new file mode 100644 index 00000000..74d5a263 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PAPPay/NotifyPAPPayContractsRequest.cs @@ -0,0 +1,57 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +{ + /// + /// 表示 [POST] /papay/contracts/{contract_id}/notify 接口的请求。 + /// + public class NotifyPAPPayContractsRequest : WechatTenpayRequest + { + public static class Types + { + public class Amount + { + /// + /// 获取或设置预计扣费金额(单位:分)。 + /// + [Newtonsoft.Json.JsonProperty("amount")] + [System.Text.Json.Serialization.JsonPropertyName("amount")] + public int Total { get; set; } + + /// + /// 获取或设置预计扣费币种。 + /// 默认值:CNY + /// + [Newtonsoft.Json.JsonProperty("currency")] + [System.Text.Json.Serialization.JsonPropertyName("currency")] + public string Currency { get; set; } = "CNY"; + } + } + + /// + /// 获取或设置委托代扣协议 ID。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string ContractId { get; set; } = string.Empty; + + /// + /// 获取或设置微信商户号。如果不指定将使用构造 时的 参数。 + /// + [Newtonsoft.Json.JsonProperty("mchid")] + [System.Text.Json.Serialization.JsonPropertyName("mchid")] + public string? MerchantId { get; set; } + + /// + /// 获取或设置微信 AppId。 + /// + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public string AppId { get; set; } = string.Empty; + + /// + /// 获取或设置预计扣费金额信息。 + /// + [Newtonsoft.Json.JsonProperty("estimated_amount")] + [System.Text.Json.Serialization.JsonPropertyName("estimated_amount")] + public Types.Amount EstimatedAmount { get; set; } = new Types.Amount(); + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PAPPay/NotifyPAPPayContractsResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PAPPay/NotifyPAPPayContractsResponse.cs new file mode 100644 index 00000000..6add456b --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PAPPay/NotifyPAPPayContractsResponse.cs @@ -0,0 +1,9 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +{ + /// + /// 表示 [POST] /papay/contracts/{contract_id}/notify 接口的响应。 + /// + public class NotifyPAPPayContractsResponse : WechatTenpayResponse + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PartnerPAPPay/NotifyPartnerPAPPayContractsRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PartnerPAPPay/NotifyPartnerPAPPayContractsRequest.cs new file mode 100644 index 00000000..0a305e73 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PartnerPAPPay/NotifyPartnerPAPPayContractsRequest.cs @@ -0,0 +1,57 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +{ + /// + /// 表示 [POST] /partner-papay/contracts/{contract_id}/notify 接口的请求。 + /// + public class NotifyPartnerPAPPayContractsRequest : WechatTenpayRequest + { + public static class Types + { + public class Amount : NotifyPAPPayContractsRequest.Types.Amount + { + } + } + + /// + /// 获取或设置委托代扣协议 ID。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string ContractId { get; set; } = string.Empty; + + /// + /// 获取或设置微信商户号。如果不指定将使用构造 时的 参数。 + /// + [Newtonsoft.Json.JsonProperty("sp_mchid")] + [System.Text.Json.Serialization.JsonPropertyName("sp_mchid")] + public string? MerchantId { get; set; } + + /// + /// 获取或设置微信 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sp_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sp_appid")] + public string AppId { get; set; } = string.Empty; + + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonProperty("sub_mchid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_mchid")] + public string SubMerchantId { get; set; } = string.Empty; + + /// + /// 获取或设置子商户 AppId。 + /// + [Newtonsoft.Json.JsonProperty("sub_appid")] + [System.Text.Json.Serialization.JsonPropertyName("sub_appid")] + public string? SubAppid { get; set; } + + /// + /// 获取或设置预计扣费金额信息。 + /// + [Newtonsoft.Json.JsonProperty("estimated_amount")] + [System.Text.Json.Serialization.JsonPropertyName("estimated_amount")] + public Types.Amount EstimatedAmount { get; set; } = new Types.Amount(); + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PartnerPAPPay/NotifyPartnerPAPPayContractsResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PartnerPAPPay/NotifyPartnerPAPPayContractsResponse.cs new file mode 100644 index 00000000..2bdb8078 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/PartnerPAPPay/NotifyPartnerPAPPayContractsResponse.cs @@ -0,0 +1,9 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +{ + /// + /// 表示 [POST] /partner-papay/contracts/{contract_id}/notify 接口的响应。 + /// + public class NotifyPartnerPAPPayContractsResponse : WechatTenpayResponse + { + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/EventSamples/OrderEvent.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/EventSamples/OrderEvent.json new file mode 100644 index 00000000..2bbdc649 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/EventSamples/OrderEvent.json @@ -0,0 +1,24 @@ +{ + "appid": "wx2421b1c4370ec43b", + "sub_appid": "wx2421b1c4370ec13b", + "attach": "支付测试", + "bank_type": "CFT", + "fee_type": "CNY", + "is_subscribe": "Y", + "mch_id": "10000100", + "nonce_str": "5d2b6c2a8db53831f7eda20af46e531c", + "openid": "oUpF8uMEb4qRXf22hE3X68TekukE", + "out_trade_no": "1409811653", + "result_code": "SUCCESS", + "return_code": "SUCCESS", + "sign": "B552ED6B279343CB493C5DD0D78AB241", + "sub_mch_id": "10000100", + "time_end": "20140903131540", + "total_fee": "1", + "coupon_fee_0": "10", + "coupon_count": "1", + "coupon_type_0": "CASH", + "coupon_id_0": "10000", + "trade_type": "JSAPI", + "transaction_id": "1004400740201409030005092168" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/EventSamples/PAPContractEvent.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/EventSamples/PAPContractEvent.json new file mode 100644 index 00000000..2dfcf324 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/EventSamples/PAPContractEvent.json @@ -0,0 +1,13 @@ +{ + "return_code": "SUCCESS", + "result_code": "SUCCESS", + "sign": "C380BEC2BFD727A4B6845133519F3AD6", + "mch_id": "10010404", + "sub_mch_id": "10010405", + "contract_code": "100001256", + "openid": "onqOjjmM1tad-3ROpncN-yUfa6ua", + "plan_id": "123", + "change_type": "ADD", + "operate_time": "2015-07-01 10:00:00", + "contract_id": "Wx15463511252015071056489715" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/EventSamples/PAPOrderEvent.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/EventSamples/PAPOrderEvent.json new file mode 100644 index 00000000..71a38b31 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/EventSamples/PAPOrderEvent.json @@ -0,0 +1,21 @@ +{ + "appid": "wx2421b1c4370ec43b", + "attach": "支付测试", + "bank_type": "CFT", + "fee_type": "CNY", + "is_subscribe": "Y", + "mch_id": "10000100", + "sub_mch_id": "10000100", + "nonce_str": "5d2b6c2a8db53831f7eda20af46e531c", + "openid": "oUpF8uMEb4qRXf22hE3X68TekukE", + "out_trade_no": "1409811653", + "cash_fee": "1000", + "trade_state": "SUCCESS", + "result_code": "SUCCESS", + "return_code": "SUCCESS", + "sign": "B552ED6B279343CB493C5DD0D78AB241", + "time_end": "20140903131540", + "total_fee": "1", + "transaction_id": "1004400740201409030005092168", + "contract_id": "Wx15463511252015071056489715" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/EventSamples/RefundEventRequestInfo.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/EventSamples/RefundEventRequestInfo.json new file mode 100644 index 00000000..88323932 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/EventSamples/RefundEventRequestInfo.json @@ -0,0 +1,15 @@ +{ + "out_refund_no": "131811191610442717309", + "out_trade_no": "71106718111915575302817", + "refund_account": "REFUND_SOURCE_RECHARGE_FUNDS", + "refund_fee": "3960", + "refund_id": "50000408942018111907145868882", + "refund_recv_accout": "支付用户零钱", + "refund_request_source": "API", + "refund_status": "SUCCESS", + "settlement_refund_fee": "3960", + "settlement_total_fee": "3960", + "success_time": "2018-11-19 16:24:13", + "total_fee": "3960", + "transaction_id": "4200000215201811190261405420" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/ConsumeDepositRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/ConsumeDepositRequest.json new file mode 100644 index 00000000..e4008f01 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/ConsumeDepositRequest.json @@ -0,0 +1,11 @@ +{ + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "nonce_str": "GOp3TRyMXzbMlkun", + "sign": "D6C76CB785F07992CDE05494BB7DF7FD", + "transaction_id": "1008450740201411110005820873", + "out_trade_no": "1415757673", + "total_fee": "1", + "consume_fee": "0", + "fee_type": "CNY" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/ConsumeDepositResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/ConsumeDepositResponse.json new file mode 100644 index 00000000..c763e383 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/ConsumeDepositResponse.json @@ -0,0 +1,14 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "nonce_str": "GOp3TRyMXzbMlkun", + "sign": "D6C76CB785F07992CDE05494BB7DF7FD", + "result_code": "SUCCESS", + "transaction_id": "1008450740201411110005820873", + "out_trade_no": "1415757673", + "total_fee": "1", + "consume_fee": "0", + "fee_type": "CNY" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositFacePayRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositFacePayRequest.json new file mode 100644 index 00000000..89f067f2 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositFacePayRequest.json @@ -0,0 +1,17 @@ +{ + "deposit": "Y", + "appid": "wx2421b1c4370ec43b", + "attach": "订单额外描述", + "face_code": " b713b5d2-666c-48b6-8c37-f15acf5a7069", + "openid": " oHkLxtxS5pkpxVbVeVuqpPQviw5o ", + "body": "押金人脸支付测试", + "device_info": "1000", + "mch_id": "10000100", + "sub_mch_id": "10000101", + "nonce_str": "8aaee146b1dee7cec9100add9b96cbe2", + "out_trade_no": "1415757673", + "spbill_create_ip": "14.17.22.52", + "total_fee": "1", + "sign_type": " HMAC-SHA256", + "sign": "C29DB7DB1FD4136B84AE35604756362C" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositFacePayResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositFacePayResponse.json new file mode 100644 index 00000000..9f668743 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositFacePayResponse.json @@ -0,0 +1,21 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "device_info": "1000", + "nonce_str": "GOp3TRyMXzbMlkun", + "sign": "D6C76CB785F07992CDE05494BB7DF7FD", + "result_code": "SUCCESS", + "openid": "oUpF8uN95-Ptaags6E_roPHg7AG0", + "is_subscribe": "Y", + "trade_type": "MICROPAY", + "bank_type": "CCB_DEBIT", + "total_fee": "1", + "coupon_fee": "0", + "fee_type": "CNY", + "transaction_id": "1008450740201411110005820873", + "out_trade_no": "1415757673", + "attach": "订单额外描述", + "time_end": "20141111170043" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositMicroPayRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositMicroPayRequest.json new file mode 100644 index 00000000..232492d6 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositMicroPayRequest.json @@ -0,0 +1,16 @@ +{ + "deposit": "Y", + "appid": "wx2421b1c4370ec43b", + "attach": "订单额外描述", + "auth_code": "120269300684844649", + "body": "支付测试", + "device_info": "1000", + "mch_id": "10000100", + "sub_mch_id": "10000101", + "nonce_str": "8aaee146b1dee7cec9100add9b96cbe2", + "out_trade_no": "1415757673", + "spbill_create_ip": "14.17.22.52", + "total_fee": "1", + "sign_type": " HMAC-SHA256", + "sign": "C29DB7DB1FD4136B84AE35604756362C" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositMicroPayResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositMicroPayResponse.json new file mode 100644 index 00000000..9f668743 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositMicroPayResponse.json @@ -0,0 +1,21 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "device_info": "1000", + "nonce_str": "GOp3TRyMXzbMlkun", + "sign": "D6C76CB785F07992CDE05494BB7DF7FD", + "result_code": "SUCCESS", + "openid": "oUpF8uN95-Ptaags6E_roPHg7AG0", + "is_subscribe": "Y", + "trade_type": "MICROPAY", + "bank_type": "CCB_DEBIT", + "total_fee": "1", + "coupon_fee": "0", + "fee_type": "CNY", + "transaction_id": "1008450740201411110005820873", + "out_trade_no": "1415757673", + "attach": "订单额外描述", + "time_end": "20141111170043" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositRefundRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositRefundRequest.json new file mode 100644 index 00000000..c5c4d39c --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositRefundRequest.json @@ -0,0 +1,13 @@ +{ + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "nonce_str": "6cefdb308e1e2e8aabd48cf79e546a02", + "sub_mch_id": "1415701182", + "out_refund_no": "1415701182", + "out_trade_no": "1415757673", + "refund_fee": "1", + "total_fee": "1", + "transaction_id": "4006252001201705123297353072", + "sign": "FE56DD4AA85C0EECA82C35595A69E153", + "sign_type": " HMAC-SHA256" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositRefundResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositRefundResponse.json new file mode 100644 index 00000000..a39c7dd9 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositRefundResponse.json @@ -0,0 +1,14 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "nonce_str": "NfsMFbUFpdbEhPXP", + "sign": "B7274EB9F8925EB93100DD2085FA56C0", + "result_code": "SUCCESS", + "transaction_id": "1008450740201411110005820873", + "out_trade_no": "1415757673", + "refund_id": "2008450740201411110000174436", + "refund_fee": "1", + "coupon_refund_fee": "0" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositUnifiedOrderRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositUnifiedOrderRequest.json new file mode 100644 index 00000000..349c287a --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositUnifiedOrderRequest.json @@ -0,0 +1,16 @@ +{ + "appid": "wx2421b1c4370ec43b", + "attach": "支付测试", + "body": "JSAPI支付测试", + "mch_id": "10000100", + "detail": "{ \"goods_detail\":[ { \"goods_id\":\"iphone6s_16G\", \"wxpay_goods_id\":\"1001\", \"goods_name\":\"iPhone6s 16G\", \"quantity\":1, \"price\":528800, \"goods_category\":\"123456\", \"body\":\"苹果手机\" }, { \"goods_id\":\"iphone6s_32G\", \"wxpay_goods_id\":\"1002\", \"goods_name\":\"iPhone6s 32G\", \"quantity\":1, \"price\":608800, \"goods_category\":\"123789\", \"body\":\"苹果手机\" } ] }", + "nonce_str": "1add1a30ac87aa2db72f57a2375d8fec", + "notify_url": "http://wxpay.wxutil.com/pub_v2/pay/notify.v2.php", + "openid": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o", + "out_trade_no": "1415659990", + "fee_type": "CNY", + "spbill_create_ip": "14.23.150.211", + "total_fee": "1", + "trade_type": "JSAPI", + "sign": "0CB01533B8C1EF103065174F50BCA001" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositUnifiedOrderResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositUnifiedOrderResponse.json new file mode 100644 index 00000000..347c793e --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/CreateDepositUnifiedOrderResponse.json @@ -0,0 +1,11 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "nonce_str": "IITRi8Iabbblz1Jc", + "sign": "7921E432F65EB8ED0CE9755F0E86D72F", + "result_code": "SUCCESS", + "prepay_id": "wx201411101639507cbf6ffd8b0779950874", + "trade_type": "JSAPI" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/GetDepositOrderRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/GetDepositOrderRequest.json new file mode 100644 index 00000000..4f886243 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/GetDepositOrderRequest.json @@ -0,0 +1,8 @@ +{ + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "nonce_str": "ec2316275641faa3aacf3cc599e8730f", + "transaction_id": "1008450740201411110005820873", + "sign_type": " HMAC-SHA256", + "sign": "FDD167FAA73459FD921B144BAF4F4CA2" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/GetDepositOrderResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/GetDepositOrderResponse.json new file mode 100644 index 00000000..e0fef85b --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/GetDepositOrderResponse.json @@ -0,0 +1,21 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "device_info": "1000", + "nonce_str": "TN55wO9Pba5yENl8", + "sign": "BDF0099C15FF7BC6B1585FBB110AB635", + "result_code": "SUCCESS", + "openid": "oUpF8uN95-Ptaags6E_roPHg7AG0", + "is_subscribe": "Y", + "trade_type": "MICROPAY", + "bank_type": "CCB_DEBIT", + "total_fee": "1", + "fee_type": "CNY", + "transaction_id": "1008450740201411110005820873", + "out_trade_no": "1415757673", + "attach": "订单额外描述", + "time_end": "20141111170043", + "trade_state": "SUCCESS" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/GetDepositRefundRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/GetDepositRefundRequest.json new file mode 100644 index 00000000..2d02bd8e --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/GetDepositRefundRequest.json @@ -0,0 +1,8 @@ +{ + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "nonce_str": "0b9f35f484df17a732e537c37708d1d0", + "sub_mch_id": "1900000109", + "sign": "66FFB727015F450D167EF38CCC549521", + "sign_type": " HMAC-SHA256" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/GetDepositRefundResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/GetDepositRefundResponse.json new file mode 100644 index 00000000..b824e1f3 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/GetDepositRefundResponse.json @@ -0,0 +1,15 @@ +{ + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "nonce_str": "TeqClE3i0mvn3DrK", + "out_refund_no_0": "1415701182", + "out_trade_no": "1415757673", + "refund_count": "1", + "refund_fee_0": "1", + "refund_status_0": "PROCESSING", + "result_code": "SUCCESS", + "return_code": "SUCCESS", + "return_msg": "OK", + "sign": "1F2841558E233C33ABA71A961D27561C", + "transaction_id": "1008450740201411110005820873" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/ReverseDepositOrderRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/ReverseDepositOrderRequest.json new file mode 100644 index 00000000..7454ec9f --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/ReverseDepositOrderRequest.json @@ -0,0 +1,8 @@ +{ + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "nonce_str": "b7ffb16a7150cf08639db472c5f5bdae", + "out_trade_no": "1415717424", + "sign_type": " HMAC-SHA256", + "sign": "9B2EA16C05A5CEF8E53B14D53932D012" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/ReverseDepositOrderResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/ReverseDepositOrderResponse.json new file mode 100644 index 00000000..69db3868 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Deposit/ReverseDepositOrderResponse.json @@ -0,0 +1,9 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "nonce_str": "o5bAKF3o2ypC8hwa", + "sign": "6F5080EDDD196FFCDE53F786BBB93899", + "result_code": "SUCCESS" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Fraud/GetRiskPublicKeyRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Fraud/GetRiskPublicKeyRequest.json new file mode 100644 index 00000000..67ba9ddf --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Fraud/GetRiskPublicKeyRequest.json @@ -0,0 +1,6 @@ +{ + "mch_id": "123456", + "nonce_str": "5087e0xessefellkg", + "sign": "xxxxxx", + "sign_type": "MD5" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Fraud/GetRiskPublicKeyResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Fraud/GetRiskPublicKeyResponse.json new file mode 100644 index 00000000..998e7e8e --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Fraud/GetRiskPublicKeyResponse.json @@ -0,0 +1,7 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "result_code": "SUCCESS", + "mch_id": "123456", + "pub_key": "-----BEGIN RSA PUBLIC KEY-----\nBASE64 ENCODED DATA\n-----END RSA PUBLIC KEY-----\n" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/ApplyPAPPayRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/ApplyPAPPayRequest.json new file mode 100644 index 00000000..e7ac95e8 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/ApplyPAPPayRequest.json @@ -0,0 +1,12 @@ +{ + "mch_id": "10000098", + "appid": "wxcbda96de0b165486", + "nonce_str": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS", + "sign": "C380BEC2BFD727A4B6845133519F3AD6", + "body": "水电代扣", + "out_trade_no": "217752501201407033233368018", + "total_fee": "888", + "spbill_create_ip": "8.8.8.8", + "notify_url": "http://yoursite.com/wxpay.html", + "contract_id": "Wx15463511252015071056489715" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/ApplyPAPPayResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/ApplyPAPPayResponse.json new file mode 100644 index 00000000..a0e8a5ed --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/ApplyPAPPayResponse.json @@ -0,0 +1,9 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "appid": "wxcbda96de0b165486", + "mch_id": "10000098", + "nonce_str": "IITRi8Iabbblz1Jc", + "sign": "E1EE61A91C8E90F299DE6AE075D60A2D", + "result_code": "SUCCESS" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/DeletePAPPayContractRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/DeletePAPPayContractRequest.json new file mode 100644 index 00000000..90144118 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/DeletePAPPayContractRequest.json @@ -0,0 +1,9 @@ +{ + "mch_id": "10000098", + "appid": "wxcbda96de0b165486", + "sign": "E1EE61A91C8E90F299DE6AE075D60A2D", + "plan_id": "12251", + "contract_code": "1234", + "contract_termination_remark": "原因", + "version": "1.0" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/DeletePAPPayContractResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/DeletePAPPayContractResponse.json new file mode 100644 index 00000000..95b8469a --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/DeletePAPPayContractResponse.json @@ -0,0 +1,8 @@ +{ + "return_code": "SUCCESS", + "result_code": "SUCCESS", + "sign": "C380BEC2BFD727A4B6845133519F3AD6", + "mch_id": "10010404", + "appid": "wxcbda96de0b165486", + "contract_id": "100005698" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/GetPAPPayContractRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/GetPAPPayContractRequest.json new file mode 100644 index 00000000..071f3f66 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/GetPAPPayContractRequest.json @@ -0,0 +1,7 @@ +{ + "sign": "019C869758CC7F258C42F05CDB9EE361", + "mch_id": "10000097", + "appid": "wxf5b5e87a6a0fde94", + "contract_id": "201509160000028648", + "version": "1.0" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/GetPAPPayContractResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/GetPAPPayContractResponse.json new file mode 100644 index 00000000..f9df36d5 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/Contract/GetPAPPayContractResponse.json @@ -0,0 +1,21 @@ +{ + "return_code": " SUCCESS ", + "result_code": " SUCCESS ", + "mch_id": " 80000000 ", + "appid": " wx426b3015555b46be ", + "contract_id": "203", + "plan_id": "66", + "openid": " oHZx6uMbIG46UXQ3SKxVYEgw1LZs ", + "request_serial": "123", + "contract_code": " 1005 ", + "contract_display_account": " test ", + "contract_state": "1", + "contract_signed_time": "2015-07-01 10:00:00", + "contract_expired_time": "2015-07-01 10:00:00", + "contract_terminated_time": "2015-07-01 10:00:00", + "contract_termination_mode": "3", + "contract_termination_remark": " delete .... ", + "err_code": "0", + "err_code_des": " SUCCESS ", + "sign": " 8FC9DACB7DDF9B48333DCCC2224E0CAC " +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/CreateContractOrderRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/CreateContractOrderRequest.json new file mode 100644 index 00000000..c6ac9c78 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/CreateContractOrderRequest.json @@ -0,0 +1,21 @@ +{ + "appid": "wxcbda96de0b165486", + "mch_id": "1200009811", + "contract_mchid": "1200009811", + "contract_appid": "wxcbda96de0b165486", + "out_trade_no": "123456", + "device_info": "013467007045764", + "nonce_str": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS", + "body": "Ipad mini 16G 白色", + "detail": "Ipad mini 16G 白色", + "notify_url": "https://weixin.qq.com", + "total_fee": "888", + "spbill_create_ip": "123.12.12.123", + "trade_type": "JSAPI", + "plan_id": "123", + "contract_code": "100001256", + "request_serial": "1000", + "contract_display_account": "微信代扣", + "contract_notify_url": "https://yoursite.com", + "sign": "C380BEC2BFD727A4B6845133519F3AD6" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/CreateContractOrderResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/CreateContractOrderResponse.json new file mode 100644 index 00000000..9f9f9cca --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/CreateContractOrderResponse.json @@ -0,0 +1,12 @@ +{ + "return_code": "SUCCESS", + "result_code": "SUCCESS", + "appid": "wxcbda96de0b165486", + "mch_id": "1200009811", + "prepay_id": "wx201410272009395522657a690389285100", + "sign": "E1EE61A91C8E90F299DE6AE075D60A2D", + "trade_type": "JSAPI", + "code_url": "weixin//wxpay/s/An4baqw", + "plan_id": "123", + "out_trade_no": "123456" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/CreatePAPPayPreEntrustWebRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/CreatePAPPayPreEntrustWebRequest.json new file mode 100644 index 00000000..a0c3ab01 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/CreatePAPPayPreEntrustWebRequest.json @@ -0,0 +1,13 @@ +{ + "appid": "wxcbda96de0b165486", + "mch_id": "1200009811", + "plan_id": "12535", + "contract_code": "100000", + "request_serial": "1000", + "contract_display_account": "微信代扣", + "notify_url": "https://weixin.qq.com", + "version": "1.0", + "sign": "C380BEC2BFD727A4B6845133519F3AD6", + "timestamp": "1414488825", + "return_app": "Y" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/CreatePAPPayPreEntrustWebResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/CreatePAPPayPreEntrustWebResponse.json new file mode 100644 index 00000000..a26ba116 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAP/CreatePAPPayPreEntrustWebResponse.json @@ -0,0 +1,10 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "result_code": "SUCCESS", + "appid": "wxcbda96de0b165486", + "mch_id": "10000098", + "nonce_str": "IITRi8Iabbblz1Jc", + "sign": "E1EE61A91C8E90F299DE6AE075D60A2D", + "pre_entrustweb_id": "5778aadY9nltAsZzXixCkFIGYnV2V" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/Contract/ApplyPAPPayPartnerRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/Contract/ApplyPAPPayPartnerRequest.json new file mode 100644 index 00000000..5ebc9fd9 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/Contract/ApplyPAPPayPartnerRequest.json @@ -0,0 +1,14 @@ +{ + "mch_id": "10000098", + "appid": "wxcbda96de0b165486", + "sub_mch_id": "10010405", + "nonce_str": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS", + "sign": "C380BEC2BFD727A4B6845133519F3AD6", + "body": "水电代扣", + "out_trade_no": "217752501201407033233368018", + "total_fee": "888", + "trade_type": "PAP", + "spbill_create_ip": "8.8.8.8", + "notify_url": "http://yoursite.com/wxpay.html", + "contract_id": "Wx15463511252015071056489715" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/Contract/ApplyPAPPayPartnerResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/Contract/ApplyPAPPayPartnerResponse.json new file mode 100644 index 00000000..9f93f4a2 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/Contract/ApplyPAPPayPartnerResponse.json @@ -0,0 +1,10 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "appid": "wxcbda96de0b165486", + "mch_id": "10000098", + "sub_mch_id": "10010405", + "nonce_str": "IITRi8Iabbblz1Jc", + "sign": "E1EE61A91C8E90F299DE6AE075D60A2D", + "result_code": "SUCCESS" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/Contract/GetPAPPayPartnerContractRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/Contract/GetPAPPayPartnerContractRequest.json new file mode 100644 index 00000000..badbd1e3 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/Contract/GetPAPPayPartnerContractRequest.json @@ -0,0 +1,8 @@ +{ + "sign": "019C869758CC7F258C42F05CDB9EE361", + "mch_id": "10000097", + "sub_mch_id": "1900000109", + "appid": "wxf5b5e87a6a0fde94", + "contract_id": "201509160000028648", + "version": "1.0" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/Contract/GetPAPPayPartnerContractResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/Contract/GetPAPPayPartnerContractResponse.json new file mode 100644 index 00000000..8fe0afb1 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/Contract/GetPAPPayPartnerContractResponse.json @@ -0,0 +1,22 @@ +{ + "return_code": " SUCCESS ", + "result_code": " SUCCESS ", + "mch_id": " 80000000 ", + "appid": " wx426b3015555b46be ", + "sub_mch_id": " 10010405 ", + "contract_id": "203", + "plan_id": "66", + "openid": " oHZx6uMbIG46UXQ3SKxVYEgw1LZs ", + "request_serial": "123", + "contract_code": " 1005 ", + "contract_display_account": " test ", + "contract_state": "1", + "contract_signed_time": "2015-07-01 10:00:00", + "contract_expired_time": "2015-07-01 10:00:00", + "contract_terminated_time": "2015-07-01 10:00:00", + "contract_termination_mode": "3", + "contract_termination_remark": " delete .... ", + "err_code": "0", + "err_code_des": " SUCCESS ", + "sign": " 8FC9DACB7DDF9B48333DCCC2224E0CAC " +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/CreatePAPPayPartnerPreEntrustWebRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/CreatePAPPayPartnerPreEntrustWebRequest.json new file mode 100644 index 00000000..29a75dbc --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/CreatePAPPayPartnerPreEntrustWebRequest.json @@ -0,0 +1,15 @@ +{ + "appid": "wxcbda96de0b165486", + "mch_id": "1200009811", + "sub_appid": "wxcbda96de0b165489", + "sub_mch_id": "1900000109", + "plan_id": "12535", + "contract_code": "100000", + "request_serial": "1000", + "contract_display_account": "微信代扣", + "notify_url": "https://weixin.qq.com", + "version": "1.0", + "sign": "C380BEC2BFD727A4B6845133519F3AD6", + "timestamp": "1414488825", + "return_app": "Y" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/CreatePAPPayPartnerPreEntrustWebResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/CreatePAPPayPartnerPreEntrustWebResponse.json new file mode 100644 index 00000000..9a69f154 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PAPPartner/CreatePAPPayPartnerPreEntrustWebResponse.json @@ -0,0 +1,12 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "result_code": "SUCCESS", + "appid": "wxcbda96de0b165486", + "mch_id": "10000098", + "sub_appid": "wxcbda96de0b165489", + "sub_mch_id": "1900000109", + "nonce_str": "IITRi8Iabbblz1Jc", + "sign": "E1EE61A91C8E90F299DE6AE075D60A2D", + "pre_entrustweb_id": "5778aadY9nltAsZzXixCkFIGYnV2V" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/ClosePayOrderRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/ClosePayOrderRequest.json new file mode 100644 index 00000000..422e1e6b --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/ClosePayOrderRequest.json @@ -0,0 +1,8 @@ +{ + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "sub_mch_id": "1900000109", + "nonce_str": "4ca93f17ddf3443ceabf72f26d64fe0e", + "out_trade_no": "1415983244", + "sign": "59FF1DF214B2D279A0EA7077C54DD95D" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/ClosePayOrderResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/ClosePayOrderResponse.json new file mode 100644 index 00000000..097c51ed --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/ClosePayOrderResponse.json @@ -0,0 +1,11 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "sub_mch_id": "1900000109", + "nonce_str": "BFK89FC6rxKCOjLX", + "sign": "72B321D92A7BFA0B2509F3D13C7B1631", + "result_code": "SUCCESS", + "result_msg": "OK" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/CreatePayRefundRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/CreatePayRefundRequest.json new file mode 100644 index 00000000..987f33d6 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/CreatePayRefundRequest.json @@ -0,0 +1,12 @@ +{ + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "sub_mch_id": "10000109", + "nonce_str": "6cefdb308e1e2e8aabd48cf79e546a02", + "out_refund_no": "1415701182", + "out_trade_no": "1415757673", + "refund_fee": "1", + "total_fee": "1", + "transaction_id": "4006252001201705123297353072", + "sign": "FE56DD4AA85C0EECA82C35595A69E153" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/CreatePayRefundResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/CreatePayRefundResponse.json new file mode 100644 index 00000000..9759f979 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/CreatePayRefundResponse.json @@ -0,0 +1,15 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "sub_mch_id": "10000101", + "nonce_str": "NfsMFbUFpdbEhPXP", + "sign": "B7274EB9F8925EB93100DD2085FA56C0", + "result_code": "SUCCESS", + "transaction_id": "4008450740201411110005820873", + "out_trade_no": "1415757673", + "out_refund_no": "1415701182", + "refund_id": "2008450740201411110000174436", + "refund_fee": "1" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/CreatePayUnifiedOrderRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/CreatePayUnifiedOrderRequest.json new file mode 100644 index 00000000..b0fb7544 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/CreatePayUnifiedOrderRequest.json @@ -0,0 +1,16 @@ +{ + "appid": "wx2421b1c4370ec43b", + "attach": "支付测试", + "body": "JSAPI支付测试", + "mch_id": "10000100", + "sub_mch_id": "1900000109", + "detail": "{ \"goods_detail\":[ { \"goods_id\":\"iphone6s_16G\", \"wxpay_goods_id\":\"1001\", \"goods_name\":\"iPhone6s 16G\", \"quantity\":1, \"price\":528800, \"goods_category\":\"123456\", \"body\":\"苹果手机\" }, { \"goods_id\":\"iphone6s_32G\", \"wxpay_goods_id\":\"1002\", \"goods_name\":\"iPhone6s 32G\", \"quantity\":1, \"price\":608800, \"goods_category\":\"123789\", \"body\":\"苹果手机\" } ] }", + "nonce_str": "1add1a30ac87aa2db72f57a2375d8fec", + "notify_url": "https://wxpay.wxutil.com/pub_v2/pay/notify.v2.php", + "openid": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o", + "out_trade_no": "1415659990", + "spbill_create_ip": "14.23.150.211", + "total_fee": "1", + "trade_type": "JSAPI", + "sign": "0CB01533B8C1EF103065174F50BCA001" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/CreatePayUnifiedOrderResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/CreatePayUnifiedOrderResponse.json new file mode 100644 index 00000000..6689ee7b --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/CreatePayUnifiedOrderResponse.json @@ -0,0 +1,12 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "sub_mch_id": "1900000109", + "nonce_str": "IITRi8Iabbblz1Jc", + "sign": "7921E432F65EB8ED0CE9755F0E86D72F", + "result_code": "SUCCESS", + "prepay_id": "wx201411101639507cbf6ffd8b0779950874", + "trade_type": "JSAPI" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/GetPayOrderRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/GetPayOrderRequest.json new file mode 100644 index 00000000..531cd707 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/GetPayOrderRequest.json @@ -0,0 +1,9 @@ +{ + "appid": "wx2421b1c4370ec43b", + "sub_appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "sub_mch_id": "1900000109", + "nonce_str": "ec2316275641faa3aacf3cc599e8730f", + "transaction_id": "1008450740201411110005820873", + "sign": "FDD167FAA73459FD921B144BAF4F4CA2" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/GetPayOrderResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/GetPayOrderResponse.json new file mode 100644 index 00000000..9f1f8a5b --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/GetPayOrderResponse.json @@ -0,0 +1,26 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "sub_mch_id": "1900000109", + "device_info": "1000", + "nonce_str": "TN55wO9Pba5yENl8", + "sign": "BDF0099C15FF7BC6B1585FBB110AB635", + "result_code": "SUCCESS", + "openid": "oUpF8uN95-Ptaags6E_roPHg7AG0", + "is_subscribe": "Y", + "trade_type": "MICROPAY", + "bank_type": "CCB_DEBIT", + "total_fee": "1", + "fee_type": "CNY", + "transaction_id": "1008450740201411110005820873", + "out_trade_no": "1415757673", + "attach": "订单额外描述", + "time_end": "20141111170043", + "trade_state": "SUCCESS", + "coupon_id_0": "10000", + "coupon_type_0": "CASH", + "coupon_fee_0": 100, + "detail": "{\"discount_detail\":[{\"goods_id\":\"iphone6s_16G\",\"goods_name\":\"iPhone6s 16G\",\"coupon_batch_id\":888,\"coupon_id\":666888,\"coupon_fee\":1000},{\"goods_id\":\"iphone6s_32G\",\"goods_name\":\"iPhone6s 32G\",\"coupon_batch_id\":999,\"coupon_id\":666999,\"coupon_fee\":1500}]}" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/GetPayRefundRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/GetPayRefundRequest.json new file mode 100644 index 00000000..8e3b9f97 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/GetPayRefundRequest.json @@ -0,0 +1,7 @@ +{ + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "nonce_str": "0b9f35f484df17a732e537c37708d1d0", + "out_trade_no": "1415757673", + "sign": "66FFB727015F450D167EF38CCC549521" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/GetPayRefundResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/GetPayRefundResponse.json new file mode 100644 index 00000000..b4e80a6e --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/GetPayRefundResponse.json @@ -0,0 +1,15 @@ +{ + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "nonce_str": "TeqClE3i0mvn3DrK", + "out_refund_no_0": "1415701182", + "out_trade_no": "1415757673", + "refund_fee_0": "1", + "refund_id_0": "2008450740201411110000174436", + "refund_status_0": "PROCESSING", + "result_code": "SUCCESS", + "return_code": "SUCCESS", + "return_msg": "OK", + "sign": "1F2841558E233C33ABA71A961D27561C", + "transaction_id": "1008450740201411110005820873" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/ReversePayOrderRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/ReversePayOrderRequest.json new file mode 100644 index 00000000..422e1e6b --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/ReversePayOrderRequest.json @@ -0,0 +1,8 @@ +{ + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "sub_mch_id": "1900000109", + "nonce_str": "4ca93f17ddf3443ceabf72f26d64fe0e", + "out_trade_no": "1415983244", + "sign": "59FF1DF214B2D279A0EA7077C54DD95D" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/ReversePayOrderResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/ReversePayOrderResponse.json new file mode 100644 index 00000000..581c2897 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Pay/ReversePayOrderResponse.json @@ -0,0 +1,12 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "sub_mch_id": "1900000109", + "nonce_str": "BFK89FC6rxKCOjLX", + "sign": "72B321D92A7BFA0B2509F3D13C7B1631", + "result_code": "SUCCESS", + "result_msg": "OK", + "recall": "Y" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/GetPayMarketingTransfersRedPackInfoRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/GetPayMarketingTransfersRedPackInfoRequest.json new file mode 100644 index 00000000..a0603d47 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/GetPayMarketingTransfersRedPackInfoRequest.json @@ -0,0 +1,8 @@ +{ + "sign": "E1EE61A91C8E90F299DE6AE075D60A2D", + "mch_billno": "0010010404201411170000046545", + "mch_id": "10000097", + "appid": "wxe062425f740c30d8", + "bill_type": "MCHT", + "nonce_str": "50780e0cca98c8c8e814883e5caa672e" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/GetPayMarketingTransfersRedPackInfoResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/GetPayMarketingTransfersRedPackInfoResponse.json new file mode 100644 index 00000000..195656be --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/GetPayMarketingTransfersRedPackInfoResponse.json @@ -0,0 +1,30 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "result_code": "SUCCESS", + "err_code": "SUCCESS", + "err_code_des": "OK", + "mch_billno": "9010080799701411170000046603", + "mch_id": "11475856", + "detail_id": "10000417012016080830956240040", + "status": "RECEIVED", + "send_type": "ACTIVITY", + "hb_type": "NORMAL", + "total_num": "1", + "total_amount": "100", + "send_time": "2016-08-08 21:49:22", + "hblist": { + "hbinfo": [ + { + "openid": "oHkLxtzmyHXX6FW_cAWo_orTSRXs", + "amount": "100", + "rcv_time": "2016-08-08 21:49:46" + }, + { + "openid": "oHkLxtzmyHXX6FW_cAWo_orTSRXs", + "amount": "100", + "rcv_time": "2016-08-08 21:49:46" + } + ] + } +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersGroupRedPackRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersGroupRedPackRequest.json new file mode 100644 index 00000000..27cd87c8 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersGroupRedPackRequest.json @@ -0,0 +1,18 @@ +{ + "sign": "E1EE61A91C8E90F299DE6AE075D60A2D", + "mch_billno": "0010010404201411170000046545", + "mch_id": "1000888888", + "sub_mch_id": "1000888888", + "wxappid": "wxcbda96de0b165486", + "send_name": "send_name", + "re_openid": "onqOjjmM1tad-3ROpncN-yUfa6uI", + "total_amount": "600", + "amt_type": "ALL_RAND", + "total_num": "3", + "wishing": "恭喜发财", + "act_name": "新年红包", + "remark": "新年红包", + "scene_id": "PRODUCT_2", + "nonce_str": "50780e0cca98c8c8e814883e5caa672e", + "risk_info": "posttime%3d123123412%26clientversion%3d234134%26mobile%3d122344545%26deviceid%3dIOS" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersGroupRedPackResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersGroupRedPackResponse.json new file mode 100644 index 00000000..590a9af7 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersGroupRedPackResponse.json @@ -0,0 +1,12 @@ +{ + "return_code": "SUCCESS", + "return_msg": "发放成功.", + "result_code": "SUCCESS", + "err_code": "0", + "err_code_des": "发放成功.", + "mch_billno": "0010010404201411170000046545", + "mch_id": "10010404", + "wxappid": "wx6fa7e3bab7e15415", + "re_openid": "onqOjjmM1tad-3ROpncN-yUfa6uI", + "total_amount": "3" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersMiniProgramRedPackRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersMiniProgramRedPackRequest.json new file mode 100644 index 00000000..38aa8532 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersMiniProgramRedPackRequest.json @@ -0,0 +1,15 @@ +{ + "act_name": "act_name", + "mch_billno": "2334580734271081478888000026", + "mch_id": "11475856", + "nonce_str": "1233213123123", + "notify_way": "MINI_PROGRAM_JSAPI", + "re_openid": "oeDV3t7xy1IkfYFzgOsCZvdRjb45", + "remark": "remark", + "send_name": "miniprogramtest", + "total_amount": "100", + "total_num": "1", + "wishing": "wishing", + "wxappid": "wxd27ebc41b85ce36d", + "sign": "b9dca63fe3f06bba49b6c4d6d2035b72" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersMiniProgramRedPackResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersMiniProgramRedPackResponse.json new file mode 100644 index 00000000..e751c482 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersMiniProgramRedPackResponse.json @@ -0,0 +1,14 @@ +{ + "return_code": "SUCCESS", + "return_msg": "发放成功", + "result_code": "SUCCESS", + "err_code": "SUCCESS", + "err_code_des": "发放成功", + "mch_billno": "2334580734271081478888000026", + "mch_id": "11475856", + "wxappid": "wxd27ebc41b85ce36d", + "re_openid": "oeDV3t7xy1IkfYFzgOsCZvdRzx3U", + "total_amount": "10", + "send_listid": "1000041701201609263000000204000", + "package": "sendid=242e8abd163d300019b2cae74ba8e8c06e3f0e51ab84d16b3c80decd22a5b672&ver=8&sign=4110d649a5aef52dd6b95654ddf91ca7d5411ac159ace4e1a766b7d3967a1c3dfe1d256811445a4abda2d9cfa4a9b377a829258bd00d90313c6c346f2349fe5d&mchid=11475856&appid=wxd27ebc41b85ce36d" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersRedPackRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersRedPackRequest.json new file mode 100644 index 00000000..e15b1c39 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersRedPackRequest.json @@ -0,0 +1,17 @@ +{ + "sign": "E1EE61A91C8E90F299DE6AE075D60A2D", + "mch_billno": "0010010404201411170000046545", + "mch_id": "888", + "wxappid": "wxcbda96de0b165486", + "send_name": "send_name", + "re_openid": "onqOjjmM1tad-3ROpncN-yUfa6uI", + "total_amount": "200", + "total_num": "1", + "wishing": "恭喜发财", + "client_ip": "127.0.0.1", + "act_name": "新年红包", + "remark": "新年红包", + "scene_id": "PRODUCT_2", + "nonce_str": "50780e0cca98c8c8e814883e5caa672e", + "risk_info": "posttime%3d123123412%26clientversion%3d234134%26mobile%3d122344545%26deviceid%3dIOS" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersRedPackResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersRedPackResponse.json new file mode 100644 index 00000000..f0dfa2b3 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersRedPack/SendPayMarketingTransfersRedPackResponse.json @@ -0,0 +1,12 @@ +{ + "return_code": "SUCCESS", + "return_msg": "发放成功.", + "result_code": "SUCCESS", + "err_code": "0", + "err_code_des": "发放成功.", + "mch_billno": "0010010404201411170000046545", + "mch_id": "10010404", + "wxappid": "wx6fa7e3bab7e15415", + "re_openid": "onqOjjmM1tad-3ROpncN-yUfa6uI", + "total_amount": "1" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersTransfer/CreatePayMarketingTransfersPromotionTransferRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersTransfer/CreatePayMarketingTransfersPromotionTransferRequest.json new file mode 100644 index 00000000..94f20adf --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersTransfer/CreatePayMarketingTransfersPromotionTransferRequest.json @@ -0,0 +1,13 @@ +{ + "mch_appid": "wxe062425f740c30d8", + "mchid": "10000098", + "nonce_str": "3PG2J4ILTKCH16CQ2502SI8ZNMTM67VS", + "partner_trade_no": "100000982014120919616", + "openid": "ohO4Gt7wVPxIT1A9GjFaMYMiZY1s", + "check_name": "FORCE_CHECK", + "re_user_name": "张三", + "amount": "100", + "desc": "节日快乐!", + "spbill_create_ip": "10.2.3.10", + "sign": "C97BDBACF37622775366F38B629F45E3" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersTransfer/CreatePayMarketingTransfersPromotionTransferResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersTransfer/CreatePayMarketingTransfersPromotionTransferResponse.json new file mode 100644 index 00000000..cf8466d9 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersTransfer/CreatePayMarketingTransfersPromotionTransferResponse.json @@ -0,0 +1,10 @@ +{ + "return_code": "SUCCESS", + "mch_appid": "wxec38b8ff840bd989", + "mchid": "10013274", + "nonce_str": "lxuDzMnRjpcXzxLx0q", + "result_code": "SUCCESS", + "partner_trade_no": "10013574201505191526582441", + "payment_no": "1000018301201505190181489473", + "payment_time": "2015-05-19 15:26:59" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersTransfer/GetPayMarketingTransfersTransferInfoRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersTransfer/GetPayMarketingTransfersTransferInfoRequest.json new file mode 100644 index 00000000..e369cfb7 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersTransfer/GetPayMarketingTransfersTransferInfoRequest.json @@ -0,0 +1,7 @@ +{ + "sign": "E1EE61A91C8E90F299DE6AE075D60A2D", + "partner_trade_no": "0010010404201411170000046545", + "mch_id": "10000097", + "appid": "wxe062425f740c30d8", + "nonce_str": "50780e0cca98c8c8e814883e5caa672e" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersTransfer/GetPayMarketingTransfersTransferInfoResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersTransfer/GetPayMarketingTransfersTransferInfoResponse.json new file mode 100644 index 00000000..5a7504c1 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayMarketingTransfersTransfer/GetPayMarketingTransfersTransferInfoResponse.json @@ -0,0 +1,15 @@ +{ + "return_code": "SUCCESS", + "return_msg": "获取成功", + "result_code": "SUCCESS", + "mch_id": "10000098", + "appid": "wxe062425f740c30d8", + "detail_id": "1000000000201503283103439304", + "partner_trade_no": "1000005901201407261446939628", + "status": "SUCCESS", + "payment_amount": "650", + "openid": "oxTWIuGaIt6gTKsQRLau2M0yL16E", + "transfer_time": "2015-04-21 20:00:00", + "transfer_name": "测试", + "desc": "福利测试" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayServicePartnerTransfers/CreatePayServicePartnerTransfersPayToBankRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayServicePartnerTransfers/CreatePayServicePartnerTransfersPayToBankRequest.json new file mode 100644 index 00000000..c5acf0e6 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayServicePartnerTransfers/CreatePayServicePartnerTransfersPayToBankRequest.json @@ -0,0 +1,11 @@ +{ + "amount": "500", + "bank_code": "1002", + "desc": "test", + "enc_bank_no": "so40iz98I8P5DRdMpOqYK/SOWdDhW8fQhlCQEuxV//LLvRZs51B4z8yeIe3X7aYyRdJGdYy18RLpJAZEYrZ9y981pB55aU9ZqT1So7Ypc1URahkLAOggUk/nKur750Lei6D0QQ1Q/B1aiYHA+IPwZH1YEjsIra9tvY7LjYgBjUsEnWx51piaL/Bv4gLvK5lo+lT7iTT2eiLD95y7PcV9U5p5zAxRMPiy6dtJt1UYfwNnbHMZbP+hdTmUhBup2JpJbk+9xchWzrwrFUQPYpB4caTOx98xubwrKrOO/xM2lt9GbRsv1GA5vF04jIiWx/dtkjQvWuPlBOTmkSDl6J0ErQ==", + "enc_true_name": "WrmNNBewyx8KJGMtrsYUf3RAmMsaHByOIu/wSjFKy/ouMeg1msRxbwzksPDRjI7OA6pvb3Ty7RQKQTGAjFdaxa10c9Dn0BqLPapP1svj000TWRd1VRJriUqy0macXZu6Pxx9bZd9ngiUcXbrVpGA10BMMwOFJ5VEt7aFJjUJSw2CCZNgj1HOVskm3abNl1eMWyzDCHVjH6uXnT8of17g5GTELTNn2ccNMTmfkUrVJopHeXTA5Yd+uKx5Tgst4IonNiHb+dFWsiGG8aOY29nqHWHw3e+vVRk/0DwEAJzaJlWjb110/TtjYjkquZwFh9XL8GncrNfoBjUz2rtvmhb5Rg==", + "mch_id": "2302758702", + "nonce_str": "50780e0cca98c8c8e814883e5caa672e", + "partner_trade_no": "1212121221278", + "sign": "1b3375482ac61d952aab56b534608971" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayServicePartnerTransfers/CreatePayServicePartnerTransfersPayToBankResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayServicePartnerTransfers/CreatePayServicePartnerTransfersPayToBankResponse.json new file mode 100644 index 00000000..fe223290 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayServicePartnerTransfers/CreatePayServicePartnerTransfersPayToBankResponse.json @@ -0,0 +1,13 @@ +{ + "return_code": "SUCCESS", + "return_msg": "支付成功", + "result_code": "SUCCESS", + "err_code": "SUCCESS", + "err_code_des": "微信侧受理成功", + "nonce_str": "50780e0cca98c8c8e814883e5caa672e", + "mch_id": "2302758702", + "partner_trade_no": "1212121221278", + "amount": "500", + "payment_no": "10000600500852017030900000020006012", + "cmms_amt": "0" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayServicePartnerTransfers/GetPayServicePartnerTransfersPayToBankInfoRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayServicePartnerTransfers/GetPayServicePartnerTransfersPayToBankInfoRequest.json new file mode 100644 index 00000000..fec0d2bf --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayServicePartnerTransfers/GetPayServicePartnerTransfersPayToBankInfoRequest.json @@ -0,0 +1,6 @@ +{ + "mch_id": "2302758702", + "nonce_str": "50780e0cca98c8c8e814883e5caa672e", + "partner_trade_no": "1212121221278", + "sign": "34bf02fe5b20f117365ef6f5d0436be1" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayServicePartnerTransfers/GetPayServicePartnerTransfersPayToBankInfoResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayServicePartnerTransfers/GetPayServicePartnerTransfersPayToBankInfoResponse.json new file mode 100644 index 00000000..a472b19f --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/PayServicePartnerTransfers/GetPayServicePartnerTransfersPayToBankInfoResponse.json @@ -0,0 +1,16 @@ +{ + "return_code": "SUCCESS", + "return_msg": "ok", + "result_code": "SUCCESS", + "err_code": "SUCCESS", + "err_code_des": "ok", + "mch_id": "2302758702", + "partner_trade_no": "1212121221278", + "payment_no": "10000600500852017030900000020006012", + "bank_no_md5": "2260AB5EF3D290E28EFD3F74FF7A29A0", + "true_name_md5": "7F25B325D37790764ABA55DAD8D09B76", + "amount": "500", + "status": "处理中", + "cmms_amt": "0", + "create_time": "2017-03-09 15:04:04" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Risk/QueryRiskViolationRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Risk/QueryRiskViolationRequest.json new file mode 100644 index 00000000..492bcac7 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Risk/QueryRiskViolationRequest.json @@ -0,0 +1,8 @@ +{ + "mch_id": "123456", + "nonce_str": "5087e0xessefellkg", + "sign": "xxxxxx", + "sign_type": "HMAC-SHA256", + "begin_time": "2017-07-02 0:0:0", + "end_time": "2017-07-29 23:59:59" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Risk/QueryRiskViolationResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Risk/QueryRiskViolationResponse.json new file mode 100644 index 00000000..80a66fe7 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/Risk/QueryRiskViolationResponse.json @@ -0,0 +1,5 @@ +{ + "return_code": "FAIL", + "return_msg": "INVALID_REQUEST", + "violation_records": "{\"total_size\":1,\"violation_records\":[{\"company_name\":\"ABC公司\",\"handle_method\":\"刷单欺诈,整改 限期 2天\",\"handle_state\":\"超时未处理\",\"illegal_type\":\"其他\",\"punish_time\":\"2018-07-24 20:12:25\",\"sub_mch_id\":\"1900012891\"}]}" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/SubMerchant/AddSubMerchantDevelopConfigRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/SubMerchant/AddSubMerchantDevelopConfigRequest.json new file mode 100644 index 00000000..4f851956 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/SubMerchant/AddSubMerchantDevelopConfigRequest.json @@ -0,0 +1,8 @@ +{ + "appid": "wx931386123456789e", + "mch_id": "1451234567", + "sub_mch_id": "10000101", + "sub_appid": "wx931386123456789e", + "jsapi_path": "http://www.qq.com/wechat/", + "sign": "C380BEC2BFD727A4B6845133519F3AD6" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/SubMerchant/AddSubMerchantDevelopConfigResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/SubMerchant/AddSubMerchantDevelopConfigResponse.json new file mode 100644 index 00000000..78870084 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/SubMerchant/AddSubMerchantDevelopConfigResponse.json @@ -0,0 +1,8 @@ +{ + "return_code": "SUCCESS", + "return_msg": "签名失败", + "result_code": "FAIL", + "sign": "C380BEC2BFD727A4B6845133519F3AD6", + "err_code": "INVALID_REQUEST", + "err_code_des": "子商户号信息有误,请检查修改后重试" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/SubMerchant/GetSubMerchantDevelopConfigRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/SubMerchant/GetSubMerchantDevelopConfigRequest.json new file mode 100644 index 00000000..104c47f4 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/SubMerchant/GetSubMerchantDevelopConfigRequest.json @@ -0,0 +1,6 @@ +{ + "appid": "wx931386123456789e", + "mch_id": "1451234567", + "sub_mch_id": "10000101", + "sign": "C380BEC2BFD727A4B6845133519F3AD6" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/SubMerchant/GetSubMerchantDevelopConfigResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/SubMerchant/GetSubMerchantDevelopConfigResponse.json new file mode 100644 index 00000000..a68bbb0b --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/SubMerchant/GetSubMerchantDevelopConfigResponse.json @@ -0,0 +1,6 @@ +{ + "return_code": "SUCCESS", + "return_msg": "签名失败", + "jsapi_path_list": "{\"jsapi_path_list\":[\"http://www.qq.com/abcd/\",\"http://www.qq.com/abcdedfg/\"]}", + "appid_config_list": "{\"appid_config_list\":[{\"subscribe_appid\":\"wxa9d9651ae82ec4b9\",\"sub_appid\":null},{\"subscribe_appid\":\"wxa9d9651ae82ec4b9\",\"sub_appid\":\"wxa9d9651ae82ec4b9\"}]}" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/ApplyVehiclePartnerPayRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/ApplyVehiclePartnerPayRequest.json new file mode 100644 index 00000000..6f960a65 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/ApplyVehiclePartnerPayRequest.json @@ -0,0 +1,16 @@ +{ + "mch_id": "10000098", + "sub_mch_id": "10000100", + "appid": "wxcbda96de0b165486", + "nonce_str": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS", + "sign_type": "HMAC-SHA256", + "sign": " EE088059BBC9141264F8D14293AD6C4BB94CEA8C08AA98FBF93E262D445F8FF5", + "body": "公交代扣", + "out_trade_no": "217752501201407033233368018", + "total_fee": "888", + "spbill_create_ip": "8.8.8.8", + "notify_url": "http://yoursite.com/wxpay.html", + "version": "3.0", + "trade_scene": " PARKING", + "scene_info": "{\"scene_info\":{\"start_time\":\"20170926114339\",\"end_time\":\"20170826114339\",\"charging_time\":\"3600\",\"free_time\":\"1200\",\"plate_number\":\"CB1000sdfasd\",\"car_type\":\"大型车\",\"parking_name\":\"欢乐海岸停车场\"}}" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/ApplyVehiclePartnerPayResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/ApplyVehiclePartnerPayResponse.json new file mode 100644 index 00000000..5ea2ad59 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/ApplyVehiclePartnerPayResponse.json @@ -0,0 +1,10 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "appid": "wxcbda96de0b165486", + "mch_id": "10000098", + "sub_mch_id": "10000100", + "nonce_str": "IITRi8Iabbblz1Jc", + "sign": "EE088059BBC9141264F8D14293AD6C4BB94CEA8C08AA98FBF93E262D445F8FF5", + "result_code": "SUCCESS" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/GetVehiclePartnerPayStateRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/GetVehiclePartnerPayStateRequest.json new file mode 100644 index 00000000..cd2e30be --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/GetVehiclePartnerPayStateRequest.json @@ -0,0 +1,11 @@ +{ + "mch_id": "100000981", + "sub_mch_id": "10000100", + "appid": "wxcbda96de0b165486", + "nonce_str": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS", + "sign_type": "HMAC-SHA256", + "trade_scene": "PARKING", + "sign": "EE088059BBC9141264F8D14293AD6C4BB94CEA8C08AA98FBF93E262D445F8FF5", + "openid": " oUpF8uMuAJO_M2pxb1Q9zNjWeS6o", + "plate_number": "粤A00000" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/GetVehiclePartnerPayStateResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/GetVehiclePartnerPayStateResponse.json new file mode 100644 index 00000000..21c3738e --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/GetVehiclePartnerPayStateResponse.json @@ -0,0 +1,11 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "sub_mch_id": "10000100", + "nonce_str": "ec2316275641faa3aacf3cc599e8730f", + "user_state": "NORMAL", + "result_code": "SUCCESS", + "sign": "EE088059BBC9141264F8D14293AD6C4BB94CEA8C08AA98FBF93E262D445F8FF5" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/NotifyVehiclePartnerPayRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/NotifyVehiclePartnerPayRequest.json new file mode 100644 index 00000000..a109242e --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/NotifyVehiclePartnerPayRequest.json @@ -0,0 +1,10 @@ +{ + "mch_id": "100000981", + "sub_mch_id": "10000100", + "appid": "wxcbda96de0b165486", + "nonce_str": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS", + "sign_type": "HMAC-SHA256", + "trade_scene": "PARKING", + "sign": "EE088059BBC9141264F8D14293AD6C4BB94CEA8C08AA98FBF93E262D445F8FF5", + "scene_info": "{\"scene_info\":{\"start_time\":\"20170926114339\",\"plate_number\":\"CB1000sdfasd\",\"car_type\":\"大型车\",\"parking_name\":\"欢乐海岸停车场\",\"free_time\":\"1200\"}}" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/NotifyVehiclePartnerPayResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/NotifyVehiclePartnerPayResponse.json new file mode 100644 index 00000000..21c3738e --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/VehiclePartner/NotifyVehiclePartnerPayResponse.json @@ -0,0 +1,11 @@ +{ + "return_code": "SUCCESS", + "return_msg": "OK", + "appid": "wx2421b1c4370ec43b", + "mch_id": "10000100", + "sub_mch_id": "10000100", + "nonce_str": "ec2316275641faa3aacf3cc599e8730f", + "user_state": "NORMAL", + "result_code": "SUCCESS", + "sign": "EE088059BBC9141264F8D14293AD6C4BB94CEA8C08AA98FBF93E262D445F8FF5" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests.csproj b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests.csproj index b41b7acf..f5adef30 100644 --- a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests.csproj +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests.csproj @@ -18,7 +18,8 @@ PreserveNewest PreserveNewest - + + diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_AESUtilityTests.cs b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_AESUtilityTests.cs new file mode 100644 index 00000000..6f5d338a --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_AESUtilityTests.cs @@ -0,0 +1,21 @@ +using System; +using System.Text; +using Xunit; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests +{ + public class TestCase_AESUtilityTests + { + [Fact(DisplayName = "测试用例:AES-ECB 解密")] + public void TestAESGCMDecrypt() + { + string key = "01234567890abcdefedcba9876543210"; + string cipherText = "l/aL5GyVfl/tw3Lww6GvCQ=="; + + string actualPlain = Utilities.AESUtility.DecryptWithECB(encodingKey: Convert.ToBase64String(Encoding.UTF8.GetBytes(key)), encodingCipherText: cipherText); + string expectedPlain = "SKIT is great!"; + + Assert.Equal(expectedPlain, actualPlain); + } + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_ApiExecuteExecutePayTests.cs b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_ApiExecuteExecutePayTests.cs new file mode 100644 index 00000000..9d79684b --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_ApiExecuteExecutePayTests.cs @@ -0,0 +1,27 @@ +using System; +using System.Threading.Tasks; +using Xunit; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests +{ + public class TestCase_ApiExecuteExecutePayTransactionsTests + { + [Fact(DisplayName = "测试用例:调用 API [POST] /pay/micropay")] + public async Task TestCase_ApiExecuteExecutePayTests() + { + var request = new Models.CreatePayMicroPayRequest() + { + OutTradeNumber = "TEST_OTN_" + DateTimeOffset.Now.ToString("yyyyMMddHHmmssfff"), + Body = "TEST_BODY", + TotalFee = 1, + ClientIp = "127.0.0.7", + AuthCode = "TEST_AUTH_CODE" + }; + var response = await TestClients.Instance.ExecuteCreatePayMicroPayAsync(request); + + Assert.NotNull(response.ReturnCode); + Assert.NotNull(response.ReturnMessage); + Assert.NotNull(response.TransactionId); + } + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_CodeReviewAnalyzer.cs b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_CodeReviewAnalyzer.cs index d4011efb..64cba07b 100644 --- a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_CodeReviewAnalyzer.cs +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_CodeReviewAnalyzer.cs @@ -31,6 +31,18 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests Assert.Null(ex); } + [Fact(DisplayName = "代码评审:分析 API 事件定义")] + public void ApiEventsDefinitionTest() + { + string workdir = Path.Combine(TestConfigs.ProjectTestDirectory, "EventSamples"); + CodeStyleUtil.VerifyApiEventsDefinition(SourceAssembly, workdir, out var ex); + + if (ex != null) + throw ex; + + Assert.Null(ex); + } + [Fact(DisplayName = "代码评审:分析 API 接口命名")] public void TestApiExtensionsNaming() { diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_EventVerificationTests.cs b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_EventVerificationTests.cs new file mode 100644 index 00000000..254dbe4f --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_EventVerificationTests.cs @@ -0,0 +1,19 @@ +using System.Threading.Tasks; +using Xunit; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests +{ + public class TestCase_EventVerificationTests + { + [Fact(DisplayName = "测试用例:验证回调通知签名")] + public void TestVerifyEventSignature() + { + string callbackXml = "wxd930ea5d5a258f4f100001001000testibuaiVcKdpRxkhJA9A0A8659F005D6984697E2CA0A9CF3B7"; + string merchantId = "10000100"; + string merchantSecret = "192006250b4c09247ec02edce69f6a2d"; + + var client = new WechatTenpayClient(merchantId, merchantSecret); + Assert.True(client.VerifyEventSignature(callbackXml)); + } + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_JsonConverterTests.cs b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_JsonConverterTests.cs index 0fff344d..b6e6602f 100644 --- a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_JsonConverterTests.cs +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_JsonConverterTests.cs @@ -34,8 +34,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests Assert.Equal("ERR_CODE_DESC", parsedObjBySystemTextJson.ErrorCodeDescription); Assert.Equal("TRANSACTION_ID", parsedObjByNewtonsoftJson.TransactionId); Assert.Equal("TRANSACTION_ID", parsedObjBySystemTextJson.TransactionId); - Assert.Equal(2, parsedObjByNewtonsoftJson.RecordCount); - Assert.Equal(2, parsedObjBySystemTextJson.RecordCount); + Assert.Equal(2, parsedObjByNewtonsoftJson.TotalRecordCount); + Assert.Equal(2, parsedObjBySystemTextJson.TotalRecordCount); Assert.Equal("SUB_ORDER_NO_0", parsedObjByNewtonsoftJson.RecordList[0].SubOrderNumber); Assert.Equal("SUB_ORDER_NO_0", parsedObjBySystemTextJson.RecordList[0].SubOrderNumber); Assert.Equal("SUB_ORDER_ID_0", parsedObjByNewtonsoftJson.RecordList[0].SubOrderId); @@ -68,14 +68,24 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests string unparsedJsonByNewtonsoftJson = newtonsoftJsonSerializer.Serialize(parsedObjByNewtonsoftJson); string unparsedJsonBySystemTextJson = systemTextJsonSerializer.Serialize(parsedObjByNewtonsoftJson); + Assert.Null(Record.Exception(() => Newtonsoft.Json.JsonConvert.DeserializeObject(unparsedJsonByNewtonsoftJson))); + Assert.Null(Record.Exception(() => System.Text.Json.JsonDocument.Parse(unparsedJsonBySystemTextJson))); Assert.Contains("return_code", unparsedJsonByNewtonsoftJson); Assert.Contains("return_code", unparsedJsonBySystemTextJson); + Assert.Contains("RETURN_CODE", unparsedJsonByNewtonsoftJson); + Assert.Contains("RETURN_CODE", unparsedJsonBySystemTextJson); Assert.Contains("return_msg", unparsedJsonByNewtonsoftJson); Assert.Contains("return_msg", unparsedJsonBySystemTextJson); + Assert.Contains("RETURN_MSG", unparsedJsonByNewtonsoftJson); + Assert.Contains("RETURN_MSG", unparsedJsonBySystemTextJson); Assert.Contains("sub_order_no_0", unparsedJsonByNewtonsoftJson); Assert.Contains("sub_order_no_0", unparsedJsonBySystemTextJson); + Assert.Contains("SUB_ORDER_NO_0", unparsedJsonByNewtonsoftJson); + Assert.Contains("SUB_ORDER_NO_0", unparsedJsonBySystemTextJson); Assert.Contains("sub_order_id_0", unparsedJsonByNewtonsoftJson); Assert.Contains("sub_order_id_0", unparsedJsonBySystemTextJson); + Assert.Contains("SUB_ORDER_ID_0", unparsedJsonByNewtonsoftJson); + Assert.Contains("SUB_ORDER_ID_0", unparsedJsonBySystemTextJson); Assert.DoesNotContain("#n", unparsedJsonByNewtonsoftJson); Assert.DoesNotContain("#n", unparsedJsonBySystemTextJson); Assert.DoesNotContain("$n", unparsedJsonByNewtonsoftJson); diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_RequestSignTests.cs b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_RequestSignTests.cs new file mode 100644 index 00000000..bc03327d --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestCase_RequestSignTests.cs @@ -0,0 +1,49 @@ +using System.Net.Http; +using Xunit; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests +{ + public class TestCase_RequestSignTests + { + internal class InnerFakeRequest : WechatTenpaySignableRequest + { + [Newtonsoft.Json.JsonProperty("appid")] + [System.Text.Json.Serialization.JsonPropertyName("appid")] + public override string? AppId { get; set; } + + [Newtonsoft.Json.JsonProperty("mch_id")] + [System.Text.Json.Serialization.JsonPropertyName("mch_id")] + public override string? MerchantId { get; set; } + + [Newtonsoft.Json.JsonProperty("device_info")] + [System.Text.Json.Serialization.JsonPropertyName("device_info")] + public string? DeviceInfo { get; set; } + + [Newtonsoft.Json.JsonProperty("body")] + [System.Text.Json.Serialization.JsonPropertyName("body")] + public string? Body { get; set; } + } + + [Fact(DisplayName = "测试用例:生成请求签名")] + public void TestRequestSign() + { + const string MCHID = "10000100"; + const string MCHKEY = "192006250b4c09247ec02edce69f6a2d"; + var request = new InnerFakeRequest() + { + AppId = "wxd930ea5d5a258f4f", + MerchantId = MCHID, + DeviceInfo = "1000", + Body = "test", + NonceString = "ibuaiVcKdpRxkhJA" + }; + var client = new WechatTenpayClient(MCHID, MCHKEY); + client.CreateRequest(request, HttpMethod.Post); + + string actualSign = "9A0A8659F005D6984697E2CA0A9CF3B7"; + string expectedSign = request.Signature!; + + Assert.Equal(actualSign, expectedSign); + } + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestClients.cs b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestClients.cs index 1626181c..879d3d8a 100644 --- a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestClients.cs +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/TestClients.cs @@ -7,7 +7,8 @@ Instance = new WechatTenpayClient(new WechatTenpayClientOptions() { MerchantId = TestConfigs.WechatMerchantId, - MerchantSecret = TestConfigs.WechatMerchantSecret + MerchantSecret = TestConfigs.WechatMerchantSecret, + AppId = TestConfigs.WechatAppId }); } diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/appsettings.local.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/appsettings.local.json index 6d260d54..e1133161 100644 --- a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/appsettings.local.json +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/appsettings.local.json @@ -1,8 +1,8 @@ { "TestConfig": { - "AppId": "wxd861802f8e303335", "MerchantId": "1601103314", "MerchantSecret": "f09b03a7a1902b5b4913856f1fd07ab1", + "AppId": "wxd861802f8e303335", "OpenId": "owNIE0msADfoPjhpy2cz1qL4vImw" }, "ProjectSourceDirectory": "D:\\Projects\\_SKIT\\stack-dotnet\\DotNetCore.SKIT.FlurlHttpClient.Wechat\\src\\SKIT.FlurlHttpClient.Wechat.TenpayV2", diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/PAPPay/NotifyPAPPayContractsRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/PAPPay/NotifyPAPPayContractsRequest.json new file mode 100644 index 00000000..9044f0cb --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/PAPPay/NotifyPAPPayContractsRequest.json @@ -0,0 +1,8 @@ +{ + "mchid": "1230000109", + "appid": "wxd678efh567hg6787", + "estimated_amount": { + "amount": 1, + "currency": "CNY" + } +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/PAPPay/NotifyPAPPayContractsResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/PAPPay/NotifyPAPPayContractsResponse.json new file mode 100644 index 00000000..22fdca1b --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/PAPPay/NotifyPAPPayContractsResponse.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/PartnerPAPPay/NotifyPartnerPAPPayContractsRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/PartnerPAPPay/NotifyPartnerPAPPayContractsRequest.json new file mode 100644 index 00000000..1340bbb0 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/PartnerPAPPay/NotifyPartnerPAPPayContractsRequest.json @@ -0,0 +1,10 @@ +{ + "sp_appid": "wxd678efh567hg6787", + "sp_mchid": "1230000109", + "estimated_amount": { + "amount": 1, + "currency": "CNY" + }, + "sub_mchid": "12345512", + "sub_appid": "wxd678efh567hg6787" +} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/PartnerPAPPay/NotifyPartnerPAPPayContractsResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/PartnerPAPPay/NotifyPartnerPAPPayContractsResponse.json new file mode 100644 index 00000000..22fdca1b --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/PartnerPAPPay/NotifyPartnerPAPPayContractsResponse.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/TestCase_AesUtilityTests.cs b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/TestCase_AESUtilityTests.cs similarity index 100% rename from test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/TestCase_AesUtilityTests.cs rename to test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/TestCase_AESUtilityTests.cs diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/TestCase_RsaUtilityTests.cs b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/TestCase_RSAUtilityTests.cs similarity index 100% rename from test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/TestCase_RsaUtilityTests.cs rename to test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/TestCase_RSAUtilityTests.cs diff --git a/test/SKIT.FlurlHttpClient.Wechat.TestTools/CodeStyleUtil.cs b/test/SKIT.FlurlHttpClient.Wechat.TestTools/CodeStyleUtil.cs index 632a4826..d00f20dc 100644 --- a/test/SKIT.FlurlHttpClient.Wechat.TestTools/CodeStyleUtil.cs +++ b/test/SKIT.FlurlHttpClient.Wechat.TestTools/CodeStyleUtil.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; +using System.Threading.Tasks; using System.Text.RegularExpressions; using System.Xml.Serialization; @@ -154,14 +155,13 @@ namespace SKIT.FlurlHttpClient.Wechat var lstModelType = TestReflectionUtil.GetAllApiModelsTypes(assembly); var lstError = new List(); - foreach (Type modelType in lstModelType) + Parallel.ForEach(lstModelType, (modelType) => { string name = modelType.Name.Split('`')[0]; if (!name.EndsWith("Request") && !name.EndsWith("Response")) { lstError.Add(new Exception($"[模型] `{name}` 类名结尾应为 \"Request\" 或 \"Response\"。")); - continue; } if (name.EndsWith("Request")) @@ -169,13 +169,11 @@ namespace SKIT.FlurlHttpClient.Wechat if (!typeof(ICommonRequest).IsAssignableFrom(modelType)) { lstError.Add(new Exception($"[模型] `{name}` 是请求模型,需实现自 `{nameof(ICommonRequest)}`。")); - continue; } if (!lstModelType.Any(e => e.Name == $"{name.Substring(0, name.Length - "Request".Length)}Response")) { lstError.Add(new Exception($"[模型] `{name}` 是请求模型,但不存在对应的响应模型。")); - continue; } } @@ -184,16 +182,14 @@ namespace SKIT.FlurlHttpClient.Wechat if (!typeof(ICommonResponse).IsAssignableFrom(modelType)) { lstError.Add(new Exception($"[模型] `{name}` 是响应模型,需实现自 `{nameof(ICommonResponse)}`。")); - continue; } if (!lstModelType.Any(e => e.Name == $"{name.Substring(0, name.Length - "Response".Length)}Request")) { lstError.Add(new Exception($"[模型] `{name}` 是响应模型,但不存在对应的请求模型。")); - continue; } } - } + }); if (lstError.Any()) { @@ -221,7 +217,7 @@ namespace SKIT.FlurlHttpClient.Wechat lstError.Add(new Exception($"[模型] \"{workdir}\" 下不存在示例文件,请检查配置的扫描路径是否正确。")); } - foreach (string filePath in lstFilePath) + Parallel.ForEach(lstFilePath, (filePath) => { string name = Path.GetFileNameWithoutExtension(filePath).Split('.')[0]; @@ -229,7 +225,7 @@ namespace SKIT.FlurlHttpClient.Wechat if (type == null) { lstError.Add(new Exception($"[模型] 扫描到示例文件 \"{filePath}\",但类型 `{name}` 不存在。")); - continue; + return; } if (string.Equals(Path.GetExtension(filePath), ".json", StringComparison.OrdinalIgnoreCase)) @@ -240,7 +236,7 @@ namespace SKIT.FlurlHttpClient.Wechat lstError.Add(ex); } } - } + }); if (lstError.Any()) { @@ -271,7 +267,7 @@ namespace SKIT.FlurlHttpClient.Wechat lstError.Add(new Exception($"[模型] \"{workdir}\" 下不存在示例文件,请检查配置的扫描路径是否正确。")); } - foreach (string filePath in lstFilePath) + Parallel.ForEach(lstFilePath, (filePath) => { string name = Path.GetFileNameWithoutExtension(filePath).Split('.')[0]; @@ -279,7 +275,7 @@ namespace SKIT.FlurlHttpClient.Wechat if (type == null) { lstError.Add(new Exception($"[模型] 扫描到示例文件 \"{filePath}\",但类型 `{name}` 不存在。")); - continue; + return; } if (string.Equals(Path.GetExtension(filePath), ".json", StringComparison.OrdinalIgnoreCase)) @@ -300,7 +296,7 @@ namespace SKIT.FlurlHttpClient.Wechat lstError.Add(ex); } } - } + }); if (lstError.Any()) { @@ -319,7 +315,7 @@ namespace SKIT.FlurlHttpClient.Wechat var lstExtType = TestReflectionUtil.GetAllApiExtensionsTypes(assembly); var lstError = new List(); - foreach (Type extensionsType in lstExtType) + Parallel.ForEach(lstExtType, (extensionsType) => { MethodInfo[] lstMethod = extensionsType.GetMethods() .Where(e => @@ -372,7 +368,7 @@ namespace SKIT.FlurlHttpClient.Wechat continue; } } - } + }); if (lstError.Any()) { @@ -406,7 +402,7 @@ namespace SKIT.FlurlHttpClient.Wechat lstError.Add(new Exception($"[风格] \"{workdir}\" 下不存在源代码文件,请检查配置的扫描路径是否正确。")); } - foreach (string extCodeFilePath in lstExtensionsCodeFile) + Parallel.ForEach(lstExtensionsCodeFile, (extCodeFilePath) => { string extCodeFileName = Path.GetFileName(extCodeFilePath); @@ -676,7 +672,7 @@ namespace SKIT.FlurlHttpClient.Wechat } } } - } + }); if (lstError.Any()) {