-
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.
- Loading branch information
Showing
25 changed files
with
8,004 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"extends": "../../.eslintrc.json", | ||
"ignorePatterns": ["bundle/componentpacks/*/*.js*"], | ||
"rules": {}, | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"parserOptions": { | ||
"project": ["apps/stripe/tsconfig.*?.json"] | ||
}, | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
} | ||
] | ||
} |
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,9 @@ | ||
.uesio | ||
node_modules/ | ||
bundle/componentpacks/*/dist/ | ||
# Don't include the following types within the app bundle | ||
bundle/collections/** | ||
bundle/fields/** | ||
bundle/routes/** | ||
bundle/selectlists/** | ||
bundle/views/** |
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,6 @@ | ||
|
||
/bundle/componentpacks/*/dist | ||
package-lock.json | ||
package.json | ||
generated | ||
node_modules |
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,8 @@ | ||
tabWidth: 4 | ||
semi: false | ||
useTabs: true | ||
overrides: | ||
- files: "*.yaml" | ||
options: | ||
tabWidth: 2 | ||
printWidth: 1000 |
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,18 @@ | ||
import { ListenerBotApi } from "@uesio/bots" | ||
|
||
export default function checkout(bot: ListenerBotApi) { | ||
const url = `https://api.stripe.com/v1/products` | ||
|
||
bot.log.info("URL", url) | ||
|
||
const response = bot.http.request({ | ||
method: "GET", | ||
url, | ||
headers: { | ||
Authorization: | ||
"Bearer sk_test_51MwQbcF1X3pAO31UFqkNAdVubAAspfKpzZnLLzKiebZGkDVzDQCQ6hTozBBSG7z1zB5NOws9MAsdSZ9Xu39dmoyd00ZVpjccKy", | ||
}, | ||
}) | ||
|
||
bot.log.info("Response", response) | ||
} |
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,3 @@ | ||
name: checkout | ||
type: LISTENER | ||
dialect: TYPESCRIPT |
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,56 @@ | ||
import { RunActionBotApi } from "@uesio/bots" | ||
import { Params } from "@uesio/app/bots/runaction/uesio/stripe/checkout" | ||
|
||
// type OrderDetails = { | ||
// orderNumber: string | ||
// } | ||
|
||
export default function checkout(bot: RunActionBotApi) { | ||
const params = bot.params.getAll() as Params | ||
const { successURL, items, mode } = params | ||
const actionName = bot.getActionName() | ||
|
||
if (actionName !== "checkout") { | ||
bot.addError("unsupported action name: " + actionName) | ||
return | ||
} | ||
|
||
const { apikey } = bot.getCredentials() | ||
|
||
if (apikey === "") { | ||
bot.addError("missing api key") | ||
return | ||
} | ||
|
||
const baseURL = bot.getIntegration().getBaseURL() | ||
|
||
bot.log.info("ITEMS", items) | ||
bot.log.info("apikey", apikey) | ||
bot.log.info("baseURL", baseURL) | ||
bot.log.info("mode", mode) | ||
bot.log.info("successURL", successURL) | ||
|
||
const result = bot.http.request({ | ||
method: "POST", | ||
headers: { | ||
Authorization: `Bearer ${apikey}`, | ||
}, | ||
url: baseURL + "/v1/checkout/sessions", | ||
body: { | ||
mode, | ||
success_url: successURL, | ||
}, | ||
}) | ||
// if (result.code !== 200) { | ||
// bot.addError("could not complete checkout: " + result.status) | ||
// return | ||
// } | ||
|
||
bot.log.info("Result", result) | ||
bot.log.info("Body", result.body) | ||
|
||
// const orderDetails = result.body as OrderDetails | ||
// const { orderNumber } = orderDetails | ||
|
||
// bot.addResult("orderNumber", orderNumber) | ||
} |
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 @@ | ||
name: checkout | ||
public: true | ||
type: RUNACTION | ||
dialect: TYPESCRIPT | ||
params: | ||
- name: successURL | ||
label: Success URL | ||
type: TEXT | ||
required: true | ||
- name: items | ||
label: Items | ||
type: LIST | ||
required: true | ||
- name: mode | ||
type: TEXT | ||
required: true | ||
selectList: mode |
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,8 @@ | ||
name: uesio/stripe | ||
dependencies: | ||
uesio/builder: | ||
version: v0.0.1 | ||
uesio/core: | ||
version: v0.0.1 | ||
uesio/io: | ||
version: v0.0.1 |
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,7 @@ | ||
name: stripe_api_key | ||
type: API_KEY | ||
apiKey: | ||
key: stripe_key | ||
location: header | ||
locationName: Authorization | ||
locationValue: ${apikey} |
4 changes: 4 additions & 0 deletions
4
apps/stripe/bundle/integrationactions/uesio/stripe/stripe/checkout.yaml
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,4 @@ | ||
name: checkout | ||
label: Get Checkout URL | ||
public: true | ||
bot: checkout |
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,6 @@ | ||
name: stripe | ||
public: true | ||
type: stripe | ||
authentication: API_KEY | ||
credentials: stripe_api_key | ||
baseUrl: https://api.stripe.com |
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,3 @@ | ||
name: stripe | ||
label: Stripe | ||
public: true |
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,4 @@ | ||
name: stripe_key | ||
public: true | ||
store: platform | ||
managedBy: site |
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,16 @@ | ||
|
||
declare module "@uesio/app/selectlists/uesio/stripe" { | ||
export type Mode = "payment" | "setup" | "subscription" | ||
} | ||
declare module "@uesio/app/bots/runaction/uesio/stripe/checkout" { | ||
|
||
type Params = { | ||
successURL: string | ||
items: string[] | ||
mode: string | ||
} | ||
|
||
export type { | ||
Params | ||
} | ||
} |
Oops, something went wrong.