Skip to content

Subscriptions

Christopher Elwell edited this page May 20, 2016 · 1 revision

"users" table

"subscription_id"
 0 - None
 1 - "Regular membership"
 2 - "Premium membership"
 3 - "B2B unlimited deliveries"

"subscription_expiration_time"
e.g., 123456789
  - timestamp exactly 30 days from time of initial payment, and pushed forward 30 days every auto-renew
    - get current day number and round up to midnight then add 30 days, so it expires/auto-renews at midnight on the 31st day (PST)

"subscription_period_start_time"

"subscription_auto_renew"
true or false

"subscription_payment_log" - edn
[{:paid true
  :stripe_charge_id ch_6473812674826374832
  :stripe_customer_id_charged cus_87d7d87d8dd
  :stripe_balance_transaction_id txf878d97ffdffffff
  :time_paid 1235612223
  :amount_paid 1499}]

"subscriptions" table

holds definitions of each type of subscription

"id" - e.g.,                           1
"name" - e.g.,                         "Regular Membership"
"price" - e.g.,                        799
"period" - e.g.,                       2592000
"num_free_one_hour" - e.g.,            0
"num_free_three_hour" - e.g.,          3
"num_free_tire_pressure_check" - e.g., 1
"discount_one_hour" - e.g.,            -200 (save $2 for orders after num_free_one_hour)
"discount_three_hour" - e.g.,          -455

"orders" table

"tire_pressure_check" - true or false (whether or not courier is supposed to do a tire pressure check)
"subscription_id" - subscription id that was used on this order - e.g., 1 - i.e., the subscription_id that the user had at the time they made the order
"subscription_discount" - the total discount due to the subscription used (if any) - e.g., -200 OR e.g., -399 (one of the free deliveries)
Clone this wiki locally