ApiComponent
extends Injectable
in package
Table of Contents
Constants
- INDEX_COLUMNS = ['order' => self::INDEX_COLUMNS_ORDER, 'sale' => self::INDEX_COLUMNS_SALE, 'vat' => self::INDEX_COLUMNS_VAT, 'product' => self::INDEX_COLUMNS_PRODUCT]
- INDEX_COLUMNS_ORDER = ['amazon_order_id' => 'varchar(19) NOT NULL', 'order_status' => 'varchar(30)', 'fulfillment_channel' => 'char(3)', 'sku' => 'varchar(60)']
- INDEX_COLUMNS_PRODUCT = ['product_id_type' => 'tinyint(3) unsigned', 'product_id' => 'varchar(30)']
- INDEX_COLUMNS_SALE = ['amazon_order_id' => 'text NOT NULL']
- INDEX_COLUMNS_VAT = ['transaction_type' => 'text', 'transaction_event_id' => 'text', 'asin' => 'text']
- SPECIAL_SALE_COLUMNS = ['']
- TRANS_HEADER = [ //de 'artikelbezeichnung' => 'item_name', 'artikelbeschreibung' => 'item_description', 'angebotsnummer' => 'listing_id', 'handler_sku' => 'seller_sku', 'preis' => 'price', 'menge' => 'quantity', 'erstellungsdatum' => 'open_date', 'image_url' => 'image_url', 'artikelistmarketplace_angebot' => 'item_is_marketplace', 'produkt_id_typ' => 'product_id_type', 'zshop_shipping_fee' => 'zshop_shipping_fee', 'anmerkungzumartikel' => 'item_note', 'artikelzustand' => 'item_condition', 'zshop_category1' => 'zshop_category1', 'zshop_browse_path' => 'zshop_browse_path', 'zshop_storefront_feature' => 'zshop_storefront_feature', 'asin1' => 'asin1', 'asin2' => 'asin2', 'asin3' => 'asin3', 'internationalerversand' => 'will_ship_internationally', 'expressversand' => 'expedited_shipping', 'zshop_boldface' => 'zshop_boldface', 'produkt_id' => 'product_id', 'bid_for_featured_placement' => 'bid_for_featured_placement', 'hinzufugen_loschen' => 'add_delete', 'anzahlbestellungen' => 'pending_quantity', 'versender' => 'fulfillment_channel', 'handlerversandgruppe' => 'merchant_shipping_group', 'produktsteuerschlussel' => 'producttaxcode', //fr 'nom_produit' => 'item_name', 'description_article' => 'item_description', 'id_offre' => 'listing_id', 'sku_vendeur' => 'seller_sku', 'prix' => 'price', 'quantite' => 'quantity', 'date_ouverture' => 'open_date', 'image_url' => 'image_url', 'article_est_marketplace' => 'item_is_marketplace', 'type_id_produit' => 'product_id_type', 'zshop_shipping_fee' => 'zshop_shipping_fee', 'note_etat_article' => 'item_note', 'etat_produit' => 'item_condition', 'zshop_category1' => 'zshop_category1', 'zshop_browse_path' => 'zshop_browse_path', 'zshop_storefront_feature' => 'zshop_storefront_feature', 'asin1' => 'asin1', 'asin2' => 'asin2', 'asin3' => 'asin3', 'expedition_international' => 'will_ship_internationally', 'livraison_express' => 'expedited_shipping', 'zshop_boldface' => 'zshop_boldface', 'id_produit' => 'product_id', 'bid_for_featured_placement' => 'bid_for_featured_placement', 'ajouter_supprimer' => 'add_delete', 'quantite_attente' => 'pending_quantity', 'canal_traitement' => 'fulfillment_channel', 'groupe_expedition_vendeur' => 'merchant_shipping_group', // es 'titulodelproducto' => 'item_name', 'descripciondelproducto' => 'item_description', 'identificadordellisting' => 'listing_id', 'skudelvendedor' => 'seller_sku', 'precio' => 'price', 'cantidad' => 'quantity', 'fechadecreacion' => 'open_date', 'productoparavender' => 'item_is_marketplace', 'tipodeidentificadordeproducto' => 'product_id_type', 'Notasobreelproducto' => 'item_note', 'estadodelproducto' => 'item_condition', 'asin1' => 'asin1', 'enviointernacional' => 'will_ship_internationally', 'enviourgente' => 'expedited_shipping', 'identificadordelproducto' => 'product_id', 'anadiroeliminar' => 'add_delete', 'cantidadpendiente' => 'pending_quantity', 'canaldegestionlogistica' => 'fulfillment_channel', 'merchant-shipping-group' => 'merchant_shipping_group', ]
Properties
- $h : mixed
- $neededColumns : mixed
- $noFilterColumns : mixed
- $reportColumns : mixed
Methods
- filterSimpleUnique() : mixed
- fixHeader() : mixed
- getAmazonFiles() : mixed
- getCreateTableColums() : mixed
- getParseFileScript() : mixed
- indexTo() : mixed
- function indexTo array indexabeArray, string indexField return array
- parseAmazonFile() : mixed
- parseByJob() : mixed
- parseGetFineHeader() : mixed
- parseGetHeader() : mixed
- parseReportAmazonSale() : mixed
- runDbQuery() : mixed
- runDbQueryWithWarnings() : mixed
- runDbScript() : mixed
- sortFiles() : mixed
- translateHeader() : mixed
- updateAmazonSaleAFNAsin() : mixed
Constants
INDEX_COLUMNS
public
mixed
INDEX_COLUMNS
= ['order' => self::INDEX_COLUMNS_ORDER, 'sale' => self::INDEX_COLUMNS_SALE, 'vat' => self::INDEX_COLUMNS_VAT, 'product' => self::INDEX_COLUMNS_PRODUCT]
INDEX_COLUMNS_ORDER
public
mixed
INDEX_COLUMNS_ORDER
= ['amazon_order_id' => 'varchar(19) NOT NULL', 'order_status' => 'varchar(30)', 'fulfillment_channel' => 'char(3)', 'sku' => 'varchar(60)']
INDEX_COLUMNS_PRODUCT
public
mixed
INDEX_COLUMNS_PRODUCT
= ['product_id_type' => 'tinyint(3) unsigned', 'product_id' => 'varchar(30)']
INDEX_COLUMNS_SALE
public
mixed
INDEX_COLUMNS_SALE
= ['amazon_order_id' => 'text NOT NULL']
INDEX_COLUMNS_VAT
public
mixed
INDEX_COLUMNS_VAT
= ['transaction_type' => 'text', 'transaction_event_id' => 'text', 'asin' => 'text']
SPECIAL_SALE_COLUMNS
public
mixed
SPECIAL_SALE_COLUMNS
= ['']
TRANS_HEADER
public
mixed
TRANS_HEADER
= [
//de
'artikelbezeichnung' => 'item_name',
'artikelbeschreibung' => 'item_description',
'angebotsnummer' => 'listing_id',
'handler_sku' => 'seller_sku',
'preis' => 'price',
'menge' => 'quantity',
'erstellungsdatum' => 'open_date',
'image_url' => 'image_url',
'artikelistmarketplace_angebot' => 'item_is_marketplace',
'produkt_id_typ' => 'product_id_type',
'zshop_shipping_fee' => 'zshop_shipping_fee',
'anmerkungzumartikel' => 'item_note',
'artikelzustand' => 'item_condition',
'zshop_category1' => 'zshop_category1',
'zshop_browse_path' => 'zshop_browse_path',
'zshop_storefront_feature' => 'zshop_storefront_feature',
'asin1' => 'asin1',
'asin2' => 'asin2',
'asin3' => 'asin3',
'internationalerversand' => 'will_ship_internationally',
'expressversand' => 'expedited_shipping',
'zshop_boldface' => 'zshop_boldface',
'produkt_id' => 'product_id',
'bid_for_featured_placement' => 'bid_for_featured_placement',
'hinzufugen_loschen' => 'add_delete',
'anzahlbestellungen' => 'pending_quantity',
'versender' => 'fulfillment_channel',
'handlerversandgruppe' => 'merchant_shipping_group',
'produktsteuerschlussel' => 'producttaxcode',
//fr
'nom_produit' => 'item_name',
'description_article' => 'item_description',
'id_offre' => 'listing_id',
'sku_vendeur' => 'seller_sku',
'prix' => 'price',
'quantite' => 'quantity',
'date_ouverture' => 'open_date',
'image_url' => 'image_url',
'article_est_marketplace' => 'item_is_marketplace',
'type_id_produit' => 'product_id_type',
'zshop_shipping_fee' => 'zshop_shipping_fee',
'note_etat_article' => 'item_note',
'etat_produit' => 'item_condition',
'zshop_category1' => 'zshop_category1',
'zshop_browse_path' => 'zshop_browse_path',
'zshop_storefront_feature' => 'zshop_storefront_feature',
'asin1' => 'asin1',
'asin2' => 'asin2',
'asin3' => 'asin3',
'expedition_international' => 'will_ship_internationally',
'livraison_express' => 'expedited_shipping',
'zshop_boldface' => 'zshop_boldface',
'id_produit' => 'product_id',
'bid_for_featured_placement' => 'bid_for_featured_placement',
'ajouter_supprimer' => 'add_delete',
'quantite_attente' => 'pending_quantity',
'canal_traitement' => 'fulfillment_channel',
'groupe_expedition_vendeur' => 'merchant_shipping_group',
// es
'titulodelproducto' => 'item_name',
'descripciondelproducto' => 'item_description',
'identificadordellisting' => 'listing_id',
'skudelvendedor' => 'seller_sku',
'precio' => 'price',
'cantidad' => 'quantity',
'fechadecreacion' => 'open_date',
'productoparavender' => 'item_is_marketplace',
'tipodeidentificadordeproducto' => 'product_id_type',
'Notasobreelproducto' => 'item_note',
'estadodelproducto' => 'item_condition',
'asin1' => 'asin1',
'enviointernacional' => 'will_ship_internationally',
'enviourgente' => 'expedited_shipping',
'identificadordelproducto' => 'product_id',
'anadiroeliminar' => 'add_delete',
'cantidadpendiente' => 'pending_quantity',
'canaldegestionlogistica' => 'fulfillment_channel',
'merchant-shipping-group' => 'merchant_shipping_group',
]
Properties
$h
public
mixed
$h
= '
CREATE
ALGORITHM = UNDEFINED
DEFINER = `vatjar`@`%`
SQL SECURITY DEFINER
VIEW `scenariohelper` AS
SELECT
(CASE
WHEN
(ISNULL(`dep_uservat`.`vat`)
OR (`dep_uservat`.`start_at` > `nmc`.`event_date`))
THEN
NULL
WHEN (`dep_country`.`eu_member` = 0) THEN 0
WHEN
(`nmc`.`buyer_vat` IS NOT NULL)
THEN
IF((`nmc`.`departure_id` <> `bvc`.`id`),
0,
`dep_vatrate`.`rate`)
WHEN (`dest_uservat`.`vat` IS NOT NULL) THEN `dest_vatrate`.`rate`
WHEN ISNULL(`dest_uservat`.`vat`) THEN `dep_vatrate`.`rate`
ELSE NULL
END) AS `srate`,
(CASE
WHEN
(ISNULL(`dep_uservat`.`vat`)
OR (`dep_uservat`.`start_at` > `nmc`.`event_date`))
THEN
NULL
WHEN (`dep_country`.`eu_member` = 0) THEN `dest_uservat`.`vat`
WHEN (`nmc`.`buyer_vat` IS NOT NULL) THEN `dep_uservat`.`vat`
WHEN (`dest_uservat`.`vat` IS NOT NULL) THEN `dest_uservat`.`vat`
WHEN ISNULL(`dest_uservat`.`vat`) THEN `dep_uservat`.`vat`
ELSE NULL
END) AS `svat`,
`nmc`.`id` AS `id`,
`nmc`.`seller_vat` AS `seller_vat`,
`nmc`.`vatrate` AS `vatrate`,
`nmc`.`create_time` AS `create_time`,
`nmc`.`update_time` AS `update_time`,
`nmc`.`position` AS `position`,
`nmc`.`history_id` AS `history_id`,
`nmc`.`event_date` AS `event_date`,
`nmc`.`product_id` AS `product_id`,
`nmc`.`source` AS `source`,
`nmc`.`user_id` AS `user_id`,
`nmc`.`transid` AS `transid`,
`nmc`.`departure_id` AS `departure_id`,
`nmc`.`destination_id` AS `destination_id`,
`nmc`.`currency_id` AS `currency_id`,
`nmc`.`price` AS `price`,
`nmc`.`buyer_vat` AS `buyer_vat`,
`bvc`.`id` AS `buyer_vat_country_id`,
`nmc`.`invoice_number_id` AS `invoice_number_id`,
`nmc`.`ship` AS `ship`,
`nmc`.`discount` AS `discount`,
`dep_vatrate`.`rate` AS `dep_vatrate_rate`,
`dep_uservat`.`vat` AS `dep_seller_vat`,
`dep_uservat`.`start_at` AS `dep_vat_date`,
`dest_vatrate`.`rate` AS `dest_vatrate_rate`,
`dest_uservat`.`vat` AS `dest_seller_vat`,
`dest_uservat`.`start_at` AS `dest_vat_date`
FROM
((((((((((`movementcredit` `nmc`
JOIN `amazonsale` `nas` ON ((`nmc`.`id` = `nas`.`movement_id`)))
JOIN `amazonproduct` `nap` ON (((`nas`.`user_id` = `nap`.`user_id`)
AND (`nas`.`asin` = `nap`.`asin1`))))
JOIN `product` `np` ON ((`np`.`id` = `nap`.`prod_id`)))
JOIN `productvatrate` `npv` ON ((`np`.`id` = `npv`.`product_id`)))
LEFT JOIN `countryvatrate` `dep_vatrate` ON ((`nmc`.`departure_id` = `dep_vatrate`.`id`)))
LEFT JOIN `countryvatrate` `dest_vatrate` ON ((`nmc`.`destination_id` = `dest_vatrate`.`id`)))
LEFT JOIN `uservat` `dep_uservat` ON (((`nmc`.`user_id` = `dep_uservat`.`user_id`)
AND (`nmc`.`departure_id` = `dep_uservat`.`country_id`))))
LEFT JOIN `uservat` `dest_uservat` ON (((`nmc`.`user_id` = `dest_uservat`.`user_id`)
AND (`nmc`.`destination_id` = `dest_uservat`.`country_id`))))
LEFT JOIN `country` `bvc` ON ((`bvc`.`two` = SUBSTR(`nmc`.`buyer_vat`, 1, 2))))
LEFT JOIN `country` `dep_country` ON ((`dep_country`.`id` = `nmc`.`departure_id`)))
WHERE
(`nas`.`asin` IS NOT NULL)
ORDER BY `nmc`.`id`
'
$neededColumns
public
static mixed
$neededColumns
= ['product' => ['seller_sku', 'product_id_type', 'product_id'], 'order' => ['amazon_order_id', 'sku', 'fulfillment_channel', 'order_status'], 'sale' => ['sku', 'amazon_order_id'], 'vat' => ['unique_account_identifier', 'transaction_type', 'transaction_event_id', 'asin']]
$noFilterColumns
public
static mixed
$noFilterColumns
= ['vat' => [], 'product' => [], 'sale' => [], 'order' => ['last_updated_date', 'product_name', 'ship_city', 'ship_state', 'ship_postal_code']]
$reportColumns
public
static mixed
$reportColumns
= ['order' => ['amazon_order_id', 'merchant_order_id', 'purchase_date', 'last_updated_date', 'order_status', 'fulfillment_channel', 'sales_channel', 'order_channel', 'url', 'ship_service_level', 'product_name', 'sku', 'asin', 'item_status', 'quantity', 'currency', 'item_price', 'item_tax', 'shipping_price', 'shipping_tax', 'gift_wrap_price', 'gift_wrap_tax', 'item_promotion_discount', 'ship_promotion_discount', 'ship_city', 'ship_state', 'ship_postal_code', 'ship_country', 'promotion_ids'], 'sale' => ['amazon_order_id', 'merchant_order_id', 'shipment_id', 'shipment_item_id', 'amazon_order_item_id', 'merchant_order_item_id', 'purchase_date', 'payments_date', 'shipment_date', 'reporting_date', 'buyer_email', 'buyer_name', 'buyer_phone_number', 'sku', 'product_name', 'quantity_shipped', 'currency', 'item_price', 'item_tax', 'shipping_price', 'shipping_tax', 'gift_wrap_price', 'gift_wrap_tax', 'ship_service_level', 'recipient_name', 'ship_address_1', 'ship_address_2', 'ship_address_3', 'ship_city', 'ship_state', 'ship_postal_code', 'ship_country', 'ship_phone_number', 'bill_address_1', 'bill_address_2', 'bill_address_3', 'bill_city', 'bill_state', 'bill_postal_code', 'bill_country', 'item_promotion_discount', 'ship_promotion_discount', 'carrier', 'tracking_number', 'estimated_arrival_date', 'fulfillment_center_id', 'fulfillment_channel', 'sales_channel'], 'vat' => ['unique_account_identifier', 'activity_period', 'sales_channel', 'marketplace', 'transaction_type', 'transaction_event_id', 'activity_transaction_id', 'tax_calculation_date', 'transaction_depart_date', 'transaction_arrival_date', 'transaction_complete_date', 'seller_sku', 'asin', 'item_description', 'item_manufacture_country', 'qty', 'item_weight', 'total_activity_weight', 'cost_price_of_items', 'price_of_items_amt_vat_excl', 'promo_price_of_items_amt_vat_excl', 'total_price_of_items_amt_vat_excl', 'ship_charge_amt_vat_excl', 'promo_ship_charge_amt_vat_excl', 'total_ship_charge_amt_vat_excl', 'gift_wrap_amt_vat_excl', 'promo_gift_wrap_amt_vat_excl', 'total_gift_wrap_amt_vat_excl', 'total_activity_value_amt_vat_excl', 'price_of_items_vat_rate_percent', 'price_of_items_vat_amt', 'promo_price_of_items_vat_amt', 'total_price_of_items_vat_amt', 'ship_charge_vat_rate_percent', 'ship_charge_vat_amt', 'promo_ship_charge_vat_amt', 'total_ship_charge_vat_amt', 'gift_wrap_vat_rate_percent', 'gift_wrap_vat_amt', 'promo_gift_wrap_vat_amt', 'total_gift_wrap_vat_amt', 'total_activity_value_vat_amt', 'price_of_items_amt_vat_incl', 'promo_price_of_items_amt_vat_incl', 'total_price_of_items_amt_vat_incl', 'ship_charge_amt_vat_incl', 'promo_ship_charge_amt_vat_incl', 'total_ship_charge_amt_vat_incl', 'gift_wrap_amt_vat_incl', 'promo_gift_wrap_amt_vat_incl', 'total_gift_wrap_amt_vat_incl', 'total_activity_value_amt_vat_incl', 'transaction_currency_code', 'commodity_code', 'statistical_code_depart', 'statistical_code_arrival', 'commodity_code_supplementary_unit', 'item_qty_supplementary_unit', 'total_activity_supplementary_unit', 'product_tax_code', 'depature_city', 'departure_country', 'departure_post_code', 'arrival_city', 'arrival_country', 'arrival_post_code', 'sale_depart_country', 'sale_arrival_country', 'transportation_mode', 'delivery_conditions', 'seller_depart_vat_number_country', 'seller_depart_country_vat_number', 'seller_arrival_vat_number_country', 'seller_arrival_country_vat_number', 'transaction_seller_vat_number_country', 'transaction_seller_vat_number', 'buyer_vat_number_country', 'buyer_vat_number', 'vat_calculation_imputation_country', 'taxable_jurisdiction', 'taxable_jurisdiction_level', 'vat_inv_number', 'vat_inv_converted_amt', 'vat_inv_currency_code', 'vat_inv_exchange_rate', 'vat_inv_exchange_rate_date', 'export_outside_eu', 'invoice_url'], 'product' => ['item_name', 'item_description', 'listing_id', 'seller_sku', 'price', 'quantity', 'open_date', 'image_url', 'item_is_marketplace', 'product_id_type', 'zshop_shipping_fee', 'item_note', 'item_condition', 'zshop_category1', 'zshop_browse_path', 'zshop_storefront_feature', 'asin1', 'asin2', 'asin3', 'will_ship_internationally', 'expedited_shipping', 'zshop_boldface', 'product_id', 'bid_for_featured_placement', 'add_delete', 'pending_quantity', 'fulfillment_channel', 'status']]
Methods
filterSimpleUnique()
public
static filterSimpleUnique(mixed $user, mixed $modul, mixed $targetType, mixed $header, mixed $targetColumns[, mixed $indexedColumns = [] ][, mixed $noFilterColumns = [] ]) : mixed
Parameters
- $user : mixed
- $modul : mixed
- $targetType : mixed
- $header : mixed
- $targetColumns : mixed
- $indexedColumns : mixed = []
- $noFilterColumns : mixed = []
fixHeader()
public
static fixHeader(mixed $h[, mixed $spaceToUnderscore = false ]) : mixed
Parameters
- $h : mixed
- $spaceToUnderscore : mixed = false
getAmazonFiles()
public
static getAmazonFiles([mixed $pattern = '/\.tsv.orig$/i' ]) : mixed
Parameters
- $pattern : mixed = '/\.tsv.orig$/i'
getCreateTableColums()
public
static getCreateTableColums(mixed $targetType, mixed $header) : mixed
Parameters
- $targetType : mixed
- $header : mixed
getParseFileScript()
public
static getParseFileScript(mixed $user, mixed $file, mixed $request, mixed $modul, mixed $targetType, mixed $header, mixed $end, mixed $targetColumns, mixed $indexedColumns, mixed &$ret) : mixed
Parameters
- $user : mixed
- $file : mixed
- $request : mixed
- $modul : mixed
- $targetType : mixed
- $header : mixed
- $end : mixed
- $targetColumns : mixed
- $indexedColumns : mixed
- $ret : mixed
indexTo()
function indexTo array indexabeArray, string indexField return array
public
final static indexTo(array<string|int, mixed> $dataList, string $indexTo) : mixed
Parameters
- $dataList : array<string|int, mixed>
- $indexTo : string
parseAmazonFile()
public
static parseAmazonFile(PullRequest $job, mixed $type[, array<string|int, mixed> &$ret = [] ]) : mixed
Parameters
- $job : PullRequest
- $type : mixed
- $ret : array<string|int, mixed> = []
parseByJob()
public
static parseByJob(PullRequest $job[, array<string|int, mixed> &$ret = [] ]) : mixed
Parameters
- $job : PullRequest
- $ret : array<string|int, mixed> = []
parseGetFineHeader()
public
static parseGetFineHeader(mixed $file[, mixed &$realEnd = '\n' ][, array<string|int, mixed> $opt = [] ]) : mixed
Parameters
- $file : mixed
- $realEnd : mixed = '\n'
- $opt : array<string|int, mixed> = []
parseGetHeader()
public
static parseGetHeader(mixed $file[, mixed &$realEnd = '\n' ][, array<string|int, mixed> $opt = [] ]) : mixed
Parameters
- $file : mixed
- $realEnd : mixed = '\n'
- $opt : array<string|int, mixed> = []
parseReportAmazonSale()
public
static parseReportAmazonSale() : mixed
runDbQuery()
public
static runDbQuery(mixed $q, mixed $idb) : mixed
Parameters
- $q : mixed
- $idb : mixed
runDbQueryWithWarnings()
public
static runDbQueryWithWarnings(mixed $q, mixed $idb) : mixed
Parameters
- $q : mixed
- $idb : mixed
runDbScript()
public
static runDbScript(mixed $dbscript[, mixed $idb = null ][, array<string|int, mixed> &$ret = [] ]) : mixed
Parameters
- $dbscript : mixed
- $idb : mixed = null
- $ret : array<string|int, mixed> = []
sortFiles()
public
static sortFiles(array<string|int, mixed> $files[, array<string|int, mixed> &$unSort = [] ]) : mixed
Parameters
- $files : array<string|int, mixed>
- $unSort : array<string|int, mixed> = []
translateHeader()
public
static translateHeader(array<string|int, mixed> $header[, array<string|int, mixed> $trans = null ]) : mixed
Parameters
- $header : array<string|int, mixed>
- $trans : array<string|int, mixed> = null
updateAmazonSaleAFNAsin()
public
static updateAmazonSaleAFNAsin() : mixed