@@ -24,8 +24,6 @@ public interface IDelistingService
24
24
Task < Dictionary < string , List < string > > > CreateTakedownRequestAsync ( TakedownRequestCreateDto dto ) ;
25
25
Task < ( Dictionary < string , List < string > > errors , EmailPreview preview ) > GetTakedownRequestPreviewAsync ( TakedownRequestCreateDto dto ) ;
26
26
Task ProcessTakedownRequestBatchEmailsAsync ( ) ;
27
- Task < Dictionary < string , List < string > > > SendBatchTakedownRequestAsync ( long platformId , Stream stream ) ;
28
- Task < Dictionary < string , List < string > > > SendBatchTakedownNoticeAsync ( long platformId , Stream stream ) ;
29
27
Task < Dictionary < string , List < string > > > CreateTakedownNoticesFromListingAsync ( TakedownNoticesFromListingDto [ ] listings ) ;
30
28
Task < ( Dictionary < string , List < string > > errors , EmailPreview preview ) > GetTakedownNoticesFromListingPreviewAsync ( TakedownNoticesFromListingDto [ ] listings ) ;
31
29
Task < Dictionary < string , List < string > > > CreateTakedownRequestsFromListingAsync ( TakedownRequestsFromListingDto [ ] listings ) ;
@@ -893,202 +891,6 @@ private async Task ProcessTakedownRequestBatchEmailAsync(OrganizationDto platfor
893
891
894
892
_unitOfWork . CommitTransaction ( transaction ) ;
895
893
}
896
-
897
- public async Task < Dictionary < string , List < string > > > SendBatchTakedownRequestAsync ( long platformId , Stream stream )
898
- {
899
- var platform = await _orgService . GetOrganizationByIdAsync ( platformId ) ;
900
-
901
- var errors = await ValidateBatchTakedownRequestAsync ( platform ) ;
902
- if ( errors . Count > 0 )
903
- {
904
- return errors ;
905
- }
906
-
907
- //the existence of the contact email has been validated above
908
- var contacts = platform ! . ContactPeople
909
- . Where ( x => x . IsPrimary && x . EmailAddressDsc . IsNotEmpty ( ) && x . EmailMessageType == EmailMessageTypes . BatchTakedownRequest )
910
- . Select ( x => x . EmailAddressDsc )
911
- . ToArray ( ) ;
912
-
913
- var content = CommonUtils . StreamToBase64 ( stream ) ;
914
- var date = DateUtils . ConvertUtcToPacificTime ( DateTime . UtcNow ) . ToString ( "yyyy-MM-dd-HH-mm" ) ;
915
- var fileName = $ "{ platform . OrganizationNm } - { date } .csv";
916
- var adminEmail = _config . GetValue < string > ( "ADMIN_EMAIL" ) ?? throw new Exception ( $ "There's no admin eamil.") ;
917
-
918
- var template = new BatchTakedownRequest ( _emailService )
919
- {
920
- To = contacts ,
921
- Bcc = new string [ ] { adminEmail ! } ,
922
- Info = $ "{ EmailMessageTypes . BatchTakedownRequest } for { platform . OrganizationNm } ",
923
- Attachments = new EmailAttachment [ ] { new EmailAttachment {
924
- Content = content ,
925
- ContentType = "text/csv" ,
926
- Encoding = "base64" ,
927
- Filename = fileName
928
- } } ,
929
- } ;
930
-
931
- var emailEntity = new DssEmailMessage
932
- {
933
- EmailMessageType = template . EmailMessageType ,
934
- MessageDeliveryDtm = DateTime . UtcNow ,
935
- MessageTemplateDsc = template . GetContent ( ) + $ " Attachement: { fileName } ",
936
- IsHostContactedExternally = false ,
937
- IsSubmitterCcRequired = false ,
938
- LgPhoneNo = null ,
939
- UnreportedListingNo = null ,
940
- HostEmailAddressDsc = null ,
941
- LgEmailAddressDsc = null ,
942
- CcEmailAddressDsc = null ,
943
- UnreportedListingUrl = null ,
944
- LgStrBylawUrl = null ,
945
- InitiatingUserIdentityId = _currentUser . Id ,
946
- AffectedByUserIdentityId = null ,
947
- InvolvedInOrganizationId = platform . OrganizationId ,
948
- RequestingOrganizationId = null
949
- } ;
950
-
951
- await _emailRepo . AddEmailMessage ( emailEntity ) ;
952
-
953
- emailEntity . ExternalMessageNo = await template . SendEmail ( ) ;
954
-
955
- using var transaction = _unitOfWork . BeginTransaction ( ) ;
956
-
957
- _unitOfWork . Commit ( ) ;
958
-
959
- emailEntity . BatchingEmailMessageId = emailEntity . EmailMessageId ;
960
-
961
- _unitOfWork . Commit ( ) ;
962
-
963
- _unitOfWork . CommitTransaction ( transaction ) ;
964
-
965
- return errors ;
966
- }
967
-
968
- private async Task < Dictionary < string , List < string > > > ValidateBatchTakedownRequestAsync ( OrganizationDto ? platform )
969
- {
970
- await Task . CompletedTask ;
971
-
972
- var errors = new Dictionary < string , List < string > > ( ) ;
973
-
974
- if ( platform == null )
975
- {
976
- errors . AddItem ( "platformId" , $ "Platform ID ({ platform ! . OrganizationId } ) does not exist.") ;
977
- }
978
- else
979
- {
980
- if ( platform . OrganizationType != OrganizationTypes . Platform )
981
- {
982
- errors . AddItem ( "platformId" , $ "Organization ({ platform ! . OrganizationId } ) is not a platform") ;
983
- }
984
-
985
- if ( platform . ContactPeople == null ||
986
- ! platform . ContactPeople . Any ( x => x . IsPrimary && x . EmailAddressDsc . IsNotEmpty ( ) && x . EmailMessageType == EmailMessageTypes . BatchTakedownRequest ) )
987
- {
988
- errors . AddItem ( "platformId" , $ "Platform ({ platform ! . OrganizationId } ) does not have the primary '{ EmailMessageTypes . BatchTakedownRequest } ' contact info") ;
989
- }
990
- }
991
-
992
- return errors ;
993
- }
994
-
995
- public async Task < Dictionary < string , List < string > > > SendBatchTakedownNoticeAsync ( long platformId , Stream stream )
996
- {
997
- var platform = await _orgService . GetOrganizationByIdAsync ( platformId ) ;
998
-
999
- var errors = await ValidateBatchTakedownNoticeAsync ( platform ) ;
1000
- if ( errors . Count > 0 )
1001
- {
1002
- return errors ;
1003
- }
1004
-
1005
- //the existence of the contact email has been validated above
1006
- var contacts = platform ! . ContactPeople
1007
- . Where ( x => x . IsPrimary && x . EmailAddressDsc . IsNotEmpty ( ) && x . EmailMessageType == EmailMessageTypes . NoticeOfTakedown )
1008
- . Select ( x => x . EmailAddressDsc )
1009
- . ToArray ( ) ;
1010
-
1011
- var content = CommonUtils . StreamToBase64 ( stream ) ;
1012
- var date = DateUtils . ConvertUtcToPacificTime ( DateTime . UtcNow ) . ToString ( "yyyy-MM-dd-HH-mm" ) ;
1013
- var fileName = $ "Notice of non-compliance - { platform . OrganizationNm } - { date } .csv";
1014
- var adminEmail = _config . GetValue < string > ( "ADMIN_EMAIL" ) ?? throw new Exception ( $ "There's no admin eamil.") ;
1015
-
1016
- var template = new BatchTakedownNotice ( _emailService )
1017
- {
1018
- To = contacts ,
1019
- Bcc = new string [ ] { adminEmail ! } ,
1020
- Info = $ "{ EmailMessageTypes . NoticeOfTakedown } for { platform . OrganizationNm } ",
1021
- Attachments = new EmailAttachment [ ] { new EmailAttachment {
1022
- Content = content ,
1023
- ContentType = "text/csv" ,
1024
- Encoding = "base64" ,
1025
- Filename = fileName
1026
- } } ,
1027
- } ;
1028
-
1029
- var emailEntity = new DssEmailMessage
1030
- {
1031
- EmailMessageType = template . EmailMessageType ,
1032
- MessageDeliveryDtm = DateTime . UtcNow ,
1033
- MessageTemplateDsc = template . GetContent ( ) + $ " Attachement: { fileName } ",
1034
- IsHostContactedExternally = false ,
1035
- IsSubmitterCcRequired = false ,
1036
- LgPhoneNo = null ,
1037
- UnreportedListingNo = null ,
1038
- HostEmailAddressDsc = null ,
1039
- LgEmailAddressDsc = null ,
1040
- CcEmailAddressDsc = null ,
1041
- UnreportedListingUrl = null ,
1042
- LgStrBylawUrl = null ,
1043
- InitiatingUserIdentityId = _currentUser . Id ,
1044
- AffectedByUserIdentityId = null ,
1045
- InvolvedInOrganizationId = platform . OrganizationId ,
1046
- RequestingOrganizationId = null
1047
- } ;
1048
-
1049
- await _emailRepo . AddEmailMessage ( emailEntity ) ;
1050
-
1051
- emailEntity . ExternalMessageNo = await template . SendEmail ( ) ;
1052
-
1053
- using var transaction = _unitOfWork . BeginTransaction ( ) ;
1054
-
1055
- _unitOfWork . Commit ( ) ;
1056
-
1057
- emailEntity . BatchingEmailMessageId = emailEntity . EmailMessageId ;
1058
-
1059
- _unitOfWork . Commit ( ) ;
1060
-
1061
- _unitOfWork . CommitTransaction ( transaction ) ;
1062
-
1063
- return errors ;
1064
- }
1065
-
1066
- private async Task < Dictionary < string , List < string > > > ValidateBatchTakedownNoticeAsync ( OrganizationDto ? platform )
1067
- {
1068
- await Task . CompletedTask ;
1069
-
1070
- var errors = new Dictionary < string , List < string > > ( ) ;
1071
-
1072
- if ( platform == null )
1073
- {
1074
- errors . AddItem ( "platformId" , $ "Platform ID ({ platform ! . OrganizationId } ) does not exist.") ;
1075
- }
1076
- else
1077
- {
1078
- if ( platform . OrganizationType != OrganizationTypes . Platform )
1079
- {
1080
- errors . AddItem ( "platformId" , $ "Organization ({ platform ! . OrganizationId } ) is not a platform") ;
1081
- }
1082
-
1083
- if ( platform . ContactPeople == null ||
1084
- ! platform . ContactPeople . Any ( x => x . IsPrimary && x . EmailAddressDsc . IsNotEmpty ( ) && x . EmailMessageType == EmailMessageTypes . BatchTakedownRequest ) )
1085
- {
1086
- errors . AddItem ( "platformId" , $ "Platform ({ platform ! . OrganizationId } ) does not have the primary '{ EmailMessageTypes . BatchTakedownRequest } ' contact info") ;
1087
- }
1088
- }
1089
-
1090
- return errors ;
1091
- }
1092
894
public async Task < ( Dictionary < string , List < string > > errors , EmailPreview preview ) > GetComplianceOrdersFromListingPreviewAsync ( ComplianceOrderDto [ ] listings )
1093
895
{
1094
896
CommonUtils . SanitizeObject ( listings ) ;
0 commit comments