-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - chargify #14284
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
Merged
Merged
New Components - chargify #14284
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
104 changes: 104 additions & 0 deletions
104
components/chargify/actions/create-customer/create-customer.mjs
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,104 @@ | ||
import chargify from "../../chargify.app.mjs"; | ||
|
||
export default { | ||
key: "chargify-create-customer", | ||
name: "Create Customer", | ||
description: "Creates a new customer in Chargify. [See the documentation](https://developers.maxio.com/http/advanced-billing-api/api-endpoints/customers/create-customer)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
chargify, | ||
firstName: { | ||
type: "string", | ||
label: "First Name", | ||
description: "The first name of the customer", | ||
}, | ||
lastName: { | ||
type: "string", | ||
label: "Last Name", | ||
description: "The last name of the customer", | ||
}, | ||
email: { | ||
type: "string", | ||
label: "Email", | ||
description: "The email of the customer", | ||
}, | ||
organization: { | ||
type: "string", | ||
label: "Organization", | ||
description: "The organization of the customer", | ||
optional: true, | ||
}, | ||
address: { | ||
type: "string", | ||
label: "Street Address", | ||
description: "Street address of the customer (line 1)", | ||
optional: true, | ||
}, | ||
address2: { | ||
type: "string", | ||
label: "Street Address (line 2)", | ||
description: "Street address of the customer (line 2)", | ||
optional: true, | ||
}, | ||
city: { | ||
type: "string", | ||
label: "City", | ||
description: "City of the customer", | ||
optional: true, | ||
}, | ||
state: { | ||
type: "string", | ||
label: "State", | ||
description: "State/Region of the customer", | ||
optional: true, | ||
}, | ||
zip: { | ||
type: "string", | ||
label: "Zip", | ||
description: "Zip code of the customer", | ||
optional: true, | ||
}, | ||
country: { | ||
type: "string", | ||
label: "Country", | ||
description: "The country code of the customer. Example: `US`", | ||
optional: true, | ||
}, | ||
phone: { | ||
type: "string", | ||
label: "Phone", | ||
description: "Phone number of the customer", | ||
optional: true, | ||
}, | ||
taxExempt: { | ||
type: "boolean", | ||
label: "Tax Exempt", | ||
description: "Set to `true` if the customer is tax exempt.", | ||
optional: true, | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { customer } = await this.chargify.createCustomer({ | ||
$, | ||
data: { | ||
customer: { | ||
first_name: this.firstName, | ||
last_name: this.lastName, | ||
email: this.email, | ||
organization: this.organization, | ||
address: this.address, | ||
address_2: this.address2, | ||
city: this.city, | ||
state: this.state, | ||
zip: this.zip, | ||
country: this.country, | ||
phone: this.phone, | ||
tax_exempt: this.taxExempt, | ||
}, | ||
}, | ||
}); | ||
$.export("$summary", `Successfully created customer with ID ${customer.id}`); | ||
return customer; | ||
}, | ||
}; |
58 changes: 58 additions & 0 deletions
58
components/chargify/actions/create-subscription/create-subscription.mjs
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,58 @@ | ||
import chargify from "../../chargify.app.mjs"; | ||
|
||
export default { | ||
key: "chargify-create-subscription", | ||
name: "Create Subscription", | ||
description: "Establishes a new subscription for a given customer in Chargify. [See the documentation](https://developers.maxio.com/http/advanced-billing-api/api-endpoints/subscriptions/create-subscription)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
chargify, | ||
customerId: { | ||
propDefinition: [ | ||
chargify, | ||
"customerId", | ||
], | ||
}, | ||
productId: { | ||
propDefinition: [ | ||
chargify, | ||
"productId", | ||
], | ||
}, | ||
couponCode: { | ||
propDefinition: [ | ||
chargify, | ||
"couponCode", | ||
], | ||
}, | ||
nextBillingAt: { | ||
propDefinition: [ | ||
chargify, | ||
"nextBillingAt", | ||
], | ||
}, | ||
paymentCollectionMethod: { | ||
propDefinition: [ | ||
chargify, | ||
"paymentCollectionMethod", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.chargify.createSubscription({ | ||
$, | ||
data: { | ||
subscription: { | ||
customer_id: this.customerId, | ||
product_id: this.productId, | ||
coupon_code: this.couponCode, | ||
next_billing_at: this.nextBillingAt, | ||
payment_collection_method: this.paymentCollectionMethod, | ||
}, | ||
}, | ||
}); | ||
$.export("$summary", `Successfully created subscription with ID: ${response.subscription.id}`); | ||
return response; | ||
}, | ||
}; |
59 changes: 59 additions & 0 deletions
59
components/chargify/actions/update-subscription/update-subscription.mjs
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,59 @@ | ||
import chargify from "../../chargify.app.mjs"; | ||
|
||
export default { | ||
key: "chargify-update-subscription", | ||
name: "Update Subscription", | ||
description: "Modifies an existing subscription in Chargify. [See the documentation](https://developers.maxio.com/http/advanced-billing-api/api-endpoints/subscriptions/update-subscription)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
chargify, | ||
subscriptionId: { | ||
propDefinition: [ | ||
chargify, | ||
"subscriptionId", | ||
], | ||
}, | ||
productId: { | ||
propDefinition: [ | ||
chargify, | ||
"productId", | ||
], | ||
optional: true, | ||
}, | ||
couponCode: { | ||
propDefinition: [ | ||
chargify, | ||
"couponCode", | ||
], | ||
}, | ||
nextBillingAt: { | ||
propDefinition: [ | ||
chargify, | ||
"nextBillingAt", | ||
], | ||
}, | ||
paymentCollectionMethod: { | ||
propDefinition: [ | ||
chargify, | ||
"paymentCollectionMethod", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.chargify.updateSubscription({ | ||
$, | ||
subscriptionId: this.subscriptionId, | ||
data: { | ||
subscription: { | ||
product_id: this.productId, | ||
coupon_code: this.couponCode, | ||
next_billing_at: this.nextBillingAt, | ||
payment_collection_method: this.paymentCollectionMethod, | ||
}, | ||
}, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}); | ||
$.export("$summary", `Successfully updated subscription ${this.subscriptionId}`); | ||
return response; | ||
}, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; |
Oops, something went wrong.
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.