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

Add the php-webmoney dependency error #63

Closed
luyenok opened this issue Mar 30, 2015 · 24 comments
Closed

Add the php-webmoney dependency error #63

luyenok opened this issue Mar 30, 2015 · 24 comments
Assignees
Labels

Comments

@luyenok
Copy link

luyenok commented Mar 30, 2015

I got error when Adding the php-webmoney dependency:

root@do [/home/the247/public_html/wmzapi]# php composer.phar require baibaratsky/php-webmoney:0.10.*
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package baibaratsky/php-webmoney 1.0.0 could not be found.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Installation failed, reverting ./composer.json to its original content.
root@do [/home/the247/public_html/wmzapi]#
@baibaratsky
Copy link
Owner

Could you show your composer.json?

@luyenok
Copy link
Author

luyenok commented Mar 30, 2015

{
    "name": "baibaratsky/php-webmoney",
    "description": "WebMoney API PHP Library",
    "keywords": ["webmoney", "megastock", "capitaller", "WMXI", "WMSigner"],
    "license": "BSD-3-Clause",
    "homepage": "http://github.com/baibaratsky/php-webmoney",
    "authors": [
        {
            "name": "Andrei Baibaratsky",
            "email": "andrei@baibaratsky.com"
        },
        {
            "name": "Constantin Chuprik",
            "email": "constantinchuprik@gmail.com"
        }
    ],
    "require": {
        "php": ">=5.3",
        "baibaratsky/php-wmsigner": "1.1.*"
    },
    "autoload": {
        "psr-4": {
            "baibaratsky\\WebMoney\\": ""
        }
    }
}

@luyenok
Copy link
Author

luyenok commented Mar 30, 2015

I just downloaded and uploaded to my server, did not change anythings.

@baibaratsky
Copy link
Owner

It's my composer.json. Please show me one from your project root directory.

@baibaratsky baibaratsky self-assigned this Mar 30, 2015
@luyenok
Copy link
Author

luyenok commented Mar 30, 2015

sorry, I have not anything, I justed downloaed php-webmoney-master.zip file and uploaded to my server :(

@baibaratsky
Copy link
Owner

If you want to use Composer, you don’t have to upload any files from this repository. Please read the Composer docs to discover how to use it.

To use the library without Composer, add require calls for all the library files.

@luyenok
Copy link
Author

luyenok commented Mar 30, 2015

thank you, I have added require calls for all the library files and tested X2 (transfer fund), I got the error: Request errors: - Array
I try to print_r ($request->getErrors()); and result is: Array ( [1] => Array ( [0] => transactionExternalId ) )

Can you help me ? I just want to using X2 to transfer fund to other purse.

@baibaratsky
Copy link
Owner

Could you attach your code please?

@luyenok
Copy link
Author

luyenok commented Mar 30, 2015

yes, how to attach ? This form accept image file only.

@baibaratsky
Copy link
Owner

Just put your code in the message here. Please use markdown to highlight the code.

@luyenok
Copy link
Author

luyenok commented Mar 30, 2015

<?
require_once('WebMoney.php');
require_once('Signer.php');
require_once('Request/Requester/CurlRequester.php');
require_once('Request/Requester/AbstractRequester.php');
require_once('Api/X/X2/Request.php');
require_once('Api/X/X2/Response.php');

use baibaratsky\WebMoney\WebMoney;
use baibaratsky\WebMoney\Signer;
use baibaratsky\WebMoney\Request\Requester\CurlRequester;
use baibaratsky\WebMoney\Api\X\X2;

$webMoney = new WebMoney(new CurlRequester);

$request = new X2\Request;
$request->setSignerWmid('removed');
$request->setPayerPurse('removed');
$request->setPayeePurse('removed');
$request->setAmount(0.01); // Payment amount
$request->setDescription('Test payment');
$request->setInvoiceId(0);

$request->sign(new Signer('removed', 'removed.kwm', 'removed'));

if ($request->validate()) {
    /** @var X2\Response $response */
    $response = $webMoney->request($request);

    if ($response->getReturnCode() === 0) {
        echo 'Successful payment, transaction id: ' . $response->getTransactionId();
    } else {
        echo 'Payment error: ' . $response->getReturnDescription();
    }
} else {
    echo 'Request errors: ' . PHP_EOL;
    print_r ($request->getErrors());
    foreach ($request->getErrors() as $error) {
        echo ' - ' . $error . PHP_EOL;
    }
}


?>

@luyenok
Copy link
Author

luyenok commented Mar 30, 2015

the result is Request errors: Array ( [1] => Array ( [0] => transactionExternalId ) ) - Array

@baibaratsky
Copy link
Owner

You have to set a required parameter transactionExternalId. Put this string in your code:

$request->setTransactionExternalId($myTransactionId); // Unique ID of the transaction in your system

$myTransactionId should be a positive integer, unique for the WMID that signs the request. It’s not allowed to perform two transactions with the same ID.

@luyenok
Copy link
Author

luyenok commented Mar 31, 2015

thank you for your support, I got new error:
Payment error: signature is incorrect. planstr=1427764213510054Z222213656185Z2820325325120.010Test payment0 step=5

@baibaratsky
Copy link
Owner

Does payerPurse belong to signerWmid?

@luyenok
Copy link
Author

luyenok commented Apr 1, 2015

yes, payerPurse belong to signerWmid, I have tested X9 and it working file (show Purse's balance), but got error with X2 :(, the code is below

<?
require_once('WebMoney.php');
require_once('Signer.php');
require_once('Request/Requester/CurlRequester.php');
require_once('Request/Requester/AbstractRequester.php');
require_once('Api/X/X2/Request.php');
require_once('Api/X/X2/Response.php');

use baibaratsky\WebMoney\WebMoney;
use baibaratsky\WebMoney\Signer;
use baibaratsky\WebMoney\Request\Requester\CurlRequester;
use baibaratsky\WebMoney\Api\X\X2;

$webMoney = new WebMoney(new CurlRequester);

$request = new X2\Request;
$request->setSignerWmid('removed');
$request->setPayerPurse('removed');
$request->setPayeePurse('removed');
$request->setAmount(0.01); // Payment amount
$request->setTransactionExternalId(310315079999);
$request->setDescription('Test');
$request->setInvoiceId(0);

$request->sign(new Signer('removed', 'removed.kwm', 'removed'));

if ($request->validate()) {
    /** @var X2\Response $response */
    $response = $webMoney->request($request);

    if ($response->getReturnCode() === 0) {
        echo 'Successful payment, transaction id: ' . $response->getTransactionId();
    } else {
        echo 'Payment error: ' . $response->getReturnDescription();
        echo '<hr />'.$response->getReturnCode();
    }
} else {
    echo 'Request errors: ' . PHP_EOL;
    print_r ($request->getErrors());
    echo "<br /><hr />";
    foreach ($request->getErrors() as $error) {
        echo ' - ' . $error . PHP_EOL;
    }
}


?>

@baibaratsky
Copy link
Owner

There was a small bug with the signature in the X2 request class. Please update the library and try again.

@luyenok
Copy link
Author

luyenok commented Apr 1, 2015

yahoooooooooooo !!!!!!!!!!!!!!!!!!
Successful payment, transaction id: 1175379855

thank you very much,

@baibaratsky
Copy link
Owner

You’re welcome!

@luyenok
Copy link
Author

luyenok commented Apr 1, 2015

Hic, it not working more, got the below error
Payment error: Out of present range. step=91

@baibaratsky
Copy link
Owner

    /**
     * Set ID of the transaction in your system
     *
     * @param int $transactionExternalId should be a positive integer, unique for the WMID that signs the request
     * It’s not allowed to perform two transactions with the same ID.
     * The uniqueness of ID is verified at least for one year.
     */
    public function setTransactionExternalId($transactionExternalId)

@luyenok
Copy link
Author

luyenok commented Apr 1, 2015

what's your mean ?

@luyenok
Copy link
Author

luyenok commented Apr 1, 2015

same problem here https://translate.google.com.vn/translate?hl=vi&sl=ru&tl=en&u=http%3A%2F%2Fcafe.owebmoney.ru%2Findex.php%3Fshowtopic%3D6206

it working if TransactionExternalId lenght < 10 only, got error Out of present range if TransactionExternalId lenght >10.

@baibaratsky
Copy link
Owner

I thought you use the same value for transactionExternalId.
Since transactionExternalId is a 32-bit integer, you shouldn’t use values greater than (2^32)-1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants