public void CreateSimplePaymentRequestWithCardHolderData() { PaymentRequestRequest paymentRequest = new PaymentRequestRequest() { Terminal = GatewayConstants.terminal, ShopOrderId = "payment-req-" + Guid.NewGuid().ToString(), Amount = Amount.Get(42.34, Currency.EUR), CustomerInfo = { CardHolder = new CardHolderData { Name = "Test Cardholder", Email = "*****@*****.**", HomePhone = "00011122", WorkPhone = "00011133", MobilePhone = "00011144" } } }; PaymentRequestResult result = _api.CreatePaymentRequest(paymentRequest); Assert.AreEqual(Result.Success, result.Result); Assert.IsNotEmpty(result.PaymentRequestId); //System.Diagnostics.Process.Start(result.Url); }
public void DoNotSendBothTaxAmountAndTaxPercent() { PaymentRequestRequest paymentRequest = new PaymentRequestRequest() { Terminal = GatewayConstants.terminal, ShopOrderId = "payment-req-" + Guid.NewGuid().ToString(), Amount = Amount.Get(5056.93, Currency.EUR), Type = AuthType.payment, // Orderlines OrderLines = { new PaymentOrderLine() { Description = "The Item Desc", ItemId = "itemId1", Quantity = 10, TaxPercent = 10, UnitCode = "unitCode", UnitPrice = 500, Discount = 0.00, GoodsType = GoodsType.Item, }, } }; // And make the actual invocation. PaymentRequestResult result = _api.CreatePaymentRequest(paymentRequest); Assert.AreEqual(null, result.ResultMerchantMessage); Assert.AreEqual(Result.Success, result.Result); Assert.IsNotEmpty(result.Url); Assert.IsNotEmpty(result.DynamicJavascriptUrl); Assert.IsNotEmpty(result.PaymentRequestId); }
[Test] // Not really a unit test, just a Klarna calling example public static void Main() { String orderId = "Example_Klarna_" + new Random().Next(); CustomerAddress address = new CustomerAddress { Address = "Sæffleberggate 56,1 mf", City = "Varde", Country = "DK", Firstname = "Testperson-dk", Lastname = "Approved", Region = "DK", PostalCode = "6800" }; PaymentRequestRequest request = new PaymentRequestRequest { ShopOrderId = orderId, Terminal = "AltaPay Klarna DK", Amount = Amount.Get(5.5, Currency.DKK), Type = AuthType.payment, CustomerInfo = new CustomerInfo { Email = "*****@*****.**", Username = "******", CustomerPhone = "20123456", BankName = "My Bank", BankPhone = "+45 12-34 5678", BillingAddress = address, ShippingAddress = address } }; request.OrderLines = new List <PaymentOrderLine> { new PaymentOrderLine { Description = "description 1", ItemId = "id 01", Quantity = 1, UnitPrice = 1.1, GoodsType = GoodsType.Item }, new PaymentOrderLine { Description = "description 2", ItemId = "id 02", Quantity = 2, UnitPrice = 2.2, GoodsType = GoodsType.Item } }; PaymentRequestResult result = _api.CreatePaymentRequest(request); // Access the url below and use the social security number 0801363945 in the page form to complete the Klarna order System.Console.WriteLine(result.Url); }
/// <summary> /// Example for performing simple create payment request with Agreement. /// </summary> public void CreateSimplePaymentRequestWithAgreement() { //dedicated terminal on the gateway string terminal = "AltaPay Dev Terminal"; //Instantiation of the payment request class //this class is used for forwarding all the data needed for create payment request //For simple payment request required properties to be set are gateway terminal, shop order ID //and amount along with currency PaymentRequestRequest paymentRequest = new PaymentRequestRequest { Terminal = terminal, ShopOrderId = "AGREEMENTS_UI_csharp_example_payment-req-" + Guid.NewGuid().ToString(), Amount = Amount.Get(777.77, Currency.EUR), //set the properties for redirection URLs //where user should be redirected after submitting payment on the gateway Config = new PaymentRequestConfig { CallbackFormUrl = "http://demoshop.pensio.com/Form", CallbackOkUrl = "http://demoshop.pensio.com/Ok", CallbackFailUrl = "http://demoshop.pensio.com/Fail", CallbackRedirectUrl = "http://demoshop.pensio.com/Redirect", CallbackNotificationUrl = "http://demoshop.pensio.com/Notification", CallbackOpenUrl = "http://demoshop.pensio.com/Open", CallbackVerifyOrderUrl = "http://demoshop.pensio.com/VerifyOrder" }, AgreementConfig = new AgreementConfig { AgreementType = AgreementType.unscheduled, AgreementUnscheduledType = AgreementUnscheduledType.incremental } }; //execute create payment method PaymentRequestResult paymentRequestResult = _api.CreatePaymentRequest(paymentRequest); //Result property contains information if the request was successful or not if (paymentRequestResult.Result == Result.Success) { //URL to the payment form page to redirect user string paymentFormURL = paymentRequestResult.Url; //Payment request ID returned from the gateway string paymentRequestId = paymentRequestResult.PaymentRequestId; } else { //error messages contain information about what went wrong string errorMerchantMessage = paymentRequestResult.ResultMerchantMessage; string errorMessage = paymentRequestResult.ResultMessage; } }
public System.Threading.Tasks.Task <PaymentRequestResponse> PaymentRequestAsync(string MerchantID, int Amount, string Description, string Email, string Mobile, string CallbackURL) { PaymentRequestRequest inValue = new PaymentRequestRequest(); inValue.Body = new PaymentRequestRequestBody(); inValue.Body.MerchantID = MerchantID; inValue.Body.Amount = Amount; inValue.Body.Description = Description; inValue.Body.Email = Email; inValue.Body.Mobile = Mobile; inValue.Body.CallbackURL = CallbackURL; return(((PaymentGatewayImplementationServicePortType)(this)).PaymentRequestAsync(inValue)); }
public int PaymentRequest(string MerchantID, int Amount, string Description, string Email, string Mobile, string CallbackURL, out string Authority) { PaymentRequestRequest inValue = new PaymentRequestRequest(); inValue.Body = new PaymentRequestRequestBody(); inValue.Body.MerchantID = MerchantID; inValue.Body.Amount = Amount; inValue.Body.Description = Description; inValue.Body.Email = Email; inValue.Body.Mobile = Mobile; inValue.Body.CallbackURL = CallbackURL; PaymentRequestResponse retVal = ((PaymentGatewayImplementationServicePortType)(this)).PaymentRequest(inValue); Authority = retVal.Body.Authority; return(retVal.Body.Status); }
private PaymentRequestRequest GetPaymentRequestRequest(PaymentRequestConfig requestConfig) { var request = new PaymentRequestRequest() { Body = new PaymentRequestRequestBody() { Amount = requestConfig.Amount, CallbackURL = callbackURL, Description = requestConfig.Name, Email = requestConfig.Email, MerchantID = merchantId, Mobile = requestConfig.PhoneNumber } }; return(request); }
public void CreateSimplePaymentRequest() { PaymentRequestRequest paymentRequest = new PaymentRequestRequest() { Terminal = GatewayConstants.terminal, ShopOrderId = "payment-req-" + Guid.NewGuid().ToString(), Amount = Amount.Get(42.34, Currency.EUR), }; PaymentRequestResult result = _api.CreatePaymentRequest(paymentRequest); Assert.AreEqual(null, result.ResultMerchantMessage); Assert.AreEqual(Result.Success, result.Result); Assert.IsNotEmpty(result.Url); Assert.IsNotEmpty(result.DynamicJavascriptUrl); Assert.IsNotEmpty(result.PaymentRequestId); //System.Diagnostics.Process.Start(result.Url); }
public void CreateSimplePaymentsRequestWithAgreement() { AgreementConfig agreementConfig = new AgreementConfig(); agreementConfig.AgreementType = AgreementType.unscheduled; agreementConfig.AgreementUnscheduledType = AgreementUnscheduledType.incremental; PaymentRequestRequest paymentRequest = new PaymentRequestRequest() { Terminal = GatewayConstants.terminal, ShopOrderId = "IT_AGREEMENT_UI_payment-req-" + Guid.NewGuid().ToString(), Amount = Amount.Get(77.77, Currency.EUR), AgreementConfig = agreementConfig, }; PaymentRequestResult result = _api.CreatePaymentRequest(paymentRequest); Assert.AreEqual(null, result.ResultMerchantMessage); Assert.AreEqual(Result.Success, result.Result); Assert.IsNotEmpty(result.Url); Assert.IsNotEmpty(result.DynamicJavascriptUrl); Assert.IsNotEmpty(result.PaymentRequestId); }
System.Threading.Tasks.Task <PaymentRequestResponse> PaymentGatewayImplementationServicePortType.PaymentRequestAsync(PaymentRequestRequest request) { return(base.Channel.PaymentRequestAsync(request)); }
PaymentRequestResponse PaymentGatewayImplementationServicePortType.PaymentRequest(PaymentRequestRequest request) { return(base.Channel.PaymentRequest(request)); }
public void CreateComplexPaymentRequest() { PaymentRequestRequest paymentRequest = new PaymentRequestRequest() { Terminal = GatewayConstants.terminal, ShopOrderId = "payment-req-" + Guid.NewGuid().ToString(), Amount = Amount.Get(5056.93, Currency.EUR), FraudService = FraudService.Test, // All the callback configs Config = new PaymentRequestConfig() { CallbackFormUrl = "http://demoshop.pensio.com/Form", CallbackOkUrl = "http://demoshop.pensio.com/Ok", CallbackFailUrl = "http://demoshop.pensio.com/Fail", CallbackRedirectUrl = "http://demoshop.pensio.com/Redirect", CallbackNotificationUrl = "http://demoshop.pensio.com/Notification", CallbackOpenUrl = "http://demoshop.pensio.com/Open", CallbackVerifyOrderUrl = "http://demoshop.pensio.com/VerifyOrder" }, // Customer Data CustomerInfo = { Email = "*****@*****.**", Username = "******", CustomerPhone = "+4512345678", BankName = "Gotham Bank", BankPhone = "666 666 666", BirthDate = DateTime.Now, BillingAddress = new CustomerAddress() { Address = "101 Night Street", City = "Gotham City", Country = "US", Firstname = "Bruce", Lastname = "Wayne", Region = "Dark Region", }, ShippingAddress = new CustomerAddress() { Address = "42 Joker Avenue", City = "Big Smile City", Country = "FI", Firstname = "Jack", Lastname = "Napier", Region = "Umbrella Neighbourhood", } }, // Many other optional parameters CustomerCreatedDate = "2010-12-24", Cookie = "thecookie=isgood", //CreditCardToken = "424242424242424242424242", Language = "fr", OrganisationNumber = "Orgnumber42", SalesInvoiceNumber = "87654321", SalesReconciliationIdentifier = "sales_recon_id", SalesTax = 56.93, ShippingType = ShippingType.Military, AccountOffer = AccountOffer.disabled, Type = AuthType.payment, // Orderlines OrderLines = { new PaymentOrderLine() { Description = "The Item Desc", ItemId = "itemId1", Quantity = 10, TaxPercent = 10, UnitCode = "unitCode", UnitPrice = 500, Discount = 0.00, GoodsType = GoodsType.Item, }, }, // Payment Infos PaymentInfos = { { "auxinfo1", "auxvalue1" }, }, }; // And make the actual invocation. PaymentRequestResult result = _api.CreatePaymentRequest(paymentRequest); Assert.AreEqual(null, result.ResultMerchantMessage); Assert.AreEqual(Result.Success, result.Result); Assert.IsNotEmpty(result.Url); Assert.IsNotEmpty(result.DynamicJavascriptUrl); Assert.IsNotEmpty(result.PaymentRequestId); // System.Diagnostics.Process.Start(result.Url); }
public void CreateVippsPaymentRequest() { PaymentRequestRequest paymentRequest = new PaymentRequestRequest() { Terminal = GatewayConstants.terminal, //ShopOrderId = "payment-req-" + Guid.NewGuid().ToString(), ShopOrderId = "11", Amount = Amount.Get(700.00, Currency.DKK), FraudService = FraudService.Test, // All the callback configs Config = new PaymentRequestConfig() { CallbackFormUrl = "https://www.sdvinternal.dk/paymentform?OkRedirectUrl=https://www.sdvinternal.dk/order-confirmation&FailRedirectUrl=https://www.sdvinternal.dk/error&CheckoutRedirectUrl=https://www.sdvinternal.dk/checkout", CallbackOkUrl = "https://sdv-webapp-payment-callback-api-dev.azurewebsites.net/api/ok?OkRedirectUrl=https://www.sdvinternal.dk/order-confirmation&FailRedirectUrl=https://www.sdvinternal.dk/error&CheckoutRedirectUrl=https://www.sdvinternal.dk/checkout", CallbackFailUrl = "https://sdv-webapp-payment-callback-api-dev.azurewebsites.net/api/fail?OkRedirectUrl=https://www.sdvinternal.dk/order-confirmation&FailRedirectUrl=https://www.sdvinternal.dk/error&CheckoutRedirectUrl=https://www.sdvinternal.dk/checkout", CallbackRedirectUrl = "http://demoshop.pensio.com/Redirect", CallbackNotificationUrl = "https://sdv-webapp-payment-callback-api-dev.azurewebsites.net/api/notify?OkRedirectUrl=https://www.sdvinternal.dk/order-confirmation&FailRedirectUrl=https://www.sdvinternal.dk/error&CheckoutRedirectUrl=https://www.sdvinternal.dk/checkout", CallbackOpenUrl = "https://sdv-webapp-payment-callback-api-dev.azurewebsites.net/api/open?OkRedirectUrl=https://www.sdvinternal.dk/order-confirmation&FailRedirectUrl=https://www.sdvinternal.dk/error&CheckoutRedirectUrl=https://www.sdvinternal.dk/checkout", CallbackVerifyOrderUrl = "http://demoshop.pensio.com/VerifyOrder" }, // Customer Data CustomerInfo = { Email = "*****@*****.**", CustomerPhone = "73577357", BirthDate = DateTime.Now, /*BillingAddress = new CustomerAddress() { * Address = "101 Night Street", * City = "Gotham City", * Country = "US", * Firstname = "Bruce", * Lastname = "Wayne", * Region = "Dark Region", * }, * * ShippingAddress = new CustomerAddress() { * Address = "42 Joker Avenue", * City = "Big Smile City", * Country = "FI", * Firstname = "Jack", * Lastname = "Napier", * Region = "Umbrella Neighbourhood", * }*/ }, // Many other optional parameters CustomerCreatedDate = "2019-06-06", Language = "da", SalesTax = 0.00, ShippingType = ShippingType.Military, Type = AuthType.payment, // Orderlines /*OrderLines = { * new PaymentOrderLine() { * Description = "The Item Desc", * ItemId = "itemId1", * Quantity = 10, * TaxPercent = 10, * UnitCode = "unitCode", * UnitPrice = 500, * Discount = 0.00, * GoodsType = GoodsType.Item, * }, * }*/ }; // And make the actual invocation. PaymentRequestResult result = _api.CreatePaymentRequest(paymentRequest); Assert.AreEqual(null, result.ResultMerchantMessage); Assert.AreEqual(Result.Success, result.Result); Assert.IsNotEmpty(result.Url); Assert.IsNotEmpty(result.DynamicJavascriptUrl); Assert.IsNotEmpty(result.PaymentRequestId); System.Diagnostics.Process.Start(result.Url); }
/// <summary> /// Example for performing complex create payment request. /// </summary> public void CreateComplexPaymentRequest() { //dedicated terminal on the gateway string terminal = "AltaPay Dev Terminal"; CustomerInfo customerInfo = new CustomerInfo { Email = "*****@*****.**", Username = "******", CustomerPhone = "+4512345678", BankName = "Example Bank", BankPhone = "+4511122356", BillingAddress = new CustomerAddress { Address = "Skole Allé 63", City = "København K", Country = "DK", Firstname = "John", Lastname = "Doe", Region = "Region Sjælland", PostalCode = "1406" }, ShippingAddress = new CustomerAddress { Address = "Skole Allé 63", City = "København K", Country = "DK", Firstname = "John", Lastname = "Doe", Region = "Region Sjælland", }, CardHolder = new CardHolderData { Name = "Test cardholder name", Email = "*****@*****.**", HomePhone = "0012345678", MobilePhone = "0001234567", WorkPhone = "0123456789" } }; //initialize orderlines List <PaymentOrderLine> orderLines = new List <PaymentOrderLine> { new PaymentOrderLine() { Description = "The Item Desc", ItemId = "itemId1", Quantity = 10, TaxPercent = 10, UnitCode = "unitCode", UnitPrice = 500, Discount = 0.00, GoodsType = GoodsType.Item, ProductUrl = "product/path/product.html", } }; //Instantiation of the payment request class //this class is used for forwarding all the data needed for create payment request PaymentRequestRequest paymentRequest = new PaymentRequestRequest() { Terminal = terminal, ShopOrderId = "payment-req-" + Guid.NewGuid().ToString(), Amount = Amount.Get(5056.93, Currency.EUR), FraudService = FraudService.Test, Source = PaymentSource.eCommerce, Config = new PaymentRequestConfig() { CallbackFormUrl = "http://demoshop.pensio.com/Form", CallbackOkUrl = "http://demoshop.pensio.com/Ok", CallbackFailUrl = "http://demoshop.pensio.com/Fail", CallbackRedirectUrl = "http://demoshop.pensio.com/Redirect", CallbackNotificationUrl = "http://demoshop.pensio.com/Notification", CallbackOpenUrl = "http://demoshop.pensio.com/Open", CallbackVerifyOrderUrl = "http://demoshop.pensio.com/VerifyOrder" }, // Customer Data CustomerInfo = customerInfo, CustomerCreatedDate = "2017-11-16", Cookie = "thecookie=isgood", Language = "en", OrganisationNumber = "Orgnumber42", SalesInvoiceNumber = "87654321", SalesReconciliationIdentifier = "sales_recon_id", SalesTax = 56.93, ShippingType = ShippingType.TwoDayService, AccountOffer = AccountOffer.disabled, Type = AuthType.payment, // Orderlines OrderLines = orderLines, // Payment Infos PaymentInfos = { { "auxinfo1", "auxvalue1" }, }, }; //execute create payment method PaymentRequestResult paymentRequestResult = _api.CreatePaymentRequest(paymentRequest); //Result property contains information if the request was successful or not if (paymentRequestResult.Result == Result.Success) { //URL to the payment form page to redirect user string paymentFormURL = paymentRequestResult.Url; //Payment request ID returned from the gateway string paymentRequestId = paymentRequestResult.PaymentRequestId; } else { //error messages contain information about what went wrong string errorMerchantMessage = paymentRequestResult.ResultMerchantMessage; string errorMessage = paymentRequestResult.ResultMessage; } }