Skip to content

Instantly share code, notes, and snippets.

@tgtxmorgan
Created March 3, 2015 15:50
Show Gist options
  • Save tgtxmorgan/41806f4867dacfea9f72 to your computer and use it in GitHub Desktop.
Save tgtxmorgan/41806f4867dacfea9f72 to your computer and use it in GitHub Desktop.
URL: https://targetxappdev1.na16.visual.force.com/apex/ProcessPayments?cost=100&cid=003j0000005XTPLAA4&retURL=/003j0000005XTPLAA4&redirectURL=/003j0000005XTPLAA4&item=Undergraduate%20Day&reason=Undergraduate%20Day&aid=003j0000005XTPLAA4&waiver=Yes&gateway=a0Tj0000001MISCEA4
Controller:
public with sharing class ProcessPayments_Con {
public targetx_payment.cartHandlerClass handler{get;set;}
public String retURL{get;set;}
public String redirectURL{get;set;}
public Decimal cost{get;set;}
public String gateway{get;set;}
public String reason{get;set;}
public String item{get;set;}
@TestVisible
private String cid;
public ProcessPayments_Con(){
cid = getParameters('cid');
gateway = getParameters('gateway');
retURL = getParameters('retURL');
redirectURL = getParameters('redirectURL');
reason = getParameters('reason');
cost = Decimal.valueOf(getParameters('cost'));
item = getParameters('item');
gateway = String.isBlank(getParameters('gateway')) ? 'gateway' : getParameters('gateway');
}
public void initCart(){
handler = new targetx_payment.cartHandlerClass();
handler.startCart();
handler.setTransType(reason);
handler.setTransReason(reason);
handler.setTransContact(cid);
handler.setTransCancel(retURL);
handler.setTransRedirect(redirectURL);
handler.addItem(item,cost,1,cid);
//handler.setTransAccount(gateway);
}
@TestVisible
private static String getParameters(String param){
return ApexPages.currentPage().getParameters().get(param);
}
}
VF:
<targetx_payment:paymentButton transID="{!handler.cartTransaction.id}"
totalCost="{!cost}"
CartHandler="{!handler}"
paymentReason="{!reason}"
payment_account="{!gateway}"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment