Skip to content

Commit

Permalink
Added the Sepa direct debit response class
Browse files Browse the repository at this point in the history
  • Loading branch information
Viincenttt committed Sep 22, 2016
1 parent dbbd9be commit 15ef081
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Mollie.Api/Framework/Factories/PaymentResponseFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public PaymentResponse Create(PaymentMethod? paymentMethod) {
return new SofortPaymentResponse();
case PaymentMethod.Belfius:
return new BelfiusPaymentResponse();
case PaymentMethod.DirectDebit:
return new SepaDirectDebitResponse();
default:
return new PaymentResponse();
}
Expand Down
3 changes: 2 additions & 1 deletion Mollie.Api/Models/Payment/PaymentStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public enum PaymentStatus {
PaidOut,
Refunded,
Expired,
Failed
Failed,
Charged_Back
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
namespace Mollie.Api.Models.Payment.Response.Specific {
public class SepaDirectDebitResponse : PaymentResponse {
public SepaDirectDebitResponseDetails Details { get; set; }
}

public class SepaDirectDebitResponseDetails {
/// <summary>
/// Transfer reference used by Mollie to identify this payment.
/// </summary>
public string TransferReference { get; set; }

/// <summary>
/// The creditor identifier indicates who is authorized to execute the payment. In this case, it is a reference to Mollie.
/// </summary>
public string CreditorIdentifier { get; set; }

/// <summary>
/// Optional – The consumer's name.
/// </summary>
public string ConsumerName { get; set; }

/// <summary>
/// Optional – The consumer's IBAN.
/// </summary>
public string ConsumerAccount { get; set; }

/// <summary>
/// Optional – The consumer's bank's BIC.
/// </summary>
public string ConsumerBic { get; set; }

/// <summary>
/// Only available if the payment has been verified – Date the payment has been signed by the consumer, in ISO 8601 format.
/// </summary>
public string SignatureDate { get; set; }

/// <summary>
/// Only available if the payment has failed – The official reason why this payment has failed. A detailed description of each reason is available on the website of
/// the European Payments Council.
/// </summary>
public string BankReasonCode { get; set; }

/// <summary>
/// Only available if the payment has failed – A textual desciption of the failure reason.
/// </summary>
public string BankReason { get; set; }

/// <summary>
/// Only available for batch transactions – The original end-to-end identifier that you've specified in your batch.
/// </summary>
public string EndToEndIdentifier { get; set; }

/// <summary>
/// Only available for batch transactions – The original mandate reference that you've specified in your batch.
/// </summary>
public string MandateReference { get; set; }

/// <summary>
/// Only available for batch transactions – The original batch reference that you've specified in your batch.
/// </summary>
public string BatchReference { get; set; }

/// <summary>
/// Only available for batch transactions – The original file reference that you've specified in your batch.
/// </summary>
public string FileReference { get; set; }
}
}
1 change: 1 addition & 0 deletions Mollie.Api/Mollie.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
<Compile Include="Models\Payment\Response\Specific\PayPalPaymentResponse.cs" />
<Compile Include="Models\Payment\Response\Specific\PaySafeCardPaymentResponse.cs" />
<Compile Include="Models\Payment\Response\Specific\PodiumCadeauKaartPaymentResponse.cs" />
<Compile Include="Models\Payment\Response\Specific\SepaDirectDebitResponse.cs" />
<Compile Include="Models\Payment\Response\Specific\SofortPaymentResponse.cs" />
<Compile Include="Models\Refund\RefundRequest.cs" />
<Compile Include="Models\Refund\RefundResponse.cs" />
Expand Down
2 changes: 1 addition & 1 deletion Mollie.Tests.Integration/Api/PaymentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void CanCreateDefaultPaymentWithAllFields() {
[TestCase(typeof(PaymentRequest), PaymentMethod.MisterCash, typeof(MisterCashPaymentResponse))]
[TestCase(typeof(PaymentRequest), PaymentMethod.Sofort, typeof(SofortPaymentResponse))]
[TestCase(typeof(BankTransferPaymentRequest), PaymentMethod.BankTransfer, typeof(BankTransferPaymentResponse))]
[TestCase(typeof(PaymentRequest), PaymentMethod.DirectDebit, typeof(PaymentResponse))]
[TestCase(typeof(SepaDirectDebitRequest), PaymentMethod.DirectDebit, typeof(SepaDirectDebitResponse))]
[TestCase(typeof(PayPalPaymentRequest), PaymentMethod.PayPal, typeof(PayPalPaymentResponse))]
[TestCase(typeof(PaymentRequest), PaymentMethod.Bitcoin, typeof(BitcoinPaymentResponse))]
[TestCase(typeof(PaymentRequest), PaymentMethod.PodiumCadeaukaart, typeof(PodiumCadeauKaartPaymentResponse))]
Expand Down

0 comments on commit 15ef081

Please sign in to comment.