Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117892621
D5319.1775365859.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D5319.1775365859.diff
View Options
diff --git a/src/app/Console/Commands/OwnerSwapCommand.php b/src/app/Console/Commands/OwnerSwapCommand.php
--- a/src/app/Console/Commands/OwnerSwapCommand.php
+++ b/src/app/Console/Commands/OwnerSwapCommand.php
@@ -86,11 +86,13 @@
$target->save();
}
- // Move plan_id setting
- if ($plan_id = $source->getSetting('plan_id')) {
- $target->setSetting('plan_id', $plan_id);
- $source->removeSetting('plan_id');
- }
+ // Move plan_id, *_policy settings
+ $source->settings()->whereLike('key', '%_policy')->orWhere('key', 'plan_id')
+ ->get()
+ ->each(function ($setting) use ($target) {
+ $target->setSetting($setting->key, $setting->value);
+ $setting->delete();
+ });
}
/**
diff --git a/src/tests/Feature/Console/OwnerSwapTest.php b/src/tests/Feature/Console/OwnerSwapTest.php
--- a/src/tests/Feature/Console/OwnerSwapTest.php
+++ b/src/tests/Feature/Console/OwnerSwapTest.php
@@ -58,6 +58,7 @@
$owner->created_at = \now()->subMonths(1);
$owner->save();
$owner->setSetting('plan_id', 'test');
+ $owner->setSetting('greylist_policy', 'true');
$entitlements = $wallet->entitlements()->orderBy('id')->pluck('id')->all();
$this->assertCount(15, $entitlements);
@@ -94,11 +95,15 @@
$this->assertTrue($user->created_at->toDateTimeString() === $owner->created_at->toDateTimeString());
$this->assertSame('test', $target_wallet->getSetting('test'));
$this->assertSame('test', $user->getSetting('plan_id'));
+ $this->assertSame('true', $user->getSetting('greylist_policy'));
+ $this->assertNull($owner->getSetting('plan_id'));
+ $this->assertNull($owner->getSetting('greylist_policy'));
$wallet->refresh();
$this->assertNull($wallet->getSetting('test'));
$this->assertSame(0, $wallet->balance);
+ sleep(2); // it may take a while for Mollie to notice the new customer
$target_customer = $this->getMollieCustomer($target_wallet->getSetting('mollie_id'));
$this->assertSame($customer->id, $target_customer->id);
$this->assertTrue($customer->email != $target_customer->email);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 5, 5:10 AM (19 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18832437
Default Alt Text
D5319.1775365859.diff (2 KB)
Attached To
Mode
D5319: Move policy settings on wallet owner swap
Attached
Detach File
Event Timeline