Allow coupon calls
This commit is contained in:
parent
f3bd38e819
commit
42d16caafc
|
|
@ -137,7 +137,7 @@ function unauthorizedAccess(to) {
|
|||
function redirectUsersWithoutValidLicense(to) {
|
||||
return privateApolloClient.query({
|
||||
query: ME_QUERY,
|
||||
}).then(({data}) => data.me.licenseExpiryDate.edges.length == null);
|
||||
}).then(({data}) => data.me.licenseExpiryDate == null);
|
||||
}
|
||||
|
||||
function redirectStudentsWithoutClass() {
|
||||
|
|
@ -165,7 +165,7 @@ router.beforeEach(async (to, from, next) => {
|
|||
return;
|
||||
}
|
||||
|
||||
if (to.name !== 'licenseActivation' && redirectUsersWithoutValidLicense()) {
|
||||
if (to.name !== 'licenseActivation' && await redirectUsersWithoutValidLicense()) {
|
||||
next({name: 'licenseActivation'})
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ export default {
|
|||
}
|
||||
) {
|
||||
if (coupon.success) {
|
||||
console.log('handle happy path');
|
||||
that.$router.push('/')
|
||||
} else {
|
||||
if (coupon.errors[0].field === 'invalid_coupon') {
|
||||
that.couponErrors = ['Der angegebene Coupon-Code ist falsch.'];
|
||||
|
|
|
|||
|
|
@ -15,9 +15,6 @@ import requests
|
|||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
MYSKILLBOX_TEACHER_EDITION_ISBN = "000-4-5678-9012-3"
|
||||
MYSKILLBOX_STUDENT_EDITION_ISBN = "123-4-5678-9012-3"
|
||||
|
||||
TEACHER_EDITION_DURATION = 365
|
||||
STUDENT_EDITION_DURATION = 4*365
|
||||
|
||||
|
|
@ -168,7 +165,8 @@ class HepClient:
|
|||
status = order_item['status']
|
||||
|
||||
for item in order_item['items']:
|
||||
if item['sku'] == MYSKILLBOX_TEACHER_EDITION_ISBN or item['sku'] == MYSKILLBOX_STUDENT_EDITION_ISBN:
|
||||
if item['sku'] == settings.MYSKILLBOX_TEACHER_EDITION_ISBN or \
|
||||
item['sku'] == settings.MYSKILLBOX_STUDENT_EDITION_ISBN:
|
||||
|
||||
product = {
|
||||
'raw': item,
|
||||
|
|
@ -176,7 +174,7 @@ class HepClient:
|
|||
'status': status
|
||||
}
|
||||
|
||||
if item['sku'] == MYSKILLBOX_TEACHER_EDITION_ISBN:
|
||||
if item['sku'] == settings.MYSKILLBOX_TEACHER_EDITION_ISBN:
|
||||
product['edition'] = TEACHER_KEY
|
||||
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -378,4 +378,7 @@ HEP_ADMIN_USER = "myskillbox"
|
|||
HEP_ADMIN_PASSWORD = "dSgqCv7zhEMmSNrw"
|
||||
HEP_URL = 'https://stage.hep-verlag.ch'
|
||||
|
||||
MYSKILLBOX_TEACHER_EDITION_ISBN = "000-4-5678-9012-3"
|
||||
MYSKILLBOX_STUDENT_EDITION_ISBN = "978-3-0355-0708-9"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ def is_private_api_call_allowed(user, body):
|
|||
|
||||
body_unicode = body.decode('utf-8')
|
||||
|
||||
if re.search(r"mutation\s*.*\s*logout\s*{", body_unicode) or re.search(r"query\s*.*\s*me\s*{", body_unicode):
|
||||
if re.search(r"mutation\s*.*\s*logout\s*{", body_unicode) or re.search(r"query\s*.*\s*me\s*{", body_unicode)\
|
||||
or re.search(r"mutation\s*Coupon", body_unicode):
|
||||
return True
|
||||
|
||||
license_expiry = user.license_expiry_date
|
||||
|
|
|
|||
Loading…
Reference in New Issue