Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AmiBX
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bitrix
AmiBX
Commits
04451ace
Commit
04451ace
authored
Dec 12, 2021
by
Kulya
😊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Order creat func 1
parent
19e83d89
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
12 deletions
+98
-12
AloVoiceRest.php
vendor/alovoice/src/AloVoiceRest.php
+88
-4
BillzRest.php
vendor/alovoice/src/BillzRest.php
+8
-6
billz.conf
vendor/alovoice/src/billz.conf
+1
-1
billzlasttime
vendor/alovoice/src/billzlasttime
+1
-1
No files found.
vendor/alovoice/src/AloVoiceRest.php
View file @
04451ace
...
...
@@ -646,6 +646,90 @@ class AloVoiceRest
return
$return
;
}
private
function
process_orders_synch
(
$p
=
false
)
{
$officeId
=
1347
;
$sFilter
=
[
"payed"
=>
"Y"
];
if
(
!
empty
(
$p
[
"order_id"
])){
$sFilter
[
"id"
]
=
$p
[
"order_id"
];
}
else
{
$sFilter
[
">dateUpdate"
]
=
"2021-12-10T18:46:50+05:00"
;
}
$res
=
BxRest
::
call
(
"sale.order.list"
,[
"select"
=>
[
"id"
,
"price"
,
"accountNumber"
,
"dateUpdate"
],
"filter"
=>
$sFilter
]);
$arResOrders
=
[];
if
(
!
empty
(
$res
[
"result"
][
"orders"
])){
foreach
(
$res
[
"result"
][
"orders"
]
as
$order
){
$arProducts
=
self
::
get_bx_order_products
(
$order
[
"id"
]);
if
(
empty
(
$arProducts
)){
continue
;
}
$arOrderProducts
=
[];
foreach
(
$arProducts
as
$oprd
){
$arOrderProducts
[]
=
[
"office_id"
=>
$officeId
,
"id"
=>
(
int
)
$oprd
[
"productId"
],
"billz_id"
=>
(
int
)
$oprd
[
"productXmlId"
],
"quantity"
=>
(
int
)
$oprd
[
"quantity"
],
"price"
=>
(
int
)
$oprd
[
"price"
],
"discount"
=>
(
int
)
$oprd
[
"discountPrice"
]
];
}
$arOrderParams
=
[
"order_id"
=>
$order
[
"id"
],
"paytype"
=>
"payme"
,
// "datePaid" => "2018-03-27T09:19:25.667Z",
"products"
=>
$arOrderProducts
];
$arResOrders
[]
=
BillzRest
::
createOrder
(
$arOrderParams
);
}
}
return
$arResOrders
;
// if(!empty($res["result"]["sections"])){
// $result = $res["result"]["sections"][0]["id"];
// }
}
private
function
get_bx_order_products
(
$id
=
false
)
{
// if(empty($id)){ return false; }
$res
=
BxRest
::
call
(
"sale.basketItem.list"
,[
// "select"=>["productId","quantity","price","name","productXmlId"],
"filter"
=>
[
"orderId"
=>
$id
]
]);
return
(
!
empty
(
$res
[
"result"
][
"basketItems"
]))
?
$res
[
"result"
][
"basketItems"
]
:
[];
}
private
function
set_orders_last_update
()
{
$ordTimeFile
=
__DIR__
.
"/orderlasttime"
;
$ldatetime
=
date
(
"c"
);
file_put_contents
(
$ordTimeFile
,
$ldatetime
);
}
private
function
get_orders_last_update
()
{
$ordTimeFile
=
__DIR__
.
"/orderlasttime"
;
$lastDateTime
=
"2021-12-10T10:10:10+05:00"
;
if
(
file_exists
(
$ordTimeFile
)){
$strTime
=
file_get_contents
(
$ordTimeFile
);
if
(
!
empty
(
$strTime
)){
$lastDateTime
=
$strTime
;
}
}
return
$lastDateTime
;
}
private
function
get_products_last_update
()
{
$timeFile
=
self
::
lasttimefile
();
$lastDateTime
=
"2018-01-01T00:00:00Z"
;
...
...
@@ -714,15 +798,15 @@ class AloVoiceRest
return
$result
;
}
private
function
create_billz_order
(
$r
=
false
)
{
$officeId
=
1347
;
$arOrderProducts
=
[
[
"office_id"
=>
1347
,
"office_id"
=>
$officeId
,
"id"
=>
6154
,
"billz_id"
=>
2641209
,
"name"
=>
"Ilm olish sirlari"
,
"barcode"
=>
"9789943510470"
,
"sku"
=>
"VIP756"
,
"quantity"
=>
2
,
"price"
=>
1200
,
"discount"
=>
180
...
...
vendor/alovoice/src/BillzRest.php
View file @
04451ace
...
...
@@ -51,7 +51,7 @@ require_once (__DIR__.'/keys.php');
$qPparams
[
'subTotalPrice'
]
=
0
;
$arProducts
=
[];
foreach
(
$params
[
"products"
]
as
$prd
){
$price
=
(
!
empty
(
$prd
[
"price"
]))
?
$prd
[
"price"
]
:
0
;
$dsnt
=
(
!
empty
(
$prd
[
"discount"
]))
?
$prd
[
"discount"
]
:
0
;
...
...
@@ -59,9 +59,9 @@ require_once (__DIR__.'/keys.php');
"billzOfficeID"
=>
$prd
[
"office_id"
],
"billzProductID"
=>
$prd
[
"billz_id"
],
"productID"
=>
$prd
[
"id"
],
"name"
=>
$prd
[
"name"
],
"barCode"
=>
$prd
[
"barcode"
],
"sku"
=>
$prd
[
"sku"
],
//
"name" => $prd["name"],
//
"barCode" => $prd["barcode"],
//
"sku" => $prd["sku"],
"qty"
=>
$prd
[
"quantity"
],
"subTotalPrice"
=>
$price
,
"discountAmount"
=>
$dsnt
,
...
...
@@ -139,7 +139,8 @@ require_once (__DIR__.'/keys.php');
{
return
[
// "url" => "https://api.billz.uz/v4/",
"url"
=>
"https://api.billz.uz/v1/"
,
"apiversion"
=>
"v4"
,
"url"
=>
"https://api.billz.uz/"
,
"iss"
=>
"qam.bitrix24.ru"
,
"sub"
=>
"qamar.bitrix24"
,
"secret"
=>
"iRPiwoNhnyhyyLMtADtINSuxHyVmsrXpvtejrAuERdyhhj2EPtMxUorppLUnELVhRmIpnGWsHSpwCzCWsjJLENekd9WumpLjPHvUQDwWmcuwotmhvEyIzzSVkejywICwzKrSDXucLE3SGQtyDVcmpeFBneSMmxuKMjo6Q2kGIGbfQkupBm3mMGXmPIEpwMNYNV38VcemDd6fPYQnRcyYERXctSGMTXFwdmDLoYBE6btCfNZfkdoBFmbhpQJpBkifPUScyQRGeRbkFxjEwvnXjhCSCMbpkjjfWkFeesnPupKkiKKKL8MkSKx6HuRIzbmbcGNJNWtrkx3sSM1MjPzCTiWE2wM1SZQWVYu8hDBVUVDKxBeRisKTjjeidboGWJNhWcpzQEJe4cMSjBvNNxxBiveZ0iDdMpcSYsJNfoVTT8mSkavRzmHeeSGXKSDDTmwjUwfoPsHhWJTt7BrauLIRhIrjKnsYZscNvSGYRDyVwBXaS8YfELUBUMSFjYnpjJVs"
...
...
@@ -161,7 +162,8 @@ require_once (__DIR__.'/keys.php');
$result
=
[
"settings"
=>
$arSettings
];
if
(
!
empty
(
$arSettings
))
{
$url
=
$arSettings
[
"url"
];
if
(
$method
==
"orders.create"
)
{
$arSettings
[
"apiversion"
]
=
"v2"
;
}
$url
=
$arSettings
[
"url"
]
.
$arSettings
[
"apiversion"
]
.
"/"
;
$arData
=
[
'jsonrpc'
=>
'2.0'
,
...
...
vendor/alovoice/src/billz.conf
View file @
04451ace
{
"billz_productfields"
:{
"ID"
:
"ID"
,
"name"
:
"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435"
,
"sku"
:
"\u0410\u0440\u0442\u0438\u043a\u0443\u043b\u044c"
,
"barCode"
:
"\u0411\u0430\u0440\u043a\u043e\u0434"
,
"price"
:
"\u0426\u0435\u043d\u0430"
,
"priceUSD"
:
"\u0426\u0435\u043d\u0430USD"
,
"discountAmount"
:
"\u0421\u043a\u0438\u0434\u043a\u0430"
,
"qty"
:
"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e"
,
".imageUrls"
:
"\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435"
,
".offices"
:
"\u0412 \u0441\u043a\u043b\u0430\u0434\u0430\u0445"
,
"properties_BRAND"
:
"BRAND"
,
"properties_CATEGORY"
:
"CATEGORY"
,
"properties_COLLECTION"
:
"COLLECTION"
,
"properties_COLOR"
:
"COLOR"
,
"properties_DESCRIPTION"
:
"DESCRIPTION"
,
"properties_GENDER"
:
"GENDER"
,
"properties_SEASON"
:
"SEASON"
,
"properties_SIZE"
:
"SIZE"
,
"properties_SUB_CATEGORY"
:
"SUB_CATEGORY"
,
"properties_\u0410\u0412\u0422\u041e\u0420"
:
"\u0410\u0412\u0422\u041e\u0420"
,
"properties_\u0412\u0415\u0421"
:
"\u0412\u0415\u0421"
,
"properties_\u0416\u0410\u041d\u0420"
:
"\u0416\u0410\u041d\u0420"
,
"properties_\u0418\u0417\u0414\u0410\u0422\u0415\u041b\u042c\u0421\u0422\u0412\u041e"
:
"\u0418\u0417\u0414\u0410\u0422\u0415\u041b\u042c\u0421\u0422\u0412\u041e"
,
"properties_\u041a\u041e\u041b\u0418\u0427\u0415\u0421\u0422\u0412\u041e_\u0421\u0422\u0420\u0410\u041d\u0418\u0426"
:
"\u041a\u041e\u041b\u0418\u0427\u0415\u0421\u0422\u0412\u041e_\u0421\u0422\u0420\u0410\u041d\u0418\u0426"
,
"properties_\u041d\u0410\u041f\u0420\u0410\u0412\u041b\u0415\u041d\u0418\u0415"
:
"\u041d\u0410\u041f\u0420\u0410\u0412\u041b\u0415\u041d\u0418\u0415"
,
"properties_\u041f\u041e\u0414\u041a\u0410\u0422\u0415\u0413\u041e\u0420\u0418\u042f2"
:
"\u041f\u041e\u0414\u041a\u0410\u0422\u0415\u0413\u041e\u0420\u0418\u042f2"
,
"properties_\u041f\u041e\u0421\u0422\u0410\u0412\u0429\u0418\u041a"
:
"\u041f\u041e\u0421\u0422\u0410\u0412\u0429\u0418\u041a"
,
"properties_\u0422\u0418\u041f_\u041e\u0411\u041b\u041e\u0416\u041a\u0418"
:
"\u0422\u0418\u041f_\u041e\u0411\u041b\u041e\u0416\u041a\u0418"
}}
\ No newline at end of file
{
"billz_productfields"
:{
"ID"
:
"ID"
,
"name"
:
"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435"
,
"sku"
:
"\u0410\u0440\u0442\u0438\u043a\u0443\u043b\u044c"
,
"barCode"
:
"\u0411\u0430\u0440\u043a\u043e\u0434"
,
"price"
:
"\u0426\u0435\u043d\u0430"
,
"priceUSD"
:
"\u0426\u0435\u043d\u0430USD"
,
"discountAmount"
:
"\u0421\u043a\u0438\u0434\u043a\u0430"
,
"qty"
:
"\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e"
,
".imageUrls"
:
"\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435"
,
".offices"
:
"\u0412 \u0441\u043a\u043b\u0430\u0434\u0430\u0445"
,
"properties_BRAND"
:
"BRAND"
,
"properties_CATEGORY"
:
"CATEGORY"
,
"properties_COLOR"
:
"COLOR"
,
"properties_DESCRIPTION"
:
"DESCRIPTION"
,
"properties_SIZE"
:
"SIZE"
,
"properties_SUB_CATEGORY"
:
"SUB_CATEGORY"
,
"properties_\u0410\u0412\u0422\u041e\u0420"
:
"\u0410\u0412\u0422\u041e\u0420"
,
"properties_\u0412\u0415\u0421"
:
"\u0412\u0415\u0421"
,
"properties_\u0415\u0414\u0418\u041d\u0418\u0426\u0410_\u0418\u0417\u041c\u0415\u0420\u0415\u041d\u0418\u042f"
:
"\u0415\u0414\u0418\u041d\u0418\u0426\u0410_\u0418\u0417\u041c\u0415\u0420\u0415\u041d\u0418\u042f"
,
"properties_\u0417\u0410\u041f\u0410\u0425\u0418"
:
"\u0417\u0410\u041f\u0410\u0425\u0418"
,
"properties_\u0418\u0417\u0414\u0410\u0422\u0415\u041b\u042c\u0421\u0422\u0412\u041e"
:
"\u0418\u0417\u0414\u0410\u0422\u0415\u041b\u042c\u0421\u0422\u0412\u041e"
,
"properties_\u041a\u041e\u041b_\u0412\u041e_\u0412_\u0423\u041f\u0410\u041a\u041e\u0412\u041a\u0415"
:
"\u041a\u041e\u041b_\u0412\u041e_\u0412_\u0423\u041f\u0410\u041a\u041e\u0412\u041a\u0415"
,
"properties_\u041a\u041e\u041b\u0418\u0427\u0415\u0421\u0422\u0412\u041e_\u0421\u0422\u0420\u0410\u041d\u0418\u0426"
:
"\u041a\u041e\u041b\u0418\u0427\u0415\u0421\u0422\u0412\u041e_\u0421\u0422\u0420\u0410\u041d\u0418\u0426"
,
"properties_\u041d\u0410\u041f\u0420\u0410\u0412\u041b\u0415\u041d\u0418\u0415"
:
"\u041d\u0410\u041f\u0420\u0410\u0412\u041b\u0415\u041d\u0418\u0415"
,
"properties_\u041f\u0415\u0420\u0415\u0412\u041e\u0414\u0427\u0418\u041a"
:
"\u041f\u0415\u0420\u0415\u0412\u041e\u0414\u0427\u0418\u041a"
,
"properties_\u041f\u041e\u0414\u041a\u0410\u0422\u0415\u0413\u041e\u0420\u0418\u042f2"
:
"\u041f\u041e\u0414\u041a\u0410\u0422\u0415\u0413\u041e\u0420\u0418\u042f2"
,
"properties_\u041f\u041e\u0421\u0422\u0410\u0412\u0429\u0418\u041a"
:
"\u041f\u041e\u0421\u0422\u0410\u0412\u0429\u0418\u041a"
,
"properties_\u041f\u0420\u041e\u0418\u0417\u0412\u041e\u0414\u0418\u0422\u0415\u041b\u042c"
:
"\u041f\u0420\u041e\u0418\u0417\u0412\u041e\u0414\u0418\u0422\u0415\u041b\u042c"
,
"properties_\u0421\u0415\u0420\u0422\u0418\u0424\u0418\u041a\u0410\u0422"
:
"\u0421\u0415\u0420\u0422\u0418\u0424\u0418\u041a\u0410\u0422"
,
"properties_\u0421\u041e\u0421\u0422\u0410\u0412"
:
"\u0421\u041e\u0421\u0422\u0410\u0412"
,
"properties_\u0421\u041f\u041e\u0421\u041e\u0411_\u041f\u0420\u0418\u041c\u0415\u041d\u0415\u041d\u0418\u042f"
:
"\u0421\u041f\u041e\u0421\u041e\u0411_\u041f\u0420\u0418\u041c\u0415\u041d\u0415\u041d\u0418\u042f"
,
"properties_\u0422\u0418\u041f_\u041e\u0411\u041b\u041e\u0416\u041a\u0418"
:
"\u0422\u0418\u041f_\u041e\u0411\u041b\u041e\u0416\u041a\u0418"
}}
\ No newline at end of file
vendor/alovoice/src/billzlasttime
View file @
04451ace
2021-12-10T12:18:44Z
\ No newline at end of file
2021-12-12T04:18:34Z
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment