Wallet Download 3.0

This component/theme works with latest OSSN version.
5.0
Indonesian Arsalan Shah 3 years ago

A general wallet for users that they can charge. Site admin can utilize that wallet balance using set of available APIs. PayPal is the method available to load the wallet. Minimum amount is set is 10 and default current is USD. You may can edit these details in ossn_com.php file. The wallet only supports the amounts for credit that are not in floating. However the debit support two decimal places floating amount. (X.nn) not (X.nnnn)

define('WALLET_CURRENCY_CODE', 'USD'); //your 3 digits currency code from PayPal
define('WALLET_MINIMUM_LOAD', 10);  //Minimum amount integer only (no floating)

API END POINTS

Debit

CURL https://www.yourwebsite.com/api/v1.0/wallet/debit

Credit

CURL https://www.yourwebsite.com/api/v1.0/wallet/credit

Responses and parameter required
https://github.com/opensource-socialnetwork/Wallet#responces-and-parameter-required

 {
    "merchant": "Open Source Social Network",
    "url": "https:\/\/yourwebsite.com\/",
    "time_token": 1637513403,
    "payload": {
        "status": "success",
        "amount": "50",
        "guid": "1"
    },
    "code": "100",
    "message": "Request successfully executed"
}

Access using PHP

<?php
....
....
try {
    $user_guid = ossn_loggedin_user()->guid;
    $wallet = new Wallet\Wallet($user_guid);
    $amount = 20;
    $description = 'Some description';
    var_dump($wallet->credit($amount, $description)); //credit amount
} catch (Wallet\NoUserException $e) {
    echo $e->getMessage();
}  catch (Wallet\CreditException $e) {
    echo $e->getMessage();
}

//debit

try {
    $user_guid = ossn_loggedin_user()->guid;
    $wallet = new Wallet\Wallet($user_guid);
    $amount = 20;
    $description = 'Some description';
    var_dump($wallet->debit($amount, $description)); //debit amount
} catch (Wallet\NoUserException $e) {
    echo $e->getMessage();
}  catch (Wallet\DebitException $e) {
    echo $e->getMessage();
}

//getting balance
$user_guid = ossn_loggedin_user()->guid;
$wallet = new Wallet\Wallet($user_guid);
echo $wallet->getBalance();

//changing balance
$user_guid = ossn_loggedin_user()->guid;
$wallet = new Wallet\Wallet($user_guid);
echo $wallet->setBalance(<new amount>);

..
Wallet
2.8

  • Translation of card fields.

2.4

  • Customer details sent to Stripe

2.0

  • Support Credit/Debit card payments.

1.1

  • Allow floating (only two decimal places) for debit example 0.12 (not 0.123)
Comments
us Mizhack Aguilar Replied 2 hours ago

It's eflymoney.com
I just created a new discussion

Indonesian Arsalan Shah Replied 2 hours ago

What is your website url?

Create new discussion instead https://www.opensource-socialnetwork.org/discussion/add

us Mizhack Aguilar Replied 2 hours ago

Okay. I did go to Github and reported the issue. Thanks.

us Mizhack Aguilar Replied 2 hours ago

This is the admin page.
enter image description here

Indonesian Arsalan Shah Replied 2 hours ago

The ticket closed the problem is in your code not in wallet itself.

Please open a new discussion thread above.

Also follow what Michael said and provide the correct details mentioned on the how to report error.

us Mizhack Aguilar Replied 3 hours ago

I just did submit the issue to Github. I also asked for any suggestions to incorporate the real exchange rate conversion of the amount issued/paid/received.

us Mizhack Aguilar Replied 3 hours ago

So, the member here is one of our business people. We are trying to populate the members area before we become live.
So, any idea or suggestion for my conversion code integration, to make it work? I would appreciate it.

us Mizhack Aguilar Replied 3 hours ago

Hi Michael
Thank you for your quick response. Our website is still underdevelopment mode. We are making some minor changes that would cater our business goal. When I checked the specific member area issue in wallet. I did not pay for any subscription fee. The wallet component is free right? So, we were just making some changes to this by adding a real exchange rate from a company that we subscribed to.
The system did some self-repair. However, it did not go back to the normal view of the wallet overview. enter image description here We

German Michael Zülsdorff Replied 10 hours ago

It told the member to wait to get it refresh.

Please provide a screenshot.
See https://www.opensource-socialnetwork.org/wiki/view/1101/how-to-report-a-bug-error-issue
and put your complete code on Github.

And: Which pricing plan did you subscribe to?

us Mizhack Aguilar Replied 18 hours ago

This is a great component. I hope to add a live conversion of the USD currency to other currencies. using an API key.. I have this code, but it gives me an error for several try after integrating the code within the wallet overview.php.
Here's the code that I have:
<?php
// Replace with your actual API key
$apiKey = 'YOURAPIKEY';

// Function to get exchange rates from CurrencyLayer API
function getExchangeRates($apiKey) {
$url = "https://api.currencylayer.com/live?access_key={$apiKey}";
$ch = curlinit($url);
curl
setopt($ch, CURLOPTRETURNTRANSFER, true);
$response = curl
exec($ch);
curlclose($ch);
return json
decode($response, true);
}

// Function to convert USD to another currency
function convertCurrency($amount, $toCurrency, $exchangeRates) {
if (arraykeyexists($toCurrency, $exchangeRates['quotes'])) {
return $amount * $exchangeRates['quotes'][$toCurrency];
} else {
return "Currency not supported.";
}
}

// Example usage
$exchangeRates = getExchangeRates($apiKey);
$amountInUSD = 100; // Amount in USD

echo "Amount in PHP: " . convertCurrency($amountInUSD, 'PHP', $exchangeRates) . "\n";
echo "Amount in MXN: " . convertCurrency($amountInUSD, 'MXN', $exchangeRates) . "\n";
echo "Amount in EUR: " . convertCurrency($amountInUSD, 'EUR', $exchangeRates) . "\n";
echo "Amount in GBP: " . convertCurrency($amountInUSD, 'GBP', $exchangeRates) . "\n";
echo "Amount in ILS: " . convertCurrency($amountInUSD, 'ILS', $exchangeRates) . "\n";
echo "Amount in SAR: " . convertCurrency($amountInUSD, 'SAR', $exchangeRates) . "\n";
echo "Amount in JPY: " . convertCurrency($amountInUSD, 'JPY', $exchangeRates) . "\n";
?>

Component

Developer: Arsalan
License ossnv4
Type: Tools
Requires Ossn Version : 6.1
Latest Version: 3.0
Last Updated 10 months ago
Repository Url View Repository

Versions