Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- u.id AS user_id,
- u.locale AS language,
- u.username AS email,
- usp.product_id AS productId,
- DATE_FORMAT(usp.activated_on, '%Y-%m-%d') AS subscription_starts_at,
- DATE_FORMAT(usp.expiration_date, '%Y-%m-%d') AS subscription_ends_at,
- substring(p.subscription_interval, 1, 2) AS subscription_interval,
- aml.payment_method AS current_subscription_payment_method,
- aml.amount AS current_subscription_total_price,
- v.voucher_code AS current_subscription_voucher
- from user as u
- INNER JOIN user_subscription_plan AS usp ON usp.user_id = u.id
- INNER JOIN product p ON p.id = usp.product_id
- LEFT JOIN adyen_modification_log AS aml ON aml.subscription_id =
- usp.id
- LEFT JOIN user_voucher AS uservoucher ON uservoucher.subscription_id =
- usp.id
- LEFT JOIN voucher AS v ON v.id = uservoucher.voucher_id
- WHERE u.inactive = 0 AND usp.status IN ('N_OK', 'N_ENDED')
- GROUP BY u.id
- ORDER BY u.id;
- let userObject = {
- user_id: 111,
- language: 'english',
- email: 'whatever@something.com',
- subscriptions: [
- {
- subscription_starts_at: 'some date',
- subscription_ends_at: 'some date',
- payment_method: 'visa',
- amount: 666
- }
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement