Просмотр исходного кода

fix(server): Fix error when streetLine2 is null on checkout

Michael Bromley 6 лет назад
Родитель
Сommit
4fd64e04cd

+ 4 - 4
server/e2e/shop-order.e2e-spec.ts

@@ -277,7 +277,7 @@ describe('Shop orders', () => {
                 fullName: 'name',
                 company: 'company',
                 streetLine1: '12 the street',
-                streetLine2: 'line 2',
+                streetLine2: null,
                 city: 'foo',
                 province: 'bar',
                 postalCode: '123456',
@@ -292,7 +292,7 @@ describe('Shop orders', () => {
                 fullName: 'name',
                 company: 'company',
                 streetLine1: '12 the street',
-                streetLine2: 'line 2',
+                streetLine2: null,
                 city: 'foo',
                 province: 'bar',
                 postalCode: '123456',
@@ -478,7 +478,7 @@ describe('Shop orders', () => {
                     fullName: 'name',
                     company: 'company',
                     streetLine1: '12 the street',
-                    streetLine2: 'line 2',
+                    streetLine2: null,
                     city: 'foo',
                     province: 'bar',
                     postalCode: '123456',
@@ -493,7 +493,7 @@ describe('Shop orders', () => {
                     fullName: 'name',
                     company: 'company',
                     streetLine1: '12 the street',
-                    streetLine2: 'line 2',
+                    streetLine2: null,
                     city: 'foo',
                     province: 'bar',
                     postalCode: '123456',

+ 1 - 0
server/src/api/resolvers/shop/shop-order.resolver.ts

@@ -234,6 +234,7 @@ export class ShopOrderResolver {
                         await this.customerService.createAddress(ctx, customer.id as string, {
                             ...address,
                             streetLine1: address.streetLine1 || '',
+                            streetLine2: address.streetLine2 || '',
                             countryCode: address.countryCode || '',
                             defaultBillingAddress: true,
                             defaultShippingAddress: true,