Skip to content

Commit

Permalink
Merge pull request #17 from omarxp/thankyoupage
Browse files Browse the repository at this point in the history
Add thankyou page for akulaku
  • Loading branch information
omarxp committed Sep 8, 2021
2 parents c61d4ba + 983b1d0 commit 12c1e4b
Show file tree
Hide file tree
Showing 68 changed files with 7,467 additions and 110 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_STORE
34 changes: 34 additions & 0 deletions Maintaining.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
### Releasing / Publishing Module to Drupal.Org
Module Project URL: https://www.drupal.org/project/midtrans_commerce
Drupal Git Repository URL: https://git.drupalcode.org/project/midtrans_commerce

#### HOW TO:
##### Prepare:
1. Get drupal git access with ssh key
2. Clone or add remote url : `git remote add drupal git@git.drupal.org:project/midtrans_commerce.git`
3. Update module (new features, bug fixes, etc)

##### Update Version:
1. Open midtrans_commerce.info.yml and remove (version, project, datestamp), this will automatically added by drupal when user install the module, sample:
```
# Information added by Drupal.org packaging script on 2021-09-07
version: '2.1.0-alpha2'
project: 'midtrans_commerce'
datestamp: 1631003789
```
2. update version in Readme.md file

##### Release:
1. Open https://www.drupal.org/project/midtrans_commerce
2. Scroll to bottom and click Add new release
3. Please follow this docs to release to drupal.org
Release naming conventions: https://www.drupal.org/node/1015226
Creating project release: https://www.drupal.org/docs/develop/git/git-for-drupal-project-maintainers/creating-a-project-release
Valid release branch examples:
2.0.x
2.1.x
Valid release tag examples:
2.0.1
2.1.0-alpha1
2.1.0-alpha2
2.1.0
40 changes: 10 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,32 @@ Midtrans Drupal 8/9 Commerce Payment Gateway Module
Midtrans :heart: Drupal 8/9!
Let your Drupal Commerce 2 store integrated with Midtrans payment gateway.

### Description
#### Description
This is the official Midtrans extension for the Drupal Commerce 2 E-commerce platform.

### Version
2.0.1
#### Version
2.1.0
(for Drupal v8.x and Drupal v9.x)

### Requirements
The following plugin is tested under following environment:
#### Requirements
The following module is tested under following environment:

* PHP v5.6.x or greater
* MySQL version 5.0 or greater
* Drupal v8.x or greater
* [Midtrans PHP Library](https://github.com/Midtrans/midtrans-php)
* [Drupal v8.x or greater](https://www.drupal.org/project/drupal)
* [Drupal Commerce 8.x-2.xx ](http://www.drupal.org/project/commerce)

#### Composer Installation
If you are using [Composer](https://getcomposer.org), you can install via composer CLI
By default, composer.json in drupal site only add drupal repository, because this plugin store in github, you need add this require line to your `composer.json` file:

```json
"repositories": [
{
"type": "vcs",
"url": "https://github.com/midtrans/midtrans-drupal8"
}
]
```
run: `composer require midtrans/midtrans-drupal8` on your terminal.

or
```json
{
"require": {
"midtrans/midtrans-drupal8": "2.0.1"
}
}
```
run `composer update` on your terminal.
run: `composer require drupal/midtrans_commerce` on your terminal.

#### Manual Instalation
The manual installation method involves downloading our feature-rich plugin and uploading it to your webserver via your favourite FTP application.

1. Download the plugin file to your computer and unzip it, rename folder to ``commerce_midtrans``.
1. Download the plugin file to your computer and unzip it, rename folder to ``midtrans_commerce``.
2. Using an FTP program, or your hosting control panel, upload the unzipped plugin folder to your Drupal modules installation's ``[Drupal folder]/modules/contrib/`` directory.


#### Plugin Configuration
1. Open drupal admin page, open menu **Extend**.
2. Look for **Commerce Midtrans** modules under COMMERCE (CONTRIB) group, enable by ticking the checkboxes.
Expand All @@ -64,7 +44,7 @@ The manual installation method involves downloading our feature-rich plugin and
#### Midtrans Map Configuration
1. Go to **Settings > Configuration**.
2. Insert ``http://[your web]/payment/notify/midtrans`` as your Payment Notification URL in your MAP.
3. Insert ``http://[your web]`` link as Finish/Unfinish/Error Redirect URL in your MAP configuration.
3. Insert ``http://[your web]/payment/finish/midtrans`` link as Finish/Unfinish/Error Redirect URL in your MAP configuration.

#### Advanced Usage
<details>
Expand Down
10 changes: 0 additions & 10 deletions commerce_midtrans.routing.yml

This file was deleted.

12 changes: 4 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"name": "midtrans/midtrans-drupal8",
"name": "drupal/midtrans_commerce",
"description": "The official Midtrans extension for the Drupal Commerce 2",
"homepage": "https://midtrans.com",
"version": "2.0.1",
"type": "drupal-module",
"license":"MIT",
"require": {
"midtrans/midtrans-php": "^2.4"
}
"homepage": "http://drupal.org/project/midtrans_commerce",
"license": "GPL-2.0+",
"type": "drupal-module"
}
Binary file removed config/.DS_Store
Binary file not shown.
File renamed without changes.
2 changes: 1 addition & 1 deletion js/midtrans.admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Drupal.behaviors.initMidtransModule = {
attach: function (context) {
var midtransSettings = drupalSettings.commerce_midtrans;
var midtransSettings = drupalSettings.midtrans_commerce;
var midtransModule = $(context).find(midtransSettings.id);
if (midtransModule.length > 0) {
updateEnvMode(midtransSettings.module);
Expand Down
4 changes: 2 additions & 2 deletions js/midtrans.checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
attach: function (context) {
var $midtransModule = $(context).find('#midtrans-checkout');
if ($midtransModule.length > 0) {
var midtransSettings = drupalSettings.commerce_midtrans;
var midtransSettings = drupalSettings.midtrans_commerce;
$midtransModule.once('init-midtrans-checkout').each(function () {
var script = document.createElement('script');
script.type = 'text/javascript';
Expand Down Expand Up @@ -62,7 +62,7 @@
}
};

(function(c,a){if(!a.__SV){var b=window;try{var d,m,j,k=b.location,f=k.hash;d=function(a,b){return(m=a.match(RegExp(b+"=([^&]*)")))?m[1]:null};f&&d(f,"state")&&(j=JSON.parse(decodeURIComponent(d(f,"state"))),"mpeditor"===j.action&&(b.sessionStorage.setItem("_mpcehash",f),history.replaceState(j.desiredHash||"",c.title,k.pathname+k.search)))}catch(n){}var l,h;window.mixpanel=a;a._i=[];a.init=function(b,d,g){function c(b,i){var a=i.split(".");2==a.length&&(b=b[a[0]],i=a[1]);b[i]=function(){b.push([i].concat(Array.prototype.slice.call(arguments,0)))}}var e=a;"undefined"!==typeof g?e=a[g]=[]:g="mixpanel";e.people=e.people||[];e.toString=function(b){var a="mixpanel";"mixpanel"!==g&&(a+="."+g);b||(a+=" (stub)");return a};e.people.toString=function(){return e.toString(1)+".people (stub)"};l="disable time_event track track_pageview track_links track_forms track_with_groups add_group set_group remove_group register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user people.remove".split(" ");for(h=0;h<l.length;h++)c(e,l[h]);var f="set set_once union unset remove delete".split(" ");e.get_group=function(){function a(c){b[c]=function(){call2_args=arguments;call2=[c].concat(Array.prototype.slice.call(call2_args,0));e.push([d,call2])}}for(var b={},d=["get_group"].concat(Array.prototype.slice.call(arguments,0)),c=0;c<f.length;c++)a(f[c]);return b};a._i.push([b,d,g])};a.__SV=1.2;b=c.createElement("script");b.type="text/javascript";b.async=!0;b.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===c.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";d=c.getElementsByTagName("script")[0];d.parentNode.insertBefore(b,d)}})(document,window.mixpanel||[]);mixpanel.init(drupalSettings.commerce_midtrans.data.mixpanelKey);
(function(c,a){if(!a.__SV){var b=window;try{var d,m,j,k=b.location,f=k.hash;d=function(a,b){return(m=a.match(RegExp(b+"=([^&]*)")))?m[1]:null};f&&d(f,"state")&&(j=JSON.parse(decodeURIComponent(d(f,"state"))),"mpeditor"===j.action&&(b.sessionStorage.setItem("_mpcehash",f),history.replaceState(j.desiredHash||"",c.title,k.pathname+k.search)))}catch(n){}var l,h;window.mixpanel=a;a._i=[];a.init=function(b,d,g){function c(b,i){var a=i.split(".");2==a.length&&(b=b[a[0]],i=a[1]);b[i]=function(){b.push([i].concat(Array.prototype.slice.call(arguments,0)))}}var e=a;"undefined"!==typeof g?e=a[g]=[]:g="mixpanel";e.people=e.people||[];e.toString=function(b){var a="mixpanel";"mixpanel"!==g&&(a+="."+g);b||(a+=" (stub)");return a};e.people.toString=function(){return e.toString(1)+".people (stub)"};l="disable time_event track track_pageview track_links track_forms track_with_groups add_group set_group remove_group register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user people.remove".split(" ");for(h=0;h<l.length;h++)c(e,l[h]);var f="set set_once union unset remove delete".split(" ");e.get_group=function(){function a(c){b[c]=function(){call2_args=arguments;call2=[c].concat(Array.prototype.slice.call(call2_args,0));e.push([d,call2])}}for(var b={},d=["get_group"].concat(Array.prototype.slice.call(arguments,0)),c=0;c<f.length;c++)a(f[c]);return b};a._i.push([b,d,g])};a.__SV=1.2;b=c.createElement("script");b.type="text/javascript";b.async=!0;b.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===c.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";d=c.getElementsByTagName("script")[0];d.parentNode.insertBefore(b,d)}})(document,window.mixpanel||[]);mixpanel.init(drupalSettings.midtrans_commerce.data.mixpanelKey);

})(jQuery, Drupal, drupalSettings);

Expand Down
2 changes: 2 additions & 0 deletions lib/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
// Silence is golden.
21 changes: 21 additions & 0 deletions lib/midtrans/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Midtrans

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
30 changes: 30 additions & 0 deletions lib/midtrans/Midtrans.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/**
* Check PHP version.
*/
if (version_compare(PHP_VERSION, '5.4', '<')) {
throw new Exception('PHP version >= 5.4 required');
}

// Check PHP Curl & json decode capabilities.
if (!function_exists('curl_init') || !function_exists('curl_exec')) {
throw new Exception('Midtrans needs the CURL PHP extension.');
}
if (!function_exists('json_decode')) {
throw new Exception('Midtrans needs the JSON PHP extension.');
}

// Configurations
require_once 'Midtrans/Config.php';

// Midtrans API Resources
require_once 'Midtrans/Transaction.php';

// Plumbing
require_once 'Midtrans/ApiRequestor.php';
require_once 'Midtrans/Notification.php';
require_once 'Midtrans/CoreApi.php';
require_once 'Midtrans/Snap.php';

// Sanitization
require_once 'Midtrans/Sanitizer.php';
Loading

0 comments on commit 12c1e4b

Please sign in to comment.