From 0814065b3e26026e28cb6e62fab6a2f1ee951d69 Mon Sep 17 00:00:00 2001 From: Eugene Grybinnyk Date: Mon, 22 Apr 2024 18:34:22 +0200 Subject: [PATCH 1/3] PAYM-5230: Use payments v3 spec --- pom.xml | 27 ++++ .../PaymentOrderPresentationRestClient.java | 6 +- .../configurator/PaymentsConfigurator.java | 6 +- .../ct/bbfuel/data/PaymentsDataGenerator.java | 152 +++++++++--------- src/main/resources/data.properties | 2 +- .../us-productized-data.properties | 2 +- 6 files changed, 111 insertions(+), 84 deletions(-) diff --git a/pom.xml b/pom.xml index acc74a21..17150249 100644 --- a/pom.xml +++ b/pom.xml @@ -56,6 +56,7 @@ 2.7.2 2.6.0 2.9.5 + 3.9.0 @@ -472,6 +473,18 @@ contact-manager-integration-inbound-api-v${contact-manager-integration-inbound-api.version}.yaml + + + download-payment-order-client-api-spec + + download-single + + generate-sources + + https://repo.backbase.com/specs/payment + payment-order-client-api-v${payment-order-client-api.version}.yaml + + @@ -642,6 +655,20 @@ + + + generate-payment-order-client-api-client-code + + generate + + + ${api.target}/payment-order-client-api-v${payment-order-client-api.version}.yaml + + com.backbase.dbs.paymentorder.client.api.v3 + com.backbase.dbs.paymentorder.client.api.v3.model + + + diff --git a/src/main/java/com/backbase/ct/bbfuel/client/payment/PaymentOrderPresentationRestClient.java b/src/main/java/com/backbase/ct/bbfuel/client/payment/PaymentOrderPresentationRestClient.java index c8b38c9e..44de3ea4 100644 --- a/src/main/java/com/backbase/ct/bbfuel/client/payment/PaymentOrderPresentationRestClient.java +++ b/src/main/java/com/backbase/ct/bbfuel/client/payment/PaymentOrderPresentationRestClient.java @@ -2,7 +2,7 @@ import com.backbase.ct.bbfuel.client.common.RestClient; import com.backbase.ct.bbfuel.config.BbFuelConfiguration; -import com.backbase.dbs.presentation.paymentorder.rest.spec.v2.paymentorders.InitiatePaymentOrder; +import com.backbase.dbs.paymentorder.client.api.v3.model.InitiatePaymentOrderWithId; import io.restassured.http.ContentType; import io.restassured.response.Response; import javax.annotation.PostConstruct; @@ -15,7 +15,7 @@ public class PaymentOrderPresentationRestClient extends RestClient { private final BbFuelConfiguration config; - private static final String SERVICE_VERSION = "v2"; + private static final String SERVICE_VERSION = "v3"; private static final String ENDPOINT_PAYMENT_ORDERS = "/payment-orders"; @PostConstruct @@ -25,7 +25,7 @@ public void init() { setInitialPath(config.getDbsServiceNames().getPayments() + "/" + CLIENT_API); } - public Response initiatePaymentOrder(InitiatePaymentOrder body) { + public Response initiatePaymentOrder(InitiatePaymentOrderWithId body) { return requestSpec() .contentType(ContentType.JSON) .body(body) diff --git a/src/main/java/com/backbase/ct/bbfuel/configurator/PaymentsConfigurator.java b/src/main/java/com/backbase/ct/bbfuel/configurator/PaymentsConfigurator.java index ee28c45e..64fa4b91 100644 --- a/src/main/java/com/backbase/ct/bbfuel/configurator/PaymentsConfigurator.java +++ b/src/main/java/com/backbase/ct/bbfuel/configurator/PaymentsConfigurator.java @@ -8,7 +8,7 @@ import com.backbase.ct.bbfuel.data.PaymentsDataGenerator; import com.backbase.ct.bbfuel.util.CommonHelpers; import com.backbase.ct.bbfuel.util.GlobalProperties; -import com.backbase.dbs.presentation.paymentorder.rest.spec.v2.paymentorders.InitiatePaymentOrder; +import com.backbase.dbs.paymentorder.client.api.v3.model.InitiatePaymentOrderWithId; import com.backbase.dbs.productsummary.presentation.rest.spec.v2.productsummary.ArrangementsByBusinessFunctionGetResponseBody; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -41,6 +41,8 @@ public void ingestPaymentOrders(String externalUserId) { List ootbPaymentTypes = globalProperties.getList(PROPERTY_PAYMENTS_OOTB_TYPES); + log.info("ootbPaymentTypes is {}", String.join(",", ootbPaymentTypes)); + loginRestClient.login(externalUserId, externalUserId); userContextPresentationRestClient.selectContextBasedOnMasterServiceAgreement(); List sepaCtArrangements = productSummaryPresentationRestClient @@ -75,7 +77,7 @@ public void ingestPaymentOrders(String externalUserId) { throw new IllegalArgumentException("Unknown payment type " + paymentType); } - InitiatePaymentOrder initiatePaymentOrder = PaymentsDataGenerator + InitiatePaymentOrderWithId initiatePaymentOrder = PaymentsDataGenerator .generateInitiatePaymentOrder(randomArrangement.getId(), randomArrangement.getCurrency(), paymentType); paymentOrderPresentationRestClient.initiatePaymentOrder(initiatePaymentOrder) .then() diff --git a/src/main/java/com/backbase/ct/bbfuel/data/PaymentsDataGenerator.java b/src/main/java/com/backbase/ct/bbfuel/data/PaymentsDataGenerator.java index b6ff7d1b..d19587ce 100644 --- a/src/main/java/com/backbase/ct/bbfuel/data/PaymentsDataGenerator.java +++ b/src/main/java/com/backbase/ct/bbfuel/data/PaymentsDataGenerator.java @@ -6,29 +6,31 @@ import static com.backbase.ct.bbfuel.util.CommonHelpers.getRandomFromList; import com.backbase.ct.bbfuel.util.CommonHelpers; -import com.backbase.dbs.presentation.paymentorder.rest.spec.v2.paymentorders.AccountIdentification; -import com.backbase.dbs.presentation.paymentorder.rest.spec.v2.paymentorders.Bank; -import com.backbase.dbs.presentation.paymentorder.rest.spec.v2.paymentorders.Identification; -import com.backbase.dbs.presentation.paymentorder.rest.spec.v2.paymentorders.IdentifiedPaymentOrder; -import com.backbase.dbs.presentation.paymentorder.rest.spec.v2.paymentorders.InitiateCounterpartyAccount; -import com.backbase.dbs.presentation.paymentorder.rest.spec.v2.paymentorders.InitiatePaymentOrder; -import com.backbase.dbs.presentation.paymentorder.rest.spec.v2.paymentorders.InitiateTransaction; -import com.backbase.dbs.presentation.paymentorder.rest.spec.v2.paymentorders.InvolvedParty; -import com.backbase.dbs.presentation.paymentorder.rest.spec.v2.paymentorders.PostalAddress; -import com.backbase.dbs.presentation.paymentorder.rest.spec.v2.paymentorders.Schedule; -import com.backbase.rest.spec.common.types.Currency; +import com.backbase.dbs.paymentorder.client.api.v3.model.AccountIdentification; +import com.backbase.dbs.paymentorder.client.api.v3.model.Bank; +import com.backbase.dbs.paymentorder.client.api.v3.model.CurrencyTyped; +import com.backbase.dbs.paymentorder.client.api.v3.model.Identification; +import com.backbase.dbs.paymentorder.client.api.v3.model.InitiateCounterpartyAccount; +import com.backbase.dbs.paymentorder.client.api.v3.model.InitiatePaymentOrderWithId; +import com.backbase.dbs.paymentorder.client.api.v3.model.InitiateTransaction; +import com.backbase.dbs.paymentorder.client.api.v3.model.InstructionPriority; +import com.backbase.dbs.paymentorder.client.api.v3.model.InvolvedParty; +import com.backbase.dbs.paymentorder.client.api.v3.model.PaymentMode; +import com.backbase.dbs.paymentorder.client.api.v3.model.PostalAddress; +import com.backbase.dbs.paymentorder.client.api.v3.model.Schedule; +import com.backbase.dbs.paymentorder.client.api.v3.model.Schedule.EveryEnum; +import com.backbase.dbs.paymentorder.client.api.v3.model.Schedule.NonWorkingDayExecutionStrategyEnum; +import com.backbase.dbs.paymentorder.client.api.v3.model.Schedule.TransferFrequencyEnum; +import com.backbase.dbs.paymentorder.client.api.v3.model.SchemeNames; import com.github.javafaker.Faker; -import java.text.SimpleDateFormat; +import java.time.LocalDate; import java.util.Arrays; -import java.util.Date; import java.util.List; -import java.util.Random; -import org.apache.commons.lang.time.DateUtils; +import java.util.UUID; public class PaymentsDataGenerator { private static Faker faker = new Faker(); - private static Random random = new Random(); private static List branchCodes = Arrays .asList("114923756", "114910222", "124000054", "113011258", "113110586", "121002042", "122003396", "122232109", "122237625", "122237997", "122238572", "122105045", "122105171", "122105320", "122400779", "123006965", @@ -42,26 +44,23 @@ public class PaymentsDataGenerator { "NWBKGB2LXXX", "COBADEFFXXX", "BNPAFRPPXXX", "POALILITXXX", "LOYDGB2LXXX", "NTSBDEB1XXX", "DEUTDEDBPAL", "AXISINBB002"); - public static InitiatePaymentOrder generateInitiatePaymentOrder(String originatorArrangementId, + public static InitiatePaymentOrderWithId generateInitiatePaymentOrder(String originatorArrangementId, String originatorArrangementCurrency, String paymentType) { - IdentifiedPaymentOrder.PaymentMode paymentMode = IdentifiedPaymentOrder.PaymentMode.values()[random - .nextInt(IdentifiedPaymentOrder.PaymentMode.values().length)]; + PaymentMode paymentMode = getRandomFromEnumValues(PaymentMode.values()); Schedule schedule = null; Bank counterpartyBank = null; Bank correspondentBank = null; - Currency currency = new Currency().withAmount(CommonHelpers.generateRandomAmountInRange(1000L, 99999L)); + CurrencyTyped currency = new CurrencyTyped().amount(CommonHelpers.generateRandomAmountInRange(1000L, 99999L)); Identification identification; - if (paymentMode.equals(IdentifiedPaymentOrder.PaymentMode.RECURRING)) { + if (paymentMode == PaymentMode.RECURRING) { schedule = new Schedule() - .withStartDate(new SimpleDateFormat("yyyy-MM-dd").format(new Date())) - .withEvery(getRandomFromEnumValues(Schedule.Every.values())) - .withNonWorkingDayExecutionStrategy( - getRandomFromEnumValues(Schedule.NonWorkingDayExecutionStrategy.values())) - .withTransferFrequency( - getRandomFromEnumValues(Schedule.TransferFrequency.values())) - .withOn(CommonHelpers.generateRandomNumberInRange(1, 7)) - .withEndDate(new SimpleDateFormat("yyyy-MM-dd").format(DateUtils.addYears(new Date(), 1))); + .startDate(LocalDate.now()) + .every(getRandomFromEnumValues(EveryEnum.values())) + .nonWorkingDayExecutionStrategy(getRandomFromEnumValues(NonWorkingDayExecutionStrategyEnum.values())) + .transferFrequency(getRandomFromEnumValues(TransferFrequencyEnum.values())) + .on(CommonHelpers.generateRandomNumberInRange(1, 7)) + .endDate(LocalDate.now().plusYears(1L)); } if (PAYMENT_TYPE_SEPA_CREDIT_TRANSFER.equals(paymentType)) { @@ -78,69 +77,68 @@ public static InitiatePaymentOrder generateInitiatePaymentOrder(String originato identification = generateBbanIdentification(); } - return new InitiatePaymentOrder() - .withOriginatorAccount(new AccountIdentification() - .withName(faker.lorem().sentence(3, 0).replace(".", "")) - .withIdentification(new Identification().withSchemeName(Identification.SchemeName.ID) - .withIdentification(originatorArrangementId))) - .withBatchBooking(false) - .withInstructionPriority(IdentifiedPaymentOrder.InstructionPriority.values()[random - .nextInt(IdentifiedPaymentOrder.InstructionPriority.values().length)]) - .withPaymentMode(paymentMode) - .withPaymentType(paymentType) - .withRequestedExecutionDate(new SimpleDateFormat("yyyy-MM-dd").format(new Date())) - .withSchedule(schedule) - .withTransferTransactionInformation(new InitiateTransaction() - .withEndToEndIdentification(faker.lorem().characters(10)) - .withCounterpartyAccount(new InitiateCounterpartyAccount() - .withName(faker.lorem().sentence(3, 0).replace(".", "")) - .withIdentification(identification)) - .withInstructedAmount(currency) - .withRemittanceInformation(faker.lorem().sentence(3, 0).replace(".", "")) - .withCounterparty(new InvolvedParty() - .withName(faker.name().fullName()) - .withPostalAddress(new PostalAddress() - .withAddressLine1(faker.address().streetAddress()) - .withAddressLine2(faker.address().secondaryAddress()) - .withStreetName(faker.address().streetAddress()) - .withPostCode(faker.address().zipCode()) - .withTown(faker.address().city()) - .withCountry(faker.address().countryCode()) - .withCountrySubDivision(faker.address().state()))) - .withCounterpartyBank(counterpartyBank) - .withCorrespondentBank(correspondentBank)); + return new InitiatePaymentOrderWithId() + .id(UUID.randomUUID().toString()) + .originatorAccount(new AccountIdentification() + .name(faker.lorem().sentence(3, 0).replace(".", "")) + .identification( + new Identification().schemeName(SchemeNames.ID).identification(originatorArrangementId))) + .instructionPriority(getRandomFromEnumValues(InstructionPriority.values())) + .paymentMode(paymentMode) + .paymentType(paymentType) + .requestedExecutionDate(LocalDate.now()) + .schedule(schedule) + .transferTransactionInformation(new InitiateTransaction() + .endToEndIdentification(faker.lorem().characters(10)) + .counterpartyAccount(new InitiateCounterpartyAccount() + .name(faker.lorem().sentence(3, 0).replace(".", "")) + .identification(identification)) + .instructedAmount(currency) + .remittanceInformation(faker.lorem().sentence(3, 0).replace(".", "")) + .counterparty(new InvolvedParty() + .name(faker.name().fullName()) + .postalAddress(new PostalAddress() + .addressLine1(faker.address().streetAddress()) + .addressLine2(faker.address().secondaryAddress()) + .streetName(faker.address().streetAddress()) + .postCode(faker.address().zipCode()) + .town(faker.address().city()) + .country(faker.address().countryCode()) + .countrySubDivision(faker.address().state()))) + .counterpartyBank(counterpartyBank) + .correspondentBank(correspondentBank)); } private static Identification generateIbanIdentification() { return new Identification() - .withSchemeName(Identification.SchemeName.IBAN) - .withIdentification(ProductSummaryDataGenerator.generateRandomIban()); + .schemeName(SchemeNames.IBAN) + .identification(ProductSummaryDataGenerator.generateRandomIban()); } private static Identification generateBbanIdentification() { return new Identification() - .withSchemeName(Identification.SchemeName.BBAN) - .withIdentification(String.valueOf(CommonHelpers.generateRandomNumberInRange(0, 999999999))); + .schemeName(SchemeNames.BBAN) + .identification(String.valueOf(CommonHelpers.generateRandomNumberInRange(0, 999999999))); } private static Bank generateCorrespondentBank() { return new Bank() - .withBankBranchCode(getRandomFromList(branchCodes)) - .withName(faker.name().fullName()); + .bankBranchCode(getRandomFromList(branchCodes)) + .name(faker.name().fullName()); } private static Bank generateCounterpartyBank() { return new Bank() - .withBankBranchCode(getRandomFromList(branchCodes)) - .withName(faker.name().fullName()) - .withBic(getRandomFromList(bicCodes)) - .withPostalAddress(new PostalAddress() - .withAddressLine1(faker.address().streetAddress()) - .withAddressLine2(faker.address().secondaryAddress()) - .withStreetName(faker.address().streetAddress()) - .withPostCode(faker.address().zipCode()) - .withTown(faker.address().city()) - .withCountry(faker.address().countryCode()) - .withCountrySubDivision(faker.address().state())); + .bankBranchCode(getRandomFromList(branchCodes)) + .name(faker.name().fullName()) + .bic(getRandomFromList(bicCodes)) + .postalAddress(new PostalAddress() + .addressLine1(faker.address().streetAddress()) + .addressLine2(faker.address().secondaryAddress()) + .streetName(faker.address().streetAddress()) + .postCode(faker.address().zipCode()) + .town(faker.address().city()) + .country(faker.address().countryCode()) + .countrySubDivision(faker.address().state())); } } diff --git a/src/main/resources/data.properties b/src/main/resources/data.properties index f8fb7e6c..3aefe1a2 100644 --- a/src/main/resources/data.properties +++ b/src/main/resources/data.properties @@ -62,7 +62,7 @@ payments.min=10 payments.max=30 # Available OOTB payment types: SEPA_CREDIT_TRANSFER/US_DOMESTIC_WIRE/ACH_DEBIT/US_FOREIGN_WIRE # This is a comma (,) separated value -payments.ootb.types=SEPA_CREDIT_TRANSFER,US_DOMESTIC_WIRE,ACH_DEBIT,US_FOREIGN_WIRE +payments.ootb.types=SEPA_CREDIT_TRANSFER,US_FOREIGN_WIRE # Number of messages ingest.messages=false diff --git a/src/main/resources/data/us-productized-dataset/us-productized-data.properties b/src/main/resources/data/us-productized-dataset/us-productized-data.properties index 85b771bd..a82f079e 100644 --- a/src/main/resources/data/us-productized-dataset/us-productized-data.properties +++ b/src/main/resources/data/us-productized-dataset/us-productized-data.properties @@ -72,7 +72,7 @@ payments.min=10 payments.max=30 # Available OOTB payment types: SEPA_CREDIT_TRANSFER/US_DOMESTIC_WIRE/ACH_DEBIT/US_FOREIGN_WIRE # This is a comma (,) separated value -payments.ootb.types=US_DOMESTIC_WIRE,ACH_DEBIT +payments.ootb.types=US_DOMESTIC_WIRE,US_FOREIGN_WIRE # Number of messages ingest.messages=false From 0b022ad6bd32127ddce10694f6f3d130017c60fc Mon Sep 17 00:00:00 2001 From: Eugene Grybinnyk Date: Mon, 22 Apr 2024 19:45:26 +0200 Subject: [PATCH 2/3] PAYM-5230: Use payments v3 spec (stop generating payments code with RAML) --- pom.xml | 85 ++++++------- .../ProductSummaryPresentationRestClient.java | 24 ++-- .../AccountStatementsConfigurator.java | 8 +- .../configurator/ActionsConfigurator.java | 4 +- .../configurator/PaymentsConfigurator.java | 14 +-- .../configurator/PositivePayConfigurator.java | 4 +- .../ct/bbfuel/data/PaymentsDataGenerator.java | 114 +++++++++--------- 7 files changed, 130 insertions(+), 123 deletions(-) diff --git a/pom.xml b/pom.xml index 17150249..1b10ee66 100644 --- a/pom.xml +++ b/pom.xml @@ -51,6 +51,7 @@ 1.0.5 + 2.11.1 2.1.1 1.0.3 2.7.2 @@ -414,6 +415,18 @@ + + download-arrangement-client-api-spec + + download-single + + generate-sources + + https://repo.backbase.com/specs/arrangement-manager + arrangement-client-api-v${arrangement-client-api.version}.yaml + + + download-arrangement-outbound-origination-api-spec @@ -656,19 +669,6 @@ - - generate-payment-order-client-api-client-code - - generate - - - ${api.target}/payment-order-client-api-v${payment-order-client-api.version}.yaml - - com.backbase.dbs.paymentorder.client.api.v3 - com.backbase.dbs.paymentorder.client.api.v3.model - - - @@ -695,6 +695,21 @@ + + generate-arrangement-client-api + + generate + + generate-sources + + ${api.target}/arrangement-client-api-v${arrangement-client-api.version}.yaml + + com.backbase.dbs.arrangement.client.api.v2 + com.backbase.dbs.arrangement.client.api.v2.model + + + + generate-arrangement-outbound-origination-client-code @@ -737,6 +752,22 @@ + + + generate-payment-order-client-api + + generate + + generate-sources + + ${api.target}/payment-order-client-api-v${payment-order-client-api.version}.yaml + + com.backbase.dbs.paymentorder.client.api.v3 + com.backbase.dbs.paymentorder.client.api.v3.model + + + + @@ -794,14 +825,6 @@ - - com.backbase.dbs.paymentorder - payment-order-presentation-spec - - ${project.build.directory}/payment-order-presentation-spec - - - com.backbase.dbs.user user-manager-spec @@ -919,26 +942,6 @@ - - generate-payment-order-presentation-spec - generate-sources - - raml-api-generator - - - payment-order-presentation-spec - dbs.payments - - - ${project.build.directory}/payment-order-presentation-spec/service-api.raml - - - ${project.build.directory}/payment-order-presentation-spec/api.raml - - - false - - diff --git a/src/main/java/com/backbase/ct/bbfuel/client/productsummary/ProductSummaryPresentationRestClient.java b/src/main/java/com/backbase/ct/bbfuel/client/productsummary/ProductSummaryPresentationRestClient.java index 29dc250e..f278a5e1 100644 --- a/src/main/java/com/backbase/ct/bbfuel/client/productsummary/ProductSummaryPresentationRestClient.java +++ b/src/main/java/com/backbase/ct/bbfuel/client/productsummary/ProductSummaryPresentationRestClient.java @@ -14,7 +14,6 @@ import com.backbase.ct.bbfuel.client.common.RestClient; import com.backbase.ct.bbfuel.config.BbFuelConfiguration; import com.backbase.ct.bbfuel.dto.ProductSummaryQueryParameters; -import com.backbase.dbs.productsummary.presentation.rest.spec.v2.productsummary.ArrangementsByBusinessFunctionGetResponseBody; import io.restassured.response.Response; import java.util.Arrays; import java.util.List; @@ -22,6 +21,7 @@ import javax.annotation.PostConstruct; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; +import com.backbase.dbs.arrangement.client.api.v2.model.ProductSummaryItem; @Component @RequiredArgsConstructor @@ -40,7 +40,7 @@ public void init() { setInitialPath(config.getDbsServiceNames().getProducts() + "/" + CLIENT_API); } - public List getProductSummaryArrangements() { + public List getProductSummaryArrangements() { return Arrays.asList(getProductSummaryContextArrangements(new ProductSummaryQueryParameters() .withBusinessFunction(PRODUCT_SUMMARY_FUNCTION_NAME) .withResourceName(PRODUCT_SUMMARY_RESOURCE_NAME) @@ -50,11 +50,11 @@ public List getProductSummaryArra .then() .statusCode(SC_OK) .extract() - .as(ArrangementsByBusinessFunctionGetResponseBody[].class)); + .as(ProductSummaryItem[].class)); } - public List getSepaCtArrangements() { - ArrangementsByBusinessFunctionGetResponseBody[] arrangements = getProductSummaryContextArrangements( + public List getSepaCtArrangements() { + ProductSummaryItem[] arrangements = getProductSummaryContextArrangements( new ProductSummaryQueryParameters() .withBusinessFunction(SEPA_CT_FUNCTION_NAME) .withResourceName(PAYMENTS_RESOURCE_NAME) @@ -66,7 +66,7 @@ public List getSepaCtArrangements .then() .statusCode(SC_OK) .extract() - .as(ArrangementsByBusinessFunctionGetResponseBody[].class); + .as(ProductSummaryItem[].class); // Make sure the Regex is in sync with payment-order-presentation-service/src/main/resources/application.yml (property: sepacountries) return Arrays.stream(arrangements) @@ -78,7 +78,7 @@ public List getSepaCtArrangements .collect(Collectors.toList()); } - public List getUsDomesticWireArrangements() { + public List getUsDomesticWireArrangements() { return Arrays.asList(getProductSummaryContextArrangements(new ProductSummaryQueryParameters() .withBusinessFunction(US_DOMESTIC_WIRE_FUNCTION_NAME) .withResourceName(PAYMENTS_RESOURCE_NAME) @@ -90,10 +90,10 @@ public List getUsDomesticWireArra .then() .statusCode(SC_OK) .extract() - .as(ArrangementsByBusinessFunctionGetResponseBody[].class)); + .as(ProductSummaryItem[].class)); } - public List getAchDebitArrangements() { + public List getAchDebitArrangements() { return Arrays.stream(getProductSummaryContextArrangements(new ProductSummaryQueryParameters() .withBusinessFunction(ACH_DEBIT_FUNCTION_NAME) .withResourceName(PAYMENTS_RESOURCE_NAME) @@ -105,7 +105,7 @@ public List getAchDebitArrangemen .then() .statusCode(SC_OK) .extract() - .as(ArrangementsByBusinessFunctionGetResponseBody[].class)) + .as(ProductSummaryItem[].class)) .filter(arrangement -> isValidCurrencyForAchDebit(arrangement.getCurrency())).collect(Collectors.toList()); } @@ -113,7 +113,7 @@ private static boolean isValidCurrencyForAchDebit(String currency) { return currency.equals("USD") || currency.equals("CAD"); } - public List getUSForeignWireArrangements() { + public List getUSForeignWireArrangements() { return Arrays.asList(getProductSummaryContextArrangements(new ProductSummaryQueryParameters() .withBusinessFunction(US_FOREIGN_WIRE_FUNCTION_NAME) .withResourceName(PAYMENTS_RESOURCE_NAME) @@ -125,7 +125,7 @@ public List getUSForeignWireArran .then() .statusCode(SC_OK) .extract() - .as(ArrangementsByBusinessFunctionGetResponseBody[].class)); + .as(ProductSummaryItem[].class)); } private Response getProductSummaryContextArrangements(ProductSummaryQueryParameters queryParameters) { diff --git a/src/main/java/com/backbase/ct/bbfuel/configurator/AccountStatementsConfigurator.java b/src/main/java/com/backbase/ct/bbfuel/configurator/AccountStatementsConfigurator.java index f7f80a9f..b959b37c 100644 --- a/src/main/java/com/backbase/ct/bbfuel/configurator/AccountStatementsConfigurator.java +++ b/src/main/java/com/backbase/ct/bbfuel/configurator/AccountStatementsConfigurator.java @@ -18,7 +18,7 @@ import com.backbase.ct.bbfuel.client.user.UserProfileRestClient; import com.backbase.ct.bbfuel.dto.accountStatement.EStatementPreferencesRequest; import com.backbase.ct.bbfuel.util.GlobalProperties; -import com.backbase.dbs.productsummary.presentation.rest.spec.v2.productsummary.ArrangementsByBusinessFunctionGetResponseBody; +import com.backbase.dbs.arrangement.client.api.v2.model.ProductSummaryItem; import io.restassured.response.Response; import java.util.List; import java.util.Random; @@ -48,7 +48,7 @@ public void ingestAccountStatements(String externalUserId) { int randomAmount = generateRandomNumberInRange(globalProperties.getInt(PROPERTY_ACCOUNTSTATEMENTS_MIN), globalProperties.getInt(PROPERTY_ACCOUNTSTATEMENTS_MAX)); - Consumer consumer = arrangement -> { + Consumer consumer = arrangement -> { String internalArrangementId = arrangement.getId(); String accountName = arrangement.getName(); String accountIBAN = arrangement.getIBAN(); @@ -69,7 +69,7 @@ public void ingestAccountStatements(String externalUserId) { public void ingestAccountStatementPreferences(String externalUserId) { final Random booleanGenerator = new Random(System.currentTimeMillis()); - Function mapper = + Function mapper = arrangement -> new EStatementPreferencesRequest( arrangement.getId(), externalUserId, booleanGenerator.nextBoolean(), booleanGenerator.nextBoolean()); @@ -117,7 +117,7 @@ public void ingestUserProfile(String externalUserId) { } } - private List fetchUserArrangements(String externalUserId) { + private List fetchUserArrangements(String externalUserId) { loginRestClient.login(externalUserId, externalUserId); userContextPresentationRestClient.selectContextBasedOnMasterServiceAgreement(); diff --git a/src/main/java/com/backbase/ct/bbfuel/configurator/ActionsConfigurator.java b/src/main/java/com/backbase/ct/bbfuel/configurator/ActionsConfigurator.java index 4ae6f3a0..afb34569 100644 --- a/src/main/java/com/backbase/ct/bbfuel/configurator/ActionsConfigurator.java +++ b/src/main/java/com/backbase/ct/bbfuel/configurator/ActionsConfigurator.java @@ -13,7 +13,7 @@ import com.backbase.ct.bbfuel.client.productsummary.ProductSummaryPresentationRestClient; import com.backbase.ct.bbfuel.util.GlobalProperties; import com.backbase.dbs.action.client.v2.model.ActionRecipesPostRequestBodyParent; -import com.backbase.dbs.productsummary.presentation.rest.spec.v2.productsummary.ArrangementsByBusinessFunctionGetResponseBody; +import com.backbase.dbs.arrangement.client.api.v2.model.ProductSummaryItem; import java.util.ArrayList; import java.util.List; import java.util.stream.IntStream; @@ -34,7 +34,7 @@ public class ActionsConfigurator { private final ActionRecipesPresentationRestClient actionRecipesPresentationRestClient; public void ingestActions(String externalUserId) { - List arrangements = new ArrayList<>(); + List arrangements = new ArrayList<>(); int randomAmount = generateRandomNumberInRange(globalProperties.getInt(PROPERTY_ACTIONS_MIN), globalProperties.getInt(PROPERTY_ACTIONS_MAX)); diff --git a/src/main/java/com/backbase/ct/bbfuel/configurator/PaymentsConfigurator.java b/src/main/java/com/backbase/ct/bbfuel/configurator/PaymentsConfigurator.java index 64fa4b91..3d4b476b 100644 --- a/src/main/java/com/backbase/ct/bbfuel/configurator/PaymentsConfigurator.java +++ b/src/main/java/com/backbase/ct/bbfuel/configurator/PaymentsConfigurator.java @@ -9,7 +9,7 @@ import com.backbase.ct.bbfuel.util.CommonHelpers; import com.backbase.ct.bbfuel.util.GlobalProperties; import com.backbase.dbs.paymentorder.client.api.v3.model.InitiatePaymentOrderWithId; -import com.backbase.dbs.productsummary.presentation.rest.spec.v2.productsummary.ArrangementsByBusinessFunctionGetResponseBody; +import com.backbase.dbs.arrangement.client.api.v2.model.ProductSummaryItem; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -41,17 +41,15 @@ public void ingestPaymentOrders(String externalUserId) { List ootbPaymentTypes = globalProperties.getList(PROPERTY_PAYMENTS_OOTB_TYPES); - log.info("ootbPaymentTypes is {}", String.join(",", ootbPaymentTypes)); - loginRestClient.login(externalUserId, externalUserId); userContextPresentationRestClient.selectContextBasedOnMasterServiceAgreement(); - List sepaCtArrangements = productSummaryPresentationRestClient + List sepaCtArrangements = productSummaryPresentationRestClient .getSepaCtArrangements(); - List usDomesticWireArrangements = productSummaryPresentationRestClient + List usDomesticWireArrangements = productSummaryPresentationRestClient .getUsDomesticWireArrangements(); - List achDebitArrangements = productSummaryPresentationRestClient + List achDebitArrangements = productSummaryPresentationRestClient .getAchDebitArrangements(); - List usForeignWireArrangements = productSummaryPresentationRestClient + List usForeignWireArrangements = productSummaryPresentationRestClient .getUSForeignWireArrangements(); int randomAmount = CommonHelpers @@ -63,7 +61,7 @@ public void ingestPaymentOrders(String externalUserId) { IntStream.range(0, randomAmount).parallel().forEach(randomNumber -> { String paymentType = getRandomFromList(ootbPaymentTypes); - ArrangementsByBusinessFunctionGetResponseBody randomArrangement; + ProductSummaryItem randomArrangement; if (PAYMENT_TYPE_SEPA_CREDIT_TRANSFER.equals(paymentType)) { randomArrangement = getRandomFromList(sepaCtArrangements); diff --git a/src/main/java/com/backbase/ct/bbfuel/configurator/PositivePayConfigurator.java b/src/main/java/com/backbase/ct/bbfuel/configurator/PositivePayConfigurator.java index 691ca0d7..65a4872f 100644 --- a/src/main/java/com/backbase/ct/bbfuel/configurator/PositivePayConfigurator.java +++ b/src/main/java/com/backbase/ct/bbfuel/configurator/PositivePayConfigurator.java @@ -17,7 +17,7 @@ import com.backbase.ct.bbfuel.util.GlobalProperties; import com.backbase.dbs.arrangement.integration.inbound.api.v2.model.Subscription; import com.backbase.dbs.positivepay.client.api.v1.model.PositivePayPost; -import com.backbase.dbs.productsummary.presentation.rest.spec.v2.productsummary.ArrangementsByBusinessFunctionGetResponseBody; +import com.backbase.dbs.arrangement.client.api.v2.model.ProductSummaryItem; import java.util.ArrayList; import java.util.List; import java.util.stream.IntStream; @@ -47,7 +47,7 @@ public class PositivePayConfigurator { private final ArrangementsIntegrationRestClient arrangementsIntegrationRestClient; public void ingestPositivePayChecks(String externalUserId) { - List arrangements = new ArrayList<>(); + List arrangements = new ArrayList<>(); int randomAmount = generateRandomNumberInRange(globalProperties.getInt(PROPERTY_POSITIVEPAY_MIN), globalProperties.getInt(PROPERTY_POSITIVEPAY_MAX)); diff --git a/src/main/java/com/backbase/ct/bbfuel/data/PaymentsDataGenerator.java b/src/main/java/com/backbase/ct/bbfuel/data/PaymentsDataGenerator.java index d19587ce..f4d76fdb 100644 --- a/src/main/java/com/backbase/ct/bbfuel/data/PaymentsDataGenerator.java +++ b/src/main/java/com/backbase/ct/bbfuel/data/PaymentsDataGenerator.java @@ -50,17 +50,19 @@ public static InitiatePaymentOrderWithId generateInitiatePaymentOrder(String ori Schedule schedule = null; Bank counterpartyBank = null; Bank correspondentBank = null; - CurrencyTyped currency = new CurrencyTyped().amount(CommonHelpers.generateRandomAmountInRange(1000L, 99999L)); + CurrencyTyped currency = new CurrencyTyped(); + currency.setAmount(CommonHelpers.generateRandomAmountInRange(1000L, 99999L)); Identification identification; if (paymentMode == PaymentMode.RECURRING) { schedule = new Schedule() - .startDate(LocalDate.now()) - .every(getRandomFromEnumValues(EveryEnum.values())) - .nonWorkingDayExecutionStrategy(getRandomFromEnumValues(NonWorkingDayExecutionStrategyEnum.values())) - .transferFrequency(getRandomFromEnumValues(TransferFrequencyEnum.values())) - .on(CommonHelpers.generateRandomNumberInRange(1, 7)) - .endDate(LocalDate.now().plusYears(1L)); + .withStartDate(LocalDate.now()) + .withEvery(getRandomFromEnumValues(EveryEnum.values())) + .withNonWorkingDayExecutionStrategy( + getRandomFromEnumValues(NonWorkingDayExecutionStrategyEnum.values())) + .withTransferFrequency(getRandomFromEnumValues(TransferFrequencyEnum.values())) + .withOn(CommonHelpers.generateRandomNumberInRange(1, 7)) + .withEndDate(LocalDate.now().plusYears(1L)); } if (PAYMENT_TYPE_SEPA_CREDIT_TRANSFER.equals(paymentType)) { @@ -77,68 +79,72 @@ public static InitiatePaymentOrderWithId generateInitiatePaymentOrder(String ori identification = generateBbanIdentification(); } - return new InitiatePaymentOrderWithId() - .id(UUID.randomUUID().toString()) - .originatorAccount(new AccountIdentification() - .name(faker.lorem().sentence(3, 0).replace(".", "")) - .identification( - new Identification().schemeName(SchemeNames.ID).identification(originatorArrangementId))) - .instructionPriority(getRandomFromEnumValues(InstructionPriority.values())) - .paymentMode(paymentMode) - .paymentType(paymentType) - .requestedExecutionDate(LocalDate.now()) - .schedule(schedule) - .transferTransactionInformation(new InitiateTransaction() - .endToEndIdentification(faker.lorem().characters(10)) - .counterpartyAccount(new InitiateCounterpartyAccount() - .name(faker.lorem().sentence(3, 0).replace(".", "")) - .identification(identification)) - .instructedAmount(currency) - .remittanceInformation(faker.lorem().sentence(3, 0).replace(".", "")) - .counterparty(new InvolvedParty() - .name(faker.name().fullName()) - .postalAddress(new PostalAddress() - .addressLine1(faker.address().streetAddress()) - .addressLine2(faker.address().secondaryAddress()) - .streetName(faker.address().streetAddress()) - .postCode(faker.address().zipCode()) - .town(faker.address().city()) - .country(faker.address().countryCode()) - .countrySubDivision(faker.address().state()))) - .counterpartyBank(counterpartyBank) - .correspondentBank(correspondentBank)); + InitiateCounterpartyAccount initiateCounterpartyAccount = new InitiateCounterpartyAccount(); + initiateCounterpartyAccount.setName(faker.lorem().sentence(3, 0).replace(".", "")); + initiateCounterpartyAccount.setIdentification(identification); + + InitiatePaymentOrderWithId initiatePaymentOrder = new InitiatePaymentOrderWithId(); + initiatePaymentOrder + .withId(UUID.randomUUID().toString()) + .withOriginatorAccount(new AccountIdentification() + .withName(faker.lorem().sentence(3, 0).replace(".", "")) + .withIdentification(new Identification().withSchemeName(SchemeNames.ID) + .withIdentification(originatorArrangementId))) + .withInstructionPriority(getRandomFromEnumValues(InstructionPriority.values())) + .withPaymentMode(paymentMode) + .withPaymentType(paymentType) + .withRequestedExecutionDate(LocalDate.now()) + .withSchedule(schedule) + .withTransferTransactionInformation(new InitiateTransaction() + .withEndToEndIdentification(faker.lorem().characters(10)) + .withCounterpartyAccount(initiateCounterpartyAccount) + .withInstructedAmount(currency) + .withRemittanceInformation(faker.lorem().sentence(3, 0).replace(".", "")) + .withCounterparty(new InvolvedParty() + .withName(faker.name().fullName()) + .withPostalAddress(new PostalAddress() + .withAddressLine1(faker.address().streetAddress()) + .withAddressLine2(faker.address().secondaryAddress()) + .withStreetName(faker.address().streetAddress()) + .withPostCode(faker.address().zipCode()) + .withTown(faker.address().city()) + .withCountry(faker.address().countryCode()) + .withCountrySubDivision(faker.address().state()))) + .withCounterpartyBank(counterpartyBank) + .withCorrespondentBank(correspondentBank)); + return initiatePaymentOrder; } private static Identification generateIbanIdentification() { return new Identification() - .schemeName(SchemeNames.IBAN) - .identification(ProductSummaryDataGenerator.generateRandomIban()); + .withSchemeName(SchemeNames.IBAN) + .withIdentification(ProductSummaryDataGenerator.generateRandomIban()); } private static Identification generateBbanIdentification() { return new Identification() - .schemeName(SchemeNames.BBAN) - .identification(String.valueOf(CommonHelpers.generateRandomNumberInRange(0, 999999999))); + .withSchemeName(SchemeNames.BBAN) + .withIdentification(String.valueOf(CommonHelpers.generateRandomNumberInRange(0, 999999999))); } private static Bank generateCorrespondentBank() { return new Bank() - .bankBranchCode(getRandomFromList(branchCodes)) - .name(faker.name().fullName()); + .withBankBranchCode(getRandomFromList(branchCodes)) + .withName(faker.name().fullName()); } private static Bank generateCounterpartyBank() { return new Bank() - .bankBranchCode(getRandomFromList(branchCodes)) - .name(faker.name().fullName()) - .bic(getRandomFromList(bicCodes)) - .postalAddress(new PostalAddress() - .addressLine1(faker.address().streetAddress()) - .addressLine2(faker.address().secondaryAddress()) - .streetName(faker.address().streetAddress()) - .postCode(faker.address().zipCode()) - .town(faker.address().city()) - .country(faker.address().countryCode()) - .countrySubDivision(faker.address().state())); + .withBankBranchCode(getRandomFromList(branchCodes)) + .withName(faker.name().fullName()) + .withBic(getRandomFromList(bicCodes)) + .withPostalAddress(new PostalAddress() + .withAddressLine1(faker.address().streetAddress()) + .withAddressLine2(faker.address().secondaryAddress()) + .withStreetName(faker.address().streetAddress()) + .withPostCode(faker.address().zipCode()) + .withTown(faker.address().city()) + .withCountry(faker.address().countryCode()) + .withCountrySubDivision(faker.address().state())); } } From 6e8003917bab5aa343201daae98cb0342da5905e Mon Sep 17 00:00:00 2001 From: Eugene Grybinnyk Date: Mon, 22 Apr 2024 19:48:58 +0200 Subject: [PATCH 3/3] PAYM-5230: Use payments v3 spec (optimised imports) --- .../productsummary/ProductSummaryPresentationRestClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/backbase/ct/bbfuel/client/productsummary/ProductSummaryPresentationRestClient.java b/src/main/java/com/backbase/ct/bbfuel/client/productsummary/ProductSummaryPresentationRestClient.java index f278a5e1..c0c4f59f 100644 --- a/src/main/java/com/backbase/ct/bbfuel/client/productsummary/ProductSummaryPresentationRestClient.java +++ b/src/main/java/com/backbase/ct/bbfuel/client/productsummary/ProductSummaryPresentationRestClient.java @@ -14,6 +14,7 @@ import com.backbase.ct.bbfuel.client.common.RestClient; import com.backbase.ct.bbfuel.config.BbFuelConfiguration; import com.backbase.ct.bbfuel.dto.ProductSummaryQueryParameters; +import com.backbase.dbs.arrangement.client.api.v2.model.ProductSummaryItem; import io.restassured.response.Response; import java.util.Arrays; import java.util.List; @@ -21,7 +22,6 @@ import javax.annotation.PostConstruct; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; -import com.backbase.dbs.arrangement.client.api.v2.model.ProductSummaryItem; @Component @RequiredArgsConstructor