- 001
- 002
- 003
- 004
- 005
- 006
- 007
- 008
- 009
- 010
- 011
- 012
- 013
- 014
- 015
- 016
- 017
- 018
- 019
- 020
- 021
- 022
- 023
- 024
- 025
- 026
- 027
- 028
- 029
- 030
- 031
- 032
- 033
- 034
- 035
- 036
- 037
- 038
- 039
- 040
- 041
- 042
- 043
- 044
- 045
- 046
- 047
- 048
- 049
- 050
- 051
- 052
- 053
- 054
- 055
- 056
- 057
- 058
- 059
- 060
- 061
- 062
- 063
- 064
- 065
- 066
- 067
- 068
- 069
- 070
- 071
- 072
- 073
- 074
- 075
- 076
- 077
- 078
- 079
- 080
- 081
- 082
- 083
- 084
- 085
- 086
- 087
- 088
- 089
- 090
- 091
- 092
- 093
- 094
- 095
- 096
- 097
- 098
- 099
- 100
public function addBankAccount(
$firstName, $lastName, $companyName, $phone, $addressId, $bankName, $bankSwiftCode, $bankStreet,$bankCity, $bankCountry, $bankState, $bankPostalCode,
$bankAccountNumber, $currency, $bankRoutingCode, $accountType, $bankAccountType, $intermediaryName, $intermediaryStreet,
$intermediaryCountry, $intermediaryState, $intermediaryCity, $intermediaryPostalCode, $intermediarySwift, $intermediaryCodeBank, $intermediaryFurtherAccount, $intermediaryBank
)
{
$key = md5(sprintf("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
$this->encryptedPassword, $firstName, $lastName, $companyName,
$phone, $addressId, $bankName, $bankSwiftCode, $bankStreet, $bankCity,
$bankState, $bankCountry, $bankPostalCode, $bankAccountNumber,
$currency, $bankRoutingCode, $bankAccountType, $accountType,
$intermediaryName, $intermediaryStreet, $intermediaryCountry,
$intermediaryState, $intermediaryCity, $intermediaryPostalCode,
$intermediarySwift, $intermediaryCodeBank, $intermediaryFurtherAccount, $intermediaryBank
));
// Prepare the request
$req = sprintf("method=%s", urlencode("addBankAccount"));
$req .= sprintf("&fromEmail=%s", urlencode($this->fromEmail));
$req .= sprintf("&firstName=%s", urlencode($firstName));
$req .= sprintf("&lastName=%s", urlencode($lastName));
$req .= sprintf("&companyName=%s", urlencode($companyName));
$req .= sprintf("&phone=%s", urlencode($phone));
$req .= sprintf("&addressId=%s", urlencode($addressId));
$req .= sprintf("&bankName=%s", urlencode($bankName));
$req .= sprintf("&bankSwiftCode=%s", urlencode($bankSwiftCode));
$req .= sprintf("&bankStreet=%s", urlencode($bankStreet));
$req .= sprintf("&bankCity=%s", urlencode($bankCity));
$req .= sprintf("&bankCountry=%s", urlencode($bankCountry));
$req .= sprintf("&bankState=%s", urlencode($bankState));
$req .= sprintf("&bankPostalCode=%s", urlencode($bankPostalCode));
$req .= sprintf("&bankAccountNumber=%s", urlencode($bankAccountNumber));
$req .= sprintf("¤cy=%s", urlencode($currency));
$req .= sprintf("&bankRoutingCode=%s", urlencode($bankRoutingCode));
$req .= sprintf("&accountType=%s", urlencode($accountType));
$req .= sprintf("&bankAccountType=%s", urlencode($bankAccountType));
$req .= sprintf("&intermediaryName=%s", urlencode($intermediaryName));
$req .= sprintf("&intermediaryStreet=%s", urlencode($intermediaryStreet));
$req .= sprintf("&intermediaryCountry=%s", urlencode($intermediaryCountry));
$req .= sprintf("&intermediaryState=%s", urlencode($intermediaryState));
$req .= sprintf("&intermediarySwift=%s", urlencode($intermediarySwift));
$req .= sprintf("&intermediaryCodeBank=%s", $intermediaryCodeBank);
$req .= sprintf("&intermediaryFurtherAccount=%s", urlencode($intermediaryFurtherAccount));
$req .= sprintf("&intermediaryBank=%s", $intermediaryBank);
$req .= sprintf("&key=%s", urlencode($key));
// the following two lines are for testing only (in production they should be commented out)
//$req .= sprintf("&sandbox=ON");
//$req .= sprintf("&return=%s", urlencode("51"));
$res = $this->process($req);
// TODO: Parse the response from server and return error code
printf("<textarea cols=\"60\" rows=\"10\" wrap=\"off\">\n%s\n</textarea>\n", $res);
}
protected function process($req)
{
$header = "POST /payment/api/paymentAPI.php HTTP/1.0\r\n";
$header .= "Host: www.paxum.com\r\n";
$header .= "Accept: */*\r\n";
$header .= "User-Agent: php-agent/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Connection: close\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
// Make the request to the server
// If possible, securely post using HTTPS, your PHP server will need to be SSL enabled
$fp = fsockopen ("ssl://www.paxum.com", 443, $errno, $errstr, 30);
if (!$fp)
{
// HTTP ERROR
return -1;
}
//echo $req;exit;
fputs ($fp, sprintf("%s%s", $header, $req));
// Read the server response
$res = "";
$headerdone = false;
while (!feof($fp))
{
$line = fgets ($fp, 1024);
if (strcmp($line, "\r\n") == 0)
{
// read the header
$headerdone = true;
}
else if ($headerdone)
{
// header has been read. now read the contents
$res .= $line;
}
}
}
Dummy00001 20.07.2016 18:01 # +1
ни строчки лишнего. ни зависимости лишней. -> hardcore = true;
знаю не модно. но меня порадовало.
gost 21.07.2016 17:52 # 0
Надёжно. Добротно. Хорошо!
3_14dar 21.07.2016 22:28 # 0
bormand 21.07.2016 22:30 # 0
3_14dar 22.07.2016 02:04 # +1
А АНАЛОГ REQUESTS У НИХ ЕСТЬ?
guest 22.07.2016 03:01 # +1
там вообще не бывает готовых пакетов для чего либо
там даже культуры реюзания кода нет
3_14dar 22.07.2016 03:07 # 0
guesto 23.07.2016 01:38 # +1
в каждом фреймворке свой API для написания пакетов
inkanus-gray 22.07.2016 11:02 # 0
guesto 23.07.2016 01:38 # 0
Fike 23.07.2016 10:53 # 0
guest 23.07.2016 21:00 # +3
Fike 23.07.2016 10:52 # 0