File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed
Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -117,16 +117,12 @@ export default class Transaction {
117117 private sanitizeKeys ( ) {
118118 const sanitized = Object . assign ( { } , this ) as any ;
119119
120- if ( sanitized . creditCard != null ) {
121- if ( sanitized . creditCard . last4digits != null ) {
122- sanitized . creditCard . last_digits = this . creditCard ! . last4digits ;
123- delete sanitized . creditCard . last4digits ;
124- }
125-
126- if ( sanitized . creditCard . lastDigits != null ) {
127- sanitized . creditCard . last_digits = this . creditCard ! . lastDigits ;
128- delete sanitized . creditCard . lastDigits ;
129- }
120+ if (
121+ sanitized . creditCard &&
122+ Object . prototype . hasOwnProperty . call ( sanitized . creditCard , 'lastDigits' )
123+ ) {
124+ sanitized . creditCard . last_digits = sanitized . creditCard . lastDigits ;
125+ delete sanitized . creditCard . lastDigits ;
130126 }
131127
132128 if (
You can’t perform that action at this time.
0 commit comments