Skip to content

Commit

Permalink
Add chippin as a new apm (#197)
Browse files Browse the repository at this point in the history
* chippin added

* enum type added
  • Loading branch information
beratallahverdi authored Oct 1, 2024
1 parent cb5805d commit 6a5e50f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
1 change: 1 addition & 0 deletions Craftgate/Model/ApmType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public enum ApmType
[EnumMember(Value = "MULTINET")] MULTINET,
[EnumMember(Value = "MULTINET_GIFT")] MULTINET_GIFT,
[EnumMember(Value = "ISPAY")] ISPAY,
[EnumMember(Value = "CHIPPIN")] CHIPPIN,
[EnumMember(Value = "FUND_TRANSFER")] FUND_TRANSFER,
[EnumMember(Value = "CASH_ON_DELIVERY")] CASH_ON_DELIVERY
}
Expand Down
41 changes: 40 additions & 1 deletion Samples/PaymentSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,45 @@ public void Init_Tompay_Apm_Payment()
Assert.AreEqual(response.AdditionalAction, ApmAdditionalAction.WAIT_FOR_WEBHOOK);
}

[Test]
public void Init_Chippin_Apm_Payment()
{
var request = new InitApmPaymentRequest
{
ApmType = ApmType.CHIPPIN,
ApmUserIdentity = "1000000", // Chippin Kullanıcı No
Price = new decimal(1.0),
PaidPrice = new decimal(1.0),
Currency = Currency.TRY,
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)
}
},
};

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 Complete_Edenred_Apm_Payment()
{
Expand Down Expand Up @@ -2123,4 +2162,4 @@ public void Retrieve_Provider_Card()
Assert.NotNull(response);
}
}
}
}

0 comments on commit 6a5e50f

Please sign in to comment.