Skip to content

Instantly share code, notes, and snippets.

@ryanhanks
Last active April 11, 2019 21:02
Show Gist options
  • Save ryanhanks/f58d0b508b59b2d8ca4e2851199e19e9 to your computer and use it in GitHub Desktop.
Save ryanhanks/f58d0b508b59b2d8ca4e2851199e19e9 to your computer and use it in GitHub Desktop.
#!/bin/bash
site_id=flamingo_us
cas_base_url="https://customer-account-service.sandbox.core.harrys.systems/api/v1/sites/$site_id"
customer_id=`uuidgen`
verbose=-v
verbose=
# set -x
# curl -X POST $cas_base_url/customers/$customer_id -v -d "{\"default_payment_source_id\": \"$payment_source_id\"}"
curl -sS $cas_base_url/customers/$customer_id $verbose -d "{}" | jq
echo $id $id
shipping_address_id=$(curl -sS $cas_base_url/customers/$customer_id/shipping-addresses $verbose -d'
{
"name": "string",
"address_line1": "string",
"address_line2": "string",
"country": "US",
"city": "string",
"province": "VA",
"postal_code": "20166",
"phone_number": "+17032651000"
}' | jq -r ".id")
echo $shipping_address_id
payment_source_id=$(curl -sS $cas_base_url/customers/$customer_id/payment-sources $verbose -d'
{
"stripe_token": "tok_visa"
}' | jq -r ".id")
echo $payment_source_id
subscriptions_service_base_url="https://subscriptions-service.sandbox.core.harrys.systems"
subscriptions_service_base_url="http://localhost:9000"
subscription_id=`uuidgen`
curl $subscriptions_service_base_url/customers/$customer_id/subscriptions/$subscription_id -d"
{
\"payment_source_id\": \"$payment_source_id\",
\"shipping_address_id\": \"$shipping_address_id\",
\"items\": [
{ \"product_id\": 10001, \"quantity\": 1}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment