node-easywechat 2.9.3 → 3.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +20 -281
- package/dist/Core/Cache/FileCache.d.ts +6 -5
- package/dist/Core/Cache/FileCache.js +5 -5
- package/dist/Core/Config.d.ts +66 -0
- package/dist/Core/Config.js +117 -0
- package/dist/Core/Contracts/AccessTokenInterface.d.ts +13 -0
- package/dist/Core/Contracts/AccessTokenInterface.js +28 -0
- package/dist/Core/Contracts/CacheInterface.d.ts +28 -5
- package/dist/Core/Contracts/CacheInterface.js +31 -18
- package/dist/Core/Contracts/ConfigInterface.d.ts +29 -0
- package/dist/Core/Contracts/ConfigInterface.js +34 -0
- package/dist/Core/Contracts/ObjectAccessInterface.d.ts +31 -0
- package/dist/Core/Contracts/ObjectAccessInterface.js +33 -0
- package/dist/Core/Contracts/RefreshableAccessTokenInterface.d.ts +9 -0
- package/dist/{OfficialAccount/Server/Guard.js → Core/Contracts/RefreshableAccessTokenInterface.js} +9 -8
- package/dist/Core/Contracts/ServerInterface.d.ts +8 -0
- package/dist/Core/Contracts/ServerInterface.js +20 -0
- package/dist/Core/Encryptor.d.ts +29 -3
- package/dist/Core/Encryptor.js +37 -12
- package/dist/Core/Http/Contracts/MessageInterface.d.ts +69 -0
- package/dist/Core/Http/Contracts/MessageInterface.js +70 -0
- package/dist/Core/Http/Contracts/RequestInterface.d.ts +37 -0
- package/dist/Core/Http/Contracts/RequestInterface.js +42 -0
- package/dist/Core/Http/Contracts/ResponseInterface.d.ts +21 -0
- package/dist/Core/Http/Contracts/ResponseInterface.js +26 -0
- package/dist/Core/Http/Contracts/ServerRequestInterface.d.ts +78 -0
- package/dist/Core/Http/Contracts/ServerRequestInterface.js +83 -0
- package/dist/Core/Http/Minxins/MessageMixin.d.ts +24 -0
- package/dist/Core/Http/Minxins/MessageMixin.js +93 -0
- package/dist/Core/Http/Minxins/RequestMixin.d.ts +12 -0
- package/dist/Core/Http/Minxins/RequestMixin.js +30 -0
- package/dist/Core/Http/Request.d.ts +8 -25
- package/dist/Core/Http/Request.js +12 -177
- package/dist/Core/Http/Response.d.ts +11 -12
- package/dist/Core/Http/Response.js +30 -26
- package/dist/Core/Http/ServerRequest.d.ts +47 -0
- package/dist/Core/Http/ServerRequest.js +136 -0
- package/dist/Core/HttpClient/AccessTokenAwareClient.d.ts +19 -0
- package/dist/Core/HttpClient/AccessTokenAwareClient.js +47 -0
- package/dist/Core/HttpClient/Contracts/AccessTokenAwareHttpClientInterface.d.ts +9 -0
- package/dist/Core/HttpClient/Contracts/AccessTokenAwareHttpClientInterface.js +13 -0
- package/dist/Core/HttpClient/Contracts/HttpClientInterface.d.ts +18 -0
- package/dist/Core/HttpClient/Contracts/HttpClientInterface.js +29 -0
- package/dist/Core/HttpClient/Contracts/HttpClientResponseInterface.d.ts +35 -0
- package/dist/Core/HttpClient/Contracts/HttpClientResponseInterface.js +37 -0
- package/dist/Core/HttpClient/HttpClient.d.ts +20 -0
- package/dist/Core/HttpClient/HttpClient.js +92 -0
- package/dist/Core/HttpClient/HttpClientResponse.d.ts +76 -0
- package/dist/Core/HttpClient/HttpClientResponse.js +171 -0
- package/dist/Core/HttpClient/Mixins/HttpClientMethodsMixin.d.ts +48 -0
- package/dist/Core/HttpClient/Mixins/HttpClientMethodsMixin.js +88 -0
- package/dist/Core/Message.d.ts +144 -0
- package/dist/Core/Message.js +74 -0
- package/dist/Core/Mixins/CacheMixin.d.ts +40 -0
- package/dist/Core/Mixins/CacheMixin.js +63 -0
- package/dist/Core/Mixins/ClientMixin.d.ts +16 -0
- package/dist/Core/Mixins/ClientMixin.js +21 -0
- package/dist/Core/Mixins/ConfigMixin.d.ts +16 -0
- package/dist/Core/Mixins/ConfigMixin.js +21 -0
- package/dist/Core/Mixins/DecryptXmlMessageMixin.d.ts +11 -0
- package/dist/Core/Mixins/DecryptXmlMessageMixin.js +38 -0
- package/dist/Core/Mixins/HandlersMixin.d.ts +79 -0
- package/dist/Core/Mixins/HandlersMixin.js +163 -0
- package/dist/Core/Mixins/HasAttributesMixin.d.ts +46 -0
- package/dist/Core/Mixins/HasAttributesMixin.js +75 -0
- package/dist/Core/Mixins/HttpClientMixin.d.ts +26 -0
- package/dist/Core/Mixins/HttpClientMixin.js +45 -0
- package/dist/Core/Mixins/ResponseXmlMessageMixin.d.ts +13 -0
- package/dist/Core/Mixins/ResponseXmlMessageMixin.js +63 -0
- package/dist/Core/Mixins/ServerRequestMixin.d.ts +16 -0
- package/dist/Core/Mixins/ServerRequestMixin.js +21 -0
- package/dist/Core/{AES.d.ts → Support/AES.d.ts} +0 -0
- package/dist/Core/{AES.js → Support/AES.js} +0 -0
- package/dist/Core/Support/Obj.d.ts +62 -0
- package/dist/Core/Support/Obj.js +136 -0
- package/dist/Core/{PKCS.d.ts → Support/PKCS.d.ts} +2 -1
- package/dist/Core/{PKCS.js → Support/PKCS.js} +1 -3
- package/dist/Core/{RSA.d.ts → Support/RSA.d.ts} +2 -1
- package/dist/Core/{RSA.js → Support/RSA.js} +1 -2
- package/dist/Core/Support/Utils.d.ts +89 -0
- package/dist/Core/{Utils.js → Support/Utils.js} +84 -40
- package/dist/OfficialAccount/AccessToken.d.ts +26 -0
- package/dist/OfficialAccount/AccessToken.js +83 -0
- package/dist/OfficialAccount/Account.d.ts +13 -0
- package/dist/OfficialAccount/Account.js +29 -0
- package/dist/OfficialAccount/Application.d.ts +70 -66
- package/dist/OfficialAccount/Application.js +146 -222
- package/dist/OfficialAccount/Config.d.ts +5 -0
- package/dist/OfficialAccount/Config.js +14 -0
- package/dist/OfficialAccount/Contracts/AccountInterface.d.ts +23 -0
- package/dist/OfficialAccount/Contracts/AccountInterface.js +25 -0
- package/dist/OfficialAccount/Contracts/ApplicationInterface.d.ts +87 -0
- package/dist/OfficialAccount/Contracts/ApplicationInterface.js +76 -0
- package/dist/OfficialAccount/JsApiTicket.d.ts +23 -0
- package/dist/OfficialAccount/JsApiTicket.js +76 -0
- package/dist/OfficialAccount/Message.d.ts +4 -0
- package/dist/OfficialAccount/Message.js +8 -0
- package/dist/OfficialAccount/Server.d.ts +43 -0
- package/dist/OfficialAccount/Server.js +96 -0
- package/dist/OfficialAccount/Utils.d.ts +7 -0
- package/dist/{Work/MiniProgram/Auth/AuthClient.js → OfficialAccount/Utils.js} +14 -13
- package/dist/Types/global.d.ts +343 -0
- package/official_account.access_token.mock-access_token-appid.cache +1 -0
- package/official_account.jsapi_ticket.mock-ticket-appid.cache +1 -0
- package/package.json +13 -10
- package/dist/BaseService/Application.d.ts +0 -17
- package/dist/BaseService/Application.js +0 -46
- package/dist/BaseService/ContentSecurity/ContentSecurityClient.d.ts +0 -16
- package/dist/BaseService/ContentSecurity/ContentSecurityClient.js +0 -47
- package/dist/BaseService/Jssdk/JssdkClient.d.ts +0 -52
- package/dist/BaseService/Jssdk/JssdkClient.js +0 -128
- package/dist/BaseService/Media/MediaClient.d.ts +0 -57
- package/dist/BaseService/Media/MediaClient.js +0 -151
- package/dist/BaseService/Qrcode/QrcodeClient.d.ts +0 -28
- package/dist/BaseService/Qrcode/QrcodeClient.js +0 -79
- package/dist/BaseService/Url/UrlClient.d.ts +0 -9
- package/dist/BaseService/Url/UrlClient.js +0 -24
- package/dist/Core/BaseAccessToken.d.ts +0 -89
- package/dist/Core/BaseAccessToken.js +0 -206
- package/dist/Core/BaseApplication.d.ts +0 -72
- package/dist/Core/BaseApplication.js +0 -138
- package/dist/Core/BaseClient.d.ts +0 -20
- package/dist/Core/BaseClient.js +0 -109
- package/dist/Core/Contracts/RequestInterface.d.ts +0 -10
- package/dist/Core/Contracts/RequestInterface.js +0 -30
- package/dist/Core/Decorators/FinallResult.d.ts +0 -4
- package/dist/Core/Decorators/FinallResult.js +0 -8
- package/dist/Core/Decorators/TerminateResult.d.ts +0 -4
- package/dist/Core/Decorators/TerminateResult.js +0 -8
- package/dist/Core/Http/StreamResponse.d.ts +0 -6
- package/dist/Core/Http/StreamResponse.js +0 -40
- package/dist/Core/Messages/Article.d.ts +0 -7
- package/dist/Core/Messages/Article.js +0 -31
- package/dist/Core/Messages/Card.d.ts +0 -6
- package/dist/Core/Messages/Card.js +0 -15
- package/dist/Core/Messages/DeviceEvent.d.ts +0 -5
- package/dist/Core/Messages/DeviceEvent.js +0 -19
- package/dist/Core/Messages/DeviceText.d.ts +0 -6
- package/dist/Core/Messages/DeviceText.js +0 -27
- package/dist/Core/Messages/File.d.ts +0 -4
- package/dist/Core/Messages/File.js +0 -12
- package/dist/Core/Messages/Image.d.ts +0 -4
- package/dist/Core/Messages/Image.js +0 -12
- package/dist/Core/Messages/InteractiveTaskCard.d.ts +0 -8
- package/dist/Core/Messages/InteractiveTaskCard.js +0 -22
- package/dist/Core/Messages/Link.d.ts +0 -5
- package/dist/Core/Messages/Link.js +0 -17
- package/dist/Core/Messages/Location.d.ts +0 -5
- package/dist/Core/Messages/Location.js +0 -19
- package/dist/Core/Messages/Markdown.d.ts +0 -5
- package/dist/Core/Messages/Markdown.js +0 -15
- package/dist/Core/Messages/Media.d.ts +0 -8
- package/dist/Core/Messages/Media.js +0 -31
- package/dist/Core/Messages/Message.d.ts +0 -47
- package/dist/Core/Messages/Message.js +0 -133
- package/dist/Core/Messages/MiniProgramNotice.d.ts +0 -5
- package/dist/Core/Messages/MiniProgramNotice.js +0 -16
- package/dist/Core/Messages/MiniProgramPage.d.ts +0 -6
- package/dist/Core/Messages/MiniProgramPage.js +0 -23
- package/dist/Core/Messages/Music.d.ts +0 -7
- package/dist/Core/Messages/Music.js +0 -39
- package/dist/Core/Messages/News.d.ts +0 -9
- package/dist/Core/Messages/News.js +0 -50
- package/dist/Core/Messages/NewsItem.d.ts +0 -7
- package/dist/Core/Messages/NewsItem.js +0 -34
- package/dist/Core/Messages/Raw.d.ts +0 -9
- package/dist/Core/Messages/Raw.js +0 -26
- package/dist/Core/Messages/ReplyInteractiveTaskCard.d.ts +0 -10
- package/dist/Core/Messages/ReplyInteractiveTaskCard.js +0 -25
- package/dist/Core/Messages/ShortVideo.d.ts +0 -4
- package/dist/Core/Messages/ShortVideo.js +0 -12
- package/dist/Core/Messages/TaskCard.d.ts +0 -5
- package/dist/Core/Messages/TaskCard.js +0 -19
- package/dist/Core/Messages/Text.d.ts +0 -7
- package/dist/Core/Messages/Text.js +0 -20
- package/dist/Core/Messages/TextCard.d.ts +0 -5
- package/dist/Core/Messages/TextCard.js +0 -17
- package/dist/Core/Messages/Transfer.d.ts +0 -7
- package/dist/Core/Messages/Transfer.js +0 -22
- package/dist/Core/Messages/Video.d.ts +0 -7
- package/dist/Core/Messages/Video.js +0 -33
- package/dist/Core/Messages/Voice.d.ts +0 -5
- package/dist/Core/Messages/Voice.js +0 -16
- package/dist/Core/Messages/index.d.ts +0 -24
- package/dist/Core/Messages/index.js +0 -36
- package/dist/Core/Mixins/HttpMixin.d.ts +0 -4
- package/dist/Core/Mixins/HttpMixin.js +0 -57
- package/dist/Core/ServerGuard.d.ts +0 -54
- package/dist/Core/ServerGuard.js +0 -288
- package/dist/Core/Types.d.ts +0 -237
- package/dist/Core/Types.js +0 -3
- package/dist/Core/Utils.d.ts +0 -31
- package/dist/MicroMerchant/Application.d.ts +0 -27
- package/dist/MicroMerchant/Application.js +0 -105
- package/dist/MicroMerchant/Base/MicroMerchantBase.d.ts +0 -7
- package/dist/MicroMerchant/Base/MicroMerchantBase.js +0 -52
- package/dist/MicroMerchant/Certficates/CertficatesClient.d.ts +0 -5
- package/dist/MicroMerchant/Certficates/CertficatesClient.js +0 -52
- package/dist/MicroMerchant/Core/BaseClient.d.ts +0 -9
- package/dist/MicroMerchant/Core/BaseClient.js +0 -106
- package/dist/MicroMerchant/Media/MediaClient.d.ts +0 -6
- package/dist/MicroMerchant/Media/MediaClient.js +0 -33
- package/dist/MicroMerchant/MerchantConfig/MerchantConfigClient.d.ts +0 -8
- package/dist/MicroMerchant/MerchantConfig/MerchantConfigClient.js +0 -49
- package/dist/MicroMerchant/Meterial/MeterialClient.d.ts +0 -5
- package/dist/MicroMerchant/Meterial/MeterialClient.js +0 -30
- package/dist/MicroMerchant/Withdraw/WithdrawClient.d.ts +0 -5
- package/dist/MicroMerchant/Withdraw/WithdrawClient.js +0 -28
- package/dist/MiniProgram/ActivityMessage/ActivityMessageClient.d.ts +0 -6
- package/dist/MiniProgram/ActivityMessage/ActivityMessageClient.js +0 -42
- package/dist/MiniProgram/AppCode/AppCodeClient.d.ts +0 -22
- package/dist/MiniProgram/AppCode/AppCodeClient.js +0 -79
- package/dist/MiniProgram/Application.d.ts +0 -83
- package/dist/MiniProgram/Application.js +0 -238
- package/dist/MiniProgram/Auth/AccessToken.d.ts +0 -5
- package/dist/MiniProgram/Auth/AccessToken.js +0 -31
- package/dist/MiniProgram/Auth/AuthClient.d.ts +0 -8
- package/dist/MiniProgram/Auth/AuthClient.js +0 -22
- package/dist/MiniProgram/Base/MiniProgramBase.d.ts +0 -9
- package/dist/MiniProgram/Base/MiniProgramBase.js +0 -21
- package/dist/MiniProgram/Broadcast/BroadcastClient.d.ts +0 -40
- package/dist/MiniProgram/Broadcast/BroadcastClient.js +0 -141
- package/dist/MiniProgram/DataCube/DataCubeClient.d.ts +0 -70
- package/dist/MiniProgram/DataCube/DataCubeClient.js +0 -116
- package/dist/MiniProgram/Encryptor.d.ts +0 -4
- package/dist/MiniProgram/Encryptor.js +0 -23
- package/dist/MiniProgram/Express/ExpressClient.d.ts +0 -65
- package/dist/MiniProgram/Express/ExpressClient.js +0 -113
- package/dist/MiniProgram/Live/LiveClient.d.ts +0 -5
- package/dist/MiniProgram/Live/LiveClient.js +0 -23
- package/dist/MiniProgram/NearbyPoi/NearbyPoiClient.d.ts +0 -31
- package/dist/MiniProgram/NearbyPoi/NearbyPoiClient.js +0 -67
- package/dist/MiniProgram/OpenData/OpenDataClient.d.ts +0 -7
- package/dist/MiniProgram/OpenData/OpenDataClient.js +0 -46
- package/dist/MiniProgram/PhoneNumber/PhoneNumberClient.d.ts +0 -10
- package/dist/MiniProgram/PhoneNumber/PhoneNumberClient.js +0 -20
- package/dist/MiniProgram/Plugin/PluginClient.d.ts +0 -17
- package/dist/MiniProgram/Plugin/PluginClient.js +0 -37
- package/dist/MiniProgram/Plugin/PluginDevClient.d.ts +0 -23
- package/dist/MiniProgram/Plugin/PluginDevClient.js +0 -49
- package/dist/MiniProgram/RealtimeLog/RealtimeLogClient.d.ts +0 -11
- package/dist/MiniProgram/RealtimeLog/RealtimeLogClient.js +0 -25
- package/dist/MiniProgram/RiskControl/RiskControlClient.d.ts +0 -4
- package/dist/MiniProgram/RiskControl/RiskControlClient.js +0 -12
- package/dist/MiniProgram/Search/SearchClient.d.ts +0 -4
- package/dist/MiniProgram/Search/SearchClient.js +0 -14
- package/dist/MiniProgram/Shop/AccoutClient.d.ts +0 -25
- package/dist/MiniProgram/Shop/AccoutClient.js +0 -42
- package/dist/MiniProgram/Shop/AftersaleClient.d.ts +0 -22
- package/dist/MiniProgram/Shop/AftersaleClient.js +0 -35
- package/dist/MiniProgram/Shop/BasicClient.d.ts +0 -39
- package/dist/MiniProgram/Shop/BasicClient.js +0 -69
- package/dist/MiniProgram/Shop/DeliveryClient.d.ts +0 -20
- package/dist/MiniProgram/Shop/DeliveryClient.js +0 -32
- package/dist/MiniProgram/Shop/OrderClient.d.ts +0 -39
- package/dist/MiniProgram/Shop/OrderClient.js +0 -60
- package/dist/MiniProgram/Shop/RegisterClient.d.ts +0 -25
- package/dist/MiniProgram/Shop/RegisterClient.js +0 -43
- package/dist/MiniProgram/Shop/SpuClient.d.ts +0 -67
- package/dist/MiniProgram/Shop/SpuClient.js +0 -92
- package/dist/MiniProgram/ShortLink/ShortLinkClient.d.ts +0 -11
- package/dist/MiniProgram/ShortLink/ShortLinkClient.js +0 -23
- package/dist/MiniProgram/Soter/SoterClient.d.ts +0 -10
- package/dist/MiniProgram/Soter/SoterClient.js +0 -22
- package/dist/MiniProgram/SubscribeMessage/SubscribeMessageClient.d.ts +0 -50
- package/dist/MiniProgram/SubscribeMessage/SubscribeMessageClient.js +0 -122
- package/dist/MiniProgram/TemplateMessage/TemplateMessageClient.d.ts +0 -18
- package/dist/MiniProgram/TemplateMessage/TemplateMessageClient.js +0 -50
- package/dist/MiniProgram/UniformMessage/UniformMessageClient.d.ts +0 -26
- package/dist/MiniProgram/UniformMessage/UniformMessageClient.js +0 -68
- package/dist/MiniProgram/Union/UnionClient.d.ts +0 -16
- package/dist/MiniProgram/Union/UnionClient.js +0 -69
- package/dist/MiniProgram/UrlLink/UrlLinkClient.d.ts +0 -9
- package/dist/MiniProgram/UrlLink/UrlLinkClient.js +0 -17
- package/dist/MiniProgram/UrlScheme/UrlSchemeClient.d.ts +0 -4
- package/dist/MiniProgram/UrlScheme/UrlSchemeClient.js +0 -12
- package/dist/OfficialAccount/Auth/AccessToken.d.ts +0 -5
- package/dist/OfficialAccount/Auth/AccessToken.js +0 -31
- package/dist/OfficialAccount/AutoReply/AutoReplyClient.d.ts +0 -7
- package/dist/OfficialAccount/AutoReply/AutoReplyClient.js +0 -15
- package/dist/OfficialAccount/Base/OfficialAccountBase.d.ts +0 -18
- package/dist/OfficialAccount/Base/OfficialAccountBase.js +0 -47
- package/dist/OfficialAccount/Broadcasting/BroadcastingClient.d.ts +0 -158
- package/dist/OfficialAccount/Broadcasting/BroadcastingClient.js +0 -233
- package/dist/OfficialAccount/Broadcasting/MessageBuilder.d.ts +0 -14
- package/dist/OfficialAccount/Broadcasting/MessageBuilder.js +0 -63
- package/dist/OfficialAccount/Card/BoardingPassClient.d.ts +0 -4
- package/dist/OfficialAccount/Card/BoardingPassClient.js +0 -12
- package/dist/OfficialAccount/Card/Card.d.ts +0 -17
- package/dist/OfficialAccount/Card/Card.js +0 -31
- package/dist/OfficialAccount/Card/Client.d.ts +0 -108
- package/dist/OfficialAccount/Card/Client.js +0 -218
- package/dist/OfficialAccount/Card/CodeClient.d.ts +0 -51
- package/dist/OfficialAccount/Card/CodeClient.js +0 -100
- package/dist/OfficialAccount/Card/CoinClient.d.ts +0 -10
- package/dist/OfficialAccount/Card/CoinClient.js +0 -41
- package/dist/OfficialAccount/Card/GeneralCardClient.d.ts +0 -19
- package/dist/OfficialAccount/Card/GeneralCardClient.js +0 -34
- package/dist/OfficialAccount/Card/JssdkClient.d.ts +0 -6
- package/dist/OfficialAccount/Card/JssdkClient.js +0 -67
- package/dist/OfficialAccount/Card/MeetingTicketClient.d.ts +0 -8
- package/dist/OfficialAccount/Card/MeetingTicketClient.js +0 -16
- package/dist/OfficialAccount/Card/MemberCardClient.d.ts +0 -35
- package/dist/OfficialAccount/Card/MemberCardClient.js +0 -62
- package/dist/OfficialAccount/Card/MovieTicketClient.d.ts +0 -8
- package/dist/OfficialAccount/Card/MovieTicketClient.js +0 -16
- package/dist/OfficialAccount/Card/SubMerchantClient.d.ts +0 -26
- package/dist/OfficialAccount/Card/SubMerchantClient.js +0 -73
- package/dist/OfficialAccount/Comment/CommentClient.d.ts +0 -60
- package/dist/OfficialAccount/Comment/CommentClient.js +0 -115
- package/dist/OfficialAccount/CustomerService/CustomerServiceClient.d.ts +0 -15
- package/dist/OfficialAccount/CustomerService/CustomerServiceClient.js +0 -78
- package/dist/OfficialAccount/CustomerService/CustomerServiceSession.d.ts +0 -8
- package/dist/OfficialAccount/CustomerService/CustomerServiceSession.js +0 -36
- package/dist/OfficialAccount/CustomerService/Messenger.d.ts +0 -18
- package/dist/OfficialAccount/CustomerService/Messenger.js +0 -62
- package/dist/OfficialAccount/DataCube/DataCubeClient.d.ts +0 -135
- package/dist/OfficialAccount/DataCube/DataCubeClient.js +0 -203
- package/dist/OfficialAccount/Device/DeviceClient.d.ts +0 -15
- package/dist/OfficialAccount/Device/DeviceClient.js +0 -70
- package/dist/OfficialAccount/Goods/GoodsClient.d.ts +0 -30
- package/dist/OfficialAccount/Goods/GoodsClient.js +0 -60
- package/dist/OfficialAccount/Material/MaterialClient.d.ts +0 -67
- package/dist/OfficialAccount/Material/MaterialClient.js +0 -193
- package/dist/OfficialAccount/Menu/MenuClient.d.ts +0 -27
- package/dist/OfficialAccount/Menu/MenuClient.js +0 -58
- package/dist/OfficialAccount/OCR/OCRClient.d.ts +0 -40
- package/dist/OfficialAccount/OCR/OCRClient.js +0 -85
- package/dist/OfficialAccount/POI/POIClient.d.ts +0 -39
- package/dist/OfficialAccount/POI/POIClient.js +0 -87
- package/dist/OfficialAccount/Semantic/SemanticClient.d.ts +0 -10
- package/dist/OfficialAccount/Semantic/SemanticClient.js +0 -24
- package/dist/OfficialAccount/Server/Guard.d.ts +0 -4
- package/dist/OfficialAccount/ShakeAround/Client.d.ts +0 -23
- package/dist/OfficialAccount/ShakeAround/Client.js +0 -43
- package/dist/OfficialAccount/ShakeAround/DeviceClient.d.ts +0 -51
- package/dist/OfficialAccount/ShakeAround/DeviceClient.js +0 -100
- package/dist/OfficialAccount/ShakeAround/GroupClient.d.ts +0 -44
- package/dist/OfficialAccount/ShakeAround/GroupClient.js +0 -84
- package/dist/OfficialAccount/ShakeAround/MaterialClient.d.ts +0 -9
- package/dist/OfficialAccount/ShakeAround/MaterialClient.js +0 -21
- package/dist/OfficialAccount/ShakeAround/PageClient.d.ts +0 -30
- package/dist/OfficialAccount/ShakeAround/PageClient.js +0 -56
- package/dist/OfficialAccount/ShakeAround/RelationClient.d.ts +0 -21
- package/dist/OfficialAccount/ShakeAround/RelationClient.js +0 -44
- package/dist/OfficialAccount/ShakeAround/ShakeAround.d.ts +0 -14
- package/dist/OfficialAccount/ShakeAround/ShakeAround.js +0 -25
- package/dist/OfficialAccount/ShakeAround/StatsClient.d.ts +0 -29
- package/dist/OfficialAccount/ShakeAround/StatsClient.js +0 -57
- package/dist/OfficialAccount/Store/StoreClient.d.ts +0 -63
- package/dist/OfficialAccount/Store/StoreClient.js +0 -104
- package/dist/OfficialAccount/SubscribeMessage/SubscribeMessageClient.d.ts +0 -39
- package/dist/OfficialAccount/SubscribeMessage/SubscribeMessageClient.js +0 -116
- package/dist/OfficialAccount/TemplateMessage/TemplateMessageClient.d.ts +0 -42
- package/dist/OfficialAccount/TemplateMessage/TemplateMessageClient.js +0 -114
- package/dist/OfficialAccount/User/TagClient.d.ts +0 -46
- package/dist/OfficialAccount/User/TagClient.js +0 -92
- package/dist/OfficialAccount/User/UserClient.d.ts +0 -47
- package/dist/OfficialAccount/User/UserClient.js +0 -95
- package/dist/OpenPlatform/Application.d.ts +0 -88
- package/dist/OpenPlatform/Application.js +0 -223
- package/dist/OpenPlatform/Auth/AccessToken.d.ts +0 -7
- package/dist/OpenPlatform/Auth/AccessToken.js +0 -33
- package/dist/OpenPlatform/Auth/VerifyTicket.d.ts +0 -8
- package/dist/OpenPlatform/Auth/VerifyTicket.js +0 -40
- package/dist/OpenPlatform/Authorizer/Aggregate/Account/Client.d.ts +0 -21
- package/dist/OpenPlatform/Authorizer/Aggregate/Account/Client.js +0 -45
- package/dist/OpenPlatform/Authorizer/Auth/AccessToken.d.ts +0 -12
- package/dist/OpenPlatform/Authorizer/Auth/AccessToken.js +0 -43
- package/dist/OpenPlatform/Authorizer/MiniProgram/Account/AccountClient.d.ts +0 -21
- package/dist/OpenPlatform/Authorizer/MiniProgram/Account/AccountClient.js +0 -42
- package/dist/OpenPlatform/Authorizer/MiniProgram/Application.d.ts +0 -15
- package/dist/OpenPlatform/Authorizer/MiniProgram/Application.js +0 -42
- package/dist/OpenPlatform/Authorizer/MiniProgram/Auth/Client.d.ts +0 -11
- package/dist/OpenPlatform/Authorizer/MiniProgram/Auth/Client.js +0 -39
- package/dist/OpenPlatform/Authorizer/MiniProgram/Code/CodeClient.d.ts +0 -85
- package/dist/OpenPlatform/Authorizer/MiniProgram/Code/CodeClient.js +0 -152
- package/dist/OpenPlatform/Authorizer/MiniProgram/Domain/DomainClient.d.ts +0 -14
- package/dist/OpenPlatform/Authorizer/MiniProgram/Domain/DomainClient.js +0 -27
- package/dist/OpenPlatform/Authorizer/MiniProgram/Setting/SettingClient.d.ts +0 -72
- package/dist/OpenPlatform/Authorizer/MiniProgram/Setting/SettingClient.js +0 -133
- package/dist/OpenPlatform/Authorizer/MiniProgram/Tester/TesterClient.d.ts +0 -17
- package/dist/OpenPlatform/Authorizer/MiniProgram/Tester/TesterClient.js +0 -35
- package/dist/OpenPlatform/Authorizer/OfficialAccount/Account/Client.d.ts +0 -18
- package/dist/OpenPlatform/Authorizer/OfficialAccount/Account/Client.js +0 -38
- package/dist/OpenPlatform/Authorizer/OfficialAccount/Application.d.ts +0 -7
- package/dist/OpenPlatform/Authorizer/OfficialAccount/Application.js +0 -22
- package/dist/OpenPlatform/Authorizer/OfficialAccount/MiniProgram/MiniProgramClient.d.ts +0 -19
- package/dist/OpenPlatform/Authorizer/OfficialAccount/MiniProgram/MiniProgramClient.js +0 -37
- package/dist/OpenPlatform/Authorizer/Server/Guard.d.ts +0 -4
- package/dist/OpenPlatform/Authorizer/Server/Guard.js +0 -13
- package/dist/OpenPlatform/Base/OpenPlatformBase.d.ts +0 -40
- package/dist/OpenPlatform/Base/OpenPlatformBase.js +0 -83
- package/dist/OpenPlatform/CodeTemplate/CodeTemplateClient.d.ts +0 -23
- package/dist/OpenPlatform/CodeTemplate/CodeTemplateClient.js +0 -48
- package/dist/OpenPlatform/Component/ComponentClient.d.ts +0 -15
- package/dist/OpenPlatform/Component/ComponentClient.js +0 -33
- package/dist/OpenPlatform/Server/OpenPlatformGuard.d.ts +0 -11
- package/dist/OpenPlatform/Server/OpenPlatformGuard.js +0 -54
- package/dist/OpenWork/Application.d.ts +0 -37
- package/dist/OpenWork/Application.js +0 -128
- package/dist/OpenWork/Auth/ProviderAccessToken.d.ts +0 -8
- package/dist/OpenWork/Auth/ProviderAccessToken.js +0 -33
- package/dist/OpenWork/Auth/SuiteAccessToken.d.ts +0 -8
- package/dist/OpenWork/Auth/SuiteAccessToken.js +0 -34
- package/dist/OpenWork/Auth/SuiteTicket.d.ts +0 -8
- package/dist/OpenWork/Auth/SuiteTicket.js +0 -40
- package/dist/OpenWork/Corp/CorpClient.d.ts +0 -72
- package/dist/OpenWork/Corp/CorpClient.js +0 -150
- package/dist/OpenWork/MiniProgram/MiniProgramClient.d.ts +0 -5
- package/dist/OpenWork/MiniProgram/MiniProgramClient.js +0 -18
- package/dist/OpenWork/Provider/ProviderClient.d.ts +0 -81
- package/dist/OpenWork/Provider/ProviderClient.js +0 -172
- package/dist/OpenWork/Server/OpenWorkGuard.d.ts +0 -13
- package/dist/OpenWork/Server/OpenWorkGuard.js +0 -51
- package/dist/OpenWork/Work/Application.d.ts +0 -5
- package/dist/OpenWork/Work/Application.js +0 -22
- package/dist/OpenWork/Work/Auth/AccessToken.d.ts +0 -12
- package/dist/OpenWork/Work/Auth/AccessToken.js +0 -44
- package/dist/Payment/Application.d.ts +0 -76
- package/dist/Payment/Application.js +0 -199
- package/dist/Payment/Base/PaymentBase.d.ts +0 -13
- package/dist/Payment/Base/PaymentBase.js +0 -40
- package/dist/Payment/Bill/BillClient.d.ts +0 -10
- package/dist/Payment/Bill/BillClient.js +0 -43
- package/dist/Payment/Core/BaseClient.d.ts +0 -17
- package/dist/Payment/Core/BaseClient.js +0 -116
- package/dist/Payment/Coupon/CouponClient.d.ts +0 -6
- package/dist/Payment/Coupon/CouponClient.js +0 -37
- package/dist/Payment/Jssdk/JssdkClient.d.ts +0 -38
- package/dist/Payment/Jssdk/JssdkClient.js +0 -122
- package/dist/Payment/Merchant/MerchantClient.d.ts +0 -7
- package/dist/Payment/Merchant/MerchantClient.js +0 -40
- package/dist/Payment/Notify/Handler.d.ts +0 -25
- package/dist/Payment/Notify/Handler.js +0 -96
- package/dist/Payment/Notify/Paid.d.ts +0 -6
- package/dist/Payment/Notify/Paid.js +0 -32
- package/dist/Payment/Notify/Refunded.d.ts +0 -7
- package/dist/Payment/Notify/Refunded.js +0 -39
- package/dist/Payment/Notify/Scanned.d.ts +0 -9
- package/dist/Payment/Notify/Scanned.js +0 -54
- package/dist/Payment/Order/OrderClient.d.ts +0 -25
- package/dist/Payment/Order/OrderClient.js +0 -76
- package/dist/Payment/ProfitSharing/ProfitSharingClient.d.ts +0 -10
- package/dist/Payment/ProfitSharing/ProfitSharingClient.js +0 -59
- package/dist/Payment/Redpack/RedpackClient.d.ts +0 -23
- package/dist/Payment/Redpack/RedpackClient.js +0 -73
- package/dist/Payment/Refund/RefundClient.d.ts +0 -43
- package/dist/Payment/Refund/RefundClient.js +0 -80
- package/dist/Payment/Reverse/ReverseClient.d.ts +0 -14
- package/dist/Payment/Reverse/ReverseClient.js +0 -30
- package/dist/Payment/Sandbox/SandboxClient.d.ts +0 -8
- package/dist/Payment/Sandbox/SandboxClient.js +0 -40
- package/dist/Payment/Security/SecurityClient.d.ts +0 -7
- package/dist/Payment/Security/SecurityClient.js +0 -18
- package/dist/Payment/Transfer/TransferClient.d.ts +0 -23
- package/dist/Payment/Transfer/TransferClient.js +0 -78
- package/dist/Work/Agent/AgentClient.d.ts +0 -6
- package/dist/Work/Agent/AgentClient.js +0 -25
- package/dist/Work/Agent/WorkbenchClient.d.ts +0 -24
- package/dist/Work/Agent/WorkbenchClient.js +0 -39
- package/dist/Work/Application.d.ts +0 -80
- package/dist/Work/Application.js +0 -263
- package/dist/Work/Auth/AccessToken.d.ts +0 -5
- package/dist/Work/Auth/AccessToken.js +0 -36
- package/dist/Work/Base/WorkBase.d.ts +0 -4
- package/dist/Work/Base/WorkBase.js +0 -12
- package/dist/Work/Calendar/CalendarClient.d.ts +0 -7
- package/dist/Work/Calendar/CalendarClient.js +0 -32
- package/dist/Work/Chat/ChatClient.d.ts +0 -7
- package/dist/Work/Chat/ChatClient.js +0 -27
- package/dist/Work/CorpGroup/CorpGroupClient.d.ts +0 -40
- package/dist/Work/CorpGroup/CorpGroupClient.js +0 -68
- package/dist/Work/Department/DepartmentClient.d.ts +0 -7
- package/dist/Work/Department/DepartmentClient.js +0 -29
- package/dist/Work/ExternalContact/Client.d.ts +0 -222
- package/dist/Work/ExternalContact/Client.js +0 -365
- package/dist/Work/ExternalContact/ContactWayClient.d.ts +0 -44
- package/dist/Work/ExternalContact/ContactWayClient.js +0 -82
- package/dist/Work/ExternalContact/GroupChatWayClient.d.ts +0 -32
- package/dist/Work/ExternalContact/GroupChatWayClient.js +0 -54
- package/dist/Work/ExternalContact/MessageClient.d.ts +0 -58
- package/dist/Work/ExternalContact/MessageClient.js +0 -158
- package/dist/Work/ExternalContact/MessageTemplateClient.d.ts +0 -14
- package/dist/Work/ExternalContact/MessageTemplateClient.js +0 -78
- package/dist/Work/ExternalContact/MomentClient.d.ts +0 -61
- package/dist/Work/ExternalContact/MomentClient.js +0 -104
- package/dist/Work/ExternalContact/SchoolClient.d.ts +0 -28
- package/dist/Work/ExternalContact/SchoolClient.js +0 -177
- package/dist/Work/ExternalContact/StatisticsClient.d.ts +0 -28
- package/dist/Work/ExternalContact/StatisticsClient.js +0 -52
- package/dist/Work/GroupRobot/GroupRobotClient.d.ts +0 -7
- package/dist/Work/GroupRobot/GroupRobotClient.js +0 -18
- package/dist/Work/GroupRobot/Messages/Image.d.ts +0 -6
- package/dist/Work/GroupRobot/Messages/Image.js +0 -15
- package/dist/Work/GroupRobot/Messages/Markdown.d.ts +0 -6
- package/dist/Work/GroupRobot/Messages/Markdown.js +0 -14
- package/dist/Work/GroupRobot/Messages/Message.d.ts +0 -3
- package/dist/Work/GroupRobot/Messages/Message.js +0 -7
- package/dist/Work/GroupRobot/Messages/News.d.ts +0 -8
- package/dist/Work/GroupRobot/Messages/News.js +0 -32
- package/dist/Work/GroupRobot/Messages/NewsItem.d.ts +0 -6
- package/dist/Work/GroupRobot/Messages/NewsItem.js +0 -20
- package/dist/Work/GroupRobot/Messages/Text.d.ts +0 -8
- package/dist/Work/GroupRobot/Messages/Text.js +0 -24
- package/dist/Work/GroupRobot/Messages/index.d.ts +0 -6
- package/dist/Work/GroupRobot/Messages/index.js +0 -18
- package/dist/Work/GroupRobot/Messenger.d.ts +0 -11
- package/dist/Work/GroupRobot/Messenger.js +0 -39
- package/dist/Work/Invoice/InvoiceClient.d.ts +0 -7
- package/dist/Work/Invoice/InvoiceClient.js +0 -38
- package/dist/Work/Jssdk/JssdkClient.d.ts +0 -21
- package/dist/Work/Jssdk/JssdkClient.js +0 -106
- package/dist/Work/Kf/KfAccountClient.d.ts +0 -41
- package/dist/Work/Kf/KfAccountClient.js +0 -71
- package/dist/Work/Kf/KfMessageClient.d.ts +0 -44
- package/dist/Work/Kf/KfMessageClient.js +0 -73
- package/dist/Work/Kf/KfServicerClient.d.ts +0 -26
- package/dist/Work/Kf/KfServicerClient.js +0 -47
- package/dist/Work/Live/LiveClient.d.ts +0 -6
- package/dist/Work/Live/LiveClient.js +0 -32
- package/dist/Work/Media/MediaClient.d.ts +0 -52
- package/dist/Work/Media/MediaClient.js +0 -124
- package/dist/Work/Menu/MenuClient.d.ts +0 -6
- package/dist/Work/Menu/MenuClient.js +0 -24
- package/dist/Work/Message/MessageClient.d.ts +0 -7
- package/dist/Work/Message/MessageClient.js +0 -16
- package/dist/Work/Message/Messenger.d.ts +0 -18
- package/dist/Work/Message/Messenger.js +0 -69
- package/dist/Work/MiniProgram/Application.d.ts +0 -7
- package/dist/Work/MiniProgram/Application.js +0 -26
- package/dist/Work/MiniProgram/Auth/AuthClient.d.ts +0 -8
- package/dist/Work/MsgAudit/MsgAuditClient.d.ts +0 -7
- package/dist/Work/MsgAudit/MsgAuditClient.js +0 -32
- package/dist/Work/OA/OAClient.d.ts +0 -11
- package/dist/Work/OA/OAClient.js +0 -67
- package/dist/Work/Schedule/ScheduleClient.d.ts +0 -8
- package/dist/Work/Schedule/ScheduleClient.js +0 -39
- package/dist/Work/Server/Guard.d.ts +0 -6
- package/dist/Work/Server/Guard.js +0 -34
- package/dist/Work/User/TagClient.d.ts +0 -13
- package/dist/Work/User/TagClient.js +0 -53
- package/dist/Work/User/UserClient.d.ts +0 -16
- package/dist/Work/User/UserClient.js +0 -80
- package/dist/index.d.ts +0 -119
- package/dist/index.js +0 -86
package/dist/Core/Types.d.ts
DELETED
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
/**
|
|
3
|
-
* 公众号网页授权相关配置
|
|
4
|
-
*/
|
|
5
|
-
export declare interface EasyWechatConfigOauth {
|
|
6
|
-
/**
|
|
7
|
-
* 网页授权权限,可选值:snsapi_userinfo、snsapi_base
|
|
8
|
-
*/
|
|
9
|
-
scope: string;
|
|
10
|
-
/**
|
|
11
|
-
* 网页授权回调地址,完整URL
|
|
12
|
-
*/
|
|
13
|
-
callback: string;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* 文件缓存相关配置
|
|
17
|
-
*/
|
|
18
|
-
export declare interface EasyWechatConfigCacheFile {
|
|
19
|
-
/**
|
|
20
|
-
* 缓存文件保存路径,默认:./
|
|
21
|
-
*/
|
|
22
|
-
path: string;
|
|
23
|
-
/**
|
|
24
|
-
* 缓存文件所在目录权限,默认:0o777
|
|
25
|
-
*/
|
|
26
|
-
dirMode: string | number;
|
|
27
|
-
/**
|
|
28
|
-
* 缓存文件的权限,默认:0o666
|
|
29
|
-
*/
|
|
30
|
-
fileMode: string | number;
|
|
31
|
-
/**
|
|
32
|
-
* 缓存文件的后缀,“.”号开头,默认:.cache
|
|
33
|
-
*/
|
|
34
|
-
ext: string;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* 通用配置
|
|
38
|
-
*/
|
|
39
|
-
export declare interface EasyWechatConfig {
|
|
40
|
-
/**
|
|
41
|
-
* 是否开启调试,开启后会在控制台输出日志,默认:false
|
|
42
|
-
* @scope ALL
|
|
43
|
-
*/
|
|
44
|
-
debug?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* 应用 id
|
|
47
|
-
* @scope ALL
|
|
48
|
-
*/
|
|
49
|
-
app_id?: string;
|
|
50
|
-
/**
|
|
51
|
-
* 应用 secret
|
|
52
|
-
* @scope BaseService | OfficialAccount | MiniProgram | Work | OpenWork
|
|
53
|
-
*/
|
|
54
|
-
secret?: string;
|
|
55
|
-
/**
|
|
56
|
-
* 网络请求相关配置
|
|
57
|
-
* @scope ALL
|
|
58
|
-
*/
|
|
59
|
-
http?: AxiosRequestConfig;
|
|
60
|
-
/**
|
|
61
|
-
* 文件缓存相关配置
|
|
62
|
-
* @scope ALL
|
|
63
|
-
*/
|
|
64
|
-
file_cache?: EasyWechatConfigCacheFile;
|
|
65
|
-
/**
|
|
66
|
-
* 服务端接口验证 token
|
|
67
|
-
* @scope OfficialAccount | MiniProgram | OpenPlatform | OpenWork
|
|
68
|
-
*/
|
|
69
|
-
token?: string;
|
|
70
|
-
/**
|
|
71
|
-
* 服务端消息加解密密钥 aes_key
|
|
72
|
-
* @scope OfficialAccount | MiniProgram | OpenPlatform | OpenWork
|
|
73
|
-
*/
|
|
74
|
-
aes_key?: string;
|
|
75
|
-
/**
|
|
76
|
-
* 网页授权相关配置
|
|
77
|
-
* @scope OfficialAccount | OpenPlatform
|
|
78
|
-
*/
|
|
79
|
-
oauth?: EasyWechatConfigOauth;
|
|
80
|
-
/**
|
|
81
|
-
* 微信支付签名密钥
|
|
82
|
-
* @scope Payment | MicroMerchant
|
|
83
|
-
*/
|
|
84
|
-
key?: string;
|
|
85
|
-
/**
|
|
86
|
-
* 支付应用的子 app_id
|
|
87
|
-
* @scope Payment
|
|
88
|
-
*/
|
|
89
|
-
sub_appid?: string;
|
|
90
|
-
/**
|
|
91
|
-
* 商户号
|
|
92
|
-
* @scope Payment | MicroMerchant
|
|
93
|
-
*/
|
|
94
|
-
mch_id?: string;
|
|
95
|
-
/**
|
|
96
|
-
* 子商户号
|
|
97
|
-
* @scope Payment | MicroMerchant
|
|
98
|
-
*/
|
|
99
|
-
sub_mch_id?: string;
|
|
100
|
-
/**
|
|
101
|
-
* pfx 证书路径(敏感接口(如退款、发送红包等)需要)
|
|
102
|
-
* @scope Payment | MicroMerchant
|
|
103
|
-
*/
|
|
104
|
-
cert_path?: string;
|
|
105
|
-
/**
|
|
106
|
-
* 公钥路径(付款到银行卡接口需要,transfer.toBankCard())
|
|
107
|
-
* @scope Payment
|
|
108
|
-
*/
|
|
109
|
-
rsa_public_key_path?: string;
|
|
110
|
-
/**
|
|
111
|
-
* 支付通知URL
|
|
112
|
-
* @scope Payment
|
|
113
|
-
*/
|
|
114
|
-
notify_url?: string;
|
|
115
|
-
/**
|
|
116
|
-
* 支付签约通知URL
|
|
117
|
-
* @scope Payment
|
|
118
|
-
*/
|
|
119
|
-
contract_notify_url?: string;
|
|
120
|
-
/**
|
|
121
|
-
* 是否沙盒模式,默认:false
|
|
122
|
-
* @scope Payment
|
|
123
|
-
*/
|
|
124
|
-
sandbox?: boolean;
|
|
125
|
-
/**
|
|
126
|
-
* 获取证书接口获取到的平台证书序列号
|
|
127
|
-
* @scope MicroMerchant
|
|
128
|
-
*/
|
|
129
|
-
serial_no?: string;
|
|
130
|
-
/**
|
|
131
|
-
* 获取证书接口获取到的证书内容
|
|
132
|
-
* @scope MicroMerchant
|
|
133
|
-
*/
|
|
134
|
-
certificate?: string;
|
|
135
|
-
/**
|
|
136
|
-
* 服务商的公众账号 ID
|
|
137
|
-
* @scope MicroMerchant
|
|
138
|
-
*/
|
|
139
|
-
appid?: string;
|
|
140
|
-
/**
|
|
141
|
-
* APIv3 密钥
|
|
142
|
-
* @scope MicroMerchant
|
|
143
|
-
*/
|
|
144
|
-
apiv3_key?: string;
|
|
145
|
-
/**
|
|
146
|
-
* 刷新token
|
|
147
|
-
* @scope OpenPlatform
|
|
148
|
-
*/
|
|
149
|
-
refresh_token?: string;
|
|
150
|
-
/**
|
|
151
|
-
* 设备类型,目前为“公众账号原始ID”
|
|
152
|
-
* @scope OfficialAccount
|
|
153
|
-
*/
|
|
154
|
-
device_type?: string;
|
|
155
|
-
/**
|
|
156
|
-
* 企业id
|
|
157
|
-
* @scope Work | OpenWork
|
|
158
|
-
*/
|
|
159
|
-
corp_id?: string;
|
|
160
|
-
/**
|
|
161
|
-
* 代理商id
|
|
162
|
-
* @scope Work
|
|
163
|
-
*/
|
|
164
|
-
agent_id?: string;
|
|
165
|
-
/**
|
|
166
|
-
* 应用id
|
|
167
|
-
* @scope OpenWork
|
|
168
|
-
*/
|
|
169
|
-
suite_id?: string;
|
|
170
|
-
/**
|
|
171
|
-
* 应用secret
|
|
172
|
-
* @scope OpenWork
|
|
173
|
-
*/
|
|
174
|
-
suite_secret?: string;
|
|
175
|
-
/**
|
|
176
|
-
* 注册定制化模板ID
|
|
177
|
-
* @scope OpenWork
|
|
178
|
-
*/
|
|
179
|
-
reg_template_id?: string;
|
|
180
|
-
/**
|
|
181
|
-
* 安装应用的回调url(可选)
|
|
182
|
-
* @scope OpenWork
|
|
183
|
-
*/
|
|
184
|
-
redirect_uri_install?: string;
|
|
185
|
-
/**
|
|
186
|
-
* 单点登录回调url(可选)
|
|
187
|
-
* @scope OpenWork
|
|
188
|
-
*/
|
|
189
|
-
redirect_uri_single?: string;
|
|
190
|
-
/**
|
|
191
|
-
* 网页授权第三方回调url(可选)
|
|
192
|
-
* @scope OpenWork
|
|
193
|
-
*/
|
|
194
|
-
redirect_uri_oauth?: string;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* 服务端通知处理回调函数
|
|
198
|
-
* @param message 微信通知信息
|
|
199
|
-
*/
|
|
200
|
-
export declare interface ServerHandlers {
|
|
201
|
-
[key: string]: ServerHandler[];
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* 服务端通知处理回调函数
|
|
205
|
-
* @param message 微信通知信息
|
|
206
|
-
*/
|
|
207
|
-
export declare type ServerHandler = (message: object) => void;
|
|
208
|
-
/**
|
|
209
|
-
* Payment通知错误处理
|
|
210
|
-
* @param message 错误信息
|
|
211
|
-
*/
|
|
212
|
-
export declare type PaymentFailHandler = (message: string) => void;
|
|
213
|
-
/**
|
|
214
|
-
* Payment业务错误处理
|
|
215
|
-
* @param message 错误信息
|
|
216
|
-
*/
|
|
217
|
-
export declare type PaymentAlertHandler = (message: string) => void;
|
|
218
|
-
/**
|
|
219
|
-
* Payment支付结果处理回调函数
|
|
220
|
-
* @param message 微信通知信息
|
|
221
|
-
* @param fail 通知错误处理函数
|
|
222
|
-
*/
|
|
223
|
-
export declare type PaymentPaidHandler = (message: object, fail: PaymentFailHandler) => void;
|
|
224
|
-
/**
|
|
225
|
-
* Payment退款结果处理回调函数
|
|
226
|
-
* @param message 微信通知信息
|
|
227
|
-
* @param reqInfo 微信通知信息中 req_info 解密后的信息
|
|
228
|
-
* @param fail 通知错误处理函数
|
|
229
|
-
*/
|
|
230
|
-
export declare type PaymentRefundedHandler = (message: object, reqInfo: object, fail: PaymentFailHandler) => void;
|
|
231
|
-
/**
|
|
232
|
-
* Payment扫码支付结果处理回调函数
|
|
233
|
-
* @param message 微信通知信息
|
|
234
|
-
* @param fail 通知错误处理函数
|
|
235
|
-
* @param alert 业务错误处理函数
|
|
236
|
-
*/
|
|
237
|
-
export declare type PaymentScannedHandler = (message: object, fail: PaymentFailHandler, alert: PaymentAlertHandler) => void;
|
package/dist/Core/Types.js
DELETED
package/dist/Core/Utils.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import Stream from 'stream';
|
|
2
|
-
export declare const merge: (target: any, source: any) => any;
|
|
3
|
-
export declare const createHash: (str: string, type?: string) => any;
|
|
4
|
-
export declare const createHmac: (str: string, key: string, type?: string) => any;
|
|
5
|
-
/**
|
|
6
|
-
* 计算文件的 md5 值
|
|
7
|
-
* @param path 文件路径或文件可读流
|
|
8
|
-
*/
|
|
9
|
-
export declare const md5File: (path: string | Stream.Readable) => Promise<string>;
|
|
10
|
-
export declare const getTimestamp: (datetime?: string) => number;
|
|
11
|
-
export declare const buildQueryString: (data: object, options?: object) => string;
|
|
12
|
-
export declare const parseQueryString: (data: string, options?: object) => object;
|
|
13
|
-
export declare const randomString: (len?: number) => string;
|
|
14
|
-
export declare const makeSignature: (params: object, key?: string, type?: string) => string;
|
|
15
|
-
export declare const isString: (data: any) => boolean;
|
|
16
|
-
export declare const isArray: (data: any) => boolean;
|
|
17
|
-
export declare const isNumber: (data: any) => boolean;
|
|
18
|
-
export declare const isObject: (data: any) => boolean;
|
|
19
|
-
export declare const isFunction: (data: any) => boolean;
|
|
20
|
-
export declare const isIpv4: (ip: string) => boolean;
|
|
21
|
-
export declare const isIpv6: (ip: string) => boolean;
|
|
22
|
-
export declare const isIp: (ip: string) => boolean;
|
|
23
|
-
export declare const inArray: (data: any, arr: any, strict?: boolean) => boolean;
|
|
24
|
-
export declare const applyMixins: (derivedCtor: any, baseCtors: any[]) => void;
|
|
25
|
-
export declare const strUcwords: (str: string) => string;
|
|
26
|
-
export declare const strLcwords: (str: string) => string;
|
|
27
|
-
export declare const strStudly: (value: string) => string;
|
|
28
|
-
export declare const strCamel: (value: string) => string;
|
|
29
|
-
export declare const singleItem: (obj: any) => any;
|
|
30
|
-
export declare const parseXml: (xml: string) => Promise<any>;
|
|
31
|
-
export declare const buildXml: (data: object, rootName?: string) => string;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import BaseApplication from '../Core/BaseApplication';
|
|
2
|
-
import { EasyWechatConfig } from '../Core/Types';
|
|
3
|
-
import MicroMerchantBase from './Base/MicroMerchantBase';
|
|
4
|
-
import CertficatesClient from './Certficates/CertficatesClient';
|
|
5
|
-
import MediaClient from './Media/MediaClient';
|
|
6
|
-
import MerchantConfigClient from './MerchantConfig/MerchantConfigClient';
|
|
7
|
-
import MeterialClient from './Meterial/MeterialClient';
|
|
8
|
-
import WithdrawClient from './Withdraw/WithdrawClient';
|
|
9
|
-
export default class MicroMerchant extends BaseApplication {
|
|
10
|
-
protected defaultConfig: EasyWechatConfig;
|
|
11
|
-
base: MicroMerchantBase;
|
|
12
|
-
certficates: CertficatesClient;
|
|
13
|
-
media: MediaClient;
|
|
14
|
-
merchantConfig: MerchantConfigClient;
|
|
15
|
-
material: MeterialClient;
|
|
16
|
-
withdraw: WithdrawClient;
|
|
17
|
-
constructor(config?: EasyWechatConfig, prepends?: Object, id?: String);
|
|
18
|
-
registerProviders(): void;
|
|
19
|
-
getKey(): string;
|
|
20
|
-
setSubMchId(subMchId: string, appId?: string): this;
|
|
21
|
-
setCertificate(certificate: string, serialNo?: string): this;
|
|
22
|
-
verifySignature(data: object): boolean;
|
|
23
|
-
submitApplication(): Promise<any>;
|
|
24
|
-
getStatus(): Promise<any>;
|
|
25
|
-
upgrade(): Promise<any>;
|
|
26
|
-
getUpgradeStatus(): Promise<any>;
|
|
27
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const BaseApplication_1 = __importDefault(require("../Core/BaseApplication"));
|
|
7
|
-
const Utils_1 = require("../Core/Utils");
|
|
8
|
-
const MicroMerchantBase_1 = __importDefault(require("./Base/MicroMerchantBase"));
|
|
9
|
-
const CertficatesClient_1 = __importDefault(require("./Certficates/CertficatesClient"));
|
|
10
|
-
const MediaClient_1 = __importDefault(require("./Media/MediaClient"));
|
|
11
|
-
const MerchantConfigClient_1 = __importDefault(require("./MerchantConfig/MerchantConfigClient"));
|
|
12
|
-
const MeterialClient_1 = __importDefault(require("./Meterial/MeterialClient"));
|
|
13
|
-
const WithdrawClient_1 = __importDefault(require("./Withdraw/WithdrawClient"));
|
|
14
|
-
class MicroMerchant extends BaseApplication_1.default {
|
|
15
|
-
constructor(config = {}, prepends = {}, id = null) {
|
|
16
|
-
super(config, prepends, id);
|
|
17
|
-
this.defaultConfig = {
|
|
18
|
-
// 必要配置
|
|
19
|
-
app_id: '',
|
|
20
|
-
mch_id: '',
|
|
21
|
-
key: '',
|
|
22
|
-
http: {
|
|
23
|
-
baseURL: 'https://api.mch.weixin.qq.com/',
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
this.base = null;
|
|
27
|
-
this.certficates = null;
|
|
28
|
-
this.media = null;
|
|
29
|
-
this.merchantConfig = null;
|
|
30
|
-
this.material = null;
|
|
31
|
-
this.withdraw = null;
|
|
32
|
-
this.registerProviders();
|
|
33
|
-
}
|
|
34
|
-
registerProviders() {
|
|
35
|
-
super.registerCommonProviders();
|
|
36
|
-
this.offsetSet('base', function (app) {
|
|
37
|
-
return new MicroMerchantBase_1.default(app);
|
|
38
|
-
});
|
|
39
|
-
this.offsetSet('certficates', function (app) {
|
|
40
|
-
return new CertficatesClient_1.default(app);
|
|
41
|
-
});
|
|
42
|
-
this.offsetSet('media', function (app) {
|
|
43
|
-
return new MediaClient_1.default(app);
|
|
44
|
-
});
|
|
45
|
-
this.offsetSet('merchantConfig', function (app) {
|
|
46
|
-
return new MerchantConfigClient_1.default(app);
|
|
47
|
-
});
|
|
48
|
-
this.offsetSet('material', function (app) {
|
|
49
|
-
return new MeterialClient_1.default(app);
|
|
50
|
-
});
|
|
51
|
-
this.offsetSet('withdraw', function (app) {
|
|
52
|
-
return new WithdrawClient_1.default(app);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
getKey() {
|
|
56
|
-
let key = this.config.key;
|
|
57
|
-
if (!key) {
|
|
58
|
-
throw new Error('config key should not empty.');
|
|
59
|
-
}
|
|
60
|
-
if (32 !== key.length) {
|
|
61
|
-
throw new Error(`'${key}' should be 32 chars length.`);
|
|
62
|
-
}
|
|
63
|
-
return key;
|
|
64
|
-
}
|
|
65
|
-
setSubMchId(subMchId, appId = '') {
|
|
66
|
-
this.config.sub_mch_id = subMchId;
|
|
67
|
-
if (appId) {
|
|
68
|
-
this.config.appid = appId;
|
|
69
|
-
}
|
|
70
|
-
return this;
|
|
71
|
-
}
|
|
72
|
-
setCertificate(certificate, serialNo = '') {
|
|
73
|
-
this.config.certificate = certificate;
|
|
74
|
-
this.config.serial_no = serialNo;
|
|
75
|
-
return this;
|
|
76
|
-
}
|
|
77
|
-
verifySignature(data) {
|
|
78
|
-
if (typeof data['sign'] == 'undefined' || !data['sign']) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
let sign = data['sign'];
|
|
82
|
-
delete data['sign'];
|
|
83
|
-
let signType = sign.length > 32 ? 'HMAC-SHA256' : 'MD5';
|
|
84
|
-
let secretKey = this.getKey();
|
|
85
|
-
if ((0, Utils_1.makeSignature)(data, secretKey, signType) === sign) {
|
|
86
|
-
return true;
|
|
87
|
-
}
|
|
88
|
-
throw new Error('return value signature verification error');
|
|
89
|
-
}
|
|
90
|
-
// map to `base` module
|
|
91
|
-
submitApplication() {
|
|
92
|
-
return this.base.submitApplication.apply(this.base, arguments);
|
|
93
|
-
}
|
|
94
|
-
getStatus() {
|
|
95
|
-
return this.base.getStatus.apply(this.base, arguments);
|
|
96
|
-
}
|
|
97
|
-
upgrade() {
|
|
98
|
-
return this.base.upgrade.apply(this.base, arguments);
|
|
99
|
-
}
|
|
100
|
-
getUpgradeStatus() {
|
|
101
|
-
return this.base.getUpgradeStatus.apply(this.base, arguments);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
exports.default = MicroMerchant;
|
|
105
|
-
;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import BaseClient from '../Core/BaseClient';
|
|
2
|
-
export default class MicroMerchantBase extends BaseClient {
|
|
3
|
-
submitApplication(params: object): Promise<any>;
|
|
4
|
-
getStatus(applymentId: string, businessCode?: string): Promise<any>;
|
|
5
|
-
upgrade(params: object): Promise<any>;
|
|
6
|
-
getUpgradeStatus(subMchId?: string): Promise<any>;
|
|
7
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const Utils_1 = require("../../Core/Utils");
|
|
7
|
-
const BaseClient_1 = __importDefault(require("../Core/BaseClient"));
|
|
8
|
-
class MicroMerchantBase extends BaseClient_1.default {
|
|
9
|
-
submitApplication(params) {
|
|
10
|
-
let newParams = this.processParams((0, Utils_1.merge)((0, Utils_1.merge)({}, params), {
|
|
11
|
-
version: '3.0',
|
|
12
|
-
cert_sn: '',
|
|
13
|
-
sign_type: 'HMAC-SHA256',
|
|
14
|
-
nonce_str: (0, Utils_1.randomString)(18),
|
|
15
|
-
}));
|
|
16
|
-
return this.safeRequest('applyment/micro/submit', newParams);
|
|
17
|
-
}
|
|
18
|
-
getStatus(applymentId, businessCode = '') {
|
|
19
|
-
let params = {
|
|
20
|
-
version: '1.0',
|
|
21
|
-
sign_type: 'HMAC-SHA256',
|
|
22
|
-
nonce_str: (0, Utils_1.randomString)(18),
|
|
23
|
-
};
|
|
24
|
-
if (applymentId) {
|
|
25
|
-
params['applyment_id'] = applymentId;
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
params['business_code'] = businessCode;
|
|
29
|
-
}
|
|
30
|
-
return this.safeRequest('applyment/micro/getstate', params);
|
|
31
|
-
}
|
|
32
|
-
upgrade(params) {
|
|
33
|
-
let newParams = this.processParams((0, Utils_1.merge)((0, Utils_1.merge)({}, params), {
|
|
34
|
-
sub_mch_id: params['sub_mch_id'] || this.app.config.sub_mch_id,
|
|
35
|
-
version: '1.0',
|
|
36
|
-
cert_sn: '',
|
|
37
|
-
sign_type: 'HMAC-SHA256',
|
|
38
|
-
nonce_str: (0, Utils_1.randomString)(18),
|
|
39
|
-
}));
|
|
40
|
-
return this.safeRequest('applyment/micro/submitupgrade', newParams);
|
|
41
|
-
}
|
|
42
|
-
getUpgradeStatus(subMchId = '') {
|
|
43
|
-
let params = {
|
|
44
|
-
sub_mch_id: subMchId || this.app.config.sub_mch_id,
|
|
45
|
-
version: '1.0',
|
|
46
|
-
sign_type: 'HMAC-SHA256',
|
|
47
|
-
nonce_str: (0, Utils_1.randomString)(18),
|
|
48
|
-
};
|
|
49
|
-
return this.safeRequest('applyment/micro/getupgradestate', params);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.default = MicroMerchantBase;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const AES_1 = require("../../Core/AES");
|
|
16
|
-
const Utils_1 = require("../../Core/Utils");
|
|
17
|
-
const BaseClient_1 = __importDefault(require("../Core/BaseClient"));
|
|
18
|
-
class CertficatesClient extends BaseClient_1.default {
|
|
19
|
-
get(returnRaw = false) {
|
|
20
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
let params = {
|
|
22
|
-
sign_type: 'HMAC-SHA256',
|
|
23
|
-
nonce_str: (0, Utils_1.randomString)(18),
|
|
24
|
-
};
|
|
25
|
-
if (returnRaw) {
|
|
26
|
-
return yield this.requestRaw('risk/getcertficates', params);
|
|
27
|
-
}
|
|
28
|
-
let response = yield this.request('risk/getcertficates', params);
|
|
29
|
-
if ('SUCCESS' !== response['return_code']) {
|
|
30
|
-
throw new Error(`Failed to get certificate. return_code_msg: "${response['return_code']}(${response['return_msg']})".`);
|
|
31
|
-
}
|
|
32
|
-
if ('SUCCESS' !== response['result_code']) {
|
|
33
|
-
throw new Error(`Failed to get certificate. result_err_code_desc: "${response['return_code']}(${response['err_code']}[${response['err_code_desc']}])".`);
|
|
34
|
-
}
|
|
35
|
-
let certificates = {};
|
|
36
|
-
try {
|
|
37
|
-
certificates = JSON.parse(response['certificates'])['data'][0];
|
|
38
|
-
}
|
|
39
|
-
catch (e) { }
|
|
40
|
-
let ciphertext = this.decrypt(certificates['encrypt_certificate']);
|
|
41
|
-
delete certificates['encrypt_certificate'];
|
|
42
|
-
certificates['certificates'] = ciphertext;
|
|
43
|
-
return certificates;
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
decrypt(encryptCertificate) {
|
|
47
|
-
if (!encryptCertificate)
|
|
48
|
-
return null;
|
|
49
|
-
return AES_1.AES_GCM.decrypt(Buffer.from(encryptCertificate['ciphertext'], 'base64'), this.app.config.apiv3_key, encryptCertificate['nonce'], encryptCertificate['associated_data'], 'aes-256-gcm').toString();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.default = CertficatesClient;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import PaymentBaseClient from '../../Payment/Core/BaseClient';
|
|
2
|
-
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
3
|
-
declare class BaseClient extends PaymentBaseClient {
|
|
4
|
-
httpUpload(url: string, files?: object, form?: object, query?: object, returnResponse?: boolean): Promise<any>;
|
|
5
|
-
protected request(endpoint: string, params?: object, method?: string, options?: AxiosRequestConfig, returnResponse?: boolean): Promise<AxiosResponse<any>>;
|
|
6
|
-
protected processParams(params: object): object;
|
|
7
|
-
protected getSensitiveFieldsName(): string[];
|
|
8
|
-
}
|
|
9
|
-
export default BaseClient;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const BaseClient_1 = __importDefault(require("../../Payment/Core/BaseClient"));
|
|
16
|
-
const Utils_1 = require("../../Core/Utils");
|
|
17
|
-
const RSA_1 = __importDefault(require("../../Core/RSA"));
|
|
18
|
-
const fs_1 = __importDefault(require("fs"));
|
|
19
|
-
const form_data_1 = __importDefault(require("form-data"));
|
|
20
|
-
class BaseClient extends BaseClient_1.default {
|
|
21
|
-
httpUpload(url, files = {}, form = {}, query = {}, returnResponse = false) {
|
|
22
|
-
let formData = new form_data_1.default;
|
|
23
|
-
for (let name in files) {
|
|
24
|
-
if ((0, Utils_1.isString)(files[name])) {
|
|
25
|
-
formData.append(name, fs_1.default.createReadStream(files[name]));
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
formData.append(name, files[name]);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
for (let name in form) {
|
|
32
|
-
formData.append(name, form[name]);
|
|
33
|
-
}
|
|
34
|
-
return this.doRequest({
|
|
35
|
-
url,
|
|
36
|
-
data: formData,
|
|
37
|
-
method: 'POST',
|
|
38
|
-
params: query,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
request(endpoint, params = {}, method = 'post', options = {}, returnResponse = false) {
|
|
42
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
let base = {
|
|
44
|
-
mch_id: this.app.config.mch_id,
|
|
45
|
-
};
|
|
46
|
-
let localParams = (0, Utils_1.merge)((0, Utils_1.merge)(base, this.prepends()), params);
|
|
47
|
-
let secretKey = yield this.app.getKey();
|
|
48
|
-
localParams['sign'] = (0, Utils_1.makeSignature)(localParams, secretKey, localParams['sign_type'] || 'MD5');
|
|
49
|
-
let payload = (0, Utils_1.merge)((0, Utils_1.merge)({}, options), {
|
|
50
|
-
url: endpoint,
|
|
51
|
-
method,
|
|
52
|
-
responseType: 'text',
|
|
53
|
-
data: (0, Utils_1.buildXml)(localParams)
|
|
54
|
-
});
|
|
55
|
-
let response = yield this.doRequest(payload);
|
|
56
|
-
if (returnResponse) {
|
|
57
|
-
return response;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
let body = response.data;
|
|
61
|
-
try {
|
|
62
|
-
body = yield (0, Utils_1.parseXml)(body);
|
|
63
|
-
}
|
|
64
|
-
catch (e) { }
|
|
65
|
-
return body;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
processParams(params) {
|
|
70
|
-
let serial_no = this.app.config.serial_no;
|
|
71
|
-
if (serial_no == undefined || serial_no == null) {
|
|
72
|
-
throw new Error('Config `serial_no` connot be empty.');
|
|
73
|
-
}
|
|
74
|
-
let certificate = this.app.config.certificate;
|
|
75
|
-
if (certificate == undefined || certificate == null) {
|
|
76
|
-
throw new Error('Config `certificate` connot be empty.');
|
|
77
|
-
}
|
|
78
|
-
let rsa = new RSA_1.default;
|
|
79
|
-
rsa.setPublicKey(certificate);
|
|
80
|
-
let newParams = (0, Utils_1.merge)({}, params);
|
|
81
|
-
newParams['cert_sn'] = serial_no;
|
|
82
|
-
let sensitive_fields = this.getSensitiveFieldsName();
|
|
83
|
-
for (let k in newParams) {
|
|
84
|
-
if ((0, Utils_1.inArray)(k, sensitive_fields)) {
|
|
85
|
-
newParams[k] = rsa.encrypt(newParams[k]);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return newParams;
|
|
89
|
-
}
|
|
90
|
-
getSensitiveFieldsName() {
|
|
91
|
-
return [
|
|
92
|
-
'id_card_name',
|
|
93
|
-
'id_card_number',
|
|
94
|
-
'account_name',
|
|
95
|
-
'account_number',
|
|
96
|
-
'contact',
|
|
97
|
-
'contact_phone',
|
|
98
|
-
'contact_email',
|
|
99
|
-
'legal_person',
|
|
100
|
-
'mobile_phone',
|
|
101
|
-
'email',
|
|
102
|
-
];
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
;
|
|
106
|
-
exports.default = BaseClient;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const Utils_1 = require("../../Core/Utils");
|
|
16
|
-
const BaseClient_1 = __importDefault(require("../Core/BaseClient"));
|
|
17
|
-
class MediaClient extends BaseClient_1.default {
|
|
18
|
-
upload(file) {
|
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
if (!file) {
|
|
21
|
-
throw new Error(`File does not exist, or the file is unreadable: '${file}'`);
|
|
22
|
-
}
|
|
23
|
-
let form = {
|
|
24
|
-
media_hash: yield (0, Utils_1.md5File)(file),
|
|
25
|
-
sign_type: 'HMAC-SHA256',
|
|
26
|
-
};
|
|
27
|
-
return this.httpUpload('secapi/mch/uploadmedia', {
|
|
28
|
-
media: file
|
|
29
|
-
}, form);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.default = MediaClient;
|