Skip to content

Instantly share code, notes, and snippets.

@johntran
Last active April 10, 2018 21:27
Show Gist options
  • Save johntran/14f28d5817274567bf2cb82e280880f4 to your computer and use it in GitHub Desktop.
Save johntran/14f28d5817274567bf2cb82e280880f4 to your computer and use it in GitHub Desktop.
function getBillingAddress({
firstName,
lastName,
street,
addressLineTwo,
city,
state,
zip,
} ) {
return {
billingFirstName: firstName,
billingLastName: lastName,
billingAddressLineOne: street,
billingAddressLineTwo: addressLineTwo,
billingCity: city,
billingState: state,
billingZip: zip,
};
}
function generateBillingAddress(order) {
const {
billingAddress,
shippingAddress,
} = order;
const billingAddressData = billingAddress || shippingAddress;
return getBillingAddress(billingAddressData);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment