Skip to content

Commit

Permalink
Resolves #385 - Add support for customer cart associations
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-r-west committed Dec 29, 2023
1 parent 3948b91 commit 281e1f8
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 20 deletions.
94 changes: 75 additions & 19 deletions external/runbooks/customer-cart-associations.epcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ actions:
create-customers-and-carts-with-product-items:
description:
short: "Create the customers and carts"
ignore_errors: true
ignore_errors: false
commands:
- |
epcc create customer --auto-fill email "cust1@example.com" password test
Expand All @@ -48,40 +48,80 @@ actions:
create-customers-and-carts-with-custom-items:
description:
short: "Create the customers and carts"
ignore_errors: true
ignore_errors: false
commands:
- |
epcc create customer --auto-fill email "cust1@example.com" password test
epcc create customer --auto-fill email "cust2@example.com" password test
epcc create customer --auto-fill email "cust3@example.com" password test
epcc create cart name "Customer 1 Cart" id cust1_only description "Customer 1 Cart"
epcc create cart name "Customer 1&2 Shared Cart" id cust1_and_2 description "Customer 1 & 2 Cart"
epcc create cart name "No Customer Cart" id no_cust_cart description "No Customer Cart"
- epcc create customer-cart-association id=cust1_only data[0].type customer data[0].id email=cust1@example.com
- epcc create customer-cart-association id=cust1_and_2 data[0].type customer data[0].id email=cust1@example.com
- epcc create customer-cart-association id=cust1_and_2 data[0].type customer data[0].id email=cust2@example.com
- epcc create cart-custom-item id=cust1_only sku sku=BE-Gas-Range-2b2b quantity 1
- epcc create cart-custom-item id=cust1_and_2 sku sku=BE-Gas-Range-2b2b quantity 2
- epcc create cart-custom-item no_cust_cart sku sku=BE-Gas-Range-2b2b quantity 3
epcc create customer --auto-fill email "cust4@example.com" password test
epcc create customer --auto-fill email "cust5@example.com" password test
epcc create customer --auto-fill email "cust6@example.com" password test
epcc create cart name "Customer 4 Cart" id cust1_only description "Customer 4 Cart"
epcc create cart name "Customer 4&5 Shared Cart" id cust1_and_2 description "Customer 4 & 5 Cart"
epcc create cart name "No Customer Cart" id no_cust_cart_custom_items description "No Customer Cart (Custom Items)"
- epcc create customer-cart-association id=cust4_only data[0].type customer data[0].id email=cust4@example.com
- epcc create customer-cart-association id=cust4_and_5 data[0].type customer data[0].id email=cust4@example.com
- epcc create customer-cart-association id=cust4_and_5 data[0].type customer data[0].id email=cust5@example.com
- epcc create cart-custom-item id=cust4_only sku 123-456 quantity 1 price.amount 100000 price.includes_tax false name "Best Ever Electric Range"
- epcc create cart-custom-item id=cust4_and_5 sku 123-456 quantity 2 price.amount 100000 price.includes_tax false name "Best Ever Electric Range"
- epcc create cart-custom-item no_cust_cart_custom_items sku 123-789 quantity 3 price.amount 100000 price.includes_tax false name "Best Ever Gas Range"


delete-customers-and-carts:
delete-customer-and-carts-with-product-items:
description:
short: "Delete all the customers and their carts"
ignore_errors: false
commands:
- epcc get -s customers filter 'like(email,*@example.com)'
- epcc delete customer-cart-association id=cust1_only data[0].type customer data[0].id email=cust1@example.com
- epcc delete customer-cart-association id=cust1_and_2 data[0].type customer data[0].id email=cust1@example.com
- epcc delete customer-cart-association id=cust1_and_2 data[0].type customer data[0].id email=cust2@example.com
- |
epcc delete customer email=cust1@example.com
epcc delete customer email=cust2@example.com
epcc delete customer email=cust3@example.com
- epcc delete customer-cart-association id=cust1_only data[0].type customer data[0].id email=cust1@example.com
- epcc delete customer-cart-association id=cust1_and_2 data[0].type customer data[0].id email=cust1@example.com
- epcc delete customer-cart-association id=cust1_and_2 data[0].type customer data[0].id email=cust2@example.com
- |
epcc delete cart cust1_only
epcc delete cart cust1_and_2
epcc delete cart no_cust_cart
try-and-delete-all-carts:
description:
short: "Try and delete all carts"
ignore_errors: true
commands:
- epcc get -s customers filter 'like(email,*@example.com)'
- epcc delete customer-cart-association id=cust1_only data[0].type customer data[0].id email=cust1@example.com
- epcc delete customer-cart-association id=cust1_and_2 data[0].type customer data[0].id email=cust1@example.com
- epcc delete customer-cart-association id=cust1_and_2 data[0].type customer data[0].id email=cust2@example.com
- epcc delete customer-cart-association id=cust4_only data[0].type customer data[0].id email=cust4@example.com
- epcc delete customer-cart-association id=cust4_and_5 data[0].type customer data[0].id email=cust4@example.com
- epcc delete customer-cart-association id=cust4_and_5 data[0].type customer data[0].id email=cust5@example.com
- |
epcc delete cart cust1_only
epcc delete cart cust1_and_2
epcc delete cart no_cust_cart
epcc delete cart cust4_only
epcc delete cart cust4_and_5
epcc delete cart no_cust_cart_custom_items


delete-customer-and-carts-with-custom-items:
description:
short: "Delete all the customers and their carts"
ignore_errors: false
commands:
- epcc get -s customers filter 'like(email,*@example.com)'
- epcc delete customer-cart-association id=cust4_only data[0].type customer data[0].id email=cust4@example.com
- epcc delete customer-cart-association id=cust4_and_5 data[0].type customer data[0].id email=cust4@example.com
- epcc delete customer-cart-association id=cust4_and_5 data[0].type customer data[0].id email=cust5@example.com
- |
epcc delete customer email=cust4@example.com
epcc delete customer email=cust5@example.com
epcc delete customer email=cust6@example.com
- |
epcc delete cart cust4_only
epcc delete cart cust4_and_5
epcc delete cart no_cust_cart_custom_items
reset:
description:
Expand All @@ -96,13 +136,22 @@ actions:
epcc get -s pcm-pricebooks
epcc get -s pcm-catalog-rules
epcc get -s customers filter 'like(email,*@example.com)'
- epcc delete customer-cart-association id=cust1_only data[0].type customer data[0].id email=cust1@example.com
- epcc delete customer-cart-association id=cust1_and_2 data[0].type customer data[0].id email=cust1@example.com
- epcc delete customer-cart-association id=cust1_and_2 data[0].type customer data[0].id email=cust2@example.com
- epcc delete customer-cart-association id=cust4_only data[0].type customer data[0].id email=cust4@example.com
- epcc delete customer-cart-association id=cust4_and_5 data[0].type customer data[0].id email=cust4@example.com
- epcc delete customer-cart-association id=cust4_and_5 data[0].type customer data[0].id email=cust5@example.com
- |
epcc get -s pcm-catalog-releases name=Ranges_Catalog
epcc get -s pcm-catalog-releases name=Ranges_Catalog_for_Special_Customers
- |
epcc delete customer email=cust1@example.com --if-alias-exists email=cust1@example.com
epcc delete customer email=cust2@example.com --if-alias-exists email=cust2@example.com
epcc delete customer email=cust3@example.com --if-alias-exists email=cust3@example.com
epcc delete customer email=cust4@example.com --if-alias-exists email=cust4@example.com
epcc delete customer email=cust5@example.com --if-alias-exists email=cust5@example.com
epcc delete customer email=cust6@example.com --if-alias-exists email=cust6@example.com
epcc delete currency code=GBP --if-alias-exists code=GBP
epcc delete pcm-catalog-release name=Ranges_Catalog name=Ranges_Catalog
epcc delete pcm-catalog-release name=Ranges_Catalog_for_Special_Customers name=Ranges_Catalog_for_Special_Customers
Expand All @@ -115,3 +164,10 @@ actions:
- |
epcc delete pcm-catalog name=Ranges_Catalog_for_Special_Customers --if-alias-exists name=Ranges_Catalog_for_Special_Customers
epcc delete pcm-catalog name=Ranges_Catalog --if-alias-exists name=Ranges_Catalog
- |
epcc delete cart cust1_only
epcc delete cart cust1_and_2
epcc delete cart no_cust_cart
epcc delete cart cust4_only
epcc delete cart cust4_and_5
epcc delete cart no_cust_cart_custom_items
11 changes: 10 additions & 1 deletion external/runbooks/run-all-runbooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set -x
#Let's test that epcc command works after an embarrassing bug that caused it to panic :(
epcc


epcc reset-store .+

echo "Starting Misc Runbook"
Expand Down Expand Up @@ -61,7 +62,15 @@ epcc runbooks run manual-gateway-how-to capture-payment
epcc runbooks run manual-gateway-how-to reset-cart
epcc runbooks run manual-gateway-how-to reset


echo "Starting Customer Cart Association Tests"
epcc reset-store .+
epcc runbooks run customer-cart-associations try-and-delete-all-carts
epcc runbooks run customer-cart-associations create-prerequisites
epcc runbooks run customer-cart-associations create-customers-and-carts-with-product-items
epcc runbooks run customer-cart-associations delete-customer-and-carts-with-product-items
epcc runbooks run customer-cart-associations create-customers-and-carts-with-custom-items
epcc runbooks run customer-cart-associations delete-customer-and-carts-with-custom-items
epcc runbooks run customer-cart-associations reset

echo "SUCCESS"

Expand Down

0 comments on commit 281e1f8

Please sign in to comment.