Wallet Download 2.1

5.0
Indonesian Arsalan Shah 6 months 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/blob/main/README.md#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.0

  • Support Credit/Debit card payments.

1.1

  • Allow floating (only two decimal places) for debit example 0.12 (not 0.123)
Comments
Hungarian Tamás Varga Replied 16 hours ago

What exactly data should be entered? unfortunately i don't understand what the lines mean.

enter image description here

Indonesian Arsalan Shah Replied 6 months ago

Sorry due to error it was struck in private mode now its public.

Indonesian Arsalan Shah Replied 6 months ago

It seems it was set Private when created. I added PayPal because it was quick. Others methods requires bit attention to add with credit card handling.

Breton Rafael Amorim Replied 6 months ago

Great component! Fits exactly whith my needs.

I can't open github repository to contribute with translations. At this moment, this is I can do.

In the future, I intend to add MercadoPago (an PayPal equivalent) support.

If anyone wants to do this adding, I can help.

Regards!

Component

Developer: Arsalan
License ossnv4
Type: Tools
Requires Ossn Version : 6.1
Latest Version: 2.1
Last Updated 4 weeks ago
Repository Url View Repository

Versions