From ca28b63d0e2fcd180a60631db86b9c78af1cbf48 Mon Sep 17 00:00:00 2001 From: Sergio LR Date: Wed, 10 May 2023 16:11:34 +0200 Subject: [PATCH 01/18] feat: add & update endpoints + update docs --- docs/RESTv1.html | 4 +- docs/RESTv2.html | 4050 +++++++++++++++++++++++++++++++++++--------- docs/global.html | 4 +- docs/index.html | 4 +- docs/rest1.js.html | 2 +- docs/rest2.js.html | 140 +- lib/rest2.js | 137 +- package.json | 3 +- 8 files changed, 3534 insertions(+), 810 deletions(-) diff --git a/docs/RESTv1.html b/docs/RESTv1.html index fca9ccd..30997f0 100644 --- a/docs/RESTv1.html +++ b/docs/RESTv1.html @@ -29,7 +29,7 @@ -

Home

Classes

Global

+

Home

Classes

Global

@@ -6796,4 +6796,4 @@
Parameters:
- \ No newline at end of file + diff --git a/docs/RESTv2.html b/docs/RESTv2.html index 7548434..d983804 100644 --- a/docs/RESTv2.html +++ b/docs/RESTv2.html @@ -29,7 +29,7 @@ -

Home

Classes

Global

+

Home

Classes

Global

@@ -18307,7 +18307,7 @@
Returns:
-

payDeposits(paramsopt, cbopt) → {Promise}

+

payAddCurrencyConversion(cbopt) → {Promise}

@@ -18319,7 +18319,7 @@

payDeposit
Source:
@@ -18353,7 +18353,7 @@

payDeposit
See:
@@ -18365,6 +18365,10 @@

payDeposit +
+

Add bitfinex pay currency conversions

+
+ @@ -18402,13 +18406,13 @@

Parameters:
- params + params.baseCcy -object +number @@ -18417,8 +18421,6 @@
Parameters:
- <optional>
- @@ -18428,35 +18430,14 @@
Parameters:
-

query parameters

-
Properties
- - - - - - - - - - - - - - - - - - - - + + - - + + - + + + +
NameTypeAttributesDescription

Base currency that will be converted, could be bfx pay currency symbol (e.g. UST-ETH) or global api symbol (UST), result is stored as global api symbol!

idparams.convertCcy @@ -18471,8 +18452,6 @@
Properties
- <optional>
- @@ -18482,21 +18461,20 @@
Properties
-

Deposit/Ledger entry Id to search for, use either id or from and to fields, -id has priority over from, to fields

Currency to which base currency will be converted, could be bfx pay currency symbol (e.g. UST-ETH) or global api symbol (UST), result is stored as global api symbol!

fromcb -number +function @@ -18516,115 +18494,155 @@
Properties
-

Millisecond start time

legacy callback

- - - to - - - - -number - - - - - - <optional>
- - - - - - -

Millisecond end time

- + + + + + + + +
Returns:
+ + +
+

p

+
+ + + +
+
+ Type +
+
+ +Promise + + +
+
- - - ccy - - + + - -string + - - +

payCurrencyConversionList(cbopt) → {Promise}

- - - - <optional>
- + - - - - - -

Pay currency to search deposits for

- +
+
Source:
+
+ - - - unlinked - + - - - -boolean + + - - + - - - - <optional>
- + - + - - - + - + -

Include only unlinked payments

- + - - - - + + + + + + + +
See:
+
+ +
+ + + +
+ + + + + +
+

List bitfinex pay currency conversions

+
+ + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + @@ -18654,6 +18672,12 @@
Properties
+ + @@ -18707,7 +18731,7 @@
Returns:
-

payDepositsUnlinked(params, cbopt) → {Promise}

+

payDeposits(paramsopt, cbopt) → {Promise}

@@ -18719,7 +18743,7 @@

pa
Source:
@@ -18817,6 +18841,8 @@

Parameters:
- + + - + + - + - - - - -
NameTypeAttributesDefaultDescription
+ + null + +

legacy callback

+ <optional>
+ @@ -18854,13 +18880,13 @@
Properties
ccyid -string +number @@ -18869,6 +18895,8 @@
Properties
+ <optional>
+ @@ -18878,14 +18906,15 @@
Properties
-

pay currency to search deposits for

Deposit/Ledger entry Id to search for, use either id or from and to fields, +id has priority over from, to fields

startfrom @@ -18911,15 +18940,14 @@
Properties
-

millisecond start time, if omitted it will be end - 1 day if end is present -otherwise it will be yesterday. Min value is 1614758400000

Millisecond start time

endto @@ -18945,16 +18973,80 @@
Properties
-

Millisecond end time, if omitted it will be start + 1 day if start is present -otherwise it will be current time. Max difference between start and end -is 2 days!

- - +

Millisecond end time

+ + + + + + + ccy + + + + + +string + + + + + + + + + <optional>
+ + + + + + + + + + +

Pay currency to search deposits for

+ + + + + + + unlinked + + + + + +boolean + + + + + + + + + <optional>
+ + + + + + + + + + +

Include only unlinked payments

+ + + + + + + @@ -19039,7 +19131,7 @@
Returns:
-

payInvoiceComplete(params, cbopt) → {Promise}

+

payDepositsUnlinked(params, cbopt) → {Promise}

@@ -19051,7 +19143,7 @@

pay
Source:
@@ -19186,38 +19278,7 @@

Properties
- id - - - - - -string - - - - - - - - - - - - - - - - - -

unique invoice identifier

- - - - - - - payCcy + ccy @@ -19241,15 +19302,14 @@
Properties
-

paid invoice currency, should be one of values under payCurrencies field -on invoice

+

pay currency to search deposits for

- depositId + start @@ -19275,14 +19335,15 @@
Properties
-

movement/deposit Id linked to invoice as payment

+

millisecond start time, if omitted it will be end - 1 day if end is present +otherwise it will be yesterday. Min value is 1614758400000

- ledgerId + end @@ -19308,8 +19369,9 @@
Properties
-

ledger entry Id linked to invoice as payment, use either depositId -or ledgerId

+

Millisecond end time, if omitted it will be start + 1 day if start is present +otherwise it will be current time. Max difference between start and end +is 2 days!

@@ -19401,7 +19463,7 @@
Returns:
-

payInvoiceCreate(params, cbopt) → {Promise}

+

payInvoiceComplete(params, cbopt) → {Promise}

@@ -19413,7 +19475,7 @@

payIn
Source:
@@ -19447,7 +19509,7 @@

payIn
See:
@@ -19520,7 +19582,7 @@

Parameters:
-

invoice parameters

+

query parameters

Properties
@@ -19548,7 +19610,7 @@
Properties
- amount + id @@ -19572,14 +19634,14 @@
Properties
-

invoice amount in currency

+

unique invoice identifier

- currency + payCcy @@ -19603,20 +19665,21 @@
Properties
-

invoice currency

+

paid invoice currency, should be one of values under payCurrencies field +on invoice

- payCurrencies + depositId -Array.<string> +number @@ -19625,6 +19688,8 @@
Properties
+ <optional>
+ @@ -19634,20 +19699,20 @@
Properties
-

currencies in which invoice accepts the payments

+

movement/deposit Id linked to invoice as payment

- duration + depositIds -number +Array.<number> @@ -19667,22 +19732,20 @@
Properties
-

optional, invoice expire time in seconds, minimal duration -is 5 mins and maximal duration is 3 days. -Default value is 15 minutes

+

movement/deposit ids list linked to invoice as payment

- orderId + ledgerId -string +number @@ -19691,6 +19754,8 @@
Properties
+ <optional>
+ @@ -19700,20 +19765,28 @@
Properties
-

reference order identifier in merchant's platform

+

ledger entry Id linked to invoice as payment, use either depositId +or ledgerId

+ + + + + + + - webhook + cb -string +function @@ -19733,237 +19806,160 @@
Properties
-

the endpoint that will be called once the payment is -completed or expired

+

legacy callback

+ + - - - redirectUrl - - - - -string - - - - - - <optional>
- - - - - - -

merchant redirect URL, this one is used in UI to redirect -customer to merchant's site once the payment is completed -or expired

- - - - - customerInfo - - - - -object - - - - - - +
Returns:
- - - + +
+

p

+
- -

information related to customer against who the invoice -is issued

-
Properties
- - - - - - +
+
+ Type +
+
+Promise -
- - - + + - + - - - - - - - - + - + - - - - +
-
- + +
Source:
+
+ - - - - + - + - - - + - + - - + - - - - + - + + - - - - - - - - - - - - - - - - - - +
Parameters:
+ + +
NameTypeAttributesDescription
nationality - - -string + +

payInvoiceCountstats(paramsopt, cbopt) → {Promise}

- -
- - - -

customer's nationality, alpha2 code or full country name -(alpha2 preffered)

residCountry - - -string + + - - - + - + - -

customer's residential country, alpha2 code or -full country name (alpha2 preffered)

residState - - -string + + +
See:
+
+ +
+ - -
- - <optional>
- - - -

optional, customer's residential state/province

residCity - - -string - - - - - -

customer's residential city/town

+ + + + + + + + + + + + + + + + + + - + - + - + + + +
NameTypeAttributesDescription
residZipCodeparams -string +object @@ -19972,6 +19968,8 @@
Properties
+ <optional>
+ @@ -19981,14 +19979,35 @@
Properties
-

customer's residential zip code/postal code

query parameters

+
Properties
+ + + + + + + + + + + + + + + + + + + + + - + + - + + + + + + +
NameTypeAttributesDescription
residStreetstatus @@ -20003,6 +20022,8 @@
Properties
+ <optional>
+ @@ -20012,14 +20033,15 @@
Properties
-

customer's residential street address

invoice status, allowed array item values are: +CREATED, PENDING, COMPLETED, EXPIRED

residBuildingNoformat @@ -20045,20 +20067,27 @@
Properties
-

optional, customer's residential building number/name

Aggregation format, allowed values: D - today's, W - this week, M - this month, Y - this year, A - all

+ +
fullNamecb -string +function @@ -20067,6 +20096,8 @@
Properties
+ <optional>
+ @@ -20076,78 +20107,178 @@
Properties
-

customer's full name

legacy callback

- - - email - - - - -string - - - - - - - - - - -

customer's email address

- - - - - - - - - - meta - - - - -object - - +
Returns:
- - - - <optional>
- + +
+

p

+
- - - - +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + -

metadata

+ + +

payInvoiceCreate(params, cbopt) → {Promise}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + + + + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
params + + +object + + + + + + + + + +

invoice parameters

Properties
@@ -20175,41 +20306,2592 @@
Properties
env - - -string - - - - - - <optional>
- - - - - -

merchant environment, allowed values: production, test, -staging, development

tagsamount + + +string + + + + + + + + + +

invoice amount in currency

currency + + +string + + + + + + + + + +

invoice currency

payCurrencies + + +Array.<string> + + + + + + + + + +

currencies in which invoice accepts the payments

duration + + +number + + + + + + <optional>
+ + + + + +

optional, invoice expire time in seconds, minimal duration +is 5 mins and maximal duration is 3 days. +Default value is 15 minutes

orderId + + +string + + + + + + + + + +

reference order identifier in merchant's platform

webhook + + +string + + + + + + <optional>
+ + + + + +

the endpoint that will be called once the payment is +completed or expired

redirectUrl + + +string + + + + + + <optional>
+ + + + + +

merchant redirect URL, this one is used in UI to redirect +customer to merchant's site once the payment is completed +or expired

customerInfo + + +object + + + + + + + + + +

information related to customer against who the invoice +is issued

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
nationality + + +string + + + + + + + + + +

customer's nationality, alpha2 code or full country name +(alpha2 preffered)

residCountry + + +string + + + + + + + + + +

customer's residential country, alpha2 code or +full country name (alpha2 preffered)

residState + + +string + + + + + + <optional>
+ + + + + +

optional, customer's residential state/province

residCity + + +string + + + + + + + + + +

customer's residential city/town

residZipCode + + +string + + + + + + + + + +

customer's residential zip code/postal code

residStreet + + +string + + + + + + + + + +

customer's residential street address

residBuildingNo + + +string + + + + + + <optional>
+ + + + + +

optional, customer's residential building number/name

fullName + + +string + + + + + + + + + +

customer's full name

email + + +string + + + + + + + + + +

customer's email address

ip + + +string + + + + + + <optional>
+ + + + + +

customer's ip

+ +
meta + + +object + + + + + + <optional>
+ + + + + +

metadata

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
env + + +string + + + + + + <optional>
+ + + + + +

merchant environment, allowed values: production, test, +staging, development

tags + + +Array.<string> + + + + + + <optional>
+ + + + + +

invoice tags, max number of tags is 5 and max length of +tag is 5 characters

+ +
+ + + + + + + + + cb + + + + + +function + + + + + + + + + <optional>
+ + + + + + + + + + +

legacy callback

+ + + + + + + + + + + + + + + + + + + + + +
Returns:
+ + +
+

p

+
+ + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

payInvoiceExpire(params, cbopt) → {Promise}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + + + + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
params + + +object + + + + + + + + + +

query parameters

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + + +string + + + +

unique invoice identifier

+ +
cb + + +function + + + + + + <optional>
+ + + + + +

legacy callback

+ + + + + + + + + + + + + + + + +
Returns:
+ + +
+

p

+
+ + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

payInvoiceList(paramsopt, cbopt) → {Promise}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + + + + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
params + + +object + + + + + + <optional>
+ + + + + +

query parameters

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
id + + +string + + + + + + <optional>
+ + + + + +

unique invoice identifier

start + + +number + + + + + + <optional>
+ + + + + +

millisecond start time

end + + +number + + + + + + <optional>
+ + + + + +

millisecond end time

limit + + +number + + + + + + <optional>
+ + + + + +

number of records (Max 100), default 10

+ +
cb + + +function + + + + + + <optional>
+ + + + + +

legacy callback

+ + + + + + + + + + + + + + + + +
Returns:
+ + +
+

p

+
+ + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

payInvoiceListPaginated(paramsopt, cbopt) → {Promise}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + + + + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
params + + +object + + + + + + <optional>
+ + + + + +

query parameters

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
page + + +number + + + + + + <optional>
+ + + + + +

Current page, default 1 100

pageSize + + +number + + + + + + <optional>
+ + + + + +

Number of records per page, default 10, max 100

sort + + +string + + + + + + <optional>
+ + + + + +

Sort order, default asc, accepted values are asc and desc

sortField + + +string + + + + + + <optional>
+ + + + + +

Sort field, default t, allowed values: t, amount, status

status + + +string + + + + + + <optional>
+ + + + + +

invoice status, allowed array item values are: +CREATED, PENDING, COMPLETED, EXPIRED

fiat + + +Array.<string> + + + + + + <optional>
+ + + + + +

fiat filter, should be array of strings

crypto + + +Array.<string> + + + + + + <optional>
+ + + + + +

crypto filter, should be array of strings

id + + +string + + + + + + <optional>
+ + + + + +

unique invoice identifier

orderId + + +string + + + + + + <optional>
+ + + + + +

erchant order id

+ +
cb + + +function + + + + + + <optional>
+ + + + + +

legacy callback

+ + + + + + + + + + + + + + + + +
Returns:
+ + +
+

p

+
+ + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

payInvoiceStatsEarning(paramsopt, cbopt) → {Promise}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + + + +
+

Stats related to earnings during different intervals

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
params + + +object + + + + + + <optional>
+ + + + + +

query parameters

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
currency + + +string + + + + + + <optional>
+ + + + + +

Currency on which earnings will be calculated +CREATED, PENDING, COMPLETED, EXPIRED

format + + +string + + + + + + <optional>
+ + + + + +

Aggregation format, allowed values: D - today's, W - this week, M - this month, Y - this year, A - all

+ +
cb + + +function + + + + + + <optional>
+ + + + + +

legacy callback

+ + + + + + + + + + + + + + + + +
Returns:
+ + +
+

p

+
+ + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

payMerchantDailyLimit(cbopt) → {Promise}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + + + +
+

Returns the daily limits for merchant

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
params.customerEmails + + +Array.<string> + + + + + + <optional>
+ + + + + +

Optional, customer emails for e-commerce usage

cb + + +function + + + + + + <optional>
+ + + + + +

legacy callback

+ + + + + + + + + + + + + + + + +
Returns:
+ + +
+

p

+
+ + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

payMerchantSettingsList(cbopt) → {Promise}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + + + +
+

Reads multiple merchant settings

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - -
NameTypeAttributesDescription
params.keys @@ -20224,8 +22906,6 @@
Properties
- <optional>
- @@ -20235,22 +22915,7 @@
Properties
-

invoice tags, max number of tags is 5 and max length of -tag is 5 characters

- - - - - - - - - +

Setting keys, if empty array all settings will be returned

@@ -20335,7 +23000,7 @@
Returns:
-

payInvoiceExpire(params, cbopt) → {Promise}

+

payMerchantSettingsRead(cbopt) → {Promise}

@@ -20347,7 +23012,7 @@

payIn
Source:
@@ -20381,7 +23046,7 @@

payIn
See:
@@ -20393,6 +23058,10 @@

payIn +
+

Reads merchant settings

+
+ @@ -20430,13 +23099,13 @@

Parameters:
- params + params.key -object +string @@ -20454,56 +23123,7 @@
Parameters:
-

query parameters

-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
id - - -string - - - -

unique invoice identifier

- - +

Setting key. Check doc link for possible values

@@ -20588,7 +23208,7 @@
Returns:
-

payInvoiceList(paramsopt, cbopt) → {Promise}

+

payMerchantSettingsWrite(cbopt) → {Promise}

@@ -20600,7 +23220,7 @@

payInvo
Source:
@@ -20634,7 +23254,7 @@

payInvo
See:
@@ -20646,6 +23266,9 @@

payInvo +
+

Sets merchant settings

+
@@ -20656,63 +23279,10 @@

payInvo -

Parameters:
- - - - - - - - - - - - - - - - - - - - - +
Parameters:
- - - - - - - - - - - - - - + @@ -20954,7 +23447,7 @@
Returns:
-

payInvoiceListPaginated(paramsopt, cbopt) → {Promise}

+

payMerchantSettingsWriteBatch(cbopt) → {Promise}

@@ -20966,7 +23459,7 @@

Source:
@@ -21000,7 +23493,7 @@

See:
@@ -21012,6 +23505,10 @@

+

Sets merchant settings

+ + @@ -21049,13 +23546,13 @@
Parameters:

- + - - @@ -21103,79 +23596,66 @@
Properties
- + - - - + - + - - + + - + + +
NameTypeAttributesDescription
params - - -object - - - - - - <optional>
- - - - - -

query parameters

-
Properties
- - @@ -20737,7 +23307,7 @@
Properties
- + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - -
idparams.key @@ -20752,74 +23322,6 @@
Properties
- <optional>
- - - - - -

unique invoice identifier

start - - -number - - - - - - <optional>
- - - - - -

millisecond start time

end - - -number - - - - - - <optional>
- @@ -20829,20 +23331,20 @@
Properties
-

millisecond end time

Setting key. Check doc link for possible values

limitparams.value -number +string @@ -20851,8 +23353,6 @@
Properties
- <optional>
- @@ -20862,14 +23362,7 @@
Properties
-

number of records (Max 100), default 10

- -

Setting value, if null it means unset

paramsparams.settings -object +string @@ -21064,8 +23561,6 @@
Parameters:
- <optional>
- @@ -21075,7 +23570,7 @@
Parameters:
-

query parameters

+

Setting keys and values

Properties
@@ -21089,8 +23584,6 @@
Properties
TypeAttributes
pagekey -number +string - - <optional>
- - - - - -

Current page, default 1 100

Setting key. Check doc link for possible values

pageSizevalue -number +string - - <optional>
- - - - -

Setting value, if null it means unset

Number of records per page, default 10, max 100

+ + - sort + cb -string +function @@ -21195,153 +23675,164 @@
Properties
-

Sort order, default asc, accepted values are asc and desc

+

legacy callback

+ + - - - sortField - - - - -string - - - - - - <optional>
- - - - - - -

Sort field, default t, allowed values: t, amount, status

- + + + + + + + +
Returns:
+ + +
+

p

+
+ + + +
+
+ Type +
+
+ +Promise + + +
+
- - - status - - + + - -string + - - +

payRemoveCurrencyConversion(cbopt) → {Promise}

- - - - <optional>
- + - - - - - -

invoice status, allowed array item values are: -CREATED, PENDING, COMPLETED, EXPIRED

- +
+
Source:
+
+ - - - fiat - + - - - -Array.<string> + + - - + - - - - <optional>
- + - + - - - + - + -

fiat filter, should be array of strings

- + - - - crypto - + - - - -Array.<string> + + - - + +
See:
+
+ +
+ - - - - <optional>
- + +
- - - - - -

crypto filter, should be array of strings

- +
+

Remove bitfinex pay currency conversions

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + - + + - + - - - - -
NameTypeAttributesDescription
idparams.baseCcy -string +number @@ -21350,8 +23841,6 @@
Properties
- <optional>
- @@ -21361,20 +23850,20 @@
Properties
-

unique invoice identifier

Base currency that will be converted, could be bfx pay currency symbol (e.g. UST-ETH) or global api symbol (UST), result is stored as global api symbol!

orderIdparams.convertCcy -string +number @@ -21383,8 +23872,6 @@
Properties
- <optional>
- @@ -21394,14 +23881,7 @@
Properties
-

erchant order id

- - +

Currency to which base currency will be converted, could be bfx pay currency symbol (e.g. UST-ETH) or global api symbol (UST), result is stored as global api symbol!

@@ -29630,4 +32110,4 @@
Returns:
- \ No newline at end of file + diff --git a/docs/global.html b/docs/global.html index 5e44d3c..edf7e6e 100644 --- a/docs/global.html +++ b/docs/global.html @@ -29,7 +29,7 @@ -

Home

Classes

Global

+

Home

Classes

Global

@@ -578,4 +578,4 @@
Type:
- \ No newline at end of file + diff --git a/docs/index.html b/docs/index.html index 0b7a6ab..085cb6e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -29,7 +29,7 @@ -

Home

Classes

Global

+

Home

Classes

Global

@@ -137,4 +137,4 @@

nonce too small

- \ No newline at end of file + diff --git a/docs/rest1.js.html b/docs/rest1.js.html index 4148a45..8b9f5bb 100644 --- a/docs/rest1.js.html +++ b/docs/rest1.js.html @@ -29,7 +29,7 @@ -

Home

Classes

Global

+

Home

Classes

Global

diff --git a/docs/rest2.js.html b/docs/rest2.js.html index 677a8fc..a8d6763 100644 --- a/docs/rest2.js.html +++ b/docs/rest2.js.html @@ -29,7 +29,7 @@ -

Home

Classes

Global

+

Home

Classes

Global

@@ -1970,6 +1970,7 @@

rest2.js

* @param {string} [params.customerInfo.residBuildingNo] - optional, customer's residential building number/name * @param {string} params.customerInfo.fullName - customer's full name * @param {string} params.customerInfo.email - customer's email address + * @param {string} [params.customerInfo.ip] - customer's ip * @param {object} [params.meta] - metadata * @param {string} [params.meta.env] - merchant environment, allowed values: production, test, * staging, development @@ -2018,16 +2019,44 @@

rest2.js

} /** - * @param {object} params - query parameters - * @param {string} params.id - unique invoice identifier - * @param {string} params.payCcy - paid invoice currency, should be one of values under payCurrencies field - * on invoice - * @param {number} [params.depositId] - movement/deposit Id linked to invoice as payment - * @param {number} [params.ledgerId] - ledger entry Id linked to invoice as payment, use either depositId - * or ledgerId + * @param {object} [params] - query parameters + * @param {string} [params.status] - invoice status, allowed array item values are: + * CREATED, PENDING, COMPLETED, EXPIRED + * @param {string} [params.format] - Aggregation format, allowed values: D - today's, W - this week, M - this month, Y - this year, A - all * @param {Function} [cb] - legacy callback * @returns {Promise} p - * @see https://docs.bitfinex.com/reference#complete-invoice + * @see https://docs.bitfinex.com/reference/invoice-count-stats + */ + payInvoiceCountstats (params = {}, cb = null) { + return this._makeAuthRequest('/auth/r/ext/pay/invoice/stats/count', params, cb) + } + + /** + * Stats related to earnings during different intervals + * @param {object} [params] - query parameters + * @param {string} [params.currency] - Currency on which earnings will be calculated + * CREATED, PENDING, COMPLETED, EXPIRED + * @param {string} [params.format] - Aggregation format, allowed values: D - today's, W - this week, M - this month, Y - this year, A - all + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference/invoice-earning-stats + */ + payInvoiceStatsEarning (params = {}, cb = null) { + return this._makeAuthRequest('/auth/r/ext/pay/invoice/stats/earning', params, cb) + } + + /** + * @param {object} params - query parameters + * @param {string} params.id - unique invoice identifier + * @param {string} params.payCcy - paid invoice currency, should be one of values under payCurrencies field + * on invoice + * @param {number} [params.depositId] - movement/deposit Id linked to invoice as payment + * @param {number[]} [params.depositIds] - movement/deposit ids list linked to invoice as payment + * @param {number} [params.ledgerId] - ledger entry Id linked to invoice as payment, use either depositId + * or ledgerId + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference/complete-invoice */ payInvoiceComplete (params, cb = null) { return this._makeAuthRequest('/auth/w/ext/pay/invoice/complete', params, cb) @@ -2044,6 +2073,99 @@

rest2.js

return this._makeAuthRequest('/auth/w/ext/pay/invoice/expire', params, cb) } + /** + * List bitfinex pay currency conversions + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference/conversion-list + */ + payCurrencyConversionList (cb = null) { + return this._makeAuthRequest('/auth/r/ext/pay/settings/convert/list', params, cb) + } + + /** + * Add bitfinex pay currency conversions + * @param {number} params.baseCcy - Base currency that will be converted, could be bfx pay currency symbol (e.g. UST-ETH) or global api symbol (UST), result is stored as global api symbol! + * @param {number} params.convertCcy - Currency to which base currency will be converted, could be bfx pay currency symbol (e.g. UST-ETH) or global api symbol (UST), result is stored as global api symbol! + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference/add-conversion + */ + payAddCurrencyConversion (cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/settings/convert/create', params, cb) + } + + /** + * Remove bitfinex pay currency conversions + * @param {number} params.baseCcy - Base currency that will be converted, could be bfx pay currency symbol (e.g. UST-ETH) or global api symbol (UST), result is stored as global api symbol! + * @param {number} params.convertCcy - Currency to which base currency will be converted, could be bfx pay currency symbol (e.g. UST-ETH) or global api symbol (UST), result is stored as global api symbol! + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference/remove-conversion + */ + payRemoveCurrencyConversion (cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/settings/convert/create', params, cb) + } + + /** + * Returns the daily limits for merchant + * @param {string[]} [params.customerEmails] - Optional, customer emails for e-commerce usage + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference/merchant-limits + */ + payMerchantDailyLimit (cb = null) { + return this._makeAuthRequest('/auth/r/ext/pay/settings/daily/limit', params, cb) + } + + /** + * Sets merchant settings + * @param {string} params.key - Setting key. Check doc link for possible values + * @param {string} params.value - Setting value, if null it means unset + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference/merchant-settings-write + */ + payMerchantSettingsWrite (cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/settings/set', params, cb) + } + + /** + * Sets merchant settings + * @param {string} params.settings - Setting keys and values + * @param {string} params.settings[].key - Setting key. Check doc link for possible values + * @param {string} params.settings[].value - Setting value, if null it means unset + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference/merchant-settings-write-batch + */ + payMerchantSettingsWriteBatch (cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/settings/set/batch', params, cb) + } + + /** + * Reads merchant settings + * @param {string} params.key - Setting key. Check doc link for possible values + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference/merchant-settings-read + */ + payMerchantSettingsRead (cb = null) { + return this._makeAuthRequest('/auth/r/ext/pay/settings/get', params, cb) + } + + /** + * Reads multiple merchant settings + * @param {string[]} params.keys - Setting keys, if empty array all settings will be returned + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference/merchant-settings-list + */ + payMerchantSettingsList (cb = null) { + return this._makeAuthRequest('/auth/r/ext/pay/settings/list', params, cb) + } + + /** * @param {object} params - query parameters * @param {string} params.ccy - pay currency to search deposits for diff --git a/lib/rest2.js b/lib/rest2.js index 0dabe4d..32d71c9 100644 --- a/lib/rest2.js +++ b/lib/rest2.js @@ -1924,6 +1924,7 @@ class RESTv2 { * @param {string} [params.customerInfo.residBuildingNo] - optional, customer's residential building number/name * @param {string} params.customerInfo.fullName - customer's full name * @param {string} params.customerInfo.email - customer's email address + * @param {string} [params.customerInfo.ip] - customer's ip * @param {object} [params.meta] - metadata * @param {string} [params.meta.env] - merchant environment, allowed values: production, test, * staging, development @@ -1972,16 +1973,44 @@ class RESTv2 { } /** - * @param {object} params - query parameters - * @param {string} params.id - unique invoice identifier - * @param {string} params.payCcy - paid invoice currency, should be one of values under payCurrencies field - * on invoice - * @param {number} [params.depositId] - movement/deposit Id linked to invoice as payment - * @param {number} [params.ledgerId] - ledger entry Id linked to invoice as payment, use either depositId - * or ledgerId + * @param {object} [params] - query parameters + * @param {string} [params.status] - invoice status, allowed array item values are: + * CREATED, PENDING, COMPLETED, EXPIRED + * @param {string} [params.format] - Aggregation format, allowed values: D - today's, W - this week, M - this month, Y - this year, A - all * @param {Function} [cb] - legacy callback * @returns {Promise} p - * @see https://docs.bitfinex.com/reference#complete-invoice + * @see https://docs.bitfinex.com/reference/invoice-count-stats + */ + payInvoiceCountstats (params = {}, cb = null) { + return this._makeAuthRequest('/auth/r/ext/pay/invoice/stats/count', params, cb) + } + + /** + * Stats related to earnings during different intervals + * @param {object} [params] - query parameters + * @param {string} [params.currency] - Currency on which earnings will be calculated + * CREATED, PENDING, COMPLETED, EXPIRED + * @param {string} [params.format] - Aggregation format, allowed values: D - today's, W - this week, M - this month, Y - this year, A - all + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference/invoice-earning-stats + */ + payInvoiceStatsEarning (params = {}, cb = null) { + return this._makeAuthRequest('/auth/r/ext/pay/invoice/stats/earning', params, cb) + } + + /** + * @param {object} params - query parameters + * @param {string} params.id - unique invoice identifier + * @param {string} params.payCcy - paid invoice currency, should be one of values under payCurrencies field + * on invoice + * @param {number} [params.depositId] - movement/deposit Id linked to invoice as payment + * @param {number[]} [params.depositIds] - movement/deposit ids list linked to invoice as payment + * @param {number} [params.ledgerId] - ledger entry Id linked to invoice as payment, use either depositId + * or ledgerId + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference/complete-invoice */ payInvoiceComplete (params, cb = null) { return this._makeAuthRequest('/auth/w/ext/pay/invoice/complete', params, cb) @@ -1998,6 +2027,98 @@ class RESTv2 { return this._makeAuthRequest('/auth/w/ext/pay/invoice/expire', params, cb) } + /** + * List bitfinex pay currency conversions + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference/conversion-list + */ + payCurrencyConversionList (cb = null) { + return this._makeAuthRequest('/auth/r/ext/pay/settings/convert/list', {}, cb) + } + + /** + * Add bitfinex pay currency conversions + * @param {number} params.baseCcy - Base currency that will be converted, could be bfx pay currency symbol (e.g. UST-ETH) or global api symbol (UST), result is stored as global api symbol! + * @param {number} params.convertCcy - Currency to which base currency will be converted, could be bfx pay currency symbol (e.g. UST-ETH) or global api symbol (UST), result is stored as global api symbol! + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference/add-conversion + */ + payAddCurrencyConversion (params, cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/settings/convert/create', params, cb) + } + + /** + * Remove bitfinex pay currency conversions + * @param {number} params.baseCcy - Base currency that will be converted, could be bfx pay currency symbol (e.g. UST-ETH) or global api symbol (UST), result is stored as global api symbol! + * @param {number} params.convertCcy - Currency to which base currency will be converted, could be bfx pay currency symbol (e.g. UST-ETH) or global api symbol (UST), result is stored as global api symbol! + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference/remove-conversion + */ + payRemoveCurrencyConversion (params, cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/settings/convert/create', params, cb) + } + + /** + * Returns the daily limits for merchant + * @param {string[]} [params.customerEmails] - Optional, customer emails for e-commerce usage + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference/merchant-limits + */ + payMerchantDailyLimit (params, cb = null) { + return this._makeAuthRequest('/auth/r/ext/pay/settings/daily/limit', params, cb) + } + + /** + * Sets merchant settings + * @param {string} params.key - Setting key. Check doc link for possible values + * @param {string} params.value - Setting value, if null it means unset + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference/merchant-settings-write + */ + payMerchantSettingsWrite (params, cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/settings/set', params, cb) + } + + /** + * Sets merchant settings + * @param {string} params.settings - Setting keys and values + * @param {string} params.settings[].key - Setting key. Check doc link for possible values + * @param {string} params.settings[].value - Setting value, if null it means unset + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference/merchant-settings-write-batch + */ + payMerchantSettingsWriteBatch (params, cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/settings/set/batch', params, cb) + } + + /** + * Reads merchant settings + * @param {string} params.key - Setting key. Check doc link for possible values + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference/merchant-settings-read + */ + payMerchantSettingsRead (params, cb = null) { + return this._makeAuthRequest('/auth/r/ext/pay/settings/get', params, cb) + } + + /** + * Reads multiple merchant settings + * @param {string[]} params.keys - Setting keys, if empty array all settings will be returned + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference/merchant-settings-list + */ + payMerchantSettingsList (params, cb = null) { + return this._makeAuthRequest('/auth/r/ext/pay/settings/list', params, cb) + } + /** * @param {object} params - query parameters * @param {string} params.ccy - pay currency to search deposits for diff --git a/package.json b/package.json index 6e2625e..2251876 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "Paolo Ardoino (https://www.bitfinex.com)", "Jacob Plaster (https://www.bitfinex.com)", "Abhishek Shrestha (https://www.bitfinex.com)", - "Vigan Abdurrahmani (https://www.bitfinex.com)" + "Vigan Abdurrahmani (https://www.bitfinex.com)", + "Sergio López (https://www.bitfinex.com)" ], "license": "MIT", "bugs": { From 9abc1188e314d88f17fe9d9a2589a21233e54e80 Mon Sep 17 00:00:00 2001 From: Sergio LR Date: Wed, 10 May 2023 16:21:58 +0200 Subject: [PATCH 02/18] refactor: fix payInvoiceCountStats case typo --- lib/rest2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rest2.js b/lib/rest2.js index 32d71c9..d3ff216 100644 --- a/lib/rest2.js +++ b/lib/rest2.js @@ -1981,7 +1981,7 @@ class RESTv2 { * @returns {Promise} p * @see https://docs.bitfinex.com/reference/invoice-count-stats */ - payInvoiceCountstats (params = {}, cb = null) { + payInvoiceCountStats (params = {}, cb = null) { return this._makeAuthRequest('/auth/r/ext/pay/invoice/stats/count', params, cb) } From 144cc27f7d2005be88557c9f514f2a3aa9aca308 Mon Sep 17 00:00:00 2001 From: Sergio LR Date: Wed, 10 May 2023 16:25:29 +0200 Subject: [PATCH 03/18] chore: update change log --- CHANGELOG | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index b735b8b..e37c16a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,13 @@ +# 5.1.2 +- RESTv2: add payCurrencyConversionList method +- RESTv2: add payAddCurrencyConversion method +- RESTv2: add payRemoveCurrencyConversion method +- RESTv2: add payMerchantDailyLimit method +- RESTv2: add payMerchantSettingsWrite method +- RESTv2: add payMerchantSettingsWriteBatch method +- RESTv2: add payMerchantSettingsRead method +- RESTv2: add payMerchantSettingsList method + # 5.1.1 - dep: upgraded bfx-api-node-models to 1.7.1 for compatibility From d2e914a843c1b2a7b6d453c18a5a227fc5b8b2fc Mon Sep 17 00:00:00 2001 From: Sergio LR Date: Thu, 11 May 2023 13:39:15 +0200 Subject: [PATCH 04/18] test: add rest2 integration test --- test/lib/rest-2-integration.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/lib/rest-2-integration.js b/test/lib/rest-2-integration.js index b69f92a..83d5c17 100644 --- a/test/lib/rest-2-integration.js +++ b/test/lib/rest-2-integration.js @@ -156,6 +156,14 @@ describe('RESTv2 integration (mock server) tests', () => { ['payInvoiceCreate', 'invoice_submit', [{}]], ['payInvoiceList', 'invoice_list', [{}]], ['payInvoiceComplete', 'invoice_complete', [{}]], + ['payCurrencyConversionList', 'pay_settings_convert_list', []], + ['payAddCurrencyConversion', 'pay_settings_convert_create', []], + ['payRemoveCurrencyConversion', 'pay_settings_convert_remove', []], + ['payMerchantDailyLimit', 'pay_settings_daily_limit', []], + ['payMerchantSettingsWrite', 'pay_settings_set', []], + ['payMerchantSettingsWriteBatch', 'pay_settings_set_batch', []], + ['payMerchantSettingsRead', 'pay_settings_get', []], + ['payMerchantSettingsList', 'pay_settings_list', []], ['getCoreSettings', 'core_settings', [[]]], ['invalidateAuthToken', 'delete_token', [[]]], ['payDepositsUnlinked', 'deposits_unlinked', [{}]], From 222ff56569427df4aded404aa7d3cfaa780d77f2 Mon Sep 17 00:00:00 2001 From: Sergio LR Date: Tue, 16 May 2023 13:45:12 +0200 Subject: [PATCH 05/18] fix: integration tests + payRemoveCurrencyConversion method invocation --- lib/rest2.js | 2 +- test/lib/rest-2-integration.js | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/rest2.js b/lib/rest2.js index d3ff216..61d5fbe 100644 --- a/lib/rest2.js +++ b/lib/rest2.js @@ -2058,7 +2058,7 @@ class RESTv2 { * @see https://docs.bitfinex.com/reference/remove-conversion */ payRemoveCurrencyConversion (params, cb = null) { - return this._makeAuthRequest('/auth/w/ext/pay/settings/convert/create', params, cb) + return this._makeAuthRequest('/auth/w/ext/pay/settings/convert/remove', params, cb) } /** diff --git a/test/lib/rest-2-integration.js b/test/lib/rest-2-integration.js index 83d5c17..8e8682e 100644 --- a/test/lib/rest-2-integration.js +++ b/test/lib/rest-2-integration.js @@ -157,15 +157,15 @@ describe('RESTv2 integration (mock server) tests', () => { ['payInvoiceList', 'invoice_list', [{}]], ['payInvoiceComplete', 'invoice_complete', [{}]], ['payCurrencyConversionList', 'pay_settings_convert_list', []], - ['payAddCurrencyConversion', 'pay_settings_convert_create', []], - ['payRemoveCurrencyConversion', 'pay_settings_convert_remove', []], - ['payMerchantDailyLimit', 'pay_settings_daily_limit', []], - ['payMerchantSettingsWrite', 'pay_settings_set', []], - ['payMerchantSettingsWriteBatch', 'pay_settings_set_batch', []], - ['payMerchantSettingsRead', 'pay_settings_get', []], - ['payMerchantSettingsList', 'pay_settings_list', []], - ['getCoreSettings', 'core_settings', [[]]], - ['invalidateAuthToken', 'delete_token', [[]]], + ['payAddCurrencyConversion', 'pay_settings_convert_create', [{}]], + ['payRemoveCurrencyConversion', 'pay_settings_convert_remove', [{}]], + ['payMerchantDailyLimit', 'pay_settings_daily_limit', [{}]], + ['payMerchantSettingsWrite', 'pay_settings_set', [{}]], + ['payMerchantSettingsWriteBatch', 'pay_settings_set_batch', [{}]], + ['payMerchantSettingsRead', 'pay_settings_get', [{}]], + ['payMerchantSettingsList', 'pay_settings_list', [{}]], + ['getCoreSettings', 'core_settings', [[{}]]], + ['invalidateAuthToken', 'delete_token', [[{}]]], ['payDepositsUnlinked', 'deposits_unlinked', [{}]], ['movementInfo', 'movement_info.id', [{ id: 'id' }]] ] From 163ee9f75026976dd5adc62c029cab5968d3ddb2 Mon Sep 17 00:00:00 2001 From: Sergio LR Date: Thu, 8 Jun 2023 12:07:59 +0200 Subject: [PATCH 06/18] chore: update version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2251876..2a60cd3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bfx-api-node-rest", - "version": "5.1.1", + "version": "5.1.2", "description": "Official Bitfinex REST v1 & v2 API interfaces", "engines": { "node": ">=8.3.0" From e3b167ad5a1660a712872c53e1881ed054bb53bf Mon Sep 17 00:00:00 2001 From: Sergio LR Date: Thu, 8 Jun 2023 12:08:36 +0200 Subject: [PATCH 07/18] doc: update docs --- docs/RESTv1.html | 6 +++--- docs/RESTv2.html | 12 ++++++------ docs/global.html | 6 +++--- docs/index.html | 6 +++--- docs/rest1.js.html | 4 ++-- docs/rest2.js.html | 25 ++++++++++++------------- 6 files changed, 29 insertions(+), 30 deletions(-) diff --git a/docs/RESTv1.html b/docs/RESTv1.html index 30997f0..44783ad 100644 --- a/docs/RESTv1.html +++ b/docs/RESTv1.html @@ -29,7 +29,7 @@ -

Home

Classes

Global

+

Home

Classes

Global

@@ -6784,7 +6784,7 @@
Parameters:

- Documentation generated by JSDoc 3.6.11 on Fri Jun 02 2023 10:04:44 GMT+0200 (Central European Summer Time) using the docdash theme. + Documentation generated by JSDoc 3.6.11 on Thu Jun 08 2023 12:08:20 GMT+0200 (hora de verano de Europa central) using the docdash theme.
@@ -6796,4 +6796,4 @@
Parameters:
- + \ No newline at end of file diff --git a/docs/RESTv2.html b/docs/RESTv2.html index d983804..ea33382 100644 --- a/docs/RESTv2.html +++ b/docs/RESTv2.html @@ -29,7 +29,7 @@ -

Home

Classes

Global

+

Home

Classes

Global

@@ -18743,7 +18743,7 @@

payDeposit
Source:
@@ -19143,7 +19143,7 @@

pa
Source:
@@ -19858,7 +19858,7 @@

Returns:
-

payInvoiceCountstats(paramsopt, cbopt) → {Promise}

+

payInvoiceCountStats(paramsopt, cbopt) → {Promise}

@@ -32098,7 +32098,7 @@
Returns:

- Documentation generated by JSDoc 3.6.11 on Fri Jun 02 2023 10:04:44 GMT+0200 (Central European Summer Time) using the docdash theme. + Documentation generated by JSDoc 3.6.11 on Thu Jun 08 2023 12:08:20 GMT+0200 (hora de verano de Europa central) using the docdash theme.
@@ -32110,4 +32110,4 @@
Returns:
- + \ No newline at end of file diff --git a/docs/global.html b/docs/global.html index edf7e6e..21f1b13 100644 --- a/docs/global.html +++ b/docs/global.html @@ -29,7 +29,7 @@ -

Home

Classes

Global

+

Home

Classes

Global

@@ -566,7 +566,7 @@
Type:

- Documentation generated by JSDoc 3.6.11 on Fri Jun 02 2023 10:04:44 GMT+0200 (Central European Summer Time) using the docdash theme. + Documentation generated by JSDoc 3.6.11 on Thu Jun 08 2023 12:08:20 GMT+0200 (hora de verano de Europa central) using the docdash theme.
@@ -578,4 +578,4 @@
Type:
- + \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 085cb6e..10b9ceb 100644 --- a/docs/index.html +++ b/docs/index.html @@ -29,7 +29,7 @@ -

Home

Classes

Global

+

Home

Classes

Global

@@ -125,7 +125,7 @@

nonce too small


- Documentation generated by JSDoc 3.6.11 on Fri Jun 02 2023 10:04:44 GMT+0200 (Central European Summer Time) using the docdash theme. + Documentation generated by JSDoc 3.6.11 on Thu Jun 08 2023 12:08:20 GMT+0200 (hora de verano de Europa central) using the docdash theme.
@@ -137,4 +137,4 @@

nonce too small

- + \ No newline at end of file diff --git a/docs/rest1.js.html b/docs/rest1.js.html index 8b9f5bb..de50451 100644 --- a/docs/rest1.js.html +++ b/docs/rest1.js.html @@ -29,7 +29,7 @@ -

Home

Classes

Global

+

Home

Classes

Global

@@ -662,7 +662,7 @@

rest1.js


- Documentation generated by JSDoc 3.6.11 on Fri Jun 02 2023 10:04:44 GMT+0200 (Central European Summer Time) using the docdash theme. + Documentation generated by JSDoc 3.6.11 on Thu Jun 08 2023 12:08:20 GMT+0200 (hora de verano de Europa central) using the docdash theme.
diff --git a/docs/rest2.js.html b/docs/rest2.js.html index a8d6763..439d4db 100644 --- a/docs/rest2.js.html +++ b/docs/rest2.js.html @@ -29,7 +29,7 @@ -

Home

Classes

Global

+

Home

Classes

Global

@@ -2027,7 +2027,7 @@

rest2.js

* @returns {Promise} p * @see https://docs.bitfinex.com/reference/invoice-count-stats */ - payInvoiceCountstats (params = {}, cb = null) { + payInvoiceCountStats (params = {}, cb = null) { return this._makeAuthRequest('/auth/r/ext/pay/invoice/stats/count', params, cb) } @@ -2080,7 +2080,7 @@

rest2.js

* @see https://docs.bitfinex.com/reference/conversion-list */ payCurrencyConversionList (cb = null) { - return this._makeAuthRequest('/auth/r/ext/pay/settings/convert/list', params, cb) + return this._makeAuthRequest('/auth/r/ext/pay/settings/convert/list', {}, cb) } /** @@ -2091,7 +2091,7 @@

rest2.js

* @returns {Promise} p * @see https://docs.bitfinex.com/reference/add-conversion */ - payAddCurrencyConversion (cb = null) { + payAddCurrencyConversion (params, cb = null) { return this._makeAuthRequest('/auth/w/ext/pay/settings/convert/create', params, cb) } @@ -2103,8 +2103,8 @@

rest2.js

* @returns {Promise} p * @see https://docs.bitfinex.com/reference/remove-conversion */ - payRemoveCurrencyConversion (cb = null) { - return this._makeAuthRequest('/auth/w/ext/pay/settings/convert/create', params, cb) + payRemoveCurrencyConversion (params, cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/settings/convert/remove', params, cb) } /** @@ -2114,7 +2114,7 @@

rest2.js

* @returns {Promise} p * @see https://docs.bitfinex.com/reference/merchant-limits */ - payMerchantDailyLimit (cb = null) { + payMerchantDailyLimit (params, cb = null) { return this._makeAuthRequest('/auth/r/ext/pay/settings/daily/limit', params, cb) } @@ -2126,7 +2126,7 @@

rest2.js

* @returns {Promise} p * @see https://docs.bitfinex.com/reference/merchant-settings-write */ - payMerchantSettingsWrite (cb = null) { + payMerchantSettingsWrite (params, cb = null) { return this._makeAuthRequest('/auth/w/ext/pay/settings/set', params, cb) } @@ -2139,7 +2139,7 @@

rest2.js

* @returns {Promise} p * @see https://docs.bitfinex.com/reference/merchant-settings-write-batch */ - payMerchantSettingsWriteBatch (cb = null) { + payMerchantSettingsWriteBatch (params, cb = null) { return this._makeAuthRequest('/auth/w/ext/pay/settings/set/batch', params, cb) } @@ -2150,7 +2150,7 @@

rest2.js

* @returns {Promise} p * @see https://docs.bitfinex.com/reference/merchant-settings-read */ - payMerchantSettingsRead (cb = null) { + payMerchantSettingsRead (params, cb = null) { return this._makeAuthRequest('/auth/r/ext/pay/settings/get', params, cb) } @@ -2161,11 +2161,10 @@

rest2.js

* @returns {Promise} p * @see https://docs.bitfinex.com/reference/merchant-settings-list */ - payMerchantSettingsList (cb = null) { + payMerchantSettingsList (params, cb = null) { return this._makeAuthRequest('/auth/r/ext/pay/settings/list', params, cb) } - /** * @param {object} params - query parameters * @param {string} params.ccy - pay currency to search deposits for @@ -2216,7 +2215,7 @@

rest2.js


- Documentation generated by JSDoc 3.6.11 on Fri Jun 02 2023 10:04:44 GMT+0200 (Central European Summer Time) using the docdash theme. + Documentation generated by JSDoc 3.6.11 on Thu Jun 08 2023 12:08:20 GMT+0200 (hora de verano de Europa central) using the docdash theme.
From c620ae9f6c688b08dd443890f100ad8d613bef49 Mon Sep 17 00:00:00 2001 From: Sergio LR Date: Mon, 12 Jun 2023 13:43:51 +0200 Subject: [PATCH 08/18] feat: added more endpoints --- lib/rest2.js | 207 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 207 insertions(+) diff --git a/lib/rest2.js b/lib/rest2.js index 61d5fbe..10b1088 100644 --- a/lib/rest2.js +++ b/lib/rest2.js @@ -1938,6 +1938,138 @@ class RESTv2 { return this._makeAuthRequest('/auth/w/ext/pay/invoice/create', params, cb) } + /** + * @param {object} params - invoice parameters + * @param {string} params.amount - invoice amount in currency + * @param {string} params.currency - invoice currency + * @param {string[]} params.payCurrencies - currencies in which invoice accepts the payments + * @param {number} [params.duration] - optional, invoice expire time in seconds, minimal duration + * is 5 mins and maximal duration is 3 days. + * Default value is 15 minutes + * @param {string} params.orderId - reference order identifier in merchant's platform + * @param {string} [params.webhook] - the endpoint that will be called once the payment is + * completed or expired + * @param {string} [params.redirectUrl] - merchant redirect URL, this one is used in UI to redirect + * @param {object} [params.meta] - metadata + * @param {string} [params.meta.env] - merchant environment, allowed values: production, test, + * staging, development + * @param {string[]} [params.meta.tags] - invoice tags, max number of tags is 5 and max length of + * tag is 5 characters + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + */ + payInvoiceCreatePos (params, cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/invoice/create/pos', params, cb) + } + + + /** + * @param {Array} param - The parameter value. + * @param {number} param[0] - The number value. + * @param {Object} param[1] - An object containing the following properties: + * @param {Object} param[1].id - The id property. + * @param {Object} param[1].fields.customerInfo.tosAccepted - TOS Accepted by customer + * @param {Object} param[1].privateNote - Private note + * + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference#submit-invoice + */ + payPublicInvoiceUpdate (params, cb = null) { + return this._makeAuthRequest('/auth/ext/pay/invoice/update', params, cb) + } + + /** + * @param {Array} param - The parameter value. + * @param {number} param[0] - The number value. + * @param {Object} param[1] - An object containing the following properties: + * @param {Object} param[1].id - The id property. + * @param {Object} param[1].fields.customerInfo.tosAccepted - TOS Accepted by customer + * @param {Object} param[1].privateNote - Private note + * + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + * @see https://docs.bitfinex.com/reference#submit-invoice + */ + payInvoiceUpdate (params, cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/invoice/update', params, cb) + } + + + /** + * @param {object} params - regenerate parameters + * @param {string} params.id - invoice id + * @param {string} params.ccy - invoice currency to be regenerated + * @param {string} params.remoteIp - remote ip used to lock the regeneration + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + */ + payInvoiceRegenerate (params, cb = null) { + return this._makeAuthRequest('/ext/pay/invoice/regenerate', params, cb) + } + + /** + * @param {object} params - Feedback object + * @param {boolean} params.detailed - Invoice id + * @param {number} params.score - Rating, 1-5 + * @param {string} params.comment - Feedback comment + * @param {string} params.remoteIp - Remote ip used to lock the regeneration + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + */ + payInvoiceFeedback (params, cb = null) { + return this._makeAuthRequest('/ext/pay/invoice/feedback', params, cb) + } + + /** + * @param {object} params - Feedback object + * @param {boolean} params.detailed - invoice id + * @param {number} params.score - Rating, 1-5 + * @param {string} params.category - Feedback category + * @param {string} params.comment - Feedback comment + * @param {string} params.remoteIp - Remote ip used to lock the regeneration + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + */ + payMerchantFeedback (params, cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/merchant/feedback', params, cb) + } + + + + /** + * @param {object} params - list of feedbacks + * @param {boolean} params.detailed - detailed + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + */ + payPublicInvoiceCurrencyDetailed (params, cb = null) { + return this._makeAuthRequest('/ext/pay/invoice/currency/detailed', params, cb) + } + + /** + * @param {object} params - list of feedbacks + * @param {boolean} params.detailed - detailed + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + */ + payInvoiceCurrencyDetailed (params, cb = null) { + return this._makeAuthRequest('/auth/r/ext/pay/currency/detailed', params, cb) + } + + + + /** + * @param {object} parameters - list of feedbacks + * @param {boolean} params.detailed - detailed + * @param {string?} params.id - invoice id + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + */ + payInvoiceCurrencyList (params, cb = null) { + return this._makeAuthRequest('/auth/r/ext/pay/currency/list', params, cb) + } + /** * @param {object} [params] - query parameters * @param {string} [params.id] - unique invoice identifier @@ -1999,6 +2131,52 @@ class RESTv2 { return this._makeAuthRequest('/auth/r/ext/pay/invoice/stats/earning', params, cb) } + /** + * @param {object} [params] - query parameters + * @param {string} [params.id] - invoice id of which events will be returned + * + * @returns {Promise} p + */ + payInvoiceEvents (params = {}, cb = null) { + return this._makeAuthRequest('/auth/r/ext/pay/invoice/events', params, cb) + } + + /** + * @param {object} [params] - query parameters + * @param {string} [params.id] - invoice id to be paid + * @param {string} [params.ccy] - desired currency to pay invoice + * + * @returns {Promise} p + */ + payInvoicePayInstant (params = {}, cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/instant', params, cb) + } + + /** + * @param {object} [params] - query parameters + * @param {string} [params.type] - type of image being uploaded, accepts: 'LOGO' + * @param {string} [params.image] - base64 string with the image data. e.g. data:image/png;base64,iVBORw****77uJgylyzjb2gbtz79m9d= + * + * @returns {Promise} p + */ + payUploadImage (params = {}, cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/upload/image', params, cb) + } + + /** + * @param {object} [params] - query parameters + * @param {string} params.id - invoice id + * @param {string} params.ccy - payment currency + * @param {string} params.remoteIp - remote ip + * + * @returns {Promise} p + */ + payCreditCardRates (params = {}, cb = null) { + return this._makeAuthRequest('/auth/r/ext/pay/credit-card/rates', params, cb) + } + + + /** * @param {object} params - query parameters * @param {string} params.id - unique invoice identifier @@ -2016,6 +2194,35 @@ class RESTv2 { return this._makeAuthRequest('/auth/w/ext/pay/invoice/complete', params, cb) } + /** + * @param {object} params - query parameters + * @param {string} params.id - unique invoice identifier + * @param {string} params.ccy - currency to be refunded + * @param {string} params.amount - amount to be refunded + * @param {object} params.address - address of refund + * @param {object} params.address.address - address of the wallet + * @param {object} params.address.payment_id - tag memo + + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + */ + payRefundInvoice (params, cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/invoice/refund', params, cb) + } + + /** + * @param {object} params - query parameters + * @param {string} params.id - unique invoice identifier + * @param {string} params.refundId - id of the refund + + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + */ + payInvoiceMarkRefunded (params, cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/invoice/mark/refunded', params, cb) + } + + /** * @param {object} params - query parameters * @param {string} params.id - unique invoice identifier From ab1b835a707944212affb111e3f7be2e68d9abe9 Mon Sep 17 00:00:00 2001 From: Sergio LR Date: Mon, 12 Jun 2023 13:46:06 +0200 Subject: [PATCH 09/18] style: remove lines --- lib/rest2.js | 51 +++++++++++++++++++++------------------------------ 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/lib/rest2.js b/lib/rest2.js index 10b1088..0a94558 100644 --- a/lib/rest2.js +++ b/lib/rest2.js @@ -1938,7 +1938,7 @@ class RESTv2 { return this._makeAuthRequest('/auth/w/ext/pay/invoice/create', params, cb) } - /** + /** * @param {object} params - invoice parameters * @param {string} params.amount - invoice amount in currency * @param {string} params.currency - invoice currency @@ -1949,7 +1949,7 @@ class RESTv2 { * @param {string} params.orderId - reference order identifier in merchant's platform * @param {string} [params.webhook] - the endpoint that will be called once the payment is * completed or expired - * @param {string} [params.redirectUrl] - merchant redirect URL, this one is used in UI to redirect + * @param {string} [params.redirectUrl] - merchant redirect URL, this one is used in UI to redirect * @param {object} [params.meta] - metadata * @param {string} [params.meta.env] - merchant environment, allowed values: production, test, * staging, development @@ -1958,10 +1958,9 @@ class RESTv2 { * @param {Function} [cb] - legacy callback * @returns {Promise} p */ - payInvoiceCreatePos (params, cb = null) { - return this._makeAuthRequest('/auth/w/ext/pay/invoice/create/pos', params, cb) - } - + payInvoiceCreatePos (params, cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/invoice/create/pos', params, cb) + } /** * @param {Array} param - The parameter value. @@ -1970,7 +1969,7 @@ class RESTv2 { * @param {Object} param[1].id - The id property. * @param {Object} param[1].fields.customerInfo.tosAccepted - TOS Accepted by customer * @param {Object} param[1].privateNote - Private note - * + * * @param {Function} [cb] - legacy callback * @returns {Promise} p * @see https://docs.bitfinex.com/reference#submit-invoice @@ -1986,7 +1985,7 @@ class RESTv2 { * @param {Object} param[1].id - The id property. * @param {Object} param[1].fields.customerInfo.tosAccepted - TOS Accepted by customer * @param {Object} param[1].privateNote - Private note - * + * * @param {Function} [cb] - legacy callback * @returns {Promise} p * @see https://docs.bitfinex.com/reference#submit-invoice @@ -1994,7 +1993,6 @@ class RESTv2 { payInvoiceUpdate (params, cb = null) { return this._makeAuthRequest('/auth/w/ext/pay/invoice/update', params, cb) } - /** * @param {object} params - regenerate parameters @@ -2035,8 +2033,6 @@ class RESTv2 { return this._makeAuthRequest('/auth/w/ext/pay/merchant/feedback', params, cb) } - - /** * @param {object} params - list of feedbacks * @param {boolean} params.detailed - detailed @@ -2045,7 +2041,7 @@ class RESTv2 { */ payPublicInvoiceCurrencyDetailed (params, cb = null) { return this._makeAuthRequest('/ext/pay/invoice/currency/detailed', params, cb) - } + } /** * @param {object} params - list of feedbacks @@ -2055,18 +2051,16 @@ class RESTv2 { */ payInvoiceCurrencyDetailed (params, cb = null) { return this._makeAuthRequest('/auth/r/ext/pay/currency/detailed', params, cb) - } - - + } - /** + /** * @param {object} parameters - list of feedbacks * @param {boolean} params.detailed - detailed * @param {string?} params.id - invoice id * @param {Function} [cb] - legacy callback * @returns {Promise} p */ - payInvoiceCurrencyList (params, cb = null) { + payInvoiceCurrencyList (params, cb = null) { return this._makeAuthRequest('/auth/r/ext/pay/currency/list', params, cb) } @@ -2134,7 +2128,7 @@ class RESTv2 { /** * @param {object} [params] - query parameters * @param {string} [params.id] - invoice id of which events will be returned - * + * * @returns {Promise} p */ payInvoiceEvents (params = {}, cb = null) { @@ -2145,7 +2139,7 @@ class RESTv2 { * @param {object} [params] - query parameters * @param {string} [params.id] - invoice id to be paid * @param {string} [params.ccy] - desired currency to pay invoice - * + * * @returns {Promise} p */ payInvoicePayInstant (params = {}, cb = null) { @@ -2156,27 +2150,25 @@ class RESTv2 { * @param {object} [params] - query parameters * @param {string} [params.type] - type of image being uploaded, accepts: 'LOGO' * @param {string} [params.image] - base64 string with the image data. e.g. data:image/png;base64,iVBORw****77uJgylyzjb2gbtz79m9d= - * + * * @returns {Promise} p */ payUploadImage (params = {}, cb = null) { return this._makeAuthRequest('/auth/w/ext/pay/upload/image', params, cb) } - /** + /** * @param {object} [params] - query parameters * @param {string} params.id - invoice id * @param {string} params.ccy - payment currency * @param {string} params.remoteIp - remote ip - * + * * @returns {Promise} p */ - payCreditCardRates (params = {}, cb = null) { + payCreditCardRates (params = {}, cb = null) { return this._makeAuthRequest('/auth/r/ext/pay/credit-card/rates', params, cb) } - - /** * @param {object} params - query parameters * @param {string} params.id - unique invoice identifier @@ -2210,7 +2202,7 @@ class RESTv2 { return this._makeAuthRequest('/auth/w/ext/pay/invoice/refund', params, cb) } - /** + /** * @param {object} params - query parameters * @param {string} params.id - unique invoice identifier * @param {string} params.refundId - id of the refund @@ -2218,11 +2210,10 @@ class RESTv2 { * @param {Function} [cb] - legacy callback * @returns {Promise} p */ - payInvoiceMarkRefunded (params, cb = null) { - return this._makeAuthRequest('/auth/w/ext/pay/invoice/mark/refunded', params, cb) - } + payInvoiceMarkRefunded (params, cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/invoice/mark/refunded', params, cb) + } - /** * @param {object} params - query parameters * @param {string} params.id - unique invoice identifier From d4abe2b2e6ecfc1c00d4fb95d135e8f4ff1d0020 Mon Sep 17 00:00:00 2001 From: Sergio LR Date: Mon, 12 Jun 2023 18:17:48 +0200 Subject: [PATCH 10/18] test: add e2e test for new endpoints --- lib/rest2.js | 17 ++++++++++------- test/lib/rest-2-integration.js | 17 ++++++++++++++++- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/lib/rest2.js b/lib/rest2.js index 0a94558..191f065 100644 --- a/lib/rest2.js +++ b/lib/rest2.js @@ -220,6 +220,9 @@ class RESTv2 { * @private */ async _makePublicRequest (path, cb, transformer) { + if (cb !== null && typeof cb !== 'function') { + throw new Error('callback must be a function') + } const url = `${this._url}/v2${path}` debug('GET %s', url) @@ -1975,7 +1978,7 @@ class RESTv2 { * @see https://docs.bitfinex.com/reference#submit-invoice */ payPublicInvoiceUpdate (params, cb = null) { - return this._makeAuthRequest('/auth/ext/pay/invoice/update', params, cb) + return this._makePublicPostRequest('/auth/ext/pay/invoice/update', params, cb) } /** @@ -2003,7 +2006,7 @@ class RESTv2 { * @returns {Promise} p */ payInvoiceRegenerate (params, cb = null) { - return this._makeAuthRequest('/ext/pay/invoice/regenerate', params, cb) + return this._makePublicPostRequest('/ext/pay/invoice/regenerate', params, cb) } /** @@ -2016,7 +2019,7 @@ class RESTv2 { * @returns {Promise} p */ payInvoiceFeedback (params, cb = null) { - return this._makeAuthRequest('/ext/pay/invoice/feedback', params, cb) + return this._makePublicPostRequest('/ext/pay/invoice/feedback', params, cb) } /** @@ -2039,8 +2042,8 @@ class RESTv2 { * @param {Function} [cb] - legacy callback * @returns {Promise} p */ - payPublicInvoiceCurrencyDetailed (params, cb = null) { - return this._makeAuthRequest('/ext/pay/invoice/currency/detailed', params, cb) + payPublicInvoiceCurrencyDetailed (params = {}, cb = null) { + return this._makePublicRequest('/ext/pay/invoice/currency/detailed', cb) } /** @@ -2050,7 +2053,7 @@ class RESTv2 { * @returns {Promise} p */ payInvoiceCurrencyDetailed (params, cb = null) { - return this._makeAuthRequest('/auth/r/ext/pay/currency/detailed', params, cb) + return this._makePublicPostRequest('/auth/r/ext/pay/currency/detailed', params, cb) } /** @@ -2060,7 +2063,7 @@ class RESTv2 { * @param {Function} [cb] - legacy callback * @returns {Promise} p */ - payInvoiceCurrencyList (params, cb = null) { + payCurrencyList (params, cb = null) { return this._makeAuthRequest('/auth/r/ext/pay/currency/list', params, cb) } diff --git a/test/lib/rest-2-integration.js b/test/lib/rest-2-integration.js index 8e8682e..65498e7 100644 --- a/test/lib/rest-2-integration.js +++ b/test/lib/rest-2-integration.js @@ -167,7 +167,22 @@ describe('RESTv2 integration (mock server) tests', () => { ['getCoreSettings', 'core_settings', [[{}]]], ['invalidateAuthToken', 'delete_token', [[{}]]], ['payDepositsUnlinked', 'deposits_unlinked', [{}]], - ['movementInfo', 'movement_info.id', [{ id: 'id' }]] + ['movementInfo', 'movement_info.id', [{ id: 'id' }]], + ['payRefundInvoice','pay_invoice_refund', [{}]], + ['payInvoiceMarkRefunded','pay_invoice_mark_refunded', [{}]], + ['payInvoiceEvents','pay_invoice_events', [{}]], + ['payInvoicePayInstant','pay_instant', [{}]], + ['payUploadImage','pay_upload_image', [{}]], + ['payCreditCardRates','pay_credit_card_rates', [{}]], + ['payPublicInvoiceCurrencyDetailed','pay_public_invoice_currency_detailed', [{}]], + ['payInvoiceCurrencyDetailed','pay_currency_detailed', [{}]], + ['payCurrencyList','pay_currency_list', [{}]], + ['payInvoiceFeedback','pay_invoice_feedback', [{}]], + ['payMerchantFeedback','pay_merchant_feedback', [{}]], + ['payPublicInvoiceUpdate','pay_public_invoice_update', [{}]], + ['payInvoiceUpdate','pay_invoice_update', [{}]], + ['payInvoiceRegenerate','pay_invoice_regenerate', [{}]], + ['payInvoiceCreatePos','pay_invoice_create_pos', [{}]], ] methods.forEach((m) => { From 2c67a16a84fa402f02d2e3ede11be8badd1b224a Mon Sep 17 00:00:00 2001 From: Sergio LR Date: Tue, 13 Jun 2023 12:53:01 +0200 Subject: [PATCH 11/18] feat: remove internal use endpoints --- lib/rest2.js | 100 --------------------------------- test/lib/rest-2-integration.js | 6 -- 2 files changed, 106 deletions(-) diff --git a/lib/rest2.js b/lib/rest2.js index 191f065..177b870 100644 --- a/lib/rest2.js +++ b/lib/rest2.js @@ -1997,45 +1997,6 @@ class RESTv2 { return this._makeAuthRequest('/auth/w/ext/pay/invoice/update', params, cb) } - /** - * @param {object} params - regenerate parameters - * @param {string} params.id - invoice id - * @param {string} params.ccy - invoice currency to be regenerated - * @param {string} params.remoteIp - remote ip used to lock the regeneration - * @param {Function} [cb] - legacy callback - * @returns {Promise} p - */ - payInvoiceRegenerate (params, cb = null) { - return this._makePublicPostRequest('/ext/pay/invoice/regenerate', params, cb) - } - - /** - * @param {object} params - Feedback object - * @param {boolean} params.detailed - Invoice id - * @param {number} params.score - Rating, 1-5 - * @param {string} params.comment - Feedback comment - * @param {string} params.remoteIp - Remote ip used to lock the regeneration - * @param {Function} [cb] - legacy callback - * @returns {Promise} p - */ - payInvoiceFeedback (params, cb = null) { - return this._makePublicPostRequest('/ext/pay/invoice/feedback', params, cb) - } - - /** - * @param {object} params - Feedback object - * @param {boolean} params.detailed - invoice id - * @param {number} params.score - Rating, 1-5 - * @param {string} params.category - Feedback category - * @param {string} params.comment - Feedback comment - * @param {string} params.remoteIp - Remote ip used to lock the regeneration - * @param {Function} [cb] - legacy callback - * @returns {Promise} p - */ - payMerchantFeedback (params, cb = null) { - return this._makeAuthRequest('/auth/w/ext/pay/merchant/feedback', params, cb) - } - /** * @param {object} params - list of feedbacks * @param {boolean} params.detailed - detailed @@ -2101,33 +2062,6 @@ class RESTv2 { return this._makeAuthRequest('/auth/r/ext/pay/invoices/paginated', params, cb) } - /** - * @param {object} [params] - query parameters - * @param {string} [params.status] - invoice status, allowed array item values are: - * CREATED, PENDING, COMPLETED, EXPIRED - * @param {string} [params.format] - Aggregation format, allowed values: D - today's, W - this week, M - this month, Y - this year, A - all - * @param {Function} [cb] - legacy callback - * @returns {Promise} p - * @see https://docs.bitfinex.com/reference/invoice-count-stats - */ - payInvoiceCountStats (params = {}, cb = null) { - return this._makeAuthRequest('/auth/r/ext/pay/invoice/stats/count', params, cb) - } - - /** - * Stats related to earnings during different intervals - * @param {object} [params] - query parameters - * @param {string} [params.currency] - Currency on which earnings will be calculated - * CREATED, PENDING, COMPLETED, EXPIRED - * @param {string} [params.format] - Aggregation format, allowed values: D - today's, W - this week, M - this month, Y - this year, A - all - * @param {Function} [cb] - legacy callback - * @returns {Promise} p - * @see https://docs.bitfinex.com/reference/invoice-earning-stats - */ - payInvoiceStatsEarning (params = {}, cb = null) { - return this._makeAuthRequest('/auth/r/ext/pay/invoice/stats/earning', params, cb) - } - /** * @param {object} [params] - query parameters * @param {string} [params.id] - invoice id of which events will be returned @@ -2138,40 +2072,6 @@ class RESTv2 { return this._makeAuthRequest('/auth/r/ext/pay/invoice/events', params, cb) } - /** - * @param {object} [params] - query parameters - * @param {string} [params.id] - invoice id to be paid - * @param {string} [params.ccy] - desired currency to pay invoice - * - * @returns {Promise} p - */ - payInvoicePayInstant (params = {}, cb = null) { - return this._makeAuthRequest('/auth/w/ext/pay/instant', params, cb) - } - - /** - * @param {object} [params] - query parameters - * @param {string} [params.type] - type of image being uploaded, accepts: 'LOGO' - * @param {string} [params.image] - base64 string with the image data. e.g. data:image/png;base64,iVBORw****77uJgylyzjb2gbtz79m9d= - * - * @returns {Promise} p - */ - payUploadImage (params = {}, cb = null) { - return this._makeAuthRequest('/auth/w/ext/pay/upload/image', params, cb) - } - - /** - * @param {object} [params] - query parameters - * @param {string} params.id - invoice id - * @param {string} params.ccy - payment currency - * @param {string} params.remoteIp - remote ip - * - * @returns {Promise} p - */ - payCreditCardRates (params = {}, cb = null) { - return this._makeAuthRequest('/auth/r/ext/pay/credit-card/rates', params, cb) - } - /** * @param {object} params - query parameters * @param {string} params.id - unique invoice identifier diff --git a/test/lib/rest-2-integration.js b/test/lib/rest-2-integration.js index 65498e7..929c742 100644 --- a/test/lib/rest-2-integration.js +++ b/test/lib/rest-2-integration.js @@ -171,17 +171,11 @@ describe('RESTv2 integration (mock server) tests', () => { ['payRefundInvoice','pay_invoice_refund', [{}]], ['payInvoiceMarkRefunded','pay_invoice_mark_refunded', [{}]], ['payInvoiceEvents','pay_invoice_events', [{}]], - ['payInvoicePayInstant','pay_instant', [{}]], - ['payUploadImage','pay_upload_image', [{}]], - ['payCreditCardRates','pay_credit_card_rates', [{}]], ['payPublicInvoiceCurrencyDetailed','pay_public_invoice_currency_detailed', [{}]], ['payInvoiceCurrencyDetailed','pay_currency_detailed', [{}]], ['payCurrencyList','pay_currency_list', [{}]], - ['payInvoiceFeedback','pay_invoice_feedback', [{}]], - ['payMerchantFeedback','pay_merchant_feedback', [{}]], ['payPublicInvoiceUpdate','pay_public_invoice_update', [{}]], ['payInvoiceUpdate','pay_invoice_update', [{}]], - ['payInvoiceRegenerate','pay_invoice_regenerate', [{}]], ['payInvoiceCreatePos','pay_invoice_create_pos', [{}]], ] From ad32d492e18a4c5eeff28f04af32c4a4ba44800c Mon Sep 17 00:00:00 2001 From: Sergio LR Date: Tue, 13 Jun 2023 13:16:41 +0200 Subject: [PATCH 12/18] doc: update docs --- docs/RESTv1.html | 4 +- docs/RESTv2.html | 4366 ++++++++++++++++++++++++++++++++++---------- docs/global.html | 10 +- docs/index.html | 4 +- docs/rest1.js.html | 4 +- docs/rest2.js.html | 145 +- lib/rest2.js | 26 +- 7 files changed, 3523 insertions(+), 1036 deletions(-) diff --git a/docs/RESTv1.html b/docs/RESTv1.html index 44783ad..d965264 100644 --- a/docs/RESTv1.html +++ b/docs/RESTv1.html @@ -29,7 +29,7 @@ -

Home

Classes

Global

+

Home

Classes

Global

@@ -6784,7 +6784,7 @@
Parameters:

- Documentation generated by JSDoc 3.6.11 on Thu Jun 08 2023 12:08:20 GMT+0200 (hora de verano de Europa central) using the docdash theme. + Documentation generated by JSDoc 3.6.11 on Tue Jun 13 2023 13:16:31 GMT+0200 (Central European Summer Time) using the docdash theme.
diff --git a/docs/RESTv2.html b/docs/RESTv2.html index ea33382..56d4379 100644 --- a/docs/RESTv2.html +++ b/docs/RESTv2.html @@ -29,7 +29,7 @@ -

Home

Classes

Global

+

Home

Classes

Global

@@ -526,7 +526,7 @@

accountFee
Source:
@@ -741,7 +741,7 @@

account
Source:
@@ -964,7 +964,7 @@

accountT
Source:
@@ -1363,7 +1363,7 @@

activeOrd
Source:
@@ -1581,7 +1581,7 @@

ac
Source:
@@ -1814,7 +1814,7 @@

addPulseSource:
@@ -2159,7 +2159,7 @@

addPul
Source:
@@ -2504,7 +2504,7 @@

alertDelet
Source:
@@ -2780,7 +2780,7 @@

alertListSource:
@@ -3033,7 +3033,7 @@

alertSetSource:
@@ -3332,7 +3332,7 @@

c
Source:
@@ -3725,7 +3725,7 @@

Source:
@@ -3975,7 +3975,7 @@

can
Source:
@@ -4225,7 +4225,7 @@

cancelOrde
Source:
@@ -4475,7 +4475,7 @@

cance
Source:
@@ -4843,7 +4843,7 @@

cancelOrd
Source:
@@ -5093,7 +5093,7 @@

can
Source:
@@ -5346,7 +5346,7 @@

candlesSource:
@@ -5864,7 +5864,7 @@

changeLogs<
Source:
@@ -6197,7 +6197,7 @@

claimPos
Source:
@@ -6447,7 +6447,7 @@

closeFund
Source:
@@ -6720,7 +6720,7 @@

closePos
Source:
@@ -6973,7 +6973,7 @@

confSource:
@@ -7237,7 +7237,7 @@

(async) cur
Source:
@@ -7459,7 +7459,7 @@

deletePuls
Source:
@@ -7712,7 +7712,7 @@

deleteS
Source:
@@ -7958,7 +7958,7 @@

<
Source:
@@ -8238,7 +8238,7 @@

(async) e
Source:
@@ -8507,7 +8507,7 @@

fet
Source:
@@ -8829,7 +8829,7 @@

f
Source:
@@ -9193,7 +9193,7 @@

funding
Source:
@@ -9446,7 +9446,7 @@

fundingInf
Source:
@@ -9699,7 +9699,7 @@

fun
Source:
@@ -10063,7 +10063,7 @@

fundingLo
Source:
@@ -10316,7 +10316,7 @@

fu
Source:
@@ -10680,7 +10680,7 @@

fundingO
Source:
@@ -10933,7 +10933,7 @@

fundingT
Source:
@@ -11297,7 +11297,7 @@

futuresSource:
@@ -11519,7 +11519,7 @@

genera
Source:
@@ -11818,7 +11818,7 @@

generate
Source:
@@ -12206,7 +12206,7 @@

getCor
Source:
@@ -12452,7 +12452,7 @@

getD
Source:
@@ -12744,7 +12744,7 @@

getSetting
Source:
@@ -13095,7 +13095,7 @@

inacti
Source:
@@ -13317,7 +13317,7 @@

in
Source:
@@ -13563,7 +13563,7 @@

keepFundin
Source:
@@ -13839,7 +13839,7 @@

keyPerm
Source:
@@ -14054,7 +14054,7 @@

ledgersSource:
@@ -14419,7 +14419,7 @@

liquidati
Source:
@@ -14785,7 +14785,7 @@

lnx
Source:
@@ -15115,7 +15115,7 @@

loginsSource:
@@ -15448,7 +15448,7 @@

marginInfo<
Source:
@@ -15715,7 +15715,7 @@

mar
Source:
@@ -16075,7 +16075,7 @@

movementI
Source:
@@ -16342,7 +16342,7 @@

movementsSource:
@@ -16774,7 +16774,7 @@

orderBookSource:
@@ -17050,7 +17050,7 @@

orderHist
Source:
@@ -17416,7 +17416,7 @@

or
Source:
@@ -17669,7 +17669,7 @@

orderMult
Source:
@@ -17926,7 +17926,7 @@

orderTrade
Source:
@@ -18319,7 +18319,7 @@

Source:
@@ -18558,7 +18558,7 @@

Source:
@@ -18701,6 +18701,267 @@
Parameters:
+
Returns:
+ + +
+

p

+
+ + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

payCurrencyList(parameters, cbopt) → {Promise}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
parameters + + +object + + + + + + + + + +

list of feedbacks

params.detailed + + +boolean + + + + + + + + + +

detailed

params.id + + +string + + + + + + + + <nullable>
+ + + +

invoice id

cb + + +function + + + + + + <optional>
+ + + + + +

legacy callback

+ + + + + + + + + + + + + + + +
Returns:
@@ -18743,7 +19004,7 @@

payDeposit
Source:
@@ -19143,7 +19404,7 @@

pa
Source:
@@ -19475,7 +19736,7 @@

pay
Source:
@@ -19858,7 +20119,7 @@

Returns:
-

payInvoiceCountStats(paramsopt, cbopt) → {Promise}

+

payInvoiceCreate(params, cbopt) → {Promise}

@@ -19870,7 +20131,7 @@

p
Source:
@@ -19904,7 +20165,7 @@

p
See:
@@ -19968,8 +20229,6 @@

Parameters:
- <optional>
- @@ -19979,306 +20238,7 @@
Parameters:
-

query parameters

-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
status - - -string - - - - - - <optional>
- - - - - -

invoice status, allowed array item values are: -CREATED, PENDING, COMPLETED, EXPIRED

format - - -string - - - - - - <optional>
- - - - - -

Aggregation format, allowed values: D - today's, W - this week, M - this month, Y - this year, A - all

- - - - - - - - - cb - - - - - -function - - - - - - - - - <optional>
- - - - - - - - - - -

legacy callback

- - - - - - - - - - - - - - - - - - - - - -
Returns:
- - -
-

p

-
- - - -
-
- Type -
-
- -Promise - - -
-
- - - - - - - - - - -

payInvoiceCreate(params, cbopt) → {Promise}

- - - - - - -
- - -
Source:
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
See:
-
- -
- - - -
- - - - - - - - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -21271,7 +21226,7 @@
Properties
- + + - + + + - - -
NameTypeAttributesDescription
params - - -object - - - - - - - - - -

invoice parameters

+

invoice parameters

Properties
@@ -21126,7 +21086,7 @@
Returns:
-

payInvoiceExpire(params, cbopt) → {Promise}

+

payInvoiceCreatePos(params, cbopt) → {Promise}

@@ -21138,7 +21098,7 @@

payIn
Source:
@@ -21168,13 +21128,6 @@

payIn - -
See:
-
- -
@@ -21245,7 +21198,7 @@

Parameters:
-

query parameters

+

invoice parameters

Properties
@@ -21259,6 +21212,8 @@
Properties
TypeAttributes
idamount @@ -21284,30 +21239,31 @@
Properties
+ - + -

unique invoice identifier

+ - +

invoice amount in currency

- cb + currency -function +string @@ -21316,8 +21272,6 @@
Properties
- <optional>
- @@ -21327,160 +21281,117 @@
Properties
-

legacy callback

+

invoice currency

- - - - - - - - - - - - - - - - - - -
Returns:
- - -
-

p

-
- - - -
-
- Type -
-
- -Promise - - -
-
- - - - - + + + payCurrencies - - -

payInvoiceList(paramsopt, cbopt) → {Promise}

- - - - + + + +Array.<string> -
+ + - -
Source:
-
- + + + - + - + + + - + - +

currencies in which invoice accepts the payments

+ - + + + duration + - + + + +number - - + + - + + + + <optional>
+ - + - + + + - + - -
See:
-
- -
- +

optional, invoice expire time in seconds, minimal duration +is 5 mins and maximal duration is 3 days. +Default value is 15 minutes

+ -
- - - - - - - - - - - + + + orderId + + + + +string -
Parameters:
- + + - - - - - - + + + - - - + + + - + - - - + + - - + - + + + +
Name + - TypeAttributesDescription

reference order identifier in merchant's platform

paramswebhook -object +string @@ -21500,35 +21411,15 @@
Parameters:
-

query parameters

-
Properties
- - - - - - - - - - - - - - - - - - - - + + - - + + - + - + @@ -21745,7 +21666,7 @@
Returns:
-

payInvoiceListPaginated(paramsopt, cbopt) → {Promise}

+

payInvoiceCurrencyDetailed(params, cbopt) → {Promise}

@@ -21757,7 +21678,7 @@

Source:
@@ -21787,13 +21708,6 @@

See: -
- -
@@ -21855,8 +21769,6 @@
Parameters:

- - @@ -21894,46 +21804,43 @@
Properties
- + - - + + - + + +
NameTypeAttributesDescription

the endpoint that will be called once the payment is +completed or expired

idredirectUrl @@ -21554,20 +21445,20 @@
Properties
-

unique invoice identifier

merchant redirect URL, this one is used in UI to redirect

startmeta -number +object @@ -21587,20 +21478,41 @@
Properties
-

millisecond start time

metadata

+
Properties
+ + + + + + + + + + + + + + + + + + + + + - + + - + + + + + + +
NameTypeAttributesDescription
endenv -number +string @@ -21620,20 +21532,21 @@
Properties
-

millisecond end time

merchant environment, allowed values: production, test, +staging, development

limittags -number +Array.<string> @@ -21653,7 +21566,15 @@
Properties
-

number of records (Max 100), default 10

invoice tags, max number of tags is 5 and max length of +tag is 5 characters

+ +
- <optional>
- @@ -21866,7 +21778,7 @@
Parameters:
-

query parameters

+

list of feedbacks

Properties
@@ -21880,8 +21792,6 @@
Properties
TypeAttributes
pagedetailed -number +boolean - - <optional>
- - - - -

detailed

Current page, default 1 100

+ +
pageSizecb -number +function @@ -21953,219 +21860,153 @@
Properties
-

Number of records per page, default 10, max 100

legacy callback

- - - sort - - - - -string - - - - - - <optional>
- - - - - - -

Sort order, default asc, accepted values are asc and desc

- - - - - sortField - - - - -string - - - - - - <optional>
- - +
Returns:
- - - + +
+

p

+
- -

Sort field, default t, allowed values: t, amount, status

- + +
+
+ Type +
+
+ +Promise + + +
+
- - - status - - + + - -string + - - +

payInvoiceEvents(paramsopt) → {Promise}

- - - - <optional>
- + - - - - - -

invoice status, allowed array item values are: -CREATED, PENDING, COMPLETED, EXPIRED

- +
+
Source:
+
+ - - - fiat - + - - - -Array.<string> + + - - + - - - - <optional>
- + - + - - - + - + -

fiat filter, should be array of strings

- + - - - crypto - + - - - -Array.<string> + + - - + - - - - <optional>
- + +
- - - - - -

crypto filter, should be array of strings

- - - - - id - - - - -string - - - - - - <optional>
- - - - - - -

unique invoice identifier

- +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + - + - + -
NameTypeAttributesDescription
orderIdparams -string +object @@ -22185,27 +22026,41 @@
Properties
-

erchant order id

query parameters

+
Properties
+ - -
+ + + + + + - - + + + + + + + + + + + + - + + + + + + +
Name
TypeAttributesDescription
cbid -function +string @@ -22225,7 +22080,14 @@
Properties
-

legacy callback

invoice id of which events will be returned

+ + @@ -22277,7 +22139,7 @@
Returns:
-

payInvoiceStatsEarning(paramsopt, cbopt) → {Promise}

+

payInvoiceExpire(params, cbopt) → {Promise}

@@ -22289,7 +22151,7 @@

Source:
@@ -22323,7 +22185,7 @@

See:
@@ -22335,10 +22197,6 @@

-

Stats related to earnings during different intervals

-

- @@ -22391,8 +22249,6 @@
Parameters:
- <optional>
- @@ -22416,8 +22272,6 @@
Properties
Type - Attributes - @@ -22430,41 +22284,7 @@
Properties
- currency - - - - - -string - - - - - - - - - <optional>
- - - - - - - - - - -

Currency on which earnings will be calculated -CREATED, PENDING, COMPLETED, EXPIRED

- - - - - - - format + id @@ -22477,20 +22297,10 @@
Properties
- - - <optional>
- - - - - - - -

Aggregation format, allowed values: D - today's, W - this week, M - this month, Y - this year, A - all

+

unique invoice identifier

@@ -22582,7 +22392,7 @@
Returns:
-

payMerchantDailyLimit(cbopt) → {Promise}

+

payInvoiceList(paramsopt, cbopt) → {Promise}

@@ -22594,7 +22404,7 @@

Source:
@@ -22628,7 +22438,7 @@

See:
@@ -22640,10 +22450,6 @@

-
-

Returns the daily limits for merchant

-
- @@ -22681,13 +22487,13 @@

Parameters:
- params.customerEmails + params -Array.<string> +object @@ -22707,20 +22513,41 @@
Parameters:
-

Optional, customer emails for e-commerce usage

- +

query parameters

+
Properties
+ + + + + + + + + + + + + + + + + + + + + - + + - -
NameTypeAttributesDescription
cbid -function +string @@ -22740,164 +22567,86 @@
Parameters:
-

legacy callback

unique invoice identifier

- - - - - - - - - - - - - - - -
Returns:
- - -
-

p

-
- - - -
-
- Type -
-
- -Promise - - -
-
- - - - - - + + + start - - -

payMerchantSettingsList(cbopt) → {Promise}

- - - - - - -
- - -
Source:
-
- - - - - - - - - - - - - - - + + + +number - - + + - + + + + <optional>
+ - + - + + + - + - -
See:
-
- -
- +

millisecond start time

+ -
- - - - - -
-

Reads multiple merchant settings

-
- - - - - - - + + + end + + + + +number -
Parameters:
- + + - - - - - - + + + - - - + + + - + - - - + + - - + + + + + + +
Name + + <optional>
+ -
TypeAttributesDescription

millisecond end time

params.keyslimit -Array.<string> +number @@ -22906,6 +22655,8 @@
Parameters:
+ <optional>
+ @@ -22915,7 +22666,14 @@
Parameters:
-

Setting keys, if empty array all settings will be returned

number of records (Max 100), default 10

+ + @@ -23000,7 +22758,7 @@
Returns:
-

payMerchantSettingsRead(cbopt) → {Promise}

+

payInvoiceListPaginated(paramsopt, cbopt) → {Promise}

@@ -23012,7 +22770,7 @@

Source:
@@ -23046,7 +22804,7 @@

See:
@@ -23058,10 +22816,1827 @@

-

Reads merchant settings

-

- + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
params + + +object + + + + + + <optional>
+ + + + + +

query parameters

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
page + + +number + + + + + + <optional>
+ + + + + +

Current page, default 1 100

pageSize + + +number + + + + + + <optional>
+ + + + + +

Number of records per page, default 10, max 100

sort + + +string + + + + + + <optional>
+ + + + + +

Sort order, default asc, accepted values are asc and desc

sortField + + +string + + + + + + <optional>
+ + + + + +

Sort field, default t, allowed values: t, amount, status

status + + +string + + + + + + <optional>
+ + + + + +

invoice status, allowed array item values are: +CREATED, PENDING, COMPLETED, EXPIRED

fiat + + +Array.<string> + + + + + + <optional>
+ + + + + +

fiat filter, should be array of strings

crypto + + +Array.<string> + + + + + + <optional>
+ + + + + +

crypto filter, should be array of strings

id + + +string + + + + + + <optional>
+ + + + + +

unique invoice identifier

orderId + + +string + + + + + + <optional>
+ + + + + +

erchant order id

+ +
cb + + +function + + + + + + <optional>
+ + + + + +

legacy callback

+ + + + + + + + + + + + + + + + +
Returns:
+ + +
+

p

+
+ + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

payInvoiceMarkRefunded(params, cbopt) → {Promise}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
params + + +object + + + + + + + + + +

query parameters

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + + +string + + + +

unique invoice identifier

refundId + + +string + + + +

id of the refund

+ +
cb + + +function + + + + + + <optional>
+ + + + + +

legacy callback

+ + + + + + + + + + + + + + + + +
Returns:
+ + +
+

p

+
+ + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

payInvoiceUpdate(params, cbopt) → {Promise}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
params + + +Object + + + + + + + + + +

An object containing the following properties:

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + + +Object + + + +

The id property.

fields + + +Object + + + + +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
customerInfo + + +Object + + + + +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
tosAccepted + + +Object + + + +

TOS Accepted by customer

+ +
+ +
privateNote + + +Object + + + +

Private note

+ +
cb + + +function + + + + + + <optional>
+ + + + + +

legacy callback

+ + + + + + + + + + + + + + + + +
Returns:
+ + +
+

p

+
+ + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

payMerchantDailyLimit(cbopt) → {Promise}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + + + +
+

Returns the daily limits for merchant

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
params.customerEmails + + +Array.<string> + + + + + + <optional>
+ + + + + +

Optional, customer emails for e-commerce usage

cb + + +function + + + + + + <optional>
+ + + + + +

legacy callback

+ + + + + + + + + + + + + + + + +
Returns:
+ + +
+

p

+
+ + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

payMerchantSettingsList(cbopt) → {Promise}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + + + +
+

Reads multiple merchant settings

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
params.keys + + +Array.<string> + + + + + + + + + +

Setting keys, if empty array all settings will be returned

cb + + +function + + + + + + <optional>
+ + + + + +

legacy callback

+ + + + + + + + + + + + + + + + +
Returns:
+ + +
+

p

+
+ + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

payMerchantSettingsRead(cbopt) → {Promise}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + + + +
+

Reads merchant settings

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
params.key + + +string + + + + + + + + + +

Setting key. Check doc link for possible values

cb + + +function + + + + + + <optional>
+ + + + + +

legacy callback

+ + + + + + + + + + + + + + + + +
Returns:
+ + +
+

p

+
+ + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

payMerchantSettingsWrite(cbopt) → {Promise}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + + + +
+

Sets merchant settings

+
+ @@ -23105,7 +24680,515 @@
Parameters:
-string +string + + + + + + + + + + + + + + + + + +

Setting key. Check doc link for possible values

+ + + + + + + params.value + + + + + +string + + + + + + + + + + + + + + + + + +

Setting value, if null it means unset

+ + + + + + + cb + + + + + +function + + + + + + + + + <optional>
+ + + + + + + + + + +

legacy callback

+ + + + + + + + + + + + + + + + + + + + + +
Returns:
+ + +
+

p

+
+ + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

payMerchantSettingsWriteBatch(cbopt) → {Promise}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + + + +
+

Sets merchant settings

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
params.settings + + +string + + + + + + + + + +

Setting keys and values

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
key + + +string + + + +

Setting key. Check doc link for possible values

value + + +string + + + +

Setting value, if null it means unset

+ +
cb + + +function + + + + + + <optional>
+ + + + + +

legacy callback

+ + + + + + + + + + + + + + + + +
Returns:
+ + +
+

p

+
+ + + +
+
+ Type +
+
+ +Promise + + +
+
+ + + + + + + + + + +

payPublicInvoiceCurrencyDetailed(params, cbopt) → {Promise}

+ + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -23208,7 +25340,7 @@
Returns:
-

payMerchantSettingsWrite(cbopt) → {Promise}

+

payPublicInvoiceUpdate(params, cbopt) → {Promise}

@@ -23220,7 +25352,7 @@

Source:
@@ -23250,13 +25382,6 @@

See: -
- -
@@ -23266,10 +25391,6 @@

-

Sets merchant settings

- - @@ -23307,13 +25428,13 @@
Parameters:

- + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
params + + +object @@ -23123,7 +25206,56 @@
Parameters:
-

Setting key. Check doc link for possible values

list of feedbacks

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
detailed + + +boolean + + + +

detailed

+ +
params.keyparams -string +Object @@ -23331,38 +25452,200 @@
Parameters:
-

Setting key. Check doc link for possible values

An object containing the following properties:

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + + + +
NameTypeDescription
id + + +Object + + + +

The id property.

params.valuefields -string +Object + + + + +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
customerInfo + +Object + + + + +
Properties
-
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
tosAccepted + +Object -

Setting value, if null it means unset

TOS Accepted by customer

+ +
+ +
privateNote + + +Object + + + +

Private note

+ + @@ -23447,7 +25730,7 @@
Returns:
-

payMerchantSettingsWriteBatch(cbopt) → {Promise}

+

payRefundInvoice(params, cbopt) → {Promise}

@@ -23459,7 +25742,7 @@

Source:
@@ -23489,13 +25772,6 @@

See: -
- -
@@ -23505,10 +25781,6 @@

-

Sets merchant settings

-

- @@ -23546,13 +25818,13 @@
Parameters:
- params.settings + params -string +object @@ -23570,7 +25842,7 @@
Parameters:
-

Setting keys and values

+

query parameters

Properties
@@ -23596,7 +25868,7 @@
Properties
- key + id @@ -23612,14 +25884,14 @@
Properties
-

Setting key. Check doc link for possible values

+

unique invoice identifier

- value + ccy @@ -23635,7 +25907,125 @@
Properties
-

Setting value, if null it means unset

+

currency to be refunded

+ + + + + + + amount + + + + + +string + + + + + + + + + +

amount to be refunded

+ + + + + + + address + + + + + +object + + + + + + + + + +

address of refund

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
address + + +object + + + +

address of the wallet

payment_id + + +object + + + +

tag memo

+ + @@ -23739,7 +26129,7 @@

<
Source:
@@ -23978,7 +26368,7 @@

performanc
Source:
@@ -24196,7 +26586,7 @@

positionsSource:
@@ -24414,7 +26804,7 @@

positio
Source:
@@ -24780,7 +27170,7 @@

posit
Source:
@@ -25113,7 +27503,7 @@

posi
Source:
@@ -25446,7 +27836,7 @@

pub
Source:
@@ -25722,7 +28112,7 @@

pub
Source:
@@ -25975,7 +28365,7 @@

pulseHist
Source:
@@ -26228,7 +28618,7 @@

statsSource:
@@ -26504,7 +28894,7 @@

statusSource:
@@ -26722,7 +29112,7 @@

statusM
Source:
@@ -27022,7 +29412,7 @@

subm
Source:
@@ -27364,7 +29754,7 @@

sub
Source:
@@ -27614,7 +30004,7 @@

submitOrde
Source:
@@ -27864,7 +30254,7 @@

submi
Source:
@@ -28114,7 +30504,7 @@

symbolDe
Source:
@@ -28385,7 +30775,7 @@

symbolsSource:
@@ -28607,7 +30997,7 @@

tickerSource:
@@ -28860,7 +31250,7 @@

tickersSource:
@@ -29127,7 +31517,7 @@

tickers
Source:
@@ -29493,7 +31883,7 @@

tradesSource:
@@ -29888,7 +32278,7 @@

transferSource:
@@ -30230,7 +32620,7 @@

updateOrde
Source:
@@ -30443,7 +32833,7 @@

updat
Source:
@@ -30693,7 +33083,7 @@

updateS
Source:
@@ -30939,7 +33329,7 @@

userInfoSource:
@@ -31262,7 +33652,7 @@

walletsSource:
@@ -31480,7 +33870,7 @@

wallets
Source:
@@ -31780,7 +34170,7 @@

withdrawSource:
@@ -32098,7 +34488,7 @@
Returns:

- Documentation generated by JSDoc 3.6.11 on Thu Jun 08 2023 12:08:20 GMT+0200 (hora de verano de Europa central) using the docdash theme. + Documentation generated by JSDoc 3.6.11 on Tue Jun 13 2023 13:16:31 GMT+0200 (Central European Summer Time) using the docdash theme.
diff --git a/docs/global.html b/docs/global.html index 21f1b13..76bd584 100644 --- a/docs/global.html +++ b/docs/global.html @@ -29,7 +29,7 @@ -

Home

Classes

Global

+

Home

Classes

Global

@@ -136,7 +136,7 @@

ClientOrderIdPayload

Source:
@@ -280,7 +280,7 @@

MultiOrderOp

Source:
@@ -427,7 +427,7 @@

MultiOrderOpPayload

Source:
@@ -566,7 +566,7 @@
Type:

- Documentation generated by JSDoc 3.6.11 on Thu Jun 08 2023 12:08:20 GMT+0200 (hora de verano de Europa central) using the docdash theme. + Documentation generated by JSDoc 3.6.11 on Tue Jun 13 2023 13:16:31 GMT+0200 (Central European Summer Time) using the docdash theme.
diff --git a/docs/index.html b/docs/index.html index 10b9ceb..ab62384 100644 --- a/docs/index.html +++ b/docs/index.html @@ -29,7 +29,7 @@ -

Home

Classes

Global

+

Home

Classes

Global

@@ -125,7 +125,7 @@

nonce too small


- Documentation generated by JSDoc 3.6.11 on Thu Jun 08 2023 12:08:20 GMT+0200 (hora de verano de Europa central) using the docdash theme. + Documentation generated by JSDoc 3.6.11 on Tue Jun 13 2023 13:16:31 GMT+0200 (Central European Summer Time) using the docdash theme.
diff --git a/docs/rest1.js.html b/docs/rest1.js.html index de50451..35ea7e4 100644 --- a/docs/rest1.js.html +++ b/docs/rest1.js.html @@ -29,7 +29,7 @@ -

Home

Classes

Global

+

Home

Classes

Global

@@ -662,7 +662,7 @@

rest1.js


- Documentation generated by JSDoc 3.6.11 on Thu Jun 08 2023 12:08:20 GMT+0200 (hora de verano de Europa central) using the docdash theme. + Documentation generated by JSDoc 3.6.11 on Tue Jun 13 2023 13:16:31 GMT+0200 (Central European Summer Time) using the docdash theme.
diff --git a/docs/rest2.js.html b/docs/rest2.js.html index 439d4db..2ae3429 100644 --- a/docs/rest2.js.html +++ b/docs/rest2.js.html @@ -29,7 +29,7 @@ -

Home

Classes

Global

+

Home

Classes

Global

@@ -266,6 +266,9 @@

rest2.js

* @private */ async _makePublicRequest (path, cb, transformer) { + if (cb !== null && typeof cb !== 'function') { + throw new Error('callback must be a function') + } const url = `${this._url}/v2${path}` debug('GET %s', url) @@ -1984,6 +1987,91 @@

rest2.js

return this._makeAuthRequest('/auth/w/ext/pay/invoice/create', params, cb) } + /** + * @param {object} params - invoice parameters + * @param {string} params.amount - invoice amount in currency + * @param {string} params.currency - invoice currency + * @param {string[]} params.payCurrencies - currencies in which invoice accepts the payments + * @param {number} [params.duration] - optional, invoice expire time in seconds, minimal duration + * is 5 mins and maximal duration is 3 days. + * Default value is 15 minutes + * @param {string} params.orderId - reference order identifier in merchant's platform + * @param {string} [params.webhook] - the endpoint that will be called once the payment is + * completed or expired + * @param {string} [params.redirectUrl] - merchant redirect URL, this one is used in UI to redirect + * @param {object} [params.meta] - metadata + * @param {string} [params.meta.env] - merchant environment, allowed values: production, test, + * staging, development + * @param {string[]} [params.meta.tags] - invoice tags, max number of tags is 5 and max length of + * tag is 5 characters + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + */ + payInvoiceCreatePos (params, cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/invoice/create/pos', params, cb) + } + + /** + * @param {Object} params - An object containing the following properties: + * @param {Object} params.id - The id property. + * @param {Object} params.fields + * @param {Object} params.fields.customerInfo + * @param {Object} params.fields.customerInfo.tosAccepted - TOS Accepted by customer + * @param {Object} params.privateNote - Private note + * + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + */ + payPublicInvoiceUpdate (params, cb = null) { + return this._makePublicPostRequest('/auth/ext/pay/invoice/update', params, cb) + } + + /** + * @param {Object} params - An object containing the following properties: + * @param {Object} params.id - The id property. + * @param {Object} params.fields + * @param {Object} params.fields.customerInfo + * @param {Object} params.fields.customerInfo.tosAccepted - TOS Accepted by customer + * @param {Object} params.privateNote - Private note + * + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + */ + payInvoiceUpdate (params, cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/invoice/update', params, cb) + } + + /** + * @param {object} params - list of feedbacks + * @param {boolean} params.detailed - detailed + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + */ + payPublicInvoiceCurrencyDetailed (params = {}, cb = null) { + return this._makePublicRequest('/ext/pay/invoice/currency/detailed', cb) + } + + /** + * @param {object} params - list of feedbacks + * @param {boolean} params.detailed - detailed + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + */ + payInvoiceCurrencyDetailed (params, cb = null) { + return this._makePublicPostRequest('/auth/r/ext/pay/currency/detailed', params, cb) + } + + /** + * @param {object} parameters - list of feedbacks + * @param {boolean} params.detailed - detailed + * @param {string?} params.id - invoice id + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + */ + payCurrencyList (params, cb = null) { + return this._makeAuthRequest('/auth/r/ext/pay/currency/list', params, cb) + } + /** * @param {object} [params] - query parameters * @param {string} [params.id] - unique invoice identifier @@ -2020,29 +2108,12 @@

rest2.js

/** * @param {object} [params] - query parameters - * @param {string} [params.status] - invoice status, allowed array item values are: - * CREATED, PENDING, COMPLETED, EXPIRED - * @param {string} [params.format] - Aggregation format, allowed values: D - today's, W - this week, M - this month, Y - this year, A - all - * @param {Function} [cb] - legacy callback - * @returns {Promise} p - * @see https://docs.bitfinex.com/reference/invoice-count-stats - */ - payInvoiceCountStats (params = {}, cb = null) { - return this._makeAuthRequest('/auth/r/ext/pay/invoice/stats/count', params, cb) - } - - /** - * Stats related to earnings during different intervals - * @param {object} [params] - query parameters - * @param {string} [params.currency] - Currency on which earnings will be calculated - * CREATED, PENDING, COMPLETED, EXPIRED - * @param {string} [params.format] - Aggregation format, allowed values: D - today's, W - this week, M - this month, Y - this year, A - all - * @param {Function} [cb] - legacy callback + * @param {string} [params.id] - invoice id of which events will be returned + * * @returns {Promise} p - * @see https://docs.bitfinex.com/reference/invoice-earning-stats */ - payInvoiceStatsEarning (params = {}, cb = null) { - return this._makeAuthRequest('/auth/r/ext/pay/invoice/stats/earning', params, cb) + payInvoiceEvents (params = {}, cb = null) { + return this._makeAuthRequest('/auth/r/ext/pay/invoice/events', params, cb) } /** @@ -2062,6 +2133,34 @@

rest2.js

return this._makeAuthRequest('/auth/w/ext/pay/invoice/complete', params, cb) } + /** + * @param {object} params - query parameters + * @param {string} params.id - unique invoice identifier + * @param {string} params.ccy - currency to be refunded + * @param {string} params.amount - amount to be refunded + * @param {object} params.address - address of refund + * @param {object} params.address.address - address of the wallet + * @param {object} params.address.payment_id - tag memo + + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + */ + payRefundInvoice (params, cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/invoice/refund', params, cb) + } + + /** + * @param {object} params - query parameters + * @param {string} params.id - unique invoice identifier + * @param {string} params.refundId - id of the refund + + * @param {Function} [cb] - legacy callback + * @returns {Promise} p + */ + payInvoiceMarkRefunded (params, cb = null) { + return this._makeAuthRequest('/auth/w/ext/pay/invoice/mark/refunded', params, cb) + } + /** * @param {object} params - query parameters * @param {string} params.id - unique invoice identifier @@ -2215,7 +2314,7 @@

rest2.js


- Documentation generated by JSDoc 3.6.11 on Thu Jun 08 2023 12:08:20 GMT+0200 (hora de verano de Europa central) using the docdash theme. + Documentation generated by JSDoc 3.6.11 on Tue Jun 13 2023 13:16:31 GMT+0200 (Central European Summer Time) using the docdash theme.
diff --git a/lib/rest2.js b/lib/rest2.js index 177b870..d472052 100644 --- a/lib/rest2.js +++ b/lib/rest2.js @@ -1966,32 +1966,30 @@ class RESTv2 { } /** - * @param {Array} param - The parameter value. - * @param {number} param[0] - The number value. - * @param {Object} param[1] - An object containing the following properties: - * @param {Object} param[1].id - The id property. - * @param {Object} param[1].fields.customerInfo.tosAccepted - TOS Accepted by customer - * @param {Object} param[1].privateNote - Private note + * @param {Object} params - An object containing the following properties: + * @param {Object} params.id - The id property. + * @param {Object} params.fields + * @param {Object} params.fields.customerInfo + * @param {Object} params.fields.customerInfo.tosAccepted - TOS Accepted by customer + * @param {Object} params.privateNote - Private note * * @param {Function} [cb] - legacy callback * @returns {Promise} p - * @see https://docs.bitfinex.com/reference#submit-invoice */ payPublicInvoiceUpdate (params, cb = null) { return this._makePublicPostRequest('/auth/ext/pay/invoice/update', params, cb) } /** - * @param {Array} param - The parameter value. - * @param {number} param[0] - The number value. - * @param {Object} param[1] - An object containing the following properties: - * @param {Object} param[1].id - The id property. - * @param {Object} param[1].fields.customerInfo.tosAccepted - TOS Accepted by customer - * @param {Object} param[1].privateNote - Private note + * @param {Object} params - An object containing the following properties: + * @param {Object} params.id - The id property. + * @param {Object} params.fields + * @param {Object} params.fields.customerInfo + * @param {Object} params.fields.customerInfo.tosAccepted - TOS Accepted by customer + * @param {Object} params.privateNote - Private note * * @param {Function} [cb] - legacy callback * @returns {Promise} p - * @see https://docs.bitfinex.com/reference#submit-invoice */ payInvoiceUpdate (params, cb = null) { return this._makeAuthRequest('/auth/w/ext/pay/invoice/update', params, cb) From 68ae671e4d4389c6a2c70773c6d29e637f9de3a1 Mon Sep 17 00:00:00 2001 From: Sergio LR Date: Tue, 13 Jun 2023 16:53:00 +0200 Subject: [PATCH 13/18] doc: update changelog --- CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index e37c16a..d4958f2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,4 @@ -# 5.1.2 +# 5.2.0 - RESTv2: add payCurrencyConversionList method - RESTv2: add payAddCurrencyConversion method - RESTv2: add payRemoveCurrencyConversion method From f2b145888faa3b8a21e6a6e6ffe8e8d7d7f0d017 Mon Sep 17 00:00:00 2001 From: Sergio LR Date: Tue, 13 Jun 2023 18:50:15 +0200 Subject: [PATCH 14/18] refactor: allow cb = undefined --- lib/rest2.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rest2.js b/lib/rest2.js index d472052..c264e27 100644 --- a/lib/rest2.js +++ b/lib/rest2.js @@ -220,8 +220,8 @@ class RESTv2 { * @private */ async _makePublicRequest (path, cb, transformer) { - if (cb !== null && typeof cb !== 'function') { - throw new Error('callback must be a function') + if ((cb !== null && cb !== undefined) && typeof cb !== 'function') { + throw new Error('_makePublicRequest cb param must be a function') } const url = `${this._url}/v2${path}` From ed98838d3c7ab88f24768f9f203560c62a05ce2a Mon Sep 17 00:00:00 2001 From: Sergio LR Date: Wed, 14 Jun 2023 11:00:58 +0200 Subject: [PATCH 15/18] feat: add test and remove not needed endpoint --- lib/rest2.js | 15 --------------- test/lib/rest-2-integration.js | 1 - 2 files changed, 16 deletions(-) diff --git a/lib/rest2.js b/lib/rest2.js index c264e27..634b42c 100644 --- a/lib/rest2.js +++ b/lib/rest2.js @@ -1965,21 +1965,6 @@ class RESTv2 { return this._makeAuthRequest('/auth/w/ext/pay/invoice/create/pos', params, cb) } - /** - * @param {Object} params - An object containing the following properties: - * @param {Object} params.id - The id property. - * @param {Object} params.fields - * @param {Object} params.fields.customerInfo - * @param {Object} params.fields.customerInfo.tosAccepted - TOS Accepted by customer - * @param {Object} params.privateNote - Private note - * - * @param {Function} [cb] - legacy callback - * @returns {Promise} p - */ - payPublicInvoiceUpdate (params, cb = null) { - return this._makePublicPostRequest('/auth/ext/pay/invoice/update', params, cb) - } - /** * @param {Object} params - An object containing the following properties: * @param {Object} params.id - The id property. diff --git a/test/lib/rest-2-integration.js b/test/lib/rest-2-integration.js index 929c742..9be705b 100644 --- a/test/lib/rest-2-integration.js +++ b/test/lib/rest-2-integration.js @@ -174,7 +174,6 @@ describe('RESTv2 integration (mock server) tests', () => { ['payPublicInvoiceCurrencyDetailed','pay_public_invoice_currency_detailed', [{}]], ['payInvoiceCurrencyDetailed','pay_currency_detailed', [{}]], ['payCurrencyList','pay_currency_list', [{}]], - ['payPublicInvoiceUpdate','pay_public_invoice_update', [{}]], ['payInvoiceUpdate','pay_invoice_update', [{}]], ['payInvoiceCreatePos','pay_invoice_create_pos', [{}]], ] From db7799d33c4790c2981b6813f77884813e249d64 Mon Sep 17 00:00:00 2001 From: Sergio LR Date: Wed, 14 Jun 2023 11:01:08 +0200 Subject: [PATCH 16/18] chore: bump version --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2a60cd3..a547da5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bfx-api-node-rest", - "version": "5.1.2", + "version": "5.2.0", "description": "Official Bitfinex REST v1 & v2 API interfaces", "engines": { "node": ">=8.3.0" @@ -45,7 +45,7 @@ "url": "https://github.com/bitfinexcom/bfx-api-node-rest/issues" }, "devDependencies": { - "bfx-api-mock-srv": "^1.2.0", + "bfx-api-mock-srv": "^1.4.0", "chai": "^4.3.7", "chai-as-promised": "^7.1.1", "docdash": "^1.2.0", From 3194b0639eea06a15bb09c8643722a6e85ec7d0f Mon Sep 17 00:00:00 2001 From: Sergio LR Date: Wed, 14 Jun 2023 15:42:41 +0200 Subject: [PATCH 17/18] test: remove useless getCoreSettings params from test --- test/lib/rest-2-integration.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/lib/rest-2-integration.js b/test/lib/rest-2-integration.js index 9be705b..1eed874 100644 --- a/test/lib/rest-2-integration.js +++ b/test/lib/rest-2-integration.js @@ -164,7 +164,7 @@ describe('RESTv2 integration (mock server) tests', () => { ['payMerchantSettingsWriteBatch', 'pay_settings_set_batch', [{}]], ['payMerchantSettingsRead', 'pay_settings_get', [{}]], ['payMerchantSettingsList', 'pay_settings_list', [{}]], - ['getCoreSettings', 'core_settings', [[{}]]], + ['getCoreSettings', 'core_settings', [[]]], ['invalidateAuthToken', 'delete_token', [[{}]]], ['payDepositsUnlinked', 'deposits_unlinked', [{}]], ['movementInfo', 'movement_info.id', [{ id: 'id' }]], From 15ffd78c3f41a6e886e150628685cc12b7d82e00 Mon Sep 17 00:00:00 2001 From: Sergio LR Date: Wed, 14 Jun 2023 16:28:58 +0200 Subject: [PATCH 18/18] chore: update bfx-api-mock-srv to 1.5.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a547da5..f7b74f9 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "url": "https://github.com/bitfinexcom/bfx-api-node-rest/issues" }, "devDependencies": { - "bfx-api-mock-srv": "^1.4.0", + "bfx-api-mock-srv": "^1.5.0", "chai": "^4.3.7", "chai-as-promised": "^7.1.1", "docdash": "^1.2.0",