in Hands-on lab/lab-files/src/Contoso Sports League/Contoso.Apps.SportsLeague.Web/Helpers/PaymentGatewayFunctions.cs [73:111]
public bool DoCheckoutAuth(OrderModel order, ref string token, ref NVPCodec decoder)
{
if (bSandbox)
{
pEndPointURL = pEndPointURL_SB;
}
NVPCodec encoder = new NVPCodec();
encoder[NVPProperties.Properties.METHOD] = NVPProperties.Methods.AuthorizePayment;
encoder[NVPProperties.Properties.BRANDNAME] = "Contoso Sports League";
encoder[NVPProperties.Properties.PAYMENTREQUEST_AMT] = order.Total.ToString();
encoder[NVPProperties.Properties.FIRSTNAME] = order.FirstName;
encoder[NVPProperties.Properties.LASTNAME] = order.LastName;
encoder[NVPProperties.Properties.ADDRESS] = order.Address;
encoder[NVPProperties.Properties.CITY] = order.City;
encoder[NVPProperties.Properties.STATE] = order.State;
encoder[NVPProperties.Properties.POSTALCODE] = order.PostalCode;
encoder[NVPProperties.Properties.NAME_ON_CREDIT_CARD] = order.NameOnCard;
encoder[NVPProperties.Properties.CREDIT_CARD_TYPE] = order.CreditCardType;
encoder[NVPProperties.Properties.CREDIT_CARD_NUMBER] = order.CreditCardNumber;
encoder[NVPProperties.Properties.CREDIT_CARD_EXPDATE] = order.ExpirationDate;
encoder[NVPProperties.Properties.CCV2] = order.CCV;
string pStrrequestforNvp = encoder.Encode();
string pStresponsenvp = HttpCall(pStrrequestforNvp);
decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
string strAck = decoder[NVPProperties.Properties.ACK].ToLower();
if (strAck != null && (strAck == "success" || strAck == "successwithwarning"))
{
return true;
}
else
{
return false;
}
}