Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. // Asura (CustomerController.js)
  2.  
  3. static async postCustomerWithMagic(ctx, next) {
  4. // .. something something
  5. } else if (primary_id_type === 'customerId') {
  6. let { isActive, isProvisioned } = await api.classify(primary_id, primary_id_type);
  7. if (!isActive && !isProvisioned) {
  8. await api.provision(customer.id, 'spAccountId', customer.sku, effectiveDate, primary_id);
  9. }
  10. } else {
  11. // .. something something
  12. ctx.json(result);
  13. }
  14.  
  15. // Wyvern (SignupController.js)
  16.  
  17. *prePostOtp()
  18. {
  19. // do something
  20. var classify = .. do classification
  21.  
  22. if (isActive || isLapsed) {
  23. // call another asura endpoint
  24. // which will move SKU instead of provision and create user
  25. return;
  26. }
  27. // do something else
  28. }
  29.  
  30. *postOtp()
  31. {
  32. var activationResult = yield postCustomer(this.session.country, this.request.body);
  33.  
  34. // create user
  35. var customerParam = {
  36. ipAddress: process.env[this.session.country + '_CREDENTIALS_API_IP'],
  37. apiuser: process.env.EVERGENT_API_USER,
  38. apipassword: process.env.EVERGENT_API_PASSWORD,
  39. contactUserName: this.request.body.email,
  40. contactPassword: this.request.body.password,
  41. phoneNumber: sanitizePhone(this.request.body.phone),
  42. smsCode: this.request.body.otp, // <--- for primaryIdType === 'msisdn' || 'email'
  43. socialLoginID: this.request.body.socialid || null,
  44. socialLoginType: this.request.body.socialid ? 'Facebook' : null,
  45. channelPartnerID: this.request.body.cpid || process.env[this.session.country + '_CREDENTIALS_API_PARTNERID'],
  46. locale: process.env.EVERGENT_API_LOCALE
  47. },
  48. response = yield request.post({ url: process.env.EVERGENT_API_DOMAIN + 'createCustomer', form: customerParam });
  49.  
  50. response = JSON.parse(response.body);
  51.  
  52. // .. something something
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement