Skip to content

Commit

Permalink
Merge pull request j3k0#913 from j3k0/application_username_validation
Browse files Browse the repository at this point in the history
Add applicationUsername to all validation requests
  • Loading branch information
j3k0 authored Aug 16, 2019
2 parents 2eeeb22 + a59a045 commit e0edbdd
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 4 deletions.
17 changes: 16 additions & 1 deletion src/js/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,25 @@ function runValidation() {
// Run one validation request for each product.
Object.keys(byProduct).forEach(function(productId) {
var request = byProduct[productId];
var product = request.product;

// Ensure applicationUsername is sent with validation requests
if (!product.additionalData) {
product.additionalData = {};
}
if (!product.additionalData.applicationUsername) {
product.additionalData.applicationUsername =
store._evaluateApplicationUsername(product);
}
if (!product.additionalData.applicationUsername) {
delete product.additionalData.applicationUsername;
}

// Post
store.utils.ajax({
url: store.validator,
method: 'POST',
data: request.product,
data: product,
success: function(data) {
store.log.debug("validator success, response: " + JSON.stringify(data));
request.callbacks.forEach(function(callback) {
Expand Down
17 changes: 16 additions & 1 deletion www/store-android.js
Original file line number Diff line number Diff line change
Expand Up @@ -1471,10 +1471,25 @@ function runValidation() {
// Run one validation request for each product.
Object.keys(byProduct).forEach(function(productId) {
var request = byProduct[productId];
var product = request.product;

// Ensure applicationUsername is sent with validation requests
if (!product.additionalData) {
product.additionalData = {};
}
if (!product.additionalData.applicationUsername) {
product.additionalData.applicationUsername =
store._evaluateApplicationUsername(product);
}
if (!product.additionalData.applicationUsername) {
delete product.additionalData.applicationUsername;
}

// Post
store.utils.ajax({
url: store.validator,
method: 'POST',
data: request.product,
data: product,
success: function(data) {
store.log.debug("validator success, response: " + JSON.stringify(data));
request.callbacks.forEach(function(callback) {
Expand Down
17 changes: 16 additions & 1 deletion www/store-ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -1492,10 +1492,25 @@ function runValidation() {
// Run one validation request for each product.
Object.keys(byProduct).forEach(function(productId) {
var request = byProduct[productId];
var product = request.product;

// Ensure applicationUsername is sent with validation requests
if (!product.additionalData) {
product.additionalData = {};
}
if (!product.additionalData.applicationUsername) {
product.additionalData.applicationUsername =
store._evaluateApplicationUsername(product);
}
if (!product.additionalData.applicationUsername) {
delete product.additionalData.applicationUsername;
}

// Post
store.utils.ajax({
url: store.validator,
method: 'POST',
data: request.product,
data: product,
success: function(data) {
store.log.debug("validator success, response: " + JSON.stringify(data));
request.callbacks.forEach(function(callback) {
Expand Down
17 changes: 16 additions & 1 deletion www/store-windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -1471,10 +1471,25 @@ function runValidation() {
// Run one validation request for each product.
Object.keys(byProduct).forEach(function(productId) {
var request = byProduct[productId];
var product = request.product;

// Ensure applicationUsername is sent with validation requests
if (!product.additionalData) {
product.additionalData = {};
}
if (!product.additionalData.applicationUsername) {
product.additionalData.applicationUsername =
store._evaluateApplicationUsername(product);
}
if (!product.additionalData.applicationUsername) {
delete product.additionalData.applicationUsername;
}

// Post
store.utils.ajax({
url: store.validator,
method: 'POST',
data: request.product,
data: product,
success: function(data) {
store.log.debug("validator success, response: " + JSON.stringify(data));
request.callbacks.forEach(function(callback) {
Expand Down

0 comments on commit e0edbdd

Please sign in to comment.