web services: webshop payment

Functionality discussions and feature requests

Moderators: hugo, alexandre, rmvanarkel

Post Reply
w3giga
Posts: 4
Joined: Sun Jun 24, 2012 3:12 pm

web services: webshop payment

Post by w3giga »

Hello,

I am trying to receive a payment from external customers via the channel "webshop payment" but I get this error message.
... SoapFault exception: [ns1:unauthorized-access] Server error: unauthorized-access in ...;

NB: Locally, everything works fine, but when I put my app online, I received this error message on the merchant's website even after changing the IP addresses of merchant.

Could you help me please?
w3giga

w3giga
Posts: 4
Joined: Sun Jun 24, 2012 3:12 pm

Re: web services: webshop payment

Post by w3giga »

Hello,
I just found the solution to my problem.
I filled an IP address for my merchant's website, but this did not correspond to the one I wanted.
So I'm going to http://network-tools.com (=> DNS servers) and I found the second Ip address what I used for my merchant and now everything works like a charm.

I post this reply to help those who may face the same problems as me.
Take care and thanks to cyclos for this forum.

ken4ward
Posts: 94
Joined: Tue Sep 18, 2012 3:29 pm

Re: web services: webshop payment

Post by ken4ward »

Hello,

I have the same problem on my local development server
I am trying to receive a payment from external customers via the channel "webshop payment" but I get this error message. ... SoapFault exception: [ns1:unauthorized-access] Server error: unauthorized-access in ...;
Below are my source codes. What am I doing wrong?

My Cylos server is located at http://ndf1-hp:8585 and Joomla server is on http://ndf1-hp:83

I will really appreciate any help.

cylcos.php:

Code: Select all

<?php
class Cyclos {
    public static $server_root = "http://ndf1-hp:8585/cyclos";
    private static $cache = array();
 
    public static function service($service) {
        $cache = Cyclos::$cache;
		// print_r($cache); exit;
        if (!array_key_exists($service, $cache)) {
            $wsdl = Cyclos::$server_root."/services/$service?wsdl";
			// echo $wsdl;
            try {
                $cache[$service] = new SoapClient($wsdl);
            } catch (Exception $e) {
                die("Error retrieving WSDL file $wsdl: $e");
            }
        }
        return $cache[$service];
    }
 
    public static function picture_url($url) {
        if (empty($url)) {
            return Cyclos::$server_root."/systemImage?image=noPicture&thumbnail=true";
        } else {
            return $url;
        }
    }
}
 
# Ensures an element is returned as array. 
# When empty, returns an empty array. 
# When an array, returns itself. 
# Otherwise, an array containg the just the element
function ensure_array($element) {
    if (empty($element)) {
        return array();
    }
    if (array_key_exists(0, $element)) {
        return $element;
    }
    return array($element);
}
?>
prepare_payment.php

Code: Select all

<?php
// Get the web service proxy
require_once 'cyclos.php';
$cyclos = new Cyclos();
$webShopService = $cyclos->service('webshop');
 
// Setup the payment parameters
$params = new stdclass();
$params->amount = 15.23;
$params->description = "Buying new stuff";
$params->clientAddress = 'http://ndf1-hp:83';     // $_SERVER['REMOTE_ADDR'];
$params->toUsername = 'testing';

// This should be the absolute url for the page which will process the payment
$params->returnUrl = "http://ndf1-hp:83/myshop/complete_payment.php";

// Generate the ticket
try {
    //Ensure the input parameter is named 'params' and the output, 'return'
    $ticket = $webShopService->generate(array('params' => $params))->return;
} catch (SoapFault $e) {
    die("Error generating a payment ticket: $e");
}
 
// With the ticket ok, redirect the client to perform the payment
echo $ticket; exit;
header( "Location: ".Cyclos::$server_root."/do/webshop/payment?ticket=".$ticket ) ;
?>

Post Reply