This repository has been archived by the owner on Dec 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
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 #3 from Giftbit/ListImprovements
Release 0.0.11.
- Loading branch information
Showing
15 changed files
with
505 additions
and
331 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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import * as stripe from "stripe"; | ||
import log = require("loglevel"); | ||
import {generateId} from "./utils"; | ||
import {applyListOptions, generateId} from "./utils"; | ||
import {StripeError} from "./StripeError"; | ||
|
||
export namespace accounts { | ||
|
@@ -27,7 +27,6 @@ export namespace accounts { | |
} | ||
|
||
const connectedAccountId = (params as any).id || `acct_${generateId(16)}`; | ||
const now = new Date(); | ||
const account: stripe.accounts.IAccount & any = { // The d.ts is out of date on this object and I don't want to bother. | ||
id: connectedAccountId, | ||
object: "account", | ||
|
@@ -45,7 +44,7 @@ export namespace accounts { | |
capabilities: {}, | ||
charges_enabled: false, | ||
country: params.country || "US", | ||
created: (now.getTime() / 1000) | 0, | ||
created: (Date.now() / 1000) | 0, | ||
default_currency: params.default_currency || "usd", | ||
details_submitted: false, | ||
email: params.email || "[email protected]", | ||
|
@@ -169,6 +168,11 @@ export namespace accounts { | |
return accounts[connectedAccountId]; | ||
} | ||
|
||
export function list(accountId: string, params: stripe.IListOptions): stripe.IList<stripe.accounts.IAccount> { | ||
let data = Object.values(accounts); | ||
return applyListOptions(data, params, (id, paramName) => retrieve(accountId, id, paramName)); | ||
} | ||
|
||
export function del(accountId: string, connectedAccountId: string): stripe.IDeleteConfirmation { | ||
log.debug("accounts.delete", accountId, connectedAccountId); | ||
|
||
|
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
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
Oops, something went wrong.