@robobanky/adaptors
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -15,3 +15,4 @@ import { BankAccount, CashAccount, EntityId, Jar, PaymentTx } from '../../robobanky'; | ||
listAccountWebhooks(bankAccount: BankAccount): Promise<any>; | ||
deleteBankAccountWebhook(webhookId: string): Promise<any>; | ||
} | ||
export { MonzoAdaptor }; |
@@ -106,2 +106,4 @@ "use strict"; | ||
try { | ||
const { cashAccountId, externalId } = bankAccount; | ||
console.info(`MonzoAdaptor.createAccountWebhook customerId: ${customerId}, bankAccount: ${cashAccountId} ${externalId}`); | ||
const response = await axiosInstance({ | ||
@@ -111,4 +113,4 @@ method: 'post', | ||
data: qs_1.default.stringify({ | ||
account_id: bankAccount.externalId, | ||
url: `${this.robobankyApiBaseUrl}/providers-webhooks/monzo/${customerId}/${bankAccount.cashAccountId}`, | ||
account_id: externalId, | ||
url: `${this.robobankyApiBaseUrl}/providers-webhooks/monzo/${customerId}/${cashAccountId}`, | ||
}), | ||
@@ -136,3 +138,17 @@ headers: { | ||
} | ||
async deleteBankAccountWebhook(webhookId) { | ||
console.info('MonzoAdaptor.deleteBankAccountWebhook', webhookId); | ||
if (!webhookId) { | ||
throw new robobanky_1.BadParamsException('webhookId', webhookId); | ||
} | ||
try { | ||
console.info(`MonzoAdaptor.deleteAccountWebhook bankAccount: ${webhookId}`); | ||
const response = await axiosInstance.delete(`webhooks/${webhookId}`); | ||
return true; | ||
} | ||
catch (error) { | ||
console.error('MonzoAdaptor.deleteBankAccountWebhook', error); | ||
} | ||
} | ||
} | ||
exports.MonzoAdaptor = MonzoAdaptor; |
{ | ||
"name": "@robobanky/adaptors", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "src/index.ts", |
@@ -157,2 +157,6 @@ import axios, { AxiosError, AxiosInstance, AxiosResponse } from 'axios' | ||
try { | ||
const { cashAccountId, externalId } = bankAccount | ||
console.info( | ||
`MonzoAdaptor.createAccountWebhook customerId: ${customerId}, bankAccount: ${cashAccountId} ${externalId}` | ||
) | ||
const response = await axiosInstance({ | ||
@@ -162,4 +166,4 @@ method: 'post', | ||
data: qs.stringify({ | ||
account_id: bankAccount.externalId, | ||
url: `${this.robobankyApiBaseUrl}/providers-webhooks/monzo/${customerId}/${bankAccount.cashAccountId}`, | ||
account_id: externalId, | ||
url: `${this.robobankyApiBaseUrl}/providers-webhooks/monzo/${customerId}/${cashAccountId}`, | ||
}), | ||
@@ -186,4 +190,21 @@ headers: { | ||
} | ||
async deleteBankAccountWebhook(webhookId: string): Promise<any> { | ||
console.info('MonzoAdaptor.deleteBankAccountWebhook', webhookId) | ||
if (!webhookId) { | ||
throw new BadParamsException('webhookId', webhookId) | ||
} | ||
try { | ||
console.info(`MonzoAdaptor.deleteAccountWebhook bankAccount: ${webhookId}`) | ||
const response = await axiosInstance.delete(`webhooks/${webhookId}`) | ||
return true | ||
} catch (error) { | ||
console.error('MonzoAdaptor.deleteBankAccountWebhook', error) | ||
} | ||
} | ||
} | ||
export { MonzoAdaptor } |
70454
1637