mirror of
https://github.com/valitydev/claim-management.git
synced 2024-11-06 02:05:18 +00:00
Contractor country (#33)
This commit is contained in:
parent
7ab771c883
commit
d5c88c8ae2
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.rbkmoney</groupId>
|
||||
<artifactId>service-parent-pom</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<version>1.2.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>claim-management</artifactId>
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.rbkmoney.cm.converter;
|
||||
|
||||
import com.rbkmoney.cm.model.InternationalBankDetailsModel;
|
||||
import com.rbkmoney.damsel.domain.CountryCode;
|
||||
import com.rbkmoney.damsel.domain.InternationalBankDetails;
|
||||
import com.rbkmoney.damsel.domain.Residence;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Optional;
|
||||
@ -20,7 +20,7 @@ public class InternationalBankDetailsModelToInternationalBankDetailsConverter
|
||||
.setName(internationalBankDetailsModel.getName())
|
||||
.setCountry(
|
||||
Optional.ofNullable(internationalBankDetailsModel.getCountryCode())
|
||||
.map(Residence::findByValue)
|
||||
.map(CountryCode::findByValue)
|
||||
.orElse(null)
|
||||
);
|
||||
}
|
||||
|
@ -1,8 +1,11 @@
|
||||
package com.rbkmoney.cm.converter;
|
||||
|
||||
import com.rbkmoney.cm.model.InternationalLegalEntityModel;
|
||||
import com.rbkmoney.damsel.domain.CountryCode;
|
||||
import com.rbkmoney.damsel.domain.CountryRef;
|
||||
import com.rbkmoney.damsel.domain.InternationalLegalEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@Component
|
||||
public class InternationalLegalEntityModelToInternationalLegalEntityConverter
|
||||
@ -15,7 +18,10 @@ public class InternationalLegalEntityModelToInternationalLegalEntityConverter
|
||||
.setTradingName(internationalLegalEntityModel.getTradingName())
|
||||
.setActualAddress(internationalLegalEntityModel.getActualAddress())
|
||||
.setRegisteredNumber(internationalLegalEntityModel.getRegisteredNumber())
|
||||
.setRegisteredAddress(internationalLegalEntityModel.getRegisteredAddress());
|
||||
.setRegisteredAddress(internationalLegalEntityModel.getRegisteredAddress())
|
||||
.setCountry(StringUtils.hasLength(internationalLegalEntityModel.getCountryCode())
|
||||
? new CountryRef(CountryCode.valueOf(internationalLegalEntityModel.getCountryCode()))
|
||||
: null);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
public class InternationalLegalEntityToInternationalLegalEntityModelConverter
|
||||
implements ClaimConverter<InternationalLegalEntity, InternationalLegalEntityModel> {
|
||||
|
||||
@Override
|
||||
public InternationalLegalEntityModel convert(InternationalLegalEntity internationalLegalEntity) {
|
||||
InternationalLegalEntityModel internationalLegalEntityModel = new InternationalLegalEntityModel();
|
||||
@ -15,6 +16,10 @@ public class InternationalLegalEntityToInternationalLegalEntityModelConverter
|
||||
internationalLegalEntityModel.setRegisteredNumber(internationalLegalEntity.getRegisteredNumber());
|
||||
internationalLegalEntityModel.setLegalName(internationalLegalEntity.getLegalName());
|
||||
internationalLegalEntityModel.setTradingName(internationalLegalEntity.getTradingName());
|
||||
if (internationalLegalEntity.isSetCountry()) {
|
||||
internationalLegalEntityModel.setCountryCode(internationalLegalEntity.getCountry().getId().name());
|
||||
}
|
||||
return internationalLegalEntityModel;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,4 +29,6 @@ public class InternationalLegalEntityModel extends LegalEntityModel {
|
||||
|
||||
private String registeredNumber;
|
||||
|
||||
private String countryCode;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,2 @@
|
||||
ALTER TABLE cm.legal_entity_model
|
||||
ADD COLUMN country_code character varying;
|
Loading…
Reference in New Issue
Block a user