| @@ -45,8 +45,9 @@ | ||
| 45 | 45 | use IvyForms\Controllers\GoogleSheets\GoogleSheetsListColumnsController; |
| 46 | 46 | use IvyForms\Controllers\GoogleSheets\GoogleSheetsListIntegrationsController; |
| 47 | 47 | use IvyForms\Controllers\GoogleSheets\GoogleSheetsListSpreadsheetsController; |
| 48 | 48 | use IvyForms\Controllers\GoogleSheets\GoogleSheetsListWorksheetsController; |
| 49 | +use IvyForms\Controllers\GoogleSheets\GoogleSheetsPickerConfigController; | |
| 49 | 50 | use IvyForms\Controllers\GoogleSheets\GoogleSheetsStatusController; |
| 50 | 51 | use IvyForms\Controllers\GoogleSheets\GoogleSheetsUpdateController; |
| 51 | 52 | use IvyForms\Controllers\GoogleSheets\GoogleSheetsUpdateStatusController; |
| 52 | 53 | use IvyForms\Services\Settings\SettingsService; |
| @@ -51,8 +52,14 @@ | ||
| 51 | 52 | use IvyForms\Controllers\GoogleSheets\GoogleSheetsUpdateStatusController; |
| 52 | 53 | use IvyForms\Services\Settings\SettingsService; |
| 53 | 54 | use IvyForms\Services\Usage\UsageTrackingService; |
| 54 | 55 | use IvyForms\Vendor\Melograno\UsageTracker\Collectors\Plugin\IvyFormsCollector; |
| 56 | +use IvyForms\Services\Payment\FormSubmissionPaymentService; | |
| 57 | +use IvyForms\Services\Payment\OrderManager; | |
| 58 | +use IvyForms\Services\Payment\PaymentAmountCalculator; | |
| 59 | +use IvyForms\Services\Payment\PaymentGatewayRegistry; | |
| 60 | +use IvyForms\Services\Payment\PaymentManager; | |
| 61 | +use IvyForms\Services\Payment\SquarePaymentGateway; | |
| 55 | 62 | |
| 56 | 63 | return [ |
| 57 | 64 | |
| 58 | 65 | MenuManager::class => function ($container) { |
| @@ -99,9 +106,10 @@ | ||
| 99 | 106 | $container->get(SecurityService::class), |
| 100 | 107 | $container->get(EntryService::class), |
| 101 | 108 | $container->get(NotificationService::class), |
| 102 | 109 | $container->get(MailerService::class), |
| 103 | - $container->get(ConfirmationService::class) | |
| 110 | + $container->get(ConfirmationService::class), | |
| 111 | + $container->get(FormSubmissionPaymentService::class) | |
| 104 | 112 | ); |
| 105 | 113 | }, |
| 106 | 114 | |
| 107 | 115 | GoogleSheetsRequestSanitizer::class => static function () { |
| @@ -169,8 +177,14 @@ | ||
| 169 | 177 | $container->get(GoogleSheetsService::class) |
| 170 | 178 | ); |
| 171 | 179 | }, |
| 172 | 180 | |
| 181 | + GoogleSheetsPickerConfigController::class => static function ($container) { | |
| 182 | + return new GoogleSheetsPickerConfigController( | |
| 183 | + $container->get(GoogleSheetsService::class) | |
| 184 | + ); | |
| 185 | + }, | |
| 186 | + | |
| 173 | 187 | GoogleSheetsListSpreadsheetsController::class => static function ($container) { |
| 174 | 188 | return new GoogleSheetsListSpreadsheetsController( |
| 175 | 189 | $container->get(GoogleSheetsService::class) |
| 176 | 190 | ); |
| @@ -248,8 +262,31 @@ | ||
| 248 | 262 | }, |
| 249 | 263 | |
| 250 | 264 | UsageTrackingService::class => function ($container) { |
| 251 | 265 | return new UsageTrackingService($container->get(IvyFormsCollector::class)); |
| 266 | + }, | |
| 267 | + | |
| 268 | + PaymentGatewayRegistry::class => function ($container) { | |
| 269 | + $registry = new PaymentGatewayRegistry(); | |
| 270 | + $registry->register($container->get(SquarePaymentGateway::class)); | |
| 271 | + | |
| 272 | + /** | |
| 273 | + * Allow Pro/addons to register additional payment gateways. | |
| 274 | + * | |
| 275 | + * The action receives the registry and PHP-DI container. | |
| 276 | + */ | |
| 277 | + do_action('ivyforms/payment/register_gateways', $registry, $container); | |
| 278 | + | |
| 279 | + return $registry; | |
| 280 | + }, | |
| 281 | + | |
| 282 | + FormSubmissionPaymentService::class => function ($container) { | |
| 283 | + return new FormSubmissionPaymentService( | |
| 284 | + $container->get(PaymentAmountCalculator::class), | |
| 285 | + $container->get(PaymentManager::class), | |
| 286 | + $container->get(OrderManager::class), | |
| 287 | + $container->get(PaymentGatewayRegistry::class) | |
| 288 | + ); | |
| 252 | 289 | }, |
| 253 | 290 | |
| 254 | 291 | // GetAllIntegrationsController::class => function ($container) { |
| 255 | 292 | // return new GetAllIntegrationsController( |