-
Notifications
You must be signed in to change notification settings - Fork 16
feature/typescript-corporate-resource #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
luistarkbank
wants to merge
9
commits into
master
Choose a base branch
from
feature/Add-typeScrpit-resource
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cb840d6
Add corporateBalance
luistarkbank b0da45b
Add corporate Resources to Types
luistarkbank 75f6acf
Add corporate Resource to types
luistarkbank 04b6b6d
Add corporate resource to typeScript
luistarkbank 9d90891
Add types corporate resource
luistarkbank 9a1ed2f
Add types Corporate resource
luistarkbank d71da5c
Add types corporate resource
luistarkbank bfb2d4d
Add types corporate resource
luistarkbank 76f4ca2
Fix page functions doc string
luistarkbank File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -15,11 +15,11 @@ class Permission extends SubResource { | |
| * @param ownerType [string, default null]: owner type. ex: "project" | ||
| * | ||
| * Attributes (return only): | ||
| * @return ownerEmail [string]: email address of the owner. ex: "[email protected] | ||
| * @return ownerName [string]: name of the owner. ex: "Tony Stark" | ||
| * @return ownerPictureUrl [string]: Profile picture Url of the owner. ex: "https://storage.googleapis.com/api-ms-workspace-sbx.appspot.com/pictures/member/6227829385592832?20230404164942" | ||
| * @return ownerStatus [string]: current owner status. ex: "active", "blocked", "canceled" | ||
| * @return created [string]: creation datetime for the Permission. ex: '2020-03-10 10:30:00.000' | ||
| * @param ownerEmail [string]: email address of the owner. ex: "[email protected] | ||
| * @param ownerName [string]: name of the owner. ex: "Tony Stark" | ||
| * @param ownerPictureUrl [string]: Profile picture Url of the owner. ex: "https://storage.googleapis.com/api-ms-workspace-sbx.appspot.com/pictures/member/6227829385592832?20230404164942" | ||
| * @param ownerStatus [string]: current owner status. ex: "active", "blocked", "canceled" | ||
| * @param created [string]: creation datetime for the Permission. ex: '2020-03-10 10:30:00.000' | ||
| * | ||
| */ | ||
|
|
||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 @@ | ||
| ///<reference types="../types/" /> | ||
|
|
||
| import starkbank from "starkbank"; | ||
| import assert from 'assert'; | ||
|
|
||
| starkbank.user = require('./utils/user').exampleProject; | ||
|
|
||
| describe('TestCorporateBalanceGet', function(){ | ||
| jest.setTimeout(10000); | ||
| it('test_success', async () => { | ||
| let balance = await starkbank.corporateBalance.get(); | ||
| assert(typeof balance.amount == 'number'); | ||
| }); | ||
| }); |
This file contains hidden or 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,68 @@ | ||
| ///<reference types="../types/" /> | ||
|
|
||
| import starkbank from "starkbank"; | ||
| import assert from 'assert'; | ||
|
|
||
| starkbank.user = require('./utils/user').exampleProject; | ||
|
|
||
| describe('TestCorporateCardCreate', function(){ | ||
| jest.setTimeout(10000); | ||
| it('test_success', async () => { | ||
|
|
||
| let holders = await starkbank.corporateHolder.query({ limit: 1 }); | ||
| for await (let holder of holders) { | ||
| let card = await starkbank.corporateCard.create( | ||
| new starkbank.CorporateCard( | ||
| { | ||
| holderId: holder.id | ||
| } | ||
| ), {"expand": ["rules", "securityCode", "number", "expiration"]} | ||
| ); | ||
| assert(card.securityCode != '***'); | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| describe('TestCorporateCardGet', function(){ | ||
| jest.setTimeout(10000); | ||
| it('test_success', async () => { | ||
| let cards = await starkbank.corporateCard.query({ limit: 1 }); | ||
| for await (let card of cards) { | ||
| card = await starkbank.corporateCard.get(card.id) | ||
| assert(typeof card.id == 'string') | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| describe('TestCorporateCardQuery', function(){ | ||
| jest.setTimeout(10000); | ||
| it('test_success', async () => { | ||
| let i = 0; | ||
| let cards = await starkbank.corporateCard.query({ limit: 5 }); | ||
| for await (let card of cards) { | ||
| assert(typeof card.id == 'string'); | ||
| i += 1; | ||
| } | ||
| assert(i === 5); | ||
| }); | ||
| }); | ||
|
|
||
| describe('TestCorporateCardPage', function(){ | ||
| jest.setTimeout(10000); | ||
| it('test_success', async () => { | ||
| let ids: string[] = []; | ||
| let cursor: string | null = null; | ||
| let page: starkbank.CorporateCard[] | null = null; | ||
| for (let i = 0; i < 2; i++) { | ||
| [page, cursor] = await starkbank.corporateCard.page({ limit: 5, cursor: cursor }); | ||
| for (let entity of page) { | ||
| assert(!ids.includes(entity.id)); | ||
| ids.push(entity.id); | ||
| } | ||
| if (cursor == null) { | ||
| break; | ||
| } | ||
| } | ||
| assert(ids.length == 10); | ||
| }); | ||
| }); |
This file contains hidden or 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,50 @@ | ||
| ///<reference types="../types/" /> | ||
|
|
||
| import starkbank from "starkbank"; | ||
| import assert from 'assert'; | ||
|
|
||
| starkbank.user = require('./utils/user').exampleProject; | ||
|
|
||
| describe('TestCorporateCardGet', function(){ | ||
| jest.setTimeout(10000); | ||
| it('test_success', async () => { | ||
| let cards = await starkbank.corporateCard.log.query({ limit: 1 }); | ||
| for await (let card of cards) { | ||
| card = await starkbank.corporateCard.log.get(card.id) | ||
| assert(typeof card.id == 'string') | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| describe('TestCorporateCardQuery', function(){ | ||
| jest.setTimeout(10000); | ||
| it('test_success', async () => { | ||
| let i = 0; | ||
| let cards = await starkbank.corporateCard.log.query({ limit: 5 }); | ||
| for await (let card of cards) { | ||
| assert(typeof card.id == 'string'); | ||
| i += 1; | ||
| } | ||
| assert(i === 5); | ||
| }); | ||
| }); | ||
|
|
||
| describe('TestCorporateCardPage', function(){ | ||
| jest.setTimeout(10000); | ||
| it('test_success', async () => { | ||
| let ids: string[] = []; | ||
| let cursor: string | null = null; | ||
| let page: starkbank.CorporateCard[] | null = null; | ||
| for (let i = 0; i < 2; i++) { | ||
| [page, cursor] = await starkbank.corporateCard.log.page({ limit: 5, cursor: cursor }); | ||
| for (let entity of page) { | ||
| assert(!ids.includes(entity.id)); | ||
| ids.push(entity.id); | ||
| } | ||
| if (cursor == null) { | ||
| break; | ||
| } | ||
| } | ||
| assert(ids.length == 10); | ||
| }); | ||
| }); |
This file contains hidden or 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,53 @@ | ||
| ///<reference types="../types/" /> | ||
|
|
||
| import starkbank, { corporateHolder } from "starkbank"; | ||
| import assert from 'assert'; | ||
| const random = require('./utils/random.js').random; | ||
|
|
||
| starkbank.user = require('./utils/user').exampleProject; | ||
|
|
||
| describe('TestCorporateHolderCreateAndUpdate', function(){ | ||
| it('test_success', async () => { | ||
| let holder = await starkbank.corporateHolder.create( | ||
| [new starkbank.CorporateHolder({ | ||
| name: "Test - " + 1025425, | ||
| permissions: [new starkbank.corporateHolder.Permission({ ownerType: "project", ownerId: process.env.SANDBOX_ID })], | ||
| rules: [new starkbank.CorporateRule({ name: "Travel", amount: 200000 })] | ||
| }) | ||
| ]); | ||
|
|
||
| let holderId = holder[0].id | ||
| assert(typeof holderId == 'string'); | ||
| holder = await starkbank.corporateHolder.update(holderId, { status: "blocked" }); | ||
| assert(typeof holder.id == 'string'); | ||
| }); | ||
| }); | ||
|
|
||
| describe('TestcorporateHolderGet', function(){ | ||
| jest.setTimeout(10000); | ||
| it('test_success', async () => { | ||
| let holders = await starkbank.corporateHolder.query({ limit: 1 }); | ||
| for await (let holder of holders) { | ||
| holder = await starkbank.corporateHolder.get(holder.id) | ||
| assert(typeof holder.id == 'string') | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| describe('TestCorporateHolderQuery', function(){ | ||
| it('test_success', async () => { | ||
| let holders = await starkbank.corporateHolder.query({ limit: 3 }); | ||
| for await (let holder of holders) { | ||
| assert(typeof holder.id == 'string'); | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| describe('TestCorporateHolderPage', function(){ | ||
| it('test_success', async () => { | ||
| let [page, cursor] = await starkbank.corporateHolder.page(); | ||
| for await (let entity of page) { | ||
| assert(typeof entity.id == 'string'); | ||
| } | ||
| }); | ||
| }); |
This file contains hidden or 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,50 @@ | ||
| ///<reference types="../types/" /> | ||
|
|
||
| import starkbank from "starkbank"; | ||
| import assert from 'assert'; | ||
|
|
||
| starkbank.user = require('./utils/user').exampleProject; | ||
|
|
||
| describe('TestcorporateHolderGet', function(){ | ||
| jest.setTimeout(10000); | ||
| it('test_success', async () => { | ||
| let holders = await starkbank.corporateHolder.log.query({ limit: 1 }); | ||
| for await (let holder of holders) { | ||
| holder = await starkbank.corporateHolder.log.get(holder.id) | ||
| assert(typeof holder.id == 'string') | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| describe('TestcorporateHolderQuery', function(){ | ||
| jest.setTimeout(10000); | ||
| it('test_success', async () => { | ||
| let i = 0; | ||
| let holders = await starkbank.corporateHolder.log.query({ limit: 5 }); | ||
| for await (let holder of holders) { | ||
| assert(typeof holder.id == 'string'); | ||
| i += 1; | ||
| } | ||
| assert(i === 5); | ||
| }); | ||
| }); | ||
|
|
||
| describe('TestcorporateHolderPage', function(){ | ||
| jest.setTimeout(10000); | ||
| it('test_success', async () => { | ||
| let ids: string[] = []; | ||
| let cursor: string | null = null; | ||
| let page: starkbank.corporateHolder.Log[] | ||
| for (let i = 0; i < 2; i++) { | ||
| [page, cursor] = await starkbank.corporateHolder.log.page({ limit: 5, cursor: cursor }); | ||
| for (let entity of page) { | ||
| assert(!ids.includes(entity.id)); | ||
| ids.push(entity.id); | ||
| } | ||
| if (cursor == null) { | ||
| break; | ||
| } | ||
| } | ||
| assert(ids.length == 10); | ||
| }); | ||
| }); | ||
This file contains hidden or 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,32 @@ | ||
| ///<reference types="../types/" /> | ||
|
|
||
| import starkbank from "starkbank"; | ||
| import assert from 'assert'; | ||
|
|
||
| starkbank.user = require('./utils/user').exampleProject; | ||
|
|
||
| describe('TestCorporateInvoiceCreate', function(){ | ||
| it('test_success', async () => { | ||
| let invoice = await starkbank.corporateInvoice.create(new starkbank.CorporateInvoice({ amount: 1000 })); | ||
| assert(typeof invoice.id == 'string'); | ||
| }); | ||
| }); | ||
|
|
||
| describe('TestCorporateInvoiceQuery', function(){ | ||
| it('test_success', async () => { | ||
| let invoices = await starkbank.corporateInvoice.query({ limit: 3 }); | ||
| for await (let invoice of invoices) { | ||
| assert(typeof invoice.id == 'string'); | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| describe('TestCorporateInvoicePage', function(){ | ||
| it('test_success', async () => { | ||
| let [page, cursor] = await starkbank.corporateInvoice.page(); | ||
| for await (let entity of page) { | ||
| assert(typeof entity.id == 'string'); | ||
| } | ||
| assert(typeof cursor == 'string'); | ||
| }); | ||
| }); |
This file contains hidden or 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,36 @@ | ||
| ///<reference types="../types/" /> | ||
|
|
||
| import starkbank from "starkbank"; | ||
| import assert from 'assert'; | ||
|
|
||
| starkbank.user = require('./utils/user').exampleProject; | ||
|
|
||
| describe('TestcorporatePurchaseGet', function(){ | ||
| jest.setTimeout(10000); | ||
| it('test_success', async () => { | ||
| let purchases = await starkbank.corporatePurchase.query({ limit: 1 }); | ||
| for await (let purchase of purchases) { | ||
| purchase = await starkbank.corporatePurchase.get(purchase.id) | ||
| assert(typeof purchase.id == 'string') | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| describe('TestCorporatePurchaseQuery', function(){ | ||
| it('test_success', async () => { | ||
| let purchases = await starkbank.corporatePurchase.query({ limit: 3 }); | ||
| for await (let purchase of purchases) { | ||
| assert(typeof purchase.id == 'string'); | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| describe('TestCorporatePurchasePage', function(){ | ||
| it('test_success', async () => { | ||
| let [page, cursor] = await starkbank.corporatePurchase.page({ limit: 2 }); | ||
| for await (let entity of page) { | ||
| assert(typeof entity.id == 'string'); | ||
| } | ||
| assert(typeof cursor == 'string'); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.