Skip to content

Commit

Permalink
feat: implement feature for donate with Stripe
Browse files Browse the repository at this point in the history
  • Loading branch information
AraanBranco committed Mar 23, 2024
1 parent 4936530 commit eb7cb31
Show file tree
Hide file tree
Showing 17 changed files with 820 additions and 220 deletions.
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',
)
);
?>
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

0 comments on commit eb7cb31

Please sign in to comment.