mirror of
https://github.com/HackPlan/node-iap.git
synced 2026-06-12 07:58:52 +08:00
fix apple receipt error
This commit is contained in:
@@ -112,8 +112,12 @@ exports.verifyPayment = function (payment, cb) {
|
||||
return cb(error);
|
||||
}
|
||||
|
||||
if (payment.hasOwnProperty('packageName') && payment.packageName !== result.receipt.bundle_id) {
|
||||
return cb(new Error('Wrong bundle ID: ' + result.receipt.bundle_id + ' (expected: ' + payment.packageName + ')'));
|
||||
if (payment.hasOwnProperty('packageName') && result.result == 'verified' && payment.packageName !== result.receipt.bundle_id) {
|
||||
return cb(null, {
|
||||
result: 'failed',
|
||||
receipt: result.receipt,
|
||||
message: 'Wrong bundle ID: ' + result.receipt.bundle_id + ' (expected: ' + payment.packageName + ')'
|
||||
});
|
||||
}
|
||||
|
||||
return cb(null, result);
|
||||
|
||||
@@ -64,7 +64,6 @@ exports.verifyPayment = function (payment, cb) {
|
||||
}
|
||||
|
||||
if (res.statusCode !== 200) {
|
||||
|
||||
if (res.statusCode == 400) {
|
||||
var responseObject;
|
||||
try {
|
||||
@@ -76,7 +75,6 @@ exports.verifyPayment = function (payment, cb) {
|
||||
result: 'failed',
|
||||
message: responseObject.error.message
|
||||
});
|
||||
|
||||
} else {
|
||||
return cb(new NetworkError('Received ' + res.statusCode + ' status code with body: ' + responseString));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user