-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
I have a weird issue. I'm calling payments.remove to delete a payment. The payment id is correct, the payment is removed (checking with the Merchant Centre website) as it should but the promise is rejected. Error callback is called with the error:
PMError: API Error:{
"data":null,
"mode":"test"
}I'm using "paymill-wrapper": "^2.2.0"
This is my code:
function createOrUpdatePaymentForClient(clientId, token, paymentId) {
var deferred = when.defer();
var promise = deferred.promise;
var removeResult = pm.payments.remove(paymentId).then(function (payment) {
///this is never called, WHY ?
console.log('Payment with id removed {' + payment.id + '} for client {' + clientId + '}');
pm.payments.create(token, clientId).then(function (payment) {
deferred.resolve(payment);
}, function (error) {
deferred.reject(error);
});
}, function (err) {
//this is always called and payment got deleted, BUG ?
console.log(arguments);
console.log('........\n')
console.log('Could not delete payment :');
console.log(err);
pm.payments.create(token, clientId).then(function (payment) {
deferred.resolve(payment);
}, function (error) {
deferred.reject(error);
});
});
console.log('Remove result: ');
console.log(removeResult);
return promise;
}zellb
Metadata
Metadata
Assignees
Labels
No labels