From 281e1f8f7c9879fff694d13740552c5d37531edd Mon Sep 17 00:00:00 2001 From: Steve Ramage Date: Fri, 29 Dec 2023 09:24:37 -0800 Subject: [PATCH] Resolves #385 - Add support for customer cart associations --- .../customer-cart-associations.epcc.yml | 94 +++++++++++++++---- external/runbooks/run-all-runbooks.sh | 11 ++- 2 files changed, 85 insertions(+), 20 deletions(-) diff --git a/external/runbooks/customer-cart-associations.epcc.yml b/external/runbooks/customer-cart-associations.epcc.yml index a610d19..74448dd 100644 --- a/external/runbooks/customer-cart-associations.epcc.yml +++ b/external/runbooks/customer-cart-associations.epcc.yml @@ -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 @@ -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: @@ -96,6 +136,12 @@ 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 @@ -103,6 +149,9 @@ actions: 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 @@ -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 diff --git a/external/runbooks/run-all-runbooks.sh b/external/runbooks/run-all-runbooks.sh index bb3cda0..cae47e1 100755 --- a/external/runbooks/run-all-runbooks.sh +++ b/external/runbooks/run-all-runbooks.sh @@ -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" @@ -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"