-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e6fdded
commit c03424e
Showing
12 changed files
with
316 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
using System.Threading.Tasks; | ||
using Craftgate.Net; | ||
using Craftgate.Request; | ||
using Craftgate.Request.Common; | ||
using Craftgate.Response; | ||
|
||
namespace Craftgate.Adapter | ||
{ | ||
public class MasterpassPaymentAdapter : BaseAdapter | ||
{ | ||
public MasterpassPaymentAdapter(RequestOptions requestOptions) : base(requestOptions) | ||
{ | ||
} | ||
|
||
public CheckMasterpassUserResponse CheckMasterpassUser(CheckMasterpassUserRequest checkMasterpassUserRequest) | ||
{ | ||
var path = "/payment/v1/masterpass-payments/check-user"; | ||
return RestClient.Post<CheckMasterpassUserResponse>(RequestOptions.BaseUrl + path, | ||
CreateHeaders(checkMasterpassUserRequest, path, RequestOptions), checkMasterpassUserRequest); | ||
} | ||
|
||
public Task<CheckMasterpassUserResponse> CheckMasterpassUserAsync( | ||
CheckMasterpassUserRequest checkMasterpassUserRequest) | ||
{ | ||
var path = "/payment/v1/masterpass-payments/check-user"; | ||
return AsyncRestClient.Post<CheckMasterpassUserResponse>(RequestOptions.BaseUrl + path, | ||
CreateHeaders(checkMasterpassUserRequest, path, RequestOptions), checkMasterpassUserRequest); | ||
} | ||
|
||
public MasterpassPaymentTokenGenerateResponse GenerateMasterpassPaymentToken( | ||
MasterpassPaymentTokenGenerateRequest masterpassPaymentTokenGenerateRequest) | ||
{ | ||
var path = "/payment/v2/masterpass-payments/generate-token"; | ||
return RestClient.Post<MasterpassPaymentTokenGenerateResponse>(RequestOptions.BaseUrl + path, | ||
CreateHeaders(masterpassPaymentTokenGenerateRequest, path, RequestOptions), | ||
masterpassPaymentTokenGenerateRequest); | ||
} | ||
|
||
public Task<MasterpassPaymentTokenGenerateResponse> GenerateMasterpassPaymentTokenAsync( | ||
MasterpassPaymentTokenGenerateRequest masterpassPaymentTokenGenerateRequest) | ||
{ | ||
var path = "/payment/v2/masterpass-payments/generate-token"; | ||
return AsyncRestClient.Post<MasterpassPaymentTokenGenerateResponse>(RequestOptions.BaseUrl + path, | ||
CreateHeaders(masterpassPaymentTokenGenerateRequest, path, RequestOptions), | ||
masterpassPaymentTokenGenerateRequest); | ||
} | ||
|
||
public PaymentResponse CompleteMasterpassPayment( | ||
MasterpassPaymentCompleteRequest masterpassPaymentCompleteRequest) | ||
{ | ||
var path = "/payment/v2/masterpass-payments/complete"; | ||
return RestClient.Post<PaymentResponse>(RequestOptions.BaseUrl + path, | ||
CreateHeaders(masterpassPaymentCompleteRequest, path, RequestOptions), | ||
masterpassPaymentCompleteRequest); | ||
} | ||
|
||
public Task<PaymentResponse> CompleteMasterpassPaymentAsync( | ||
MasterpassPaymentCompleteRequest masterpassPaymentCompleteRequest) | ||
{ | ||
var path = "/payment/v2/masterpass-payments/complete"; | ||
return AsyncRestClient.Post<PaymentResponse>(RequestOptions.BaseUrl + path, | ||
CreateHeaders(masterpassPaymentCompleteRequest, path, RequestOptions), | ||
masterpassPaymentCompleteRequest); | ||
} | ||
|
||
public MasterpassPaymentThreeDSInitResponse Init3DSMasterpassPayment( | ||
MasterpassPaymentThreeDSInitRequest masterpassPaymentThreeDSInitRequest) | ||
{ | ||
var path = "/payment/v2/masterpass-payments/3ds-init"; | ||
return RestClient.Post<MasterpassPaymentThreeDSInitResponse>(RequestOptions.BaseUrl + path, | ||
CreateHeaders(masterpassPaymentThreeDSInitRequest, path, RequestOptions), | ||
masterpassPaymentThreeDSInitRequest); | ||
} | ||
|
||
public Task<MasterpassPaymentThreeDSInitResponse> Init3DSMasterpassPaymentAsync( | ||
MasterpassPaymentThreeDSInitRequest masterpassPaymentThreeDSInitRequest) | ||
{ | ||
var path = "/payment/v2/masterpass-payments/3ds-init"; | ||
return AsyncRestClient.Post<MasterpassPaymentThreeDSInitResponse>(RequestOptions.BaseUrl + path, | ||
CreateHeaders(masterpassPaymentThreeDSInitRequest, path, RequestOptions), | ||
masterpassPaymentThreeDSInitRequest); | ||
} | ||
|
||
public PaymentResponse Complete3DSMasterpassPayment( | ||
MasterpassPaymentThreeDSCompleteRequest masterpassPaymentThreeDSCompleteRequest) | ||
{ | ||
var path = "/payment/v2/masterpass-payments/3ds-complete"; | ||
return RestClient.Post<PaymentResponse>(RequestOptions.BaseUrl + path, | ||
CreateHeaders(masterpassPaymentThreeDSCompleteRequest, path, RequestOptions), | ||
masterpassPaymentThreeDSCompleteRequest); | ||
} | ||
|
||
public Task<PaymentResponse> Complete3DSMasterpassPaymentAsync( | ||
MasterpassPaymentThreeDSCompleteRequest masterpassPaymentThreeDSCompleteRequest) | ||
{ | ||
var path = "/payment/v2/masterpass-payments/3ds-complete"; | ||
return AsyncRestClient.Post<PaymentResponse>(RequestOptions.BaseUrl + path, | ||
CreateHeaders(masterpassPaymentThreeDSCompleteRequest, path, RequestOptions), | ||
masterpassPaymentThreeDSCompleteRequest); | ||
} | ||
} | ||
} |
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
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,24 @@ | ||
using System.Collections.Generic; | ||
using Craftgate.Model; | ||
|
||
namespace Craftgate.Request.Dto | ||
{ | ||
public class MasterpassCreatePayment | ||
{ | ||
public decimal? Price { get; set; } | ||
public decimal? PaidPrice { get; set; } | ||
public string PosAlias { get; set; } | ||
public int? Installment { get; set; } | ||
public Currency? Currency { get; set; } | ||
public PaymentGroup? PaymentGroup { get; set; } | ||
public string PaymentChannel { get; set; } | ||
public string ConversationId { get; set; } | ||
public string ExternalId { get; set; } | ||
public PaymentPhase PaymentPhase { get; set; } = PaymentPhase.AUTH; | ||
public long? BuyerMemberId { get; set; } | ||
public string BankOrderId { get; set; } | ||
public string ClientIp { get; set; } | ||
public IList<PaymentItem> Items { get; set; } | ||
public Dictionary<string, object> AdditionalParams { 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,8 @@ | ||
namespace Craftgate.Request | ||
{ | ||
public class MasterpassPaymentCompleteRequest | ||
{ | ||
public string ReferenceId { get; set; } | ||
public string Token { 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,7 @@ | ||
namespace Craftgate.Request | ||
{ | ||
public class MasterpassPaymentThreeDSCompleteRequest | ||
{ | ||
public long? PaymentId; | ||
} | ||
} |
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,8 @@ | ||
namespace Craftgate.Request | ||
{ | ||
public class MasterpassPaymentThreeDSInitRequest | ||
{ | ||
public string ReferenceId { get; set; } | ||
public string CallbackUrl { 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,13 @@ | ||
using Craftgate.Request.Dto; | ||
|
||
namespace Craftgate.Request | ||
{ | ||
public class MasterpassPaymentTokenGenerateRequest | ||
{ | ||
public string Msisdn { get; set; } | ||
public string UserId { get; set; } | ||
public string BinNumber { get; set; } | ||
public bool ForceThreeDS { get; set; } | ||
public MasterpassCreatePayment CreatePayment { 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,7 @@ | ||
namespace Craftgate.Response | ||
{ | ||
public class MasterpassPaymentThreeDSInitResponse | ||
{ | ||
public string ReturnUrl { 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,9 @@ | ||
namespace Craftgate.Response | ||
{ | ||
public class MasterpassPaymentTokenGenerateResponse | ||
{ | ||
public string Token { get; set; } | ||
public string ReferenceId { get; set; } | ||
public string OrderNo { get; set; } | ||
} | ||
} |
Oops, something went wrong.