-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add support for ExpiredPaidLate order status.
* Register and listen to PaymentSettled webhook events. * Add UpdateManager to process and perform needed updates once. * Add update routines for order states and update Webhook event config on BTCPay Server. * Bump version.
- Loading branch information
Showing
8 changed files
with
252 additions
and
34 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
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,40 @@ | ||
<?php | ||
|
||
namespace BTCPayServer\WC\Helper; | ||
|
||
use BTCPayServer\WC\Admin\Notice; | ||
|
||
class UpdateManager { | ||
|
||
private static $updates = [ | ||
'1.0.3' => 'update-1.0.3.php' | ||
]; | ||
|
||
/** | ||
* Runs updates if available or just updates the stored version. | ||
*/ | ||
public static function processUpdates() { | ||
|
||
// Check stored version to see if update is needed, will only run once. | ||
$runningVersion = get_option( BTCPAYSERVER_VERSION_KEY, '1.0.2' ); | ||
|
||
if ( version_compare( $runningVersion, BTCPAYSERVER_VERSION, '<' ) ) { | ||
|
||
// Run update scripts if there are any. | ||
foreach ( self::$updates as $updateVersion => $filename ) { | ||
if ( version_compare( $runningVersion, $updateVersion, '<' ) ) { | ||
$file = BTCPAYSERVER_PLUGIN_FILE_PATH . 'updates/' . $filename; | ||
if ( file_exists( $file ) ) { | ||
include $file; | ||
} | ||
$runningVersion = $updateVersion; | ||
update_option( BTCPAYSERVER_VERSION_KEY, $updateVersion ); | ||
Notice::addNotice('success', 'BTCPay Server: successfully ran updates to version ' . $runningVersion, true); | ||
} | ||
} | ||
|
||
update_option( BTCPAYSERVER_VERSION_KEY, BTCPAYSERVER_VERSION ); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.