-
-
Notifications
You must be signed in to change notification settings - Fork 38
decorator.js
Decorate the Axios
instance
Kind: global class
-
Decorator
- new Decorator(config)
-
instance
-
.v2 ⇒
AxiosInstance
-
.v3 ⇒
AxiosInstance
-
.request([pathname], [method], [data], [config]) ⇒
PromiseLike
-
.v2 ⇒
-
static
- .defaults
-
.withDefaults(config) ⇒
object
-
.xmlBased(config) ⇒
AxiosInstance
-
.requestInterceptor() ⇒
function
-
.responseVerifier(certs) ⇒
function
-
.jsonBased(config) ⇒
AxiosInstance
Decorate factory
Param | Type | Description |
---|---|---|
config | object |
configuration |
config.mchid | string |
The merchant ID |
config.serial | string |
The serial number of the merchant certificate |
config.privateKey |
string | Buffer
|
The merchant private key certificate |
config.certs | object |
The wechatpay provider size configuration, {serial: publicKey} pair |
[config.secret] | string |
The merchant secret key string |
[config.merchant] | object |
The merchant certificates, more @see {import('tls').createSecureContext} |
[config.merchant.cert] |
string | Buffer
|
The merchant cert chains in PEM format |
[config.merchant.key] |
string | Buffer
|
The merchant private keys in PEM format |
[config.merchant.pfx] |
string | Buffer
|
The merchant PFX or PKCS12 encoded private key and certificate chain. |
[config.merchant.passphrase] |
string | Buffer
|
The merchant shared passphrase used for a single private key and/or a PFX. |
Getter APIv2's client (xmlBased)
Kind: instance property of Decorator
Returns: AxiosInstance
- - The axios instance
Getter APIv3's client (jsonBased)
Kind: instance property of Decorator
Returns: AxiosInstance
- - The axios instance
Request the remote pathname
by a HTTP method
verb
Kind: instance method of Decorator
Returns: PromiseLike
- - The AxiosPromise
Param | Type | Description |
---|---|---|
[pathname] | string |
The pathname string. |
[method] | string |
The method string. |
[data] |
object | Buffer
|
The data. |
[config] | object |
The config. |
Kind: static property of Decorator
Properties
Name | Type | Description |
---|---|---|
defaults | object |
The defaults configuration whose pased in Axios . |
Deep merge the input with the defaults
Kind: static method of Decorator
Returns: object
- - With the built-in configuration.
Param | Type | Description |
---|---|---|
config | object |
The configuration. |
Create an APIv2's client
Kind: static method of Decorator
Returns: AxiosInstance
- - The axios instance
Param | Type | Description |
---|---|---|
config | object |
configuration |
[config.mchid] | string |
The merchant ID |
[config.secret] | string |
The merchant secret key string |
[config.merchant] | object |
The merchant certificates, more @see {import('tls').createSecureContext} |
[config.merchant.cert] |
string | Buffer
|
The merchant cert chains in PEM format |
[config.merchant.key] |
string | Buffer
|
The merchant private keys in PEM format |
[config.merchant.pfx] |
string | Buffer
|
The merchant PFX or PKCS12 encoded private key and certificate chain. |
[config.merchant.passphrase] |
string | Buffer
|
The merchant shared passphrase used for a single private key and/or a PFX. |
APIv3's requestInterceptor
Kind: static method of Decorator
Returns: function
- Named signer
function
APIv3's responseVerifier
Kind: static method of Decorator
Returns: function
- Named as verifier
function
Param | Type | Description |
---|---|---|
certs | object |
The wechatpay platform serial and certificate(s), {serial: publicKey} pair |
Create an APIv3's client
Kind: static method of Decorator
Returns: AxiosInstance
- - The axios instance
Param | Type | Description |
---|---|---|
config | object |
configuration |
config.mchid | string |
The merchant ID |
config.serial | string |
The serial number of the merchant certificate |
config.privateKey |
string | Buffer
|
The merchant private key certificate |
config.certs | object |
The wechatpay platform serial and certificate(s), {serial: publicKey} pair |