From de40281e2233e1cafb5cc5d2b675296ec19d7715 Mon Sep 17 00:00:00 2001 From: = Date: Fri, 25 Dec 2020 14:15:43 +1100 Subject: [PATCH] Fixes for migrating online payment gateways --- app/Traits/GenerateMigrationResources.php | 146 +++++++++++++++++++++- storage/framework/.DS_Store | Bin storage/import/.gitignore | 0 storage/migrations/.gitignore | 0 storage/templates/bold.js | 0 storage/templates/business.js | 0 storage/templates/clean.css | 0 storage/templates/clean.html | 0 storage/templates/clean.js | 0 storage/templates/creative.js | 0 storage/templates/elegant.js | 0 storage/templates/hipster.js | 0 storage/templates/modern.js | 0 storage/templates/photo.js | 0 storage/templates/plain.js | 0 storage/templates/playful.js | 0 16 files changed, 145 insertions(+), 1 deletion(-) mode change 100644 => 100755 storage/framework/.DS_Store mode change 100644 => 100755 storage/import/.gitignore mode change 100644 => 100755 storage/migrations/.gitignore mode change 100644 => 100755 storage/templates/bold.js mode change 100644 => 100755 storage/templates/business.js mode change 100644 => 100755 storage/templates/clean.css mode change 100644 => 100755 storage/templates/clean.html mode change 100644 => 100755 storage/templates/clean.js mode change 100644 => 100755 storage/templates/creative.js mode change 100644 => 100755 storage/templates/elegant.js mode change 100644 => 100755 storage/templates/hipster.js mode change 100644 => 100755 storage/templates/modern.js mode change 100644 => 100755 storage/templates/photo.js mode change 100644 => 100755 storage/templates/plain.js mode change 100644 => 100755 storage/templates/playful.js diff --git a/app/Traits/GenerateMigrationResources.php b/app/Traits/GenerateMigrationResources.php index dda114273a..25b85b4bbf 100644 --- a/app/Traits/GenerateMigrationResources.php +++ b/app/Traits/GenerateMigrationResources.php @@ -1038,7 +1038,7 @@ trait GenerateMigrationResources foreach ($gateway_types as $gateway_type_id) { $transformed[] = [ - 'id' => $account_gateway->id, + 'id' => $this->translateGatewaysId($account_gateway->id), 'user_id' => $account_gateway->user_id, 'gateway_key' => $this->getGatewayKeyById($account_gateway->gateway_id), 'accepted_credit_cards' => $account_gateway->accepted_credit_cards, @@ -1059,6 +1059,150 @@ trait GenerateMigrationResources return $transformed; } + /*converts the gateway ID to the new v5 list*/ + private function translateGatewaysId($gateway_id) + { + switch ($gateway_id) { + case 1: + case 2: + return 1; + case 3: + return 2; + case 4: + return 3; + case 5: + return 4; + case 6: + return 52; + case 7: + return 5; + case 8: + return 6; + case 9: + return 7; + case 10: + return 8; + case 11: + return 9; + case 12: + return 10; + case 13: + return 11; + case 14: + return 12; + case 15: + return 13; + case 16: + return 14; + case 17: + return 15; + case 18: + return 16; + case 19: + return 17; + case 20: + return 18; + case 21: + return 0; // + case 22: + return 19; + case 23: + return 20; + case 24: + return 21; + case 25: + return 22; + case 26: + return 23; + case 27: + return 24; + case 28: + return 25; + case 29: + case 30: + return 0; // + case 31: + return 26; + case 32: + return 27; + case 33: + return 28; + case 34: + return 29; + case 35: + return 30; + case 36: + return 0; // + case 37: + return 31; + case 38: + return 0; + case 39: + return 32; + case 40: + return 33; + case 41: + return 34; + case 42: + return 35; + case 43: + return 0; + case 44: + return 36; + case 45: + return 37; + case 46: + return 38; + case 47: + return 39; + case 48: + return 40; + case 49: + return 41; + case 50: + return 42; + case 51: + return 43; + case 52: + return 44; + case 53: + case 54: + return 0; + case 55: + return 45; + case 56: + return 46; + case 57: + return 47; + case 58: + return 48; + case 59: + return 0; + case 60: + return 49; + case 61: + return 50; + case 62: + return 55; + case 63: + return 51; + case 64: + return 52; + case 65: + return 53; + case 66: + return 54; + case 67: + case 68: + return 55; + default: + return 0; + break; + } + } + + + private function getClientGatewayTokens() { $payment_methods = PaymentMethod::where('account_id', $this->account->id)->withTrashed()->get(); diff --git a/storage/framework/.DS_Store b/storage/framework/.DS_Store old mode 100644 new mode 100755 diff --git a/storage/import/.gitignore b/storage/import/.gitignore old mode 100644 new mode 100755 diff --git a/storage/migrations/.gitignore b/storage/migrations/.gitignore old mode 100644 new mode 100755 diff --git a/storage/templates/bold.js b/storage/templates/bold.js old mode 100644 new mode 100755 diff --git a/storage/templates/business.js b/storage/templates/business.js old mode 100644 new mode 100755 diff --git a/storage/templates/clean.css b/storage/templates/clean.css old mode 100644 new mode 100755 diff --git a/storage/templates/clean.html b/storage/templates/clean.html old mode 100644 new mode 100755 diff --git a/storage/templates/clean.js b/storage/templates/clean.js old mode 100644 new mode 100755 diff --git a/storage/templates/creative.js b/storage/templates/creative.js old mode 100644 new mode 100755 diff --git a/storage/templates/elegant.js b/storage/templates/elegant.js old mode 100644 new mode 100755 diff --git a/storage/templates/hipster.js b/storage/templates/hipster.js old mode 100644 new mode 100755 diff --git a/storage/templates/modern.js b/storage/templates/modern.js old mode 100644 new mode 100755 diff --git a/storage/templates/photo.js b/storage/templates/photo.js old mode 100644 new mode 100755 diff --git a/storage/templates/plain.js b/storage/templates/plain.js old mode 100644 new mode 100755 diff --git a/storage/templates/playful.js b/storage/templates/playful.js old mode 100644 new mode 100755