Skip to content
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

Basic Subscriptions Support #473

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: distribution
path: dist/epcc-cli_linux_amd64
path: dist/epcc-cli_linux_amd64_v1/epcc
retention-days: 5
134 changes: 134 additions & 0 deletions external/resources/yaml/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2372,3 +2372,137 @@ stores:
get-entity:
docs: "https://elasticpath.dev/docs/getting-started/api-reference"
url: "/v2/stores/{settings}"
subscription-products:
docs: "https://elasticpath.dev/docs/api/subscriptions/products"
json-api-type: subscription_product
json-api-format: compliant
singular-name: subscription-product
get-collection:
docs: https://elasticpath.dev/docs/api/subscriptions/list-products
url: /v2/subscriptions/products
get-entity:
docs: https://elasticpath.dev/docs/api/subscriptions/get-product
url: /v2/subscriptions/products/{subscription_products}
create-entity:
docs: https://elasticpath.dev/docs/api/subscriptions/create-product
url: /v2/subscriptions/products
update-entity:
docs: https://elasticpath.dev/docs/api/subscriptions/update-product
url: /v2/subscriptions/products/{subscription_products}
delete-entity:
docs: https://elasticpath.dev/docs/api/subscriptions/delete-product
url: /v2/subscriptions/products/{subscription_products}
attributes:
^price\.([a-zA-Z0-9-_]+)\.amount$:
type: INT
^price\.([a-zA-Z0-9-_]+)\.includes_tax$:
type: BOOL
description:
type: STRING
autofill: VALUE:Auto Generated
external_ref:
type: STRING
main_image:
type: STRING
name:
type: STRING
autofill: FUNC:Name
price_units.amount:
type: INT
price_units.unit:
type: ENUM:day,month
sku:
type: STRING
subscription-plans:
docs: "https://elasticpath.dev/docs/api/subscriptions/plans"
json-api-type: subscription_plan
json-api-format: compliant
singular-name: subscription-plan
get-collection:
docs: "https://elasticpath.dev/docs/api/subscriptions/list-plans"
url: /v2/subscriptions/plans
get-entity:
docs: "https://elasticpath.dev/docs/api/subscriptions/get-plan"
url: /v2/subscriptions/plans/{subscription_plans}
create-entity:
docs: "https://elasticpath.dev/docs/api/subscriptions/create-plan"
url: /v2/subscriptions/plans
update-entity:
docs: "https://elasticpath.dev/docs/api/subscriptions/update-plan"
url: /v2/subscriptions/plans/{subscription_plans}
delete-entity:
docs: "https://elasticpath.dev/docs/api/subscriptions/delete-plan"
url: /v2/subscriptions/plans/{subscription_plans}
attributes:
^fixed_price\.(USD|[a-zA-Z0-9-_]+)\.amount$:
type: INT
^fixed_price\.(USD|[a-zA-Z0-9-_]+)\.includes_tax$:
type: BOOL
billing_day:
type: INT
billing_frequency:
type: INT
autofill: VALUE:1
billing_interval_type:
type: ENUM:day,week,month,year
autofill: VALUE:day
billing_month_day:
type: INT
can_cancel:
type: BOOL
autofill: VALUE:true
can_pause:
type: BOOL
autofill: VALUE:true
can_resume:
type: BOOL
autofill: VALUE:true
description:
type: STRING
autofill: VALUE:Auto Generated
end_behavior:
type: ENUM:close,roll
autofill: VALUE:close
external_ref:
type: STRING
name:
type: STRING
autofill: FUNC:Name
plan_length:
type: INT
autofill: VALUE:1
status:
type: ENUM:active,draft,archive
trial_period:
type: INT
subscription-offerings:
docs: "https://elasticpath.dev/docs/api/subscriptions/offerings"
json-api-type: subscription_offering
json-api-format: compliant
get-collection:
docs: "https://elasticpath.dev/docs/api/subscriptions/create-offering"
url: /v2/subscriptions/offerings
get-entity:
docs: "https://elasticpath.dev/docs/api/subscriptions/get-offering"
url: /v2/subscriptions/offerings/{subscription_offerings}
create-entity:
docs: "https://elasticpath.dev/docs/api/subscriptions/create-offering"
url: /v2/subscriptions/offerings
update-entity:
docs: "https://elasticpath.dev/docs/api/subscriptions/update-offering"
url: /v2/subscriptions/offerings/{subscription_offerings}
delete-entity:
docs: "https://elasticpath.dev/docs/api/subscriptions/delete-offering"
url: /v2/subscriptions/offerings/{subscription_offerings}
attributes:
description:
type: STRING
autofill: VALUE:Auto Generated
external_ref:
type: STRING
id:
type: RESOURCE_ID:subscription-offerings
name:
type: STRING
autofill: FUNC:Name
singular-name: subscription-offering
7 changes: 6 additions & 1 deletion external/runbooks/run-all-runbooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ set -x


#Let's test that epcc command works after an embarrassing bug that caused it to panic :(
#epcc
epcc

echo "Starting Subscriptions Tests"
epcc reset-store .+
epcc runbooks run subscriptions create-subscription-plans
epcc runbooks run subscriptions create-subscription-products
epcc runbooks run subscriptions create-subscription-offerings

echo "Starting Account Cart Association Tests"
epcc reset-store .+
Expand Down
45 changes: 45 additions & 0 deletions external/runbooks/subscriptions.epcc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "subscriptions"
description:
long: "Utilities for working with subscriptions"
short: "Utilities for working with subscriptions"
actions:
create-subscription-products:
variables:
count:
type: INT
default: 10
description:
short: "Create a lot of subscription products"
description:
short: "Create a number of products"
commands:
- |
{{ range untilStep 0 .count 1 -}}epcc create --skip-alias-processing -s subscription-product --auto-fill
{{ end }}
create-subscription-plans:
variables:
count:
type: INT
default: 10
description:
short: "Create a lot of subscription plans"
description:
short: "Create a number of orders"
commands:
- |
{{ range untilStep 0 .count 1 -}}epcc create --skip-alias-processing -s subscription-plan status active --auto-fill billing_interval_type day billing_frequency 214 plan_length 1 end_behavior close can_pause true can_resume true can_cancel true fixed_price.USD.amount {{ pseudoRandInt 1 200 }}00 fixed_price.USD.includes_tax true
{{ end }}
create-subscription-offerings:
variables:
count:
type: INT
default: 10
description:
short: "Create a lot of subscription offerings"
description:
short: "Create a number of offerings"
commands:
- |
{{ range untilStep 0 .count 1 -}}epcc create --skip-alias-processing -s subscription-offering --auto-fill
{{ end }}

Loading