bitapy-sdk 6.2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/4tjtyyj8.cjs +1 -0
- package/LICENSE +21 -0
- package/README.md +49 -0
- package/dist/Client/BillClient.d.ts +60 -0
- package/dist/Client/BillClient.js +117 -0
- package/dist/Client/BitPayClient.d.ts +51 -0
- package/dist/Client/BitPayClient.js +186 -0
- package/dist/Client/CurrencyClient.d.ts +13 -0
- package/dist/Client/CurrencyClient.js +30 -0
- package/dist/Client/InvoiceClient.d.ts +108 -0
- package/dist/Client/InvoiceClient.js +222 -0
- package/dist/Client/LedgerClient.d.ts +26 -0
- package/dist/Client/LedgerClient.js +51 -0
- package/dist/Client/PayoutClient.d.ts +51 -0
- package/dist/Client/PayoutClient.js +106 -0
- package/dist/Client/PayoutGroupClient.d.ts +25 -0
- package/dist/Client/PayoutGroupClient.js +44 -0
- package/dist/Client/PayoutRecipientClient.d.ts +65 -0
- package/dist/Client/PayoutRecipientClient.js +132 -0
- package/dist/Client/RateClient.d.ts +25 -0
- package/dist/Client/RateClient.js +51 -0
- package/dist/Client/RefundClient.d.ts +92 -0
- package/dist/Client/RefundClient.js +207 -0
- package/dist/Client/SettlementClient.d.ts +36 -0
- package/dist/Client/SettlementClient.js +71 -0
- package/dist/Client/WalletClient.d.ts +13 -0
- package/dist/Client/WalletClient.js +27 -0
- package/dist/Client/index.d.ts +13 -0
- package/dist/Client/index.js +28 -0
- package/dist/Client.d.ts +445 -0
- package/dist/Client.js +685 -0
- package/dist/Config.d.ts +5 -0
- package/dist/Config.js +8 -0
- package/dist/Currency.d.ts +178 -0
- package/dist/Currency.js +193 -0
- package/dist/Env.d.ts +8 -0
- package/dist/Env.js +22 -0
- package/dist/Environment.d.ts +4 -0
- package/dist/Environment.js +9 -0
- package/dist/Exceptions/BitPayApiException.d.ts +13 -0
- package/dist/Exceptions/BitPayApiException.js +21 -0
- package/dist/Exceptions/BitPayException.d.ts +12 -0
- package/dist/Exceptions/BitPayException.js +17 -0
- package/dist/Exceptions/BitPayExceptionProvider.d.ts +14 -0
- package/dist/Exceptions/BitPayExceptionProvider.js +81 -0
- package/dist/Exceptions/BitPayGenericException.d.ts +4 -0
- package/dist/Exceptions/BitPayGenericException.js +9 -0
- package/dist/Exceptions/BitPayValidationException.d.ts +4 -0
- package/dist/Exceptions/BitPayValidationException.js +9 -0
- package/dist/Exceptions/index.d.ts +4 -0
- package/dist/Exceptions/index.js +24 -0
- package/dist/Facade.d.ts +5 -0
- package/dist/Facade.js +10 -0
- package/dist/Logger/BitPayLogger.d.ts +5 -0
- package/dist/Logger/BitPayLogger.js +3 -0
- package/dist/Logger/EmptyLogger.d.ts +6 -0
- package/dist/Logger/EmptyLogger.js +11 -0
- package/dist/Logger/LoggerProvider.d.ts +11 -0
- package/dist/Logger/LoggerProvider.js +23 -0
- package/dist/Logger/WinstonLoggerExample.d.ts +0 -0
- package/dist/Logger/WinstonLoggerExample.js +29 -0
- package/dist/Model/Bill/Bill.d.ts +58 -0
- package/dist/Model/Bill/Bill.js +30 -0
- package/dist/Model/Bill/Bill.zod.d.ts +93 -0
- package/dist/Model/Bill/Bill.zod.js +29 -0
- package/dist/Model/Bill/BillStatus.d.ts +5 -0
- package/dist/Model/Bill/BillStatus.js +9 -0
- package/dist/Model/Bill/Item.d.ts +13 -0
- package/dist/Model/Bill/Item.js +8 -0
- package/dist/Model/Bill/Item.zod.d.ts +17 -0
- package/dist/Model/Bill/Item.zod.js +11 -0
- package/dist/Model/Currency/Currency.d.ts +28 -0
- package/dist/Model/Currency/Currency.js +7 -0
- package/dist/Model/Currency/Currency.zod.d.ts +41 -0
- package/dist/Model/Currency/Currency.zod.js +19 -0
- package/dist/Model/Invoice/Buyer.d.ts +25 -0
- package/dist/Model/Invoice/Buyer.js +8 -0
- package/dist/Model/Invoice/Buyer.zod.d.ts +35 -0
- package/dist/Model/Invoice/Buyer.zod.js +17 -0
- package/dist/Model/Invoice/Invoice.d.ts +147 -0
- package/dist/Model/Invoice/Invoice.js +29 -0
- package/dist/Model/Invoice/Invoice.zod.d.ts +419 -0
- package/dist/Model/Invoice/Invoice.zod.js +74 -0
- package/dist/Model/Invoice/InvoiceBuyerProvidedInfo.d.ts +9 -0
- package/dist/Model/Invoice/InvoiceBuyerProvidedInfo.js +3 -0
- package/dist/Model/Invoice/InvoiceBuyerProvidedInfo.zod.d.ts +26 -0
- package/dist/Model/Invoice/InvoiceBuyerProvidedInfo.zod.js +14 -0
- package/dist/Model/Invoice/InvoiceEventToken.d.ts +12 -0
- package/dist/Model/Invoice/InvoiceEventToken.js +7 -0
- package/dist/Model/Invoice/InvoiceEventToken.zod.d.ts +17 -0
- package/dist/Model/Invoice/InvoiceEventToken.zod.js +11 -0
- package/dist/Model/Invoice/InvoiceRefundAddresses.d.ts +6 -0
- package/dist/Model/Invoice/InvoiceRefundAddresses.js +3 -0
- package/dist/Model/Invoice/InvoiceRefundAddresses.zod.d.ts +17 -0
- package/dist/Model/Invoice/InvoiceRefundAddresses.zod.js +11 -0
- package/dist/Model/Invoice/InvoiceStatus.d.ts +6 -0
- package/dist/Model/Invoice/InvoiceStatus.js +10 -0
- package/dist/Model/Invoice/InvoiceTransaction.d.ts +9 -0
- package/dist/Model/Invoice/InvoiceTransaction.js +3 -0
- package/dist/Model/Invoice/InvoiceTransaction.zod.d.ts +26 -0
- package/dist/Model/Invoice/InvoiceTransaction.zod.js +14 -0
- package/dist/Model/Invoice/InvoiceUniversalCodes.d.ts +4 -0
- package/dist/Model/Invoice/InvoiceUniversalCodes.js +3 -0
- package/dist/Model/Invoice/InvoiceUniversalCodes.zod.d.ts +11 -0
- package/dist/Model/Invoice/InvoiceUniversalCodes.zod.js +9 -0
- package/dist/Model/Invoice/MinerFeesItem.d.ts +5 -0
- package/dist/Model/Invoice/MinerFeesItem.js +3 -0
- package/dist/Model/Invoice/MinerFeesItem.zod.d.ts +14 -0
- package/dist/Model/Invoice/MinerFeesItem.zod.js +10 -0
- package/dist/Model/Invoice/Refund.d.ts +54 -0
- package/dist/Model/Invoice/Refund.js +12 -0
- package/dist/Model/Invoice/Refund.zod.d.ts +122 -0
- package/dist/Model/Invoice/Refund.zod.js +32 -0
- package/dist/Model/Invoice/RefundInfo.d.ts +5 -0
- package/dist/Model/Invoice/RefundInfo.js +3 -0
- package/dist/Model/Invoice/RefundInfo.zod.d.ts +14 -0
- package/dist/Model/Invoice/RefundInfo.zod.js +10 -0
- package/dist/Model/Invoice/RefundParams.d.ts +10 -0
- package/dist/Model/Invoice/RefundParams.js +3 -0
- package/dist/Model/Invoice/RefundParams.zod.d.ts +29 -0
- package/dist/Model/Invoice/RefundParams.zod.js +15 -0
- package/dist/Model/Invoice/RefundStatus.d.ts +3 -0
- package/dist/Model/Invoice/RefundStatus.js +7 -0
- package/dist/Model/Invoice/Shopper.d.ts +3 -0
- package/dist/Model/Invoice/Shopper.js +3 -0
- package/dist/Model/Invoice/Shopper.zod.d.ts +8 -0
- package/dist/Model/Invoice/Shopper.zod.js +8 -0
- package/dist/Model/Invoice/SupportedTransactionCurrency.d.ts +4 -0
- package/dist/Model/Invoice/SupportedTransactionCurrency.js +3 -0
- package/dist/Model/Invoice/SupportedTransactionCurrency.zod.d.ts +11 -0
- package/dist/Model/Invoice/SupportedTransactionCurrency.zod.js +9 -0
- package/dist/Model/Ledger/BuyerFields.d.ts +25 -0
- package/dist/Model/Ledger/BuyerFields.js +8 -0
- package/dist/Model/Ledger/BuyerFields.zod.d.ts +35 -0
- package/dist/Model/Ledger/BuyerFields.zod.js +17 -0
- package/dist/Model/Ledger/Ledger.d.ts +9 -0
- package/dist/Model/Ledger/Ledger.js +8 -0
- package/dist/Model/Ledger/Ledger.zod.d.ts +11 -0
- package/dist/Model/Ledger/Ledger.zod.js +9 -0
- package/dist/Model/Ledger/LedgerEntry.d.ts +34 -0
- package/dist/Model/Ledger/LedgerEntry.js +8 -0
- package/dist/Model/Ledger/LedgerEntry.zod.d.ts +102 -0
- package/dist/Model/Ledger/LedgerEntry.zod.js +22 -0
- package/dist/Model/Payout/Payout.d.ts +59 -0
- package/dist/Model/Payout/Payout.js +20 -0
- package/dist/Model/Payout/Payout.zod.d.ts +99 -0
- package/dist/Model/Payout/Payout.zod.js +31 -0
- package/dist/Model/Payout/PayoutGroup.d.ts +11 -0
- package/dist/Model/Payout/PayoutGroup.js +11 -0
- package/dist/Model/Payout/PayoutGroup.zod.d.ts +186 -0
- package/dist/Model/Payout/PayoutGroup.zod.js +11 -0
- package/dist/Model/Payout/PayoutGroupFailed.d.ts +10 -0
- package/dist/Model/Payout/PayoutGroupFailed.js +10 -0
- package/dist/Model/Payout/PayoutGroupFailed.zod.d.ts +14 -0
- package/dist/Model/Payout/PayoutGroupFailed.zod.js +10 -0
- package/dist/Model/Payout/PayoutRecipient.d.ts +29 -0
- package/dist/Model/Payout/PayoutRecipient.js +12 -0
- package/dist/Model/Payout/PayoutRecipient.zod.d.ts +29 -0
- package/dist/Model/Payout/PayoutRecipient.zod.js +15 -0
- package/dist/Model/Payout/PayoutRecipients.d.ts +17 -0
- package/dist/Model/Payout/PayoutRecipients.js +15 -0
- package/dist/Model/Payout/PayoutRecipients.zod.d.ts +59 -0
- package/dist/Model/Payout/PayoutRecipients.zod.js +11 -0
- package/dist/Model/Payout/PayoutStatus.d.ts +8 -0
- package/dist/Model/Payout/PayoutStatus.js +12 -0
- package/dist/Model/Payout/PayoutTransaction.d.ts +13 -0
- package/dist/Model/Payout/PayoutTransaction.js +8 -0
- package/dist/Model/Payout/PayoutTransaction.zod.d.ts +17 -0
- package/dist/Model/Payout/PayoutTransaction.zod.js +11 -0
- package/dist/Model/Payout/RecipientReferenceMethod.d.ts +3 -0
- package/dist/Model/Payout/RecipientReferenceMethod.js +7 -0
- package/dist/Model/Payout/RecipientStatus.d.ts +6 -0
- package/dist/Model/Payout/RecipientStatus.js +10 -0
- package/dist/Model/Rates/Rate.d.ts +5 -0
- package/dist/Model/Rates/Rate.js +3 -0
- package/dist/Model/Rates/Rate.zod.d.ts +14 -0
- package/dist/Model/Rates/Rate.zod.js +10 -0
- package/dist/Model/Rates/Rates.d.ts +11 -0
- package/dist/Model/Rates/Rates.js +40 -0
- package/dist/Model/Settlement/InvoiceData.d.ts +20 -0
- package/dist/Model/Settlement/InvoiceData.js +8 -0
- package/dist/Model/Settlement/InvoiceData.zod.d.ts +51 -0
- package/dist/Model/Settlement/InvoiceData.zod.js +15 -0
- package/dist/Model/Settlement/PayoutInfo.d.ts +53 -0
- package/dist/Model/Settlement/PayoutInfo.js +8 -0
- package/dist/Model/Settlement/PayoutInfo.zod.d.ts +77 -0
- package/dist/Model/Settlement/PayoutInfo.zod.js +31 -0
- package/dist/Model/Settlement/RefundInfo.d.ts +13 -0
- package/dist/Model/Settlement/RefundInfo.js +8 -0
- package/dist/Model/Settlement/RefundInfo.zod.d.ts +17 -0
- package/dist/Model/Settlement/RefundInfo.zod.js +11 -0
- package/dist/Model/Settlement/Settlement.d.ts +40 -0
- package/dist/Model/Settlement/Settlement.js +8 -0
- package/dist/Model/Settlement/Settlement.zod.d.ts +349 -0
- package/dist/Model/Settlement/Settlement.zod.js +26 -0
- package/dist/Model/Settlement/SettlementLedgerEntry.d.ts +18 -0
- package/dist/Model/Settlement/SettlementLedgerEntry.js +8 -0
- package/dist/Model/Settlement/SettlementLedgerEntry.zod.d.ts +98 -0
- package/dist/Model/Settlement/SettlementLedgerEntry.zod.js +14 -0
- package/dist/Model/Settlement/WithHoldings.d.ts +17 -0
- package/dist/Model/Settlement/WithHoldings.js +8 -0
- package/dist/Model/Settlement/WithHoldings.zod.d.ts +23 -0
- package/dist/Model/Settlement/WithHoldings.zod.js +13 -0
- package/dist/Model/Wallet/Currencies.d.ts +26 -0
- package/dist/Model/Wallet/Currencies.js +7 -0
- package/dist/Model/Wallet/Currencies.zod.d.ts +44 -0
- package/dist/Model/Wallet/Currencies.zod.js +16 -0
- package/dist/Model/Wallet/CurrencyQr.d.ts +13 -0
- package/dist/Model/Wallet/CurrencyQr.js +7 -0
- package/dist/Model/Wallet/CurrencyQr.zod.d.ts +11 -0
- package/dist/Model/Wallet/CurrencyQr.zod.js +9 -0
- package/dist/Model/Wallet/Wallet.d.ts +22 -0
- package/dist/Model/Wallet/Wallet.js +7 -0
- package/dist/Model/Wallet/Wallet.zod.d.ts +89 -0
- package/dist/Model/Wallet/Wallet.zod.js +14 -0
- package/dist/Model/Webhook/InvoiceBuyerFields.zod.d.ts +35 -0
- package/dist/Model/Webhook/InvoiceBuyerFields.zod.js +17 -0
- package/dist/Model/Webhook/InvoiceWebhook.d.ts +21 -0
- package/dist/Model/Webhook/InvoiceWebhook.js +3 -0
- package/dist/Model/Webhook/InvoiceWebhook.zod.d.ts +114 -0
- package/dist/Model/Webhook/InvoiceWebhook.zod.js +26 -0
- package/dist/Model/Webhook/InvoiceWebhookBuyerFields.d.ts +12 -0
- package/dist/Model/Webhook/InvoiceWebhookBuyerFields.js +3 -0
- package/dist/Model/Webhook/PayoutWebhook.d.ts +22 -0
- package/dist/Model/Webhook/PayoutWebhook.js +3 -0
- package/dist/Model/Webhook/PayoutWebhook.zod.d.ts +87 -0
- package/dist/Model/Webhook/PayoutWebhook.zod.js +27 -0
- package/dist/Model/Webhook/RefundWebhook.d.ts +21 -0
- package/dist/Model/Webhook/RefundWebhook.js +3 -0
- package/dist/Model/Webhook/RefundWebhook.zod.d.ts +62 -0
- package/dist/Model/Webhook/RefundWebhook.zod.js +26 -0
- package/dist/Model/index.d.ts +12 -0
- package/dist/Model/index.js +32 -0
- package/dist/PosToken.d.ts +13 -0
- package/dist/PosToken.js +21 -0
- package/dist/PrivateKey.d.ts +9 -0
- package/dist/PrivateKey.js +18 -0
- package/dist/TokenContainer.d.ts +39 -0
- package/dist/TokenContainer.js +71 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +46 -0
- package/dist/setup/BitPaySetup.d.ts +1 -0
- package/dist/setup/BitPaySetup.js +295 -0
- package/dist/util/BitPayResponseParser.d.ts +4 -0
- package/dist/util/BitPayResponseParser.js +67 -0
- package/dist/util/GuidGenerator.d.ts +3 -0
- package/dist/util/GuidGenerator.js +10 -0
- package/dist/util/KeyUtils.d.ts +12 -0
- package/dist/util/KeyUtils.js +47 -0
- package/dist/util/ParamsRemover.d.ts +3 -0
- package/dist/util/ParamsRemover.js +11 -0
- package/package.json +64 -0
@@ -0,0 +1,132 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.PayoutRecipientClient = void 0;
|
4
|
+
const BitPayResponseParser_1 = require("../util/BitPayResponseParser");
|
5
|
+
const BitPayExceptionProvider_1 = require("../Exceptions/BitPayExceptionProvider");
|
6
|
+
const index_1 = require("../index");
|
7
|
+
class PayoutRecipientClient {
|
8
|
+
constructor(bitPayClient, tokenContainer, guidGenerator) {
|
9
|
+
this.bitPayClient = bitPayClient;
|
10
|
+
this.tokenContainer = tokenContainer;
|
11
|
+
this.guidGenerator = guidGenerator;
|
12
|
+
}
|
13
|
+
/**
|
14
|
+
* Submit BitPay Payout Recipients.
|
15
|
+
*
|
16
|
+
* @param recipients A PayoutRecipients object with request parameters defined.
|
17
|
+
* @returns PayoutRecipients[] A list of BitPay PayoutRecipients objects.
|
18
|
+
* @throws BitPayApiException BitPayApiException class
|
19
|
+
* @throws BitPayGenericException BitPayGenericException class
|
20
|
+
*/
|
21
|
+
async submit(recipients) {
|
22
|
+
recipients.token = this.tokenContainer.getToken(index_1.Facade.Payout);
|
23
|
+
recipients.guid = recipients.guid ? recipients.guid : this.guidGenerator.execute();
|
24
|
+
const result = await this.bitPayClient.post('recipients', recipients, true);
|
25
|
+
try {
|
26
|
+
return JSON.parse(result);
|
27
|
+
}
|
28
|
+
catch (e) {
|
29
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Payout Recipient', e.message);
|
30
|
+
throw new Error();
|
31
|
+
}
|
32
|
+
}
|
33
|
+
/**
|
34
|
+
* Update a Payout Recipient.
|
35
|
+
*
|
36
|
+
* @param recipientId The recipient id for the recipient to be updated.
|
37
|
+
* @param recipient A PayoutRecipient object with updated parameters defined.
|
38
|
+
* @returns PayoutRecipient
|
39
|
+
* @throws BitPayApiException BitPayApiException class
|
40
|
+
* @throws BitPayGenericException BitPayGenericException class
|
41
|
+
*/
|
42
|
+
async update(recipientId, recipient) {
|
43
|
+
recipient.token = this.tokenContainer.getToken(index_1.Facade.Payout);
|
44
|
+
recipient.guid = recipient.guid ? recipient.guid : this.guidGenerator.execute();
|
45
|
+
const result = await this.bitPayClient.put('recipients/' + recipientId, recipient, true);
|
46
|
+
try {
|
47
|
+
return JSON.parse(result);
|
48
|
+
}
|
49
|
+
catch (e) {
|
50
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Payout Recipient', e.message);
|
51
|
+
throw new Error();
|
52
|
+
}
|
53
|
+
}
|
54
|
+
/**
|
55
|
+
* Retrieve a BitPay payout recipient by batch id using. The client must have been previously authorized for the payout facade.
|
56
|
+
*
|
57
|
+
* @param recipientId The id of the recipient to retrieve.
|
58
|
+
* @returns PayoutRecipient
|
59
|
+
* @throws BitPayApiException BitPayApiException class
|
60
|
+
* @throws BitPayGenericException BitPayGenericException class
|
61
|
+
*/
|
62
|
+
async get(recipientId) {
|
63
|
+
const params = { token: this.tokenContainer.getToken(index_1.Facade.Payout) };
|
64
|
+
const result = await this.bitPayClient.get('recipients/' + recipientId, params, true);
|
65
|
+
try {
|
66
|
+
return JSON.parse(result);
|
67
|
+
}
|
68
|
+
catch (e) {
|
69
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Payout Recipient', e.message);
|
70
|
+
throw new Error();
|
71
|
+
}
|
72
|
+
}
|
73
|
+
/**
|
74
|
+
* Retrieve a collection of BitPay Payout Recipients.
|
75
|
+
*
|
76
|
+
* @param params
|
77
|
+
* @returns PayoutRecipient[]
|
78
|
+
* @throws BitPayApiException BitPayApiException class
|
79
|
+
* @throws BitPayGenericException BitPayGenericException class
|
80
|
+
*/
|
81
|
+
async getByFilters(params) {
|
82
|
+
params['token'] = this.tokenContainer.getToken(index_1.Facade.Payout);
|
83
|
+
const result = await this.bitPayClient.get('recipients', params, true);
|
84
|
+
try {
|
85
|
+
return JSON.parse(result);
|
86
|
+
}
|
87
|
+
catch (e) {
|
88
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Payout Recipient', e.message);
|
89
|
+
throw new Error();
|
90
|
+
}
|
91
|
+
}
|
92
|
+
/**
|
93
|
+
* Delete a Payout Recipient.
|
94
|
+
*
|
95
|
+
* @param recipientId The recipient id for the recipient to be deleted.
|
96
|
+
* @returns boolean True if the recipient was successfully deleted, false otherwise.
|
97
|
+
* @throws BitPayApiException BitPayApiException class
|
98
|
+
* @throws BitPayGenericException BitPayGenericException class
|
99
|
+
*/
|
100
|
+
async delete(recipientId) {
|
101
|
+
const params = { token: this.tokenContainer.getToken(index_1.Facade.Payout) };
|
102
|
+
const result = await this.bitPayClient.delete('recipients/' + recipientId, params, true);
|
103
|
+
try {
|
104
|
+
return BitPayResponseParser_1.BitPayResponseParser.jsonToBoolean(result);
|
105
|
+
}
|
106
|
+
catch (e) {
|
107
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Payout Recipient', e.message);
|
108
|
+
throw new Error();
|
109
|
+
}
|
110
|
+
}
|
111
|
+
/**
|
112
|
+
* Notify BitPay Payout Recipient.
|
113
|
+
*
|
114
|
+
* @param recipientId The id of the recipient to notify.
|
115
|
+
* @returns boolean True if the notification was successfully sent, false otherwise.
|
116
|
+
* @throws BitPayApiException BitPayApiException class
|
117
|
+
* @throws BitPayGenericException BitPayGenericException class
|
118
|
+
*/
|
119
|
+
async requestNotification(recipientId) {
|
120
|
+
const params = { token: this.tokenContainer.getToken(index_1.Facade.Payout) };
|
121
|
+
const result = await this.bitPayClient.post('recipients/' + recipientId + '/notifications', params, true);
|
122
|
+
try {
|
123
|
+
return BitPayResponseParser_1.BitPayResponseParser.jsonToBoolean(result);
|
124
|
+
}
|
125
|
+
catch (e) {
|
126
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Payout Recipient', e.message);
|
127
|
+
throw new Error();
|
128
|
+
}
|
129
|
+
}
|
130
|
+
}
|
131
|
+
exports.PayoutRecipientClient = PayoutRecipientClient;
|
132
|
+
//# sourceMappingURL=PayoutRecipientClient.js.map
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { RateInterface, Rates } from '../Model';
|
2
|
+
import { BitPayClient } from './BitPayClient';
|
3
|
+
export declare class RateClient {
|
4
|
+
private bitPayClient;
|
5
|
+
constructor(bitPayClient: BitPayClient);
|
6
|
+
/**
|
7
|
+
* Retrieve the rate for a cryptocurrency / fiat pair
|
8
|
+
*
|
9
|
+
* @param baseCurrency The cryptocurrency for which you want to fetch the fiat-equivalent rate.
|
10
|
+
* @param currency The fiat currency for which you want to fetch the baseCurrency rate
|
11
|
+
* @returns Rate A Rate object populated with the currency rate for the requested baseCurrency.
|
12
|
+
* @throws BitPayGenericException BitPayGenericException class
|
13
|
+
* @throws BitPayApiException BitPayApiException class
|
14
|
+
*/
|
15
|
+
getRate(baseCurrency: string, currency: string): Promise<RateInterface>;
|
16
|
+
/**
|
17
|
+
* Retrieve the exchange rate table maintained by BitPay. See https://bitpay.com/bitcoin-exchange-rates.
|
18
|
+
*
|
19
|
+
* @param currency
|
20
|
+
* @returns Rates A Rates object populated with the currency rates for the requested baseCurrency.
|
21
|
+
* @throws BitPayGenericException BitPayGenericException class
|
22
|
+
* @throws BitPayApiException BitPayApiException class
|
23
|
+
*/
|
24
|
+
getRates(currency: string | null): Promise<Rates>;
|
25
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.RateClient = void 0;
|
4
|
+
const Model_1 = require("../Model");
|
5
|
+
const BitPayExceptionProvider_1 = require("../Exceptions/BitPayExceptionProvider");
|
6
|
+
class RateClient {
|
7
|
+
constructor(bitPayClient) {
|
8
|
+
this.bitPayClient = bitPayClient;
|
9
|
+
}
|
10
|
+
/**
|
11
|
+
* Retrieve the rate for a cryptocurrency / fiat pair
|
12
|
+
*
|
13
|
+
* @param baseCurrency The cryptocurrency for which you want to fetch the fiat-equivalent rate.
|
14
|
+
* @param currency The fiat currency for which you want to fetch the baseCurrency rate
|
15
|
+
* @returns Rate A Rate object populated with the currency rate for the requested baseCurrency.
|
16
|
+
* @throws BitPayGenericException BitPayGenericException class
|
17
|
+
* @throws BitPayApiException BitPayApiException class
|
18
|
+
*/
|
19
|
+
async getRate(baseCurrency, currency) {
|
20
|
+
const uri = currency ? 'rates/' + baseCurrency + '/' + currency : '/' + baseCurrency;
|
21
|
+
const result = await this.bitPayClient.get(uri, null, false);
|
22
|
+
try {
|
23
|
+
return JSON.parse(result);
|
24
|
+
}
|
25
|
+
catch (e) {
|
26
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Rate', e.message);
|
27
|
+
throw new Error();
|
28
|
+
}
|
29
|
+
}
|
30
|
+
/**
|
31
|
+
* Retrieve the exchange rate table maintained by BitPay. See https://bitpay.com/bitcoin-exchange-rates.
|
32
|
+
*
|
33
|
+
* @param currency
|
34
|
+
* @returns Rates A Rates object populated with the currency rates for the requested baseCurrency.
|
35
|
+
* @throws BitPayGenericException BitPayGenericException class
|
36
|
+
* @throws BitPayApiException BitPayApiException class
|
37
|
+
*/
|
38
|
+
async getRates(currency) {
|
39
|
+
const uri = currency ? 'rates/' + currency : 'rates';
|
40
|
+
const result = await this.bitPayClient.get(uri, null, false);
|
41
|
+
try {
|
42
|
+
return new Model_1.Rates(result);
|
43
|
+
}
|
44
|
+
catch (e) {
|
45
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Rate', e.message);
|
46
|
+
throw new Error();
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
exports.RateClient = RateClient;
|
51
|
+
//# sourceMappingURL=RateClient.js.map
|
@@ -0,0 +1,92 @@
|
|
1
|
+
import { BitPayClient } from './BitPayClient';
|
2
|
+
import { TokenContainer } from '../TokenContainer';
|
3
|
+
import { GuidGenerator } from '../util/GuidGenerator';
|
4
|
+
import { RefundInterface } from '../Model/Invoice/Refund';
|
5
|
+
export declare class RefundClient {
|
6
|
+
private bitPayClient;
|
7
|
+
private tokenContainer;
|
8
|
+
private guidGenerator;
|
9
|
+
constructor(bitPayClient: BitPayClient, tokenContainer: TokenContainer, guidGenerator: GuidGenerator);
|
10
|
+
/**
|
11
|
+
* Create a refund for a BitPay invoice.
|
12
|
+
*
|
13
|
+
* @param refund RefundInterface
|
14
|
+
* @returns Refund An updated Refund Object
|
15
|
+
* @throws RefundCreationException
|
16
|
+
*/
|
17
|
+
create(refund: RefundInterface): Promise<RefundInterface>;
|
18
|
+
/**
|
19
|
+
* Retrieve a previously made refund request on a BitPay invoice.
|
20
|
+
*
|
21
|
+
* @param refundId The BitPay refund ID.
|
22
|
+
* @returns Refund BitPay Refund object with the associated Refund object.
|
23
|
+
* @throws BitPayApiException BitPayApiException class
|
24
|
+
* @throws BitPayGenericException BitPayGenericException class
|
25
|
+
*/
|
26
|
+
get(refundId: string): Promise<RefundInterface>;
|
27
|
+
/**
|
28
|
+
* Retrieve a previously made refund request on a BitPay invoice by Guid.
|
29
|
+
*
|
30
|
+
* @param guid The BitPay GUID.
|
31
|
+
* @returns Refund BitPay Refund object with the associated Refund object.
|
32
|
+
* @throws BitPayApiException BitPayApiException class
|
33
|
+
* @throws BitPayGenericException BitPayGenericException class
|
34
|
+
*/
|
35
|
+
getByGuid(guid: string): Promise<RefundInterface>;
|
36
|
+
/**
|
37
|
+
* Retrieve a previously made refund request on a BitPay invoice by guid.
|
38
|
+
*
|
39
|
+
* @param invoiceId The BitPay refund Guid.
|
40
|
+
* @returns Refund BitPay Refund object with the associated Refund object.
|
41
|
+
* @throws BitPayApiException BitPayApiException class
|
42
|
+
* @throws BitPayGenericException BitPayGenericException class
|
43
|
+
*/
|
44
|
+
getRefunds(invoiceId: string): Promise<RefundInterface[]>;
|
45
|
+
/**
|
46
|
+
* Send a refund notification.
|
47
|
+
*
|
48
|
+
* @param refundId A BitPay refund ID.
|
49
|
+
* @returns boolean An updated Refund Object
|
50
|
+
* @throws BitPayApiException BitPayApiException class
|
51
|
+
* @throws BitPayGenericException BitPayGenericException class
|
52
|
+
*/
|
53
|
+
sendRefundNotification(refundId: string): Promise<boolean>;
|
54
|
+
/**
|
55
|
+
* Update the status of a BitPay invoice.
|
56
|
+
*
|
57
|
+
* @param refundId BitPay refund ID.
|
58
|
+
* @param status The new status for the refund to be updated.
|
59
|
+
* @returns Refund A BitPay generated Refund object.
|
60
|
+
* @throws BitPayApiException BitPayApiException class
|
61
|
+
* @throws BitPayGenericException BitPayGenericException class
|
62
|
+
*/
|
63
|
+
update(refundId: string, status: string): Promise<RefundInterface>;
|
64
|
+
/**
|
65
|
+
* Update the status of a BitPay invoice.
|
66
|
+
*
|
67
|
+
* @param guid BitPay refund Guid.
|
68
|
+
* @param status The new status for the refund to be updated.
|
69
|
+
* @returns Refund A BitPay generated Refund object.
|
70
|
+
* @throws BitPayApiException BitPayApiException class
|
71
|
+
* @throws BitPayGenericException BitPayGenericException class
|
72
|
+
*/
|
73
|
+
updateByGuid(guid: string, status: string): Promise<RefundInterface>;
|
74
|
+
/**
|
75
|
+
* Cancel a previously submitted refund request on a BitPay invoice.
|
76
|
+
*
|
77
|
+
* @param refundId The refund Id for the refund to be canceled.
|
78
|
+
* @returns Cancelled refund Object.
|
79
|
+
* @throws BitPayApiException BitPayApiException class
|
80
|
+
* @throws BitPayGenericException BitPayGenericException class
|
81
|
+
*/
|
82
|
+
cancel(refundId: string): Promise<RefundInterface>;
|
83
|
+
/**
|
84
|
+
* Cancel a previously submitted refund request on a BitPay invoice
|
85
|
+
*
|
86
|
+
* @param guid The refund Guid for the refund to be canceled.
|
87
|
+
* @returns Cancelled refund Object.
|
88
|
+
* @throws BitPayApiException BitPayApiException class
|
89
|
+
* @throws BitPayGenericException BitPayGenericException class
|
90
|
+
*/
|
91
|
+
cancelByGuid(guid: string): Promise<RefundInterface>;
|
92
|
+
}
|
@@ -0,0 +1,207 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.RefundClient = void 0;
|
4
|
+
const index_1 = require("../index");
|
5
|
+
const ParamsRemover_1 = require("../util/ParamsRemover");
|
6
|
+
const BitPayResponseParser_1 = require("../util/BitPayResponseParser");
|
7
|
+
const BitPayExceptionProvider_1 = require("../Exceptions/BitPayExceptionProvider");
|
8
|
+
class RefundClient {
|
9
|
+
constructor(bitPayClient, tokenContainer, guidGenerator) {
|
10
|
+
this.bitPayClient = bitPayClient;
|
11
|
+
this.tokenContainer = tokenContainer;
|
12
|
+
this.guidGenerator = guidGenerator;
|
13
|
+
}
|
14
|
+
/**
|
15
|
+
* Create a refund for a BitPay invoice.
|
16
|
+
*
|
17
|
+
* @param refund RefundInterface
|
18
|
+
* @returns Refund An updated Refund Object
|
19
|
+
* @throws RefundCreationException
|
20
|
+
*/
|
21
|
+
async create(refund) {
|
22
|
+
const params = {
|
23
|
+
token: this.tokenContainer.getToken(index_1.Facade.Merchant),
|
24
|
+
invoiceId: refund.invoice,
|
25
|
+
amount: refund.amount,
|
26
|
+
currency: refund.currency,
|
27
|
+
preview: refund.preview,
|
28
|
+
immediate: refund.immediate,
|
29
|
+
buyerPaysRefundFee: refund.buyerPaysRefundFee
|
30
|
+
};
|
31
|
+
params['guid'] = refund.guid ? refund.guid : this.guidGenerator.execute();
|
32
|
+
ParamsRemover_1.ParamsRemover.removeNullValuesFromObject(params);
|
33
|
+
const result = await this.bitPayClient.post('refunds', params, true);
|
34
|
+
try {
|
35
|
+
return JSON.parse(result);
|
36
|
+
}
|
37
|
+
catch (e) {
|
38
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Refund', e.message);
|
39
|
+
throw new Error();
|
40
|
+
}
|
41
|
+
}
|
42
|
+
/**
|
43
|
+
* Retrieve a previously made refund request on a BitPay invoice.
|
44
|
+
*
|
45
|
+
* @param refundId The BitPay refund ID.
|
46
|
+
* @returns Refund BitPay Refund object with the associated Refund object.
|
47
|
+
* @throws BitPayApiException BitPayApiException class
|
48
|
+
* @throws BitPayGenericException BitPayGenericException class
|
49
|
+
*/
|
50
|
+
async get(refundId) {
|
51
|
+
const params = { token: this.tokenContainer.getToken(index_1.Facade.Merchant) };
|
52
|
+
const result = await this.bitPayClient.get('refunds/' + refundId, params, true);
|
53
|
+
try {
|
54
|
+
return JSON.parse(result);
|
55
|
+
}
|
56
|
+
catch (e) {
|
57
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Refund', e.message);
|
58
|
+
throw new Error();
|
59
|
+
}
|
60
|
+
}
|
61
|
+
/**
|
62
|
+
* Retrieve a previously made refund request on a BitPay invoice by Guid.
|
63
|
+
*
|
64
|
+
* @param guid The BitPay GUID.
|
65
|
+
* @returns Refund BitPay Refund object with the associated Refund object.
|
66
|
+
* @throws BitPayApiException BitPayApiException class
|
67
|
+
* @throws BitPayGenericException BitPayGenericException class
|
68
|
+
*/
|
69
|
+
async getByGuid(guid) {
|
70
|
+
const params = { token: this.tokenContainer.getToken(index_1.Facade.Merchant) };
|
71
|
+
const result = await this.bitPayClient.get('refunds/guid/' + guid, params, true);
|
72
|
+
try {
|
73
|
+
return JSON.parse(result);
|
74
|
+
}
|
75
|
+
catch (e) {
|
76
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Refund', e.message);
|
77
|
+
throw new Error();
|
78
|
+
}
|
79
|
+
}
|
80
|
+
/**
|
81
|
+
* Retrieve a previously made refund request on a BitPay invoice by guid.
|
82
|
+
*
|
83
|
+
* @param invoiceId The BitPay refund Guid.
|
84
|
+
* @returns Refund BitPay Refund object with the associated Refund object.
|
85
|
+
* @throws BitPayApiException BitPayApiException class
|
86
|
+
* @throws BitPayGenericException BitPayGenericException class
|
87
|
+
*/
|
88
|
+
async getRefunds(invoiceId) {
|
89
|
+
const params = {
|
90
|
+
token: this.tokenContainer.getToken(index_1.Facade.Merchant),
|
91
|
+
invoiceId: invoiceId
|
92
|
+
};
|
93
|
+
const result = await this.bitPayClient.get('refunds', params, true);
|
94
|
+
try {
|
95
|
+
return JSON.parse(result);
|
96
|
+
}
|
97
|
+
catch (e) {
|
98
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Refund', e.message);
|
99
|
+
throw new Error();
|
100
|
+
}
|
101
|
+
}
|
102
|
+
/**
|
103
|
+
* Send a refund notification.
|
104
|
+
*
|
105
|
+
* @param refundId A BitPay refund ID.
|
106
|
+
* @returns boolean An updated Refund Object
|
107
|
+
* @throws BitPayApiException BitPayApiException class
|
108
|
+
* @throws BitPayGenericException BitPayGenericException class
|
109
|
+
*/
|
110
|
+
async sendRefundNotification(refundId) {
|
111
|
+
const params = { token: this.tokenContainer.getToken(index_1.Facade.Merchant) };
|
112
|
+
const result = await this.bitPayClient.post('refunds/' + refundId + '/notifications', params, true);
|
113
|
+
try {
|
114
|
+
return BitPayResponseParser_1.BitPayResponseParser.jsonToBoolean(result);
|
115
|
+
}
|
116
|
+
catch (e) {
|
117
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Refund', e.message);
|
118
|
+
throw new Error();
|
119
|
+
}
|
120
|
+
}
|
121
|
+
/**
|
122
|
+
* Update the status of a BitPay invoice.
|
123
|
+
*
|
124
|
+
* @param refundId BitPay refund ID.
|
125
|
+
* @param status The new status for the refund to be updated.
|
126
|
+
* @returns Refund A BitPay generated Refund object.
|
127
|
+
* @throws BitPayApiException BitPayApiException class
|
128
|
+
* @throws BitPayGenericException BitPayGenericException class
|
129
|
+
*/
|
130
|
+
async update(refundId, status) {
|
131
|
+
const params = {
|
132
|
+
token: this.tokenContainer.getToken(index_1.Facade.Merchant),
|
133
|
+
status: status
|
134
|
+
};
|
135
|
+
const result = await this.bitPayClient.put('refunds/' + refundId, params, true);
|
136
|
+
try {
|
137
|
+
return JSON.parse(result);
|
138
|
+
}
|
139
|
+
catch (e) {
|
140
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Refund', e.message);
|
141
|
+
throw new Error();
|
142
|
+
}
|
143
|
+
}
|
144
|
+
/**
|
145
|
+
* Update the status of a BitPay invoice.
|
146
|
+
*
|
147
|
+
* @param guid BitPay refund Guid.
|
148
|
+
* @param status The new status for the refund to be updated.
|
149
|
+
* @returns Refund A BitPay generated Refund object.
|
150
|
+
* @throws BitPayApiException BitPayApiException class
|
151
|
+
* @throws BitPayGenericException BitPayGenericException class
|
152
|
+
*/
|
153
|
+
async updateByGuid(guid, status) {
|
154
|
+
const params = {
|
155
|
+
token: this.tokenContainer.getToken(index_1.Facade.Merchant),
|
156
|
+
status: status
|
157
|
+
};
|
158
|
+
const result = await this.bitPayClient.put('refunds/guid/' + guid, params, true);
|
159
|
+
try {
|
160
|
+
return JSON.parse(result);
|
161
|
+
}
|
162
|
+
catch (e) {
|
163
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Refund', e.message);
|
164
|
+
throw new Error();
|
165
|
+
}
|
166
|
+
}
|
167
|
+
/**
|
168
|
+
* Cancel a previously submitted refund request on a BitPay invoice.
|
169
|
+
*
|
170
|
+
* @param refundId The refund Id for the refund to be canceled.
|
171
|
+
* @returns Cancelled refund Object.
|
172
|
+
* @throws BitPayApiException BitPayApiException class
|
173
|
+
* @throws BitPayGenericException BitPayGenericException class
|
174
|
+
*/
|
175
|
+
async cancel(refundId) {
|
176
|
+
const params = { token: this.tokenContainer.getToken(index_1.Facade.Merchant) };
|
177
|
+
const result = await this.bitPayClient.delete('refunds/' + refundId, params, true);
|
178
|
+
try {
|
179
|
+
return JSON.parse(result);
|
180
|
+
}
|
181
|
+
catch (e) {
|
182
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Refund', e.message);
|
183
|
+
throw new Error();
|
184
|
+
}
|
185
|
+
}
|
186
|
+
/**
|
187
|
+
* Cancel a previously submitted refund request on a BitPay invoice
|
188
|
+
*
|
189
|
+
* @param guid The refund Guid for the refund to be canceled.
|
190
|
+
* @returns Cancelled refund Object.
|
191
|
+
* @throws BitPayApiException BitPayApiException class
|
192
|
+
* @throws BitPayGenericException BitPayGenericException class
|
193
|
+
*/
|
194
|
+
async cancelByGuid(guid) {
|
195
|
+
const params = { token: this.tokenContainer.getToken(index_1.Facade.Merchant) };
|
196
|
+
const result = await this.bitPayClient.delete('refunds/guid/' + guid, params, true);
|
197
|
+
try {
|
198
|
+
return JSON.parse(result);
|
199
|
+
}
|
200
|
+
catch (e) {
|
201
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Refund', e.message);
|
202
|
+
throw new Error();
|
203
|
+
}
|
204
|
+
}
|
205
|
+
}
|
206
|
+
exports.RefundClient = RefundClient;
|
207
|
+
//# sourceMappingURL=RefundClient.js.map
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { BitPayClient } from './BitPayClient';
|
2
|
+
import { TokenContainer } from '../TokenContainer';
|
3
|
+
import { SettlementInterface } from '../Model/Settlement/Settlement';
|
4
|
+
export declare class SettlementClient {
|
5
|
+
private bitPayClient;
|
6
|
+
private tokenContainer;
|
7
|
+
constructor(bitPayClient: BitPayClient, tokenContainer: TokenContainer);
|
8
|
+
/**
|
9
|
+
* Retrieves a summary of the specified settlement.
|
10
|
+
*
|
11
|
+
* @param settlementId Settlement Id
|
12
|
+
* @returns Settlement
|
13
|
+
* @throws BitPayApiException BitPayApiException class
|
14
|
+
* @throws BitPayGenericException BitPayGenericException class
|
15
|
+
*/
|
16
|
+
get(settlementId: string): Promise<SettlementInterface>;
|
17
|
+
/**
|
18
|
+
* Retrieves settlement reports for the calling merchant filtered by query.
|
19
|
+
*
|
20
|
+
* @param params
|
21
|
+
* @returns Settlement[]
|
22
|
+
* @throws BitPayApiException BitPayApiException class
|
23
|
+
* @throws BitPayGenericException BitPayGenericException class
|
24
|
+
*/
|
25
|
+
getSettlements(params: object): Promise<SettlementInterface[]>;
|
26
|
+
/**
|
27
|
+
* Gets a detailed reconciliation report of the activity within the settlement period.
|
28
|
+
*
|
29
|
+
* @param settlementId
|
30
|
+
* @param token
|
31
|
+
* @returns Settlement
|
32
|
+
* @throws BitPayApiException BitPayApiException class
|
33
|
+
* @throws BitPayGenericException BitPayGenericException class
|
34
|
+
*/
|
35
|
+
getReconciliationReport(settlementId: string, token: string): Promise<SettlementInterface>;
|
36
|
+
}
|
@@ -0,0 +1,71 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.SettlementClient = void 0;
|
4
|
+
const index_1 = require("../index");
|
5
|
+
const BitPayExceptionProvider_1 = require("../Exceptions/BitPayExceptionProvider");
|
6
|
+
class SettlementClient {
|
7
|
+
constructor(bitPayClient, tokenContainer) {
|
8
|
+
this.bitPayClient = bitPayClient;
|
9
|
+
this.tokenContainer = tokenContainer;
|
10
|
+
}
|
11
|
+
/**
|
12
|
+
* Retrieves a summary of the specified settlement.
|
13
|
+
*
|
14
|
+
* @param settlementId Settlement Id
|
15
|
+
* @returns Settlement
|
16
|
+
* @throws BitPayApiException BitPayApiException class
|
17
|
+
* @throws BitPayGenericException BitPayGenericException class
|
18
|
+
*/
|
19
|
+
async get(settlementId) {
|
20
|
+
const params = { token: this.tokenContainer.getToken(index_1.Facade.Merchant) };
|
21
|
+
try {
|
22
|
+
const result = await this.bitPayClient.get('settlements/' + settlementId, params, true);
|
23
|
+
return JSON.parse(result);
|
24
|
+
}
|
25
|
+
catch (e) {
|
26
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Settlement', e.message);
|
27
|
+
throw new Error();
|
28
|
+
}
|
29
|
+
}
|
30
|
+
/**
|
31
|
+
* Retrieves settlement reports for the calling merchant filtered by query.
|
32
|
+
*
|
33
|
+
* @param params
|
34
|
+
* @returns Settlement[]
|
35
|
+
* @throws BitPayApiException BitPayApiException class
|
36
|
+
* @throws BitPayGenericException BitPayGenericException class
|
37
|
+
*/
|
38
|
+
async getSettlements(params) {
|
39
|
+
params['token'] = this.tokenContainer.getToken(index_1.Facade.Merchant);
|
40
|
+
const result = await this.bitPayClient.get('settlements', params, true);
|
41
|
+
try {
|
42
|
+
return JSON.parse(result);
|
43
|
+
}
|
44
|
+
catch (e) {
|
45
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Settlement', e.message);
|
46
|
+
throw new Error();
|
47
|
+
}
|
48
|
+
}
|
49
|
+
/**
|
50
|
+
* Gets a detailed reconciliation report of the activity within the settlement period.
|
51
|
+
*
|
52
|
+
* @param settlementId
|
53
|
+
* @param token
|
54
|
+
* @returns Settlement
|
55
|
+
* @throws BitPayApiException BitPayApiException class
|
56
|
+
* @throws BitPayGenericException BitPayGenericException class
|
57
|
+
*/
|
58
|
+
async getReconciliationReport(settlementId, token) {
|
59
|
+
const params = { token: token };
|
60
|
+
const result = await this.bitPayClient.get('settlements/' + settlementId + '/reconciliationReport', params, true);
|
61
|
+
try {
|
62
|
+
return JSON.parse(result);
|
63
|
+
}
|
64
|
+
catch (e) {
|
65
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Settlement', e.message);
|
66
|
+
throw new Error();
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
exports.SettlementClient = SettlementClient;
|
71
|
+
//# sourceMappingURL=SettlementClient.js.map
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { BitPayClient } from './BitPayClient';
|
2
|
+
import { WalletInterface } from '../Model/Wallet/Wallet';
|
3
|
+
export declare class WalletClient {
|
4
|
+
private bitPayClient;
|
5
|
+
constructor(bitPayClient: BitPayClient);
|
6
|
+
/**
|
7
|
+
* Retrieve all supported wallets.
|
8
|
+
*
|
9
|
+
* @returns Wallet[]
|
10
|
+
* @throws WalletQueryException
|
11
|
+
*/
|
12
|
+
getSupportedWallets(): Promise<WalletInterface[]>;
|
13
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.WalletClient = void 0;
|
4
|
+
const BitPayExceptionProvider_1 = require("../Exceptions/BitPayExceptionProvider");
|
5
|
+
class WalletClient {
|
6
|
+
constructor(bitPayClient) {
|
7
|
+
this.bitPayClient = bitPayClient;
|
8
|
+
}
|
9
|
+
/**
|
10
|
+
* Retrieve all supported wallets.
|
11
|
+
*
|
12
|
+
* @returns Wallet[]
|
13
|
+
* @throws WalletQueryException
|
14
|
+
*/
|
15
|
+
async getSupportedWallets() {
|
16
|
+
const result = await this.bitPayClient.get('supportedwallets', null, false);
|
17
|
+
try {
|
18
|
+
return JSON.parse(result);
|
19
|
+
}
|
20
|
+
catch (e) {
|
21
|
+
BitPayExceptionProvider_1.BitPayExceptionProvider.throwDeserializeResourceException('Wallet', e.message);
|
22
|
+
throw new Error();
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
exports.WalletClient = WalletClient;
|
27
|
+
//# sourceMappingURL=WalletClient.js.map
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { BillClient } from './BillClient';
|
2
|
+
import { BitPayClient } from './BitPayClient';
|
3
|
+
import { CurrencyClient } from './CurrencyClient';
|
4
|
+
import { InvoiceClient } from './InvoiceClient';
|
5
|
+
import { LedgerClient } from './LedgerClient';
|
6
|
+
import { PayoutClient } from './PayoutClient';
|
7
|
+
import { PayoutGroupClient } from './PayoutGroupClient';
|
8
|
+
import { PayoutRecipientClient } from './PayoutRecipientClient';
|
9
|
+
import { RateClient } from './RateClient';
|
10
|
+
import { RefundClient } from './RefundClient';
|
11
|
+
import { SettlementClient } from './SettlementClient';
|
12
|
+
import { WalletClient } from './WalletClient';
|
13
|
+
export { BillClient, BitPayClient, CurrencyClient, InvoiceClient, LedgerClient, PayoutClient, PayoutGroupClient, PayoutRecipientClient, RateClient, RefundClient, SettlementClient, WalletClient };
|