-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c8a56f
commit 761ad35
Showing
8 changed files
with
76 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
includes/payment-methods/class-wc-stripe-upe-payment-method-ach.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
/** | ||
* Class that handles ACH Direct Debit as a UPE Payment Method. | ||
* | ||
* @extends WC_Stripe_UPE_Payment_Method | ||
*/ | ||
class WC_Stripe_UPE_Payment_Method_ACH extends WC_Stripe_UPE_Payment_Method { | ||
|
||
/** | ||
* Stripe's internal identifier for ACH Direct Debit. | ||
*/ | ||
const STRIPE_ID = 'us_bank_account'; | ||
|
||
/** | ||
* Constructor for ACH Direct Debit payment method. | ||
*/ | ||
public function __construct() { | ||
parent::__construct(); | ||
|
||
$this->stripe_id = self::STRIPE_ID; | ||
$this->title = __( 'ACH Direct Debit', 'woocommerce-gateway-stripe' ); | ||
$this->is_reusable = false; // Usually ACH requires verification per transaction. | ||
$this->supported_currencies = [ 'USD' ]; | ||
$this->supported_countries = [ 'US' ]; | ||
$this->label = __( 'ACH Direct Debit', 'woocommerce-gateway-stripe' ); | ||
$this->description = __( 'Pay directly from your US bank account via ACH.', 'woocommerce-gateway-stripe' ); | ||
} | ||
|
||
/** | ||
* Checks if ACH is available for the Stripe account's country. | ||
* | ||
* @return bool True if US-based account; false otherwise. | ||
*/ | ||
public function is_available_for_account_country() { | ||
return in_array( WC_Stripe::get_instance()->account->get_account_country(), $this->supported_countries, true ); | ||
} | ||
|
||
/** | ||
* Returns string representing payment method type | ||
* to query to retrieve saved payment methods from Stripe. | ||
*/ | ||
public function get_retrievable_type() { | ||
return $this->get_id(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters