-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from omarxp/support-drupal-9-and-enhancement
Support Drupal 9 and Enhancement
- Loading branch information
Showing
56 changed files
with
1,491 additions
and
7,386 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
commerce_midtrans_notification: | ||
category: commerce_order | ||
label: 'Notification' | ||
template: '<p><strong>Midtrans Notification:</strong><br /> | ||
Drupal Order ID: {{ order_id }}<br> | ||
Midtrans Transaction ID: {{ transaction_id }}<br> | ||
Transaction Status: {{ transaction_status }}<br> | ||
Payment Type: {{ payment_type }}<br> | ||
</p>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
adminmodule: | ||
version: VERSION | ||
js: | ||
js/midtrans.admin.js: {} | ||
dependencies: | ||
- core/jquery | ||
- core/jquery.once | ||
- core/drupal | ||
- core/drupalSettings | ||
|
||
checkout: | ||
version: VERSION | ||
js: | ||
js/midtrans.checkout.js: {} | ||
dependencies: | ||
- core/jquery | ||
- core/jquery.once | ||
- core/drupal | ||
- core/drupalSettings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "midtrans/midtrans-drupal8", | ||
"description": "The official Midtrans extension for the Drupal Commerce 2", | ||
"homepage": "https://midtrans.com", | ||
"version": "2.0.0", | ||
"type": "drupal-module", | ||
"license":"MIT", | ||
"require": { | ||
"midtrans/midtrans-php": "^2.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// This file for dynamically put sandbox/production text label on API keys field, according to selected API env mode. | ||
// For each of Midtrans Modules (fullpayment, installment, promo etc) | ||
|
||
(function ($, Drupal, drupalSettings) { | ||
'use strict'; | ||
|
||
Drupal.behaviors.initMidtransModule = { | ||
attach: function (context) { | ||
var midtransSettings = drupalSettings.commerce_midtrans; | ||
var midtransModule = $(context).find(midtransSettings.id); | ||
if (midtransModule.length > 0) { | ||
updateEnvMode(midtransSettings.module); | ||
} | ||
} | ||
}; | ||
|
||
function updateEnvMode(moduleName) { | ||
var selectorName = moduleName.replace('_', '-'); | ||
var mode = $("input[type='radio'][name='configuration[" +moduleName+ "][mode]']:checked").val(); | ||
updateTextLabel(selectorName, mode); | ||
|
||
$("input[type='radio'][name='configuration[" +moduleName+ "][mode]']").on('change', function() { | ||
updateTextLabel(selectorName, this.value); | ||
}); | ||
} | ||
|
||
function updateTextLabel(selectorName, mode) { | ||
var hrefs = document.querySelectorAll('.config_info'); | ||
var textLabel = capitalizeLabel(mode); | ||
var subdomain = (mode == 'sandbox') ? 'dashboard.sandbox' : 'dashboard'; | ||
document.querySelector('label[for^="edit-configuration-' +selectorName+ '-server-key"]').innerText = "Server Key " +textLabel; | ||
document.querySelector('label[for^="edit-configuration-' +selectorName+ '-client-key"]').innerText = "Client Key " +textLabel; | ||
hrefs.forEach(function(e){ | ||
e.href = 'https://' +subdomain+ '.midtrans.com/settings/config_info' | ||
}); | ||
} | ||
|
||
function capitalizeLabel(string) { | ||
return string[0].toUpperCase() + string.slice(1); | ||
} | ||
|
||
})(jQuery, Drupal, drupalSettings); |
Oops, something went wrong.