-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added template for "Save new card" case - Card.cshtml.
Changed code to handle it.
- Loading branch information
1 parent
b9159e8
commit a57b17c
Showing
14 changed files
with
736 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.IO; | ||
using System.Security.Cryptography; | ||
using System.Text; | ||
|
||
namespace Dynamicweb.Ecommerce.CheckoutHandlers.QuickPayPaymentWindow; | ||
|
||
internal static class Hash | ||
{ | ||
public static string ByteArrayToHexString(byte[] bytes) | ||
{ | ||
var result = new StringBuilder(); | ||
foreach (byte b in bytes) | ||
{ | ||
result.Append(b.ToString("x2")); | ||
} | ||
|
||
return result.ToString(); | ||
} | ||
|
||
public static string ComputeHash(string key, Stream message) | ||
{ | ||
var encoding = new UTF8Encoding(); | ||
var byteKey = encoding.GetBytes(key); | ||
|
||
using (HMACSHA256 hmac = new HMACSHA256(byteKey)) | ||
{ | ||
var hashedBytes = hmac.ComputeHash(message); | ||
return ByteArrayToHexString(hashedBytes); | ||
} | ||
} | ||
|
||
public static string ComputeHash(string key, string message) | ||
{ | ||
var encoding = new UTF8Encoding(); | ||
var byteKey = encoding.GetBytes(key); | ||
|
||
using (HMACSHA256 hmac = new HMACSHA256(byteKey)) | ||
{ | ||
var messageBytes = encoding.GetBytes(message); | ||
var hashedBytes = hmac.ComputeHash(messageBytes); | ||
|
||
return ByteArrayToHexString(hashedBytes); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System.Runtime.Serialization; | ||
|
||
namespace Dynamicweb.Ecommerce.CheckoutHandlers.QuickPayPaymentWindow.Models; | ||
|
||
[DataContract] | ||
internal sealed class CardLinkUrl | ||
{ | ||
[DataMember(Name = "url")] | ||
public string Url { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.Runtime.Serialization; | ||
|
||
namespace Dynamicweb.Ecommerce.CheckoutHandlers.QuickPayPaymentWindow.Models.Frontend; | ||
|
||
//This is a model for ajax-interactions with our templates only | ||
[DataContract] | ||
internal sealed class CallbackError | ||
{ | ||
[DataMember(Name = "errorMessage")] | ||
public string ErrorMessage { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.Runtime.Serialization; | ||
|
||
namespace Dynamicweb.Ecommerce.CheckoutHandlers.QuickPayPaymentWindow.Models.Frontend; | ||
|
||
//This is a model for ajax-interactions with our templates only | ||
[DataContract] | ||
internal sealed class CreateCardRequestData | ||
{ | ||
[DataMember(Name = "agreementId")] | ||
public string AgreementId { get; set; } | ||
|
||
[DataMember(Name = "brandingId")] | ||
public string BrandingId { get; set; } | ||
|
||
[DataMember(Name = "languageCode")] | ||
public string LanguageCode { get; set; } | ||
|
||
[DataMember(Name = "paymentMethods")] | ||
public string PaymentMethods { get; set; } | ||
|
||
[DataMember(Name = "googleAnalyticsTrackingId")] | ||
public string GoogleAnalyticsTrackingId { get; set; } | ||
|
||
[DataMember(Name = "googleAnalyticsClientId")] | ||
public string GoogleAnalyticsClientId { get; set; } | ||
|
||
[DataMember(Name = "receiptUrl")] | ||
public string ReceiptUrl { get; set; } | ||
|
||
[DataMember(Name = "cancelUrl")] | ||
public string CancelUrl { get; set; } | ||
|
||
[DataMember(Name = "callbackUrl")] | ||
public string СallbackUrl { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.