-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from peoray/accounts-methods
Accounts methods
- Loading branch information
Showing
18 changed files
with
713 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Bloc, IUpdateAccountRequest } from '../../dist' | ||
|
||
const bloc = new Bloc('secret-keyasfasfbahfb', 'public-key') | ||
|
||
const closeAccount = async () => { | ||
try { | ||
const data: IUpdateAccountRequest = { | ||
reason: 'bad kyc details', | ||
} | ||
const response = await bloc.closeAccount('account-id', data) | ||
console.log(response) | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} | ||
|
||
closeAccount() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Bloc, ICreateCollectionAccountRequest } from '../../dist' | ||
|
||
const bloc = new Bloc('secret-keyasfasfbahfb', 'public-key') | ||
|
||
const createCollectionAccount = async () => { | ||
try { | ||
const data: ICreateCollectionAccountRequest = { | ||
preferred_bank: 'Providus', | ||
alias: 'Business', | ||
collection_rules: { | ||
amount: 30000, | ||
frequency: 2, | ||
}, | ||
} | ||
const response = await bloc.createCollectionAccount(data) | ||
console.log(response) | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} | ||
|
||
createCollectionAccount() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Bloc, ICreateFixedAccountRequest } from '../../dist' | ||
|
||
const bloc = new Bloc('secret-keyasfasfbahfb', 'public-key') | ||
|
||
const createFixedAccount = async () => { | ||
try { | ||
const data: ICreateFixedAccountRequest = { | ||
customer_id: '64c9e81497880d4b259cec77', | ||
preferred_bank: 'Banc Corp', | ||
alias: 'business', | ||
collection_rules: { | ||
amount: 30000, | ||
frequency: 2, | ||
}, | ||
} | ||
const response = await bloc.createFixedAccount(data) | ||
console.log(response) | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} | ||
|
||
createFixedAccount() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Bloc, IUpdateAccountRequest } from '../../dist' | ||
|
||
const bloc = new Bloc('secret-keyasfasfbahfb', 'public-key') | ||
|
||
const freezeAccount = async () => { | ||
try { | ||
const data: IUpdateAccountRequest = { | ||
reason: 'bad kyc details', | ||
} | ||
const response = await bloc.freezeAccount('account-id', data) | ||
console.log(response) | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} | ||
|
||
freezeAccount() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Bloc } from '../../dist' | ||
|
||
const bloc = new Bloc('secret-keyasfasfbahfb', 'public-key') | ||
|
||
const getAccountByAccountNumber = async () => { | ||
try { | ||
const response = await bloc.getAccountByAccountNumber('account-id') | ||
console.log(response) | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} | ||
|
||
getAccountByAccountNumber() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Bloc } from '../../dist' | ||
|
||
const bloc = new Bloc('secret-keyasfasfbahfb', 'public-key') | ||
|
||
const getAccountById = async () => { | ||
try { | ||
const response = await bloc.getAccountById('account-id') | ||
console.log(response) | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} | ||
|
||
getAccountById() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Bloc } from '../../dist' | ||
|
||
const bloc = new Bloc('secret-keyasfasfbahfb', 'public-key') | ||
|
||
const getAccounts = async () => { | ||
try { | ||
const response = await bloc.getAccounts() | ||
console.log(response) | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} | ||
|
||
getAccounts() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Bloc } from '../../dist' | ||
|
||
const bloc = new Bloc('secret-keyasfasfbahfb', 'public-key') | ||
|
||
const getCollectionAccount = async () => { | ||
try { | ||
const response = await bloc.getCollectionAccount() | ||
console.log(response) | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} | ||
|
||
getCollectionAccount() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Bloc } from '../../dist' | ||
|
||
const bloc = new Bloc('secret-keyasfasfbahfb', 'public-key') | ||
|
||
const getCustomerAccounts = async () => { | ||
try { | ||
const response = await bloc.getCustomerAccounts('customer-id') | ||
console.log(response) | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} | ||
|
||
getCustomerAccounts() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Bloc } from '../../dist' | ||
|
||
const bloc = new Bloc('secret-keyasfasfbahfb', 'public-key') | ||
|
||
const getOrganisationDefaultAccounts = async () => { | ||
try { | ||
const response = await bloc.getOrganisationDefaultAccounts() | ||
console.log(response) | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} | ||
|
||
getOrganisationDefaultAccounts() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Bloc, IUpdateAccountRequest } from '../../dist' | ||
|
||
const bloc = new Bloc('secret-keyasfasfbahfb', 'public-key') | ||
|
||
const reopenAccount = async () => { | ||
try { | ||
const data: IUpdateAccountRequest = { | ||
reason: 'bad kyc details', | ||
} | ||
const response = await bloc.reopenAccount('account-id', data) | ||
console.log(response) | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} | ||
|
||
reopenAccount() |
Oops, something went wrong.