SHARE
TWEET

Untitled

a guest Jul 24th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2. u.id AS user_id,
  3. u.locale AS language,
  4. u.username AS email,
  5. usp.product_id AS productId,
  6. DATE_FORMAT(usp.activated_on, '%Y-%m-%d') AS subscription_starts_at,
  7. DATE_FORMAT(usp.expiration_date, '%Y-%m-%d') AS subscription_ends_at,
  8. substring(p.subscription_interval, 1, 2) AS subscription_interval,
  9. aml.payment_method AS current_subscription_payment_method,
  10. aml.amount AS current_subscription_total_price,
  11. v.voucher_code AS current_subscription_voucher
  12. from user as u
  13. INNER JOIN user_subscription_plan AS usp ON usp.user_id = u.id
  14. INNER JOIN product p ON p.id = usp.product_id
  15. LEFT JOIN adyen_modification_log AS aml ON aml.subscription_id =
  16. usp.id
  17. LEFT JOIN user_voucher AS uservoucher ON uservoucher.subscription_id =
  18. usp.id
  19. LEFT JOIN voucher AS v ON v.id = uservoucher.voucher_id
  20. WHERE u.inactive = 0 AND usp.status IN ('N_OK', 'N_ENDED')
  21. GROUP BY u.id
  22. ORDER BY u.id;
  23.      
  24. let userObject = {
  25. user_id: 111,
  26. language: 'english',
  27. email: 'whatever@something.com',
  28. subscriptions: [
  29.     {
  30.         subscription_starts_at: 'some date',
  31.         subscription_ends_at: 'some date',
  32.         payment_method: 'visa',
  33.         amount: 666
  34.     }
  35. ]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top