File tree Expand file tree Collapse file tree 3 files changed +17
-9
lines changed
Expand file tree Collapse file tree 3 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ CHANGELOG
55------------------
66
77* Added ` ShopifyPayments ` to the ` Processor ` enum.
8+ * Fix ` creditCard.was3DSecureSuccessful ` snakecase conversion.
89
9104.5.0 (2022-03-28)
1011------------------
Original file line number Diff line number Diff line change @@ -255,6 +255,7 @@ describe('Transaction()', () => {
255255 const test = new Transaction ( {
256256 creditCard : new CreditCard ( {
257257 last4digits : '1234' ,
258+ was3DSecureSuccessful : true ,
258259 } ) ,
259260 device : new Device ( {
260261 ipAddress : '1.1.1.1' ,
@@ -266,7 +267,9 @@ describe('Transaction()', () => {
266267
267268 expect ( test . toString ( ) ) . toContain ( deviceString ) ;
268269
269- expect ( test . toString ( ) ) . toContain ( '"credit_card":{"last_digits":"1234"}' ) ;
270+ expect ( test . toString ( ) ) . toContain (
271+ '"credit_card":{"last_digits":"1234","was_3d_secure_successful":true}'
272+ ) ;
270273 } ) ;
271274
272275 it ( 'it handles optional order field' , ( ) => {
Original file line number Diff line number Diff line change @@ -119,14 +119,6 @@ export default class Transaction {
119119 // eslint-disable-next-line @typescript-eslint/no-explicit-any
120120 const sanitized = Object . assign ( { } , this ) as any ;
121121
122- if (
123- sanitized . creditCard &&
124- Object . prototype . hasOwnProperty . call ( sanitized . creditCard , 'lastDigits' )
125- ) {
126- sanitized . creditCard . last_digits = sanitized . creditCard . lastDigits ;
127- delete sanitized . creditCard . lastDigits ;
128- }
129-
130122 if (
131123 sanitized . billing &&
132124 Object . prototype . hasOwnProperty . call ( sanitized . billing , 'address2' )
@@ -143,6 +135,18 @@ export default class Transaction {
143135 delete sanitized . shipping . address2 ;
144136 }
145137
138+ if (
139+ sanitized . creditCard &&
140+ Object . prototype . hasOwnProperty . call (
141+ sanitized . creditCard ,
142+ 'was3DSecureSuccessful'
143+ )
144+ ) {
145+ sanitized . creditCard . was_3d_secure_successful =
146+ sanitized . creditCard . was3DSecureSuccessful ;
147+ delete sanitized . creditCard . was3DSecureSuccessful ;
148+ }
149+
146150 return sanitized ;
147151 }
148152
You can’t perform that action at this time.
0 commit comments