Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Asura (CustomerController.js)
- static async postCustomerWithMagic(ctx, next) {
- // .. something something
- } else if (primary_id_type === 'customerId') {
- let { isProvisioned } = await api.classify(primary_id, primary_id_type);
- result = isProvisioned ? null :
- await api.provision(customer.id, 'spAccountId', customer.sku, effectiveDate, primary_id);
- } else {
- // .. something something
- ctx.json(result);
- }
- // Wyvern (SignupController.js)
- *postOtp()
- {
- var activationResult = {};
- try {
- activationResult = yield postCustomer(this.session.country, this.request.body);
- } catch (err) {
- // FIXME: handle when activation failed
- // however e.g. for telkomsel, the user is already provisioned
- }
- var createPath = activationResult.type === 'spAccountId' ? 'partnersCreateCustomer' : 'createCustomer';
- // create user
- var customerParam = {
- ipAddress: process.env[this.session.country + '_CREDENTIALS_API_IP'],
- apiuser: process.env.EVERGENT_API_USER,
- apipassword: process.env.EVERGENT_API_PASSWORD,
- contactUserName: this.request.body.email,
- contactPassword: this.request.body.password,
- phoneNumber: sanitizePhone(this.request.body.phone),
- smsCode: this.request.body.otp, // <--- for primaryIdType === 'msisdn' || 'email'
- spAccountId: activationResult.type === 'spAccountId' && activationResult.primaryId, // <--- for primaryIdType === 'customerId'
- socialLoginID: this.request.body.socialid || null,
- socialLoginType: this.request.body.socialid ? 'Facebook' : null,
- channelPartnerID: this.request.body.cpid || process.env[this.session.country + '_CREDENTIALS_API_PARTNERID'],
- locale: process.env.EVERGENT_API_LOCALE
- },
- response = yield request.post({ url: process.env.EVERGENT_API_DOMAIN + createPath, form: customerParam });
- response = JSON.parse(response.body);
- // .. something something
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement