Skip to content

Commit 8a2d026

Browse files
committed
First commit
0 parents  commit 8a2d026

17 files changed

+1087
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.idea
2+
*.patch
3+
*.rej
4+
*.orig

LICENSE.txt

Lines changed: 339 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Stripe API Drupal module
2+
------------------------
3+
Provider Stripe as forked from: https://www.drupal.org/project/stripe_api
4+
5+
This module provides a simple abstraction to use the Stripe PHP SDK.

composer.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "wasare/provider_stripe",
3+
"type": "drupal-module",
4+
"description": "Provides an integration to use the Stripe API library",
5+
"keywords": [
6+
"Drupal"
7+
],
8+
"license": "GPL-2.0+",
9+
"homepage": "https://github.com/wasare/provider_stripe",
10+
"minimum-stability": "dev",
11+
"support": {
12+
"issues": "https://github.com/wasare/provider_stripe/issues",
13+
"source": "https://github.com/wasare/provider_stripe"
14+
},
15+
"repositories": {
16+
"wasare": {
17+
"type": "path",
18+
"url": "https://github.com/wasare/provider_stripe"
19+
}
20+
},
21+
"require": {
22+
"stripe/stripe-php": "^7.36",
23+
"drupal/key": "^1.1"
24+
},
25+
"extra": {
26+
"branch-alias": {
27+
"dev-master": "1.x-dev"
28+
}
29+
}
30+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
test_secret_key: ''
2+
test_public_key: ''
3+
live_secret_key: ''
4+
live_public_key: ''
5+
log_webhooks: TRUE
6+
enable_webhooks: TRUE
7+
mode: 'test'

provider_stripe.info.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: '[Provider] Stripe'
2+
description: 'Provides an integration to use the Stripe API library'
3+
core_version_requirement: ^9
4+
type: module
5+
package: Provider
6+
configure: provider_stripe.admin
7+
dependencies:
8+
- key:key

provider_stripe.links.menu.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
provider_stripe.admin:
2+
title: 'Provider Stripe'
3+
description: 'Edit Provider Stripe API credentials.'
4+
parent: system.admin_config_services
5+
route_name: provider_stripe.admin

provider_stripe.module

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
/**
4+
* Implements hook_preprocess_HOOK().
5+
*/
6+
function provider_stripe_preprocess_page(&$variables) {
7+
$admin_context = \Drupal::service('router.admin_context');
8+
if ($admin_context->isAdminRoute()) {
9+
/** @var $stripe_api \Drupal\provider_stripe\StripeApiService **/
10+
$stripe_api = \Drupal::service('provider_stripe.stripe_api');
11+
if ($stripe_api->getMode() === 'test') {
12+
\Drupal::messenger()
13+
->addMessage(t('Provider Stripe is running in test mode.'),
14+
\Drupal\Core\Messenger\MessengerInterface::TYPE_WARNING);
15+
}
16+
}
17+
// $module_data = \Drupal::config('core.extension')->get('module');
18+
// unset($module_data['subscription_manager']);
19+
// \Drupal::configFactory()->getEditable('core.extension')->set('module', $module_data)->save();
20+
}

provider_stripe.permissions.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
administer provider stripe:
2+
title: 'Administer Provider Stripe'

provider_stripe.routing.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
provider_stripe.admin:
2+
path: '/admin/config/services/provider/stripe'
3+
defaults:
4+
_form: '\Drupal\provider_stripe\Form\StripeApiAdminForm'
5+
_title: 'Provider Stripe Settings'
6+
requirements:
7+
_permission: 'administer provider stripe'
8+
options:
9+
_admin_route: TRUE
10+
11+
provider_stripe.webhook:
12+
path: '/provider/stripe/webhook'
13+
methods: [POST]
14+
defaults:
15+
_controller: '\Drupal\provider_stripe\Controller\StripeApiWebhook::handleIncomingWebhook'
16+
requirements:
17+
_permission: 'access content'
18+
_content_type_format: json
19+
20+
provider_stripe.webhook_redirect:
21+
path: '/provider/stripe/webhook'
22+
methods: [GET, HEAD, PUT, DELETE]
23+
defaults:
24+
_controller: '\Drupal\provider_stripe\Controller\StripeApiWebhookRedirect::webhookRedirect'
25+
requirements:
26+
_permission: 'access content'

0 commit comments

Comments
 (0)