mirror of
https://github.com/valitydev/adapter-bank-payout-spring-boot-starter.git
synced 2024-11-06 00:45:21 +00:00
PROX-396: damsel-cds -> cds-proto (#18)
* PROX-396: damsel-cds -> cds-proto
This commit is contained in:
parent
22b06a56dd
commit
f19526235f
8
pom.xml
8
pom.xml
@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.rbkmoney</groupId>
|
||||
<artifactId>adapter-bank-payout-spring-boot-starter</artifactId>
|
||||
<version>1.0.4</version>
|
||||
<version>1.0.5</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Adapter-bank-payout-spring-boot-starter</name>
|
||||
@ -15,10 +15,10 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>8</java.version>
|
||||
<spring-boot.version>2.1.1.RELEASE</spring-boot.version>
|
||||
<damsel-utils.version>2.1.9</damsel-utils.version>
|
||||
<damsel.version>1.303-d99319c</damsel.version>
|
||||
<damsel.version>1.391-8fe5f98</damsel.version>
|
||||
<serializer.version>0.6.7</serializer.version>
|
||||
<error-mapping.version>1.0.4</error-mapping.version>
|
||||
<adapter-common-lib.version>0.0.19</adapter-common-lib.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@ -71,7 +71,7 @@
|
||||
<dependency>
|
||||
<groupId>com.rbkmoney</groupId>
|
||||
<artifactId>adapter-common-lib</artifactId>
|
||||
<version>0.0.15</version>
|
||||
<version>${adapter-common-lib.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.rbkmoney</groupId>
|
||||
|
@ -0,0 +1,10 @@
|
||||
package com.rbkmoney.adapter.bank.payout.spring.boot.starter.handler;
|
||||
|
||||
import com.rbkmoney.damsel.withdrawals.provider_adapter.GetQuoteParams;
|
||||
import com.rbkmoney.damsel.withdrawals.provider_adapter.Quote;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface GetQuoteHandler {
|
||||
Quote handle(GetQuoteParams getQuoteParams, Map<String, String> map);
|
||||
}
|
@ -5,14 +5,13 @@ import com.rbkmoney.adapter.bank.payout.spring.boot.starter.converter.ExitStateT
|
||||
import com.rbkmoney.adapter.bank.payout.spring.boot.starter.converter.WithdrawalToEntryStateConverter;
|
||||
import com.rbkmoney.adapter.bank.payout.spring.boot.starter.flow.StepResolver;
|
||||
import com.rbkmoney.adapter.bank.payout.spring.boot.starter.handler.CommonHandler;
|
||||
import com.rbkmoney.adapter.bank.payout.spring.boot.starter.handler.GetQuoteHandler;
|
||||
import com.rbkmoney.adapter.bank.payout.spring.boot.starter.model.EntryStateModel;
|
||||
import com.rbkmoney.adapter.bank.payout.spring.boot.starter.model.ExitStateModel;
|
||||
import com.rbkmoney.adapter.bank.payout.spring.boot.starter.validator.WithdrawalValidator;
|
||||
import com.rbkmoney.adapter.common.exception.UnsupportedMethodException;
|
||||
import com.rbkmoney.damsel.msgpack.Value;
|
||||
import com.rbkmoney.damsel.withdrawals.provider_adapter.AdapterSrv;
|
||||
import com.rbkmoney.damsel.withdrawals.provider_adapter.ProcessResult;
|
||||
import com.rbkmoney.damsel.withdrawals.provider_adapter.Withdrawal;
|
||||
import com.rbkmoney.damsel.withdrawals.provider_adapter.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.thrift.TException;
|
||||
@ -29,6 +28,7 @@ public class PayoutAdapterService<T extends EntryStateModel, X extends ExitState
|
||||
private final List<CommonHandler<T, X>> handlers;
|
||||
private final StepResolver<T, X> resolver;
|
||||
private final WithdrawalValidator validator;
|
||||
private final GetQuoteHandler getQuoteHandler;
|
||||
|
||||
@Override
|
||||
public ProcessResult processWithdrawal(Withdrawal withdrawal, Value state, Map<String, String> options) throws TException {
|
||||
@ -43,4 +43,9 @@ public class PayoutAdapterService<T extends EntryStateModel, X extends ExitState
|
||||
exitStateModel.getNextState().setStep(resolver.resolveExit(exitStateModel));
|
||||
return exitStateToProcessResultConverter.convert(exitStateModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Quote getQuote(GetQuoteParams getQuoteParams, Map<String, String> map) throws GetQuoteFailure, TException {
|
||||
return getQuoteHandler.handle(getQuoteParams, map);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
package com.rbkmoney.adapter.bank.payout.spring.boot.starter.service;
|
||||
|
||||
import com.rbkmoney.damsel.msgpack.Value;
|
||||
import com.rbkmoney.damsel.withdrawals.provider_adapter.AdapterSrv;
|
||||
import com.rbkmoney.damsel.withdrawals.provider_adapter.ProcessResult;
|
||||
import com.rbkmoney.damsel.withdrawals.provider_adapter.Withdrawal;
|
||||
import com.rbkmoney.damsel.withdrawals.provider_adapter.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.thrift.TException;
|
||||
@ -28,12 +26,31 @@ public class PayoutAdapterServiceLogDecorator implements AdapterSrv.Iface {
|
||||
return processResult;
|
||||
} catch (Exception ex) {
|
||||
String message = "Exception in processPayment with withdrawalId " + withdrawalId;
|
||||
logMessage(ex, message);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Quote getQuote(GetQuoteParams getQuoteParams, Map<String, String> map) throws GetQuoteFailure, TException {
|
||||
String withdrawalId = getQuoteParams.getIdempotencyId();
|
||||
log.info("processWithdrawal: start with withdrawalId {}", withdrawalId);
|
||||
try {
|
||||
Quote quote = payoutAdapterService.getQuote(getQuoteParams, map);
|
||||
log.info("processWithdrawal: finish {} with withdrawalId {}", quote, withdrawalId);
|
||||
return quote;
|
||||
} catch (Exception ex) {
|
||||
String message = "Exception in getQuote with withdrawalId " + withdrawalId;
|
||||
logMessage(ex, message);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
private void logMessage(Exception ex, String message) {
|
||||
if (isUndefinedResultOrUnavailable(ex)) {
|
||||
log.warn(message, ex);
|
||||
} else {
|
||||
log.error(message, ex);
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user