diff --git a/CHANGELOG.md b/CHANGELOG.md index a899d06..1f8c2f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Stripe Payments Changelog +## 5.5.0 - 2023.10.30 +### Added +- Added Craft CMS requirement `^4.5.0` + +### Fixed +- Fixed issue when adding subscription plan on customer chooses plan only on Craft CMS `^4.5.0` and for new installations ([#369]) + +[#369]: https://github.com/enupal/stripe/issues/369 + ## 5.4.0 - 2023.09.28 ### Updated - Updated Stripe lib to v10 diff --git a/composer.json b/composer.json index 8175be1..aa510a9 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "enupal/stripe", "description": "Allows customers sign up for recurring and one-time payments with Stripe, perfect for orders, donations, subscriptions, and events. Create simple payment forms in seconds easily without coding. For Craft CMS 3.x", "type": "craft-plugin", - "version": "5.4.0", + "version": "5.5.0", "keywords": [ "craft", "cms", @@ -42,7 +42,7 @@ "docs": "https://docs.enupal.com/stripe-payments/" }, "require": { - "craftcms/cms": "^4.0.0", + "craftcms/cms": "^4.5.0", "stripe/stripe-php": "^10.0", "phpoffice/phpspreadsheet": "^1.16" }, diff --git a/src/Stripe.php b/src/Stripe.php index 159b95a..7e28353 100644 --- a/src/Stripe.php +++ b/src/Stripe.php @@ -56,7 +56,7 @@ class Stripe extends Plugin public static $app; public bool $hasCpSection = true; public bool $hasCpSettings = true; - public string $schemaVersion = '5.1.0'; + public string $schemaVersion = '5.5.0'; public function init() { diff --git a/src/migrations/m231030_000000_update_enupalmultipleplans_selectplan.php b/src/migrations/m231030_000000_update_enupalmultipleplans_selectplan.php new file mode 100644 index 0000000..ad6026b --- /dev/null +++ b/src/migrations/m231030_000000_update_enupalmultipleplans_selectplan.php @@ -0,0 +1,54 @@ +select(['*']) + ->from('{{%fields}}') + ->where(["name" => 'Select Plan', 'handle' => 'selectPlan', 'type' => 'craft\fields\Dropdown']) + ->andWhere(['like', 'context', 'matrixBlockType:%', false]) + ->one(); + + if (empty($field)) { + Craft::error('Unable to find Stripe Payment field selectPlan', __METHOD__); + return null; + } + + $column = 'field_subscriptionPlan_selectPlan_'.$field['columnSuffix']; + + if ($this->db->columnExists($matrixTable, $column)) { + $this->alterColumn($matrixTable, $column, $this->string(255)); + } else { + Craft::error('Unable to find Stripe Payment select plan column: '.$column, __METHOD__); + } + + return true; + } + + /** + * @inheritdoc + */ + public function safeDown() + { + echo "m230208_000000_add_adjustable_quantity cannot be reverted.\n"; + + return false; + } +} diff --git a/src/services/PaymentForms.php b/src/services/PaymentForms.php index bd28b8f..c08c617 100644 --- a/src/services/PaymentForms.php +++ b/src/services/PaymentForms.php @@ -1496,7 +1496,7 @@ private function createMultiplePlansMatrixField() 'handle' => 'selectPlan', 'instructions' => "Can't see your plans? Go to [Subscriptions]($subscriptionUrl) and click on Refresh Plans", 'required' => 1, - 'typesettings' => '{"options":[{"label":"Select Plan...","value":"","default":""}]}', + 'typesettings' => '{"columnType":"string", "options":[{"label":"Select Plan...","value":"","default":""}]}', 'translationMethod' => Field::TRANSLATION_METHOD_SITE, ], 'new2' => [