We will work on Apr 26th (Saturday) and will be off from Apr 30th (Wednesday) until May 2nd (Friday) for public holiday in our country

Commit a9cb752b authored by cyattilakiss's avatar cyattilakiss Committed by GitHub

Merge pull request #469 from Adyen/PW-1417

PW-1417 Check issuers in the whole response detail object
parents 123304a4 a9a85633
......@@ -289,16 +289,28 @@ define(
result.getBankAccountNumberMaxLength = function () {
return 17;
};
/**
* Finds the issuer property in the payment method's response and if available returns it's index
* @returns
*/
result.findIssuersProperty = function () {
var issuerKey = false;
if (typeof value.details !== 'undefined') {
$.each(value.details, function(key, detail) {
if (typeof detail.items !== 'undefined' && detail.key == 'issuer') {
issuerKey = key;
}
});
}
return issuerKey;
}
/**
* Checks if the payment method has issuers property available
* @returns {boolean}
*/
result.hasIssuersProperty = function () {
if (
typeof value.details !== 'undefined' &&
typeof value.details[0].items !== 'undefined' &&
value.details[0].key == 'issuer'
) {
if (result.findIssuersProperty() !== false) {
return true;
}
......@@ -309,7 +321,7 @@ define(
* @returns {boolean}
*/
result.hasIssuersAvailable = function () {
if (result.hasIssuersProperty() && value.details[0].items.length > 0) {
if (result.hasIssuersProperty() && value.details[result.findIssuersProperty()].items.length > 0) {
return true;
}
......@@ -321,7 +333,7 @@ define(
*/
result.getIssuers = function() {
if (result.hasIssuersAvailable()) {
return value.details[0].items;
return value.details[result.findIssuersProperty()].items;
}
return [];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment