-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial Commit
- Loading branch information
0 parents
commit 8c3f63e
Showing
16 changed files
with
637 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# See https://github.com/silverstripe-labs/silverstripe-travis-support for setup details | ||
# used Silverstripe Translatable as a guide | ||
|
||
language: php | ||
php: | ||
- 5.5 | ||
- 5.6 | ||
- 7.0 | ||
|
||
sudo: false | ||
|
||
env: | ||
- DB=MYSQL CORE_RELEASE=3.1 | ||
- DB=MYSQL CORE_RELEASE=3.2 PDO=1 | ||
- DB=MYSQL CORE_RELEASE=3.3 PDO=1 | ||
- DB=MYSQL CORE_RELEASE=master PDO=1 | ||
- DB=PGSQL CORE_RELEASE=master | ||
|
||
matrix: | ||
allow_failures: | ||
- php: 7.0 | ||
exclude: | ||
- php: 7.0 | ||
env: DB=MYSQL CORE_RELEASE=3.1 | ||
- php: 7.0 | ||
env: DB=MYSQL CORE_RELEASE=3.2 PDO=1 | ||
- php: 7.0 | ||
env: DB=MYSQL CORE_RELEASE=3.3 PDO=1 | ||
|
||
before_script: | ||
- phpenv rehash | ||
- git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support | ||
- php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss | ||
- cd ~/builds/ss | ||
|
||
script: | ||
- vendor/bin/phpunit shop_bankdeposit/tests/ |
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,22 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Antony Thorpe | ||
|
||
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. | ||
|
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,81 @@ | ||
# silverstripe-shop-bankdeposit | ||
Submodule for Silverstripe Shop that adds bank deposit as a Payment Method | ||
|
||
[![Build Status](https://travis-ci.org/AntonyThorpe/silverstripe-shop-bankdeposit.svg)](https://travis-ci.org/AntonyThorpe/silverstripe-shop-bankdeposit) | ||
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/AntonyThorpe/silverstripe-shop-bankdeposit/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/AntonyThorpe/silverstripe-shop-bankdeposit/?branch=master) | ||
|
||
## How it works | ||
Utilises the 'Manual' Payment Method (names it "Bank Deposit"). | ||
Localisation options available. | ||
|
||
## Warning | ||
It is assumed that people accessing the Setting folder can be trusted. This is where the bank account number is entered. | ||
|
||
## Requirements | ||
[SilverStripe Shop module](https://github.com/burnbright/silverstripe-shop) | ||
|
||
## Installation | ||
In your composer.json add | ||
|
||
```json | ||
"repositories": [{ | ||
"type": "vcs", | ||
"url": "https://github.com/AntonyThorpe/silverstripe-shop-bankdeposit.git" | ||
}], | ||
"require": { | ||
"AntonyThorpe/silverstripe-shop-bankdeposit": "latest version number" | ||
} | ||
``` | ||
Then in the terminal cd to your project root and `composer update` | ||
|
||
In your mysite/_config/config.yml add | ||
```yml | ||
Payment: | ||
allowed_gateways: | ||
- 'Manual' | ||
``` | ||
dev/build/?flush | ||
## Getting Started | ||
In Admin, click settings/shop/bankaccount and add details. | ||
## Customisation | ||
### Checkout Page | ||
As an option, add a message for the user in the Payment Method section of the Checkout Page: | ||
```html | ||
<% with SiteConfig %> | ||
$BankAccountPaymentMethodMessage | ||
<% end_with %> | ||
``` | ||
###Account Page | ||
Refer to this module's template folder for includes/changes to `AccountPage_order.ss` where the opening statement is shown if the order has an unpaid status. In addition, the order includes modifications to Total Outstanding and an additional table displaying bank account information, just like what typically appears on a invoice. | ||
|
||
## Send Email Confirmations | ||
Email a copy of an unpaid Order to the customer with your bank deposit instructions. | ||
This feature is enabled by default. To deactivate: | ||
```yml | ||
OrderProcessor: | ||
bank_deposit_send_confirmation: false | ||
``` | ||
To customise copy `shop/templates/email/Order_ConfirmationEmail.ss` to `themes/yourname/templates/email/Order_ConfirmationEmail.ss` and style as needed. | ||
|
||
The email will need your subject. Override the default in your `mysite/lang/en.yml` file (see `lang/en.yml` for an example). | ||
|
||
In addition, if you want a blind copy: | ||
```yml | ||
Email: | ||
admin_email: example@example.com | ||
OrderEmailNotifier: | ||
bcc_confirmation_to_admin: true | ||
``` | ||
|
||
For more information see [Enable / disable sending of emails](https://github.com/burnbright/silverstripe-shop/blob/master/docs/en/02_Customisation/Emails.md) | ||
|
||
## Contributions | ||
Pull requests welcome! PSR-2 please. | ||
|
||
## License | ||
[MIT](LICENCE) | ||
|
||
|
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,8 @@ | ||
--- | ||
Name: shop_bankdeposit | ||
Before: | ||
- 'shop/*' | ||
--- | ||
OrderProcessor: | ||
bank_deposit_send_confirmation: true | ||
|
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: shop_bankdeposit | ||
Before: | ||
- 'shop/*' | ||
--- | ||
SiteConfig: | ||
extensions: | ||
- Shop\BankDeposit\Extensions\ShopConfig | ||
Order: | ||
extensions: | ||
- Shop\BankDeposit\Extensions\Order |
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,26 @@ | ||
<?php namespace Shop\BankDeposit\Extensions; | ||
|
||
use DataExtension; | ||
use Checkout; | ||
use OrderProcessor; | ||
use GatewayInfo; | ||
|
||
class Order extends DataExtension | ||
{ | ||
/** | ||
* onPlaceOrder | ||
* | ||
* send an email with a copy of the order for payment | ||
* @see onPlaceOrder is an extension within the placeOrder function within the OrderProcessor class | ||
* @return null | ||
*/ | ||
public function onPlaceOrder() | ||
{ | ||
$gateway = Checkout::get($this->owner)->getSelectedPaymentMethod(); | ||
if (OrderProcessor::config()->bank_deposit_send_confirmation && GatewayInfo::is_manual($gateway) && $this->owner->Status == "Unpaid") { | ||
OrderProcessor::config()->send_confirmation = true; | ||
} else { | ||
OrderProcessor::config()->send_confirmation = false; | ||
} | ||
} | ||
} |
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,33 @@ | ||
<?php namespace Shop\BankDeposit\Extensions; | ||
|
||
use DataExtension; | ||
use FieldList; | ||
use Textfield; | ||
use HtmlEditorField; | ||
|
||
class ShopConfig extends DataExtension | ||
{ | ||
private static $db = array( | ||
'BankAccountPaymentMethodMessage' => 'Text', | ||
'BankAccountNumber' => 'Text', | ||
'BankAccountDetails' => 'Text', | ||
'BankAccountInvoiceMessage' => 'HTMLText' | ||
); | ||
|
||
public function updateCMSFields(FieldList $fields) | ||
{ | ||
$fields->addFieldsToTab( | ||
'Root.Shop.ShopTabs.BankAccount', | ||
array( | ||
Textfield::create("BankAccountPaymentMethodMessage", _t("ShopConfig.BANKACCOUNTPAYMENTMETHODMESSAGE", "Payment Method message on Checkout page")) | ||
->setDescription(_t("ShopConfig.BANKACCOUNTPAYMENTMETHODMESSAGEDESCRIPTION", "Message to appear in the Payment Method section of Checkout Page")), | ||
Textfield::create("BankAccountNumber", _t("ShopConfig.BANKACCOUNTNUMBER", "Bank Account Number")) | ||
->setDescription(_t("ShopConfig.BANKACCOUNTNUMBERDESCRIPTION", "e.g XX-XXXX-XXXXXXX-XX")), | ||
Textfield::create("BankAccountDetails", _t("ShopConfig.BANKACCOUNTDETAILS", "Bank Account Details")) | ||
->setDescription(_t("ShopConfig.BANKACCOUNTDETAILSDESCRIPTION", "Account Name, Bank Name, Branch, Branch Address")), | ||
HtmlEditorField::create("BankAccountInvoiceMessage", _t("ShopConfig.BANKACCOUNTINVOICEMESSAGE", "Bank Account Order/Invoice Message")) | ||
->setDescription(_t("ShopConfig.BANKACCOUNTINVOICEMESSAGEDESCRIPTION", "Message to appear on the order/invoice")) | ||
) | ||
); | ||
} | ||
} |
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 @@ | ||
{ | ||
"name": "AntonyThorpe/silverstripe-shop-bankdeposit", | ||
"description": "Submodule for Silverstripe Shop that adds bank deposit as a Payment Method", | ||
"type": "silverstripe-module", | ||
"keywords": ["silverstripe", "ecommerce", "bank deposit", "direct credit"], | ||
"license": "MIT", | ||
"extra": { | ||
"installer-name": "shop_bankdeposit", | ||
"branch-alias": { | ||
"dev-master": "1.*-dev" | ||
} | ||
}, | ||
"require": { | ||
"burnbright/silverstripe-shop": ">=1.1.1" | ||
}, | ||
"require-dev": { | ||
"phpunit/PHPUnit": "3.7.*@stable" | ||
} | ||
} |
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,8 @@ | ||
en: | ||
Payment: | ||
Manual: "Bank Deposit" | ||
OrderNotifier: | ||
TITLE: "Your business name - Tax Invoice #%d" | ||
RECEIPTSUBJECT: "Your business name - Tax Invoice #%d" | ||
CONFIRMATIONSUBJECT: "Your business name - Tax Invoice #%d - Please deposit funds" | ||
ADMINNOTIFICATIONSUBJECT: "Admin notification - Tax Invoice #%d" |
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,29 @@ | ||
<% require themedCSS(account,shop) %> | ||
<% include AccountNavigation %> | ||
<div class="typography"> | ||
<% if Order %> | ||
<% with Order %> | ||
|
||
<%-- SS Shop Bank Deposit --%> | ||
<% if $Status == "Unpaid" %> | ||
<% include Order_BankDepositNeededStatement %> | ||
<% end_if %> | ||
|
||
<h2><% _t('AccountPage.ss.ORDER','Order') %> $Reference ($Created.Long)</h2> | ||
<% end_with %> | ||
<% end_if %> | ||
<% if Message %> | ||
<p class="message $MessageType">$Message</p> | ||
<% end_if %> | ||
<% if Order %> | ||
<% with Order %> | ||
<% include Order %> | ||
<% end_with %> | ||
|
||
<%-- SS Shop Bank Deposit --%> | ||
<% if $Order.Status == "Unpaid" %> | ||
$ActionsForm | ||
<% end_if %> | ||
|
||
<% end_if %> | ||
</div> |
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,61 @@ | ||
<div id="OrderInformation"> | ||
<% include Order_Address %> | ||
<% include Order_Content %> | ||
<% if Total %> | ||
<% if Payments %> | ||
<% include Order_Payments %> | ||
<% end_if %> | ||
<table id="OutstandingTable" class="infotable"> | ||
<tbody> | ||
<tr class="gap summary" id="Outstanding"> | ||
<th colspan="4" scope="row" class="threeColHeader"><strong><% _t("TOTALOUTSTANDING","Total outstanding") %></strong></th> | ||
<td class="right"> | ||
<strong> | ||
|
||
<%-- SS Shop Bank Deposit --%> | ||
<% if $Status == "Unpaid" %> | ||
$TotalOutstanding.Nice | ||
<% else %> | ||
<% if $Status == "MemberCancelled" || $Status == "AdminCancelled" %> | ||
<% _t("ORDERCANCELLED","Order Cancelled") %> | ||
<% else %> | ||
<% _t("PAIDMESSAGEORDER","Paid with thanks") %> | ||
<% end_if %> | ||
<% end_if %> | ||
|
||
</strong> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<% end_if %> | ||
|
||
<% if Notes %> | ||
<table id="NotesTable" class="infotable"> | ||
<thead> | ||
<tr> | ||
<th><% _t("ORDERNOTES","Notes") %></th> | ||
</tr> | ||
</thead> | ||
</tbody> | ||
<tr> | ||
<td>$Notes</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<% end_if %> | ||
|
||
<%-- SS Shop Bank Deposit --%> | ||
<% if Total %> | ||
<% if TotalOutstanding %> | ||
<% if Payments %> | ||
<% loop Payments.last %> | ||
<% if GatewayTitle == "Bank Deposit" %> | ||
<% include Order_BankDeposit %> | ||
<% end_if %> | ||
<% end_loop %> | ||
<% end_if %> | ||
<% end_if %> | ||
<% end_if %> | ||
|
||
</div> |
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,34 @@ | ||
<%-- Bank Deposit table for Order/Invoice on Account page --%> | ||
<table id="BankDepositTable" class="infotable"> | ||
<thead> | ||
<tr class="gap mainHeader"> | ||
<th> | ||
<% _t("BankDepositHeading","Bank Deposit") %> | ||
</th> | ||
</tr> | ||
</thead> | ||
</tbody> | ||
<tr> | ||
<td> | ||
<% with SiteConfig %> | ||
<% if $BankAccountNumber %> | ||
<p> | ||
<% _t("BankAccountNumberTitle", "Bank Account Number: ") %> | ||
$BankAccountNumber | ||
</p> | ||
<% end_if %> | ||
<% if $BankAccountDetails %> | ||
<p> | ||
$BankAccountDetails | ||
</p> | ||
<% end_if %> | ||
<% if $BankAccountInvoiceMessage %> | ||
<p> | ||
$BankAccountInvoiceMessage | ||
</p> | ||
<% end_if %> | ||
<% end_with %> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> |
Oops, something went wrong.