public void UpdateReceiptRule(IAmazonSimpleEmailService client, string email) { try { var objReceipient = new List <string>(DescribeReceiptRule(client)); objReceipient.Add(SenderAddress); var objCreateReceiptRuleRequest = new UpdateReceiptRuleRequest { RuleSetName = "email-receive" }; var lstReceiptAction = new List <ReceiptAction>(); var objReceiptAction = new ReceiptAction(); var objS3Action = new S3Action { BucketName = "test-receive-email", ObjectKeyPrefix = string.Empty, TopicArn = "arn:aws:sns:us-west-2:803078631911:test-notification", KmsKeyArn = string.Empty }; objReceiptAction.S3Action = objS3Action; lstReceiptAction.Add(objReceiptAction); var objReceiptRule = new ReceiptRule { Name = "test-email", ScanEnabled = true, Enabled = true, Actions = lstReceiptAction, TlsPolicy = TlsPolicy.Optional, Recipients = objReceipient }; objCreateReceiptRuleRequest.Rule = objReceiptRule; client.UpdateReceiptRule(objCreateReceiptRuleRequest); } catch { // ignored } }
public void CreateReceiptRule(IAmazonSimpleEmailService client, string email) { try { var objCreateReceiptRuleRequest = new CreateReceiptRuleRequest { RuleSetName = email.Replace("@", "-") }; var lstReceiptAction = new List <ReceiptAction>(); var objReceiptAction = new ReceiptAction(); var objS3Action = new S3Action { BucketName = email.ToLower().Replace("@", "-").Replace(".", "-"), ObjectKeyPrefix = string.Empty, TopicArn = "arn:aws:sns:us-west-2:803078631911:test-email", KmsKeyArn = string.Empty, }; objReceiptAction.S3Action = objS3Action; lstReceiptAction.Add(objReceiptAction); var objReceiptRule = new ReceiptRule { Name = email.Substring(0, 3), ScanEnabled = true, Enabled = true, Actions = lstReceiptAction, TlsPolicy = TlsPolicy.Optional, Recipients = new List <string> { email } }; objCreateReceiptRuleRequest.Rule = objReceiptRule; client.CreateReceiptRule(objCreateReceiptRuleRequest); } catch { // ignored } }
public static ReceiptAction IsReceiptValid(string ReceiptNumber, string Mobile, string Email, string SecurityCode) { ReceiptAction ra = new ReceiptAction(); Activity <ExternalPay> activity = new Activity <ExternalPay>() { ActivityType = ActivityType.ExtPay, }; ExternalPay ep = new ExternalPay() { TempReceiptNumber = ReceiptNumber, Mobile = Mobile, Email = Email, SecurityCode = SecurityCode }; activity.ActivityToLog = ep; ActivityHandler AH = new ActivityHandler(); try { logging Lvws = new logging(); VerifyReceiptDetailsforGCSSite Vrfr = Lvws.VerifyReceiptDetailsforGCSSite(ReceiptNumber, Mobile, Email, SecurityCode); ra.VerifyReceiptDetailsforGCSSite = Vrfr; ReceiptDetailsMinified rd = null; string TokenId = "0"; if (Vrfr.Proceed) { System.Data.DataSet ds = new System.Data.DataSet(); ds = Lvws.GetPaymentDetailsforGCSSite(ReceiptNumber, Mobile, Email, false); //to retain decimal value as string (18, 3)..Normal decimal property round off it and removes unneccesary trailing zeroes ds.Tables[0].Rows[0]["Amount"] = Convert.ToDecimal(ds.Tables[0].Rows[0]["Amount"]) + Convert.ToDecimal(0.210); GCSPayment GP = new GCSPayment(); rd = GP.BindData <ReceiptDetailsMinified>(ds.Tables[0]); TokenId = Lvws.ExplicitDecryptTokenCall(rd.TokenId); //RandomStringGenerator4DotNet is installed to get random text -- To inject false string in token RandomStringGenerator.StringGenerator RSG = new RandomStringGenerator.StringGenerator() { MinNumericChars = 1, MinLowerCaseChars = 2, MinUpperCaseChars = 1 }; string randstr = RSG.GenerateString(4); rd.TokenId = rd.TokenId.Insert(3, randstr); activity.TokenId = TokenId; } ra.ReceiptDetailsMinified = rd; AH.LoggerCall <ExternalPay>(activity, LogLevel.Info, null, TokenId, "Receipt Lookup", ErrorAt.None, ep); return(ra); } catch (Exception ex) { AH.LoggerCall <ExternalPay>(activity, LogLevel.Error, ex, "0", "Receipt Lookup", ErrorAt.ReceiptLookup, ep); VerifyReceiptDetailsforGCSSite VerifyReceiptDetailsforGCSSite = new VerifyReceiptDetailsforGCSSite() { Proceed = false, Message = "Some error has occured . Please Contact IT Team" }; ra.VerifyReceiptDetailsforGCSSite = VerifyReceiptDetailsforGCSSite; return(ra); } }