public class PaymentOpportunityExtensionController { Opportunity theProject = new Opportunity(); List<String> OppMSNAVID= new List<String>(); List<String> AccMSNAVID= new List<string>(); List<String> AccountIDList= new List<String>(); List<ID> ContactEmaiIdlist= new List<ID>(); List<String> EmailAddress= new List<String>(); List<Payment_Mail_c> PaymentMailList= new List<Payment_Mail_c>(); List<Opportunity_Contact_CUSTOM_c> OpportunityContactCUSTOMList= new List<Opportunity_Contact_CUSTOM_c>(); list<Opportunity> RACIChartList = new list<Opportunity>(); list<Account> AccountList = new list<Account>(); public Boolean showSubmitButton{get;set;} public Boolean hideSubmitButton{get;set;} public Boolean showError{get;set;} public String enteredText1{get;set;} Boolean EmailBoolean=false; Boolean FieldUpdate=false; Boolean PaymentObject=false; Public map<String,String> EmailSendContactmap; public PaymentOpportunityExtensionController(ApexPages.StandardController stdController) { this.theProject = (Opportunity)stdController.getRecord(); showSubmitButton = true; hideSubmitButton = false; showError = false; EmailSendContactmap= new map<String,String>();
Opportunity theProject = new Opportunity();
List<String> OppMSNAVID= new List<String>();
List<String> AccMSNAVID= new List<string>();
List<String> AccountIDList= new List<String>();
List<ID> ContactEmaiIdlist= new List<ID>();
List<String> EmailAddress= new List<String>();
List<Payment_Mail_c> PaymentMailList= new List<Payment_Mail_c>();
List<Opportunity_Contact_CUSTOM_c> OpportunityContactCUSTOMList= new List<Opportunity_Contact_CUSTOM_c>();
list<Opportunity> RACIChartList = new list<Opportunity>();
list<Account> AccountList = new list<Account>();
public Boolean showSubmitButton{get;set;}
public Boolean hideSubmitButton{get;set;}
public Boolean showError{get;set;}
public String enteredText1{get;set;}
Boolean EmailBoolean=false;
Boolean FieldUpdate=false;
Boolean PaymentObject=false;
Public map<String,String> EmailSendContactmap;
public PaymentOpportunityExtensionController(ApexPages.StandardController stdController) {
this.theProject = (Opportunity)stdController.getRecord();
showSubmitButton = true;
hideSubmitButton = false;
showError = false;
EmailSendContactmap= new map<String,String>();
String MsgSub = OpportunityMSNAV +' - Make Payment';
final String chars1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
String encodedData = '';
while (encodedData.length() < 25)
{
Integer idx = Math.mod(Math.abs(Crypto.getRandomInteger()), chars1.length());
encodedData += chars1.substring(idx, idx+1);
}
String Hyperlink= 'http://localhost:59490/payment/Authorize/'+encodedData;
System.debug('Hyperlink'+Hyperlink);
if(EmailBoolean){
List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setSubject(MsgSub);
mail.setToAddresses(EmailAddress);
Messaging.Emailfileattachment efa = new Messaging.Emailfileattachment();
List<StaticResource> docs = [select id, name, body from StaticResource where name = 'SSG_Logo' limit 1];
mails.add(mail);
Messaging.sendEmail(mails);
System.debug('messageBody'+messageBody);
system.debug('Email ::::::::'+EmailAddress+','+'http://localhost:59490/payment/Authorize/'+OpportunityMSNAV+','+AccountMSNAV+'Random Number'+randStr);
showSubmitButton = false;
showError = false;
hideSubmitButton = true;
FieldUpdate=true;
}
Payment_Mail__c msinfoOne=null;
if(FieldUpdate){
System.debug('FieldUpdate'+FieldUpdate);
theProject.Status__c='Payment link send';
Update theProject;
PaymentObject=true;
System.debug('theProject'+theProject.Status__c);