32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
|
|
const DEFAULT_PACKAGE_IMG = 'static/img/no-photo-package.jpg';
|
|
|
|
export const fromWCPackage = wcPackage => {
|
|
return {
|
|
id: wcPackage.id,
|
|
reference: wcPackage.slug,
|
|
image: wcPackage.images[0].src || DEFAULT_PACKAGE_IMG,
|
|
hasImage: !!wcPackage.images.length,
|
|
name: wcPackage.name,
|
|
country: 'Sweden',
|
|
countryCode: 'se',
|
|
currency: 'SEK',
|
|
documents: [],
|
|
shortDescription: wcPackage.description,
|
|
prices: wcPackage.prices.map(price => ({
|
|
idPrice: price.id,
|
|
idPaymentType: price.id,
|
|
payType: price['payment_type'],
|
|
isSameCompanyAsCl: false,
|
|
idPackage: wcPackage.id,
|
|
periodUnit: price['period_unit'],
|
|
maxContractPeriod: price['max_contract_period'],
|
|
packagePayPeriod: price['package_pay_period'],
|
|
servicesContractPeriod: price['services_contract_period'],
|
|
fixedExtra: price['minimal_fixed_price'],
|
|
servicesExtra: price['minimal_services_price'],
|
|
recurentExtra: price['recurrent_price']
|
|
})) || [],
|
|
groups: [],
|
|
}
|
|
}; |