Committer: ailyin
LJSUP-6936 (Webmoney integration): documentationU trunk/cgi-bin/LJ/Client/WebMoney.pm
Modified: trunk/cgi-bin/LJ/Client/WebMoney.pm =================================================================== --- trunk/cgi-bin/LJ/Client/WebMoney.pm 2010-10-04 03:40:05 UTC (rev 9582) +++ trunk/cgi-bin/LJ/Client/WebMoney.pm 2010-10-04 05:14:30 UTC (rev 9583) @@ -1,3 +1,62 @@ +=head1 NAME + +LJ::Client::WebMoney - the module that handles communication with +the WebMoney XML API. + +=head1 SYNOPSIS + + my $xml = q{ + <w3s.request> + <wmid>123456789012</wmid> + <sign>c30eb2d2a15aef15433732e4f10303ed7801e4d8a35c6e7ab1215544e28411a47b69aca9a5e4d1ad61bb54e05ca80ef8847b7447bcd4898fb6fa8ee64dde1aaa02e9</sign> + <testsign> + <wmid>234567890121</wmid> + <plan>Dummy</plan> + <sign>30eb2d2a15aef15433732e4f10303ed7801e4d8a35c6e7ab1215544e28411a47b69aca9a5e4d1ad61bb54e05ca80ef8847b7447bcd4898fb6fa8ee64dde1aaa02e9c</sign> + </testsign> + </w3s.request> + }; + + # call ClassicAuth (X7) + my $res = LJ::Client::WebMoney->call('ClassicAuth', $xml); + + # another way to do the same + my $res = LJ::Client::WebMoney->call_x7( + 'test_wmid' => '234567890121', + 'test_str' => 'Dummy', + 'test_sign' => '30eb2d2a15aef15433732e4f10303ed7801e4d8a35c6e7ab1215544e28411a47b69aca9a5e4d1ad61bb54e05ca80ef8847b7447bcd4898fb6fa8ee64dde1aaa02e9c', + ); + + warn "signature invalid" + unless $res->{'testsign'}->{'res'} eq 'yes'; + + # please note that methods other than X7 are not implemented yet + +=head1 SEE ALSO + +WebMoney XML API documentation: + +=over 2 + +=item * + +http://wiki.webmoney.ru/wiki/show/XML-%D0%B8%D0%BD%D1%82%D0%B5%D1%80%D1%84%D0%B5%D0%B9%D1%81%D1%8B (Russian) + +=item * + +https://wiki.wmtransfer.com/wiki/show/XML-interfaces (English) + +=back + +Business::WebMoney on CPAN (that one only works with Light Keeper accounts; +in contrast, LJ::Client::WebMoney only works with the Classic ones). + +LJ::Pay::Method::WebMoney + +lj-webmoney-conf.pl + +=cut + package LJ::Client::WebMoney; use strict; use warnings; @@ -16,7 +75,7 @@ $req->uri("https://w3s.wmtransfer.com/asp/XML$func.asp"); $req->content($xml); - my $ua = LWP::UserAgent->new; #LJ::get_useragent( 'role' => 'webmoney-api' ); + my $ua = LJ::get_useragent( 'role' => 'webmoney-api' ); my $res = $ua->request($req); unless ($res->is_success) {