# GetCancelationsByCanceledDate Method
Overview
The GetCancelationsByCanceledDate method retrieves all orders that were canceled on a specific date, along with the reasons for cancellation. This method is essential for daily reconciliation, refund processing, and understanding cancellation patterns.
Use Cases
- Daily Reconciliation: Match canceled orders with refunds
- Financial Reporting: Track cancellation rates and reasons
- Refund Processing: Process refunds for canceled orders
- Analytics: Analyze cancellation patterns to improve service
- Compliance: Maintain audit trail of all cancellations
- Customer Service: Verify cancellation details for customer inquiries
Response Fields
The method returns an array of canceled orders. Each order contains:
| Field Name | Type (Length) | Description |
|---|---|---|
| OrderID | Integer (10) | Pontual's unique order ID |
| AgentOrderReference | Alpha (25) | Your unique order reference |
| OrderCreationTime | DateTime | When the order was originally created (ISO 8601 format) |
| OrderCancelationTime | DateTime | When the order was canceled (ISO 8601 format) |
| ReasonForCancelation | Alpha (255) | Textual description of cancellation reason |
Request Fields
| Field Name | Type (Length) | Option | Description |
|---|---|---|---|
| AgentID | Integer (9) | R | Your agent ID |
| PartnerID | Integer (9) | R | Your partner ID |
| CancelationDate | Date | R | Date for which to list canceled orders (YYYY-MM-DD) |
SOAP Request/Response Examples
Example 2: No Cancellations for Date
Request:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetCancelationsByCanceledDate xmlns="http://tempuri.org/">
<AgentID>12345</AgentID>
<PartnerID>67890</PartnerID>
<CancelationDate>2025-11-01</CancelationDate>
</GetCancelationsByCanceledDate>
</soap:Body>
</soap:Envelope>
Response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetCancelationsByCanceledDateResponse xmlns="http://tempuri.org/">
<GetCancelationsByCanceledDateResult>
<Cancelations />
</GetCancelationsByCanceledDateResult>
</GetCancelationsByCanceledDateResponse>
</soap:Body>
</soap:Envelope>
Integration Best Practices
2. Cancellation Analytics
// Analyze cancellation patterns
async function analyzeCancellations(startDate, endDate) {
const cancellations = [];
// Fetch cancellations for date range
for (let date = new Date(startDate); date <= new Date(endDate); date.setDate(date.getDate() + 1)) {
const dateStr = date.toISOString().split('T')[0];
const dailyCancellations = await soapClient.GetCancelationsByCanceledDate({
AgentID: config.agentID,
PartnerID: config.partnerID,
CancelationDate: dateStr
});
if (dailyCancellations && dailyCancellations.length > 0) {
cancellations.push(...dailyCancellations);
}
await sleep(1000); // Rate limiting
}
// Analyze by reason
const byReason = {};
cancellations.forEach(c => {
const reason = c.ReasonForCancelation;
if (!byReason[reason]) {
byReason[reason] = { count: 0, orders: [] };
}
byReason[reason].count++;
byReason[reason].orders.push(c.AgentOrderReference);
});
// Sort by frequency
const sortedReasons = Object.entries(byReason)
.sort((a, b) => b[1].count - a[1].count);
console.log('\n=== Cancellation Analysis ===');
console.log(`Period: ${startDate} to ${endDate}`);
console.log(`Total Cancellations: ${cancellations.length}\n`);
sortedReasons.forEach(([reason, data]) => {
const percentage = (data.count / cancellations.length * 100).toFixed(1);
console.log(`${reason}: ${data.count} (${percentage}%)`);
});
return { cancellations, byReason, sortedReasons };
}
// Run monthly analysis
// cron.schedule('0 9 1 * *', () => {
// const lastMonth = new Date();
// lastMonth.setMonth(lastMonth.getMonth() - 1);
// const startDate = new Date(lastMonth.getFullYear(), lastMonth.getMonth(), 1);
// const endDate = new Date(lastMonth.getFullYear(), lastMonth.getMonth() + 1, 0);
// analyzeCancellations(startDate.toISOString().split('T')[0], endDate.toISOString().split('T')[0]);
// });
3. Automated Refund Processing
// Automatically process refunds for cancellations
async function processRefund(localOrder, cancellation) {
// Get full order details
const orderDetails = await soapClient.GetOrderDetails({
AgentID: config.agentID,
PartnerID: config.partnerID,
OrderID: cancellation.OrderID,
AgentOrderReference: ''
});
// Calculate refund amount based on cancellation reason
const totalCollected = parseFloat(orderDetails.TotalCollectedFromSender);
let refundAmount = totalCollected;
// Apply fees based on reason
const reason = cancellation.ReasonForCancelation.toLowerCase();
if (reason.includes('customer request') || reason.includes('incorrect information')) {
// Deduct processing fee
refundAmount -= 5.00;
} else if (reason.includes('duplicate') || reason.includes('system error')) {
// Full refund
refundAmount = totalCollected;
}
// Process refund via payment gateway
try {
const refundResult = await paymentGateway.refund({
orderReference: cancellation.AgentOrderReference,
amount: refundAmount,
reason: cancellation.ReasonForCancelation,
originalTransactionId: localOrder.transactionId
});
// Record refund in database
await db.refunds.insert({
orderReference: cancellation.AgentOrderReference,
orderID: cancellation.OrderID,
refundAmount: refundAmount,
refundDate: new Date(),
refundTransactionId: refundResult.transactionId,
reason: cancellation.ReasonForCancelation
});
console.log(`Refund processed: ${cancellation.AgentOrderReference} - ${refundAmount}`);
} catch (error) {
console.error(`Refund failed for ${cancellation.AgentOrderReference}:`, error);
// Alert finance team for manual processing
await alertFinance(`Manual refund required for ${cancellation.AgentOrderReference}`);
}
}
Testing
Related Methods
Before calling GetCancelationsByCanceledDate:
- CancelOrder - Cancel orders
- GetOrderStatus - Check order status
After getting cancellations:
- GetOrderDetails - Get full details for refund processing
- GetPaymentsByDate - Reconcile payments
Support
- remittance@inter.co
- marcos.lanzoni@inter.co