SalesProcessController: check-in
1. UserInfoResponse userInfo = posManagerService.getUserInfo(trackId, extId, token);
Dealerin infosu goturulur.
2. TransactionEntity transactionEntity = createTransaction(providerId, trackId, checkInRequestDto, customerEntity, userInfo);
@Transactional
public TransactionEntity createTransaction(Integer providerId, String trackId, CheckInRequestDto
checkInRequestDto, CustomerEntity customerEntity, UserInfoResponse userInfo) {
if (SALE_NEW_NUMBER.equals(checkInRequestDto.getTransactionType())) {
validateDailyTransactionLimit(checkInRequestDto.getCustomer().getDocument().getPinCode(),
checkInRequestDto.getCustomer().getDocument().getSerialNumber(), providerId);
}
TransactionEntity transactionEntity = new TransactionEntity();
transactionEntity.setTrackId(trackId);
transactionEntity.setProviderId(providerId);
transactionEntity.setCustomer(customerEntity);
transactionEntity.setCreatedAt(LocalDateTime.now());
transactionEntity.setTransactionType(checkInRequestDto.getTransactionType());
transactionEntity.setStatus(IN_PROGRESS);
transactionEntity.setFullName(userInfo.getFullName());
transactionEntity.setRegionCode(String.valueOf(userInfo.getTradePoint().getRegionCode()));
transactionEntity.setPosCode(userInfo.getTradePoint().getPosCode());
transactionEntity.setOrganizationId(String.valueOf(userInfo.getOrganization().getExtId()));
transactionEntity.setDealerId(userInfo.getOrganization().getNgbssSellerId());
transactionEntity.setOrganizationName(userInfo.getOrganization().getTitle());
transactionEntity.setTradePointId(String.valueOf(userInfo.getTradePoint().getExtId()));
transactionEntity.setTradePointName(userInfo.getTradePoint().getTitle());
transactionEntity.setUserId(String.valueOf(userInfo.getId()));
transactionEntity.setDealerCode(userInfo.getOrganization().getParentDealerCode());
transactionEntity.setOrganizationType(userInfo.getOrganization().getOrganizationType());
return transactionEntity;
}
Комментарии
Отправить комментарий