Skip to content

Commit

Permalink
Add Bizum Payment Method (#204)
Browse files Browse the repository at this point in the history
* Add Bizum Payment Method

* Add Bizum Payment Method

---------

Co-authored-by: Mustafa Özcan <[email protected]>
  • Loading branch information
mozcan and Mustafa Özcan authored Nov 26, 2024
1 parent 12a589b commit 126c976
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions Craftgate/Model/ApmType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public enum ApmType
[EnumMember(Value = "ISPAY")] ISPAY,
[EnumMember(Value = "CHIPPIN")] CHIPPIN,
[EnumMember(Value = "PAYMOB")] PAYMOB,
[EnumMember(Value = "BIZUM")] BIZUM,
[EnumMember(Value = "FUND_TRANSFER")] FUND_TRANSFER,
[EnumMember(Value = "CASH_ON_DELIVERY")] CASH_ON_DELIVERY
}
Expand Down
1 change: 1 addition & 0 deletions Craftgate/Model/PaymentProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public enum PaymentProvider
[EnumMember(Value = "ISPAY")] ISPAY,
[EnumMember(Value = "CHIPPIN")] CHIPPIN,
[EnumMember(Value = "PAYMOB")] PAYMOB,
[EnumMember(Value = "BIZUM")] BIZUM,
[EnumMember(Value = "OFFLINE")] OFFLINE
}
}
41 changes: 41 additions & 0 deletions Samples/PaymentSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,47 @@ public void Init_Chippin_Apm_Payment()
Assert.AreEqual(response.PaymentStatus, PaymentStatus.WAITING);
Assert.AreEqual(response.AdditionalAction, ApmAdditionalAction.WAIT_FOR_WEBHOOK);
}

[Test]
public void Init_Bizum_Apm_Payment()
{
var additionalParams = new Dictionary<string, object>();
additionalParams.Add("buyerPhoneNumber", "34700000000");

var request = new InitApmPaymentRequest
{
ApmType = ApmType.BIZUM,
Price = new decimal(1.0),
PaidPrice = new decimal(1.0),
Currency = Currency.EUR,
PaymentGroup = PaymentGroup.LISTING_OR_SUBSCRIPTION,
ConversationId = "conversationId",
ExternalId = "externalId",
Items = new List<PaymentItem>
{
new PaymentItem
{
Name = "Item 1",
ExternalId = Guid.NewGuid().ToString(),
Price = new decimal(0.40)
},

new PaymentItem
{
Name = "Item 2",
ExternalId = Guid.NewGuid().ToString(),
Price = new decimal(0.60)
}
},
AdditionalParams = additionalParams
};

var response = _craftgateClient.Payment().InitApmPayment(request);
Assert.NotNull(response);
Assert.NotNull(response.PaymentId);
Assert.AreEqual(response.PaymentStatus, PaymentStatus.WAITING);
Assert.AreEqual(response.AdditionalAction, ApmAdditionalAction.WAIT_FOR_WEBHOOK);
}

[Test]
public void Init_Paymob_Apm_Payment()
Expand Down

0 comments on commit 126c976

Please sign in to comment.