diff --git a/docs/data-models.md b/docs/data-models.md index 8fc5b0b..c169176 100644 --- a/docs/data-models.md +++ b/docs/data-models.md @@ -10,24 +10,25 @@ The data model is described in the diagram. ## Beneficiaries -| Name | Type | Modifiers | Description | -|:------------------------------|:----------------------:|:----------|:--------------------------------:| -| id [PK] | integer | NOT NULL | Primary key | -| person_id [FK] | integer | NOT NULL | foundational id forign key | -| package_id [FK] | integer | NOT NULL | Package id forign key | -| payment_status | character varying(255) | NOT NULL | [Payment status](status.md) | -| functional_id | character varying(255) | NOT NULL | Functional id of the beneficiary | -| payment_onboarding_status | character varying(255) | NOT NULL | Onboarding request status. | -| payment_onboarding_request_id | character varying(255) | NOT NULL | Onboarding request id. | +| Name | Type | Modifiers | Description | +|:------------------------------|:----------------------:|:----------|:------------------------------------------------------:| +| id [PK] | integer | NOT NULL | Primary key | +| person_id [FK] | integer | NOT NULL | foundational id forign key | +| package_id [FK] | integer | NOT NULL | Package id forign key | +| payment_status | character varying(255) | NOT NULL | [Payment status](status.md) | +| functional_id | character varying(255) | NOT NULL | Public version of the foundation id. [More information](https://govstack-global.atlassian.net/wiki/spaces/GH/pages/239370263/Authentication+and+Cross-BB+Authorization) | +| payment_onboarding_status | character varying(255) | NOT NULL | Onboarding request status. | +| payment_onboarding_request_id | character varying(255) | NOT NULL | Onboarding request id. | ## Candidates -| Name | Type | Modifiers | Description | -|:--------------------|:-------------:|:----------|:--------------------------------------------:| -| id [PK] | integer | NOT NULL | Primary key | -| person_id [FK] | integer | | | -| openimis_package_id | integer array | | Ids of [packages](packages.md) from OpenIMIS | -| emulator_package_id | integer array | | Ids of [packages](packages.md) from emulator | +| Name | Type | Modifiers | Description | +|:--------------------|:-------------:|:-----------------|:--------------------------------------------------:| +| id [PK] | integer | NOT NULL | Primary key | +| person_id [FK] | integer | | | +| openimis_package_id | integer array | | Ids of [packages](packages.md) from OpenIMIS | +| emulator_package_id | integer array | | Ids of [packages](packages.md) from emulator | +| is_beneficiary | boolean | NOT NULL | Status changes when candidate become a beneficiary | ## Payment Disbursement diff --git a/docs/main.md b/docs/main.md index d130c22..df1f0e1 100644 --- a/docs/main.md +++ b/docs/main.md @@ -10,6 +10,8 @@ This is a driver backend application for ## Application logic +### Enrollment officer sequence of steps + ```mermaid sequenceDiagram Civil servant ->> USCT-backend: Sign in @@ -23,12 +25,21 @@ sequenceDiagram USCT-backend ->>Consent BB: Civil servant may apply for consent end Civil servant ->> USCT-backend: When consent record is in place, create new beneficiary and remove beneficiary from candidates list - USCT-backend ->> Payment BB: Automatically register beneficiary in payment system if not registered - USCT-backend ->> Payment BB: Automatically update beneficiary in payment system if registered - Civil servant ->> USCT-backend: Order payment - USCT-backend ->> Payment BB: Automatically validate prepayment - USCT-backend ->> Payment BB: Automatically make bulk payment - USCT-backend -->> Civil servant: Return result + USCT-backend -->> Civil servant: Beneficiary was created + + +``` + +### Payment officer sequence of steps + +```mermaid +sequenceDiagram + Civil servant ->> USCT-backend: Chose a beneficiary from the list + Civil servant ->> USCT-backend: Order payment + participant im as Information mediator + + USCT-backend ->> Payment BB: Automatically make bulk payment + USCT-backend -->> Civil servant: Payment was done ``` ## Authentication / Authorization @@ -63,7 +74,6 @@ Mosip uses Foundational ID (VID) | VID / username | Role | Description | |---------------------------------|--------------------|-----------------------------------------------------| -| 7495681570 / registry-officer | REGISTRY_OFFICER | Officer responsible for creating/editing candidates | | 9038952310 / enrollment-officer | ENROLLMENT_OFFICER | Officer responsible for enrollment | | 2405176278 / payment-officer | PAYMENT_OFFICER | Officer responsible for payment | @@ -98,9 +108,9 @@ Supported payment Building blocks are: * [Implementation](https://github.com/GovStackWorkingGroup/sandbox-bb-payments/tree/main/emulator/implementation) * [Documentation](https://github.com/GovStackWorkingGroup/sandbox-bb-payments/tree/main/emulator/docs) * Mifos Payment Hub - * [API spec](https://govstack.gitbook.io/bb-payments/) version 2.0 (In Development!) - * Implementation (in progress) - * Documentation (in progress) + * [API spec](https://govstack.gitbook.io/bb-payments/) + * [Implementation](https://github.com/openMF) + * [Documentation](https://docs.mifos.org/) Environment variable is used to define which service to use: @@ -135,6 +145,133 @@ Environment variables for global configuration: | JWS_TENANT_PRIVATE_KEY | More information in PaymentHub Documentation ( TBD ) | Default private key from [HERE](https://github.com/openMF/ph-ee-connector-common/blob/master/src/main/resources/application-jws.yaml) | | PAYMENTHUB_PAYMENT_MODE | More information in PaymentHub Documentation ( TBD ) | mojaloop | | PAYMENTHUB_IM_HEADER | Header value for Information Mediator Building Block request header "X-Road-Client". More [Information](https://govstack.gitbook.io/bb-information-mediation/v/information-mediation-1.0/). | SANDBOX/ORG/CLIENT/TEST | +### Swagger + +https://app.swaggerhub.com/apis/myapi943/payment-hub_ap_is/1.0 + + +### Installation + +`helm install my-ph-ee-g2psandbox g2p-sandbox-1-5/ph-ee-g2psandbox --version 1.5.0 --create-namespace --namespace paymenthub` + +#### Post Deployment Steps +The Post_installation_Job is automated through a Kubernetes job in the helm chart. it will create secrets for ElasticSearch and Kibana. and Upload the BPMN. However, The following steps can be used to create Secrets and upload BPMN Manually. + +##### Create the required secrets for Elasticsearch and Kibana + +Use https://github.com/openMF/ph-ee-env-labs/tree/master/helm/es-secret and https://github.com/openMF/ph-ee-env-labs/tree/master/helm/kibana-secret you can create a secret for Elasticsearch and Kibana. The command used to create a secret is + +1. auth +2. make secrets NAMESPACE=paymenthub + +##### Upload BPMN +https://mifos.gitbook.io/docs/payment-hub-ee/overview/installation-instructions/configuration-instructions/deploy-bpmns-with-multiple-dfsp-ids + + +1. The Payment Hub EE business logic is always driven by the BPMN workflows included in the git repositories. It's not only possible but often necessary to customize these flows to meet the business requirements of a specific environment. + +2. Deploying the workflows to the K8S cluster is a separate step, which can be done either manually for each business flow, or using a shell script like this (actual example from the project's CI server): + +3. In the below example tenants are picked up from the array declared and for N number of tenants the script will run for N number of times and Internal field separator will convert array into string and store in $t. + +4. Zeebe command line tools (the zbctl binary) are also required for deploying the BPMN workflows if Zeebe Operations service is not deployed. This is part of the Zeebe releases and can be downloaded from the Zeebe release page at https://github.com/zeebe-io/zeebe/releases. + +5. BPMN deployment should be done with corresponding release version which can be obtained from release notes + +6. In the below script HOST should be replaced with the zeebe ops(port-forwarded) url from your cluster. + +```bash +#!/bin/bash +HOST="http://localhost:5000/zeebe/upload" + +deploy(){ +cmd="curl --insecure --location --request POST $HOST \ +--header 'Platform-TenantId: $2' \ +--form 'file=@\"$PWD/$1\"'" +echo "$cmd" +eval "$cmd" +} + +TENANTS="gorilla,lion,rhino" +IFS=',' read -ra TENANT_ARRAY <<< "$TENANTS" + +for t in "${TENANT_ARRAY[@]}"; do +LOC="feel/*.bpmn" +for f in $LOC; do +# Check if "DFSPID" is present in the filename +if echo "$f" | grep -q "DFSPID"; then +# Replace "DFSPID" with the current tenant value in the filename +new_file_name=$(echo "$f" | sed "s/DFSPID/$t/") +else +# If "DFSPID" is not present, use the original name +new_file_name="$f" +fi +deploy "$new_file_name" "$t" +done + + LOC2="feel/example/*.bpmn" + for f in $LOC2; do + # Check if "DFSPID" is present in the filename + if echo "$f" | grep -q "DFSPID"; then + # Replace "DFSPID" with the current tenant value in the filename + new_file_name=$(echo "$f" | sed "s/DFSPID/$t/") + else + # If "DFSPID" is not present, use the original name + new_file_name="$f" + fi + deploy "$new_file_name" "$t" + done +done +``` + + +#### Change port for bulk connector from 8443 to 8080 and turn off TLS + +**Use it only for demo purpose** + + +Update config of **ph-ee-connector-bulk** pod + +```yaml +- name: SECURITY_JWS_ENABLE + value: "false" +- name: SERVER_PORT + value: "8080" +- name: SERVER_SSL_ENABLED + value: "false" + +``` + +#### Transaction request example: + +```bash +curl --location 'https://localhost:8443/batchtransactions?type=raw' \ +--header 'X-CallbackURL: https://webhook.site/{webhook}' \ +--header 'X-Registering-Institution-ID: 123' \ +--header 'Purpose: test payment' \ +--header 'X-CorrelationID: 123' \ +--header 'Platform-TenantId: gorilla' \ +--header 'X-Program-ID: 00' \ +--header 'Type: raw' \ +--header 'Content-Type: application/json' \ +--data ' { + "requestId":"8238482323", + "creditParty": [ + { + "key": "msisdn", + "value": "8837461856" + } + ], + "paymentMode ": "closedLoop", + "amount": "20.00", + "currency": "SGD", + "descriptionText": "Test Payment" + }' +``` + +#### Get transactions + +http://ph-ee-operations-app:5000/api/v1/batches?page=0&size=10&sortOrder=asc&orderBy=requestFile&Platform-TenantId=gorilla ## IP FILTER In order to protect by IP callback endpoints, whitelist of IP can be provided by ENV VAR diff --git a/helm/values.yaml b/helm/values.yaml index 73233eb..c091fd7 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -30,7 +30,7 @@ paymenthub: bulk_connector_url: "http://sandbox-xroad-ss2.im-xroad.svc.cluster.local:8080/r1/SANDBOX/GOV/PROVIDER/PAYMENT/bulk-connector" callback_base_url: "http://backend.usct.svc.cluster.local:8080" registering_institution_id: 123456 - tenant: rhino + tenant: gorilla program_id: "00" jws_tenant_private_key: "" payment_mode: "mojaloop" diff --git a/src/main/java/global/govstack/usct/configuration/RestTemplateBean.java b/src/main/java/global/govstack/usct/configuration/RestTemplateBean.java new file mode 100644 index 0000000..6d723f5 --- /dev/null +++ b/src/main/java/global/govstack/usct/configuration/RestTemplateBean.java @@ -0,0 +1,13 @@ +package global.govstack.usct.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestTemplate; + +@Configuration +public class RestTemplateBean { + @Bean + public RestTemplate createBean() { + return new RestTemplate(); + } +} diff --git a/src/main/java/global/govstack/usct/model/Candidate.java b/src/main/java/global/govstack/usct/model/Candidate.java index 8ac4e0b..eef5547 100644 --- a/src/main/java/global/govstack/usct/model/Candidate.java +++ b/src/main/java/global/govstack/usct/model/Candidate.java @@ -37,6 +37,9 @@ public class Candidate { @Column(name = "igrant_id") private String igrantId; + @Column(name = "is_beneficiary", nullable = false) + private boolean isBeneficiary; + public Set getOpenImisPackageIds() { return openImisPackageIds; } @@ -84,4 +87,12 @@ public String getIgrantId() { public void setIgrantId(String igrantId) { this.igrantId = igrantId; } + + public boolean getIsBeneficiary() { + return this.isBeneficiary; + } + + public void setIsBeneficiary(boolean isBeneficiary) { + this.isBeneficiary = isBeneficiary; + } } diff --git a/src/main/java/global/govstack/usct/repositories/CandidateRepository.java b/src/main/java/global/govstack/usct/repositories/CandidateRepository.java index 91a92ff..cf2ea6d 100644 --- a/src/main/java/global/govstack/usct/repositories/CandidateRepository.java +++ b/src/main/java/global/govstack/usct/repositories/CandidateRepository.java @@ -1,8 +1,11 @@ package global.govstack.usct.repositories; import global.govstack.usct.model.Candidate; +import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository -public interface CandidateRepository extends JpaRepository {} +public interface CandidateRepository extends JpaRepository { + List findByIsBeneficiary(boolean isBeneficiary); +} diff --git a/src/main/java/global/govstack/usct/service/BeneficiaryService.java b/src/main/java/global/govstack/usct/service/BeneficiaryService.java index 29c313a..712ed53 100644 --- a/src/main/java/global/govstack/usct/service/BeneficiaryService.java +++ b/src/main/java/global/govstack/usct/service/BeneficiaryService.java @@ -14,25 +14,19 @@ @Service public class BeneficiaryService { private final BeneficiaryRepository repository; - private final PaymentService paymentService; private final CandidateService candidateService; private final PaymentProperties properties; private final PackageService packageService; - private final ConsentService consentService; public BeneficiaryService( BeneficiaryRepository repository, - PaymentService paymentService, CandidateService candidateService, PaymentProperties properties, - PackageService packageService, - ConsentService consentService) { + PackageService packageService) { this.repository = repository; - this.paymentService = paymentService; this.candidateService = candidateService; this.properties = properties; this.packageService = packageService; - this.consentService = consentService; } public List findAll() { @@ -69,8 +63,8 @@ public Beneficiary create(Candidate candidate, int enrolledPackageId) { beneficiary.setPaymentStatus(PaymentStatus.INITIATE); beneficiary.setFunctionalId(functionalId); Beneficiary savedBeneficiary = repository.save(beneficiary); - candidateService.delete(candidate); - paymentService.registerBeneficiary(List.of(savedBeneficiary)); + candidate.setIsBeneficiary(true); + candidateService.save(candidate); return savedBeneficiary; } diff --git a/src/main/java/global/govstack/usct/service/CandidateService.java b/src/main/java/global/govstack/usct/service/CandidateService.java index 73bd26e..879629c 100644 --- a/src/main/java/global/govstack/usct/service/CandidateService.java +++ b/src/main/java/global/govstack/usct/service/CandidateService.java @@ -1,6 +1,5 @@ package global.govstack.usct.service; -import global.govstack.usct.configuration.IGrantProperties; import global.govstack.usct.configuration.OpenImisProperties; import global.govstack.usct.controller.dto.CandidateDto; import global.govstack.usct.controller.dto.CreateCandidateDto; @@ -24,26 +23,23 @@ public class CandidateService { private final PackageService packageService; private final ConsentService consentService; private final OpenImisProperties openImisProperties; - private final IGrantProperties iGrantProperties; public CandidateService( CandidateRepository candidateRepository, PersonService personService, PackageService packageService, ConsentService consentService, - OpenImisProperties openImisProperties, - IGrantProperties iGrantProperties) { + OpenImisProperties openImisProperties) { this.candidateRepository = candidateRepository; this.personService = personService; this.packageService = packageService; this.consentService = consentService; this.openImisProperties = openImisProperties; - this.iGrantProperties = iGrantProperties; } public List findAll() { log.info("Get list of candidates"); - List candidates = candidateRepository.findAll(); + List candidates = candidateRepository.findByIsBeneficiary(false); return candidates.stream() .map( candidate -> { @@ -86,11 +82,6 @@ public void deleteById(Integer id) { candidateRepository.deleteById(id); } - public void delete(Candidate candidate) { - log.info("Delete candidate by id: {}", candidate.getId()); - candidateRepository.delete(candidate); - } - @Transactional public Candidate save(CreateCandidateDto createCandidateDto) { log.info("Create candidate, firstName: {}", createCandidateDto.person().firstName()); diff --git a/src/main/java/global/govstack/usct/service/PaymentHubService.java b/src/main/java/global/govstack/usct/service/PaymentHubService.java index 65a2502..bce6fb4 100644 --- a/src/main/java/global/govstack/usct/service/PaymentHubService.java +++ b/src/main/java/global/govstack/usct/service/PaymentHubService.java @@ -13,8 +13,6 @@ import global.govstack.usct.service.dto.paymenthub.*; import global.govstack.usct.types.PaymentOnboardingCallbackMode; import global.govstack.usct.types.PaymentOnboardingStatus; -import global.govstack.usct.util.RSAUtil; -import global.govstack.usct.util.SHAUtils; import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -48,14 +46,15 @@ public PaymentHubService( HttpComponentsClientHttpRequestFactory requestFactory, BeneficiaryRepository beneficiaryRepository, PaymentDisbursementRepository paymentDisbursementRepository, - PackageService packageService) { + PackageService packageService, + RestTemplate restTemplate) { this.paymentHubProperties = paymentHubProperties; this.paymentHubBBInformationMediatorProperties = paymentHubBBInformationMediatorProperties; this.requestFactory = requestFactory; this.beneficiaryRepository = beneficiaryRepository; this.paymentDisbursementRepository = paymentDisbursementRepository; this.packageService = packageService; - this.restTemplate = new RestTemplate(); + this.restTemplate = restTemplate; this.restTemplateSelfSigned = new RestTemplate(requestFactory); } @@ -198,15 +197,9 @@ public void updatePaymentOnboardingStatus( } @Override - @Transactional public void orderPayment(List beneficiaries) { - var beneficiaryList = - beneficiaryRepository.findAllById(beneficiaries.stream().map(b -> b.getId()).toList()); - - validateOnboardingStatus(beneficiaryList); - var requestID = UUID.randomUUID().toString(); - var body = constructOrderPaymentRequestBody(beneficiaryList); + var body = constructOrderPaymentRequestBody(beneficiaries); HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.add( @@ -218,19 +211,14 @@ public void orderPayment(List beneficiaries) { httpHeaders.add("X-CorrelationID", requestID); httpHeaders.add("Platform-TenantId", paymentHubProperties.tenant()); httpHeaders.add("X-Program-ID", paymentHubProperties.programId()); - httpHeaders.add("X-Signature", signOrderPaymentRequest(requestID, body)); httpHeaders.add("type", "raw"); httpHeaders.add("X-Road-Client", paymentHubBBInformationMediatorProperties.header()); - + log.info("batch transaction request: {}", body); var response = - restTemplateSelfSigned - .exchange( - paymentHubProperties.bulkConnectorURL() + "/batchtransactions?type=raw", - HttpMethod.POST, - new HttpEntity<>(body, httpHeaders), - String.class) - .getBody(); - + restTemplate.postForObject( + paymentHubProperties.bulkConnectorURL() + "/batchtransactions?type=raw", + new HttpEntity<>(body, httpHeaders), + String.class); var request = "{\"headers\":%s, \"body\":%s}"; try { var headers = objectMapper.writeValueAsString(httpHeaders.entrySet()); @@ -281,16 +269,4 @@ private String constructOrderPaymentRequestBody(List beneficiaryLis throw new RuntimeException(e); } } - - private String signOrderPaymentRequest(String requestID, String body) { - var sha3 = - SHAUtils.generateSHA( - String.format("%s:%s:%s", requestID, paymentHubProperties.tenant(), body), "SHA3-256"); - try { - return RSAUtil.encrypt( - sha3, RSAUtil.getPrivateKey(paymentHubProperties.jwsTenantPrivateKey())); - } catch (Exception e) { - throw new RuntimeException(e); - } - } } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 8382127..67d568d 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -21,7 +21,7 @@ paymenthub.bb.account-mapper-url = ${PAYMENTHUB_ACCOUNT_MAPPER_URL:http://ph-ee- paymenthub.bb.bulk-connector-url = ${PAYMENTHUB_BULK_CONNECTOR_URL:https://ph-ee-connector-bulk.paymenthub.svc.cluster.local:8443} paymenthub.bb.callback-base-url = ${PAYMENT_CALLBACK_BASE_URL:http://backend.usct.svc.cluster.local:8080} paymenthub.bb.registering-institution-id = ${PAYMENT_REGISTERING_INSTITUTION_ID:123456} -paymenthub.bb.tenant = ${PAYMENTHUB_TENANT:rhino} +paymenthub.bb.tenant = ${PAYMENTHUB_TENANT:gorilla} paymenthub.bb.program-id = ${PAYMENTHUB_PROGRAM_ID:00} paymenthub.bb.jws_tenant_private_key = ${JWS_TENANT_PRIVATE_KEY} paymenthub.bb.payment_mode = ${PAYMENTHUB_PAYMENT_MODE:mojaloop} diff --git a/src/main/resources/db/migration/V1_0__init_tables.sql b/src/main/resources/db/migration/V1_0__init_tables.sql index 99b96bb..a7833eb 100644 --- a/src/main/resources/db/migration/V1_0__init_tables.sql +++ b/src/main/resources/db/migration/V1_0__init_tables.sql @@ -29,6 +29,7 @@ create table CANDIDATE EMULATOR_PACKAGE_ID INTEGER ARRAY, CONSENT_ID INT, IGRANT_ID CHARACTER VARYING(255), + IS_BENEFICIARY NUMBER(1,0) DEFAULT 0 NOT NULL, constraint CANDIDATE_PK primary key (ID), constraint "CANDIDATE_PERSON_ID_fk" diff --git a/src/test/java/global/govstack/usct/service/PaymentHubServiceTest.java b/src/test/java/global/govstack/usct/service/PaymentHubServiceTest.java new file mode 100644 index 0000000..77b051e --- /dev/null +++ b/src/test/java/global/govstack/usct/service/PaymentHubServiceTest.java @@ -0,0 +1,94 @@ +package global.govstack.usct.service; + +import static global.govstack.usct.types.PaymentStatus.ACCEPTED; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; + +import global.govstack.usct.configuration.PaymentBBInformationMediatorProperties; +import global.govstack.usct.configuration.PaymentHubBBInformationMediatorProperties; +import global.govstack.usct.configuration.PaymentHubProperties; +import global.govstack.usct.controller.dto.CreatePersonDto; +import global.govstack.usct.model.Beneficiary; +import global.govstack.usct.model.Person; +import global.govstack.usct.repositories.BeneficiaryRepository; +import global.govstack.usct.repositories.PaymentDisbursementRepository; +import java.util.List; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.web.client.RestTemplate; + +class PaymentHubServiceTest { + + @Mock private PaymentBBInformationMediatorProperties paymentBBInformationMediatorproperties; + + @Mock private PaymentHubBBInformationMediatorProperties paymentHubBBInformationMediatorProperties; + + @Mock private PaymentHubProperties paymentHubProperties; + + @Mock private BeneficiaryRepository beneficiaryRepository; + + @Mock private PaymentDisbursementRepository paymentDisbursementRepository; + + @Mock private PackageService packageService; + + @Mock private RestTemplate restTemplate; + + @Mock private HttpComponentsClientHttpRequestFactory requestFactory; + + private PaymentHubService paymentHubService; + + @BeforeEach + public void setUp() { + MockitoAnnotations.openMocks(this); + paymentHubService = + new PaymentHubService( + paymentHubProperties, + paymentHubBBInformationMediatorProperties, + requestFactory, + beneficiaryRepository, + paymentDisbursementRepository, + packageService, + restTemplate); + } + + @Test + void checkOrderPayment() { + when(paymentHubProperties.bulkConnectorURL()) + .thenReturn("http://ph-ee-connector-bulk.paymenthub"); + when(restTemplate.postForObject(any(), any(), any())).thenReturn(null); + var personDto = + new CreatePersonDto( + "personalIdCode", + "John", + "Doe", + "john.doe@email.com", + "dateOfBirth", + "test-region", + "test-street", + "1234567", + "smith", + "test-munic", + "12345", + "johndoe", + "test-address", + "BANK_ACCOUNT", + "1234567891234567", + "test-bank"); + var person = new Person(personDto); + var functionalId = "7485782570"; + var testOnboardedId = "testOnboardedId"; + Beneficiary beneficiary = new Beneficiary(); + beneficiary.setPerson(person); + beneficiary.setEnrolledPackageId(1); + beneficiary.setFunctionalId(functionalId); + beneficiary.setPaymentStatus(ACCEPTED); + beneficiary.setPaymentOnboardingRequestId(testOnboardedId); + + List beneficiaries = List.of(new Beneficiary()); + paymentHubService.orderPayment(beneficiaries); + assertFalse(beneficiaries.isEmpty()); + } +}