Search in sources :

Example 1 with MiraklAdditionalFieldValue

use of com.mirakl.client.mmp.domain.common.MiraklAdditionalFieldValue in project mirakl-hyperwallet-connector by paypal.

the class MiraklShopToKYCDocumentBusinessStakeholderInfoModelConverterTest method createMiraklShop.

private MiraklShop createMiraklShop() {
    final List<MiraklAdditionalFieldValue> additionalValues = List.of(new MiraklAdditionalFieldValue.MiraklBooleanAdditionalFieldValue(HYPERWALLET_KYC_REQUIRED_PROOF_IDENTITY_STAKEHOLDER_FIELD, Boolean.TRUE.toString()), new MiraklAdditionalFieldValue.MiraklStringAdditionalFieldValue(HYPERWALLET_USER_TOKEN_FIELD, USER_TOKEN), new MiraklAdditionalFieldValue.MiraklStringAdditionalFieldValue(HYPERWALLET_BUSINESS_STAKEHOLDER_PROOF_OF_IDENTITY_COUNTRY_ISOCODE_FIELD, COUNTRY_ISO_CODE), new MiraklAdditionalFieldValue.MiraklStringAdditionalFieldValue(HYPERWALLET_BUSINESS_STAKEHOLDER_TOKEN_FIELD, BUSINESS_STAKEHOLDER_TOKEN), new MiraklAdditionalFieldValue.MiraklValueListAdditionalFieldValue(HYPERWALLET_BUSINESS_STAKEHOLDER_PROOF_IDENTITY_TYPE_FIELD, GOVERNMENT_ID_DOC), new MiraklAdditionalFieldValue.MiraklBooleanAdditionalFieldValue(HW_STAKEHOLDER_BUSINESS_CONTACT_1, Boolean.TRUE.toString()), new MiraklAdditionalFieldValue.MiraklBooleanAdditionalFieldValue(HW_KYC_REQ_PROOF_AUTHORIZATION, Boolean.TRUE.toString()));
    MiraklShop miraklShop = new MiraklShop();
    miraklShop.setId(SHOP_ID);
    miraklShop.setAdditionalFieldValues(additionalValues);
    return miraklShop;
}
Also used : MiraklAdditionalFieldValue(com.mirakl.client.mmp.domain.common.MiraklAdditionalFieldValue) MiraklShop(com.mirakl.client.mmp.domain.shop.MiraklShop)

Example 2 with MiraklAdditionalFieldValue

use of com.mirakl.client.mmp.domain.common.MiraklAdditionalFieldValue in project mirakl-hyperwallet-connector by paypal.

the class MiraklShopToAccountingModelConverterTest method convert_shouldReturnInvoiceModelBasedOnValuesOfMiraklShop.

@Test
void convert_shouldReturnInvoiceModelBasedOnValuesOfMiraklShop() {
    when(miraklShopMock.getId()).thenReturn(SHOP_ID);
    final List<MiraklAdditionalFieldValue> miraklAdditionalFieldValues = List.of(miraklAdditionalFieldValueOneMock);
    when(miraklShopMock.getAdditionalFieldValues()).thenReturn(miraklAdditionalFieldValues);
    doReturn(invoiceModelBuilderMock).when(testObj).getBuilder();
    when(invoiceModelBuilderMock.shopId(SHOP_ID)).thenReturn(invoiceModelBuilderMock);
    when(invoiceModelBuilderMock.destinationToken(miraklAdditionalFieldValues)).thenReturn(invoiceModelBuilderMock);
    when(invoiceModelBuilderMock.hyperwalletProgram(miraklAdditionalFieldValues)).thenReturn(invoiceModelBuilderMock);
    when(invoiceModelBuilderMock.build()).thenReturn(invoiceModelMock);
    final AccountingDocumentModel result = testObj.convert(miraklShopMock);
    verify(invoiceModelBuilderMock).destinationToken(miraklAdditionalFieldValues);
    verify(invoiceModelBuilderMock).shopId(SHOP_ID);
    assertThat(result).isEqualTo(invoiceModelMock);
}
Also used : MiraklAdditionalFieldValue(com.mirakl.client.mmp.domain.common.MiraklAdditionalFieldValue) AccountingDocumentModel(com.paypal.invoices.invoicesextract.model.AccountingDocumentModel) Test(org.junit.jupiter.api.Test)

Example 3 with MiraklAdditionalFieldValue

use of com.mirakl.client.mmp.domain.common.MiraklAdditionalFieldValue in project mirakl-hyperwallet-connector by paypal.

the class MiraklShopToKYCDocumentSellerInfoModelConverterTest method convert_shouldConvertFromShopToKyCDocumentInfoModel.

@Test
void convert_shouldConvertFromShopToKyCDocumentInfoModel() {
    final List<MiraklAdditionalFieldValue> additionalValues = List.of(new MiraklAdditionalFieldValue.MiraklBooleanAdditionalFieldValue(HYPERWALLET_KYC_REQUIRED_PROOF_IDENTITY_BUSINESS_FIELD, Boolean.TRUE.toString()), new MiraklAdditionalFieldValue.MiraklStringAdditionalFieldValue(HYPERWALLET_USER_TOKEN_FIELD, USER_TOKEN), new MiraklAdditionalFieldValue.MiraklValueListAdditionalFieldValue(HYPERWALLET_KYC_IND_PROOF_OF_IDENTITY_FIELD, "GOVERNMENT_ID"), new MiraklAdditionalFieldValue.MiraklValueListAdditionalFieldValue(HYPERWALLET_KYC_IND_PROOF_OF_ADDRESS_FIELD, "BANK_STATEMENT"), new MiraklAdditionalFieldValue.MiraklValueListAdditionalFieldValue(HW_PROGRAM, "EUROPE"));
    final MiraklShop miraklShopStub = new MiraklShop();
    miraklShopStub.setProfessional(true);
    miraklShopStub.setId(SHOP_ID);
    miraklShopStub.setAdditionalFieldValues(additionalValues);
    final KYCDocumentSellerInfoModel result = testObj.convert(miraklShopStub);
    assertThat(result.getUserToken()).isEqualTo(USER_TOKEN);
    assertThat(result.getClientUserId()).isEqualTo(SHOP_ID);
    assertThat(result.getProofOfAddress()).isEqualTo(KYCProofOfAddressEnum.BANK_STATEMENT);
    assertThat(result.getProofOfIdentity()).isEqualTo(KYCProofOfIdentityEnum.GOVERNMENT_ID);
    assertThat(result.isRequiresKYC()).isTrue();
    assertThat(result.isProfessional()).isTrue();
    assertThat(result.getHyperwalletProgram()).isEqualTo(EUROPE_HYPERWALLET_PROGRAM);
}
Also used : MiraklAdditionalFieldValue(com.mirakl.client.mmp.domain.common.MiraklAdditionalFieldValue) KYCDocumentSellerInfoModel(com.paypal.kyc.model.KYCDocumentSellerInfoModel) MiraklShop(com.mirakl.client.mmp.domain.shop.MiraklShop) Test(org.junit.jupiter.api.Test)

Example 4 with MiraklAdditionalFieldValue

use of com.mirakl.client.mmp.domain.common.MiraklAdditionalFieldValue in project mirakl-hyperwallet-connector by paypal.

the class AbstractMiraklShopToSellerModelConverter method getCommonFieldsBuilder.

protected SellerModel.SellerModelBuilder getCommonFieldsBuilder(final MiraklShop source) {
    final MiraklContactInformation contactInformation = source.getContactInformation();
    final List<MiraklAdditionalFieldValue> additionalFieldValues = source.getAdditionalFieldValues();
    final BankAccountModel bankAccountModel = miraklShopBankAccountModelStrategyExecutor.execute(source);
    // @formatter:off
    return SellerModel.builder().clientUserId(source.getId()).businessName(source.getName()).firstName(contactInformation.getFirstname()).lastName(contactInformation.getLastname()).phoneNumber(contactInformation.getPhone()).mobilePhone(contactInformation.getPhoneSecondary()).email(contactInformation.getEmail()).addressLine1(contactInformation.getStreet1()).addressLine2(contactInformation.getStreet2()).city(contactInformation.getCity()).postalCode(contactInformation.getZipCode()).stateProvince(contactInformation.getState()).country(contactInformation.getCountry()).timeZone(sellersMiraklApiConfig.getTimeZone()).dateOfBirth(additionalFieldValues).passportId(additionalFieldValues).countryOfBirth(additionalFieldValues).countryOfNationality(additionalFieldValues).governmentId(additionalFieldValues).governmentIdType(additionalFieldValues).driversLicenseId(additionalFieldValues).businessType(additionalFieldValues).token(additionalFieldValues).bankAccountDetails(bankAccountModel).hwTermsConsent(additionalFieldValues).hyperwalletProgram(additionalFieldValues);
// @formatter:on
}
Also used : MiraklAdditionalFieldValue(com.mirakl.client.mmp.domain.common.MiraklAdditionalFieldValue) MiraklContactInformation(com.mirakl.client.mmp.domain.shop.MiraklContactInformation) BankAccountModel(com.paypal.sellers.bankaccountextract.model.BankAccountModel)

Example 5 with MiraklAdditionalFieldValue

use of com.mirakl.client.mmp.domain.common.MiraklAdditionalFieldValue in project mirakl-hyperwallet-connector by paypal.

the class ListAdditionalFieldValuesToBusinessStakeHolderModelConverterTest method convert_shouldReturnBusinessStakeHolderModelBasedOnValuesOfMiraklShop.

@Test
void convert_shouldReturnBusinessStakeHolderModelBasedOnValuesOfMiraklShop() {
    final List<MiraklAdditionalFieldValue> miraklAdditionalFieldValues = List.of(miraklAdditionalFieldValueOneMock);
    doReturn(businessStakeHolderModelBuilderMock).when(testObj).getBuilder();
    when(sellersMiraklApiConfigMock.getTimeZone()).thenReturn(UTC);
    when(businessStakeHolderModelBuilderMock.timeZone(UTC)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.userToken(miraklAdditionalFieldValues)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.clientUserId(CLIENT_ID)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.token(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.businessContact(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.director(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.ubo(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.smo(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.firstName(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.middleName(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.lastName(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.dateOfBirth(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.countryOfBirth(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.countryOfNationality(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.gender(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.phoneNumber(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.mobileNumber(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.email(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.governmentId(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.governmentIdType(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.driversLicenseId(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.addressLine1(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.addressLine2(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.city(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.stateProvince(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.country(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.postalCode(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.build()).thenReturn(businessStakeHolderModelMock);
    when(businessStakeHolderModelBuilderMock.stkId(1)).thenReturn(businessStakeHolderModelBuilderMock);
    when(businessStakeHolderModelBuilderMock.hyperwalletProgram(miraklAdditionalFieldValues)).thenReturn(businessStakeHolderModelBuilderMock);
    final BusinessStakeHolderModel result = testObj.convert(Triple.of(miraklAdditionalFieldValues, BUSINESS_STAKE_HOLDER_NUMBER, CLIENT_ID));
    verifyAttributes(miraklAdditionalFieldValues);
    assertThat(result).isEqualTo(businessStakeHolderModelMock);
}
Also used : MiraklAdditionalFieldValue(com.mirakl.client.mmp.domain.common.MiraklAdditionalFieldValue) BusinessStakeHolderModel(com.paypal.sellers.sellersextract.model.BusinessStakeHolderModel) Test(org.junit.jupiter.api.Test)

Aggregations

MiraklAdditionalFieldValue (com.mirakl.client.mmp.domain.common.MiraklAdditionalFieldValue)5 Test (org.junit.jupiter.api.Test)3 MiraklShop (com.mirakl.client.mmp.domain.shop.MiraklShop)2 MiraklContactInformation (com.mirakl.client.mmp.domain.shop.MiraklContactInformation)1 AccountingDocumentModel (com.paypal.invoices.invoicesextract.model.AccountingDocumentModel)1 KYCDocumentSellerInfoModel (com.paypal.kyc.model.KYCDocumentSellerInfoModel)1 BankAccountModel (com.paypal.sellers.bankaccountextract.model.BankAccountModel)1 BusinessStakeHolderModel (com.paypal.sellers.sellersextract.model.BusinessStakeHolderModel)1