public static void PreCheckoutQueryTest() { //field class ShippingAddressInfo const string countryCode = "AW"; const string state = "TestState"; const string city = "TestCity"; const string streetLineOne = "TestStreetLineOne"; const string streetLineTwo = "TestStreetLineTwo"; const string postCode = "TestPostCode"; JObject shippingAddress = ShippingAddressInfoObject.GetObject(countryCode, state, city, streetLineOne, streetLineTwo, postCode); //field class OrederInfo const string name = "TestName"; const string phoneNumber = "TestPhoneNumber"; const string email = "TestEmail"; const int totalAmmount = 123; const string shippingOptionId = "TestShippingId"; JObject orderInfo = OrderInfoObject.GetObject(name, phoneNumber, email, shippingAddress); //field class PreCheckoutQueryInfo const string preCheckoutId = "TestId"; const string currency = "USD"; const string invoicePayload = "TestInvoicePayload"; JObject preCheckoutQueryInfo = PreCheckoutQueryInfoObject.GetObject( preCheckoutId, MCommonUserInfo, currency, totalAmmount, invoicePayload, shippingOptionId, orderInfo); //field class UpdateInfo const int updateId = 123; JObject updateInfoObject = UpdateInfoObject.GetObject(updateId, preCheckoutQuery: preCheckoutQueryInfo); UpdateInfo updateInfo = new UpdateInfo(updateInfoObject); //filed PreCheckoutQuery Assert.AreEqual(updateId, updateInfo.UpdateId); Assert.AreEqual(preCheckoutId, updateInfo.PreCheckoutQuery.Id); Assert.AreEqual(invoicePayload, updateInfo.PreCheckoutQuery.InvoicePayload); Assert.AreEqual(shippingOptionId, updateInfo.PreCheckoutQuery.ShippingOptionId); //filed UserInfo AssertUserInfo(updateInfo.PreCheckoutQuery.From); //field OrderInfo Assert.AreEqual(name, updateInfo.PreCheckoutQuery.OrderInfo.Name); Assert.AreEqual(phoneNumber, updateInfo.PreCheckoutQuery.OrderInfo.PnoneNumber); Assert.AreEqual(email, updateInfo.PreCheckoutQuery.OrderInfo.Email); //field ShippingAddress Assert.AreEqual(countryCode.ToEnum <Countries>(), updateInfo.PreCheckoutQuery.OrderInfo.ShippingAddress.CountryCode); Assert.AreEqual(state, updateInfo.PreCheckoutQuery.OrderInfo.ShippingAddress.State); Assert.AreEqual(city, updateInfo.PreCheckoutQuery.OrderInfo.ShippingAddress.City); Assert.AreEqual(streetLineOne, updateInfo.PreCheckoutQuery.OrderInfo.ShippingAddress.StreetLineOne); Assert.AreEqual(streetLineTwo, updateInfo.PreCheckoutQuery.OrderInfo.ShippingAddress.StreetLineTwo); Assert.AreEqual(postCode, updateInfo.PreCheckoutQuery.OrderInfo.ShippingAddress.PostCode); }
public static void MessageInfoSuccessfulPaymentTest() { //SuccessfulPaymentInfo field const string currency = "USD"; const int totalAmount = 123; const string invoicePayload = "TestInvoicePayload"; const string shippingOptionId = "TestShippingOptionId"; const string telegramPaymentChargeId = "TestTelegramPaymentChargeId"; const string providerPaymentChargeId = "TestProviderPaymentChargeId"; //OrderInfo fields const string name = "TestName"; const string phoneNumber = "123456789"; const string email = "test@email"; //ShippingAddressInfo fields const string countryCode = "US"; const string state = "TestState"; const string city = "TestCity"; const string streetLineOne = "TestStreetLineOne"; const string streetLineTwo = "TestStreetLineTwo"; const string postCode = "TestPostCode"; JObject shippingAddress = ShippingAddressInfoObject.GetObject(countryCode, state, city, streetLineOne, streetLineTwo, postCode); JObject orderInfo = OrderInfoObject.GetObject(name, phoneNumber, email, shippingAddress); dynamic messageSuccessfulPayment = MCommonMandatoryFieldsMessageInfo; messageSuccessfulPayment.successful_payment = SuccessfulPaymentInfoObject.GetObject(currency, totalAmount, invoicePayload, shippingOptionId, orderInfo, telegramPaymentChargeId, providerPaymentChargeId); MessageInfo messageInfo = new MessageInfo(messageSuccessfulPayment); Assert.Multiple(() => { //SuccessfulPaymentInfo field Assert.AreEqual(Currency.USD, messageInfo.SuccessfulPayment.Currency); Assert.AreEqual(totalAmount, messageInfo.SuccessfulPayment.TotalAmmount); Assert.AreEqual(invoicePayload, messageInfo.SuccessfulPayment.InvoicePayload); Assert.AreEqual(shippingOptionId, messageInfo.SuccessfulPayment.ShippingOptionId); Assert.AreEqual(telegramPaymentChargeId, messageInfo.SuccessfulPayment.TelegramPaymentChargeId); Assert.AreEqual(providerPaymentChargeId, messageInfo.SuccessfulPayment.ProviderPaymentChargeId); //OrderInfo fields Assert.AreEqual(name, messageInfo.SuccessfulPayment.OrderInfo.Name); Assert.AreEqual(phoneNumber, messageInfo.SuccessfulPayment.OrderInfo.PnoneNumber); Assert.AreEqual(email, messageInfo.SuccessfulPayment.OrderInfo.Email); //ShippingAddressInfo fields Assert.AreEqual(Countries.US, messageInfo.SuccessfulPayment.OrderInfo.ShippingAddress.CountryCode); Assert.AreEqual(state, messageInfo.SuccessfulPayment.OrderInfo.ShippingAddress.State); Assert.AreEqual(city, messageInfo.SuccessfulPayment.OrderInfo.ShippingAddress.City); Assert.AreEqual(streetLineOne, messageInfo.SuccessfulPayment.OrderInfo.ShippingAddress.StreetLineOne); Assert.AreEqual(streetLineTwo, messageInfo.SuccessfulPayment.OrderInfo.ShippingAddress.StreetLineTwo); Assert.AreEqual(postCode, messageInfo.SuccessfulPayment.OrderInfo.ShippingAddress.PostCode); }); }