Skip to content

Commit

Permalink
Merge pull request #7 from wp-pronamic-pay-icepay/issues/6
Browse files Browse the repository at this point in the history
Add bank transfer, Giropay and PayPal payment methods.
  • Loading branch information
rvdsteege authored Feb 3, 2023
2 parents 0935a60 + e17ce76 commit e0dccca
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
use Icepay_Paymentmethod_Creditcard;
use Icepay_Paymentmethod_Ddebit;
use Icepay_Paymentmethod_Directebank;
use Icepay_Paymentmethod_Giropay;
use Icepay_Paymentmethod_Ideal;
use Icepay_Paymentmethod_Mistercash;
use Icepay_Paymentmethod_Paypal;
use Icepay_Paymentmethod_Wire;
use Icepay_PaymentObject;
use Icepay_Postback;
use Icepay_Result;
Expand Down Expand Up @@ -98,8 +101,11 @@ function() {
// Payment methods.
$this->register_payment_method( $ideal_payment_method );
$this->register_payment_method( $credit_card_payment_method );
$this->register_payment_method( new PaymentMethod( PaymentMethods::BANK_TRANSFER ) );
$this->register_payment_method( new PaymentMethod( PaymentMethods::DIRECT_DEBIT ) );
$this->register_payment_method( new PaymentMethod( PaymentMethods::BANCONTACT ) );
$this->register_payment_method( new PaymentMethod( PaymentMethods::GIROPAY ) );
$this->register_payment_method( new PaymentMethod( PaymentMethods::PAYPAL ) );
$this->register_payment_method( new PaymentMethod( PaymentMethods::SOFORT ) );
}

Expand Down Expand Up @@ -253,31 +259,46 @@ public function start( Payment $payment ) {
$icepay_method = null;

switch ( $payment->get_payment_method() ) {
case PaymentMethods::BANK_TRANSFER:
// @link https://github.com/pronamic/icepay-soap-api/blob/2.4.0/api/paymentmethods/wire.php
$icepay_method = new Icepay_Paymentmethod_Wire();

break;
case PaymentMethods::CREDIT_CARD:
// @link https://github.com/icepay/icepay/blob/2.4.0/api/paymentmethods/creditcard.php
// @link https://github.com/pronamic/icepay-soap-api/blob/2.4.0/api/paymentmethods/creditcard.php
$icepay_method = new Icepay_Paymentmethod_Creditcard();

$payment_object->setIssuer( $payment->get_meta( 'credit_card_issuer' ) );

break;
case PaymentMethods::DIRECT_DEBIT:
// @link https://github.com/icepay/icepay/blob/2.4.0/api/paymentmethods/ddebit.php
// @link https://github.com/pronamic/icepay-soap-api/blob/2.4.0/api/paymentmethods/ddebit.php
$icepay_method = new Icepay_Paymentmethod_Ddebit();

break;
case PaymentMethods::GIROPAY:
// @link https://github.com/pronamic/icepay-soap-api/blob/2.4.0/api/paymentmethods/giropay.php
$icepay_method = new Icepay_Paymentmethod_Giropay();

break;
case PaymentMethods::IDEAL:
// @link https://github.com/icepay/icepay/blob/2.4.0/api/paymentmethods/ideal.php
// @link https://github.com/pronamic/icepay-soap-api/blob/2.4.0/api/paymentmethods/ideal.php
$icepay_method = new Icepay_Paymentmethod_Ideal();

break;
case PaymentMethods::BANCONTACT:
case PaymentMethods::MISTER_CASH:
// @link https://github.com/icepay/icepay/blob/2.4.0/api/paymentmethods/mistercash.php
// @link https://github.com/pronamic/icepay-soap-api/blob/2.4.0/api/paymentmethods/mistercash.php
$icepay_method = new Icepay_Paymentmethod_Mistercash();

break;
case PaymentMethods::PAYPAL:
// @link https://github.com/pronamic/icepay-soap-api/blob/2.4.0/api/paymentmethods/paypal.php
$icepay_method = new Icepay_Paymentmethod_Paypal();

break;
case PaymentMethods::SOFORT:
// @link https://github.com/icepay/icepay/blob/2.4.0/api/paymentmethods/directebank.php
// @link https://github.com/pronamic/icepay-soap-api/blob/2.4.0/api/paymentmethods/directebank.php
$icepay_method = new Icepay_Paymentmethod_Directebank();

// Set issuer.
Expand Down

0 comments on commit e0dccca

Please sign in to comment.