Skip to content

Commit

Permalink
v2.2.1: Minor Updates; Bug Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lsthompson committed Jun 6, 2023
1 parent 3960366 commit b88a718
Show file tree
Hide file tree
Showing 11 changed files with 241 additions and 51 deletions.
Binary file removed .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
29 changes: 23 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,37 @@
# Changelog
All notable changes to BPAY Manager will be documented in this file.

## [2.2.1] - 2023-06-06

### Added
- Logic to support WHMCS & cron.php being isolated
- Flag to reinject the Invoice PDF template with code

### Changed
- Hide the BPAY Biller Name lookup (deprecated method) (#2)
- Fatal Errors updated to reflect origination from BPAY Manager
- Improved the README file; Added a CONTRIBUTING file to the repo

### Fixed
- SQL Error in bpay_mgr_hooks.php (rogue apostrophe) (resolves #13)
- More work towards resolving #1 (relative/absolute, superglobals, etc)

## [2.2.0] - 2023-01-16

### Added
- PHP Version now listed in Health Status
- PHP Version now listed in Health Status (#8)
- Support added for PHPv8 and WHMCS v8 (latest)

### Changed
- Indenting of module files reset and done properly
- Removed some old code snippets, table columns, etc.

- Include the BPAY Image on 1st page of PDFs only (#10)

### Fixed
- Resolved issue with BPAY Image not appearing in Admin Area
- Resolved image not appearing in Client Area, viewing Invoice
- Implemented fix for delayed image generation, re: cron no-image
- Collectively, should resolve GitHub Issues: #1, #3, #4, #6, #8 and #9
- Fixed issue with no BPAY Image in Admin > Summary/Invoice (#3/#7)
- Fixed issue with no BPAY Image in Client > Viewing Invoice (#4/#7)
- Fixed a range of typos throughout the code-base, including hook (#6)
- Collectively, should resolve GitHub Issues: #3, #4, #6, #7 & #8

## [2.1.9] - 2019-01-27

Expand Down
146 changes: 146 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# Contributing to BPAY-for-WHMCS

First off, thanks for taking the time to contribute! ❤️

All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉

> And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about:
> - Star the project
> - Share it on social media
> - Refer this project in your project's readme
> - Mention the project at local meetups and tell your friends/colleagues

## Table of Contents

- [Code of Conduct](#code-of-conduct)
- [I Have a Question](#i-have-a-question)
- [I Want To Contribute](#i-want-to-contribute)
- [Reporting Bugs](#reporting-bugs)
- [Suggesting Enhancements](#suggesting-enhancements)
- [Your First Code Contribution](#your-first-code-contribution)
- [Improving The Documentation](#improving-the-documentation)
- [Styleguides](#styleguides)
- [Commit Messages](#commit-messages)
- [Join The Project Team](#join-the-project-team)


## Code of Conduct

This project and everyone participating in it is governed by the [BPAY-for-WHMCS Code of Conduct](blob/main/CODE_OF_CONDUCT.md).

By participating, you are expected to uphold this code. Please report unacceptable behavior to The Network Crew Pty Ltd.


## I Have a Question

> If you want to ask a question, we assume that you have read the available Documentation.
Before you ask a question, it is best to search for existing [Issues](/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first.

If you then still feel the need to ask a question and need clarification, we recommend the following:

- Open an [Issue](/issues/new).
- Provide as much context as you can about what you're running into.
- Provide project and platform versions (Apache, PHP, ioncube, etc), depending on what seems relevant.
- Send a copy of the Health tab in BPAY-for-WHMCS which contains versions and the like.

We will then take care of the issue as soon as possible.



## I Want To Contribute

> ### Legal Notice
> When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license.
### Reporting Bugs


#### Before Submitting a Bug Report

A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible.

- Make sure that you are using the latest version.
- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](). If you are looking for support, you might want to check [this section](#i-have-a-question)).
- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](issues?q=label%3Abug).
- Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue.
- Collect information about the bug:
- Stack trace (Traceback)
- OS, Platform and Version (Windows, Linux, macOS, x86, ARM)
- Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant.
- Possibly your input and the output
- Can you reliably reproduce the issue? And can you also reproduce it with older versions?


#### How Do I Submit a Good Bug Report? (+ CyberSec)

> You must NEVER REPORT SECURITY ISSUES, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent via GitHub Vulnerability Reporting (enabled for this repository) - not as an Issue/etc.

We use GitHub issues to track bugs and errors. If you run into an issue with the project:

- Open an [Issue](/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.)
- Explain the behavior you would expect and the actual behavior.
- Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case.
- Provide the information you collected in the previous section.

Once it's filed:

- The project team will label the issue accordingly.
- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced.
- If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be [implemented by someone](#your-first-code-contribution).




### Suggesting Enhancements

This section guides you through submitting an enhancement suggestion for BPAY-for-WHMCS, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions.


#### Before Submitting an Enhancement

- Make sure that you are using the latest version.
- Read the [documentation]() carefully and find out if the functionality is already covered, maybe by an individual configuration.
- Perform a [search](/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.
- Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library.


#### How Do I Submit a Good Enhancement Suggestion?

Enhancement suggestions are tracked as [GitHub issues](/issues).

- Use a **clear and descriptive title** for the issue to identify the suggestion.
- Provide a **step-by-step description of the suggested enhancement** in as many details as possible.
- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you.
- You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux.
- **Explain why this enhancement would be useful** to most BPAY-for-WHMCS users. You may also want to point out the other projects that solved it better and which could serve as inspiration.



### Improving The Documentation

This project needs better documentation, and arguably major refactoring, so all contributions whether semantic or significant are appreciated. The more work you do, the less other people need to contribute - open-source is about collective contributions after all.

## Styleguides

### Commit Messages

Keep them short, relevant and helpful - "updated file" doesn't help! Tell us what you did for each commit.

### Changes (Fork & PR)

If you're making significant changes, create your own branch (fork into it) then PR it back into main.

Where it's a major feature that makes sense to deploy, we're happy to create a formal branch for it.

## Join The Project Team

Contact us at [The Network Crew Pty Ltd](https://thenetworkcrew.com.au) if you're interested.

Past contributions here are always a good indicator that you're serious!

## Attribution

This guide is based on the **contributing.md**. [Make your own](https://contributing.md/)!
43 changes: 28 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**_Addon Module for WHMCS which adds BPAY Payment support, image generation, etc._**

### Module (System) Requirements
### 🎯 Module (System) Requirements 🎯

Below is what the module needs in order to work properly.
- PHP: v8.x (latest stable)
Expand All @@ -12,19 +12,32 @@ Below is what the module needs in order to work properly.
- Firewall: Need to have TCP/443 open
- SSL Certificate: WHMCS needs to use one

### Installation Instructions (WHMCS)
### Installation Instructions (WHMCS)

Below are the proper steps to Upload & Install the Module/Gateway.
1. Download the latest version of the BPAY Manager for WHMCS from the GitHub repository.
2. Upload all the files into your WHMCS directory in the same file structure as set in the ZIP.
3. Once all files are uploaded, then go to your WHMCS Administrator area. Go to Setup tab => Addon Modules.
4. Look for “BPAY Manager” and click “Activate” Select "BPAY" from "Activate Module" and then click “Configure” and grant your user access to the module.
5. Finally, in the top blue menu in WHMCS click “Addons” and then select “BPAY Manager” (per user group/s authorised).
1. Download the latest version of the BPAY Manager for WHMCS from the GitHub repo.
2. Upload all the files into your WHMCS directory in the same hierarchy as set in the ZIP.
3. Once all files are uploaded, then go to your WHMCS Admin area. Go to Setup -> Addon Modules.
4. Find “BPAY Manager”, click “Activate”, then click “Configure” & grant admin access to the module.
5. Finally, in the top blue menu in WHMCS click “Addons” and then select “BPAY Manager” (per the ACL).
6. The installer will appear, allowing you to configure the module as the bank specifies.
7. (You will be prompted to separately enable the Payment Gateway of BPAY as well)
7. You can start using BPAY right away for your existing invoices - done!
8. You can start using BPAY right away for your existing invoices - done!

### Upgrading from a legacy version ⚠️
### 🐛 Troubleshooting the Gateway Module 🐛

Problem: My biller code / reference number image is not appearing in the PDF file.
- Go to the BPAY Manager in your WHMCS and click the “Health” tab and check for errors.
- Ensure BPAY code is in /templates/your_template/invoicepdf.tpl AND /templates/invoicepdf.tpl
- If all else fails, please raise an Issue on the repo - detailing steps, error, logs, etc - thanks!

Problem: Every time I update my WHMCS installation (core), the Invoice PDFs stop having the image.
- This occurs due to the invoicepdf.tpl file/s being over-written. Same when using Clean PDF, etc.
- You can use the reinject_template_code flag (see Advanced Operation below) to re-inject the code.

Something else not behaving? Check any [Open Issues](https://github.com/LEOPARD-host/BPAY-for-WHMCS/issues) on GitHub.

### ⚠️ Upgrading from a legacy version ⚠️

Due to the module being renamed, it's important to make sure you upgrade properly.

Expand All @@ -34,15 +47,15 @@ Due to the module being renamed, it's important to make sure you upgrade properl
4. Do a manual check to verify that all legacy (\_rh) files & folders are gone
5. Also within the Admin Area, go to Addon Modules and activate the new ver!

### Troubleshooting the Gateway Module
### ⚙️ Advanced Operation (Flags) ⚙️

Problem: My biller code / reference number image is not appearing on the invoice.
- Go to the BPAY Manager in your WHMCS and click the “Health” tab and look for any errors that may be causing BPAY Manager to not work correctly.
- If all else fails, please raise an Issue on the GitHub Repo - making sure to detail the problem, including errors/logs, steps to reproduce, etc.
##### Bypass initializion without needing to install the BPAY Manager again.
URL: https://{whmcs_admin_url}/addonmodules.php?module=bpay_mgr&initialise_record_bypass=1

Something else not behaving? Check any [Open Issues](https://github.com/LEOPARD-host/BPAY-for-WHMCS/issues) on GitHub.
##### Reinject the Invoice PDF template code without needing to reinitialise.
URL: https://{whmcs_admin_url}/addonmodules.php?module=bpay_mgr&reinject_template_code=1

### BPAY
### ™️ BPAY Trade Marks ™️

BPAY and the BPAY logo are registered trade marks of BPAY Pty Ltd.

Expand Down
45 changes: 25 additions & 20 deletions includes/hooks/bpay_mgr_inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,47 @@
// https://github.com/LEOPARD-host/BPAY-for-WHMCS/

/**
* BPAY Manager - Hook Function
* This hook is used to manage the invoice management for the BPAY Module system.
*
* @package BPAY for WHMCS (BPAY Manager)
* @author The Network Crew Pty Ltd and Clinton Nesbitt
*
* @copyright Copyright (C) The Network Crew Pty Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
* BPAY Manager - Hook Function
* This hook is used to manage the invoice management for the BPAY Module system.
*
* @package BPAY for WHMCS (BPAY Manager)
* @author The Network Crew Pty Ltd and Clinton Nesbitt
*
* @copyright Copyright (C) The Network Crew Pty Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/


if (!defined("WHMCS")) {
die("This file cannot be accessed directly");
die("This file cannot be accessed directly");
}

if (file_exists('modules/addons/bpay_mgr/bpay_mgr_hooks.php')) {
if (file_exists(ROOTDIR . '/modules/addons/bpay_mgr/bpay_mgr_hooks.php')) {
require_once(ROOTDIR . '/modules/addons/bpay_mgr/bpay_mgr_hooks.php');
call_hooks();
}else if (file_exists('modules/addons/bpay_mgr/bpay_mgr_hooks.php')) {
require_once('modules/addons/bpay_mgr/bpay_mgr_hooks.php');
call_hooks();
}else if (file_exists('../modules/addons/bpay_mgr/bpay_mgr_hooks.php')) {
require_once('../modules/addons/bpay_mgr/bpay_mgr_hooks.php');
call_hooks();
}else if (file_exists('../../modules/addons/bpay_mgr/bpay_mgr_hooks.php')) {
require_once('../../modules/addons/bpay_mgr/bpay_mgr_hooks.php');
call_hooks();
call_hooks();
}else if (file_exists('../../../modules/addons/bpay_mgr/bpay_mgr_hooks.php')) {
require_once('../../../modules/addons/bpay_mgr/bpay_mgr_hooks.php');
call_hooks();
}else if (file_exists('../../../../modules/addons/bpay_mgr/bpay_mgr_hooks.php')) {
require_once('../../../../modules/addons/bpay_mgr/bpay_mgr_hooks.php');
call_hooks();
}else{
// failed - but dont crash system, just dont run this hook

$current = file_get_contents("bpay_mgr_debug.txt");
// Append a new person to the file
$current .= getcwd()."\n";
// Write the contents back to the file
file_put_contents($file, $current);
}
logActivity("DID NOT CALL BPAY HOOKS - reached debug step instead", 0);
// $debugfile = dirname( dirname( __DIR__ ) ) . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'addons' . DIRECTORY_SEPARATOR . 'bpay_mgr' . DIRECTORY_SEPARATOR . 'bpay_mgr_debug.txt';
// Failed - but don't crash, just log the CWD to debug later
// $debuglog = file_get_contents($debugfile);
// Append the dir onto the file contents
// $debuglog .= "BPAY Hooks not called, as file not located.\n";
// $debuglog .= getcwd()."\n";
// Write the contents back
// file_put_contents($debugfile, $debuglog);
}
Binary file removed modules/addons/.DS_Store
Binary file not shown.
Loading

0 comments on commit b88a718

Please sign in to comment.