230 lines
8.1 KiB
PHP
230 lines
8.1 KiB
PHP
<?php
|
|
require dirname( __DIR__, 2 ) . "/core/api/php/includes/include.php";
|
|
// https://www15.cradle2careertx.org/portal/admin/services/paypal/webhooks.php?webhook=true
|
|
|
|
|
|
|
|
function __paypal_service_request($requestUrl){
|
|
$body = array("access" => true);
|
|
// $requestUrl = "https://www15.cradle2careertx.org:9302/webhook_events_listener";
|
|
$options = array(
|
|
'http' => array(
|
|
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
|
'method' => 'GET',
|
|
'content' => http_build_query($body)
|
|
),
|
|
"ssl"=>array(
|
|
"verify_peer"=>false,
|
|
"verify_peer_name"=>false,
|
|
),
|
|
);
|
|
$context = stream_context_create($options);
|
|
$result = file_get_contents($requestUrl, false, $context);
|
|
if ($result === FALSE) {
|
|
$result = array("status" => "failure");
|
|
}else{
|
|
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
|
|
// https://www15.cradle2careertx.org/core/php/request.php?webhook_request=true
|
|
// https://www15.cradle2careertx.org/portal/admin/services/paypal/webhooks.php?webhook=true
|
|
// https://www15.cradle2careertx.org/portal/admin/core/api/php/request.php?webhook_request=true
|
|
function webhook_request2(){
|
|
// $obj = array(
|
|
// // The ID of the webhook as configured in your Developer Portal account.
|
|
// webhook_id: "",
|
|
// "transmission_id": req.get('PAYPAL-TRANSMISSION-ID'),
|
|
// "transmission_time": req.get('PAYPAL-TRANSMISSION-TIME'),
|
|
// "transmission_sig": req.get('PAYPAL-TRANSMISSION-SIG'),
|
|
|
|
// cert_url: req.get('PAYPAL-CERT-URL'),
|
|
// auth_algo: req.get('PAYPAL-AUTH-ALGO'),
|
|
// );
|
|
|
|
|
|
// appID: AppfactoryStudio
|
|
// james_api1.appfactory.studio
|
|
// TVFHPK2R9225PCKT
|
|
// AwMds0NH2m8vEgPRSgphoR2TvaTYA.BubSLgZ.Td5GLrpFKL5P52AKlh
|
|
|
|
|
|
|
|
// webhooks details
|
|
// app_name: mywebhooks
|
|
// ClientId
|
|
// Aa-hUI-QfmPnt7vNwhqkoSdjE0UuK0wFe-neDJiuIfnOEXhGl-Fx8Qf1hxaDqxsw_JS5ta6ew2boAoTR
|
|
// Secret key 1:
|
|
// EBaL2WenKH5x028AK_WukCFOzvwRaOtIgTgVSlN44xBRwKcvCYYr0cT4JOTDQK1CVlaJ-QM_b-d_bMYu
|
|
|
|
|
|
|
|
// personal sandbox account
|
|
// https://sandbox.paypal.com
|
|
// sb-yevcv28400344@personal.example.com
|
|
// iTAp#!7n
|
|
|
|
// NVP/SOAP Sandbox API credentials
|
|
// business sandbox account
|
|
// sb-f4g6728386181@business.example.com
|
|
// |Fq@)H8o
|
|
|
|
// sb-f4g6728386181_api1.business.example.com
|
|
// NV9LPHSYD6HBDLE2
|
|
// Signature:
|
|
// AmOqcCijq4H.wz5KnnQf9r6HqN6SAK-9G5nx1QsCR835E-mx5Tx0khAc
|
|
|
|
|
|
// IPN
|
|
// API Username: esb-f4g6728386181_api1.business.example.com
|
|
// API Password: NV9LPHSYD6HBDLE2
|
|
// Signature: AmOqcCijq4H.wz5KnnQf9r6HqN6SAK-9G5nx1QsCR835E-mx5Tx0khAc
|
|
|
|
|
|
|
|
// headers
|
|
/*
|
|
|
|
Content-Length: 1473
|
|
X-B3-Spanid: 85daf04c3165688
|
|
Correlation-Id: 06e9f90c0a87b
|
|
User-Agent: PayPal/AUHD-214.0-58228326
|
|
Content-Type: application/json
|
|
Paypal-Auth-Algo: SHA256withRSA
|
|
Paypal-Cert-Url: https://api.paypal.com/v1/notifications/certs/CERT-360caa42-fca2a594-ad47cb8d
|
|
Paypal-Auth-Version: v2
|
|
Paypal-Transmission-Sig: hCZ2QkwDIwsX80KYD+jE4IrvZ8UFQixhj0ZQ0Hku1VQZ/U9Sm/Mz1eqIScKXtr9dHC6TrbpGyRIFAWKzrMKscoZp/u8DLgsQ9k1IJ/KzxXlqW4WJFG8AV8FietHUAgS6WezOoWuL8H3Zpe9MTGjrzKYQDQBV/swKITXBIwQ4ngCv0T9LTuxfn46iJtdh7XIsswyTsZVoqrwU6ebJn6hl7N9JgOuw3Prhf8DrJMR4UhxRG05fFVydGOoYA7UjXtkUv9+cg5SXwRmtN6sEUJVzF8PVBtsUZ4/LmlKBbFmBDpVlXI+H0P+p0whnkEpjbUi6Zd1GyNbARUb3TrzFiY6U2Q==
|
|
Paypal-Transmission-Time: 2023-12-07T15:53:48Z
|
|
Paypal-Transmission-Id: cf0e7910-9518-11ee-8c10-01aae997541f
|
|
Accept:
|
|
Host: www15.cradle2careertx.org
|
|
*/
|
|
|
|
|
|
// body
|
|
/*
|
|
{
|
|
"id": "WH-6W4482673W002281V-61985753LP2332451",
|
|
"create_time": "2018-19-12T22:20:32.000Z",
|
|
"resource_type": "payment",
|
|
"event_type": "CHECKOUT.CHECKOUT.BUYER-APPROVED",
|
|
"summary": "Checkout Payment is created and approved by buyer.",
|
|
"resource": {
|
|
"payload": "payment_type=instant&payment_date=10%3A46%3A54%20Apr%2028%2C%202019%20PDT&payment_status=Completed&address_status=confirmed&payer_status=verified&first_name=John&last_name=Smith&payer_email=buyer@paypalsandbox.com&payer_id=TESTBUYERID01&address_name=John%20Smith&address_country=United%20States&address_country_code=US&address_zip=95131&address_state=CA&address_city=San%20Jose&address_street=123%20any%20street&business=seller@paypalsandbox.com&receiver_email=seller@paypalsandbox.com&receiver_id=seller@paypalsandbox.com&residence_country=US&item_name1=something&item_number1=AK-1234&tax=2.02&mc_currency=USD&mc_fee=0.44&mc_gross=12.34&mc_gross_1=12.34&mc_handling=2.06&mc_handling1=1.67&mc_shipping=3.02&mc_shipping1=1.02&txn_type=cart&txn_id=274113719¬ify_version=2.1&custom=xyz123&invoice=abc1234&test_ipn=1&verify_sign=AmoLQMSQnFNTX4UH11dp7XvPK.4bAfd10dnRIZeo9cONJNn0b9NquIGb",
|
|
"id": "EC-7JW39463WG7174715"
|
|
},
|
|
"links": [
|
|
{
|
|
"href": "https://api.paypal.com/v1/notifications/webhooks-events/WH-6W4482673W002281V-61985753LP2332451",
|
|
"rel": "self",
|
|
"method": "GET",
|
|
"encType": "application/json"
|
|
},
|
|
{
|
|
"href": "https://api.paypal.com/v1/notifications/webhooks-events/WH-6W4482673W002281V-61985753LP2332451/resend",
|
|
"rel": "resend",
|
|
"method": "POST",
|
|
"encType": "application/json"
|
|
}
|
|
],
|
|
"event_version": "1.0"
|
|
}
|
|
*/
|
|
|
|
|
|
|
|
|
|
// $result = __paypal_service_request("https://www15.cradle2careertx.org:9302/webhook_events_listener");
|
|
|
|
|
|
// nnnnn
|
|
$str = "";
|
|
foreach (getallheaders() as $name => $value) {
|
|
$str .= "$name: $value\n";
|
|
}
|
|
|
|
file_put_contents(__DIR__ . "/testing123.tx", $str);
|
|
|
|
|
|
|
|
}
|
|
|
|
// https://www15.cradle2careertx.org/portal/admin/services/paypal/webhooks.php?webhook=true
|
|
|
|
if(Input::get("webhook")){
|
|
|
|
// webhooks details
|
|
// app_name: mywebhooks
|
|
// webhook_id: 2XA78019KT678284E
|
|
// ClientId
|
|
// Aa-hUI-QfmPnt7vNwhqkoSdjE0UuK0wFe-neDJiuIfnOEXhGl-Fx8Qf1hxaDqxsw_JS5ta6ew2boAoTR
|
|
// Secret key 1:
|
|
// EBaL2WenKH5x028AK_WukCFOzvwRaOtIgTgVSlN44xBRwKcvCYYr0cT4JOTDQK1CVlaJ-QM_b-d_bMYu
|
|
|
|
$X_B3_SPANID = $_SERVER['HTTP_X_B3_SPANID'];
|
|
$CORRELATIONS_Id = $_SERVER['HTTP_CORRELATIONS_Id'];
|
|
$CONTENT_TYPE = $_SERVER['HTTP_CONTENT_TYPE'];
|
|
|
|
$USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
|
|
$PAYPAL_AUTH_ALGO = $_SERVER['HTTP_PAYPAL_AUTH_ALGO'];
|
|
$PAYPAL_Cert_Url = $_SERVER['HTTP_PAYPAL_CERT_URL'];
|
|
$PAYPAL_Auth_Version = $_SERVER['HTTP_PAYPAL_AUTH_VERSION'];
|
|
$PAYPAL_TRANSMISSION_SIG = $_SERVER['HTTP_PAYPAL_TRANSMISSION_SIG'];
|
|
$PAYPAL_TRANSMISSION_TIME = $_SERVER['HTTP_PAYPAL_TRANSMISSION_TIME'];
|
|
$PAYPAL_TRANSMISSION_ID = $_SERVER['HTTP_PAYPAL_TRANSMISSION_ID'];
|
|
|
|
|
|
|
|
$str = "";
|
|
foreach (getallheaders() as $name => $value) {
|
|
$str .= "$name: $value\n";
|
|
}
|
|
|
|
$body = "\n\n\n";
|
|
$body .= "" . $str . "\n\n\n";
|
|
$body .= "auth-algo: " . $PAYPAL_AUTH_ALGO . "\n";
|
|
$body .= "User-Agent: " . $USER_AGENT . "\n";
|
|
$body .= "cert-url: " . $PAYPAL_Cert_Url . "\n";
|
|
$body .= "auth-version: " . $PAYPAL_Auth_Version . "\n";
|
|
$body .= "transmission-sig: " . $PAYPAL_TRANSMISSION_SIG . "\n";
|
|
$body .= "transmission-time: " . $PAYPAL_TRANSMISSION_TIME . "\n";
|
|
$body .= "transmission-id: " . $PAYPAL_TRANSMISSION_ID . "\n\n\n";
|
|
$body .= json_encode(json_decode(file_get_contents('php://input')), JSON_PRETTY_PRINT);
|
|
|
|
|
|
file_put_contents(__DIR__ . "/mytesting59.txt", $body);
|
|
|
|
|
|
|
|
}
|
|
|
|
if(Input::get("webhook2")){
|
|
$payment = __get_main_configurations();
|
|
$obj = null;
|
|
for($i=0; $i < count($payment["configurations"]["payments"]); $i++){
|
|
//echo '</pre>';var_dump($payment["configurations"]["payments"][$i]);echo '</pre>';
|
|
if($payment["configurations"]["payments"][$i]["json"]["active"]){
|
|
$obj = $payment["configurations"]["payments"][$i];
|
|
break;
|
|
}
|
|
|
|
}
|
|
echo $obj["json"]["client_id"];// json_encode($payment["configurations"]);
|
|
echo "<br>";
|
|
echo $payment["managed_domain"]["Address"];
|
|
|
|
// echo gettype($payment["configurations"][0]);
|
|
// echo "<br><br><br><br><br>";
|
|
|
|
// echo '</pre>';
|
|
// var_dump($payment["configurations"][0]);
|
|
// echo '</pre>';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|