Fix type mapping (#47)

This commit is contained in:
Egor Cherniak 2022-08-03 18:52:32 +03:00 committed by GitHub
parent 35fa9e4707
commit f8fa3304e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 15 deletions

16
pom.xml
View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>dev.vality</groupId> <groupId>dev.vality</groupId>
<artifactId>service-parent-pom</artifactId> <artifactId>service-parent-pom</artifactId>
<version>1.0.17</version> <version>1.0.18</version>
</parent> </parent>
<artifactId>anapi-v2</artifactId> <artifactId>anapi-v2</artifactId>
@ -43,12 +43,12 @@
<dependency> <dependency>
<groupId>dev.vality</groupId> <groupId>dev.vality</groupId>
<artifactId>swag-anapi-v2</artifactId> <artifactId>swag-anapi-v2</artifactId>
<version>1.76-ec7a406-server</version> <version>1.77-89e7ff0-server</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>dev.vality</groupId> <groupId>dev.vality</groupId>
<artifactId>bouncer-proto</artifactId> <artifactId>bouncer-proto</artifactId>
<version>1.39-633ba73</version> <version>1.41-5628c61</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>dev.vality</groupId> <groupId>dev.vality</groupId>
@ -58,7 +58,7 @@
<dependency> <dependency>
<groupId>dev.vality</groupId> <groupId>dev.vality</groupId>
<artifactId>payout-manager-proto</artifactId> <artifactId>payout-manager-proto</artifactId>
<version>1.36-063163d</version> <version>1.38-635dc24</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>dev.vality</groupId> <groupId>dev.vality</groupId>
@ -78,7 +78,7 @@
<dependency> <dependency>
<groupId>dev.vality</groupId> <groupId>dev.vality</groupId>
<artifactId>reporter-proto</artifactId> <artifactId>reporter-proto</artifactId>
<version>1.16-cc187f5</version> <version>1.18-d7d9995</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>dev.vality.geck</groupId> <groupId>dev.vality.geck</groupId>
@ -87,7 +87,7 @@
<dependency> <dependency>
<groupId>dev.vality</groupId> <groupId>dev.vality</groupId>
<artifactId>damsel</artifactId> <artifactId>damsel</artifactId>
<version>1.566-03bbf48</version> <version>1.568-9362c08</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>dev.vality.woody</groupId> <groupId>dev.vality.woody</groupId>
@ -230,7 +230,7 @@
<dependency> <dependency>
<groupId>org.openapitools</groupId> <groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId> <artifactId>jackson-databind-nullable</artifactId>
<version>0.2.2</version> <version>0.2.3</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -268,7 +268,7 @@
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-wiremock</artifactId> <artifactId>spring-cloud-contract-wiremock</artifactId>
<version>3.1.1</version> <version>3.1.3</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -73,7 +73,8 @@ public class StatPaymentToPaymentSearchResultConverter {
return new CustomerPayer() return new CustomerPayer()
.customerID(customer.getCustomerId()) .customerID(customer.getCustomerId())
.paymentToolDetails(mapPaymentToolDetails(paymentTool)) .paymentToolDetails(mapPaymentToolDetails(paymentTool))
.paymentToolToken(getPaymentToolToken(paymentTool)); .paymentToolToken(getPaymentToolToken(paymentTool))
.payerType("CustomerPayer");
} }
case PAYMENT_RESOURCE -> { case PAYMENT_RESOURCE -> {
var resource = payer.getPaymentResource(); var resource = payer.getPaymentResource();
@ -91,7 +92,8 @@ public class StatPaymentToPaymentSearchResultConverter {
: null) : null)
.contactInfo(new ContactInfo() .contactInfo(new ContactInfo()
.email(contactInfo.getEmail()) .email(contactInfo.getEmail())
.phoneNumber(contactInfo.getPhoneNumber())); .phoneNumber(contactInfo.getPhoneNumber()))
.payerType("PaymentResourcePayer");
} }
case RECURRENT -> { case RECURRENT -> {
var recurrent = payer.getRecurrent(); var recurrent = payer.getRecurrent();
@ -105,7 +107,8 @@ public class StatPaymentToPaymentSearchResultConverter {
.phoneNumber(contactInfo.getPhoneNumber())) .phoneNumber(contactInfo.getPhoneNumber()))
.recurrentParentPayment(new PaymentRecurrentParent() .recurrentParentPayment(new PaymentRecurrentParent()
.paymentID(recurrent.getRecurrentParent().getPaymentId()) .paymentID(recurrent.getRecurrentParent().getPaymentId())
.invoiceID(recurrent.getRecurrentParent().getInvoiceId())); .invoiceID(recurrent.getRecurrentParent().getInvoiceId()))
.payerType("RecurrentPayer");
} }
default -> throw new IllegalArgumentException(); default -> throw new IllegalArgumentException();
} }
@ -133,22 +136,26 @@ public class StatPaymentToPaymentSearchResultConverter {
.paymentSystem(getPaymentSystem(card)) .paymentSystem(getPaymentSystem(card))
.cardNumberMask(MaskUtil.constructCardNumber(card)) .cardNumberMask(MaskUtil.constructCardNumber(card))
.lastDigits(card.getLastDigits()) .lastDigits(card.getLastDigits())
.tokenProvider(getTokenProvider(card)); .tokenProvider(getTokenProvider(card))
.detailsType("PaymentToolDetailsBankCard");
} }
case PAYMENT_TERMINAL -> { case PAYMENT_TERMINAL -> {
var terminal = paymentTool.getPaymentTerminal(); var terminal = paymentTool.getPaymentTerminal();
return new PaymentToolDetailsPaymentTerminal() return new PaymentToolDetailsPaymentTerminal()
.provider(getProvider(terminal)); .provider(getProvider(terminal))
.detailsType("PaymentToolDetailsPaymentTerminal");
} }
case MOBILE_COMMERCE -> { case MOBILE_COMMERCE -> {
var mobile = paymentTool.getMobileCommerce(); var mobile = paymentTool.getMobileCommerce();
return new PaymentToolDetailsMobileCommerce() return new PaymentToolDetailsMobileCommerce()
.phoneNumber(MaskUtil.constructPhoneNumber(mobile.getPhone())); .phoneNumber(MaskUtil.constructPhoneNumber(mobile.getPhone()))
.detailsType("PaymentToolDetailsMobileCommerce");
} }
case CRYPTO_CURRENCY -> { case CRYPTO_CURRENCY -> {
var cryptoCurrency = paymentTool.getCryptoCurrency(); var cryptoCurrency = paymentTool.getCryptoCurrency();
return new PaymentToolDetailsCryptoWallet() return new PaymentToolDetailsCryptoWallet()
.cryptoCurrency(cryptoCurrency.getId()); .cryptoCurrency(cryptoCurrency.getId())
.detailsType("PaymentToolDetailsCryptoWallet");
} }
default -> throw new IllegalArgumentException(); default -> throw new IllegalArgumentException();
} }