All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.ecwid.apiclient.v3.converter.FetchedCustomer.kt Maven / Gradle / Ivy
package com.ecwid.apiclient.v3.converter
import com.ecwid.apiclient.v3.dto.customer.request.UpdatedCustomer
import com.ecwid.apiclient.v3.dto.customer.result.FetchedCustomer
fun FetchedCustomer.toUpdated(): UpdatedCustomer {
return UpdatedCustomer(
email = email,
customerGroupId = customerGroupId,
billingPerson = billingPerson?.toUpdated(),
shippingAddresses = shippingAddresses?.map(FetchedCustomer.ShippingAddress::toUpdated),
contacts = contacts?.map(FetchedCustomer.CustomerContact::toUpdated),
taxId = taxId,
taxIdValid = taxIdValid,
taxExempt = taxExempt,
acceptMarketing = acceptMarketing,
lang = lang,
privateAdminNotes = privateAdminNotes,
commercialRelationshipScheme = commercialRelationshipScheme,
)
}
fun FetchedCustomer.BillingPerson.toUpdated(): UpdatedCustomer.BillingPerson {
return UpdatedCustomer.BillingPerson(
name = name,
companyName = companyName,
street = street,
city = city,
countryCode = countryCode,
postalCode = postalCode,
stateOrProvinceCode = stateOrProvinceCode,
phone = phone
)
}
fun FetchedCustomer.ShippingAddress.toUpdated(): UpdatedCustomer.ShippingAddress {
return UpdatedCustomer.ShippingAddress(
id = id,
name = name,
companyName = companyName,
street = street,
city = city,
countryCode = countryCode,
postalCode = postalCode,
stateOrProvinceCode = stateOrProvinceCode,
phone = phone,
note = note,
defaultAddress = defaultAddress,
orderBy = orderBy,
)
}
fun FetchedCustomer.CustomerContact.toUpdated(): UpdatedCustomer.CustomerContact {
return UpdatedCustomer.CustomerContact(
id = id,
contact = contact,
handle = handle,
note = note,
type = type,
default = default,
orderBy = orderBy,
)
}