Bug 1044792 - Send MCC and MNC on POST /sms/mt/verify. r=spenrose

This commit is contained in:
Fernando Jiménez 2014-07-29 14:27:03 +02:00
Родитель 68cec10ca7
Коммит 17d1a2d5f3
6 изменённых файлов: 47 добавлений и 66 удалений

Просмотреть файл

@ -54,10 +54,13 @@ this.MobileIdentityClient.prototype = {
return this._request(REGISTER, "POST", null, {});
},
smsMtVerify: function(aSessionToken, aMsisdn, aWantShortCode = false) {
smsMtVerify: function(aSessionToken, aMsisdn, aMcc, aMnc,
aWantShortCode = false) {
let credentials = this._deriveHawkCredentials(aSessionToken);
return this._request(SMS_MT_VERIFY, "POST", credentials, {
msisdn: aMsisdn,
mcc: aMcc,
mnc: aMnc,
shortVerificationCode: aWantShortCode
});
},

Просмотреть файл

@ -450,30 +450,31 @@ this.MobileIdentityManager = {
aToVerify.msisdn &&
aToVerify.verificationDetails &&
aToVerify.verificationDetails.mtSender) {
this.activeVerificationFlow = new MobileIdentitySmsMtVerificationFlow(
aOrigin,
aToVerify.msisdn,
aToVerify.iccId,
aToVerify.serviceId === undefined, // external: the phone number does
// not seem to belong to any of the
// device SIM cards.
aToVerify.verificationDetails.mtSender,
this.activeVerificationFlow = new MobileIdentitySmsMtVerificationFlow({
origin: aOrigin,
msisdn: aToVerify.msisdn,
mcc: aToVerify.mcc,
mnc: aToVerify.mnc,
iccId: aToVerify.iccId,
external: aToVerify.serviceId === undefined,
mtSender: aToVerify.verificationDetails.mtSender
},
this.ui,
this.client
);
#ifdef MOZ_B2G_RIL
} else if (aToVerify.verificationMethod.indexOf(SMS_MO_MT) != -1 &&
aToVerify.serviceId &&
aToVerify.verificationDetails &&
aToVerify.verificationDetails.moVerifier &&
aToVerify.verificationDetails.mtSender) {
this.activeVerificationFlow = new MobileIdentitySmsMoMtVerificationFlow(
aOrigin,
aToVerify.serviceId,
aToVerify.iccId,
aToVerify.verificationDetails.mtSender,
aToVerify.verificationDetails.moVerifier,
aToVerify.serviceId &&
aToVerify.verificationDetails &&
aToVerify.verificationDetails.moVerifier &&
aToVerify.verificationDetails.mtSender) {
this.activeVerificationFlow = new MobileIdentitySmsMoMtVerificationFlow({
origin: aOrigin,
serviceId: aToVerify.serviceId,
iccId: aToVerify.iccId,
mtSender: aToVerify.verificationDetails.mtSender,
moVerifier: aToVerify.verificationDetails.moVerifier
},
this.ui,
this.client
);
@ -517,6 +518,8 @@ this.MobileIdentityManager = {
toVerify.serviceId = serviceId;
toVerify.iccId = this.iccInfo[serviceId].iccId;
toVerify.msisdn = this.iccInfo[serviceId].msisdn;
toVerify.mcc = this.iccInfo[serviceId].mcc;
toVerify.mnc = this.iccInfo[serviceId].mnc;
toVerify.verificationMethod =
this.iccInfo[serviceId].verificationMethods[0];
toVerify.verificationDetails =
@ -524,6 +527,7 @@ this.MobileIdentityManager = {
return this._verificationFlow(toVerify, aOrigin);
} else {
toVerify.msisdn = aUserSelection.msisdn;
toVerify.mcc = aUserSelection.mcc;
return this.client.discover(aUserSelection.msisdn,
aUserSelection.mcc)
.then(

Просмотреть файл

@ -39,24 +39,14 @@ SilentSmsRequest.prototype = {
}
};
this.MobileIdentitySmsMoMtVerificationFlow = function(aOrigin,
aServiceId,
aIccId,
aMtSender,
aMoVerifier,
this.MobileIdentitySmsMoMtVerificationFlow = function(aVerificationOptions,
aUI,
aClient) {
log.debug("MobileIdentitySmsMoMtVerificationFlow");
log.debug("MobileIdentitySmsMoMtVerificationFlow ${}", aVerificationOptions);
MobileIdentitySmsVerificationFlow.call(this,
aOrigin,
null, //msisdn
aIccId,
aServiceId,
false, // external
aMtSender,
aMoVerifier,
aVerificationOptions,
aUI,
aClient,
this.smsVerifyStrategy);

Просмотреть файл

@ -13,25 +13,14 @@ Cu.import("resource://gre/modules/MobileIdentitySmsVerificationFlow.jsm");
Cu.import("resource://gre/modules/Promise.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
this.MobileIdentitySmsMtVerificationFlow = function(aOrigin,
aMsisdn,
aIccId,
aExternal,
aMtSender,
this.MobileIdentitySmsMtVerificationFlow = function(aVerificationOptions,
aUI,
aClient) {
log.debug("MobileIdentitySmsVerificationFlow " + aMsisdn + ", external: " +
aExternal);
log.debug("MobileIdentitySmsVerificationFlow ${}", aVerificationOptions);
MobileIdentitySmsVerificationFlow.call(this,
aOrigin,
aMsisdn,
aIccId,
null, // service ID
aExternal,
aMtSender,
null, // moVerifier
aVerificationOptions,
aUI,
aClient,
this.smsVerifyStrategy);
@ -44,6 +33,8 @@ this.MobileIdentitySmsMtVerificationFlow.prototype = {
smsVerifyStrategy: function() {
return this.client.smsMtVerify(this.sessionToken,
this.verificationOptions.msisdn,
this.verificationOptions.mcc,
this.verificationOptions.mnc,
this.verificationOptions.external);
}
};

Просмотреть файл

@ -19,13 +19,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "smsService",
"nsISmsService");
#endif
this.MobileIdentitySmsVerificationFlow = function(aOrigin,
aMsisdn,
aIccId,
aServiceId,
aExternal,
aMtSender,
aMoVerifier,
this.MobileIdentitySmsVerificationFlow = function(aVerificationOptions,
aUI,
aClient,
aVerifyStrategy) {
@ -33,15 +27,9 @@ this.MobileIdentitySmsVerificationFlow = function(aOrigin,
// SMS MT or SMS MO+MT specific verify strategy.
this.smsVerifyStrategy = aVerifyStrategy;
MobileIdentityVerificationFlow.call(this, {
origin: aOrigin,
msisdn: aMsisdn,
iccId: aIccId,
serviceId: aServiceId,
external: aExternal,
mtSender: aMtSender,
moVerifier: aMoVerifier
}, aUI, aClient, this._verifyStrategy, this._cleanupStrategy);
log.debug("aVerificationOptions ${}", aVerificationOptions);
MobileIdentityVerificationFlow.call(this, aVerificationOptions, aUI, aClient,
this._verifyStrategy, this._cleanupStrategy);
};
this.MobileIdentitySmsVerificationFlow.prototype = {

Просмотреть файл

@ -138,7 +138,8 @@ MockUi.prototype = {
__proto__: Mock.prototype,
_startFlowResult: {
phoneNumber: PHONE_NUMBER
phoneNumber: PHONE_NUMBER,
mcc: MNC
},
_verifyCodePromptResult: {
@ -434,7 +435,9 @@ add_test(function() {
client._("smsMtVerify").callsLength(1);
client._("smsMtVerify").call(1).arg(1, SESSION_TOKEN);
client._("smsMtVerify").call(1).arg(2, PHONE_NUMBER);
client._("smsMtVerify").call(1).arg(3, true);
client._("smsMtVerify").call(1).arg(3, MNC);
client._("smsMtVerify").call(1).arg(4, undefined);
client._("smsMtVerify").call(1).arg(5, true);
client._("verifyCode").callsLength(1);
client._("verifyCode").call(1).arg(1, SESSION_TOKEN);
client._("verifyCode").call(1).arg(2, {
@ -670,7 +673,9 @@ add_test(function() {
client._("smsMtVerify").callsLength(1);
client._("smsMtVerify").call(1).arg(1, _sessionToken);
client._("smsMtVerify").call(1).arg(2, PHONE_NUMBER);
client._("smsMtVerify").call(1).arg(3, true);
client._("smsMtVerify").call(1).arg(3, MNC);
client._("smsMtVerify").call(1).arg(4, undefined);
client._("smsMtVerify").call(1).arg(5, true);
client._("verifyCode").callsLength(1);
client._("verifyCode").call(1).arg(1, _sessionToken);
client._("verifyCode").call(1).arg(2, {