Skip to content

Commit 107da5a

Browse files
OctopusDeploy release: 5.2.2
1 parent f3ab9a5 commit 107da5a

File tree

18 files changed

+244
-102
lines changed

18 files changed

+244
-102
lines changed

CHANGELOG.md

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

55
#### Enhancements
66

7+
- GP-ECOM: Add refund for transaction with open banking
8+
9+
## v5.2.1 (06/07/23)
10+
11+
#### Enhancements
12+
713
- GP-API: Added integration examples using Hosted Fields (GP JS library), 3DS library
814

915
#### Bug fixes:

examples/gpapi/end-to-end/end-to-end/Check3dsVersion.ashx.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using GlobalPayments.Api;
22
using GlobalPayments.Api.Entities;
3+
using GlobalPayments.Api.Entities.Enums;
34
using GlobalPayments.Api.PaymentMethods;
45
using GlobalPayments.Api.Services;
56
using GlobalPayments.Api.Utils.Logging;
@@ -87,7 +88,7 @@ public void ProcessRequest(HttpContext context)
8788
messageVersion = messageVersion
8889
});
8990

90-
if (enrolled == "ENROLLED" && messageVersion == Secure3dVersion.Two) {
91+
if (enrolled == Secure3dStatus.ENROLLED.ToString() && messageVersion == Secure3dVersion.Two) {
9192
responseJson = JsonConvert.SerializeObject(new
9293
{
9394
enrolled = enrolled,

examples/gpapi/end-to-end/end-to-end/InitiateAuthentication.ashx.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using GlobalPayments.Api;
22
using GlobalPayments.Api.Entities;
3+
using GlobalPayments.Api.Entities.Enums;
34
using GlobalPayments.Api.PaymentMethods;
45
using GlobalPayments.Api.Services;
56
using GlobalPayments.Api.Utils.Logging;
@@ -149,7 +150,7 @@ public void ProcessRequest(HttpContext context)
149150
});
150151

151152

152-
if (status != "CHALLENGE_REQUIRED")
153+
if (status != Secure3dStatus.CHALLENGE_REQUIRED.ToString())
153154
{
154155
// Frictionless flow
155156
response = JsonConvert.SerializeObject(new

examples/gpapi/end-to-end/end-to-end/end-to-end.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
<WarningLevel>4</WarningLevel>
4545
</PropertyGroup>
4646
<ItemGroup>
47-
<Reference Include="GlobalPayments.Api, Version=5.1.9.0, Culture=neutral, processorArchitecture=MSIL">
48-
<HintPath>..\packages\GlobalPayments.Api.5.1.9\lib\netstandard1.3\GlobalPayments.Api.dll</HintPath>
47+
<Reference Include="GlobalPayments.Api, Version=5.2.1.0, Culture=neutral, processorArchitecture=MSIL">
48+
<HintPath>..\packages\GlobalPayments.Api.5.2.1\lib\netstandard1.3\GlobalPayments.Api.dll</HintPath>
4949
</Reference>
5050
<Reference Include="Microsoft.CSharp" />
5151
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">

examples/gpapi/end-to-end/end-to-end/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<package id="AspNet.ScriptManager.bootstrap" version="3.4.1" targetFramework="net472" />
55
<package id="AspNet.ScriptManager.jQuery" version="3.4.1" targetFramework="net472" />
66
<package id="bootstrap" version="3.4.1" targetFramework="net472" />
7-
<package id="GlobalPayments.Api" version="5.1.9" targetFramework="net472" />
7+
<package id="GlobalPayments.Api" version="5.2.1" targetFramework="net472" />
88
<package id="jQuery" version="3.4.1" targetFramework="net472" />
99
<package id="Microsoft.AspNet.FriendlyUrls" version="1.0.2" targetFramework="net472" />
1010
<package id="Microsoft.AspNet.FriendlyUrls.Core" version="1.0.2" targetFramework="net472" />

src/GlobalPayments.Api/Builders/ManagementBuilder.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,14 @@ public override Transaction Execute(string configName = "default") {
488488
base.Execute(configName);
489489

490490
var client = ServicesContainer.Instance.GetClient(configName);
491+
if (client.SupportsOpenBanking &&
492+
PaymentMethod is TransactionReference &&
493+
PaymentMethod.PaymentMethodType == PaymentMethodType.BankPayment) {
494+
var obClient = ServicesContainer.Instance.GetOpenBanking(configName);
495+
if (obClient != client) {
496+
return obClient.ManageOpenBanking(this);
497+
}
498+
}
491499
return client.ManageTransaction(this);
492500
}
493501

src/GlobalPayments.Api/Entities/BankPaymentResponse.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@ public class BankPaymentResponse {
1717
public string Iban { get; set; }
1818
public string RemittanceReferenceValue { get; set; }
1919
public string RemittanceReferenceType { get; set; }
20+
public decimal? Amount { get; set; }
21+
public string Currency { get; set; }
2022
}
2123
}

src/GlobalPayments.Api/Entities/Enums/BankPaymentStatus.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,8 @@ public enum BankPaymentStatus {
2424
FAILURE_DECLINED,
2525
STATUS_NOT_AVAILABLE,
2626
PAYMENT_NOT_COMPLETED,
27+
INITIATION_PROCESSING,
28+
INITIATION_REJECTED,
29+
INITIATION_FAILED
2730
}
2831
}

src/GlobalPayments.Api/Gateways/Interfaces/IOpenBankingProvider.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace GlobalPayments.Api.Gateways
99
public interface IOpenBankingProvider
1010
{
1111
bool SupportsHostedPayments { get; }
12-
Transaction ProcessOpenBanking(AuthorizationBuilder builder);
12+
Transaction ProcessOpenBanking(AuthorizationBuilder builder);
13+
Transaction ManageOpenBanking(ManagementBuilder builder);
1314
}
1415
}

src/GlobalPayments.Api/Gateways/OpenBankingProvider.cs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ private void SetAuthorizationHeader(string value) {
158158
}
159159
}
160160

161-
162161
public static BankPaymentType? GetBankPaymentType(string currency) {
163162
switch (currency) {
164163
case "EUR":
@@ -181,5 +180,43 @@ protected override string HandleResponse(GatewayResponse response)
181180
return response.RawResponse;
182181
}
183182

183+
public Transaction ManageOpenBanking(ManagementBuilder builder)
184+
{
185+
string timestamp = builder.Timestamp ?? GenerationUtils.GenerateTimestamp();
186+
var amount = builder.Amount != null ? builder.Amount.ToNumericCurrencyString() : null;
187+
188+
JsonDoc request = new JsonDoc();
189+
190+
switch (builder.TransactionType) {
191+
case TransactionType.Refund:
192+
193+
string hash = GenerationUtils.GenerateHash(SharedSecret, ShaHashType, MerchantId, AccountId, timestamp, builder.TransactionId, builder.ClientTransactionId, amount);
194+
195+
SetAuthorizationHeader(hash);
196+
request.Set("merchant_id", MerchantId)
197+
.Set("account_id", AccountId)
198+
.Set("request_timestamp", timestamp);
199+
200+
JsonDoc order = new JsonDoc();
201+
order.Set("id", builder.TransactionId)
202+
.Set("ob_trans_id", builder.ClientTransactionId)
203+
.Set("amount", amount)
204+
.Set("description", builder.Description);
205+
206+
request.Set("order", order);
207+
208+
break;
209+
default:
210+
break;
211+
}
212+
213+
try {
214+
string rawResponse = DoTransaction(HttpMethod.Post, "/refunds", request.ToString());
215+
return OpenBankingMapping.MapResponse(rawResponse);
216+
}
217+
catch (GatewayException gatewayException) {
218+
throw gatewayException;
219+
}
220+
}
184221
}
185222
}

0 commit comments

Comments
 (0)