Skip to content

Commit

Permalink
Add Bizum Payment Method
Browse files Browse the repository at this point in the history
  • Loading branch information
Mustafa Özcan committed Nov 12, 2024
1 parent 86f99d8 commit 9ef4721
Show file tree
Hide file tree
Showing 3 changed files with 44 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
}
}
42 changes: 42 additions & 0 deletions Samples/PaymentSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,48 @@ 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",
CallbackUrl = "https://www.your-website.com/craftgate-apm-callback",
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 9ef4721

Please sign in to comment.