OrderService
extends Service
in package
Uses
ServiceTrait
This is the order service class.
This class will retrieve the orders and their documents from LogiCommerce API and transform them to objects. All the needed banner operations previous to Framework must be done here.
Tags
Table of Contents
DELETE | = \SDK\Core\Enums\MethodType::DELETE | |
---|---|---|
GET | = \SDK\Core\Enums\MethodType::GET | |
ITEMS | = 'items' | |
POST | = \SDK\Core\Enums\MethodType::POST | |
PUT | = \SDK\Core\Enums\MethodType::PUT | |
addGetDeliveryNote() | Add the request to get the documents filtered with the given parameters | : void |
addGetInvoice() | Add the request to get the invoice identified by the given id | : void |
addGetOrder() | Add the request to get the order identified by the given id | : void |
addGetOrderDeliveryNotes() | Add the request to get the delivery notes filtered with the given order id | : void |
addGetOrderInvoices() | Add the request to get the invoices filtered with the given order id | : void |
addGetOrderRMAs() | Add the request to get the order RMAs identified by the given order id | : void |
addGetPDFDeliveryNote() | Add the request to get the delivery note identified by the given id in PDF format (Base64) | : void |
addGetPDFInvoice() | Add the request to get the invoice identified by the given id in PDF format (Base64) | : void |
addGetPDFOrder() | Add the request to get the order identified by the given id in PDF format (Base64) | : void |
addGetReturnPoints() | Add the request to get the return points filtered with the given parameters | : void |
addGetReturnProducts() | Add the request to get returnable products filtered with the given parameters | : void |
addGetRichCorrectiveInvoice() | Add the request to get the corrective invoice in rich document format identified by the given id | : void |
addGetRichDeliveryNote() | Add the request to get the delivery note in rich document format identified by the given id | : void |
addGetRichInvoice() | Add the request to get the invoice in rich document format identified by the given id | : void |
addGetRichOrder() | Add the request to get the order in rich document format identified by the given id | : void |
addGetRichReturn() | Add the request to get the return in rich document format identified by the given id | : void |
addGetRichRMA() | Add the request to get the RMA in rich document format identified by the given id | : void |
addGetRMA() | Add the request to get the rma identified by the given id | : void |
addGetRMACorrectiveInvoice() | Add the request to get the rma corrective invoice identified by the given id | : void |
addGetRMACorrectiveInvoicePDF() | Add the request to get the rma corrective invoice by the given id in PDF format (Base64) | : void |
addGetRMAPDF() | Add the request to get the rma identified by the given id in PDF format (Base64) | : void |
addGetRMAReturns() | Add the request to get the rma return identified by the given id | : void |
addGetRMAReturnsPDF() | Add the request to get the rma return identified by the given id in PDF format (Base64) | : void |
addRecovery() | Add the request to get the basket adding the items inside the order identified by the given id | : void |
createOrder() | Create an order through the current basket and returns it | : Order|null |
createReturnRequest() | Returns the return requests filtered with the given order id | : ElementCollection|null |
getDeliveryNote() | Returns the delivery note identified by the given id | : DeliveryNote|null |
getInstance() | Returns the requested model instance. | : Service |
getInvoice() | Returns the invoice identified by the given id | : Invoice|null |
getOrder() | Returns the order identified by the given id | : Order|null |
getOrderDeliveryNotes() | Returns the delivery notes filtered with the given order id | : ElementCollection|null |
getOrderInvoices() | Returns the invoices filtered with the given order id | : ElementCollection|null |
getOrderRMAs() | Returns the Order RMAs identified by the given order id | : ElementCollection|null |
getPDFDeliveryNote() | Returns the delivery note identified by the given id in PDF format (Base64) | : PDFDocument|null |
getPDFInvoice() | Returns the invoice identified by the given id in PDF format (Base64) | : PDFDocument|null |
getPDFOrder() | Returns the order identified by the given id in PDF format (Base64) | : PDFDocument|null |
getReturnPoints() | Returns the return points identified by the given order id | : ElementCollection|null |
getReturnRequest() | Returns the returnable products identified by the given order id | : ElementCollection|null |
getRichCorrectiveInvoice() | Returns the corrective invoice in rich document format identified by the given id | : RichDocument|null |
getRichDeliveryNote() | Returns the delivery note in rich document format identified by the given id | : RichDocument|null |
getRichInvoice() | Returns the invoice in rich document format identified by the given id | : RichDocument|null |
getRichOrder() | Returns the order in rich document format identified by the given id | : RichDocument|null |
getRichReturn() | Returns the return in rich document format identified by the given id | : RichDocument|null |
getRichRMA() | Returns the rma in rich document format identified by the given id | : RichDocument|null |
getRMA() | Returns the rma identified by the given id | : RMA|null |
getRMACorrectiveInvoice() | Returns the rma corrective invoice identified by the given id | : DocumentRMACorrectiveInvoice|null |
getRMACorrectiveInvoicePDF() | Returns the rma corrective invoice identified by the given id in PDF format (Base64) | : PDFDocument|null |
getRMAPDF() | Returns the rma identified by the given id in PDF format (Base64) | : PDFDocument|null |
getRMAReturns() | Returns the rma return identified by the given id | : DocumentRMAReturn|null |
getRMAReturnsPDF() | Returns the rma return identified by the given id in PDF format (Base64) | : PDFDocument|null |
recovery() | Returns the basket adding the items inside the order identified by the given id | : Basket|null |
recoveryBasket() | Returns the basket adding the items inside the basket identified by the given hash | : Basket|null |
redirectToPayment() | Return the needed payment information to redirect the user to the payment system or manage the navigation to the needed page | : PayResponse|null |
validatePayment() | Validate the payment of an order. Returns the payment status | : PaymentValidationResponse|null |
__construct() | : mixed | |
call() | : array<string|int, mixed> | |
extractParameters() | : array<string|int, mixed> | |
getCollection() | : mixed | |
getConnection() | : Connection | |
getElement() | : Element|null | |
getElements() | : ElementCollection|null | |
getResourceElement() | : Element|null | |
getResponse() | : ElementCollection|null | |
prepareElement() | : Element|null | |
prepareElements() | : array<string|int, mixed> | |
replaceWildcards() | : string |
Constants
DELETE
protected
mixed
DELETE
= \SDK\Core\Enums\MethodType::DELETE
GET
protected
mixed
GET
= \SDK\Core\Enums\MethodType::GET
ITEMS
protected
mixed
ITEMS
= 'items'
POST
protected
mixed
POST
= \SDK\Core\Enums\MethodType::POST
PUT
protected
mixed
PUT
= \SDK\Core\Enums\MethodType::PUT
Methods
addGetDeliveryNote()
Add the request to get the documents filtered with the given parameters
public
addGetDeliveryNote(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetInvoice()
Add the request to get the invoice identified by the given id
public
addGetInvoice(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetOrder()
Add the request to get the order identified by the given id
public
addGetOrder(BatchRequests $batchRequests, string $batchName, int $id[, string $token = '' ]) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
- $token : string = ''
Return values
void —addGetOrderDeliveryNotes()
Add the request to get the delivery notes filtered with the given order id
public
addGetOrderDeliveryNotes(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
-
The id of the order we want to get the delivery notes
Return values
void —addGetOrderInvoices()
Add the request to get the invoices filtered with the given order id
public
addGetOrderInvoices(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
-
The id of the order we want to get the invoices
Return values
void —addGetOrderRMAs()
Add the request to get the order RMAs identified by the given order id
public
addGetOrderRMAs(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetPDFDeliveryNote()
Add the request to get the delivery note identified by the given id in PDF format (Base64)
public
addGetPDFDeliveryNote(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetPDFInvoice()
Add the request to get the invoice identified by the given id in PDF format (Base64)
public
addGetPDFInvoice(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetPDFOrder()
Add the request to get the order identified by the given id in PDF format (Base64)
public
addGetPDFOrder(BatchRequests $batchRequests, string $batchName, int $id[, string $token = '' ]) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
- $token : string = ''
Return values
void —addGetReturnPoints()
Add the request to get the return points filtered with the given parameters
public
addGetReturnPoints(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetReturnProducts()
Add the request to get returnable products filtered with the given parameters
public
addGetReturnProducts(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetRichCorrectiveInvoice()
Add the request to get the corrective invoice in rich document format identified by the given id
public
addGetRichCorrectiveInvoice(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetRichDeliveryNote()
Add the request to get the delivery note in rich document format identified by the given id
public
addGetRichDeliveryNote(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetRichInvoice()
Add the request to get the invoice in rich document format identified by the given id
public
addGetRichInvoice(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetRichOrder()
Add the request to get the order in rich document format identified by the given id
public
addGetRichOrder(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetRichReturn()
Add the request to get the return in rich document format identified by the given id
public
addGetRichReturn(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetRichRMA()
Add the request to get the RMA in rich document format identified by the given id
public
addGetRichRMA(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetRMA()
Add the request to get the rma identified by the given id
public
addGetRMA(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetRMACorrectiveInvoice()
Add the request to get the rma corrective invoice identified by the given id
public
addGetRMACorrectiveInvoice(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetRMACorrectiveInvoicePDF()
Add the request to get the rma corrective invoice by the given id in PDF format (Base64)
public
addGetRMACorrectiveInvoicePDF(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetRMAPDF()
Add the request to get the rma identified by the given id in PDF format (Base64)
public
addGetRMAPDF(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetRMAReturns()
Add the request to get the rma return identified by the given id
public
addGetRMAReturns(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetRMAReturnsPDF()
Add the request to get the rma return identified by the given id in PDF format (Base64)
public
addGetRMAReturnsPDF(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addRecovery()
Add the request to get the basket adding the items inside the order identified by the given id
public
addRecovery(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —createOrder()
Create an order through the current basket and returns it
public
createOrder() : Order|null
Return values
Order|null —createReturnRequest()
Returns the return requests filtered with the given order id
public
createReturnRequest(int $id[, CreateReturnRequestParametersGroup $params = null ]) : ElementCollection|null
Parameters
- $id : int
-
The id of the order we want to create the return requests
- $params : CreateReturnRequestParametersGroup = null
-
object with the needed data to send to the API basket resource
Return values
ElementCollection|null —getDeliveryNote()
Returns the delivery note identified by the given id
public
getDeliveryNote(int $id) : DeliveryNote|null
Parameters
- $id : int
Return values
DeliveryNote|null —getInstance()
Returns the requested model instance.
public
static getInstance() : Service
If is not setted, this method will set it.
Return values
Service —getInvoice()
Returns the invoice identified by the given id
public
getInvoice(int $id) : Invoice|null
Parameters
- $id : int
Return values
Invoice|null —getOrder()
Returns the order identified by the given id
public
getOrder(int $id[, string $token = '' ]) : Order|null
Parameters
- $id : int
- $token : string = ''
Return values
Order|null —getOrderDeliveryNotes()
Returns the delivery notes filtered with the given order id
public
getOrderDeliveryNotes(int $id) : ElementCollection|null
Parameters
- $id : int
-
The id of the order we want to get the delivery notes
Return values
ElementCollection|null —getOrderInvoices()
Returns the invoices filtered with the given order id
public
getOrderInvoices(int $id) : ElementCollection|null
Parameters
- $id : int
-
The id of the order we want to get the invoices
Return values
ElementCollection|null —getOrderRMAs()
Returns the Order RMAs identified by the given order id
public
getOrderRMAs(int $id) : ElementCollection|null
Parameters
- $id : int
Return values
ElementCollection|null —getPDFDeliveryNote()
Returns the delivery note identified by the given id in PDF format (Base64)
public
getPDFDeliveryNote(int $id) : PDFDocument|null
Parameters
- $id : int
Return values
PDFDocument|null —getPDFInvoice()
Returns the invoice identified by the given id in PDF format (Base64)
public
getPDFInvoice(int $id) : PDFDocument|null
Parameters
- $id : int
Return values
PDFDocument|null —getPDFOrder()
Returns the order identified by the given id in PDF format (Base64)
public
getPDFOrder(int $id[, string $token = '' ]) : PDFDocument|null
Parameters
- $id : int
- $token : string = ''
Return values
PDFDocument|null —getReturnPoints()
Returns the return points identified by the given order id
public
getReturnPoints(int $id) : ElementCollection|null
Parameters
- $id : int
Return values
ElementCollection|null —getReturnRequest()
Returns the returnable products identified by the given order id
public
getReturnRequest(int $id) : ElementCollection|null
Parameters
- $id : int
Return values
ElementCollection|null —getRichCorrectiveInvoice()
Returns the corrective invoice in rich document format identified by the given id
public
getRichCorrectiveInvoice(int $id) : RichDocument|null
Parameters
- $id : int
Return values
RichDocument|null —getRichDeliveryNote()
Returns the delivery note in rich document format identified by the given id
public
getRichDeliveryNote(int $id) : RichDocument|null
Parameters
- $id : int
Return values
RichDocument|null —getRichInvoice()
Returns the invoice in rich document format identified by the given id
public
getRichInvoice(int $id) : RichDocument|null
Parameters
- $id : int
Return values
RichDocument|null —getRichOrder()
Returns the order in rich document format identified by the given id
public
getRichOrder(int $id) : RichDocument|null
Parameters
- $id : int
Return values
RichDocument|null —getRichReturn()
Returns the return in rich document format identified by the given id
public
getRichReturn(int $id) : RichDocument|null
Parameters
- $id : int
Return values
RichDocument|null —getRichRMA()
Returns the rma in rich document format identified by the given id
public
getRichRMA(int $id) : RichDocument|null
Parameters
- $id : int
Return values
RichDocument|null —getRMA()
Returns the rma identified by the given id
public
getRMA(int $id) : RMA|null
Parameters
- $id : int
Return values
RMA|null —getRMACorrectiveInvoice()
Returns the rma corrective invoice identified by the given id
public
getRMACorrectiveInvoice(int $id) : DocumentRMACorrectiveInvoice|null
Parameters
- $id : int
Return values
DocumentRMACorrectiveInvoice|null —getRMACorrectiveInvoicePDF()
Returns the rma corrective invoice identified by the given id in PDF format (Base64)
public
getRMACorrectiveInvoicePDF(int $id) : PDFDocument|null
Parameters
- $id : int
Return values
PDFDocument|null —getRMAPDF()
Returns the rma identified by the given id in PDF format (Base64)
public
getRMAPDF(int $id) : PDFDocument|null
Parameters
- $id : int
Return values
PDFDocument|null —getRMAReturns()
Returns the rma return identified by the given id
public
getRMAReturns(int $id) : DocumentRMAReturn|null
Parameters
- $id : int
Return values
DocumentRMAReturn|null —getRMAReturnsPDF()
Returns the rma return identified by the given id in PDF format (Base64)
public
getRMAReturnsPDF(int $id) : PDFDocument|null
Parameters
- $id : int
Return values
PDFDocument|null —recovery()
Returns the basket adding the items inside the order identified by the given id
public
recovery(int $id) : Basket|null
Parameters
- $id : int
Return values
Basket|null —recoveryBasket()
Returns the basket adding the items inside the basket identified by the given hash
public
recoveryBasket(string $hash) : Basket|null
Parameters
- $hash : string
Return values
Basket|null —redirectToPayment()
Return the needed payment information to redirect the user to the payment system or manage the navigation to the needed page
public
redirectToPayment(int $id) : PayResponse|null
Parameters
- $id : int
-
the internal identifier of the order we want to pay
Return values
PayResponse|null —validatePayment()
Validate the payment of an order. Returns the payment status
public
validatePayment() : PaymentValidationResponse|null
Return values
PaymentValidationResponse|null —__construct()
protected
__construct() : mixed
Return values
mixed —call()
protected
call(Request $request[, string $apiUrl = null ]) : array<string|int, mixed>
Parameters
- $request : Request
- $apiUrl : string = null
Return values
array<string|int, mixed> —extractParameters()
protected
extractParameters([ParametersGroup|null $parametersGroup = null ]) : array<string|int, mixed>
Parameters
- $parametersGroup : ParametersGroup|null = null
Return values
array<string|int, mixed> —getCollection()
protected
getCollection(array<string|int, mixed> $data, string $class) : mixed
Parameters
- $data : array<string|int, mixed>
- $class : string
Return values
mixed —getConnection()
protected
getConnection() : Connection
Return values
Connection —getElement()
protected
getElement(string $class, string $resource[, int $id = null ][, mixed $params = null ]) : Element|null
Parameters
- $class : string
- $resource : string
- $id : int = null
- $params : mixed = null
Return values
Element|null —getElements()
protected
getElements(string $class, string $resource[, ParametersGroup $parameters = null ]) : ElementCollection|null
Parameters
- $class : string
- $resource : string
- $parameters : ParametersGroup = null
Return values
ElementCollection|null —getResourceElement()
protected
getResourceElement(string $class, string $resource[, mixed $params = [] ]) : Element|null
Parameters
- $class : string
- $resource : string
- $params : mixed = []
Return values
Element|null —getResponse()
protected
getResponse(array<string|int, mixed> $data, string $class) : ElementCollection|null
Parameters
- $data : array<string|int, mixed>
- $class : string
Return values
ElementCollection|null —prepareElement()
protected
prepareElement(array<string|int, mixed> $data, string $class) : Element|null
Parameters
- $data : array<string|int, mixed>
- $class : string
Return values
Element|null —prepareElements()
protected
prepareElements(array<string|int, mixed> $data, string $class) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
- $class : string
Return values
array<string|int, mixed> —replaceWildcards()
protected
replaceWildcards(string $resource, array<string|int, mixed> $wildcards) : string
Parameters
- $resource : string
- $wildcards : array<string|int, mixed>