pixiPaySetAuthorizationStatus
Records the result of a payment authorization for an order, releases or keeps its HAL orderlines and writes a payment transaction log entry.
Used by an external payment provider (logged as pixi Apps Payment Provider) to report the outcome of an authorization for an order.
- The order is looked up by
OrderNrinOrderHeader. From it the procedure reads the customer reference, billing address reference, currency code (Currency.CodeA) and theCustomerOf(shop) of the customer. It also calculates the sum ofqty * priceof all orderlines of the order that are currently in statusHAL. - Depending on
Success:1(authorized): orderlines in statusHALare set toANG; the log entry gets transaction typeAUand codeAUTHORIZED.0(declined, default): orderlines stay in statusHAL; the log entry gets typeDEand codeAUTH DECLINED; the order's fail counterccpSetFailTriesis increased by 1.
- The order header is updated:
ccpNumOfTriesis increased by 1,CCPLastAuthCode=AuthCode,ccpPayID=AuthID,CCPPaymentInfoOK=Y,CCPReauthorizeYN=N,ccpSetFailLastTimeandUpdateDate= current time,UpdateEmp=API Call PaySetAuth. - All orderlines of the order with status
HALget the new status (see step 2), withUpdateEmp/UpdateDateset. - A row is inserted into
CCPTranLogwith vendorAP, the shop (CustomerOf), the order number,Messageas note, the calculatedHALamount as total amount, customer and billing address references and the currency code.
The call returns no result set.
Notes
- All changes run in one transaction (or a savepoint if a transaction is already open). On error the changes are rolled back and
log.InsertError(not attached) is called; the code itself does not re-raise the error, so the caller may receive no error indication. - If
OrderNrdoes not exist, no order header or orderlines are updated, but aCCPTranLogrow is still inserted with empty (NULL) shop, customer, address and currency values. No error is returned. CCPPaymentInfoOKis set toYandccpSetFailLastTimeis updated even whenSuccess= 0.ccpSetFailTriesis incremented withoutISNULL; if the column is NULL it stays NULL.- The amount is calculated via
Order_Id, while the orderlines to update are selected viaOrderNr. - Lookups use
NOLOCK; updates useROWLOCK. AuthID,AuthCodeandMessagehave no default and must be sent.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
OrderNr
Required
|
int | – |
Pixi order number of the order whose authorization result is reported. Example: |
Success
|
bit boolean |
0 |
Result of the authorization. Allowed values
Example: |
AuthID
Required
|
varchar(50) string |
– |
Payment/authorization ID of the provider; stored in Example: |
AuthCode
Required
|
varchar(50) string |
– |
Authorization code of the provider; stored in Example: |
Message
Required
|
varchar(200) string |
– |
Free text message of the provider; stored as note ( Example: |
This call returns no result set.
POST https://apigateway.descartes.com/tms/pixi/
Content-Type: text/xml; charset=utf-8
Authorization: Basic BASE64(USERNAME:PASSWORD)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
<SOAP-ENV:Body>
<ns1:pixiPaySetAuthorizationStatus>
<OrderNr>100245</OrderNr>
<!-- <Success>1</Success> -->
<AuthID>PAY-7F3A9C21</AuthID>
<AuthCode>A12345</AuthCode>
<Message>Authorization approved</Message>
</ns1:pixiPaySetAuthorizationStatus>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
curl -X POST 'https://apigateway.descartes.com/tms/pixi/' \
--user 'USERNAME:PASSWORD' \
--header 'Content-Type: text/xml; charset=utf-8' \
--data-binary @- <<'XML'
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
<SOAP-ENV:Body>
<ns1:pixiPaySetAuthorizationStatus>
<OrderNr>100245</OrderNr>
<!-- <Success>1</Success> -->
<AuthID>PAY-7F3A9C21</AuthID>
<AuthCode>A12345</AuthCode>
<Message>Authorization approved</Message>
</ns1:pixiPaySetAuthorizationStatus>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
XML
<?php
$soapClient = new SoapClient(null, [
'login' => 'USERNAME',
'password' => 'PASSWORD',
'location' => 'https://apigateway.descartes.com/tms/pixi/',
'uri' => 'https://apigateway.descartes.com/tms/pixi/',
]);
$arguments = [
'OrderNr' => '100245',
// 'Success' => '1',
'AuthID' => 'PAY-7F3A9C21',
'AuthCode' => 'A12345',
'Message' => 'Authorization approved',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiPaySetAuthorizationStatus', $soapArguments);
- SQL object:
- dbo.pipiPaySetAuthorizationStatus