Skip to content

Commit

Permalink
Updates to 5.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Gravity Forms committed Apr 30, 2024
1 parent 2529882 commit 02abe99
Show file tree
Hide file tree
Showing 31 changed files with 1,059 additions and 320 deletions.
10 changes: 10 additions & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
### 5.6.0 | 2024-04-29
- Added a new [`gform_stripe_payment_element_updated_payment_information`](https://docs.gravityforms.com/gform_stripe_payment_element_updated_payment_information/) JavaScript filter to allow modifying the payment element payment information when the form total changes.
- Updated logging to decrease the log file size and make it easier to track issues.
- Fixed a fatal error that occurs when the customer is redirected back after a no-cost checkout order payment.
- Fixed PHP 8.1+ deprecation notices displaying on the settings page.
- Fixed a fatal error that occurs when the webhooks signing secret is invalid.
- Fixed an issue where the loading spinner is not hidden after the form fails validation.
- Fixed a fatal error that can occur when the Stripe field is hidden by conditional logic.
- Fixed an issue where the Link option for the Stripe Payment Element can not be disabled once an email field is selected.

### 5.5.0 | 2024-02-22
- Added a Stripe API wrapper and deprecated the use of the Stripe PHP SDK.
- Added new notification events for pending and authorized payment states.
Expand Down
188 changes: 124 additions & 64 deletions class-gf-stripe.php

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions includes/api/model/class-account.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,31 @@
*/
class Account extends Base {

/**
* Initialize properties that will be used throughout this class and link to the Stripe API.
*
* @since 5.5.2
*/
public $capabilities;
public $company;
public $controller;
public $country;
public $email;
public $individual;
public $metadata;
public $requirements;
public $settings;
public $type;
public $business_type;
public $business_profile;
public $charges_enabled;
public $default_currency;
public $details_submitted;
public $external_accounts;
public $future_requirements;
public $payouts_enabled;
public $tos_acceptance;

/**
* Returns the API endpoint for this object.
*
Expand Down
13 changes: 13 additions & 0 deletions includes/api/model/class-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ class Base implements \ArrayAccess {
*/
private $original_values = array();

/**
* Initialize properties that will be used throughout this class, all subclasses, and link to the Stripe API.
*
* @since 5.5.2
*/
public $id;
public $object;
public $created;

/**
* Instantiates the object.
*
Expand Down Expand Up @@ -178,6 +187,7 @@ protected function serialize_parameters( $supported_params ) {
*
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetSet( $offset, $value ) {
$this->{$offset} = $value;
}
Expand All @@ -191,6 +201,7 @@ public function offsetSet( $offset, $value ) {
*
* @return bool Returns true if the offset exists, false otherwise.
*/
#[\ReturnTypeWillChange]
public function offsetExists( $offset ) {
return isset( $this->{$offset} );
}
Expand All @@ -204,6 +215,7 @@ public function offsetExists( $offset ) {
*
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetUnset( $offset ) {
unset( $this->{$offset} );
}
Expand All @@ -217,6 +229,7 @@ public function offsetUnset( $offset ) {
*
* @return mixed Returns the value at the specified offset, or null if it doesn't exist.
*/
#[\ReturnTypeWillChange]
public function offsetGet( $offset ) {
return isset( $this->{$offset} ) ? $this->{$offset} : null;
}
Expand Down
45 changes: 45 additions & 0 deletions includes/api/model/class-charge.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,51 @@
*/
class Charge extends Base {

/**
* Initialize properties that will be used throughout this class and link to the Stripe API.
*
* @since 5.5.2
*/
public $amount;
public $application;
public $balance_transaction;
public $captured;
public $currency;
public $customer;
public $description;
public $disputed;
public $livemode;
public $metadata;
public $outcome;
public $paid;
public $payment_intent;
public $payment_method;
public $receipt_number;
public $refunded;
public $review;
public $shipping;
public $statement_descriptor;
public $status;
public $transfer;
public $amount_captured;
public $amount_refunded;
public $application_fee;
public $application_fee_amount;
public $billing_details;
public $calculated_statement_descriptor;
public $failure_balance_transaction;
public $failure_code;
public $failure_message;
public $fraud_details;
public $on_behalf_of;
public $payment_method_details;
public $receipt_email;
public $reciept_url;
public $source_transfer;
public $statement_descriptor_suffix;
public $transfer_data;
public $transfer_group;

/**
* Returns the API endpoint for this object.
*
Expand Down
20 changes: 20 additions & 0 deletions includes/api/model/class-coupon.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@
*/
class Coupon extends Base {

/**
* Initialize properties that will be used throughout this class and link to the Stripe API.
*
* @since 5.5.2
*/
public $amount_off;
public $currency;
public $duration;
public $livemode;
public $metadata;
public $name;
public $percent_off;
public $valid;
public $applies_to;
public $currency_options;
public $duration_in_months;
public $max_redemptions;
public $redeem_by;
public $times_redeemed;

/**
* Returns the API endpoint for this object.
*
Expand Down
31 changes: 31 additions & 0 deletions includes/api/model/class-customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,37 @@
*/
class Customer extends Base {

/**
* Initialize properties that will be used throughout this class and link to the Stripe API.
*
* @since 5.5.2
*/
public $address;
public $balance;
public $currency;
public $description;
public $discount;
public $email;
public $livemode;
public $metadata;
public $name;
public $phone;
public $shipping;
public $sources;
public $subscriptions;
public $tax;
public $tax_ids;
public $cash_balance;
public $default_source;
public $delinquent;
public $invoice_credit_balance;
public $invoice_prefix;
public $invoice_settings;
public $next_invoice_sequence;
public $preferred_locales;
public $tax_exempt;
public $test_clock;

/**
* Gets the supported parameters for the update endpoint.
*
Expand Down
17 changes: 17 additions & 0 deletions includes/api/model/class-customerbalancetransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@
*/
class CustomerBalanceTransaction extends Base {

/**
* Initialize properties that will be used throughout this class and link to the Stripe API.
*
* @since 5.5.2
*/
public $amount;
public $currency;
public $customer;
public $description;
public $invoice;
public $livemode;
public $metadata;
public $type;
public $credit_note;
public $ending_balance;


/**
* This method is not supported by this object
*
Expand Down
25 changes: 19 additions & 6 deletions includes/api/model/class-event.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@
*/
class Event extends Base {

/**
* Initialize properties that will be used throughout this class and link to the Stripe API.
*
* @since 5.5.2
*/
public $account;
public $api_version;
public $data;
public $livemode;
public $request;
public $type;
public $pending_webhooks;

/**
* This method is not supported by this object
*
Expand Down Expand Up @@ -58,16 +71,16 @@ public static function construct_event( $payload, $sig_header, $secret, $api, $t

try {
self::verify_header( $payload, $sig_header, $secret, $tolerance );
} catch ( Exception $e ) {
return new WP_Error( $e->getMessage() );
} catch ( \Exception $e ) {
return new \WP_Error( $e->getMessage() );
}

$data = \json_decode( $payload, true );
$json_error = \json_last_error();
if ( null === $data && \JSON_ERROR_NONE !== $json_error ) {
$msg = "Invalid payload: {$payload} " . "(json_last_error() was {$json_error})";

return new WP_Error( $msg );
return new \WP_Error( $msg );
}

return new Event( $data, $api );
Expand All @@ -82,7 +95,7 @@ public static function construct_event( $payload, $sig_header, $secret, $api, $t
* @param string $secret secret used to generate the signature
* @param int $tolerance maximum difference allowed between the header's timestamp and the current time
*
* @throws Exception if the verification fails
* @throws \Exception if the verification fails
*
* @return bool
*/
Expand All @@ -91,10 +104,10 @@ public static function verify_header( $payload, $header, $secret, $tolerance = n
$timestamp = self::get_timestamp( $header );
$signatures = self::get_signatures( $header, self::EXPECTED_SCHEME );
if ( -1 === $timestamp ) {
throw \Exception( 'Unable to extract timestamp and signatures from header' );
throw new \Exception( 'Unable to extract timestamp and signatures from header' );
}
if ( empty( $signatures ) ) {
throw \Exception( 'No signatures found with expected scheme' );
throw new \Exception( 'No signatures found with expected scheme' );
}

// Check if expected signature is found in list of signatures from
Expand Down
88 changes: 88 additions & 0 deletions includes/api/model/class-invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,94 @@
*/
class Invoice extends Base {

/**
* Initialize properties that will be used throughout this class and link to the Stripe API.
*
* @since 5.5.2
*/
public $application;
public $attempted;
public $charge;
public $currency;
public $custom_fields;
public $customer;
public $description;
public $discount;
public $discounts;
public $due_date;
public $footer;
public $lines;
public $livemode;
public $metadata;
public $number;
public $paid;
public $payment_intent;
public $quote;
public $receipt_number;
public $rendering;
public $statement_descriptor;
public $status;
public $subscription;
public $subtotal;
public $tax;
public $total;
public $account_country;
public $account_name;
public $account_tax_ids;
public $amount_due;
public $amount_paid;
public $amount_remaining;
public $amount_shipping;
public $application_fee_amount;
public $attempt_count;
public $auto_advance;
public $automatic_tax;
public $billing_reason;
public $collection_method;
public $customer_address;
public $customer_email;
public $customer_name;
public $customer_phone;
public $customer_shipping;
public $customer_tax_exempt;
public $customer_tax_ids;
public $default_payment_method;
public $default_source;
public $default_tax_rates;
public $effective_at;
public $ending_balance;
public $from_invoice;
public $hosted_invoice_url;
public $invoice_pdf;
public $issuer;
public $last_finalization_error;
public $latest_revision;
public $next_payment_attempt;
public $on_behalf_of;
public $paid_out_of_band;
public $payment_settings;
public $period_end;
public $period_start;
public $post_payment_credit_notes_amount;
public $pre_payment_credit_notes_amount;
public $rendering_options;
public $shipping_cost;
public $shipping_details;
public $starting_balance;
public $status_transitions;
public $subscription_details;
public $subscription_proration_date;
public $subtotal_excluding_tax;
public $test_clock;
public $threshold_reason;
public $total_discount_amounts;
public $total_excluding_tax;
public $total_tax_amounts;
public $transfer_data;
public $webhooks_delivered_at;



/**
* Returns the API endpoint for this object.
*
Expand Down
Loading

0 comments on commit 02abe99

Please sign in to comment.