From 1c1b0f00adf94bdf781cc01531ca1882e59e1cea Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Sun, 8 Apr 2018 16:27:03 +0200 Subject: [PATCH] reorganize payments files (#10235) --- .../groups/POST-groups_groupId_leave.js | 2 +- .../GET-payments_amazon_subscribe_cancel.test.js | 2 +- .../amazon/POST-payments_amazon_checkout.test.js | 2 +- .../POST-payments_amazon_subscribe.test.js | 2 +- .../apple/GET-payments_apple_cancelSubscribe.js | 2 +- .../apple/POST-payments_apple_verifyiap.js | 2 +- .../apple/POST-payments_google_subscribe.test.js | 2 +- .../GET-payments_google_cancelSubscribe.js | 2 +- .../POST-payments_google_subscribe.test.js | 2 +- .../google/POST-payments_google_verifyiap.js | 2 +- .../paypal/GET-payments_paypal_checkout.test.js | 2 +- .../GET-payments_paypal_checkout_success.test.js | 2 +- .../paypal/GET-payments_paypal_subscribe.test.js | 2 +- .../GET-payments_paypal_subscribe_cancel.test.js | 2 +- ...GET-payments_paypal_subscribe_success.test.js | 2 +- .../paypal/POST-payments_paypal_ipn.test.js | 2 +- .../GET-payments_stripe_subscribe_cancel.test.js | 2 +- .../stripe/POST-payments_stripe_checkout.test.js | 2 +- .../POST-payments_stripe_subscribe_edit.test.js | 2 +- .../v3/unit/libs/payments/amazon/cancel.test.js | 4 ++-- .../unit/libs/payments/amazon/checkout.test.js | 4 ++-- .../unit/libs/payments/amazon/subscribe.test.js | 4 ++-- .../payments/amazon/upgrade-groupplan.test.js | 4 ++-- .../apple.test.js} | 12 ++++++------ .../google.test.js} | 12 ++++++------ .../group-plans/group-payments-cancel.test.js | 2 +- .../group-plans/group-payments-create.test.js | 8 ++++---- .../v3/unit/libs/{ => payments}/payments.test.js | 14 +++++++------- .../payments/paypal/checkout-success.test.js | 4 ++-- .../unit/libs/payments/paypal/checkout.test.js | 2 +- .../api/v3/unit/libs/payments/paypal/ipn.test.js | 4 ++-- .../payments/paypal/subscribe-cancel.test.js | 4 ++-- .../payments/paypal/subscribe-success.test.js | 4 ++-- .../unit/libs/payments/paypal/subscribe.test.js | 2 +- .../payments/stripe/cancel-subscription.test.js | 4 ++-- .../stripe/checkout-subscription.test.js | 4 ++-- .../unit/libs/payments/stripe/checkout.test.js | 4 ++-- .../payments/stripe/edit-subscription.test.js | 2 +- .../libs/payments/stripe/handle-webhook.test.js | 4 ++-- .../payments/stripe/upgrade-group-plan.test.js | 4 ++-- website/server/controllers/api-v3/groups.js | 6 +++--- .../controllers/top-level/payments/amazon.js | 2 +- .../server/controllers/top-level/payments/iap.js | 4 ++-- .../controllers/top-level/payments/paypal.js | 2 +- .../controllers/top-level/payments/stripe.js | 2 +- .../{amazonPayments.js => payments/amazon.js} | 10 +++++----- .../libs/{applePayments.js => payments/apple.js} | 10 +++++----- .../{googlePayments.js => payments/google.js} | 10 +++++----- website/server/libs/{ => payments}/payments.js | 16 ++++++++-------- .../{paypalPayments.js => payments/paypal.js} | 10 +++++----- .../{stripePayments.js => payments/stripe.js} | 12 ++++++------ website/server/models/group.js | 6 +++--- website/server/models/user/methods.js | 8 ++++---- 53 files changed, 121 insertions(+), 121 deletions(-) rename test/api/v3/unit/libs/{applePayments.test.js => payments/apple.test.js} (95%) rename test/api/v3/unit/libs/{googlePayments.test.js => payments/google.test.js} (95%) rename test/api/v3/unit/libs/{ => payments}/payments.test.js (97%) rename website/server/libs/{amazonPayments.js => payments/amazon.js} (98%) rename website/server/libs/{applePayments.js => payments/apple.js} (96%) rename website/server/libs/{googlePayments.js => payments/google.js} (95%) rename website/server/libs/{ => payments}/payments.js (98%) rename website/server/libs/{paypalPayments.js => payments/paypal.js} (97%) rename website/server/libs/{stripePayments.js => payments/stripe.js} (97%) diff --git a/test/api/v3/integration/groups/POST-groups_groupId_leave.js b/test/api/v3/integration/groups/POST-groups_groupId_leave.js index 615b5e01e2..2afa2dcc02 100644 --- a/test/api/v3/integration/groups/POST-groups_groupId_leave.js +++ b/test/api/v3/integration/groups/POST-groups_groupId_leave.js @@ -11,7 +11,7 @@ import { each, } from 'lodash'; import { model as User } from '../../../../../website/server/models/user'; -import * as payments from '../../../../../website/server/libs/payments'; +import * as payments from '../../../../../website/server/libs/payments/payments'; describe('POST /groups/:groupId/leave', () => { let typesOfGroups = { diff --git a/test/api/v3/integration/payments/amazon/GET-payments_amazon_subscribe_cancel.test.js b/test/api/v3/integration/payments/amazon/GET-payments_amazon_subscribe_cancel.test.js index 0b5bedd4be..8f306b2723 100644 --- a/test/api/v3/integration/payments/amazon/GET-payments_amazon_subscribe_cancel.test.js +++ b/test/api/v3/integration/payments/amazon/GET-payments_amazon_subscribe_cancel.test.js @@ -3,7 +3,7 @@ import { generateGroup, translate as t, } from '../../../../../helpers/api-integration/v3'; -import amzLib from '../../../../../../website/server/libs/amazonPayments'; +import amzLib from '../../../../../../website/server/libs/payments/amazon'; describe('payments : amazon #subscribeCancel', () => { let endpoint = '/amazon/subscribe/cancel?noRedirect=true'; diff --git a/test/api/v3/integration/payments/amazon/POST-payments_amazon_checkout.test.js b/test/api/v3/integration/payments/amazon/POST-payments_amazon_checkout.test.js index 7a431b4242..835b92e929 100644 --- a/test/api/v3/integration/payments/amazon/POST-payments_amazon_checkout.test.js +++ b/test/api/v3/integration/payments/amazon/POST-payments_amazon_checkout.test.js @@ -1,7 +1,7 @@ import { generateUser, } from '../../../../../helpers/api-integration/v3'; -import amzLib from '../../../../../../website/server/libs/amazonPayments'; +import amzLib from '../../../../../../website/server/libs/payments/amazon'; describe('payments - amazon - #checkout', () => { let endpoint = '/amazon/checkout'; diff --git a/test/api/v3/integration/payments/amazon/POST-payments_amazon_subscribe.test.js b/test/api/v3/integration/payments/amazon/POST-payments_amazon_subscribe.test.js index 8948609c4c..63d0a5216b 100644 --- a/test/api/v3/integration/payments/amazon/POST-payments_amazon_subscribe.test.js +++ b/test/api/v3/integration/payments/amazon/POST-payments_amazon_subscribe.test.js @@ -3,7 +3,7 @@ import { generateGroup, translate as t, } from '../../../../../helpers/api-integration/v3'; -import amzLib from '../../../../../../website/server/libs/amazonPayments'; +import amzLib from '../../../../../../website/server/libs/payments/amazon'; describe('payments - amazon - #subscribe', () => { let endpoint = '/amazon/subscribe'; diff --git a/test/api/v3/integration/payments/apple/GET-payments_apple_cancelSubscribe.js b/test/api/v3/integration/payments/apple/GET-payments_apple_cancelSubscribe.js index 013c8c20bd..56bef407ea 100644 --- a/test/api/v3/integration/payments/apple/GET-payments_apple_cancelSubscribe.js +++ b/test/api/v3/integration/payments/apple/GET-payments_apple_cancelSubscribe.js @@ -1,5 +1,5 @@ import {generateUser} from '../../../../../helpers/api-integration/v3'; -import applePayments from '../../../../../../website/server/libs/applePayments'; +import applePayments from '../../../../../../website/server/libs/payments/apple'; describe('payments : apple #cancelSubscribe', () => { let endpoint = '/iap/ios/subscribe/cancel?noRedirect=true'; diff --git a/test/api/v3/integration/payments/apple/POST-payments_apple_verifyiap.js b/test/api/v3/integration/payments/apple/POST-payments_apple_verifyiap.js index 72ebf915f7..74a1704c9e 100644 --- a/test/api/v3/integration/payments/apple/POST-payments_apple_verifyiap.js +++ b/test/api/v3/integration/payments/apple/POST-payments_apple_verifyiap.js @@ -1,5 +1,5 @@ import {generateUser} from '../../../../../helpers/api-integration/v3'; -import applePayments from '../../../../../../website/server/libs/applePayments'; +import applePayments from '../../../../../../website/server/libs/payments/apple'; describe('payments : apple #verify', () => { let endpoint = '/iap/ios/verify'; diff --git a/test/api/v3/integration/payments/apple/POST-payments_google_subscribe.test.js b/test/api/v3/integration/payments/apple/POST-payments_google_subscribe.test.js index 4834844df7..a5b6458d16 100644 --- a/test/api/v3/integration/payments/apple/POST-payments_google_subscribe.test.js +++ b/test/api/v3/integration/payments/apple/POST-payments_google_subscribe.test.js @@ -1,5 +1,5 @@ import {generateUser, translate as t} from '../../../../../helpers/api-integration/v3'; -import applePayments from '../../../../../../website/server/libs/applePayments'; +import applePayments from '../../../../../../website/server/libs/payments/apple'; describe('payments : apple #subscribe', () => { let endpoint = '/iap/ios/subscribe'; diff --git a/test/api/v3/integration/payments/google/GET-payments_google_cancelSubscribe.js b/test/api/v3/integration/payments/google/GET-payments_google_cancelSubscribe.js index 06f4d0f9f7..a37e15331e 100644 --- a/test/api/v3/integration/payments/google/GET-payments_google_cancelSubscribe.js +++ b/test/api/v3/integration/payments/google/GET-payments_google_cancelSubscribe.js @@ -1,5 +1,5 @@ import {generateUser} from '../../../../../helpers/api-integration/v3'; -import googlePayments from '../../../../../../website/server/libs/googlePayments'; +import googlePayments from '../../../../../../website/server/libs/payments/google'; describe('payments : google #cancelSubscribe', () => { let endpoint = '/iap/android/subscribe/cancel?noRedirect=true'; diff --git a/test/api/v3/integration/payments/google/POST-payments_google_subscribe.test.js b/test/api/v3/integration/payments/google/POST-payments_google_subscribe.test.js index f91ebc8da8..c9418f77ce 100644 --- a/test/api/v3/integration/payments/google/POST-payments_google_subscribe.test.js +++ b/test/api/v3/integration/payments/google/POST-payments_google_subscribe.test.js @@ -1,5 +1,5 @@ import {generateUser, translate as t} from '../../../../../helpers/api-integration/v3'; -import googlePayments from '../../../../../../website/server/libs/googlePayments'; +import googlePayments from '../../../../../../website/server/libs/payments/google'; describe('payments : google #subscribe', () => { let endpoint = '/iap/android/subscribe'; diff --git a/test/api/v3/integration/payments/google/POST-payments_google_verifyiap.js b/test/api/v3/integration/payments/google/POST-payments_google_verifyiap.js index aa0f4d18b2..04b63f25e3 100644 --- a/test/api/v3/integration/payments/google/POST-payments_google_verifyiap.js +++ b/test/api/v3/integration/payments/google/POST-payments_google_verifyiap.js @@ -1,5 +1,5 @@ import {generateUser} from '../../../../../helpers/api-integration/v3'; -import googlePayments from '../../../../../../website/server/libs/googlePayments'; +import googlePayments from '../../../../../../website/server/libs/payments/google'; describe('payments : google #verify', () => { let endpoint = '/iap/android/verify'; diff --git a/test/api/v3/integration/payments/paypal/GET-payments_paypal_checkout.test.js b/test/api/v3/integration/payments/paypal/GET-payments_paypal_checkout.test.js index 253bd611ec..804a2c4b74 100644 --- a/test/api/v3/integration/payments/paypal/GET-payments_paypal_checkout.test.js +++ b/test/api/v3/integration/payments/paypal/GET-payments_paypal_checkout.test.js @@ -1,7 +1,7 @@ import { generateUser, } from '../../../../../helpers/api-integration/v3'; -import paypalPayments from '../../../../../../website/server/libs/paypalPayments'; +import paypalPayments from '../../../../../../website/server/libs/payments/paypal'; describe('payments : paypal #checkout', () => { let endpoint = '/paypal/checkout'; diff --git a/test/api/v3/integration/payments/paypal/GET-payments_paypal_checkout_success.test.js b/test/api/v3/integration/payments/paypal/GET-payments_paypal_checkout_success.test.js index 14b83e55b1..bae6423be0 100644 --- a/test/api/v3/integration/payments/paypal/GET-payments_paypal_checkout_success.test.js +++ b/test/api/v3/integration/payments/paypal/GET-payments_paypal_checkout_success.test.js @@ -2,7 +2,7 @@ import { generateUser, translate as t, } from '../../../../../helpers/api-integration/v3'; -import paypalPayments from '../../../../../../website/server/libs/paypalPayments'; +import paypalPayments from '../../../../../../website/server/libs/payments/paypal'; describe('payments : paypal #checkoutSuccess', () => { let endpoint = '/paypal/checkout/success'; diff --git a/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe.test.js b/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe.test.js index 20bf11b0f5..3146eb0c5d 100644 --- a/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe.test.js +++ b/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe.test.js @@ -2,7 +2,7 @@ import { generateUser, translate as t, } from '../../../../../helpers/api-integration/v3'; -import paypalPayments from '../../../../../../website/server/libs/paypalPayments'; +import paypalPayments from '../../../../../../website/server/libs/payments/paypal'; import shared from '../../../../../../website/common'; describe('payments : paypal #subscribe', () => { diff --git a/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe_cancel.test.js b/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe_cancel.test.js index ef65e0a347..28893f480d 100644 --- a/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe_cancel.test.js +++ b/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe_cancel.test.js @@ -2,7 +2,7 @@ import { generateUser, translate as t, } from '../../../../../helpers/api-integration/v3'; -import paypalPayments from '../../../../../../website/server/libs/paypalPayments'; +import paypalPayments from '../../../../../../website/server/libs/payments/paypal'; describe('payments : paypal #subscribeCancel', () => { let endpoint = '/paypal/subscribe/cancel'; diff --git a/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe_success.test.js b/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe_success.test.js index e730183127..bace51302a 100644 --- a/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe_success.test.js +++ b/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe_success.test.js @@ -2,7 +2,7 @@ import { generateUser, translate as t, } from '../../../../../helpers/api-integration/v3'; -import paypalPayments from '../../../../../../website/server/libs/paypalPayments'; +import paypalPayments from '../../../../../../website/server/libs/payments/paypal'; describe('payments : paypal #subscribeSuccess', () => { let endpoint = '/paypal/subscribe/success'; diff --git a/test/api/v3/integration/payments/paypal/POST-payments_paypal_ipn.test.js b/test/api/v3/integration/payments/paypal/POST-payments_paypal_ipn.test.js index 7202ed3263..6b64c62002 100644 --- a/test/api/v3/integration/payments/paypal/POST-payments_paypal_ipn.test.js +++ b/test/api/v3/integration/payments/paypal/POST-payments_paypal_ipn.test.js @@ -1,7 +1,7 @@ import { generateUser, } from '../../../../../helpers/api-integration/v3'; -import paypalPayments from '../../../../../../website/server/libs/paypalPayments'; +import paypalPayments from '../../../../../../website/server/libs/payments/paypal'; describe('payments - paypal - #ipn', () => { let endpoint = '/paypal/ipn'; diff --git a/test/api/v3/integration/payments/stripe/GET-payments_stripe_subscribe_cancel.test.js b/test/api/v3/integration/payments/stripe/GET-payments_stripe_subscribe_cancel.test.js index 1c9dfe4a86..0bc8fc7e74 100644 --- a/test/api/v3/integration/payments/stripe/GET-payments_stripe_subscribe_cancel.test.js +++ b/test/api/v3/integration/payments/stripe/GET-payments_stripe_subscribe_cancel.test.js @@ -3,7 +3,7 @@ import { generateGroup, translate as t, } from '../../../../../helpers/api-integration/v3'; -import stripePayments from '../../../../../../website/server/libs/stripePayments'; +import stripePayments from '../../../../../../website/server/libs/payments/stripe'; describe('payments - stripe - #subscribeCancel', () => { let endpoint = '/stripe/subscribe/cancel?redirect=none'; diff --git a/test/api/v3/integration/payments/stripe/POST-payments_stripe_checkout.test.js b/test/api/v3/integration/payments/stripe/POST-payments_stripe_checkout.test.js index 7b59930c87..d90d5fbf39 100644 --- a/test/api/v3/integration/payments/stripe/POST-payments_stripe_checkout.test.js +++ b/test/api/v3/integration/payments/stripe/POST-payments_stripe_checkout.test.js @@ -2,7 +2,7 @@ import { generateUser, generateGroup, } from '../../../../../helpers/api-integration/v3'; -import stripePayments from '../../../../../../website/server/libs/stripePayments'; +import stripePayments from '../../../../../../website/server/libs/payments/stripe'; describe('payments - stripe - #checkout', () => { let endpoint = '/stripe/checkout'; diff --git a/test/api/v3/integration/payments/stripe/POST-payments_stripe_subscribe_edit.test.js b/test/api/v3/integration/payments/stripe/POST-payments_stripe_subscribe_edit.test.js index 4351077fdb..dfd7b2332c 100644 --- a/test/api/v3/integration/payments/stripe/POST-payments_stripe_subscribe_edit.test.js +++ b/test/api/v3/integration/payments/stripe/POST-payments_stripe_subscribe_edit.test.js @@ -3,7 +3,7 @@ import { generateGroup, translate as t, } from '../../../../../helpers/api-integration/v3'; -import stripePayments from '../../../../../../website/server/libs/stripePayments'; +import stripePayments from '../../../../../../website/server/libs/payments/stripe'; describe('payments - stripe - #subscribeEdit', () => { let endpoint = '/stripe/subscribe/edit'; diff --git a/test/api/v3/unit/libs/payments/amazon/cancel.test.js b/test/api/v3/unit/libs/payments/amazon/cancel.test.js index 13e524f58f..7d4c020727 100644 --- a/test/api/v3/unit/libs/payments/amazon/cancel.test.js +++ b/test/api/v3/unit/libs/payments/amazon/cancel.test.js @@ -4,8 +4,8 @@ import { generateGroup, } from '../../../../../../helpers/api-unit.helper.js'; import { model as User } from '../../../../../../../website/server/models/user'; -import amzLib from '../../../../../../../website/server/libs/amazonPayments'; -import payments from '../../../../../../../website/server/libs/payments'; +import amzLib from '../../../../../../../website/server/libs/payments/amazon'; +import payments from '../../../../../../../website/server/libs/payments/payments'; import common from '../../../../../../../website/common'; import { createNonLeaderGroupMember } from '../paymentHelpers'; diff --git a/test/api/v3/unit/libs/payments/amazon/checkout.test.js b/test/api/v3/unit/libs/payments/amazon/checkout.test.js index 0581c76772..7748f2b532 100644 --- a/test/api/v3/unit/libs/payments/amazon/checkout.test.js +++ b/test/api/v3/unit/libs/payments/amazon/checkout.test.js @@ -1,6 +1,6 @@ import { model as User } from '../../../../../../../website/server/models/user'; -import amzLib from '../../../../../../../website/server/libs/amazonPayments'; -import payments from '../../../../../../../website/server/libs/payments'; +import amzLib from '../../../../../../../website/server/libs/payments/amazon'; +import payments from '../../../../../../../website/server/libs/payments/payments'; import common from '../../../../../../../website/common'; const i18n = common.i18n; diff --git a/test/api/v3/unit/libs/payments/amazon/subscribe.test.js b/test/api/v3/unit/libs/payments/amazon/subscribe.test.js index b0ae072880..ad35f16ea9 100644 --- a/test/api/v3/unit/libs/payments/amazon/subscribe.test.js +++ b/test/api/v3/unit/libs/payments/amazon/subscribe.test.js @@ -5,8 +5,8 @@ import { } from '../../../../../../helpers/api-unit.helper.js'; import { model as User } from '../../../../../../../website/server/models/user'; import { model as Coupon } from '../../../../../../../website/server/models/coupon'; -import amzLib from '../../../../../../../website/server/libs/amazonPayments'; -import payments from '../../../../../../../website/server/libs/payments'; +import amzLib from '../../../../../../../website/server/libs/payments/amazon'; +import payments from '../../../../../../../website/server/libs/payments/payments'; import common from '../../../../../../../website/common'; const i18n = common.i18n; diff --git a/test/api/v3/unit/libs/payments/amazon/upgrade-groupplan.test.js b/test/api/v3/unit/libs/payments/amazon/upgrade-groupplan.test.js index e60516e49c..44d994daab 100644 --- a/test/api/v3/unit/libs/payments/amazon/upgrade-groupplan.test.js +++ b/test/api/v3/unit/libs/payments/amazon/upgrade-groupplan.test.js @@ -5,8 +5,8 @@ import { } from '../../../../../../helpers/api-unit.helper.js'; import { model as User } from '../../../../../../../website/server/models/user'; import { model as Group } from '../../../../../../../website/server/models/group'; -import amzLib from '../../../../../../../website/server/libs/amazonPayments'; -import payments from '../../../../../../../website/server/libs/payments'; +import amzLib from '../../../../../../../website/server/libs/payments/amazon'; +import payments from '../../../../../../../website/server/libs/payments/payments'; describe('#upgradeGroupPlan', () => { let spy, data, user, group, uuidString; diff --git a/test/api/v3/unit/libs/applePayments.test.js b/test/api/v3/unit/libs/payments/apple.test.js similarity index 95% rename from test/api/v3/unit/libs/applePayments.test.js rename to test/api/v3/unit/libs/payments/apple.test.js index db199bd565..7dcbbf421f 100644 --- a/test/api/v3/unit/libs/applePayments.test.js +++ b/test/api/v3/unit/libs/payments/apple.test.js @@ -1,10 +1,10 @@ /* eslint-disable camelcase */ -import iapModule from '../../../../../website/server/libs/inAppPurchases'; -import payments from '../../../../../website/server/libs/payments'; -import applePayments from '../../../../../website/server/libs/applePayments'; -import iap from '../../../../../website/server/libs/inAppPurchases'; -import {model as User} from '../../../../../website/server/models/user'; -import common from '../../../../../website/common'; +import iapModule from '../../../../../../website/server/libs/inAppPurchases'; +import payments from '../../../../../../website/server/libs/payments/payments'; +import applePayments from '../../../../../../website/server/libs/payments/apple'; +import iap from '../../../../../../website/server/libs/inAppPurchases'; +import {model as User} from '../../../../../../website/server/models/user'; +import common from '../../../../../../website/common'; import moment from 'moment'; const i18n = common.i18n; diff --git a/test/api/v3/unit/libs/googlePayments.test.js b/test/api/v3/unit/libs/payments/google.test.js similarity index 95% rename from test/api/v3/unit/libs/googlePayments.test.js rename to test/api/v3/unit/libs/payments/google.test.js index 76ba779fb4..5c2f8f3a29 100644 --- a/test/api/v3/unit/libs/googlePayments.test.js +++ b/test/api/v3/unit/libs/payments/google.test.js @@ -1,10 +1,10 @@ /* eslint-disable camelcase */ -import iapModule from '../../../../../website/server/libs/inAppPurchases'; -import payments from '../../../../../website/server/libs/payments'; -import googlePayments from '../../../../../website/server/libs/googlePayments'; -import iap from '../../../../../website/server/libs/inAppPurchases'; -import {model as User} from '../../../../../website/server/models/user'; -import common from '../../../../../website/common'; +import iapModule from '../../../../../../website/server/libs/inAppPurchases'; +import payments from '../../../../../../website/server/libs/payments/payments'; +import googlePayments from '../../../../../../website/server/libs/payments/google'; +import iap from '../../../../../../website/server/libs/inAppPurchases'; +import {model as User} from '../../../../../../website/server/models/user'; +import common from '../../../../../../website/common'; import moment from 'moment'; const i18n = common.i18n; diff --git a/test/api/v3/unit/libs/payments/group-plans/group-payments-cancel.test.js b/test/api/v3/unit/libs/payments/group-plans/group-payments-cancel.test.js index 438ce5dc60..ffb569e53b 100644 --- a/test/api/v3/unit/libs/payments/group-plans/group-payments-cancel.test.js +++ b/test/api/v3/unit/libs/payments/group-plans/group-payments-cancel.test.js @@ -1,7 +1,7 @@ import moment from 'moment'; import * as sender from '../../../../../../../website/server/libs/email'; -import * as api from '../../../../../../../website/server/libs/payments'; +import * as api from '../../../../../../../website/server/libs/payments/payments'; import { model as User } from '../../../../../../../website/server/models/user'; import { model as Group } from '../../../../../../../website/server/models/group'; import { diff --git a/test/api/v3/unit/libs/payments/group-plans/group-payments-create.test.js b/test/api/v3/unit/libs/payments/group-plans/group-payments-create.test.js index 72489aa4df..f25038002c 100644 --- a/test/api/v3/unit/libs/payments/group-plans/group-payments-create.test.js +++ b/test/api/v3/unit/libs/payments/group-plans/group-payments-create.test.js @@ -3,10 +3,10 @@ import stripeModule from 'stripe'; import nconf from 'nconf'; import * as sender from '../../../../../../../website/server/libs/email'; -import * as api from '../../../../../../../website/server/libs/payments'; -import amzLib from '../../../../../../../website/server/libs/amazonPayments'; -import stripePayments from '../../../../../../../website/server/libs/stripePayments'; -import paypalPayments from '../../../../../../../website/server/libs/paypalPayments'; +import * as api from '../../../../../../../website/server/libs/payments/payments'; +import amzLib from '../../../../../../../website/server/libs/payments/amazon'; +import paypalPayments from '../../../../../../../website/server/libs/payments/paypal'; +import stripePayments from '../../../../../../../website/server/libs/payments/stripe'; import { model as User } from '../../../../../../../website/server/models/user'; import { model as Group } from '../../../../../../../website/server/models/group'; import { diff --git a/test/api/v3/unit/libs/payments.test.js b/test/api/v3/unit/libs/payments/payments.test.js similarity index 97% rename from test/api/v3/unit/libs/payments.test.js rename to test/api/v3/unit/libs/payments/payments.test.js index 54e121c7b7..85e6d91676 100644 --- a/test/api/v3/unit/libs/payments.test.js +++ b/test/api/v3/unit/libs/payments/payments.test.js @@ -1,14 +1,14 @@ import moment from 'moment'; -import * as sender from '../../../../../website/server/libs/email'; -import * as api from '../../../../../website/server/libs/payments'; -import analytics from '../../../../../website/server/libs/analyticsService'; -import notifications from '../../../../../website/server/libs/pushNotifications'; -import { model as User } from '../../../../../website/server/models/user'; -import { translate as t } from '../../../../helpers/api-v3-integration.helper'; +import * as sender from '../../../../../../website/server/libs/email'; +import * as api from '../../../../../../website/server/libs/payments/payments'; +import analytics from '../../../../../../website/server/libs/analyticsService'; +import notifications from '../../../../../../website/server/libs/pushNotifications'; +import { model as User } from '../../../../../../website/server/models/user'; +import { translate as t } from '../../../../../helpers/api-v3-integration.helper'; import { generateGroup, -} from '../../../../helpers/api-unit.helper.js'; +} from '../../../../../helpers/api-unit.helper.js'; describe('payments/index', () => { let user, group, data, plan; diff --git a/test/api/v3/unit/libs/payments/paypal/checkout-success.test.js b/test/api/v3/unit/libs/payments/paypal/checkout-success.test.js index 5f63b99050..a006fe4882 100644 --- a/test/api/v3/unit/libs/payments/paypal/checkout-success.test.js +++ b/test/api/v3/unit/libs/payments/paypal/checkout-success.test.js @@ -1,6 +1,6 @@ /* eslint-disable camelcase */ -import payments from '../../../../../../../website/server/libs/payments'; -import paypalPayments from '../../../../../../../website/server/libs/paypalPayments'; +import paypalPayments from '../../../../../../../website/server/libs/payments/paypal'; +import payments from '../../../../../../../website/server/libs/payments/payments'; import { model as User } from '../../../../../../../website/server/models/user'; describe('checkout success', () => { diff --git a/test/api/v3/unit/libs/payments/paypal/checkout.test.js b/test/api/v3/unit/libs/payments/paypal/checkout.test.js index aaa83535ee..f02b9ff39e 100644 --- a/test/api/v3/unit/libs/payments/paypal/checkout.test.js +++ b/test/api/v3/unit/libs/payments/paypal/checkout.test.js @@ -1,7 +1,7 @@ /* eslint-disable camelcase */ import nconf from 'nconf'; -import paypalPayments from '../../../../../../../website/server/libs/paypalPayments'; +import paypalPayments from '../../../../../../../website/server/libs/payments/paypal'; import { model as User } from '../../../../../../../website/server/models/user'; import common from '../../../../../../../website/common'; diff --git a/test/api/v3/unit/libs/payments/paypal/ipn.test.js b/test/api/v3/unit/libs/payments/paypal/ipn.test.js index 7094b67cb9..0f0468308d 100644 --- a/test/api/v3/unit/libs/payments/paypal/ipn.test.js +++ b/test/api/v3/unit/libs/payments/paypal/ipn.test.js @@ -1,6 +1,6 @@ /* eslint-disable camelcase */ -import payments from '../../../../../../../website/server/libs/payments'; -import paypalPayments from '../../../../../../../website/server/libs/paypalPayments'; +import paypalPayments from '../../../../../../../website/server/libs/payments/paypal'; +import payments from '../../../../../../../website/server/libs/payments/payments'; import { generateGroup, } from '../../../../../../helpers/api-unit.helper.js'; diff --git a/test/api/v3/unit/libs/payments/paypal/subscribe-cancel.test.js b/test/api/v3/unit/libs/payments/paypal/subscribe-cancel.test.js index ef5b399fed..01fa114d70 100644 --- a/test/api/v3/unit/libs/payments/paypal/subscribe-cancel.test.js +++ b/test/api/v3/unit/libs/payments/paypal/subscribe-cancel.test.js @@ -1,6 +1,6 @@ /* eslint-disable camelcase */ -import payments from '../../../../../../../website/server/libs/payments'; -import paypalPayments from '../../../../../../../website/server/libs/paypalPayments'; +import paypalPayments from '../../../../../../../website/server/libs/payments/paypal'; +import payments from '../../../../../../../website/server/libs/payments/payments'; import { generateGroup, } from '../../../../../../helpers/api-unit.helper.js'; diff --git a/test/api/v3/unit/libs/payments/paypal/subscribe-success.test.js b/test/api/v3/unit/libs/payments/paypal/subscribe-success.test.js index 5caaf34fc8..aa33429b5e 100644 --- a/test/api/v3/unit/libs/payments/paypal/subscribe-success.test.js +++ b/test/api/v3/unit/libs/payments/paypal/subscribe-success.test.js @@ -1,6 +1,6 @@ /* eslint-disable camelcase */ -import payments from '../../../../../../../website/server/libs/payments'; -import paypalPayments from '../../../../../../../website/server/libs/paypalPayments'; +import paypalPayments from '../../../../../../../website/server/libs/payments/paypal'; +import payments from '../../../../../../../website/server/libs/payments/payments'; import { generateGroup, } from '../../../../../../helpers/api-unit.helper.js'; diff --git a/test/api/v3/unit/libs/payments/paypal/subscribe.test.js b/test/api/v3/unit/libs/payments/paypal/subscribe.test.js index ee1ccd3938..cc7660a5f9 100644 --- a/test/api/v3/unit/libs/payments/paypal/subscribe.test.js +++ b/test/api/v3/unit/libs/payments/paypal/subscribe.test.js @@ -2,7 +2,7 @@ import moment from 'moment'; import cc from 'coupon-code'; -import paypalPayments from '../../../../../../../website/server/libs/paypalPayments'; +import paypalPayments from '../../../../../../../website/server/libs/payments/paypal'; import { model as Coupon } from '../../../../../../../website/server/models/coupon'; import common from '../../../../../../../website/common'; diff --git a/test/api/v3/unit/libs/payments/stripe/cancel-subscription.test.js b/test/api/v3/unit/libs/payments/stripe/cancel-subscription.test.js index d062ad0b89..ca3a92b721 100644 --- a/test/api/v3/unit/libs/payments/stripe/cancel-subscription.test.js +++ b/test/api/v3/unit/libs/payments/stripe/cancel-subscription.test.js @@ -4,8 +4,8 @@ import { generateGroup, } from '../../../../../../helpers/api-unit.helper.js'; import { model as User } from '../../../../../../../website/server/models/user'; -import stripePayments from '../../../../../../../website/server/libs/stripePayments'; -import payments from '../../../../../../../website/server/libs/payments'; +import stripePayments from '../../../../../../../website/server/libs/payments/stripe'; +import payments from '../../../../../../../website/server/libs/payments/payments'; import common from '../../../../../../../website/common'; const i18n = common.i18n; diff --git a/test/api/v3/unit/libs/payments/stripe/checkout-subscription.test.js b/test/api/v3/unit/libs/payments/stripe/checkout-subscription.test.js index 411acbedaf..7154ef4655 100644 --- a/test/api/v3/unit/libs/payments/stripe/checkout-subscription.test.js +++ b/test/api/v3/unit/libs/payments/stripe/checkout-subscription.test.js @@ -6,8 +6,8 @@ import { } from '../../../../../../helpers/api-unit.helper.js'; import { model as User } from '../../../../../../../website/server/models/user'; import { model as Coupon } from '../../../../../../../website/server/models/coupon'; -import stripePayments from '../../../../../../../website/server/libs/stripePayments'; -import payments from '../../../../../../../website/server/libs/payments'; +import stripePayments from '../../../../../../../website/server/libs/payments/stripe'; +import payments from '../../../../../../../website/server/libs/payments/payments'; import common from '../../../../../../../website/common'; const i18n = common.i18n; diff --git a/test/api/v3/unit/libs/payments/stripe/checkout.test.js b/test/api/v3/unit/libs/payments/stripe/checkout.test.js index b8f398ef6e..fca369540c 100644 --- a/test/api/v3/unit/libs/payments/stripe/checkout.test.js +++ b/test/api/v3/unit/libs/payments/stripe/checkout.test.js @@ -1,8 +1,8 @@ import stripeModule from 'stripe'; import { model as User } from '../../../../../../../website/server/models/user'; -import stripePayments from '../../../../../../../website/server/libs/stripePayments'; -import payments from '../../../../../../../website/server/libs/payments'; +import stripePayments from '../../../../../../../website/server/libs/payments/stripe'; +import payments from '../../../../../../../website/server/libs/payments/payments'; import common from '../../../../../../../website/common'; const i18n = common.i18n; diff --git a/test/api/v3/unit/libs/payments/stripe/edit-subscription.test.js b/test/api/v3/unit/libs/payments/stripe/edit-subscription.test.js index 40153f8496..7ee538a12f 100644 --- a/test/api/v3/unit/libs/payments/stripe/edit-subscription.test.js +++ b/test/api/v3/unit/libs/payments/stripe/edit-subscription.test.js @@ -4,7 +4,7 @@ import { generateGroup, } from '../../../../../../helpers/api-unit.helper.js'; import { model as User } from '../../../../../../../website/server/models/user'; -import stripePayments from '../../../../../../../website/server/libs/stripePayments'; +import stripePayments from '../../../../../../../website/server/libs/payments/stripe'; import common from '../../../../../../../website/common'; const i18n = common.i18n; diff --git a/test/api/v3/unit/libs/payments/stripe/handle-webhook.test.js b/test/api/v3/unit/libs/payments/stripe/handle-webhook.test.js index f8786b2718..54f6ae72e3 100644 --- a/test/api/v3/unit/libs/payments/stripe/handle-webhook.test.js +++ b/test/api/v3/unit/libs/payments/stripe/handle-webhook.test.js @@ -4,8 +4,8 @@ import { generateGroup, } from '../../../../../../helpers/api-unit.helper.js'; import { model as User } from '../../../../../../../website/server/models/user'; -import stripePayments from '../../../../../../../website/server/libs/stripePayments'; -import payments from '../../../../../../../website/server/libs/payments'; +import stripePayments from '../../../../../../../website/server/libs/payments/stripe'; +import payments from '../../../../../../../website/server/libs/payments/payments'; import common from '../../../../../../../website/common'; import logger from '../../../../../../../website/server/libs/logger'; import { v4 as uuid } from 'uuid'; diff --git a/test/api/v3/unit/libs/payments/stripe/upgrade-group-plan.test.js b/test/api/v3/unit/libs/payments/stripe/upgrade-group-plan.test.js index 6461209cb7..0e2c5edef0 100644 --- a/test/api/v3/unit/libs/payments/stripe/upgrade-group-plan.test.js +++ b/test/api/v3/unit/libs/payments/stripe/upgrade-group-plan.test.js @@ -5,8 +5,8 @@ import { } from '../../../../../../helpers/api-unit.helper.js'; import { model as User } from '../../../../../../../website/server/models/user'; import { model as Group } from '../../../../../../../website/server/models/group'; -import stripePayments from '../../../../../../../website/server/libs/stripePayments'; -import payments from '../../../../../../../website/server/libs/payments'; +import stripePayments from '../../../../../../../website/server/libs/payments/stripe'; +import payments from '../../../../../../../website/server/libs/payments/payments'; describe('Stripe - Upgrade Group Plan', () => { const stripe = stripeModule('test'); diff --git a/website/server/controllers/api-v3/groups.js b/website/server/controllers/api-v3/groups.js index 11d61791d6..f1264ca17c 100644 --- a/website/server/controllers/api-v3/groups.js +++ b/website/server/controllers/api-v3/groups.js @@ -21,9 +21,9 @@ import { encrypt } from '../../libs/encryption'; import { sendNotification as sendPushNotification } from '../../libs/pushNotifications'; import pusher from '../../libs/pusher'; import common from '../../../common'; -import payments from '../../libs/payments'; -import stripePayments from '../../libs/stripePayments'; -import amzLib from '../../libs/amazonPayments'; +import payments from '../../libs/payments/payments'; +import stripePayments from '../../libs/payments/stripe'; +import amzLib from '../../libs/payments/amazon'; import shared from '../../../common'; import apiMessages from '../../libs/apiMessages'; diff --git a/website/server/controllers/top-level/payments/amazon.js b/website/server/controllers/top-level/payments/amazon.js index 649bca9f4f..660569135a 100644 --- a/website/server/controllers/top-level/payments/amazon.js +++ b/website/server/controllers/top-level/payments/amazon.js @@ -1,7 +1,7 @@ import { BadRequest, } from '../../../libs/errors'; -import amzLib from '../../../libs/amazonPayments'; +import amzLib from '../../../libs/payments/amazon'; import { authWithHeaders, authWithUrl, diff --git a/website/server/controllers/top-level/payments/iap.js b/website/server/controllers/top-level/payments/iap.js index 239af7f1d7..adca65e23c 100644 --- a/website/server/controllers/top-level/payments/iap.js +++ b/website/server/controllers/top-level/payments/iap.js @@ -5,8 +5,8 @@ import { import { BadRequest, } from '../../../libs/errors'; -import googlePayments from '../../../libs/googlePayments'; -import applePayments from '../../../libs/applePayments'; +import googlePayments from '../../../libs/payments/google'; +import applePayments from '../../../libs/payments/apple'; let api = {}; diff --git a/website/server/controllers/top-level/payments/paypal.js b/website/server/controllers/top-level/payments/paypal.js index 9264f1f4cc..36b7b7a189 100644 --- a/website/server/controllers/top-level/payments/paypal.js +++ b/website/server/controllers/top-level/payments/paypal.js @@ -1,5 +1,5 @@ /* eslint-disable camelcase */ -import paypalPayments from '../../../libs/paypalPayments'; +import paypalPayments from '../../../libs/payments/paypal'; import shared from '../../../../common'; import { authWithUrl, diff --git a/website/server/controllers/top-level/payments/stripe.js b/website/server/controllers/top-level/payments/stripe.js index 5794e87314..216129ed76 100644 --- a/website/server/controllers/top-level/payments/stripe.js +++ b/website/server/controllers/top-level/payments/stripe.js @@ -3,7 +3,7 @@ import { authWithHeaders, authWithUrl, } from '../../../middlewares/auth'; -import stripePayments from '../../../libs/stripePayments'; +import stripePayments from '../../../libs/payments/stripe'; let api = {}; diff --git a/website/server/libs/amazonPayments.js b/website/server/libs/payments/amazon.js similarity index 98% rename from website/server/libs/amazonPayments.js rename to website/server/libs/payments/amazon.js index c6865963ae..644f3cc494 100644 --- a/website/server/libs/amazonPayments.js +++ b/website/server/libs/payments/amazon.js @@ -5,19 +5,19 @@ import cc from 'coupon-code'; import uuid from 'uuid'; import util from 'util'; -import common from '../../common'; +import common from '../../../common'; import { BadRequest, NotAuthorized, NotFound, -} from './errors'; +} from '../errors'; import payments from './payments'; -import { model as User } from '../models/user'; +import { model as User } from '../../models/user'; import { model as Group, basicFields as basicGroupFields, -} from '../models/group'; -import { model as Coupon } from '../models/coupon'; +} from '../../models/group'; +import { model as Coupon } from '../../models/coupon'; // TODO better handling of errors diff --git a/website/server/libs/applePayments.js b/website/server/libs/payments/apple.js similarity index 96% rename from website/server/libs/applePayments.js rename to website/server/libs/payments/apple.js index e77f452a78..e3db444c03 100644 --- a/website/server/libs/applePayments.js +++ b/website/server/libs/payments/apple.js @@ -1,12 +1,12 @@ -import shared from '../../common'; -import iap from './inAppPurchases'; +import shared from '../../../common'; +import iap from '../inAppPurchases'; import payments from './payments'; import { NotAuthorized, BadRequest, -} from './errors'; -import { model as IapPurchaseReceipt } from '../models/iapPurchaseReceipt'; -import {model as User } from '../models/user'; +} from '../errors'; +import { model as IapPurchaseReceipt } from '../../models/iapPurchaseReceipt'; +import {model as User } from '../../models/user'; import moment from 'moment'; let api = {}; diff --git a/website/server/libs/googlePayments.js b/website/server/libs/payments/google.js similarity index 95% rename from website/server/libs/googlePayments.js rename to website/server/libs/payments/google.js index b73197f4b5..fb1a253f7c 100644 --- a/website/server/libs/googlePayments.js +++ b/website/server/libs/payments/google.js @@ -1,12 +1,12 @@ -import shared from '../../common'; -import iap from './inAppPurchases'; +import shared from '../../../common'; +import iap from '../inAppPurchases'; import payments from './payments'; import { NotAuthorized, BadRequest, -} from './errors'; -import { model as IapPurchaseReceipt } from '../models/iapPurchaseReceipt'; -import {model as User } from '../models/user'; +} from '../errors'; +import { model as IapPurchaseReceipt } from '../../models/iapPurchaseReceipt'; +import {model as User } from '../../models/user'; import moment from 'moment'; let api = {}; diff --git a/website/server/libs/payments.js b/website/server/libs/payments/payments.js similarity index 98% rename from website/server/libs/payments.js rename to website/server/libs/payments/payments.js index c041e3c479..ecc790c468 100644 --- a/website/server/libs/payments.js +++ b/website/server/libs/payments/payments.js @@ -1,23 +1,23 @@ import _ from 'lodash'; import nconf from 'nconf'; -import analytics from './analyticsService'; +import analytics from '../analyticsService'; import { getUserInfo, sendTxn as txnEmail, -} from './email'; +} from '../email'; import moment from 'moment'; -import { sendNotification as sendPushNotification } from './pushNotifications'; -import shared from '../../common'; +import { sendNotification as sendPushNotification } from '../pushNotifications'; +import shared from '../../../common'; import { model as Group, basicFields as basicGroupFields, -} from '../models/group'; -import { model as User } from '../models/user'; +} from '../../models/group'; +import { model as User } from '../../models/user'; import { NotAuthorized, NotFound, -} from './errors'; -import slack from './slack'; +} from '../errors'; +import slack from '../slack'; const TECH_ASSISTANCE_EMAIL = nconf.get('EMAILS:TECH_ASSISTANCE_EMAIL'); const JOINED_GROUP_PLAN = 'joined group plan'; diff --git a/website/server/libs/paypalPayments.js b/website/server/libs/payments/paypal.js similarity index 97% rename from website/server/libs/paypalPayments.js rename to website/server/libs/payments/paypal.js index b1e4e4f217..06e553df42 100644 --- a/website/server/libs/paypalPayments.js +++ b/website/server/libs/payments/paypal.js @@ -6,19 +6,19 @@ import _ from 'lodash'; import payments from './payments'; import ipn from 'paypal-ipn'; import paypal from 'paypal-rest-sdk'; -import shared from '../../common'; +import shared from '../../../common'; import cc from 'coupon-code'; -import { model as Coupon } from '../models/coupon'; -import { model as User } from '../models/user'; +import { model as Coupon } from '../../models/coupon'; +import { model as User } from '../../models/user'; import { model as Group, basicFields as basicGroupFields, -} from '../models/group'; +} from '../../models/group'; import { BadRequest, NotAuthorized, NotFound, -} from './errors'; +} from '../errors'; const BASE_URL = nconf.get('BASE_URL'); diff --git a/website/server/libs/stripePayments.js b/website/server/libs/payments/stripe.js similarity index 97% rename from website/server/libs/stripePayments.js rename to website/server/libs/payments/stripe.js index 7cf6c0b75e..c2c218682d 100644 --- a/website/server/libs/stripePayments.js +++ b/website/server/libs/payments/stripe.js @@ -2,20 +2,20 @@ import stripeModule from 'stripe'; import nconf from 'nconf'; import cc from 'coupon-code'; import moment from 'moment'; -import logger from './logger'; +import logger from '../logger'; import { BadRequest, NotAuthorized, NotFound, -} from './errors'; +} from '../errors'; import payments from './payments'; -import { model as User } from '../models/user'; -import { model as Coupon } from '../models/coupon'; +import { model as User } from '../../models/user'; +import { model as Coupon } from '../../models/coupon'; import { model as Group, basicFields as basicGroupFields, -} from '../models/group'; -import shared from '../../common'; +} from '../../models/group'; +import shared from '../../../common'; let stripe = stripeModule(nconf.get('STRIPE_API_KEY')); const i18n = shared.i18n; diff --git a/website/server/models/group.js b/website/server/models/group.js index 6cdc5d710d..c46b3346e2 100644 --- a/website/server/models/group.js +++ b/website/server/models/group.js @@ -10,7 +10,7 @@ import { model as Challenge} from './challenge'; import * as Tasks from './task'; import validator from 'validator'; import { removeFromArray } from '../libs/collectionManipulators'; -import payments from '../libs/payments'; +import payments from '../libs/payments/payments'; import { groupChatReceivedWebhook } from '../libs/webhook'; import { InternalServerError, @@ -28,8 +28,8 @@ import { import { schema as SubscriptionPlanSchema, } from './subscriptionPlan'; -import amazonPayments from '../libs/amazonPayments'; -import stripePayments from '../libs/stripePayments'; +import amazonPayments from '../libs/payments/amazon'; +import stripePayments from '../libs/payments/stripe'; import { model as UserNotification } from './userNotification'; const questScrolls = shared.content.quests; diff --git a/website/server/models/user/methods.js b/website/server/models/user/methods.js index 1f8712fef2..c9e77427ab 100644 --- a/website/server/models/user/methods.js +++ b/website/server/models/user/methods.js @@ -10,10 +10,10 @@ import { import { defaults, map, flatten, flow, compact, uniq, partialRight } from 'lodash'; import { model as UserNotification } from '../userNotification'; import schema from './schema'; -import payments from '../../libs/payments'; -import amazonPayments from '../../libs/amazonPayments'; -import stripePayments from '../../libs/stripePayments'; -import paypalPayments from '../../libs/paypalPayments'; +import payments from '../../libs/payments/payments'; +import amazonPayments from '../../libs/payments/amazon'; +import stripePayments from '../../libs/payments/stripe'; +import paypalPayments from '../../libs/payments/paypal'; const daysSince = common.daysSince;