@@ -13,48 +13,55 @@ export function stripHTML(string) {
1313 * @param {String } side Which side of the string to return (which side of the "-" symbol)
1414 * @param {String } price The inputted price that we need to convert
1515 */
16- export const filteredVariantPrice = ( price , side ) => {
16+ export function filteredVariantPrice ( price , side ) {
1717 if ( side === "right" ) {
1818 return price . substring ( price . length , price . indexOf ( "-" ) ) . replace ( "-" , "" ) ;
1919 }
2020 return price . substring ( 0 , price . indexOf ( "-" ) ) . replace ( "-" , "" ) ;
21- } ;
21+ }
2222
2323/**
2424 * Prepares the checkout object based on the input data from the checkout form
2525 * @param {Object } form Form data to process
2626 */
27- export function createCheckoutData ( form ) {
27+ export function createCheckoutData ( {
28+ firstName,
29+ lastName,
30+ address1,
31+ address2,
32+ city,
33+ country,
34+ state,
35+ postcode,
36+ email,
37+ phone,
38+ company,
39+ paymentMethod,
40+ } ) {
41+ const checkoutData = {
42+ firstName,
43+ lastName,
44+ address1,
45+ address2,
46+ city,
47+ country,
48+ state,
49+ postcode,
50+ email,
51+ phone,
52+ company,
53+ } ;
54+
2855 return {
2956 clientMutationId : uid ( ) ,
3057 billing : {
31- firstName : form . firstName ,
32- lastName : form . lastName ,
33- address1 : form . address1 ,
34- address2 : form . address2 ,
35- city : form . city ,
36- country : form . country ,
37- state : form . state ,
38- postcode : form . postcode ,
39- email : form . email ,
40- phone : form . phone ,
41- company : form . company ,
58+ ...checkoutData ,
4259 } ,
4360 shipping : {
44- firstName : form . firstName ,
45- lastName : form . lastName ,
46- address1 : form . address1 ,
47- address2 : form . address2 ,
48- city : form . city ,
49- country : form . country ,
50- state : form . state ,
51- postcode : form . postcode ,
52- email : form . email ,
53- phone : form . phone ,
54- company : form . company ,
61+ ...checkoutData ,
5562 } ,
5663 shipToDifferentAddress : false ,
57- paymentMethod : form . paymentMethod ,
64+ paymentMethod,
5865 isPaid : false ,
5966 transactionId : "test" ,
6067 } ;
0 commit comments