|
1 | 1 | import { fetchDinteroAuthToken } from './fetchAuthToken';
|
2 | 2 | import { DinteroCreateSessionArguments, DinteroPaymentPayload, DinteroPaymentVerificationArguments } from './types';
|
3 | 3 |
|
4 |
| -const buildAddress = (customer: any) => { |
5 |
| - return { |
6 |
| - first_name: customer.firstName ?? '', |
7 |
| - last_name: customer.lastName ?? '', |
8 |
| - address_line: customer?.streetAddress ?? '', |
9 |
| - postal_code: customer?.zipCode ?? '', |
10 |
| - postal_place: customer?.city ?? '', |
11 |
| - country: customer?.country ?? '', |
12 |
| - email: customer?.email ?? '', |
13 |
| - }; |
14 |
| -}; |
15 |
| - |
16 | 4 | export async function handleDinteroPaymentSessionPayload(
|
17 | 5 | payload: DinteroPaymentPayload,
|
18 | 6 | args: DinteroCreateSessionArguments,
|
@@ -48,8 +36,8 @@ export async function handleDinteroPaymentSessionPayload(
|
48 | 36 | amount: discount.amount * 100,
|
49 | 37 | })) ?? [],
|
50 | 38 | })),
|
51 |
| - shipping_address: buildAddress(args.customer), |
52 |
| - billing_address: buildAddress(args.customer), |
| 39 | + shipping_address: args.customer?.shippingAddress, |
| 40 | + billing_address: args.customer?.billingAddress, |
53 | 41 | },
|
54 | 42 | url: {
|
55 | 43 | return_url: args.returnUrl,
|
|
0 commit comments