-
Notifications
You must be signed in to change notification settings - Fork 17
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
Showing
18 changed files
with
5,032 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
77 changes: 77 additions & 0 deletions
77
src/RestApi/Internal/Payment/AbstractPaymentCreateRoute.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,77 @@ | ||
<?php | ||
/** | ||
* Payment creation route | ||
* | ||
* Utilized by both Lite and Pro. | ||
* | ||
* @package SimplePay | ||
* @subpackage Core | ||
* @copyright Copyright (c) 2023, Sandhills Development, LLC | ||
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License | ||
* @since 4.7.0 | ||
*/ | ||
|
||
namespace SimplePay\Core\RestApi\Internal\Payment; | ||
|
||
/** | ||
* AbstractPaymentCreateRoute class. | ||
* | ||
* @since 4.7.0 | ||
*/ | ||
abstract class AbstractPaymentCreateRoute extends AbstractPaymentRoute { | ||
|
||
/** | ||
* The payment create route. | ||
* | ||
* @since 4.7.0 | ||
* | ||
* @var string | ||
*/ | ||
protected $route = 'payment/create'; | ||
|
||
/** | ||
* Application fee handling. | ||
* | ||
* @since 4.7.0 | ||
* | ||
* @var \SimplePay\Core\StripeConnect\ApplicationFee | ||
*/ | ||
protected $application_fee; | ||
|
||
/** | ||
* AbstractPaymentCreateRoute. | ||
* | ||
* @since 4.7.0 | ||
* | ||
* @param \SimplePay\Core\StripeConnect\ApplicationFee $application_fee Application fee service. | ||
*/ | ||
public function __construct( $application_fee ) { | ||
$this->application_fee = $application_fee; | ||
} | ||
|
||
/** | ||
* Determines if the current request should be able to create a payment. | ||
* | ||
* This occurs _before_ argument validation is done. This should be where | ||
* user authentication permission checks are done. | ||
* | ||
* @since 4.7.0 | ||
* | ||
* @param \WP_REST_Request $request The payment request. | ||
* @return bool | ||
*/ | ||
public function create_payment_permissions_check( $request ) { | ||
return true; | ||
} | ||
|
||
/** | ||
* Creates a payment for the given request. | ||
* | ||
* @since 4.7.0 | ||
* | ||
* @param \WP_REST_Request $request The payment request. | ||
* @return \WP_REST_Response | ||
*/ | ||
abstract public function create_payment( $request ); | ||
|
||
} |
Oops, something went wrong.