Hi guys,
What would be the best way to add a payment method to C&P from Salesforce? so we can reuse it as a referral transaction on another transaction. We are currently trying to implement a transaction of $0 to store the card info and then use that as the referral.
this is our current code:
What would be the best way to add a payment method to C&P from Salesforce? so we can reuse it as a referral transaction on another transaction. We are currently trying to implement a transaction of $0 to store the card info and then use that as the referral.
this is our current code:
Code:
Map<String, Object> result = new Map<String,Object>(); CnP_IaaS.PaaS_Class cnpxmlstring = new CnP_IaaS.PaaS_Class(); CnP_IaaS.PaaS_Class.Operation Operation = new CnP_IaaS.PaaS_Class.Operation(); CnP_IaaS.PaaS_Class.Order Order = new CnP_IaaS.PaaS_Class.Order(); CnP_IaaS.PaaS_Class.Authentication Authentication = new CnP_IaaS.PaaS_Class.Authentication(); CnP_IaaS.PaaS_Class.BillingInformation BillingInfo = new CnP_IaaS.PaaS_Class.BillingInformation(); CnP_IaaS.PaaS_Class.BillingAddress BillingAddress = new CnP_IaaS.PaaS_Class.BillingAddress(); CnP_IaaS.PaaS_Class.PaymentMethod PaymentMethod = new CnP_IaaS.PaaS_Class.PaymentMethod(); CnP_IaaS.PaaS_Class.Receipt Receipt = new CnP_IaaS.PaaS_Class.Receipt(); CnP_IaaS.PaaS_Class.cnpTransaction trans = new CnP_IaaS.PaaS_Class.cnpTransaction(); trans.TransactionType = 'Authorize'; Authentication.AccountID = 'xxx';//Replace with your Click & Pledge account number. Authentication.AccountGuid = 'xxx';//Replace with your Click & Pledge account GUID. Order.OrderMode='Test'; cnpxmlstring.ItemsList = new List<CnP_IaaS.Paas_Class.Items>(); CnP_IaaS.Paas_Class.Items i = new CnP_IaaS.Paas_Class.Items(); i.ItemName = 'Add Card'; i.UnitPrice = 0.0; cnpxmlstring.ItemsList.add(i); BillingInfo.BillingFirstName = (String)payMethod.get('firstName'); BillingInfo.BillingLastName = (String)payMethod.get('lastName'); BillingAddress.BillingStateProvince = (String)payMethod.get('billingState'); PaymentMethod.NameOnCard = (String)payMethod.get('cardName'); PaymentMethod.CardNumber = (String)payMethod.get('cardNumber'); PaymentMethod.Cvv2 = (String)payMethod.get('cvv2'); PaymentMethod.ExpirationMonth = (String)payMethod.get('expirationMonth'); PaymentMethod.ExpirationYear = (String)payMethod.get('expirationYear'); Operation.IPAddress = '0.0.0.0'; //test IP, can apex get browser IP? cnpxmlstring.getOperation_node(Operation); cnpxmlstring.getOrder_node(Order); cnpxmlstring.getAuthentication_node(Authentication); cnpxmlstring.getBillingInformation_node(BillingInfo); cnpxmlstring.getBillingAddress_node(BillingAddress); cnpxmlstring.getItemslist_node(cnpxmlstring.getItemsList()); cnpxmlstring.getTransactionDetails_node(trans); cnpxmlstring.getPaymentMethod_node(PaymentMethod); cnpxmlstring.getreceipt_node(Receipt); cnpxmlstring.getgeneratexml(cnpxmlstring); if(!payMethod.containsKey('testMode')){ cnpxmlstring.Send_Transaction_api(cnpxmlstring.xmlfile); result.put('TransactionResultCode',cnpxmlstring.TransactionResultCode); result.put('ErrorData',cnpxmlstring.ErrorData); result.put('TransactionNumber',cnpxmlstring.TransactionNumber); } return result;
Comment