validate_purchase fix for SANDBOX requests (#2253)
* Fixed routing for validate_purchase method * Fixed validate_purchase endpoint
This commit is contained in:
committed by
Florent Vilmart
parent
9658d216f3
commit
7a2e906202
@@ -37,9 +37,6 @@ function validateWithAppStore(url, receipt) {
|
|||||||
return fulfill();
|
return fulfill();
|
||||||
}
|
}
|
||||||
// receipt is from test and should go to test
|
// receipt is from test and should go to test
|
||||||
if (status == 21007) {
|
|
||||||
return validateWithAppStore(IAP_SANDBOX_URL);
|
|
||||||
}
|
|
||||||
return reject(body);
|
return reject(body);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -83,10 +80,29 @@ export class IAPValidationRouter extends PromiseRouter {
|
|||||||
return getFileForProductIdentifier(productIdentifier, req);
|
return getFileForProductIdentifier(productIdentifier, req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function successCallback() {
|
||||||
|
return getFileForProductIdentifier(productIdentifier, req);
|
||||||
|
};
|
||||||
|
|
||||||
|
function errorCallback(error) {
|
||||||
|
return Promise.resolve({response: appStoreError(error.status) });
|
||||||
|
}
|
||||||
|
|
||||||
return validateWithAppStore(IAP_PRODUCTION_URL, receipt).then( () => {
|
return validateWithAppStore(IAP_PRODUCTION_URL, receipt).then( () => {
|
||||||
return getFileForProductIdentifier(productIdentifier, req);
|
|
||||||
|
return successCallback();
|
||||||
|
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
return Promise.resolve({response: appStoreError(error.status) });
|
if (error.status == 21007) {
|
||||||
|
return validateWithAppStore(IAP_SANDBOX_URL, receipt).then( () => {
|
||||||
|
return successCallback();
|
||||||
|
}, (error) => {
|
||||||
|
return errorCallback(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return errorCallback(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user