Search in sources :

Example 16 with MiraklRequestAdditionalFieldValue

use of com.mirakl.client.mmp.request.additionalfield.MiraklRequestAdditionalFieldValue in project mirakl-hyperwallet-connector by paypal.

the class MiraklSellersExtractServiceImplCustomFieldsTest method updateUserToken_shouldUpdateValueForCustomFieldHwUserToken.

@DisplayName("Should Update Value for Custom Field 'hw-user-token'")
@Test
void updateUserToken_shouldUpdateValueForCustomFieldHwUserToken() {
    when(hyperwalletUserMock.getToken()).thenReturn(TOKEN_VALUE);
    when(hyperwalletUserMock.getClientUserId()).thenReturn("12345");
    testObj.updateUserToken(hyperwalletUserMock);
    verify(miraklMarketplacePlatformOperatorApiClientMock).updateShops(miraklUpdateShopsRequestCaptor.capture());
    final MiraklUpdateShopsRequest miraklUpdateShopsRequest = miraklUpdateShopsRequestCaptor.getValue();
    assertThat(miraklUpdateShopsRequest.getShops()).hasSize(1);
    final MiraklUpdateShop shopToUpdate = miraklUpdateShopsRequest.getShops().get(0);
    assertThat(shopToUpdate).hasFieldOrPropertyWithValue("shopId", 12345L);
    assertThat(shopToUpdate.getAdditionalFieldValues()).hasSize(1);
    final MiraklRequestAdditionalFieldValue additionalFieldValue = shopToUpdate.getAdditionalFieldValues().get(0);
    assertThat(additionalFieldValue).isInstanceOf(MiraklSimpleRequestAdditionalFieldValue.class);
    final MiraklSimpleRequestAdditionalFieldValue castedAdditionalFieldValue = (MiraklSimpleRequestAdditionalFieldValue) additionalFieldValue;
    assertThat(castedAdditionalFieldValue.getCode()).isEqualTo("hw-user-token");
    assertThat(castedAdditionalFieldValue.getValue()).isEqualTo(TOKEN_VALUE);
}
Also used : MiraklUpdateShopsRequest(com.mirakl.client.mmp.operator.request.shop.MiraklUpdateShopsRequest) MiraklUpdateShop(com.mirakl.client.mmp.operator.domain.shop.update.MiraklUpdateShop) MiraklRequestAdditionalFieldValue(com.mirakl.client.mmp.request.additionalfield.MiraklRequestAdditionalFieldValue) MiraklSimpleRequestAdditionalFieldValue(com.mirakl.client.mmp.request.additionalfield.MiraklRequestAdditionalFieldValue.MiraklSimpleRequestAdditionalFieldValue) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

MiraklUpdateShopsRequest (com.mirakl.client.mmp.operator.request.shop.MiraklUpdateShopsRequest)16 MiraklRequestAdditionalFieldValue (com.mirakl.client.mmp.request.additionalfield.MiraklRequestAdditionalFieldValue)16 Test (org.junit.jupiter.api.Test)12 MiraklUpdateShop (com.mirakl.client.mmp.operator.domain.shop.update.MiraklUpdateShop)9 MiraklSimpleRequestAdditionalFieldValue (com.mirakl.client.mmp.request.additionalfield.MiraklRequestAdditionalFieldValue.MiraklSimpleRequestAdditionalFieldValue)6 MiraklException (com.mirakl.client.core.exception.MiraklException)3 MiraklMarketplacePlatformOperatorApiClient (com.mirakl.client.mmp.operator.core.MiraklMarketplacePlatformOperatorApiClient)3 KYCUserDocumentFlagsNotificationBodyModel (com.paypal.kyc.model.KYCUserDocumentFlagsNotificationBodyModel)3 MiraklBusinessStakeholderDocumentsExtractService (com.paypal.kyc.service.documents.files.mirakl.MiraklBusinessStakeholderDocumentsExtractService)3 Collectors (java.util.stream.Collectors)3 Slf4j (lombok.extern.slf4j.Slf4j)3 DisplayName (org.junit.jupiter.api.DisplayName)3 Service (org.springframework.stereotype.Service)3 HyperwalletUser (com.hyperwallet.clientsdk.model.HyperwalletUser)2 MailNotificationUtil (com.paypal.infrastructure.mail.MailNotificationUtil)2 MiraklLoggingErrorsUtil (com.paypal.infrastructure.util.MiraklLoggingErrorsUtil)2 KYCConstants (com.paypal.kyc.model.KYCConstants)2 List (java.util.List)2 CollectionUtils (org.apache.commons.collections4.CollectionUtils)2 StringUtils (com.mchange.v2.lang.StringUtils)1