mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 17:18:29 -04:00 
			
		
		
		
	Merge pull request #6688 from turbo124/v5-develop
Fixes for square test mode
This commit is contained in:
		
						commit
						43c607262f
					
				| @ -0,0 +1,52 @@ | |||||||
|  | <?php | ||||||
|  | 
 | ||||||
|  | use App\Models\Credit; | ||||||
|  | use App\Models\Gateway; | ||||||
|  | use App\Models\Invoice; | ||||||
|  | use App\Models\Quote; | ||||||
|  | use App\Utils\Ninja; | ||||||
|  | use Illuminate\Database\Migrations\Migration; | ||||||
|  | use Illuminate\Database\Schema\Blueprint; | ||||||
|  | use Illuminate\Support\Facades\Schema; | ||||||
|  | 
 | ||||||
|  | class SetSquareTestModeBoolean extends Migration | ||||||
|  | { | ||||||
|  |     /** | ||||||
|  |      * Run the migrations. | ||||||
|  |      * | ||||||
|  |      * @return void | ||||||
|  |      */ | ||||||
|  |     public function up() | ||||||
|  |     { | ||||||
|  |         //
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Reverse the migrations. | ||||||
|  |      * | ||||||
|  |      * @return void | ||||||
|  |      */ | ||||||
|  |     public function down() | ||||||
|  |     { | ||||||
|  |         //Fixes a state where the deleted_at timestamp is 000 
 | ||||||
|  |          | ||||||
|  |         if(!Ninja::isHosted()) | ||||||
|  |         { | ||||||
|  | 
 | ||||||
|  |             Invoice::withTrashed()->where('deleted_at', '0000-00-00 00:00:00.000000')->update(['deleted_at' => null]); | ||||||
|  |             Quote::withTrashed()->where('deleted_at', '0000-00-00 00:00:00.000000')->update(['deleted_at' => null]); | ||||||
|  |             Credit::withTrashed()->where('deleted_at', '0000-00-00 00:00:00.000000')->update(['deleted_at' => null]); | ||||||
|  | 
 | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         // fixes a bool cast to string back to bool
 | ||||||
|  |         if($gateway = Gateway::find(57)) | ||||||
|  |         { | ||||||
|  |             $fields = json_decode($gateway->fields); | ||||||
|  |             $fields->testMode = false; | ||||||
|  | 
 | ||||||
|  |             $gateway->fields = json_encode($fields); | ||||||
|  |             $gateway->save(); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -80,7 +80,7 @@ class PaymentLibrariesSeeder extends Seeder | |||||||
|             ['id' => 53, 'name' => 'PagSeguro', 'provider' => 'PagSeguro', 'key' => 'ef498756b54db63c143af0ec433da803', 'fields' => '{"email":"","token":"","sandbox":false}'], |             ['id' => 53, 'name' => 'PagSeguro', 'provider' => 'PagSeguro', 'key' => 'ef498756b54db63c143af0ec433da803', 'fields' => '{"email":"","token":"","sandbox":false}'], | ||||||
|             ['id' => 54, 'name' => 'PAYMILL', 'provider' => 'Paymill', 'key' => 'ca52f618a39367a4c944098ebf977e1c', 'fields' => '{"apiKey":""}'], |             ['id' => 54, 'name' => 'PAYMILL', 'provider' => 'Paymill', 'key' => 'ca52f618a39367a4c944098ebf977e1c', 'fields' => '{"apiKey":""}'], | ||||||
|             ['id' => 55, 'name' => 'Custom', 'provider' => 'Custom', 'is_offsite' => true, 'sort_order' => 21, 'key' => '54faab2ab6e3223dbe848b1686490baa', 'fields' => '{"name":"","text":""}'], |             ['id' => 55, 'name' => 'Custom', 'provider' => 'Custom', 'is_offsite' => true, 'sort_order' => 21, 'key' => '54faab2ab6e3223dbe848b1686490baa', 'fields' => '{"name":"","text":""}'], | ||||||
|             ['id' => 57, 'name' => 'Square', 'provider' => 'Square', 'is_offsite' => false, 'sort_order' => 21, 'key' => '65faab2ab6e3223dbe848b1686490baz', 'fields' => '{"accessToken":"","applicationId":"","locationId":"","testMode":"false"}'], |             ['id' => 57, 'name' => 'Square', 'provider' => 'Square', 'is_offsite' => false, 'sort_order' => 21, 'key' => '65faab2ab6e3223dbe848b1686490baz', 'fields' => '{"accessToken":"","applicationId":"","locationId":"","testMode":false}'], | ||||||
|         ]; |         ]; | ||||||
| 
 | 
 | ||||||
|         foreach ($gateways as $gateway) { |         foreach ($gateways as $gateway) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user