Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: bash docker-build-script.sh
working-directory: docker

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: Package
path: dist/
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public void CreateComplexPaymentRequest()
ShippingType = ShippingType.Military,
AccountOffer = AccountOffer.disabled,
Type = AuthType.payment,

FormTemplate = "form_checkout",

// Orderlines
OrderLines = {
Expand Down Expand Up @@ -241,7 +241,7 @@ public void CreateVippsPaymentRequest()
{
PaymentRequestRequest paymentRequest = new PaymentRequestRequest() {
Terminal = GatewayConstants.vippsTerminal,
ShopOrderId = "payment-req-" + Guid.NewGuid().ToString(),
ShopOrderId = "payment-req-vipps-" + Guid.NewGuid().ToString(),
Amount = Amount.Get(700.00, Currency.NOK),
FraudService = FraudService.Test,
// All the callback configs
Expand All @@ -258,7 +258,7 @@ public void CreateVippsPaymentRequest()

// Customer Data
CustomerInfo = {
Email = "testValitor@impact.dk",
Email = "testAltapay@impact.dk",
CustomerPhone = "73577357",
BirthDate = DateTime.Now,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ public void CreditWithCardDataAndTransactionInfo()

IDictionary <string, object> TransactionInfo = new Dictionary<string, object>();
TransactionInfo.Add("sdkName", "sdk-csharp");
TransactionInfo.Add("sdkVersion","1.2.4");
TransactionInfo.Add("sdkVersion","1.2.5");

var request = new CreditRequest
{
Expand Down
4 changes: 2 additions & 2 deletions AltaPayApi/AltaPayApi.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.4")]
[assembly: AssemblyFileVersion("1.2.4")]
[assembly: AssemblyVersion("1.2.5")]
[assembly: AssemblyFileVersion("1.2.5")]
4 changes: 3 additions & 1 deletion AltaPayApi/AltaPayApi/AltaPayApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@
<Compile Include="Service\Results\CardWalletAuthorizeResult.cs" />
<Compile Include="Service\Requests\CalculateSurchargeRequest.cs" />
<Compile Include="Service\Results\CalculateSurchargeResult.cs" />
<Compile Include="Service\Requests\Common\RecipientInfo.cs" />
<Compile Include="Service\Requests\Common\Gender.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand All @@ -143,4 +145,4 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>
</Project>
4 changes: 2 additions & 2 deletions AltaPayApi/AltaPayApi/Properties/SdkVersion.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

using System;
using System.Reflection;
[assembly: AssemblyVersion("1.2.4")]
[assembly: AssemblyFileVersion("1.2.4")]
[assembly: AssemblyVersion("1.2.5")]
[assembly: AssemblyFileVersion("1.2.5")]
6 changes: 5 additions & 1 deletion AltaPayApi/AltaPayApi/Service/MerchantApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,14 @@ public PaymentRequestResult CreatePaymentRequest(PaymentRequestRequest request)
parameters.Add("organisation_number", request.OrganisationNumber);
parameters.Add("account_offer", request.AccountOffer);
parameters.Add("payment_source", request.Source);
parameters.Add ("form_template", request.FormTemplate);

// Customer Info
parameters.Add("customer_info", request.CustomerInfo.AddToDictionary(new Dictionary<string, object>()));

// Recipient Info
parameters.Add ("recipient_info", request.RecipientInfo.AddToDictionary (new Dictionary<string, object> ()));

// Order lines
parameters = getOrderLines(parameters, request.OrderLines);

Expand Down Expand Up @@ -708,7 +712,7 @@ private string GetSdkVersion()
}
else
{
_sdkVersion = "1.2.4";
_sdkVersion = "1.2.5";
}

return _sdkVersion;
Expand Down
4 changes: 4 additions & 0 deletions AltaPayApi/AltaPayApi/Service/Requests/Common/CustomerInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ public class CustomerInfo
{
public string Email { get; set; }
public string Username { get; set; }
public string AccountIdentifier { get; set; }
public string CustomerPhone { get; set; }
public string BankName { get; set; }
public string BankPhone { get; set; }
public CustomerAddress BillingAddress { get; set; }
public CustomerAddress ShippingAddress { get; set; }
public CardHolderData CardHolder { get; set; }
public DateTime BirthDate { get; set; }
public Gender Gender { get; set; }
public string ClientSessionId { get; set; }
public string ClientAcceptLanguage { get; set; }
public string ClienUserAgent { get; set; }
Expand All @@ -31,12 +33,14 @@ public Dictionary<string,object> AddToDictionary(Dictionary<string,object> param
{
parameters.Add("email", Email); //The customer's email address. string
parameters.Add("username", Username); //The customer's e-shop username. string
parameters.Add ("account_identifier", AccountIdentifier); //The customer's account identifier. It can be name of customer's account or pan. string
parameters.Add("customer_phone", CustomerPhone); //The customer's telephone number. string
parameters.Add("bank_name", BankName); //The name of the bank where the credit card was issued. string
parameters.Add("bank_phone", BankPhone); //The phone number of the bank where the credit card was issued. String
if (BirthDate.Ticks != 0) {
parameters.Add ("birthdate", BirthDate.ToString ("yyyy-MM-dd")); //The customer's birth date in format yyyy-MM-dd
}
parameters.Add ("gender", Gender.ToString ().ToLower ()); //Gender of the recipient.FMmalefemale
parameters.Add("billing_firstname", BillingAddress.Firstname); //The first name for the customer's billing address. String
parameters.Add("billing_lastname", BillingAddress.Lastname); //The last name for the customer's billing address. String
parameters.Add("billing_city", BillingAddress.City); //The city of the customer's billing address. string
Expand Down
13 changes: 13 additions & 0 deletions AltaPayApi/AltaPayApi/Service/Requests/Common/Gender.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;

namespace AltaPay.Service
{
public enum Gender
{
F,
M,
male,
female
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ public class PaymentRequestRequest : BasePaymentRequestRequest
public string SalesReconciliationIdentifier { get; set; }
public string SalesInvoiceNumber { get; set; }
public double SalesTax { get; set; }
public string FormTemplate { get; set; }
public CustomerInfo CustomerInfo { get; set; }
public RecipientInfo RecipientInfo { get; set; }
/// <summary>
/// This will be changed to DateTime at some point.
/// </summary>
Expand All @@ -26,6 +28,7 @@ public class PaymentRequestRequest : BasePaymentRequestRequest
public PaymentRequestRequest()
{
CustomerInfo = new CustomerInfo();
RecipientInfo = new RecipientInfo();
OrderLines = new List<PaymentOrderLine>();
}
}
Expand Down
55 changes: 55 additions & 0 deletions AltaPayApi/AltaPayApi/Service/Requests/Common/RecipientInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using AltaPay.Service.Dto;


namespace AltaPay.Service
{
public class RecipientInfo
{
public string Email { get; set; }
public string Username { get; set; }
public string AccountIdentifier { get; set; }
public string CustomerPhone { get; set; }
public CustomerAddress BillingAddress { get; set; }
public CustomerAddress ShippingAddress { get; set; }
public DateTime BirthDate { get; set; }
public Gender Gender { get; set; }

public RecipientInfo ()
{
BillingAddress = new CustomerAddress ();
ShippingAddress = new CustomerAddress ();
}

public Dictionary<string, object> AddToDictionary (Dictionary<string, object> parameters)
{
parameters.Add ("email", Email); //The recipient's email address. string
parameters.Add ("username", Username); //The recipient's e-shop username. string
parameters.Add ("account_identifier", AccountIdentifier); //The recipient's account identifier. It can be name of customer's account or pan. string
parameters.Add ("customer_phone", CustomerPhone); //The recipient's telephone number. string
if (BirthDate.Ticks != 0) {
parameters.Add ("birthdate", BirthDate.ToString ("yyyy-MM-dd")); //The recipient's birth date in format yyyy-MM-dd
}
parameters.Add ("gender", Gender.ToString ().ToLower ()); //Gender of the recipient.FMmalefemale
parameters.Add ("billing_firstname", BillingAddress.Firstname); //The first name for the recipient's billing address. String
parameters.Add ("billing_lastname", BillingAddress.Lastname); //The last name for the recipient's billing address. String
parameters.Add ("billing_city", BillingAddress.City); //The city of the recipient's billing address. string
parameters.Add ("billing_region", BillingAddress.Region); //The region of the recipient's billing address. string
parameters.Add ("billing_postal", BillingAddress.PostalCode); //The postal code of the recipient's billing address. string
parameters.Add ("billing_country", BillingAddress.Country); //The country of the recipient's billing address as a 2 character ISO-3166 country code. [a-zA-Z]{2}
parameters.Add ("billing_address", BillingAddress.Address); //The street address of the recipient's billing address. string

parameters.Add ("shipping_firstname", ShippingAddress.Firstname); //The first name for the recipient's shipping address. String
parameters.Add ("shipping_lastname", ShippingAddress.Lastname); //The last name for the recipient's shipping address. String
parameters.Add ("shipping_address", ShippingAddress.Address); //The street address of the recipient's shipping address. string
parameters.Add ("shipping_city", ShippingAddress.City); //The city of the recipient's shipping address. string
parameters.Add ("shipping_region", ShippingAddress.Region); //The region of the recipient's shipping address. string
parameters.Add ("shipping_postal", ShippingAddress.PostalCode); //The postal code of the recipient's shipping address. string
parameters.Add ("shipping_country", ShippingAddress.Country); //The country of the recipient's shipping address as a 2 character ISO-3166 country code. [a-zA-Z]{2}

return parameters;
}
}
}

43 changes: 39 additions & 4 deletions AltaPayApi/Examples/CreatePaymentRequestExamples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public void CreateSimplePaymentRequest()
CallbackOpenUrl = "http://demoshop.pensio.com/Open",
CallbackVerifyOrderUrl = "http://demoshop.pensio.com/VerifyOrder",
CallbackMobileAppRedirectUrl = "http://demoshop.pensio.com/MobileAppRedirect"
}
},
FormTemplate = "form_checkout",

};

Expand Down Expand Up @@ -88,14 +89,17 @@ public void CreateComplexPaymentRequest()
//dedicated terminal on the gateway
string terminal = "AltaPay Dev Terminal";

CustomerInfo customerInfo = new CustomerInfo
CustomerInfo customerInfo = new CustomerInfo
{
Email = "johndoe@example.com",
Username = "johndoe",
CustomerPhone = "+4512345678",
AccountIdentifier = "myAccount",
CustomerPhone = "+4512345678",
BankName = "Example Bank",
BankPhone = "+4511122356",
BillingAddress = new CustomerAddress
BirthDate = DateTime.Parse ("2000-01-01"),
Gender = Gender.F,
BillingAddress = new CustomerAddress
{
Address = "Skole Allé 63",
City = "København K",
Expand Down Expand Up @@ -123,6 +127,33 @@ public void CreateComplexPaymentRequest()
MobilePhone = "0001234567",
WorkPhone = "0123456789"
}
};

RecipientInfo recipientInfo = new RecipientInfo {
Email = "johndoe@example.com",
Username = "johndoe",
AccountIdentifier = "myAccount",
CustomerPhone = "+4512345678",
BirthDate = DateTime.Parse ("2000-01-01"),
Gender = Gender.F,
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",
}

};

Expand Down Expand Up @@ -167,6 +198,9 @@ public void CreateComplexPaymentRequest()

// Customer Data
CustomerInfo = customerInfo,

// Recipient Data
RecipientInfo = recipientInfo,

CustomerCreatedDate = "2017-11-16",
Cookie = "thecookie=isgood",
Expand All @@ -178,6 +212,7 @@ public void CreateComplexPaymentRequest()
ShippingType = ShippingType.TwoDayService,
AccountOffer = AccountOffer.disabled,
Type = AuthType.payment,
FormTemplate = "form_checkout",


// Orderlines
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog
All notable changes to this project will be documented in this file.

## [1.2.5]

- Add support to include recipient information as part of the `createPaymentRequest`.
- Add support to provide new `customer_info` parameters: `account_identifier` and `gender`.
- Add support to specify the `form_template` parameter in `createPaymentRequest`, allowing selection of a specific payment form template.

## [1.2.4]

- Add new response property `AppUrl` for `createPaymentRequest`.
Expand Down
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<arg value="--tags"/>
<arg value="${GitHash}"/>
</exec>
<condition property="GitLastTag" value="1.2.4">
<condition property="GitLastTag" value="1.2.5">
<equals arg1="${GitLastTag}" arg2="" />
</condition>
</target>
Expand Down