Skip to content

Commit

Permalink
Adds hold
Browse files Browse the repository at this point in the history
  • Loading branch information
luis-herasme committed May 4, 2024
1 parent 1364c29 commit 3e5f237
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import path from 'path';
import fs from 'fs/promises';
import { Prettify, capitalizeKeys } from './utils';

type TrxType = 'Sale' | 'Void' | 'Refund';
type TrxType = 'Sale' | 'Void' | 'Refund' | 'Hold';

const channel = z.string().max(3).optional().default('EC');
const azulOrderId = z.string().max(8);
Expand Down Expand Up @@ -278,6 +278,30 @@ class AzulAPI {
return this.checkAzulResponse(response);
}

/**
* #### Hold: Transacción para retención o reserva de fondos en la tarjeta
* Se puede separar la autorización del posteo o captura en dos mensajes distintos:
* 1. Hold: pre-autorización y reserva de los fondos en la tarjeta del cliente.
* 2. Post: se hace la captura o el “posteo” de la transacción.
*
* Al utilizar el Hold y Post se deben considerar los siguientes puntos:
* 1. Para evitar que el banco emisor elimine la pre-autorización, el Post debe ser
* realizado antes de 7 días de haber hecho el Hold.
* 2. Luego de realizado el Hold, el comercio no va a recibir la liquidación de los
* fondos hasta que someta el Post.
* 3. El Post solamente se puede hacer una vez por cada Hold realizado. Si se
* desea dividir el posteo en múltiples capturas, se debe usar la
* funcionalidad de Captura Múltiple o Split Shipment.
* 4. El Post puede ser igual, menor o mayor al monto original. El posteo por un
* monto mayor no debe sobrepasar el 15% del monto original.
* 5. El Void libera o cancela los fondos retenidos.
*/
async hold(saleRequest: ProcessPaymentSchemaInput): Promise<AzulResponseWithOk> {
const validated = ProcessPaymentSchema.parse(saleRequest);
const response = await this.request(validated, 'Hold');
return this.checkAzulResponse(response);
}

async void(azulOrderId: string): Promise<AzulResponseWithOk> {
const response = await this.request({ azulOrderId }, 'Void');
return this.checkAzulResponse(response);
Expand Down

0 comments on commit 3e5f237

Please sign in to comment.