File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ export default class Fastlane {
82
82
profileData : {
83
83
card : resp . profileData . card ,
84
84
name : resp . profileData . name ,
85
- shippingAddress : this . transformPaypalAddress ( paypalAddress ) ,
85
+ shippingAddress : paypalAddress === undefined ? undefined : this . transformPaypalAddress ( paypalAddress ) ,
86
86
} ,
87
87
} ;
88
88
}
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ export interface IFastlaneAuthenticatedCustomerResult {
74
74
firstName : string ;
75
75
lastName : string ;
76
76
} ;
77
- shippingAddress : IFastlaneAddress ;
77
+ shippingAddress : IFastlaneAddress | undefined ;
78
78
card : IFastlanePaymentToken ;
79
79
}
80
80
}
Original file line number Diff line number Diff line change 1
1
import Fastlane from 'src/fastlane/fastlane' ;
2
+ import { IFastlaneAuthenticatedCustomerResult } from 'src' ;
2
3
3
4
describe ( 'testing Fastlane class' , ( ) => {
4
5
const fastlaneInstanceMock = {
@@ -91,6 +92,7 @@ describe('testing Fastlane class', () => {
91
92
92
93
test . each ( [
93
94
{
95
+ name : 'ppcp' ,
94
96
type : 'ppcp' ,
95
97
respProfileData : {
96
98
card : { } ,
@@ -133,6 +135,20 @@ describe('testing Fastlane class', () => {
133
135
} ) ,
134
136
} as const ,
135
137
{
138
+ name : 'ppcp - no shipping address' ,
139
+ type : 'ppcp' ,
140
+ respProfileData : {
141
+ card : { } ,
142
+ name : {
143
+ firstName : 'firstName' ,
144
+ lastName : 'firstName' ,
145
+ } ,
146
+ shippingAddress : undefined ,
147
+ } ,
148
+ expected : ( ) : IFastlaneAuthenticatedCustomerResult [ 'profileData' ] [ 'shippingAddress' ] => undefined ,
149
+ } as const ,
150
+ {
151
+ name : 'braintree' ,
136
152
type : 'braintree' ,
137
153
respProfileData : {
138
154
card : { } ,
@@ -157,7 +173,7 @@ describe('testing Fastlane class', () => {
157
173
return this . respProfileData . shippingAddress ;
158
174
} ,
159
175
} as const ,
160
- ] ) ( '$type triggerAuthenticationFlow' , async ( input ) => {
176
+ ] ) ( '$name triggerAuthenticationFlow' , async ( input ) => {
161
177
// Arranging
162
178
fastlaneInstanceMock . identity . triggerAuthenticationFlow . mockResolvedValue ( {
163
179
authenticationState : 'succeeded' ,
You can’t perform that action at this time.
0 commit comments