Skip to content

Commit f3ab9a5

Browse files
OctopusDeploy release: 5.2.1
1 parent f5cf62d commit f3ab9a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+4120
-37
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44

55
#### Enhancements
66

7+
- GP-API: Added integration examples using Hosted Fields (GP JS library), 3DS library
8+
9+
#### Bug fixes:
10+
11+
- GP-ECOM: Send the correct "message_version" in the initiate step on 3DS2
12+
13+
## v5.2.0 (27/06/23)
14+
15+
#### Enhancements
16+
717
- GP-API: UPA MiTC via GP-API.
818

919
## v5.1.9 (15/06/23)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.32002.261
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "end-to-end", "end-to-end\end-to-end.csproj", "{B73986AD-3E93-4072-A718-F2739CA0DAB2}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{B73986AD-3E93-4072-A718-F2739CA0DAB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{B73986AD-3E93-4072-A718-F2739CA0DAB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{B73986AD-3E93-4072-A718-F2739CA0DAB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{B73986AD-3E93-4072-A718-F2739CA0DAB2}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {422943B9-A9C4-443E-8B78-25A17BCD4862}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using System.Web.Optimization;
6+
using System.Web.UI;
7+
8+
namespace end_to_end
9+
{
10+
public class BundleConfig
11+
{
12+
// For more information on Bundling, visit https://go.microsoft.com/fwlink/?LinkID=303951
13+
public static void RegisterBundles(BundleCollection bundles)
14+
{
15+
16+
}
17+
}
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Web;
4+
using System.Web.Routing;
5+
using Microsoft.AspNet.FriendlyUrls;
6+
7+
namespace end_to_end
8+
{
9+
public static class RouteConfig
10+
{
11+
public static void RegisterRoutes(RouteCollection routes)
12+
{
13+
var settings = new FriendlyUrlSettings();
14+
settings.AutoRedirectMode = RedirectMode.Permanent;
15+
routes.EnableFriendlyUrls(settings);
16+
}
17+
}
18+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%@ WebHandler Language="C#" CodeBehind="Authorization.ashx.cs" Class="end_to_end.Authorization" %>
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
using GlobalPayments.Api;
2+
using GlobalPayments.Api.Entities;
3+
using GlobalPayments.Api.PaymentMethods;
4+
using GlobalPayments.Api.Services;
5+
using Newtonsoft.Json;
6+
using System;
7+
using System.Collections.Generic;
8+
using System.Linq;
9+
using System.Web;
10+
11+
namespace end_to_end
12+
{
13+
/// <summary>
14+
/// Summary description for Authorization
15+
/// </summary>
16+
public class Authorization : IHttpHandler
17+
{
18+
19+
public void ProcessRequest(HttpContext context)
20+
{
21+
var serverTransactionId = context.Request.Form["serverTransactionId"];
22+
var paymentToken = context.Request.Form["tokenResponse"];
23+
24+
string baseUrl = context.Request.UrlReferrer.AbsoluteUri;
25+
string currentIP = baseUrl;
26+
27+
// configure client & request settings
28+
GpApiConfig config = new GpApiConfig();
29+
config.AppId = _Default.APP_ID;
30+
config.AppKey = _Default.APP_KEY;
31+
config.Environment = GlobalPayments.Api.Entities.Environment.TEST;
32+
config.Country = "GB";
33+
config.Channel = Channel.CardNotPresent;
34+
config.MethodNotificationUrl = string.Format("{0}MethodNotificationUrl.ashx", currentIP);
35+
config.MerchantContactUrl = "https://www.example.com/about";
36+
config.ChallengeNotificationUrl = string.Format("{0}ChallengeNotificationUrl.ashx", currentIP);
37+
38+
ServicesContainer.ConfigureService(config);
39+
40+
ThreeDSecure secureEcom = new ThreeDSecure();
41+
42+
try
43+
{
44+
secureEcom = Secure3dService.GetAuthenticationData()
45+
.WithServerTransactionId(serverTransactionId)
46+
.Execute();
47+
}
48+
49+
catch (ApiException exce)
50+
{
51+
// TODO: add your error handling here
52+
}
53+
54+
var authenticationValue = secureEcom.AuthenticationValue;
55+
var dsTransId = secureEcom.DirectoryServerTransactionId;
56+
var messageVersion = secureEcom.MessageVersion;
57+
var eci = secureEcom.Eci;
58+
59+
context.Response.ContentType = "text/html";
60+
61+
context.Response.Write("<head>");
62+
context.Response.Write("<title>3D Secure 2 Authentication</title>");
63+
context.Response.Write("</head>");
64+
65+
context.Response.Write("<body>");
66+
context.Response.Write("<h2>3D Secure 2 Authentication</h2>");
67+
context.Response.Write("<p><strong>Hurray! Your trasaction was authenticated successfully!</strong></p>");
68+
context.Response.Write($"<p>Server Trans ID: {serverTransactionId}</p>");
69+
context.Response.Write($"<p>Authentication Value: {authenticationValue}</p>");
70+
context.Response.Write($"<p>DS Trans ID: {dsTransId}</p>");
71+
context.Response.Write($"<p>Message Version: {messageVersion}</p>");
72+
context.Response.Write($"<p>ECI: {eci}</p>");
73+
74+
context.Response.Write($"<hr>");
75+
76+
context.Response.Write($"<h2>Transaction details:</h2>");
77+
78+
79+
CreditCardData paymentMethod = new CreditCardData();
80+
paymentMethod.Token = paymentToken;
81+
paymentMethod.ThreeDSecure = secureEcom;
82+
Transaction response = null;
83+
84+
// proceed to authorization with liability shift
85+
try
86+
{
87+
response = paymentMethod.Charge(100)
88+
.WithCurrency("EUR")
89+
.Execute();
90+
}
91+
catch (Exception e)
92+
{
93+
// TODO: Add your error handling here
94+
context.Response.Write($"<p> Error: {e.Message}</p>");
95+
96+
}
97+
if (response != null)
98+
{
99+
var transactionId = response.TransactionId;
100+
var transactionStatus = response.ResponseMessage;
101+
102+
context.Response.Write($"<p> Trans ID: {transactionId}</p>");
103+
context.Response.Write($"<p> Trans status: {transactionStatus}</p>");
104+
}
105+
106+
context.Response.Write("</body>");
107+
context.Response.Flush();
108+
}
109+
110+
public bool IsReusable
111+
{
112+
get
113+
{
114+
return false;
115+
}
116+
}
117+
}
118+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<bundles version="1.0">
3+
<styleBundle path="~/Content/css">
4+
<include path="~/Content/bootstrap.css" />
5+
<include path="~/Content/Site.css" />
6+
</styleBundle>
7+
</bundles>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%@ WebHandler Language="C#" CodeBehind="ChallengeNotificationUrl.ashx.cs" Class="end_to_end.ChallengeNotificationUrl" %>
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
using Newtonsoft.Json;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Web;
7+
8+
namespace end_to_end
9+
{
10+
/// <summary>
11+
/// Summary description for ChallengeNotificationUrl
12+
/// </summary>
13+
public class ChallengeNotificationUrl : IHttpHandler
14+
{
15+
16+
public void ProcessRequest(HttpContext context)
17+
{
18+
/*
19+
* this sample code is intended as a simple example and should not be treated as Production-ready code
20+
* you'll need to add your own message parsing and security in line with your application or website
21+
*/
22+
var cres = context.Request.Form["cres"];
23+
string challengeUrlResponseString = string.Empty;
24+
string request = string.Empty;
25+
string threeDSServerTransID = string.Empty;
26+
string transStatus = string.Empty;
27+
try
28+
{
29+
var a = Convert.FromBase64String(cres.Replace('-', '+').Replace('_', '/') + "=");
30+
challengeUrlResponseString = Encoding.UTF8.GetString(a);
31+
32+
ChallengeUrlResponse challengeUrlResponse = JsonConvert.DeserializeObject<ChallengeUrlResponse>(challengeUrlResponseString);
33+
34+
threeDSServerTransID = challengeUrlResponse.ThreeDSServerTransID; // af65c369-59b9-4f8d-b2f6-7d7d5f5c69d5
35+
var acsTransId = challengeUrlResponse.AcsTransID; // 13c701a3-5a88-4c45-89e9-ef65e50a8bf9
36+
var messageType = challengeUrlResponse.MessageType; // Cres
37+
var messageVersion = challengeUrlResponse.MessageVersion; // 2.1.0
38+
//var challengeCompletionInd = challengeUrlResponse.ChallengeCompletionInd;
39+
transStatus = challengeUrlResponse.TransStatus; // Y
40+
41+
// TODO: notify client-side that the Challenge step is complete and pass any required data
42+
43+
StringBuilder stringOut = new StringBuilder();
44+
stringOut.AppendLine("{\"threeDSServerTransID\":\"" + threeDSServerTransID + "\"" + ",\"transStatus\":\"" + transStatus + "\"}");
45+
46+
//string whattheheckgenererated = stringOut.ToString();
47+
48+
request = stringOut.ToString();
49+
50+
context.Response.Write("<script src=\"Scripts/globalpayments-3ds.js\"></script>");
51+
context.Response.Write("<script>");
52+
context.Response.Write(String.Format("GlobalPayments.ThreeDSecure.handleChallengeNotification({0});", stringOut));
53+
context.Response.Write("</script>");
54+
55+
}
56+
catch (Exception e)
57+
{
58+
59+
context.Response.Write(String.Format("console.log('Error Challenge : , {0});", request));
60+
context.Response.Write("</script>");
61+
}
62+
63+
}
64+
65+
public class ChallengeUrlResponse
66+
{
67+
[JsonProperty("threeDSServerTransID")]
68+
public string ThreeDSServerTransID { get; set; }
69+
70+
[JsonProperty("acsTransID")]
71+
public string AcsTransID { get; set; }
72+
73+
[JsonProperty("messageType")]
74+
public string MessageType { get; set; }
75+
76+
[JsonProperty("messageVersion")]
77+
public string MessageVersion { get; set; }
78+
79+
[JsonProperty("transStatus")]
80+
public string TransStatus { get; set; }
81+
82+
}
83+
84+
public bool IsReusable
85+
{
86+
get
87+
{
88+
return false;
89+
}
90+
}
91+
}
92+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%@ WebHandler Language="C#" CodeBehind="Check3dsVersion.ashx.cs" Class="end_to_end.Check3dsVersion" %>

0 commit comments

Comments
 (0)