-
Notifications
You must be signed in to change notification settings - Fork 6
Samples
pleykov edited this page Apr 26, 2017
·
9 revisions
- One rule triggered,
- approval status of
REVIEW
is returned
public void RisQOneItemRequiredFieldsOneRuleReview()
{
// create inquiry
Inquiry inquiry = TestHelper.CreateInquiry(PTOK, out _sid, out _orderNum);
// set CART with one item
var cart = new ArrayList();
cart.Add(new CartItem("SPORTING_GOODS", "SG999999", "3000 CANDLEPOWER PLASMA FLASHLIGHT",
2, 68990));
inquiry.SetCart(cart);
//get response
Response response = inquiry.GetResponse();
var errors = response.GetErrors();
Assert.IsTrue(errors.Count == 0, String.Join(Environment.NewLine, errors,
"There are errors in response!"));
var auto = response.GetAuto();
Assert.IsTrue("R".Equals(auto), "Inquiry failed! Approval Status is not equal to R");
var warnings = response.GetWarnings();
Assert.IsTrue(warnings.Count == 0, String.Join(Environment.NewLine, warnings,
"There are warnings in response!"));
var sid = response.GetSessionId();
Assert.IsTrue(_sid.Equals(sid), "Inquiry failed! Wrong session ID");
var orderNum = response.GetOrderNumber();
Assert.IsTrue(_orderNum.Equals(orderNum), "Inquiry failed! Wrong order number.");
var rulesTrigg = response.GetRulesTriggered();
Assert.IsTrue(rulesTrigg.Count == 1, "Inquiry failed! RULES TRIGGERED is not 1");
}
- two rules triggered,
- an optional fields included,
- approval status of
DECLINED
is returned
public void RisQMultiCartItemsTwoOptionalFieldsTwoRulesDecline()
{
Inquiry inquiry = TestHelper.CreateInquiry(PTOK, out _sid, out _orderNum);
inquiry.SetUserAgent(TestHelper.UAGT);
inquiry.SetTotal(123456789);
// set CART with one item
var cart = new ArrayList();
cart.Add(new CartItem("cart item 0 type", "cart item 0", "cart item 0 description",
10, 1000));
cart.Add(new CartItem("cart item 1 type", "cart item 1", "cart item 1 description",
11, 1001));
cart.Add(new CartItem("cart item 2 type", "cart item 2", "cart item 2 description",
12, 1002));
inquiry.SetCart(cart);
//SET Customer User-Agent HTTP header UAGT
Response response = inquiry.GetResponse();
// optional getter
var errors = response.GetErrors();
Assert.IsTrue(errors.Count == 0, String.Join(Environment.NewLine, errors,
"There are errors in response!"));
var auto = response.GetAuto();
Assert.IsTrue("D".Equals(auto), "Inquiry failed! Approval Status is not equal to D");
var warnings = response.GetWarnings();
Assert.IsTrue(warnings.Count == 0, String.Join(Environment.NewLine, warnings,
"There are warnings in response!"));
var rulesTrigg = response.GetRulesTriggered();
Assert.IsTrue(rulesTrigg.Count == 2, "Inquiry failed! RULES TRIGGERED is not 2");
}
- approval status of
REVIEW
is returned
public void RisQWithUserDefinedFields()
{
Inquiry inquiry = TestHelper.CreateInquiry(PTOK, out _sid, out _orderNum);
inquiry.SetUserDefinedField("ARBITRARY_ALPHANUM_UDF", "alphanumeric trigger value");
inquiry.SetUserDefinedField("ARBITRARY_NUMERIC_UDF", "777");
// set CART with one item
var cart = new ArrayList();
cart.Add(new CartItem("cart item 0 type", "cart item 0", "cart item 0 description",
10, 1000));
inquiry.SetCart(cart);
Response response = inquiry.GetResponse();
var errors = response.GetErrors();
Assert.IsTrue(errors.Count == 0, String.Join(Environment.NewLine, errors,
"There are errors in response!"));
var auto = response.GetAuto();
Assert.IsTrue("R".Equals(auto), "Inquiry failed! Approval Status is not equal to R");
var warnings = response.GetWarnings();
Assert.IsTrue(warnings.Count == 0, String.Join(Environment.NewLine, warnings,
"There are warnings in response!"));
var rulesTrigg = response.GetRulesTriggered();
Assert.IsTrue(rulesTrigg != null && rulesTrigg.Count != 0,
"Inquiry failed! There no RULES_TRIGGERED.");
List<string> listResponce = new List<string>(Regex.Split(response.ToString(),
"[\r\n]+"));
var filteredList = listResponce.FindAll(i => i.Contains("RULE_DESCRIPTION"));
Assert.IsTrue(rulesTrigg.Count == filteredList.Count,
"Inquiry failed! Count of RULES_TRIGGERED is wrong!");
var r1 = filteredList.Find(r =>
r.Contains("review if ARBITRARY_ALPHANUM_UDF contains \"trigger\""));
var r2 = filteredList.Find(r => r.Contains("review if ARBITRARY_NUMERIC_UDF == 777"));
Assert.IsTrue(r1 != null && r2 != null,
"Inquiry failed! The content of triggered rules are wrong!");
}
- hard error returned
public void RisQHardErrorExpected()
{
Inquiry inquiry = TestHelper.CreateInquiry(PTOK, out _sid, out _orderNum);
inquiry.SetParameter("PTOK", Khash.HashPaymentToken("BADPTOK"));
inquiry.SetGender('M');
// set CART with one item
var cart = new ArrayList();
cart.Add(new CartItem("cart item 0 type", "cart item 0", "cart item 0 description",
10, 1000));
inquiry.SetCart(cart);
Response response = inquiry.GetResponse();
var mode = response.GetMode();
Assert.IsTrue("E".Equals(mode), $"Update failed! Wrong response mode {mode}.");
// optional getter
var errors = response.GetErrors();
Assert.IsTrue(errors.Count == 1, "Wrong responce expected error_num: 332, ERROR_COUNT=1");
var err0 = errors[0];
string errCode = err0.Substring(0, 3);
Assert.IsTrue(err0.Contains("332 BAD_CARD Cause: [PTOK invalid format], Field: [PTOK],
Value: [hidden]"), $"Wrong error value: {err0}, expected 332");
}
- two warnings are returned.
[UDF_DOESNOTEXIST=>throw a warning please!]
[The label [UDF_DOESNOTEXIST] is not defined for merchant ID [999666].]
public void RisQWarningApproved()
{
Inquiry inquiry = TestHelper.CreateInquiry(PTOK, out _sid, out _orderNum);
inquiry.SetTotal(1000);
inquiry.SetUserDefinedField("UDF_DOESNOTEXIST", "throw a warning please!");
// set CART with one item
var cart = new ArrayList();
cart.Add(new CartItem("cart item 0 type", "cart item 0", "cart item 0 description",
10, 1234));
inquiry.SetCart(cart);
Response response = inquiry.GetResponse();
var sessID = response.GetSessionId();
var tranID = response.GetTransactionId();
var ordNum = response.GetOrderNumber();
var errors = response.GetErrors();
Assert.IsTrue(errors.Count == 0, String.Join(Environment.NewLine, errors,
"There are errors in response!"));
var auto = response.GetAuto();
Assert.IsTrue("A".Equals(auto),
$"Inquiry failed! Approval status {auto} is not equal to A");
var warnings = response.GetWarnings();
Assert.IsTrue(warnings.Count == 2,
$"TranID: {tranID} - Wrong number of warnings: {warnings.Count}, expected 2.");
List<string> listResponce = new List<string>(Regex.Split(response.ToString(), "[\r\n]+"));
var filteredList = listResponce.FindAll(i => i.Contains("WARNING_"));
var w1 = filteredList.Find(r => r.Contains("[UDF_DOESNOTEXIST=>throw a warning please!]"));
var w2 = filteredList.Find(r =>
r.Contains("[The label [UDF_DOESNOTEXIST] is not defined for merchant ID [999666].]"));
Assert.IsTrue(w1 != null, $"Inquiry failed! The value {warnings[0]} of warning is wrong!");
Assert.IsTrue(w2 != null, $"Inquiry failed! The value {warnings[1]} of warning is wrong!");
}
- one error
332 BAD_CARD Cause: [PTOK invalid format], Field: [PTOK], Value: [hidden]
- two warnings are returned.
[UDF_DOESNOTEXIST=>throw a warning please!]
[The label [UDF_DOESNOTEXIST] is not defined for merchant ID [999666].]
public void RisQHardSoftErrorsExpected()
{
Inquiry inquiry = TestHelper.CreateInquiry(PTOK, out _sid, out _orderNum);
inquiry.SetParameter("PTOK", Khash.HashPaymentToken("BADPTOK"));
inquiry.SetUserDefinedField("UDF_DOESNOTEXIST", "throw a warning please!");
// set CART with one item
var cart = new ArrayList();
cart.Add(new CartItem("cart item 0 type", "cart item 0", "cart item 0 description",
10, 1000));
inquiry.SetCart(cart);
Response response = inquiry.GetResponse(false);
var mode = response.GetMode();
Assert.IsTrue("E".Equals(mode), $"Update failed! Wrong response mode {mode}.");
// optional getter
var errors = response.GetErrors();
Assert.IsTrue(errors.Count == 1,
"Wrong responce expected error_num: 332, ERROR_COUNT=1");
var err0 = errors[0];
Assert.IsTrue(err0.Contains("332 BAD_CARD Cause: [PTOK invalid format],
Field: [PTOK], Value: [hidden]"), $"Wrong error content: {err0}, expected 332.");
var warnings = response.GetWarnings();
Assert.IsTrue(warnings.Count == 2,
$"Wrong number of warnings: {warnings.Count}, expected 2.");
List<string> listResponce = new List<string>(Regex.Split(response.ToString(), "[\r\n]+"));
var filteredList = listResponce.FindAll(i => i.Contains("WARNING_"));
var w1 = filteredList.Find(r => r.Contains("[UDF_DOESNOTEXIST=>throw a warning please!]"));
var w2 = filteredList.Find(r =>
r.Contains("[The label [UDF_DOESNOTEXIST] is not defined for merchant ID [999666].]"));
Assert.IsTrue(w1 != null, $"Inquiry failed! The value {warnings[0]} of warning is wrong!");
Assert.IsTrue(w2 != null, $"Inquiry failed! The value {warnings[1]} of warning is wrong!");
}
-
two Kount Central
rules
triggered, -
Kount Central status of
REVIEW
KC_TRIGGERED_COUNT : 2 KC_WARNING_COUNT : 0 KC_DECISION : "R" KC_EVENT_1_CODE : "billingToShippingAddressReview" KC_EVENT_1_DECISION: "R" KC_EVENT_2_CODE : "orderTotalReview" KC_EVENT_2_DECISION: "R"
public void RisWTwoKCRulesReview()
{
Inquiry inquiry = TestHelper.CreateInquiry(PTOK, out _sid, out _orderNum);
inquiry.SetMode('W');
inquiry.SetTotal(10001);
inquiry.SetKountCentralCustomerId("KCentralCustomerOne");
// set CART with one item
var cart = new ArrayList();
cart.Add(new CartItem("cart item 0 type", "cart item 0", "cart item 0 description",
10, 1234));
inquiry.SetCart(cart);
Response response = inquiry.GetResponse();
var sessID = response.GetSessionId();
var tranID = response.GetTransactionId();
var ordNum = response.GetOrderNumber();
var errors = response.GetErrors();
Assert.IsTrue(errors.Count == 0, String.Join(Environment.NewLine, errors,
"There are errors in response!"));
var mode = response.GetMode();
Assert.IsTrue("W".Equals(mode), $"Update failed! Wrong response mode {mode}.");
var warnings = response.GetWarnings();
Assert.IsTrue(warnings.Count == 0, String.Join(Environment.NewLine, warnings,
"There are warnings in response!"));
/*
"KC_TRIGGERED_COUNT": 2
"KC_WARNING_COUNT": 0
"KC_DECISION": "R"
"KC_EVENT_1_CODE": "billingToShippingAddressReview"
"KC_EVENT_1_DECISION": "R"
"KC_EVENT_2_CODE": "orderTotalReview"
"KC_EVENT_2_DECISION": "R"
*/
var kcCustId = response.GetKountCentralCustomerId();
var kcDecision = response.GetKountCentralDecision();
Assert.IsTrue("R".Equals(kcDecision),
$"Inquiry failed! KC Decision {kcDecision} is not equal to R");
var kcErrs = response.GetKountCentralErrors();
Assert.IsTrue(kcErrs.Count == 0,
$"Inquiry failed! KC Errors: {String.Join(Environment.NewLine, kcErrs)}");
var kcWarn = response.GetKountCentralWarnings();
Assert.IsTrue(kcWarn.Count == 0,
$"Inquiry failed! KC Warnings: {String.Join(Environment.NewLine, kcWarn)}");
var kcEvents = response.GetKountCentralThresholdEvents();
Assert.IsTrue(kcEvents.Count == 2, $"Inquiry failed! KC Events:
{kcEvents.Count} are not 2.");
Assert.IsTrue("R".Equals(kcEvents[0].Decision), $"Inquiry failed! Wrong decisions d1 =
{kcEvents[0].Decision}, d2 = {kcEvents[1].Decision} by Kount Central ThresholdEvents.");
Assert.IsTrue("R".Equals(kcEvents[1].Decision), $"Inquiry failed! Wrong decisions d1 =
{kcEvents[0].Decision}, d2 = {kcEvents[1].Decision} by Kount Central ThresholdEvents.");
var code1 = kcEvents[0].Code;
var code2 = kcEvents[1].Code;
Assert.IsTrue("billingToShippingAddressReview".Equals(code1)
|| "billingToShippingAddressReview".Equals(code2),
$"Inquiry failed! Wrong KC codes: {code1}, {code2} expected billingToShippingAddressReview.");
Assert.IsTrue("orderTotalReview".Equals(code1) || "orderTotalReview".Equals(code2),
$"Inquiry failed! Wrong KC codes: {code1}, {code2} expected orderTotalReview.");
}
-
mode
J
is returned.KC_TRIGGERED_COUNT : 1 KC_WARNING_COUNT : 0 KC_DECISION : "D" KC_EVENT_1_CODE : "orderTotalDecline" KC_EVENT_1_DECISION: "D"
public void RisJOneKountCentralRuleDecline()
{
Inquiry inquiry = TestHelper.CreateInquiry(PTOK, out _sid, out _orderNum);
inquiry.SetMode('J');
inquiry.SetTotal(1000);
inquiry.SetKountCentralCustomerId("KCentralCustomerDeclineMe");
// set CART with one item
var cart = new ArrayList();
cart.Add(new CartItem("cart item 0 type", "cart item 0", "cart item 0 description",
10, 1234));
inquiry.SetCart(cart);
Response response = inquiry.GetResponse();
// optional getter
var errors = response.GetErrors();
Assert.IsTrue(errors.Count == 0, String.Join(Environment.NewLine, errors,
"There are errors in response!"));
var mode = response.GetMode();
Assert.IsTrue("J".Equals(mode), $"Update failed! Wrong response mode {mode}.");
var warnings = response.GetWarnings();
Assert.IsTrue(warnings.Count == 0, String.Join(Environment.NewLine, warnings,
"There are warnings in response!"));
/*
"KC_TRIGGERED_COUNT": 1,
"KC_WARNING_COUNT": 0,
"KC_DECISION": "D",
"KC_EVENT_1_CODE": "orderTotalDecline",
"KC_EVENT_1_DECISION": "D"
*/
var kcCustId = response.GetKountCentralCustomerId();
var kcDecision = response.GetKountCentralDecision();
Assert.IsTrue("D".Equals(kcDecision),
$"Inquiry failed! KC Decision {kcDecision} is not equal to D");
var kcErrs = response.GetKountCentralErrors();
Assert.IsTrue(kcErrs.Count == 0,
$"Inquiry failed! KC Errors: {String.Join(Environment.NewLine, kcErrs)}");
var kcWarn = response.GetKountCentralWarnings();
Assert.IsTrue(kcWarn.Count == 0,
$"Inquiry failed! KC Warnings: {String.Join(Environment.NewLine, kcWarn)}");
var kcEvents = response.GetKountCentralThresholdEvents();
Assert.IsTrue(kcEvents.Count == 1, $"Inquiry failed! KC Events: {kcEvents.Count} are not 1.");
Assert.IsTrue("D".Equals(kcEvents[0].Decision),
$"Inquiry failed! Wrong decisions d1 =
{kcEvents[0].Decision} by Kount Central ThresholdEvents.");
var code1 = kcEvents[0].Code;
Assert.IsTrue("orderTotalDecline".Equals(code1),
$"Inquiry failed! Wrong KC codes: {code1}, expected orderTotalDecline.");
}
- return values do not include the re-evalued transaction results,
public void ModeUAfterModeQ()
{
Inquiry inquiry = TestHelper.CreateInquiry(PTOK, out _sid, out _orderNum);
// set CART with one item
var cart = new ArrayList();
cart.Add(new CartItem("cart item 0 type", "cart item 0", "cart item 0 description",
10, 1234));
inquiry.SetCart(cart);
// get response
Response response = inquiry.GetResponse();
// optional getter
var errors = response.GetErrors();
if (errors.Count > 0)
{
Assert.IsTrue(false, String.Join(Environment.NewLine, errors));
return;
}
var sessID = response.GetSessionId();
var tranID = response.GetTransactionId();
var ordNum = response.GetOrderNumber();
// create Update
Update update = new Update();
update.SetMode('U');
update.SetVersion("0695");
update.SetMerchantId(TestHelper.TEST_MERCHANT_ID);
update.SetApiKey(TestHelper.TEST_API_KEY);
update.SetSessionId(sessID);
update.SetTransactionId(tranID);
update.SetOrderNumber(ordNum);
update.SetParameter("PTOK", Khash.HashPaymentToken("5386460135176807"));
update.SetPaymentTokenLast4("6807");
update.SetMack('Y');
update.SetAuth('A');
update.SetAvst('M');
update.SetAvsz('M');
update.SetCvvr('M');
response = update.GetResponse();
errors = response.GetErrors();
Assert.IsTrue(errors.Count == 0, String.Join(Environment.NewLine, errors, "There are errors in response!"));
var mode = response.GetMode();
Assert.IsTrue("U".Equals(mode), $"Update failed! Wrong response mode {mode}.");
Assert.IsTrue(sessID.Equals(response.GetSessionId()),
$"Update failed! Wrong session ID {sessID}.");
Assert.IsTrue(tranID.Equals(response.GetTransactionId()),
$"Update failed! Wrong Transaction Id {tranID}.");
var ordU = response.GetOrderNumber(); // orderNum is null
var auto = response.GetAuto();
Assert.IsTrue(auto == null, $"Inquiry failed! Approval status {auto} is not null");
var scor = response.GetScore();
Assert.IsTrue(scor == null, $"Inquiry failed! Score {scor} is not null");
var geox = response.GetGeox();
Assert.IsTrue(geox == null, $"Inquiry failed! GEOX {geox} is not null");
}
- return values include all mode
Q
values, re-evaluated for updated data, - To test, submit a default value mode
Q
transaction, captureTRAN
,SESS
,ORDR
values, and then use those to submit a modeX
public void ModeXAfterModeQ()
{
Inquiry inquiry = TestHelper.CreateInquiry(PTOK, out _sid, out _orderNum);
// set CART with one item
var cart = new ArrayList();
cart.Add(new CartItem("cart item 0 type", "cart item 0",
"cart item 0 description", 10, 1234));
inquiry.SetCart(cart);
// get response
Response response = inquiry.GetResponse();
// optional getter
var errors = response.GetErrors();
if (errors.Count > 0)
{
Assert.IsTrue(false, String.Join(Environment.NewLine, errors));
return;
}
var sessID = response.GetSessionId();
var tranID = response.GetTransactionId();
var ordNum = response.GetOrderNumber();
// create update
Update update = new Update();
update.SetMode('X');
update.SetVersion("0695");
update.SetMerchantId(TestHelper.TEST_MERCHANT_ID);
update.SetApiKey(TestHelper.TEST_API_KEY);
update.SetSessionId(sessID);
update.SetTransactionId(tranID);
update.SetOrderNumber(ordNum);
update.SetPaymentTokenLast4("6807");
update.SetMack('Y');
update.SetAuth('A');
update.SetAvst('M');
update.SetAvsz('M');
update.SetCvvr('M');
response = update.GetResponse();
errors = response.GetErrors();
Assert.IsTrue(errors.Count == 0, String.Join(Environment.NewLine, errors,
"There are errors in response!"));
var mode = response.GetMode();
Assert.IsTrue("X".Equals(mode), $"Update failed! Wrong response mode {mode}.");
var sID = response.GetSessionId();
Assert.IsTrue(sessID.Equals(sID), $"Update failed! Wrong session ID {sID}.");
var tId = response.GetTransactionId();
Assert.IsTrue(tranID.Equals(tId), $"Update failed! Wrong Transaction Id {tranID}.");
var ordU = response.GetOrderNumber();
Assert.IsTrue(ordNum.Equals(ordU), $"Update failed! Wrong Order Number {ordNum}.");
var auto = response.GetAuto();
Assert.IsTrue(auto != null, $"Update failed! AUTO not presented in response.");
var scor = response.GetScore();
Assert.IsTrue(scor != null, $"Update failed! SCOR not presented in response.");
var geox = response.GetGeox();
Assert.IsTrue(geox != null, $"Update failed! GEOX not presented in response.");
}
- mode
P
is returned.
public void ModeP()
{
Inquiry inquiry = TestHelper.CreateInquiry(PTOK, out _sid, out _orderNum);
inquiry.SetAnid("2085551212");
inquiry.SetMode('P');
inquiry.SetTotal(1000);
// set CART with one item
var cart = new ArrayList();
cart.Add(new CartItem("cart item 0 type", "cart item 0",
"cart item 0 description", 10, 1234));
inquiry.SetCart(cart);
Response response = inquiry.GetResponse();
// optional getter
var errors = response.GetErrors();
Assert.IsTrue(errors.Count == 0, String.Join(Environment.NewLine, errors,
"There are errors in response!"));
var mode = response.GetMode();
Assert.IsTrue("P".Equals(mode), $"Update failed! Wrong response mode {mode}.");
var auto = response.GetAuto();
Assert.IsTrue("A".Equals(auto),
$"Inquiry failed! Approval status {auto} is wrong, expected 'A'.");
}
Predictive Response Tests
Common definitions for all tests samples.
public class TestHelper
{
/// <summary>
/// Payment Type
/// </summary>
public const string PTYP_CARD = "CARD";
public const string TEST_API_KEY = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI5OTk2NjYiLCJhdWQiOiJLb3VudC4xIiwiaWF0IjoxNDg4NTYzMzgzLCJzY3AiOnsia2EiOm51bGwsImtjIjpudWxsLCJhcGkiOmZhbHNlLCJyaXMiOnRydWV9fQ.u8ycf3GuUKKHpNsR8BL40VxLDGFMEpO59k6cYcku9Tc";
public const int TEST_MERCHANT_ID = 999666;
/// <summary>
/// Customer User-Agent HTTP header
/// </summary>
public const string UAGT = "Mozilla/5.0(Macintosh; Intel Mac OSX 10_9_5)AppleWebKit/537.36(KHTML, like Gecko)Chrome/37.0.2062.124Safari/537.36";
/// <summary>
/// Authorization Status returned to merchant from processor.
/// </summary>
private const char AUTH = 'A';
/// <summary>
/// Address Verification System Street verification response returned to merchant from processor.
/// </summary>
private const char AVST = 'M';
/// <summary>
/// Address Verification System Zip Code verification response returned to merchant from processor.
/// </summary>
private const char AVSZ = 'M';
/// <summary>
/// Billing street address - Line 1
/// </summary>
private const string B2A1 = "1234 North B2A1 Tree Lane South";
/// <summary>
/// Billing street address - Line 2
/// </summary>
private const string B2A2 = "";
/// <summary>
/// Billing address - Counry Code
/// </summary>
private const string B2CC = "US";
/// <summary>
/// Billing address - City
/// </summary>
private const string B2CI = "Albuquerque";
/// <summary>
/// Billing address - Postal Code
/// </summary>
private const string B2PC = "87101";
/// <summary>
/// Billing address - Phone Number
/// </summary>
private const string B2PN = "555-867-5309";
/// <summary>
/// Billing address - State/Province
/// </summary>
private const string B2ST = "NM";
/// <summary>
/// Total cash amount in currency submitted
/// </summary>
private const int CASH = 4444;
/// <summary>
/// Currency
/// </summary>
private const string CURR = "USD";
/// <summary>
/// Card Verification Value response returned to merchant from processor.
/// </summary>
private const char CVVR = 'M';
/// <summary>
/// Email
/// </summary>
private const string EMAIL = "[email protected]";
/// <summary>
/// Dotted Decimal IPv4 address that the merchant sees coming from the customer.
/// </summary>
private const string IPAD = "131.206.45.21";
/// <summary>
/// Last 4 numbers of Credit Card Value
/// </summary>
private const string LAST4 = "2514";
/// <summary>
/// Merchants acknowledgement to ship/process the order
/// </summary>
private const char MACK = 'Y';
/// <summary>
/// Risk Inquiry Service Mode
/// </summary>
private const char MODE = 'Q';
/// <summary>
/// Name of Merchant
/// </summary>
private const string NAME = "SdkTestFirstName SdkTestLastName";
/// <summary>
/// Card definitions
/// </summary>
private const string PROD_DESCR_0 = "3000 CANDLEPOWER PLASMA FLASHLIGHT";
private const string PROD_ITEM_0 = "SG999999";
private const long PROD_PRICE_0 = 68990;
private const long PROD_QUANT_0 = 2;
private const string PROD_TYPE_0 = "SPORTING_GOODS";
/// <summary>
/// Shipping Address Recipient address - Line 1
/// </summary>
private const string S2A1 = "567 West S2A1 Court North";
/// <summary>
/// Shipping Recipient street address - Line 2
/// </summary>
private const string S2A2 = "";
/// <summary>
/// Shipping Address Recipient - Counry Code
/// </summary>
private const string S2CC = "US";
/// <summary>
/// Shipping Address Recipient - City
/// </summary>
private const string S2CI = "Gnome";
/// <summary>
/// Shipping Address - Email address of Recipient
/// </summary>
private const string S2EM = "[email protected]";
/// <summary>
/// Shipping Address - Name of Recipient
/// </summary>
private const string S2NM = "SdkShipToFN SdkShipToLN";
/// <summary>
/// Shipping Address Recipient - Postal Code
/// </summary>
private const string S2PC = "99762";
/// <summary>
/// Shipping Address Recipient - Phone Number
/// </summary>
private const string S2PN = "555-777-1212";
/// <summary>
/// Shipping Address Recipient - State/Province
/// </summary>
private const string S2ST = "AK";
/// <summary>
/// Name of Web site
/// </summary>
private const string SITE = "DEFAULT";
/// <summary>
/// Total amount in currency submitted in lowest currency factor
/// </summary>
private const int TOTL = 123456;
/// <summary>
/// Create inquiry
/// </summary>
/// <param name="cardNumber">card number</param>
/// <param name="sid">session id</param>
/// <param name="orderNum">order number</param>
/// <returns>inquiry</returns>
public static Inquiry CreateInquiry(string cardNumber, out string sid, out string orderNum)
{
Inquiry inquiry = DefaultInquiry(out sid, out orderNum);
inquiry.SetCardPayment(cardNumber);
return inquiry;
}
/// <summary>
/// Create masked inquiry
/// </summary>
/// <param name="cardNumber">card number</param>
/// <param name="sid">session id</param>
/// <param name="orderNum">order number</param>
/// <returns>masked inquiry</returns>
public static Inquiry CreateInquiryMasked(string cardNumber, out string sid, out string orderNum)
{
Inquiry inquiry = DefaultInquiry(out sid, out orderNum);
inquiry.SetCardPaymentMasked(cardNumber);
return inquiry;
}
/// <summary>
/// Create inquiry with default settings
/// </summary>
/// <param name="sid">session id</param>
/// <param name="orderNum">order number</param>
/// <returns>inquiry with default settings</returns>
public static Inquiry DefaultInquiry(out string sid, out string orderNum)
{
Inquiry inquiry = new Inquiry();
inquiry.SetMerchantId(TEST_MERCHANT_ID); // 999666
inquiry.SetApiKey(TEST_API_KEY);
sid = Guid.NewGuid().ToString().Replace("-", String.Empty);
inquiry.SetSessionId(sid);
var uniq = sid.Substring(0, 20); //Fist 20 chars from sid
orderNum = uniq.Substring(0, 10);
inquiry.SetUnique(uniq);
inquiry.SetOrderNumber(orderNum);
inquiry.SetName(NAME);
inquiry.SetEmail(EMAIL);
//set billing address
inquiry.SetBillingAddress(B2A1, B2A2, B2CI, B2ST, B2PC, B2CC);
inquiry.SetBillingPhoneNumber(B2PN);
//set shipping address
inquiry.SetShippingAddress(S2A1, S2A2, S2CI, S2ST, S2PC, S2CC);
inquiry.SetShippingPhoneNumber(S2PN);
inquiry.SetMode(MODE);
inquiry.SetTotal(TOTL);
inquiry.SetCash(CASH);
inquiry.SetIpAddress(IPAD);
inquiry.SetMack(MACK);
inquiry.SetAuth(AUTH);
inquiry.SetAvst(AVST);
inquiry.SetAvsz(AVSZ);
inquiry.SetCvvr(CVVR);
inquiry.SetWebsite(SITE);
inquiry.SetCurrency(CURR);
return inquiry;
}
}
- Home
- Installation
- Adding Configuration
-
Making Your First Call
- [[
C#
Example for RIS | Making-First-Call#c-example-for-ris ]] - Explanation
- [[
- Response description
- SDK Integration Tests
- Connection Troubleshooting