soy mas que novata en estos temas...
Intento invocar a la API de dineromail DoPaymentWithReference, para que me genere el cupon de pago en mi misma pagina.
al invocar al ws me da el siguiente errror:
faultstring:SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://sandboxapi.dineromail.com/DMAPI.asmx?WSDL' : failed to load external entity https://sandboxapi.dineromail.com/DMAPI.asmx?WSDL
el codigo que usé para invocarlo es el provisto de ejemplo por dineromail...
alguien puede orientarme para solucioar el error?
Este es el código:
Código PHP:
<?php
$APIPassword = <password>;
$APIUserName = <credencial>;
$Crypt = false;
$MerchantTransactionId="1";
$UniqueMessageId="1";
$Provider="pagofacil";
$Subject="Subject";
$Message="Message";
$Hash="";
$Currency="ARG";
$Amount="10.40";
$Code="A001";
$Description="Product A001";
$ItemName="LCD Monitor";
$Quantity="1";
$Address='Charcas 2034';
$City='Buenos Aires';
$Country='Argentina';
$Email='[email protected]';
$Name='Carlos';
$LastName='Lopez';
$Phone ='45556565';
$ns = 'https://sandboxapi.dineromail.com/';
//$ns = 'https://api.dineromail.com/';
$wsdlPath="https://sandboxapi.dineromail.com/DMAPI.asmx?WSDL";
//$wsdlPath="https://api.dineromail.com/DMAPI.asmx?WSDL";
try
{
$Items=$Amount.$Code.$Currency.$Description.$ItemName.$Quantity;
$Buyer=$Name.$LastName.$Email.$Address.$Phone.$Country.$City;
$Hash=$MerchantTransactionId.$UniqueMessageId.$Items.$Buyer.$Provider.$Subject.$Message.$APIPassword;
$Hash=MD5($Hash);
if ($Crypt==true)
{
$MerchantTransactionId = encryptTripleDES($APIPassword,$MerchantTransactionId);
$UniqueMessageId =encryptTripleDES($APIPassword,$UniqueMessageId);
$Provider=encryptTripleDES($APIPassword,$Provider);
$Subject=encryptTripleDES($APIPassword,$Subject);
$Message=encryptTripleDES($APIPassword,$Message);
$Currency=encryptTripleDES($APIPassword,$Currency);
$Amount=encryptTripleDES($APIPassword,$Amount);
$Code=encryptTripleDES($APIPassword,$Code);
$ItemName=encryptTripleDES($APIPassword,$ItemName);
$Quantity=encryptTripleDES($APIPassword,$Quantity);
$Address=encryptTripleDES($APIPassword,$Address);
$City=encryptTripleDES($APIPassword,$City);
$Country=encryptTripleDES($APIPassword,$Country);
$Email=encryptTripleDES($APIPassword,$Email);
$Name=encryptTripleDES($APIPassword,$Name);
$LastName=encryptTripleDES($APIPassword,$LastName);
$Phone=encryptTripleDES($APIPassword,$Phone);
}
$soap_options = array('trace' =>1,'exceptions'=>1);
$client = new SoapClient($wsdlPath,$soap_options);
$credential = new SOAPVar(array('APIUserName' => $APIUserName,
'APIPassword'=> $APIPassword)
, SOAP_ENC_OBJECT, 'APICredential', $ns);
$Item = new SOAPVar(array('Amount' => $Amount
,'Code' => $Code
,'Currency' => $Currency
,'Description' => $Description
,'Name' => $ItemName
,'Quantity' => $Quantity)
, SOAP_ENC_OBJECT, 'Item', $ns);
$Items=array($Item);
$BuyerObject = new SOAPVar(array('Address' => $Address
,'City' => $City
,'Country' => $Country
,'Email' => $Email
,'LastName' => $LastName
,'Name' => $Name
,'Phone' => $Phone)
, SOAP_ENC_OBJECT, 'Buyer', $ns);
$request = array('Credential' =>$credential
,'Crypt' => $Crypt
,'MerchantTransactionId' => $MerchantTransactionId
,'UniqueMessageId' => $UniqueMessageId
,'Provider' => $Provider
,'Message' => $Message
,'Subject' => $Subject
,'Items'=>$Items
,'Buyer'=>$BuyerObject
,'Hash' => $Hash);
$result = $client->DoPaymentWithReference($request);
echo "<br/>";
echo "MerchantTransactionId: " . $result->DoPaymentWithReferenceResult->MerchantTransactionId . "<br/>";
echo "Status: " . $result->DoPaymentWithReferenceResult->TransactionId . "<br/>";
echo "Message: " . $result->DoPaymentWithReferenceResult->Message . "<br/>";
echo "Status: " . $result->DoPaymentWithReferenceResult->Status . "<br/>";
echo "TransactionId: " . $result->DoPaymentWithReferenceResult->TransactionId . "<br/>";
echo "BarcodeDigits: " . $result->DoPaymentWithReferenceResult->BarcodeDigits . "<br/>";
echo "BarcodeImageUrl: " . $result->DoPaymentWithReferenceResult->BarcodeImageUrl . "<br/>";
echo "VoucherUrl: " . $result->DoPaymentWithReferenceResult->VoucherUrl . "<br/>";
}
catch (SoapFault $sf)
{
echo "faultstring:". $sf->faultstring;
}
function encryptTripleDES($key, $text){
$vector = "uL%&(#(f";
$td = mcrypt_module_open (MCRYPT_3DES, '', MCRYPT_MODE_CBC, '');
// Complete the key
$key_add = 24-strlen($key);
$key .= substr($key,0,$key_add);
// Padding the text
$text_add = strlen($text)%8;
for($i=$text_add; $i<8; $i++){
$text .= chr(8-$text_add);
}
mcrypt_generic_init ($td, $key, $vector);
$encrypt64 = mcrypt_generic ($td, $text);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
// Return the encrypt text in 64 bits code
return base64_encode($encrypt64);
}
?>
Ojalá puedan ayudarme!
Muchas gracias!!