Skip to content

Commit

Permalink
fix(dvs-client): missing fields in callback 2
Browse files Browse the repository at this point in the history
  • Loading branch information
vincejv committed Aug 28, 2023
1 parent e48e75e commit a9568c9
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.List;

import com.abavilla.fpi.fw.dto.AbsDto;
import com.dtone.dvs.dto.Benefit;
import com.dtone.dvs.dto.Party;
import com.dtone.dvs.dto.PartyIdentifier;
import com.dtone.dvs.dto.Pin;
Expand Down Expand Up @@ -83,4 +84,7 @@ public class DVSCallbackDto extends AbsDto {
private StatementIdentifier statementIdentifier;

private String callbackUrl;

private List<Benefit> benefits;

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.dtone.dvs.dto.Product;
import com.dtone.dvs.dto.Promotion;
import com.dtone.dvs.dto.Rates;
import com.dtone.dvs.dto.StatementIdentifier;
import com.dtone.dvs.dto.Status;
import com.dtone.dvs.dto.Values;
import io.quarkus.mongodb.panache.common.MongoEntity;
Expand All @@ -49,23 +50,46 @@
public class DVSCallback extends AbsMongoItem {
@BsonProperty(value = "transactionId")
private Long dtOneId;

private String externalId;

private LocalDateTime creationDate;

private LocalDateTime confirmationExpirationDate;

private LocalDateTime confirmationDate;

private Status status;

private String operatorReference;

private Pin pin;

private Product product;

private Prices prices;

private Rates rates;
private List<Benefit> benefits;

private List<Promotion> promotions;

private Values requestedValues;

private Values adjustedValues;

private Party sender;

private Party beneficiary;

private PartyIdentifier debitPartyIdentifier;

private PartyIdentifier creditPartyIdentifier;

private StatementIdentifier statementIdentifier;

private String callbackUrl;

private List<Benefit> benefits;

private String loadProvider;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.function.Function;

import com.abavilla.fpi.fw.entity.mongo.AbsMongoItem;
Expand All @@ -46,12 +47,15 @@
import com.abavilla.fpi.sms.ext.rest.SmsApi;
import com.abavilla.fpi.telco.ext.enums.ApiStatus;
import com.dtone.dvs.dto.Transaction;
import com.dtone.dvs.dto.TransactionFixed;
import com.dtone.dvs.dto.TransactionRanged;
import com.google.i18n.phonenumbers.NumberParseException;
import com.google.i18n.phonenumbers.PhoneNumberUtil;
import io.quarkus.logging.Log;
import io.smallrye.mutiny.Uni;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.microprofile.rest.client.inject.RestClient;

Expand Down Expand Up @@ -100,6 +104,13 @@ public Uni<Void> storeCallback(GLRewardsCallbackDto callbackDto) {

public Uni<Void> storeCallback(Transaction dvsCallbackTransaction) {
var dvsCallbackDto = dtOneMapper.mapDTOneTransactionToCallbackDto(dvsCallbackTransaction);
if (dvsCallbackTransaction instanceof TransactionFixed fixed && ObjectUtils.isNotEmpty(fixed.getBenefits())) {
dvsCallbackDto.setBenefits(new ArrayList<>(fixed.getBenefits().size()));
dvsCallbackDto.getBenefits().addAll(fixed.getBenefits());
} else if (dvsCallbackTransaction instanceof TransactionRanged ranged && ObjectUtils.isNotEmpty(ranged.getBenefits())) {
dvsCallbackDto.setBenefits(new ArrayList<>(ranged.getBenefits().size()));
dvsCallbackDto.getBenefits().addAll(ranged.getBenefits());
}
return storeCallback(
dtOneMapper.mapDTOneRespToEntity(dvsCallbackDto),
ApiStatus.fromDtOne(dvsCallbackDto.getStatus().getId()),
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<dependency>
<groupId>com.vincejv</groupId>
<artifactId>dvs-apiclient</artifactId>
<version>2.2.0</version>
<version>2.2.1</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.googlecode.libphonenumber/libphonenumber -->
Expand Down

0 comments on commit a9568c9

Please sign in to comment.