Created
May 24, 2018 14:46
-
-
Save johndstein/71432e207c4017e0bd8883b75dd4151c to your computer and use it in GitHub Desktop.
example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AuthorizeNetService ans = new AuthorizeNetService('**', '**', true); | |
AuthorizeNetModels.creditCardType creditCard = new AuthorizeNetModels.creditCardType(); | |
creditCard.cardCode = '999'; | |
creditCard.cardNumber = '5424000000000015'; | |
creditCard.expirationDate = '2020-05'; | |
AuthorizeNetModels.paymentType payment = new AuthorizeNetModels.paymentType(); | |
payment.creditCard = creditCard; | |
List<AuthorizeNetModels.lineItemType> lineItems = new List<AuthorizeNetModels.lineItemType>(); | |
AuthorizeNetModels.lineItemType lineItem = new AuthorizeNetModels.lineItemType(); | |
lineItem.itemId = 'itemid'; | |
lineItem.name = 'name'; | |
lineItem.description = 'desc'; | |
lineItem.quantity = 11; | |
lineItem.unitPrice = 10.00; | |
lineItems.add(lineItem); | |
AuthorizeNetModels.customerType customer = new AuthorizeNetModels.customerType(); | |
customer.id = 'cust-10101'; | |
AuthorizeNetModels.addressType address = new AuthorizeNetModels.addressType(); | |
address.firstName = 'first'; | |
address.lastName = 'last'; | |
address.company = 'co'; | |
address.address = 'adr'; | |
address.city = 'cit'; | |
address.state = 'st'; | |
address.zip = 'zzzzz'; | |
address.country = '12cccccc3'; | |
AuthorizeNetModels.transactionRequestType tr = new AuthorizeNetModels.transactionRequestType(); | |
tr.transactionType = 'authCaptureTransaction'; | |
tr.amount = 10.00; | |
tr.payment = payment; | |
tr.lineItems = lineItems; | |
tr.poNumber = 'po 11'; | |
tr.customer = customer; | |
tr.billTo = address; | |
tr.shipTo = address; | |
tr.customerIP = '12.12.12.12'; | |
System.debug(tr.toXML()); | |
AuthorizeNetModels.createTransactionResponse response = ans.createTransaction(tr, '123'); | |
System.debug('XXXXXX' + response); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment