All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.payu.notification.client.mapper.MboaSmsMapper Maven / Gradle / Ivy

The newest version!
package com.payu.notification.client.mapper;

import com.payu.notification.client.mboasms.request.MboaSmsRequest;
import com.payu.notification.client.mboasms.response.MboaSmsResponse;
import com.payu.notification.client.model.enums.SmsStatus;
import com.payu.notification.client.model.request.SmsRequest;
import com.payu.notification.client.model.response.SmsResponse;
import java.util.List;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Named;

@Mapper(componentModel = "spring")
public interface MboaSmsMapper {
  @Mapping(source = "phoneNumberList", target = "phoneNumbers", qualifiedByName = "getPhoneNumbers")
  MboaSmsRequest toMboaSmsRequest(SmsRequest smsRequest);

  @Mapping(source = "success", target = "status", qualifiedByName = "getStatus")
  SmsResponse toSmsResponse(MboaSmsResponse mboaSmsResponse);

  @Named("getStatus")
  public static SmsStatus getStatus(boolean success) {
    return success ? SmsStatus.SUCCESS : SmsStatus.FAILED;
  }

  @Named("getPhoneNumbers")
  public static String getPhoneNumbers(List phoneNumberList) {
    return String.join(",", phoneNumberList);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy