Cómo integrar con CSM Servicios DD
Esta página explica cómo integrar una aplicación cliente con CSM Servicios DD. Proporciona interfaces (CSMDDClient Adapter, CSMDDClient Validation Response Adapter y CSMDDAdapter) que los clientes deben implementar para manejar diversos message type s y API flujos relacionados con el procesamiento de pagos, la liquidación y la validación de reglas del esquema dentro del CSM sistema.
CSMDDClient Adapter
El CSM El adaptador espera que los clientes proporcionen una implementación para `CSMDDClientAdapter:
public interface CSMDDClientAdapter {
default CompletionStage<Void> handleCollectAndSettleResponse(ReceivingContext receivingContext, CollectAndSettleResponse collectAndSettleResponse) {
throw new IconRuntimeException("Please implement the CSMDDClientAdapter's handleCollectAndSettleResponse");
}
default CompletionStage<Void> handleCancellationResponse(ReceivingContext receivingContext, ExecuteDDCancellationResponse cancellationResponse) {
throw new IconRuntimeException("Please implement the CSMDDClientAdapter's handleCancellationResponse");
}
default CompletionStage<Void> handleTechnicalResponse(ReceivingContext receivingContext, TechnicalResponse technicalResponse) {
throw new IconRuntimeException("Please implement the CSMDDClientAdapter's handleTechnicalResponse");
}
default CompletionStage<Void> handleReversalResponse(ReceivingContext receivingContext, ExecuteDDReversalResponse executeDDReversalResponse) {
throw new IconRuntimeException("Please implement the CSMDDClientAdapter's handleReversalResponse");
}
}
Al anular los métodos, el cliente puede procesar mensajes distintos de la CSM Service, para un procesamiento adicional.
| Método | API | Flujos |
|---|---|---|
handleCollectAndSettleResponse |
Direct Debit API |
Acreedor DD |
manejar Respuesta Cancelación |
Direct Debit API |
Acreedor DD |
handleTechnicalResponse |
Direct Debit API |
Acreedor DD |
handleReversalResponse |
Direct Debit API |
Acreedor DD |
CSMDDClient Validation Response Adapter
El CSM El adaptador espera que los clientes proporcionen una implementación para `CSMDDClientValidationResponseAdapter:
public interface CSMDDClientValidationResponseAdapter {
default CompletionStage<Void> handleSchemeRulesResponse(ReceivingContext receivingContext, ValidateDirectDebitSchemeRulesResponse response) {
ValidatedIsoType validatedIsoType = ValidatedIsoTypeExtractor.extract(response);
return switch (validatedIsoType) {
case PACS_003 -> handlePacs003ValidateDirectDebitSchemeRulesResponse(receivingContext, response);
case PACS_007 -> handlePacs007ValidateDirectDebitSchemeRulesResponse(receivingContext, response);
case CAMT_056 -> handleCamt056ValidateDirectDebitSchemeRulesResponse(receivingContext, response);
case PACS_008, PACS_004, PACS_002, PACS_028, CAMT_029, UNKNOWN -> handleUnexpectedDirectDebitSchemeRulesResponse(receivingContext, response);
};
}
default CompletionStage<Void> handleUnexpectedDirectDebitSchemeRulesResponse(ReceivingContext receivingContext, ValidateDirectDebitSchemeRulesResponse validateDirectDebitSchemeRulesResponse) {
return CompletableFuture.failedStage(new IconRuntimeException("Please implement the CSMDDClientValidationResponseAdapter's handleUnexpectedDirectDebitSchemeRulesResponse"));
}
default CompletionStage<Void> handlePacs003ValidateDirectDebitSchemeRulesResponse(ReceivingContext receivingContext, ValidateDirectDebitSchemeRulesResponse validateDirectDebitSchemeRulesResponse) {
return CompletableFuture.failedStage(new IconRuntimeException("Please implement the CSMDDClientValidationResponseAdapter's handlePacs003ValidationResponse"));
}
default CompletionStage<Void> handlePacs007ValidateDirectDebitSchemeRulesResponse(ReceivingContext receivingContext, ValidateDirectDebitSchemeRulesResponse validateDirectDebitSchemeRulesResponse) {
return CompletableFuture.failedStage(new IconRuntimeException("Please implement the CSMDDClientValidationResponseAdapter's handlePacs007ValidationResponse"));
}
default CompletionStage<Void> handleCamt056ValidateDirectDebitSchemeRulesResponse(ReceivingContext receivingContext, ValidateDirectDebitSchemeRulesResponse validateDirectDebitSchemeRulesResponse) {
return CompletableFuture.failedStage(new IconRuntimeException("Please implement the CSMDDClientValidationResponseAdapter's handleCamt056ValidationResponse"));
}
}
Al sobrescribir los métodos, el cliente puede procesar distintos `ValidateDirectDebitSchemeRuleResponse ` messages from the CSM Service. Clients can choose to implement the ISO type-specific handler methods or override default ` método handleSchemeRulesResponse()
CSM Proyecto Inicial del Cliente
El siguiente maven dependency es un proyecto inicial e incluye código base que acelerará la integración de una aplicación cliente con un CSM service. Este es el método preferido y facilita las cosas. Sin embargo, no es técnicamente obligatorio utilizarlo.
<dependency>
<groupId>com.iconsolutions.ipf.payments.csm</groupId>
<artifactId>csm-client-starter-all</artifactId>
</dependency>
CSMDDAdapter
Cuando el csm-client-starter-all se añade la dependencia, una implementación de CSMDDAdapter también está disponible:
public interface CSMDDAdapter {
CompletionStage<DeliveryReport> collectAndSettle(CollectAndSettleRequest collectAndSettleRequest);
CompletionStage<DeliveryReport> cancellation(ExecuteDDCancellationRequest cancellationRequest);
CompletionStage<DeliveryReport> executeReversalRequest(ExecuteDDReversalRequest executeDDReversalRequest);
}
Esta interfaz puede ser inyectada en el lado del cliente y, al invocar estos métodos, se pueden enviar mensajes distintos a la CSM Service, para un procesamiento adicional.
| Método | API | Flujos |
|---|---|---|
recolectarYLiquidar |
Direct Debit API |
Acreedor DD |
cancelación |
Direct Debit API |
Acreedor DD |
ejecutar Solicitud De Reversión |
Direct Debit API |
Acreedor DD |