aboutsummaryrefslogtreecommitdiff
path: root/copylib
diff options
context:
space:
mode:
Diffstat (limited to 'copylib')
-rw-r--r--copylib/Makefile.am3
-rw-r--r--copylib/config.php40
-rw-r--r--copylib/merchants.php105
-rw-r--r--copylib/util.php88
4 files changed, 0 insertions, 236 deletions
diff --git a/copylib/Makefile.am b/copylib/Makefile.am
deleted file mode 100644
index 8b8ba763..00000000
--- a/copylib/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-# This Makefile is in the public domain
-
-EXTRA_DIST = config.php merchants.php util.php
diff --git a/copylib/config.php b/copylib/config.php
deleted file mode 100644
index 7a83587c..00000000
--- a/copylib/config.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/*
- This file is part of GNU TALER.
- Copyright (C) 2014, 2015 INRIA
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU Lesser General Public License as published by the Free Software
- Foundation; either version 2.1, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License along with
- TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
-*/
-
-$REFUND_DELTA = 'P3M';
-// set to false when done with local tests
-$explicit_currency = "PUDOS";
-$MERCHANT_CURRENCY = $explicit_currency;
-
-$host = $_SERVER["HTTP_HOST"];
-switch ($host) {
-case "blog.demo.taler.net":
-case "shop.demo.taler.net":
- $MERCHANT_CURRENCY = "KUDOS";
- break;
-case "blog.test.taler.net":
-case "shop.test.taler.net":
- $MERCHANT_CURRENCY = "PUDOS";
- break;
-default:
- if(false == $explicit_currency){
- http_response_code (500);
- echo "<p>Bank configuration error: No currency for domain $host</p>\n";
- die();
- }
-}
-?>
diff --git a/copylib/merchants.php b/copylib/merchants.php
deleted file mode 100644
index a0951f42..00000000
--- a/copylib/merchants.php
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-/*
- This file is part of GNU TALER.
- Copyright (C) 2014, 2015 INRIA
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU Lesser General Public License as published by the Free Software
- Foundation; either version 2.1, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License along with
- TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
-*/
-
-/**
- * Return a contract proposition to forward to the backend
- * Note that `teatax` is an associative array representing a
- * Taler-style amount (so it has the usual <amount,fration,currency>
- * triple). Moreover, `teatax` should be a *list* of taxes
- */
-function generate_contract($args){
- $contract = array ('amount' =>
- array ('value' => $args['amount_value'],
- 'fraction' => $args['amount_fraction'],
- 'currency' => $args['currency']),
- 'max_fee' =>
- array ('value' => 3,
- 'fraction' => 01010,
- 'currency' => $args['currency']),
- 'transaction_id' => $args['transaction_id'],
- 'products' => array (
- array ('description' => $args['description'],
- 'quantity' => 1,
- 'price' =>
- array ('value' => $args['amount_value'],
- 'fraction' => $args['amount_fraction'],
- 'currency' => $args['currency']),
- 'product_id' => $args['product_id'],
- 'taxes' => $args['taxes'],
- 'delivery_date' => "Some Date Format",
- 'delivery_location' => 'LNAME1')),
- 'timestamp' => "/Date(" . $args['now']->getTimestamp() . ")/",
- 'expiry' =>
- "/Date(" . $args['now']->add(new DateInterval('P2W'))->getTimestamp() . ")/",
- 'refund_deadline' =>
- "/Date(" . $args['now']->add(new DateInterval($args['refund_delta']))->getTimestamp() . ")/",
- 'repurchase_correlation_id' => $args['correlation_id'],
- 'fulfillment_url' => $args['fulfillment_url'],
- 'merchant' =>
- array ('address' => 'LNAME2',
- 'name' => $args['merchant_name'],
- 'jurisdiction' => 'LNAME3'),
- 'locations' =>
- array ('LNAME1' =>
- array ('country' => 'Test Country',
- 'city' => 'Test City',
- 'state' => 'Test State',
- 'region' => 'Test Region',
- 'province' => 'Test Province',
- 'ZIP code' => 4908,
- 'street' => 'test street',
- 'street number' => 20),
- 'LNAME2' =>
- array ('country' => 'Test Country',
- 'city' => 'Test City',
- 'state' => 'Test State',
- 'region' => 'Test Region',
- 'province' => 'Test Province',
- 'ZIP code' => 4908,
- 'street' => 'test street',
- 'street number' => 20),
- 'LNAME3' =>
- array ('country' => 'Test Country',
- 'city' => 'Test City',
- 'state' => 'Test State',
- 'region' => 'Test Region',
- 'province' => 'Test Province',
- 'ZIP code' => 4908)));
- $json = json_encode (array ('contract' => $contract), JSON_PRETTY_PRINT);
- return $json;
-}
-
-
-/**
- * Feed `$json` to the backend and return the "(pecl) http response object"
- * corresponding to the `$backend_relative_url` call
- */
-function give_to_backend($backend_relative_url, $json){
- $url = url_join("http://".$_SERVER["HTTP_HOST"], $backend_relative_url);
-
- $req = new http\Client\Request("POST",
- $url,
- array ("Content-Type" => "application/json"));
-
- $req->getBody()->append($json);
-
- // Execute the HTTP request
- $client = new http\Client;
- $client->enqueue($req)->send();
- return $client->getResponse();
-}
-?>
diff --git a/copylib/util.php b/copylib/util.php
deleted file mode 100644
index 2cfbe851..00000000
--- a/copylib/util.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-/*
- This file is part of GNU TALER.
- Copyright (C) 2014, 2015 INRIA
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU Lesser General Public License as published by the Free Software
- Foundation; either version 2.1, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License along with
- TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
-*/
-
-function get(&$var, $default=null) {
- return isset($var) ? $var : $default;
-}
-
-function &pull(&$arr, $idx, $default) {
- if (!isset($arr[$idx])) {
- $arr[$idx] = $default;
- }
- return $arr[$idx];
-}
-
-function message_from_missing_param($missing, $link, $link_name="home page"){
- return "<p>Bad request, no $missing given. Return to <a href=\"$link\">$link_name</a></p>";
-}
-
-function article_state_to_str($article_state){
- if(null == $article_state || !isset($article_state))
- return "undefined state";
- $str = "Is payed? ";
- $str .= $article_state['ispayed'] ? "true," : "false,";
- if(!isset($article_state['hc']))
- $str .= " no hashcode for this article";
- else $str .= " " . $article_state['hc'];
- return $str;
-}
-
-function log_string($str){
- file_put_contents("/tmp/frontend.dbg", $str . "\n", FILE_APPEND);
-}
-
-function get_full_uri(){
-
- return $_SERVER['REQUEST_SCHEME'] . '://'
- . $_SERVER['HTTP_HOST']
- . $_SERVER['REQUEST_URI'];
-}
-
-function url_join($base, $path, $strip=false) {
- $flags = $strip ? (http\Url::STRIP_PATH|http\URL::STRIP_QUERY) : 0;
- return (new http\URL($base, null, $flags))
- ->mod(array ("path" => $path), http\Url::JOIN_PATH|http\URL::SANITIZE_PATH)
- ->toString();
-}
-
-// Get a url with a path relative to the
-// current script's path.
-function url_rel($path, $strip=false) {
- return url_join(
- $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'],
- $path,
- $strip);
-}
-
-function template($file, $array) {
- if (file_exists($file)) {
- $output = file_get_contents($file);
- foreach ($array as $key => $val) {
- $replace = '{'.$key.'}';
- $output = str_replace($replace, $val, $output);
- }
- return $output;
- }
-}
-
-function str_to_dom($str){
- $doc = new DOMDocument();
- $doc->loadHTML($str);
- return $doc;
-
-}
-?>