Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement feature for donate with Stripe #392

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions config/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
'update' => AccountLevel::ANYONE,
'complete' => AccountLevel::ANYONE,
'history' => AccountLevel::NORMAL,
'trusted' => AccountLevel::NORMAL
'trusted' => AccountLevel::NORMAL,
'admin' => AccountLevel::ADMIN
),
'purchase' => array(
'index' => AccountLevel::ANYONE,
Expand Down Expand Up @@ -134,7 +135,7 @@
'changemail' => AccountLevel::ADMIN,
'ban' => AccountLevel::ADMIN,
'ipban' => AccountLevel::ADMIN,
'txnview' => AccountLevel::ADMIN
'txnview' => AccountLevel::ADMIN
),
'ipban' => array(
'index' => AccountLevel::ADMIN,
Expand Down Expand Up @@ -198,7 +199,7 @@
'vending' => array(
'index' => AccountLevel::ANYONE,
'viewshop' => AccountLevel::ANYONE,
),
),
'webcommands' => array(
'index' => AccountLevel::ADMIN,
),
Expand Down Expand Up @@ -250,7 +251,7 @@
'SeeAccountID' => AccountLevel::LOWGM, // Minimum group level required to see Account ID on account view and character view pages.
'SeeUnknownItems' => AccountLevel::LOWGM, // Minimum group level required to see unidentified items as identified.
'AvoidSexChangeCost' => AccountLevel::LOWGM, // Avoid paying cost (if any) for sex changes.

'EditHigherPower' => AccountLevel::NOONE,
'BanHigherPower' => AccountLevel::NOONE
)
Expand Down
13 changes: 13 additions & 0 deletions config/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@
'MoneyThousandsSymbol' => ',', // (Visual) Thousandths place separator (a period in European currencies).
'MoneyDecimalSymbol' => '.', // (Visual) Decimal separator (a comma in European currencies).
'AcceptDonations' => true, // Whether or not to accept donations.

// Payment Gateway Options
'PaymentGateway' => ['stripe', 'paypal'], // Payment Gateway to use. Options: ['stripe', 'paypal]

// Stripe Options
'StripeButtonId' => '...', // Stripe Button ID
'StripeSecretKey' => '...', // Stripe Secret Key
'StripePublishableKey' => '...', // Stripe Publishable Key
'StripeWebhookSecret' => '...', // Stripe Webhook Secret

// PayPal Options
'PayPalIpnUrl' => 'www.paypal.com', // The ipnpb.paypal.com and ipnpb.sandbox.paypal.com endpoints only accept HTTPS connections. If you currently use www.paypal.com, you should move to ipnpb.paypal.com when you update your code to use HTTPS.
'PayPalBusinessEmail' => 'admin@localhost', // Enter the e-mail under which you have registered your business account.
'PayPalReceiverEmails' => array( // These are the receiver e-mail addresses who are allowed to receive payment.
Expand Down Expand Up @@ -542,6 +553,8 @@
'ServiceDeskSettingsTable' => 'cp_servicedesksettings',
'WebCommandsTable' => 'cp_commands',
'ItemDescTable' => 'cp_itemdesc',
'StripeTransactionTable' => 'cp_stripetransactions',
'StripeTransactionLogTable' => 'cp_stripetransactionslog',
)
);
?>
18 changes: 18 additions & 0 deletions data/schemas/logindb/cp_stripetransactions.20240323020801.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
CREATE TABLE IF NOT EXISTS `cp_stripetransactions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`event_reference_id` varchar(255) DEFAULT NULL,
`account_id` int(11) unsigned DEFAULT 0,
`email` varchar(60) DEFAULT NULL,
`server_name` varchar(255) DEFAULT NULL,
`credits` int(11) DEFAULT NULL,
`amount` int(11) DEFAULT NULL,
`settleAmount` int(11) DEFAULT NULL,
`settleCurrency` varchar(3) DEFAULT NULL,
`status` varchar(10) DEFAULT NULL,
`payment_status` varchar(10) DEFAULT NULL,
`json_payload` longtext DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
KEY `event_id` (`event_reference_id`),
KEY `account_id` (`account_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='All Stripe transactions logs.' AUTO_INCREMENT=1;
18 changes: 18 additions & 0 deletions data/schemas/logindb/cp_stripetransactionslogs.20240323020702.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
CREATE TABLE IF NOT EXISTS `cp_stripetransactions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`event_reference_id` varchar(255) DEFAULT NULL,
`account_id` int(11) unsigned DEFAULT 0,
`email` varchar(60) DEFAULT NULL,
`server_name` varchar(255) DEFAULT NULL,
`credits` int(11) DEFAULT NULL,
`amount` int(11) DEFAULT NULL,
`settleAmount` int(11) DEFAULT NULL,
`settleCurrency` varchar(3) DEFAULT NULL,
`status` varchar(10) DEFAULT NULL,
`payment_status` varchar(10) DEFAULT NULL,
`json_payload` longtext DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
KEY `event_id` (`event_reference_id`),
KEY `account_id` (`account_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='All Stripe transactions logs.' AUTO_INCREMENT=1;
22 changes: 22 additions & 0 deletions data/stripe/button.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
if (!defined('FLUX_ROOT')) exit;

if (empty($amount)) {
return false;
}

$session = Flux::$sessionData;
$customDataArray = array('server_name' => $session->loginAthenaGroup->serverName, 'account_id' => $session->account->account_id);
$customDataEscaped = htmlspecialchars(base64_encode(serialize($customDataArray)));
?>
<link rel="stylesheet" href="<?php echo $this->themePath('css/stripe.css') ?>" type="text/css" media="screen" title="" charset="utf-8" />
<script async src="https://js.stripe.com/v3/buy-button.js"></script>

<div class="button-payment-stripe">
<stripe-buy-button
buy-button-id="<?php echo FLUX::config('StripeButtonId') ?>"
publishable-key="<?php echo FLUX::config('StripePublishableKey') ?>"
client-reference-id="<?php echo $customDataEscaped ?>"
>
</stripe-buy-button>
</div>
Empty file added data/stripe/index.html
Empty file.
File renamed without changes.
Loading
Loading