-
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
1 parent
1108e52
commit 78c9b72
Showing
146 changed files
with
8,318 additions
and
1,850 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,42 @@ | ||
<?php | ||
/** | ||
* API: PaymentIntents | ||
* | ||
* @package SimplePay\Core\API\PaymentIntents | ||
* @copyright Copyright (c) 2022, Sandhills Development, LLC | ||
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License | ||
* @since 4.6.0 | ||
*/ | ||
|
||
namespace SimplePay\Core\API\PaymentIntents; | ||
|
||
use SimplePay\Core\Payments\Stripe_API; | ||
|
||
// Exit if accessed directly. | ||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
/** | ||
* Updates a PaymentIntent record. | ||
* | ||
* @since 4.6.0 | ||
* | ||
* @param string $paymentintent_id ID of the PaymentIntent to update. | ||
* @param array $paymentintent_args Data to update PaymentIntent with. | ||
* @param array $api_request_args { | ||
* Additional request arguments to send to the Stripe API when making a request. | ||
* | ||
* @type string $api_key API Secret Key to use. | ||
* } | ||
* @return \SimplePay\Vendor\Stripe\PaymentIntent $paymentintent Stripe PaymentIntent. | ||
*/ | ||
function update( $paymentintent_id, $paymentintent_args, $api_request_args = array() ) { | ||
return Stripe_API::request( | ||
'PaymentIntent', | ||
'update', | ||
$paymentintent_id, | ||
$paymentintent_args, | ||
$api_request_args | ||
); | ||
} |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import './general.js'; | ||
import './prices.js'; | ||
import './payment-methods.js'; | ||
import './taxes.js'; | ||
import './custom-fields.js'; | ||
import './stripe-checkout.js'; | ||
import './payment-page.js'; |
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,20 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import domReady from '@wordpress/dom-ready'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { maybeBlockSelectWithUpgradeModal } from '@wpsimplepay/utils'; | ||
|
||
/** | ||
* DOM ready. | ||
*/ | ||
domReady( () => { | ||
const selector = document.getElementById( '_tax_status_lite' ); | ||
|
||
if ( selector ) { | ||
selector.addEventListener( 'change', maybeBlockSelectWithUpgradeModal ); | ||
} | ||
} ); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* "Order" refers to an internal order, not a Stripe Order object. | ||
*/ | ||
|
||
/** | ||
* Internal dependencies. | ||
*/ | ||
import { apiRequest } from './api-request.js'; | ||
import { createToken } from '../../../frontend/utils/recaptcha.js'; | ||
|
||
/** @typedef {import('@wpsimplepay/payment-forms').PaymentForm} PaymentForm */ | ||
|
||
/** | ||
* Creates and returns an order preview. | ||
* | ||
* @since 4.6.0 | ||
* | ||
* @param {Object} data Data to pass to REST endpoint. | ||
* @return {jqXHR} jQuery XMLHttpRequest object. | ||
*/ | ||
export async function preview( data ) { | ||
// Create a token for the reCAPTCHA. | ||
const recaptcha = await createToken( | ||
`simple_pay_form_${ data.form_id }_order_preview` | ||
); | ||
|
||
return apiRequest( 'v2/order/preview', { | ||
...data, | ||
captcha: { | ||
recaptcha, | ||
}, | ||
} ); | ||
} | ||
|
||
/** | ||
* Submits an Order. | ||
* | ||
* @since 4.6.0 | ||
* | ||
* @param {Object} data Data to pass to REST endpoint. | ||
* @return {jqXHR} jQuery XMLHttpRequest object. | ||
*/ | ||
export async function submit( data ) { | ||
// Create a token for the reCAPTCHA. | ||
const recaptcha = await createToken( | ||
`simple_pay_form_${ data.form_id }_order_submit` | ||
); | ||
|
||
return apiRequest( 'v2/order/submit', { | ||
...data, | ||
captcha: { | ||
recaptcha, | ||
}, | ||
} ); | ||
} |
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
Oops, something went wrong.