From 32a936fb6eb2a7d780e1a5f83ebf21b4ae7bbf0a Mon Sep 17 00:00:00 2001 From: Matnabru Date: Thu, 3 Aug 2023 15:20:48 +0200 Subject: [PATCH] updated sandbox and Product mutations path --- packages/integrations/gei-stripe/package.json | 2 +- .../default_price.ts | 0 .../src/{StripeProduct => Product}/prices.ts | 0 packages/integrations/gei-stripe/src/index.ts | 4 +- .../gei-stripe-sandbox/schema.graphql | 43 ++++++- .../src/models/StripeCustomerModel.ts | 3 - .../models/StripeCustomerMutationOpsModel.ts | 3 - .../src/models/StripeCustomerQueryOpsModel.ts | 3 - .../src/models/StripeProductModel.ts | 3 - .../gei-stripe-sandbox/src/zeus/const.ts | 23 +++- .../gei-stripe-sandbox/src/zeus/index.ts | 117 +++++++++++++++--- .../sandboxes/gei-stripe-sandbox/stucco.json | 4 +- 12 files changed, 163 insertions(+), 42 deletions(-) rename packages/integrations/gei-stripe/src/{StripeProduct => Product}/default_price.ts (100%) rename packages/integrations/gei-stripe/src/{StripeProduct => Product}/prices.ts (100%) delete mode 100644 packages/sandboxes/gei-stripe-sandbox/src/models/StripeCustomerModel.ts delete mode 100644 packages/sandboxes/gei-stripe-sandbox/src/models/StripeCustomerMutationOpsModel.ts delete mode 100644 packages/sandboxes/gei-stripe-sandbox/src/models/StripeCustomerQueryOpsModel.ts delete mode 100644 packages/sandboxes/gei-stripe-sandbox/src/models/StripeProductModel.ts diff --git a/packages/integrations/gei-stripe/package.json b/packages/integrations/gei-stripe/package.json index c1a1ebe..2648664 100644 --- a/packages/integrations/gei-stripe/package.json +++ b/packages/integrations/gei-stripe/package.json @@ -1,6 +1,6 @@ { "name": "gei-stripe", - "version": "0.3.2", + "version": "0.3.3", "description": "Automatically generated by graphql-editor-cli", "main": "lib/index.js", "scripts": { diff --git a/packages/integrations/gei-stripe/src/StripeProduct/default_price.ts b/packages/integrations/gei-stripe/src/Product/default_price.ts similarity index 100% rename from packages/integrations/gei-stripe/src/StripeProduct/default_price.ts rename to packages/integrations/gei-stripe/src/Product/default_price.ts diff --git a/packages/integrations/gei-stripe/src/StripeProduct/prices.ts b/packages/integrations/gei-stripe/src/Product/prices.ts similarity index 100% rename from packages/integrations/gei-stripe/src/StripeProduct/prices.ts rename to packages/integrations/gei-stripe/src/Product/prices.ts diff --git a/packages/integrations/gei-stripe/src/index.ts b/packages/integrations/gei-stripe/src/index.ts index 872c5d1..16cd8de 100644 --- a/packages/integrations/gei-stripe/src/index.ts +++ b/packages/integrations/gei-stripe/src/index.ts @@ -5,8 +5,8 @@ import { handler as createCustomerPortalHandler } from './Mutation/createCustome import { handler as createCheckoutSessionHandler } from './Mutation/createCheckoutSession.js'; import { handler as createNewUserCheckoutSessionHandler } from './Mutation/createNewUserCheckoutSession.js'; import { handler as productsHandler } from './Query/products.js'; -import { handler as productDefaultPriceHandler } from './StripeProduct/default_price.js'; -import { handler as productPricesHandler } from './StripeProduct/prices.js'; +import { handler as productDefaultPriceHandler } from './Product/default_price.js'; +import { handler as productPricesHandler } from './Product/prices.js'; import { handler as subscriptionsHandler } from './Query/subscriptions.js'; import { handler as attachPaymentMethodHandler } from './Mutation/attachPaymentMethod.js'; import { handler as createConnectAccountHandler } from './Mutation/createConnectAccount.js'; diff --git a/packages/sandboxes/gei-stripe-sandbox/schema.graphql b/packages/sandboxes/gei-stripe-sandbox/schema.graphql index e7a1c80..34e4431 100644 --- a/packages/sandboxes/gei-stripe-sandbox/schema.graphql +++ b/packages/sandboxes/gei-stripe-sandbox/schema.graphql @@ -29,19 +29,51 @@ type Mutation{ payload: CreateConnectAccountInput! ): Boolean! """ + Gather payment method id using Stripe.js or a pre-built solution like Stripe Elements + """ + attachPaymentMethod( + payload: AttachPaymentMethodInput! + ): Boolean! + setDefaultPaymentMethod( + payload: setDefaultPaymentMethodInput! + ): Boolean! + """ entry point for Weebhooks. """ webhook: String } +input setDefaultPaymentMethodInput{ + attachedPaymentMethodId: String! + customerId: String! +} + +input AttachPaymentMethodInput { + paymentMethodId: String! + customerId: String! +} + input CreateConnectAccountInput { - type: String! + type: ConnectAccountType! country: String! email: String! - business_type: String! + business_type: ConnectAccountBusinessType! bankAccount: BankAccountInput! } +enum ConnectAccountBusinessType{ + company + government_entity + individual + non_profit +} + +enum ConnectAccountType { + standard + express + custom +} + input BankAccountInput { country: String! """ @@ -56,6 +88,7 @@ input BankAccountInput { Required when attaching the bank account to a Customer """ account_holder_name: String! + account_holder_type: BankAccountHolderType! } enum BankAccountHolderType { @@ -118,6 +151,10 @@ input CreateNewUserCheckoutSessionInput{ successUrl: String! cancelUrl: String! products: [ProductInput!]! + """ + Define amount to transfer into stripe connect account and set the rest for application fees + """ + applicationFee: ApplicationFeeInput } input CreateCheckoutSessionInput{ @@ -138,7 +175,7 @@ input ApplicationFeeInput { """ Value from 0-100 """ - application_fee: Int! + feePercentage: Int! """ Connect Account (not stripe customer) id """ diff --git a/packages/sandboxes/gei-stripe-sandbox/src/models/StripeCustomerModel.ts b/packages/sandboxes/gei-stripe-sandbox/src/models/StripeCustomerModel.ts deleted file mode 100644 index 8d6f89e..0000000 --- a/packages/sandboxes/gei-stripe-sandbox/src/models/StripeCustomerModel.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { ModelTypes } from '../zeus/index.js'; - -export type StripeCustomerModel = ModelTypes['StripeCustomer']; \ No newline at end of file diff --git a/packages/sandboxes/gei-stripe-sandbox/src/models/StripeCustomerMutationOpsModel.ts b/packages/sandboxes/gei-stripe-sandbox/src/models/StripeCustomerMutationOpsModel.ts deleted file mode 100644 index 69e0a51..0000000 --- a/packages/sandboxes/gei-stripe-sandbox/src/models/StripeCustomerMutationOpsModel.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { ModelTypes } from '../zeus/index.js'; - -export type StripeCustomerMutationOpsModel = ModelTypes['StripeCustomerMutationOps']; \ No newline at end of file diff --git a/packages/sandboxes/gei-stripe-sandbox/src/models/StripeCustomerQueryOpsModel.ts b/packages/sandboxes/gei-stripe-sandbox/src/models/StripeCustomerQueryOpsModel.ts deleted file mode 100644 index 69ef09d..0000000 --- a/packages/sandboxes/gei-stripe-sandbox/src/models/StripeCustomerQueryOpsModel.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { ModelTypes } from '../zeus/index.js'; - -export type StripeCustomerQueryOpsModel = ModelTypes['StripeCustomerQueryOps']; \ No newline at end of file diff --git a/packages/sandboxes/gei-stripe-sandbox/src/models/StripeProductModel.ts b/packages/sandboxes/gei-stripe-sandbox/src/models/StripeProductModel.ts deleted file mode 100644 index a8fceb9..0000000 --- a/packages/sandboxes/gei-stripe-sandbox/src/models/StripeProductModel.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { ModelTypes } from '../zeus/index.js'; - -export type StripeProductModel = ModelTypes['StripeProduct']; \ No newline at end of file diff --git a/packages/sandboxes/gei-stripe-sandbox/src/zeus/const.ts b/packages/sandboxes/gei-stripe-sandbox/src/zeus/const.ts index 7e6ddac..df102ed 100644 --- a/packages/sandboxes/gei-stripe-sandbox/src/zeus/const.ts +++ b/packages/sandboxes/gei-stripe-sandbox/src/zeus/const.ts @@ -24,13 +24,29 @@ export const AllTypesProps: Record = { }, createConnectAccount:{ payload:"CreateConnectAccountInput" + }, + attachPaymentMethod:{ + payload:"AttachPaymentMethodInput" + }, + setDefaultPaymentMethod:{ + payload:"setDefaultPaymentMethodInput" } + }, + setDefaultPaymentMethodInput:{ + + }, + AttachPaymentMethodInput:{ + }, CreateConnectAccountInput:{ + type:"ConnectAccountType", + business_type:"ConnectAccountBusinessType", bankAccount:"BankAccountInput" }, + ConnectAccountBusinessType: "enum" as const, + ConnectAccountType: "enum" as const, BankAccountInput:{ - + account_holder_type:"BankAccountHolderType" }, BankAccountHolderType: "enum" as const, SubscriptionFilter:{ @@ -41,7 +57,8 @@ export const AllTypesProps: Record = { address:"AddressInput" }, CreateNewUserCheckoutSessionInput:{ - products:"ProductInput" + products:"ProductInput", + applicationFee:"ApplicationFeeInput" }, CreateCheckoutSessionInput:{ products:"ProductInput", @@ -100,6 +117,8 @@ export const ReturnTypes: Record = { createNewUserCheckoutSession:"String", createCustomerPortal:"String", createConnectAccount:"Boolean", + attachPaymentMethod:"Boolean", + setDefaultPaymentMethod:"Boolean", webhook:"String" }, Subscription:{ diff --git a/packages/sandboxes/gei-stripe-sandbox/src/zeus/index.ts b/packages/sandboxes/gei-stripe-sandbox/src/zeus/index.ts index 6225272..120c02e 100644 --- a/packages/sandboxes/gei-stripe-sandbox/src/zeus/index.ts +++ b/packages/sandboxes/gei-stripe-sandbox/src/zeus/index.ts @@ -846,17 +846,29 @@ createCheckoutSession?: [{ payload: ValueTypes["CreateCheckoutSessionInput"] | V createNewUserCheckoutSession?: [{ payload: ValueTypes["CreateNewUserCheckoutSessionInput"] | Variable},boolean | `@${string}`], createCustomerPortal?: [{ payload: ValueTypes["CreateCustomerPortalInput"] | Variable},boolean | `@${string}`], createConnectAccount?: [{ payload: ValueTypes["CreateConnectAccountInput"] | Variable},boolean | `@${string}`], +attachPaymentMethod?: [{ payload: ValueTypes["AttachPaymentMethodInput"] | Variable},boolean | `@${string}`], +setDefaultPaymentMethod?: [{ payload: ValueTypes["setDefaultPaymentMethodInput"] | Variable},boolean | `@${string}`], /** entry point for Weebhooks. */ webhook?:boolean | `@${string}`, __typename?: boolean | `@${string}` }>; + ["setDefaultPaymentMethodInput"]: { + attachedPaymentMethodId: string | Variable, + customerId: string | Variable +}; + ["AttachPaymentMethodInput"]: { + paymentMethodId: string | Variable, + customerId: string | Variable +}; ["CreateConnectAccountInput"]: { - type: string | Variable, + type: ValueTypes["ConnectAccountType"] | Variable, country: string | Variable, email: string | Variable, - business_type: string | Variable, + business_type: ValueTypes["ConnectAccountBusinessType"] | Variable, bankAccount: ValueTypes["BankAccountInput"] | Variable }; + ["ConnectAccountBusinessType"]:ConnectAccountBusinessType; + ["ConnectAccountType"]:ConnectAccountType; ["BankAccountInput"]: { country: string | Variable, /** Required supported currency for the country https://stripe.com/docs/payouts */ @@ -864,7 +876,8 @@ createConnectAccount?: [{ payload: ValueTypes["CreateConnectAccountInput"] | Var /** IBAN account number */ account_number: string | Variable, /** Required when attaching the bank account to a Customer */ - account_holder_name: string | Variable + account_holder_name: string | Variable, + account_holder_type: ValueTypes["BankAccountHolderType"] | Variable }; ["BankAccountHolderType"]:BankAccountHolderType; ["SubscriptionFilter"]: { @@ -908,7 +921,9 @@ createConnectAccount?: [{ payload: ValueTypes["CreateConnectAccountInput"] | Var /** Return url after successful transaction */ successUrl: string | Variable, cancelUrl: string | Variable, - products: Array | Variable + products: Array | Variable, + /** Define amount to transfer into stripe connect account and set the rest for application fees */ + applicationFee?: ValueTypes["ApplicationFeeInput"] | undefined | null | Variable }; ["CreateCheckoutSessionInput"]: { userEmail: string | Variable, @@ -921,7 +936,7 @@ createConnectAccount?: [{ payload: ValueTypes["CreateConnectAccountInput"] | Var }; ["ApplicationFeeInput"]: { /** Value from 0-100 */ - application_fee: number | Variable, + feePercentage: number | Variable, /** Connect Account (not stripe customer) id */ connectAccountId: string | Variable }; @@ -1093,17 +1108,29 @@ createCheckoutSession?: [{ payload: ResolverInputTypes["CreateCheckoutSessionInp createNewUserCheckoutSession?: [{ payload: ResolverInputTypes["CreateNewUserCheckoutSessionInput"]},boolean | `@${string}`], createCustomerPortal?: [{ payload: ResolverInputTypes["CreateCustomerPortalInput"]},boolean | `@${string}`], createConnectAccount?: [{ payload: ResolverInputTypes["CreateConnectAccountInput"]},boolean | `@${string}`], +attachPaymentMethod?: [{ payload: ResolverInputTypes["AttachPaymentMethodInput"]},boolean | `@${string}`], +setDefaultPaymentMethod?: [{ payload: ResolverInputTypes["setDefaultPaymentMethodInput"]},boolean | `@${string}`], /** entry point for Weebhooks. */ webhook?:boolean | `@${string}`, __typename?: boolean | `@${string}` }>; + ["setDefaultPaymentMethodInput"]: { + attachedPaymentMethodId: string, + customerId: string +}; + ["AttachPaymentMethodInput"]: { + paymentMethodId: string, + customerId: string +}; ["CreateConnectAccountInput"]: { - type: string, + type: ResolverInputTypes["ConnectAccountType"], country: string, email: string, - business_type: string, + business_type: ResolverInputTypes["ConnectAccountBusinessType"], bankAccount: ResolverInputTypes["BankAccountInput"] }; + ["ConnectAccountBusinessType"]:ConnectAccountBusinessType; + ["ConnectAccountType"]:ConnectAccountType; ["BankAccountInput"]: { country: string, /** Required supported currency for the country https://stripe.com/docs/payouts */ @@ -1111,7 +1138,8 @@ createConnectAccount?: [{ payload: ResolverInputTypes["CreateConnectAccountInput /** IBAN account number */ account_number: string, /** Required when attaching the bank account to a Customer */ - account_holder_name: string + account_holder_name: string, + account_holder_type: ResolverInputTypes["BankAccountHolderType"] }; ["BankAccountHolderType"]:BankAccountHolderType; ["SubscriptionFilter"]: { @@ -1155,7 +1183,9 @@ createConnectAccount?: [{ payload: ResolverInputTypes["CreateConnectAccountInput /** Return url after successful transaction */ successUrl: string, cancelUrl: string, - products: Array + products: Array, + /** Define amount to transfer into stripe connect account and set the rest for application fees */ + applicationFee?: ResolverInputTypes["ApplicationFeeInput"] | undefined | null }; ["CreateCheckoutSessionInput"]: { userEmail: string, @@ -1168,7 +1198,7 @@ createConnectAccount?: [{ payload: ResolverInputTypes["CreateConnectAccountInput }; ["ApplicationFeeInput"]: { /** Value from 0-100 */ - application_fee: number, + feePercentage: number, /** Connect Account (not stripe customer) id */ connectAccountId: string }; @@ -1340,16 +1370,29 @@ export type ModelTypes = { createNewUserCheckoutSession: string, createCustomerPortal: string, createConnectAccount: boolean, + /** Gather payment method id using Stripe.js or a pre-built solution like Stripe Elements */ + attachPaymentMethod: boolean, + setDefaultPaymentMethod: boolean, /** entry point for Weebhooks. */ webhook?: string | undefined +}; + ["setDefaultPaymentMethodInput"]: { + attachedPaymentMethodId: string, + customerId: string +}; + ["AttachPaymentMethodInput"]: { + paymentMethodId: string, + customerId: string }; ["CreateConnectAccountInput"]: { - type: string, + type: ModelTypes["ConnectAccountType"], country: string, email: string, - business_type: string, + business_type: ModelTypes["ConnectAccountBusinessType"], bankAccount: ModelTypes["BankAccountInput"] }; + ["ConnectAccountBusinessType"]:ConnectAccountBusinessType; + ["ConnectAccountType"]:ConnectAccountType; ["BankAccountInput"]: { country: string, /** Required supported currency for the country https://stripe.com/docs/payouts */ @@ -1357,7 +1400,8 @@ export type ModelTypes = { /** IBAN account number */ account_number: string, /** Required when attaching the bank account to a Customer */ - account_holder_name: string + account_holder_name: string, + account_holder_type: ModelTypes["BankAccountHolderType"] }; ["BankAccountHolderType"]:BankAccountHolderType; ["SubscriptionFilter"]: { @@ -1398,7 +1442,9 @@ export type ModelTypes = { /** Return url after successful transaction */ successUrl: string, cancelUrl: string, - products: Array + products: Array, + /** Define amount to transfer into stripe connect account and set the rest for application fees */ + applicationFee?: ModelTypes["ApplicationFeeInput"] | undefined }; ["CreateCheckoutSessionInput"]: { userEmail: string, @@ -1411,7 +1457,7 @@ export type ModelTypes = { }; ["ApplicationFeeInput"]: { /** Value from 0-100 */ - application_fee: number, + feePercentage: number, /** Connect Account (not stripe customer) id */ connectAccountId: string }; @@ -1576,16 +1622,29 @@ export type GraphQLTypes = { createNewUserCheckoutSession: string, createCustomerPortal: string, createConnectAccount: boolean, + /** Gather payment method id using Stripe.js or a pre-built solution like Stripe Elements */ + attachPaymentMethod: boolean, + setDefaultPaymentMethod: boolean, /** entry point for Weebhooks. */ webhook?: string | undefined +}; + ["setDefaultPaymentMethodInput"]: { + attachedPaymentMethodId: string, + customerId: string +}; + ["AttachPaymentMethodInput"]: { + paymentMethodId: string, + customerId: string }; ["CreateConnectAccountInput"]: { - type: string, + type: GraphQLTypes["ConnectAccountType"], country: string, email: string, - business_type: string, + business_type: GraphQLTypes["ConnectAccountBusinessType"], bankAccount: GraphQLTypes["BankAccountInput"] }; + ["ConnectAccountBusinessType"]: ConnectAccountBusinessType; + ["ConnectAccountType"]: ConnectAccountType; ["BankAccountInput"]: { country: string, /** Required supported currency for the country https://stripe.com/docs/payouts */ @@ -1593,7 +1652,8 @@ export type GraphQLTypes = { /** IBAN account number */ account_number: string, /** Required when attaching the bank account to a Customer */ - account_holder_name: string + account_holder_name: string, + account_holder_type: GraphQLTypes["BankAccountHolderType"] }; ["BankAccountHolderType"]: BankAccountHolderType; ["SubscriptionFilter"]: { @@ -1637,7 +1697,9 @@ export type GraphQLTypes = { /** Return url after successful transaction */ successUrl: string, cancelUrl: string, - products: Array + products: Array, + /** Define amount to transfer into stripe connect account and set the rest for application fees */ + applicationFee?: GraphQLTypes["ApplicationFeeInput"] | undefined }; ["CreateCheckoutSessionInput"]: { userEmail: string, @@ -1650,7 +1712,7 @@ export type GraphQLTypes = { }; ["ApplicationFeeInput"]: { /** Value from 0-100 */ - application_fee: number, + feePercentage: number, /** Connect Account (not stripe customer) id */ connectAccountId: string }; @@ -1809,6 +1871,17 @@ export type GraphQLTypes = { endingBefore?: string | undefined } } +export const enum ConnectAccountBusinessType { + company = "company", + government_entity = "government_entity", + individual = "individual", + non_profit = "non_profit" +} +export const enum ConnectAccountType { + standard = "standard", + express = "express", + custom = "custom" +} export const enum BankAccountHolderType { individual = "individual", company = "company" @@ -1861,7 +1934,11 @@ export const enum Type { } type ZEUS_VARIABLES = { + ["setDefaultPaymentMethodInput"]: ValueTypes["setDefaultPaymentMethodInput"]; + ["AttachPaymentMethodInput"]: ValueTypes["AttachPaymentMethodInput"]; ["CreateConnectAccountInput"]: ValueTypes["CreateConnectAccountInput"]; + ["ConnectAccountBusinessType"]: ValueTypes["ConnectAccountBusinessType"]; + ["ConnectAccountType"]: ValueTypes["ConnectAccountType"]; ["BankAccountInput"]: ValueTypes["BankAccountInput"]; ["BankAccountHolderType"]: ValueTypes["BankAccountHolderType"]; ["SubscriptionFilter"]: ValueTypes["SubscriptionFilter"]; diff --git a/packages/sandboxes/gei-stripe-sandbox/stucco.json b/packages/sandboxes/gei-stripe-sandbox/stucco.json index 707da16..d2017d7 100644 --- a/packages/sandboxes/gei-stripe-sandbox/stucco.json +++ b/packages/sandboxes/gei-stripe-sandbox/stucco.json @@ -63,7 +63,7 @@ "Product.default_price": { "noCode": { "package": "gei-stripe", - "version": "0.2.0", + "version": "0.3.3", "resolver": "default_price" }, "resolve": { @@ -73,7 +73,7 @@ "Product.prices": { "noCode": { "package": "gei-stripe", - "version": "0.2.0", + "version": "0.3.3", "resolver": "prices" }, "resolve": {