Skip to content

Commit

Permalink
feat: show account identifier attribute of payment instrument
Browse files Browse the repository at this point in the history
  • Loading branch information
harshrsys authored and shauke committed Jul 22, 2020
1 parent fbc6c8d commit 75e4a31
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export interface PaymentInstrumentData {
id: string;
name: string;
attributes: Attribute<string>[];
accountIdentifier: string;
}
13 changes: 7 additions & 6 deletions src/app/core/models/payment-method/payment-method.mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class PaymentMethodMapper {

/**
* determines the accountIdentifier - this temporary method will be obsolete, if #IS-29004, #IS-29006 have been fixed
* the general identifier returns all payment instrument attributes
* the general identifier returns account identifier attribute if present, else it returns all the attributes
* a specific identifier is only returned for ISH_CREDITCARD, add further special functionality here, if needed
*/
private static determineAccountIdentifier(pm: PaymentMethodBaseData, pi: PaymentInstrumentData): string {
Expand All @@ -97,13 +97,14 @@ export class PaymentMethodMapper {
break;
}
default: {
identifier =
pi.attributes &&
pi.attributes.length &&
pi.attributes
.filter(attr => attr.name !== 'paymentInstrumentId')
if (pi.accountIdentifier) {
identifier = pi.accountIdentifier;
} else {
identifier = pi.attributes
?.filter(attr => attr.name !== 'paymentInstrumentId')
.map(attr => attr.value)
.reduce((acc, val) => (val ? `${acc} ${val}` : acc));
}
}
}

Expand Down

0 comments on commit 75e4a31

Please sign in to comment.