Compare commits
3 commits
23f811e465
...
dd7d4c865b
| Author | SHA1 | Date | |
|---|---|---|---|
| dd7d4c865b | |||
| c227fce036 | |||
| 539a848e95 |
2194 changed files with 400264 additions and 279 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -67,3 +67,5 @@ www/csv/**
|
|||
www/admin/_sounds/**
|
||||
www/mp3/**
|
||||
faceai/logs/**
|
||||
local-jsp-docker/runtime/
|
||||
/db/
|
||||
402
LOCAL_DEV_JSP_DOCKER_ANALYSIS.md
Normal file
402
LOCAL_DEV_JSP_DOCKER_ANALYSIS.md
Normal file
|
|
@ -0,0 +1,402 @@
|
|||
# Local JSP Docker Analysis
|
||||
|
||||
## Goal
|
||||
|
||||
Turn the public `www` site plus the legacy `rus` admin menu/runtime into a Docker-based local development environment with:
|
||||
|
||||
- full JSP and servlet execution
|
||||
- enough filesystem layout to satisfy docbase-based file lookups
|
||||
- a mocked MySQL-compatible database that lets the app boot and the admin menu render
|
||||
- a workflow that supports editing JSPs and restarting quickly during local development
|
||||
|
||||
This document is an implementation analysis, not a finished deployment recipe.
|
||||
|
||||
## What The Live System Actually Looks Like
|
||||
|
||||
Read-only checks on `83.149.164.4` show the production site is not running from a packaged WAR. It is running from an exploded Tomcat webapp:
|
||||
|
||||
- OS: FreeBSD 14.2
|
||||
- Java: OpenJDK 11.0.25
|
||||
- Tomcat: 9.0.102
|
||||
- `catalina.home` and `catalina.base`: `/usr/local/apache-tomcat-9.0`
|
||||
- Tomcat `server.xml` contains a dedicated host for `www.regalamiunsorriso.it`
|
||||
- The live context for `/` points at `/home/sites/regalamiunsorriso/www/`
|
||||
- Tomcat AJP is enabled on port `8009`
|
||||
|
||||
Important nuance:
|
||||
|
||||
- `/home/sites/regalamiunsorriso/www/WEB-INF` is a real directory
|
||||
- `/home/sites/regalamiunsorriso/rus/WEB-INF` is also a real directory
|
||||
- the live `www/WEB-INF/lib` is much larger than `rus/WEB-INF/lib`
|
||||
- the live `rus/WEB-INF/classes` contains the DB property files
|
||||
- the live `www/WEB-INF/classes` appears minimal
|
||||
- Tomcat `server.xml` maps the live public host only to `/home/sites/regalamiunsorriso/www/`
|
||||
- no live Tomcat `Context` for `/home/sites/regalamiunsorriso/rus/` was visible in `server.xml`
|
||||
|
||||
That means the runtime is split across two legacy trees, but the currently mapped live webapp is `www`. For local Docker work, assuming `www` alone is sufficient would still be unsafe, because the older `rus` tree remains the clearest source of legacy admin code, schema SQL, and bootstrap logic.
|
||||
|
||||
## What The Repo Shows
|
||||
|
||||
### `www`
|
||||
|
||||
The `www` tree is the public web root and already includes:
|
||||
|
||||
- JSP pages
|
||||
- `WEB-INF/web.xml`
|
||||
- taglibs such as `acxent.tld`, `pg.tld`, `news.tld`, `cc.tld`
|
||||
- a large `WEB-INF/lib` with modernized `it.acxent.*` jars
|
||||
- an `admin/menu` tree with JSP admin UI
|
||||
|
||||
Evidence of the rename/migration is strong in `www`:
|
||||
|
||||
- JSPs import `it.acxent.*`
|
||||
- `www/WEB-INF/web.xml` maps servlets under `it.acxent.*`
|
||||
- `www/WEB-INF/lib` contains `acxent-core`, `acxent-common`, `acxent-face`, and related jars
|
||||
|
||||
The current `www/WEB-INF/web.xml` shows:
|
||||
|
||||
- servlet/filter mappings for JSP and rewritten `.html` URLs
|
||||
- admin menu servlet mappings under `/admin/menu/*`
|
||||
- startup servlets that update DB structures on boot
|
||||
- DB config pointing to MySQL-compatible settings
|
||||
- direct dependence on application parameters and filesystem-backed assets
|
||||
|
||||
### `rus`
|
||||
|
||||
The `rus` tree contains the older admin/runtime stack and still matters for local development:
|
||||
|
||||
- `rus/WEB-INF/web.xml` is another full Java webapp descriptor
|
||||
- `rus/admin/menu` contains the older admin dashboard JSPs
|
||||
- `rus/WEB-INF/lib/*_src` contains source code for key servlet, DB, and parameter logic
|
||||
- `rus/admin/_alterTable/pg2rus.sql` contains a large schema for the application domain, including `GARA`, `TIPO_GARA`, `PUNTO_FOTO`, `ACCESS`, `USER_ACCESS`, and `LOG_FOTO`
|
||||
- `rus/WEB-INF/classes/dbcomuni.properties` sets `USE_PARM_HT=true`
|
||||
|
||||
Evidence that `rus` is the older lineage is equally strong:
|
||||
|
||||
- `rus/admin/menu` JSPs import `com.ablia.*`
|
||||
- `rus/WEB-INF/web.xml` maps servlets under `com.ablia.*`
|
||||
- `rus/WEB-INF/lib` contains `ablia.jar`, `abliaDbCom.jar`, and multiple `*_src` trees
|
||||
- `rus/WEB-INF/lib/decomp.bat` suggests this tree has already been treated as a reverse-engineering or recovery surface rather than a clean source distribution
|
||||
|
||||
This is also where the clearest bootstrap logic lives. `Parm.java` seeds defaults for some records such as:
|
||||
|
||||
- `SINGLE_SIGN_ON=false`
|
||||
- `LOGO_MENU=Titolo Applicazione`
|
||||
- `PATH_TMP=_tmp/`
|
||||
- `MAIL_MSG_PATH_MAILER=mailMessage/`
|
||||
- `REWRITE_URL_FILE_PATH=/admin/_alterTable/`
|
||||
|
||||
That helps, but it does not remove the need for a real schema or baseline user/access data.
|
||||
|
||||
## Migration Interpretation
|
||||
|
||||
The evidence supports this interpretation of the `ablia` to `acxent` transition:
|
||||
|
||||
- the active public runtime has moved to the `acxent` namespace and libraries under `www`
|
||||
- the `rus` tree is still valuable, but it is a legacy `ablia` runtime/reference tree rather than the clean current implementation
|
||||
- the live host mapping reinforces that shift, because Tomcat serves `www` and does not visibly publish `rus` as its own live host context
|
||||
|
||||
That means the safest handling is:
|
||||
|
||||
- keep the current `rus` tree as a legacy backup/reference
|
||||
- do not treat the existing `rus` tree as the current canonical codebase
|
||||
- if you want a fresh, updated `rus`-equivalent admin/runtime tree, obtain it separately and preserve it as a new artifact rather than overwriting this legacy one
|
||||
- if the fresh artifact is delivered only as jars or compiled classes, decompiling those classes into a browsable source mirror is reasonable for local analysis and maintenance
|
||||
|
||||
What the current evidence does not prove:
|
||||
|
||||
- that such a fresh downloadable `rus` tree is already present in this repo
|
||||
- that the live server still executes `rus` directly for public requests
|
||||
|
||||
So the evidence supports the preservation and decompilation strategy, but not a claim that this repository already contains the fresh replacement.
|
||||
|
||||
### The Admin Boundary
|
||||
|
||||
There are effectively two admin surfaces in the repo:
|
||||
|
||||
- `www/admin/menu`, using the newer `it.acxent.*` stack
|
||||
- `rus/admin/menu`, using the older `com.ablia.*` stack
|
||||
|
||||
The `www` admin menu already contains compatibility links such as `/admin/pg_RUS/Gara`, which is a strong sign that the public app has been carrying forward legacy admin functionality instead of replacing it cleanly.
|
||||
|
||||
For Docker, that means there are two viable targets:
|
||||
|
||||
1. boot only the `www` webapp and bring over enough `rus` data/assets to satisfy the legacy admin links
|
||||
2. boot both `www` and `rus` as separate Tomcat contexts and keep the boundary explicit
|
||||
|
||||
The second option is safer for analysis and migration because it matches the repository reality better.
|
||||
|
||||
## What “Full JSP Support” Actually Requires
|
||||
|
||||
To satisfy the request, a local container must support more than static JSP rendering.
|
||||
|
||||
It needs:
|
||||
|
||||
- Tomcat 9 with JSP compilation enabled
|
||||
- Java 11 first, because that is what production is currently running
|
||||
- exploded webapp deployment so JSP edits are visible without rebuilding a WAR each time
|
||||
- both taglib trees and both `WEB-INF/lib` trees available at runtime
|
||||
- a writable temp/work area for Tomcat compiled JSPs
|
||||
- a writable app docbase for uploads, generated files, CSV imports, image lookups, and mail templates
|
||||
- a MySQL-compatible database reachable by the app at startup
|
||||
|
||||
It also needs to tolerate the app's legacy assumptions:
|
||||
|
||||
- path concatenation against `DOCBASE`
|
||||
- direct filesystem existence checks inside taglibs and servlets
|
||||
- startup DB mutation via `InitUpdateDbSvlt`
|
||||
- servlet code that chooses JSP pages dynamically based on `ACCESS`, request params, and file existence
|
||||
|
||||
## Data Strategy
|
||||
|
||||
The application does not just query a few content tables. It uses the database as runtime configuration.
|
||||
|
||||
For this codebase, the most practical local-development strategy is not to handcraft mock rows first. It is to start from a dump of the real production-shaped database and trim or sanitize later if needed.
|
||||
|
||||
This is now directly supported by the local workspace state. The following dumps already exist under `db/`:
|
||||
|
||||
- `dump-pg-202604211927.sql`
|
||||
- `dump-pg_log-202604211930.sql`
|
||||
- `dump-mysql-202604211926.sql`
|
||||
- `dump-performance_schema-202604211926.sql`
|
||||
- `dump-sys-202604211930.sql`
|
||||
|
||||
For local development, `dump-pg-202604211927.sql` should be treated as the primary seed source.
|
||||
|
||||
At minimum, local boot for useful development will require:
|
||||
|
||||
- `PARM`
|
||||
- `USERS`
|
||||
- `USER_PROFILE`
|
||||
- `ACCESS`
|
||||
- `USER_ACCESS`
|
||||
- `TABLE_DESC`
|
||||
- photo/event tables such as `GARA`, `TIPO_GARA`, `PUNTO_FOTO`, and likely additional related tables referenced by the servlets
|
||||
|
||||
The admin menu depends on both authentication and metadata-driven routing. A DB with only schema and no seed data will not be enough.
|
||||
|
||||
There are some useful seed hints already in the repo:
|
||||
|
||||
- old user/profile bootstrap SQL under `www/admin/_alterTable/_old`
|
||||
- schema SQL under `rus/admin/_alterTable/pg2rus.sql`
|
||||
- parameter defaults embedded in `rus/WEB-INF/lib/ablia_src/com/ablia/common/Parm.java`
|
||||
|
||||
What is missing from the repo is not raw data, but a curated minimal subset and a documented import procedure for local use.
|
||||
|
||||
If you use the real dump as the starting point, the first local milestone becomes:
|
||||
|
||||
- import the real `pg` dump locally
|
||||
- override the environment-sensitive values after import, especially `PARM.DOCBASE` and any mailer or file-path settings
|
||||
- document one admin login and one public sample flow that are known to work against the imported snapshot
|
||||
|
||||
This is materially easier and more faithful than trying to synthesize a coherent mock dataset from schema alone.
|
||||
|
||||
## Recommended Docker Shape
|
||||
|
||||
### Recommendation
|
||||
|
||||
Build a multi-service local stack with one shared source volume and one MySQL service.
|
||||
|
||||
Suggested services:
|
||||
|
||||
- `tomcat-www`: Tomcat 9 serving `www` as the ROOT webapp
|
||||
- `tomcat-rus`: Tomcat 9 serving `rus` at `/rus` or `/admin-rus`
|
||||
- `mysql`: MySQL 8 or MariaDB 10.11 used only for local development
|
||||
|
||||
Optional but useful:
|
||||
|
||||
- `nginx`: reverse proxy that exposes one friendly local hostname and routes `/` to `tomcat-www` and `/rus` to `tomcat-rus`
|
||||
|
||||
Why this is the best first step:
|
||||
|
||||
- it preserves both legacy runtimes instead of prematurely merging them
|
||||
- it allows JSP edits against exploded directories
|
||||
- it gives you a clean place to prove which admin flows still belong to `rus`
|
||||
- it minimizes risky assumptions about the live cross-tree wiring
|
||||
|
||||
### Alternative
|
||||
|
||||
Run only one Tomcat container with `www` as ROOT and manually overlay selected `rus` assets into it.
|
||||
|
||||
This is possible, but I would not start there because:
|
||||
|
||||
- it bakes in guesses about a split runtime that is already unclear
|
||||
- it makes failures look like classpath bugs even when the problem is missing legacy assets
|
||||
- it is harder to reason about during early local bring-up
|
||||
|
||||
## Filesystem Layout Needed Inside Docker
|
||||
|
||||
A working local setup should not rely only on the web roots. It should create an application docbase volume as well.
|
||||
|
||||
Suggested mounted paths:
|
||||
|
||||
- `/workspace/www` -> repo `www`
|
||||
- `/workspace/rus` -> repo `rus`
|
||||
- `/data/docbase` -> local writable application docbase
|
||||
- `/data/docbase/_tmp` -> temp uploads and generated files
|
||||
- `/data/docbase/admin/csv` -> CSV import/export location used by admin code
|
||||
- `/usr/local/tomcat/work` -> writable JSP compilation cache
|
||||
|
||||
Then seed `PARM.DOCBASE` in local DB to `/data/docbase/`.
|
||||
|
||||
Without that, a large amount of JSP and servlet code will fail on file existence checks even if the JSP compiler itself works.
|
||||
|
||||
## DB Strategy
|
||||
|
||||
### Practical Target
|
||||
|
||||
Use MySQL-compatible SQL, not H2.
|
||||
|
||||
Reasons:
|
||||
|
||||
- production points to MySQL-compatible configuration
|
||||
- legacy SQL and update scripts are written for that family
|
||||
- dynamic SQL and driver assumptions are unlikely to be portable to H2 without patches
|
||||
|
||||
### Preferred Seed Plan
|
||||
|
||||
The local DB should be assembled in layers, but the first layer should now be the real dump rather than repo SQL alone:
|
||||
|
||||
1. import `db/dump-pg-202604211927.sql` into the local MySQL-compatible container
|
||||
2. apply local-only overrides for environment-sensitive `PARM` values
|
||||
3. import optional auxiliary dumps only if the chosen local workflows need them
|
||||
4. document one known-good login and one known-good public sample flow
|
||||
5. only then consider trimming or anonymizing for a lighter-weight developer dataset
|
||||
|
||||
This shifts the main implementation work item from “invent a stable dataset” to “stabilize a production-shaped snapshot for local use.”
|
||||
|
||||
### Required Local Overrides After Import
|
||||
|
||||
Even with the real dump, local development still needs a few post-import adjustments.
|
||||
|
||||
At minimum, review or override:
|
||||
|
||||
- `DOCBASE=/data/docbase/`
|
||||
- `PATH_TMP=_tmp/`
|
||||
- `MAIL_MSG_PATH_MAILER` if local mail-template resolution should stay inside the repo/docbase
|
||||
- any path-oriented `PARM` values that point at production-only filesystem locations
|
||||
- any credentials or integration flags that should not target live services from a developer machine
|
||||
|
||||
The important change is that users, profiles, access metadata, and most domain rows should come from the real dump first, not from a hand-built minimal seed.
|
||||
|
||||
## What Will Probably Break First
|
||||
|
||||
These are the highest-probability local bring-up failures.
|
||||
|
||||
### 1. Incomplete DB Seed
|
||||
|
||||
Most likely symptom:
|
||||
|
||||
- menu renders partially or login works but navigation fails
|
||||
- JSPs throw nulls around `Parm`, `Access`, or user profile resolution
|
||||
|
||||
### 2. Missing Filesystem Assets Under `DOCBASE`
|
||||
|
||||
Most likely symptom:
|
||||
|
||||
- image checks fail
|
||||
- CSV import/export paths fail
|
||||
- mail template lookups fail
|
||||
- servlet code throws `FileNotFoundException` or silently renders degraded UI
|
||||
|
||||
### 3. Mixed Legacy Classpaths
|
||||
|
||||
Most likely symptom:
|
||||
|
||||
- one context starts while the other fails on missing classes, conflicting libs, or older APIs
|
||||
|
||||
Running two Tomcat contexts is the easiest way to isolate this.
|
||||
|
||||
### 4. Rewrite And Context Path Assumptions
|
||||
|
||||
Most likely symptom:
|
||||
|
||||
- `.html` routes or menu links resolve incorrectly when not hosted exactly like production
|
||||
|
||||
This is manageable, but local routing should be explicit.
|
||||
|
||||
## Estimated Work Breakdown
|
||||
|
||||
### Phase 1: Container Bring-Up
|
||||
|
||||
Expected effort: low to medium.
|
||||
|
||||
Deliverables:
|
||||
|
||||
- Docker Compose file
|
||||
- Tomcat Dockerfile or runtime image selection
|
||||
- exploded mounting of `www` and `rus`
|
||||
- MySQL service
|
||||
- baseline local environment variables and startup scripts
|
||||
|
||||
### Phase 2: Local DB Import And Stabilization
|
||||
|
||||
Expected effort: medium to high.
|
||||
|
||||
Deliverables:
|
||||
|
||||
- repeatable import of `db/dump-pg-202604211927.sql`
|
||||
- local override script for environment-sensitive `PARM` rows
|
||||
- one documented admin test login
|
||||
- one documented public sample race/photo flow
|
||||
|
||||
This is the real critical path.
|
||||
|
||||
### Phase 3: Runtime Stabilization
|
||||
|
||||
Expected effort: medium.
|
||||
|
||||
Deliverables:
|
||||
|
||||
- working `DOCBASE` directory layout
|
||||
- local rewrite compatibility
|
||||
- sample assets so photo/event pages can render without production storage
|
||||
- a short smoke-test checklist
|
||||
|
||||
## The Smallest Sensible First Implementation
|
||||
|
||||
If the goal is a usable development environment quickly, the best first slice is:
|
||||
|
||||
1. one Tomcat 9 container for `www`
|
||||
2. one MySQL container
|
||||
3. import the real `pg` dump and apply a small set of local `PARM` overrides
|
||||
4. expose the `www/admin/menu` dashboard first
|
||||
5. add a second `rus` context only when a missing admin flow proves it is still needed
|
||||
|
||||
If the goal is completeness and fewer hidden assumptions, start with both contexts immediately.
|
||||
|
||||
Given the current repo and the server findings, I would still design the Docker setup so a second `rus` context can be added without reworking the stack.
|
||||
|
||||
## Recommendation Summary
|
||||
|
||||
This is feasible, but the hard part is not Docker.
|
||||
|
||||
The hard part is stabilizing a production-shaped local runtime contract across:
|
||||
|
||||
- two legacy web trees
|
||||
- a metadata-driven admin UI
|
||||
- filesystem-backed application behavior
|
||||
- a DB that acts as both content store and runtime config store
|
||||
|
||||
### What It Would Take
|
||||
|
||||
- Tomcat 9 on Java 11
|
||||
- exploded deployment of `www`, and probably `rus` as well
|
||||
- a writable local docbase mounted outside the web roots
|
||||
- a MySQL-compatible local database
|
||||
- import of the real `pg` dump plus a deliberate set of local overrides for environment-sensitive rows
|
||||
- a short compatibility pass on rewrite behavior and admin links
|
||||
|
||||
### Overall Assessment
|
||||
|
||||
Containerizing the JSP runtime is straightforward.
|
||||
|
||||
Making it genuinely useful for local development is still a moderate migration task, but the existence of the real local DB dump changes the shape of the work. The cleanest path is to import the real `pg` snapshot, override the environment-sensitive parts, treat `www` as the active `acxent` runtime, and retain `rus` as a legacy `ablia` reference tree unless and until a fresh updated replacement is obtained and decompiled.
|
||||
|
||||
## Suggested Next Deliverables
|
||||
|
||||
If this analysis is accepted, the next implementation docs should be:
|
||||
|
||||
1. a concrete `docker-compose.yml` design
|
||||
2. a `local-db-import-plan.md` covering dump import plus local `PARM` overrides
|
||||
3. a `local-smoke-test.md` covering login, admin dashboard, one public event page, and one file-backed operation
|
||||
64
analyze_dump.py
Normal file
64
analyze_dump.py
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
import sys
|
||||
import re
|
||||
import os
|
||||
|
||||
filepath = r"db/dump-pg-202604211927.sql"
|
||||
filesize = os.path.getsize(filepath)
|
||||
|
||||
# Pattern for MySQL-style INSERT INTO `table`
|
||||
pattern = re.compile(rb"^INSERT INTO `([^`]+)`", re.IGNORECASE)
|
||||
|
||||
stats = {}
|
||||
|
||||
with open(filepath, "rb") as f:
|
||||
for line in f:
|
||||
line_len = len(line)
|
||||
match = pattern.search(line)
|
||||
if match:
|
||||
table_name = match.group(1).decode("utf-8", errors="ignore")
|
||||
if table_name not in stats:
|
||||
stats[table_name] = {"bytes": 0, "count": 0}
|
||||
stats[table_name]["bytes"] += line_len
|
||||
stats[table_name]["count"] += 1
|
||||
|
||||
results = []
|
||||
for table, data in stats.items():
|
||||
results.append({
|
||||
"table": table,
|
||||
"payload_mb": round(data["bytes"] / (1024 * 1024), 2),
|
||||
"payload_pct": round((data["bytes"] / filesize) * 100, 2),
|
||||
"insert_statements": data["count"],
|
||||
"bytes": data["bytes"]
|
||||
})
|
||||
|
||||
results.sort(key=lambda x: x["bytes"], reverse=True)
|
||||
|
||||
top_20 = results[:20]
|
||||
top_20_names = {r["table"] for r in top_20}
|
||||
|
||||
special_names = {"log_foto", "clifor", "users", "news_users", "coda_messaggi", "clifor_log", "banner_stats", "access_log"}
|
||||
special_substrings = ["log", "queue", "messaggi", "session", "temp", "stats", "foto"]
|
||||
|
||||
def is_special(name):
|
||||
if name in special_names: return True
|
||||
name_lower = name.lower()
|
||||
for sub in special_substrings:
|
||||
if sub in name_lower: return True
|
||||
return False
|
||||
|
||||
# Collect all that match special criteria
|
||||
special_rows = [r for r in results if is_special(r["table"])]
|
||||
special_names_found = {r["table"] for r in special_rows}
|
||||
|
||||
# Combine top 20 and special rows
|
||||
output_rows_set = {r["table"]: r for r in top_20}
|
||||
for r in special_rows:
|
||||
output_rows_set[r["table"]] = r
|
||||
|
||||
output_rows = list(output_rows_set.values())
|
||||
output_rows.sort(key=lambda x: x["bytes"], reverse=True)
|
||||
|
||||
print(f"{'table':<30} | {'payload_mb':>10} | {'payload_pct':>11} | {'insert_statements':>17}")
|
||||
print("-" * 75)
|
||||
for r in output_rows:
|
||||
print(f"{r['table']:<30} | {r['payload_mb']:>10.2f} | {r['payload_pct']:>10.2f}% | {r['insert_statements']:>17}")
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
Manifest-Version: 1.0
|
||||
Archiver-Version: Plexus Archiver
|
||||
Created-By: Apache Maven 3.8.7
|
||||
Built-By: jenkins
|
||||
Build-Jdk: 17.0.16
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
artifactId=acxent-bank
|
||||
groupId=it.acxent
|
||||
version=1.0.1
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>it.acxent</groupId>
|
||||
<artifactId>acxent-bank</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<name>Acxent Banche</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.13.0</version>
|
||||
<configuration>
|
||||
<source>11</source>
|
||||
<target>11</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.7.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-toolchains-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>toolchain</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<toolchains>
|
||||
<jdk>
|
||||
<version>11</version>
|
||||
</jdk>
|
||||
</toolchains>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>github-repo</id>
|
||||
<name>GitHub acolzi Apache Maven Packages</name>
|
||||
<url>https://maven.pkg.github.com/acolzi/repo</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>github-repo</id>
|
||||
<name>GitHub Repository</name>
|
||||
<url>https://maven.pkg.github.com/acolzi/repo</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.stripe</groupId>
|
||||
<artifactId>stripe-java</artifactId>
|
||||
<version>22.29.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.paypal.sdk</groupId>
|
||||
<artifactId>checkout-sdk</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>it.acxent</groupId>
|
||||
<artifactId>acxent-core</artifactId>
|
||||
<version>1.0.1</version>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>it.acxent</groupId>
|
||||
<artifactId>poste-e24paymentpipe</artifactId>
|
||||
<version>0.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>it.acxent</groupId>
|
||||
<artifactId>poste-igfs-cg-plugins</artifactId>
|
||||
<version>0.0.2</version>
|
||||
</dependency>-->
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.paypal.AuthorizeIntentExamples;
|
||||
|
||||
import com.paypal.PayPalClient;
|
||||
import com.paypal.http.HttpRequest;
|
||||
import com.paypal.http.HttpResponse;
|
||||
import com.paypal.http.serializer.Json;
|
||||
import com.paypal.orders.Authorization;
|
||||
import com.paypal.orders.LinkDescription;
|
||||
import com.paypal.orders.Order;
|
||||
import com.paypal.orders.OrderRequest;
|
||||
import com.paypal.orders.OrdersAuthorizeRequest;
|
||||
import com.paypal.orders.PurchaseUnit;
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class AuthorizeOrder extends PayPalClient {
|
||||
private OrderRequest buildRequestBody() {
|
||||
return new OrderRequest();
|
||||
}
|
||||
|
||||
public HttpResponse<Order> authorizeOrder(String orderId, boolean debug) throws IOException {
|
||||
OrdersAuthorizeRequest request = new OrdersAuthorizeRequest(orderId);
|
||||
request.requestBody(buildRequestBody());
|
||||
HttpResponse<Order> response = client().execute((HttpRequest)request);
|
||||
if (debug) {
|
||||
System.out.println("Authorization Ids:");
|
||||
((Order)response.result()).purchaseUnits().forEach(purchaseUnit -> {
|
||||
Objects.requireNonNull(System.out);
|
||||
purchaseUnit.payments().authorizations().stream().map(authorization -> authorization.id()).forEach(System.out::println);
|
||||
});
|
||||
System.out.println("Link Descriptions: ");
|
||||
for (LinkDescription link : (Iterable<LinkDescription>)((Order)response.result()).links())
|
||||
System.out.println("\t" + link.rel() + ": " + link.href());
|
||||
System.out.println("Full response body:");
|
||||
System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4));
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
new AuthorizeOrder().authorizeOrder("<<REPLACE-WITH-APPROVED-ORDER-ID>>", true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.paypal.AuthorizeIntentExamples;
|
||||
|
||||
import com.paypal.PayPalClient;
|
||||
import com.paypal.http.HttpRequest;
|
||||
import com.paypal.http.HttpResponse;
|
||||
import com.paypal.http.serializer.Json;
|
||||
import com.paypal.orders.OrderRequest;
|
||||
import com.paypal.payments.AuthorizationsCaptureRequest;
|
||||
import com.paypal.payments.Capture;
|
||||
import com.paypal.payments.LinkDescription;
|
||||
import java.io.IOException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class CaptureOrder extends PayPalClient {
|
||||
public OrderRequest buildRequestBody() {
|
||||
return new OrderRequest();
|
||||
}
|
||||
|
||||
public HttpResponse<Capture> captureOrder(String authId, boolean debug) throws IOException {
|
||||
AuthorizationsCaptureRequest request = new AuthorizationsCaptureRequest(authId);
|
||||
request.requestBody(buildRequestBody());
|
||||
HttpResponse<Capture> response = client().execute((HttpRequest)request);
|
||||
if (debug) {
|
||||
System.out.println("Status Code: " + response.statusCode());
|
||||
System.out.println("Status: " + ((Capture)response.result()).status());
|
||||
System.out.println("Capture ID: " + ((Capture)response.result()).id());
|
||||
System.out.println("Links: ");
|
||||
for (LinkDescription link : (Iterable<LinkDescription>)((Capture)response.result()).links())
|
||||
System.out.println("\t" + link.rel() + ": " + link.href() + "\tCall Type: " + link.method());
|
||||
System.out.println("Full response body:");
|
||||
System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4));
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
new CaptureOrder().captureOrder("<<REPLACE-WITH-VALID-AUTHORIZATION-ID>>", true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
package com.paypal.AuthorizeIntentExamples;
|
||||
|
||||
import com.paypal.PayPalClient;
|
||||
import com.paypal.http.HttpRequest;
|
||||
import com.paypal.http.HttpResponse;
|
||||
import com.paypal.http.exceptions.HttpException;
|
||||
import com.paypal.http.serializer.Json;
|
||||
import com.paypal.orders.AddressPortable;
|
||||
import com.paypal.orders.AmountBreakdown;
|
||||
import com.paypal.orders.AmountWithBreakdown;
|
||||
import com.paypal.orders.ApplicationContext;
|
||||
import com.paypal.orders.Item;
|
||||
import com.paypal.orders.LinkDescription;
|
||||
import com.paypal.orders.Money;
|
||||
import com.paypal.orders.Name;
|
||||
import com.paypal.orders.Order;
|
||||
import com.paypal.orders.OrderRequest;
|
||||
import com.paypal.orders.OrdersCreateRequest;
|
||||
import com.paypal.orders.PurchaseUnitRequest;
|
||||
import com.paypal.orders.ShippingDetail;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class CreateOrder extends PayPalClient {
|
||||
private OrderRequest buildCompleteRequestBody() {
|
||||
OrderRequest orderRequest = new OrderRequest();
|
||||
orderRequest.checkoutPaymentIntent("AUTHORIZE");
|
||||
ApplicationContext applicationContext = new ApplicationContext().brandName("EXAMPLE INC").landingPage("BILLING")
|
||||
.cancelUrl("https://www.example.com").returnUrl("https://www.example.com").userAction("CONTINUE")
|
||||
.shippingPreference("SET_PROVIDED_ADDRESS");
|
||||
orderRequest.applicationContext(applicationContext);
|
||||
List<PurchaseUnitRequest> purchaseUnitRequests = new ArrayList<>();
|
||||
PurchaseUnitRequest purchaseUnitRequest = new PurchaseUnitRequest().referenceId("PUHF")
|
||||
.description("Sporting Goods").customId("CUST-HighFashions").softDescriptor("HighFashions")
|
||||
.amountWithBreakdown(new AmountWithBreakdown().currencyCode("USD").value("220.00")
|
||||
.amountBreakdown(new AmountBreakdown().itemTotal(new Money().currencyCode("USD").value("180.00"))
|
||||
.shipping(new Money().currencyCode("USD").value("20.00"))
|
||||
.handling(new Money().currencyCode("USD").value("10.00"))
|
||||
.taxTotal(new Money().currencyCode("USD").value("20.00"))
|
||||
.shippingDiscount(new Money().currencyCode("USD").value("10.00"))))
|
||||
.items(new ArrayList<>() {
|
||||
{
|
||||
add(new Item().name("T-shirt").description("Green XL").sku("sku01")
|
||||
.unitAmount(new Money().currencyCode("USD").value("90.00"))
|
||||
.tax(new Money().currencyCode("USD").value("10.00")).quantity("1")
|
||||
.category("PHYSICAL_GOODS"));
|
||||
add(new Item().name("Shoes").description("Running, Size 10.5").sku("sku02")
|
||||
.unitAmount(new Money().currencyCode("USD").value("45.00"))
|
||||
.tax(new Money().currencyCode("USD").value("5.00")).quantity("2")
|
||||
.category("PHYSICAL_GOODS"));
|
||||
}
|
||||
}).shippingDetail(new ShippingDetail().name(new Name().fullName("John Doe"))
|
||||
.addressPortable(new AddressPortable().addressLine1("123 Townsend St").addressLine2("Floor 6")
|
||||
.adminArea2("San Francisco").adminArea1("CA").postalCode("94107").countryCode("US")));
|
||||
purchaseUnitRequests.add(purchaseUnitRequest);
|
||||
orderRequest.purchaseUnits(purchaseUnitRequests);
|
||||
return orderRequest;
|
||||
}
|
||||
|
||||
private OrderRequest buildMinimumRequestBody() {
|
||||
OrderRequest orderRequest = new OrderRequest();
|
||||
orderRequest.checkoutPaymentIntent("AUTHORIZE");
|
||||
ApplicationContext applicationContext = new ApplicationContext()
|
||||
.cancelUrl("https://www.example.com").returnUrl("https://www.example.com");
|
||||
orderRequest.applicationContext(applicationContext);
|
||||
List<PurchaseUnitRequest> purchaseUnitRequests = new ArrayList<>();
|
||||
PurchaseUnitRequest purchaseUnitRequest = new PurchaseUnitRequest()
|
||||
.amountWithBreakdown(new AmountWithBreakdown().currencyCode("USD").value("220.00"));
|
||||
purchaseUnitRequests.add(purchaseUnitRequest);
|
||||
orderRequest.purchaseUnits(purchaseUnitRequests);
|
||||
return orderRequest;
|
||||
}
|
||||
|
||||
public HttpResponse<Order> createOrder(boolean debug) throws IOException {
|
||||
OrdersCreateRequest request = new OrdersCreateRequest();
|
||||
request.header("prefer", "return=representation");
|
||||
request.requestBody(buildCompleteRequestBody());
|
||||
HttpResponse<Order> response = client().execute((HttpRequest)request);
|
||||
if (debug &&
|
||||
response.statusCode() == 201) {
|
||||
System.out.println("Order with Complete Payload: ");
|
||||
System.out.println("Status Code: " + response.statusCode());
|
||||
System.out.println("Status: " + ((Order)response.result()).status());
|
||||
System.out.println("Order ID: " + ((Order)response.result()).id());
|
||||
System.out.println("Intent: " + ((Order)response.result()).checkoutPaymentIntent());
|
||||
System.out.println("Links: ");
|
||||
for (LinkDescription link : (Iterable<LinkDescription>)((Order)response.result()).links())
|
||||
System.out.println("\t" + link.rel() + ": " + link.href() + "\tCall Type: " + link.method());
|
||||
System.out.println("Total Amount: " + ((Order)response.result()).purchaseUnits().get(0).amountWithBreakdown().currencyCode() + " " + ((Order)
|
||||
response.result()).purchaseUnits().get(0).amountWithBreakdown().value());
|
||||
System.out.println("Full response body:");
|
||||
System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4));
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
public HttpResponse<Order> createOrderWithMinimumPayload(boolean debug) throws IOException {
|
||||
OrdersCreateRequest request = new OrdersCreateRequest();
|
||||
request.header("prefer", "return=representation");
|
||||
request.requestBody(buildMinimumRequestBody());
|
||||
HttpResponse<Order> response = client().execute((HttpRequest)request);
|
||||
if (debug &&
|
||||
response.statusCode() == 201) {
|
||||
System.out.println("Order with Minimum Payload: ");
|
||||
System.out.println("Status Code: " + response.statusCode());
|
||||
System.out.println("Status: " + ((Order)response.result()).status());
|
||||
System.out.println("Order ID: " + ((Order)response.result()).id());
|
||||
System.out.println("Intent: " + ((Order)response.result()).checkoutPaymentIntent());
|
||||
System.out.println("Links: ");
|
||||
for (LinkDescription link : (Iterable<LinkDescription>)((Order)response.result()).links())
|
||||
System.out.println("\t" + link.rel() + ": " + link.href() + "\tCall Type: " + link.method());
|
||||
System.out.println("Total Amount: " + ((Order)response.result()).purchaseUnits().get(0).amountWithBreakdown().currencyCode() + " " + ((Order)
|
||||
response.result()).purchaseUnits().get(0).amountWithBreakdown().value());
|
||||
System.out.println("Full response body:");
|
||||
System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4));
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
new CreateOrder().createOrder(true);
|
||||
new CreateOrder().createOrderWithMinimumPayload(true);
|
||||
} catch (HttpException e) {
|
||||
System.out.println(e.getLocalizedMessage());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package com.paypal.AuthorizeIntentExamples;
|
||||
|
||||
import com.paypal.PayPalClient;
|
||||
import com.paypal.http.HttpRequest;
|
||||
import com.paypal.http.HttpResponse;
|
||||
import com.paypal.http.serializer.Json;
|
||||
import com.paypal.payments.CapturesRefundRequest;
|
||||
import com.paypal.payments.LinkDescription;
|
||||
import com.paypal.payments.Money;
|
||||
import com.paypal.payments.Refund;
|
||||
import com.paypal.payments.RefundRequest;
|
||||
import java.io.IOException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class RefundOrder extends PayPalClient {
|
||||
public RefundRequest buildRequestBody() {
|
||||
RefundRequest refundRequest = new RefundRequest();
|
||||
Money money = new Money();
|
||||
money.currencyCode("USD");
|
||||
money.value("20.00");
|
||||
refundRequest.amount(money);
|
||||
return refundRequest;
|
||||
}
|
||||
|
||||
public HttpResponse<Refund> refundOrder(String captureId, boolean debug) throws IOException {
|
||||
CapturesRefundRequest request = new CapturesRefundRequest(captureId);
|
||||
request.prefer("return=representation");
|
||||
request.requestBody(buildRequestBody());
|
||||
HttpResponse<Refund> response = client().execute((HttpRequest)request);
|
||||
if (debug) {
|
||||
System.out.println("Status Code: " + response.statusCode());
|
||||
System.out.println("Status: " + ((Refund)response.result()).status());
|
||||
System.out.println("Refund Id: " + ((Refund)response.result()).id());
|
||||
System.out.println("Links: ");
|
||||
for (LinkDescription link : (Iterable<LinkDescription>)((Refund)response.result()).links())
|
||||
System.out.println("\t" + link.rel() + ": " + link.href() + "\tCall Type: " + link.method());
|
||||
System.out.println("Full response body:");
|
||||
System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4));
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
new RefundOrder().refundOrder("<<REPLACE-WITH-VALID-CAPTURE-ID>>", true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.paypal.AuthorizeIntentExamples;
|
||||
|
||||
import com.paypal.http.HttpResponse;
|
||||
import com.paypal.orders.LinkDescription;
|
||||
import com.paypal.orders.Order;
|
||||
import com.paypal.payments.Capture;
|
||||
import com.paypal.payments.Refund;
|
||||
|
||||
public class RunAll {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
HttpResponse<Order> orderResponse = new CreateOrder().createOrder(false);
|
||||
String orderId = "";
|
||||
System.out.println("Creating Order...");
|
||||
if (orderResponse.statusCode() == 201) {
|
||||
orderId = ((Order)orderResponse.result()).id();
|
||||
System.out.println("Order ID: " + orderId);
|
||||
System.out.println("Links:");
|
||||
for (LinkDescription link : (Iterable<LinkDescription>)((Order)orderResponse.result()).links())
|
||||
System.out.println("\t" + link.rel() + ": " + link.href());
|
||||
}
|
||||
System.out.println("Created Successfully\n");
|
||||
System.out.println("Copy approve link and paste it in browser. Login with buyer account and follow the instructions.\nOnce approved hit enter...");
|
||||
System.in.read();
|
||||
System.out.println("Authorizing Order...");
|
||||
orderResponse = new AuthorizeOrder().authorizeOrder(orderId, false);
|
||||
String authId = "";
|
||||
if (orderResponse.statusCode() == 201) {
|
||||
System.out.println("Authorized Successfully\n");
|
||||
authId = ((Order)orderResponse.result()).purchaseUnits().get(0).payments().authorizations().get(0).id();
|
||||
}
|
||||
System.out.println("Capturing Order...");
|
||||
HttpResponse<Capture> captureOrderResponse = new CaptureOrder().captureOrder(authId, false);
|
||||
if (orderResponse.statusCode() == 201) {
|
||||
System.out.println("Captured Successfully");
|
||||
System.out.println("Status Code: " + captureOrderResponse.statusCode());
|
||||
System.out.println("Status: " + ((Capture)captureOrderResponse.result()).status());
|
||||
System.out.println("Capture ID: " + ((Capture)captureOrderResponse.result()).id());
|
||||
System.out.println("Links: ");
|
||||
for (com.paypal.payments.LinkDescription link : (Iterable<com.paypal.payments.LinkDescription>)((Capture)captureOrderResponse.result()).links())
|
||||
System.out.println("\t" + link.rel() + ": " + link.href() + "\tCall Type: " + link.method());
|
||||
}
|
||||
System.out.println();
|
||||
System.out.println("Refunding Order...");
|
||||
HttpResponse<Refund> refundHttpResponse = new RefundOrder().refundOrder(((Capture)captureOrderResponse.result()).id(), false);
|
||||
if (refundHttpResponse.statusCode() == 201) {
|
||||
System.out.println("Refunded Successfully");
|
||||
System.out.println("Status Code: " + refundHttpResponse.statusCode());
|
||||
System.out.println("Status: " + ((Refund)refundHttpResponse.result()).status());
|
||||
System.out.println("Order ID: " + ((Refund)refundHttpResponse.result()).id());
|
||||
System.out.println("Links: ");
|
||||
for (com.paypal.payments.LinkDescription link : (Iterable<com.paypal.payments.LinkDescription>)((Refund)refundHttpResponse.result()).links())
|
||||
System.out.println("\t" + link.rel() + ": " + link.href() + "\tCall Type: " + link.method());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package com.paypal.CaptureIntentExamples;
|
||||
|
||||
import com.paypal.PayPalClient;
|
||||
import com.paypal.http.HttpRequest;
|
||||
import com.paypal.http.HttpResponse;
|
||||
import com.paypal.http.serializer.Json;
|
||||
import com.paypal.orders.Capture;
|
||||
import com.paypal.orders.LinkDescription;
|
||||
import com.paypal.orders.Order;
|
||||
import com.paypal.orders.OrderRequest;
|
||||
import com.paypal.orders.OrdersCaptureRequest;
|
||||
import com.paypal.orders.Payer;
|
||||
import com.paypal.orders.PurchaseUnit;
|
||||
import java.io.IOException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class CaptureOrder extends PayPalClient {
|
||||
public OrderRequest buildRequestBody() {
|
||||
return new OrderRequest();
|
||||
}
|
||||
|
||||
public HttpResponse<Order> captureOrder(String orderId, boolean debug) throws IOException {
|
||||
OrdersCaptureRequest request = new OrdersCaptureRequest(orderId);
|
||||
request.requestBody(buildRequestBody());
|
||||
HttpResponse<Order> response = client().execute((HttpRequest)request);
|
||||
if (debug) {
|
||||
System.out.println("Status Code: " + response.statusCode());
|
||||
System.out.println("Status: " + ((Order)response.result()).status());
|
||||
System.out.println("Order ID: " + ((Order)response.result()).id());
|
||||
System.out.println("Links: ");
|
||||
for (LinkDescription link : (Iterable<LinkDescription>)((Order)response.result()).links())
|
||||
System.out.println("\t" + link.rel() + ": " + link.href());
|
||||
System.out.println("Capture ids:");
|
||||
for (PurchaseUnit purchaseUnit : (Iterable<PurchaseUnit>)((Order)response.result()).purchaseUnits()) {
|
||||
for (Capture capture : (Iterable<Capture>)purchaseUnit.payments().captures())
|
||||
System.out.println("\t" + capture.id());
|
||||
}
|
||||
System.out.println("Buyer: ");
|
||||
Payer buyer = ((Order)response.result()).payer();
|
||||
System.out.println("\tEmail Address: " + buyer.email());
|
||||
System.out.println("\tName: " + buyer.name().givenName() + " " + buyer.name().surname());
|
||||
System.out.println("Full response body:");
|
||||
System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4));
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
new CaptureOrder().captureOrder("<<REPLACE-WITH-APPROVED-ORDER-ID>>", true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
package com.paypal.CaptureIntentExamples;
|
||||
|
||||
import com.paypal.PayPalClient;
|
||||
import com.paypal.http.HttpRequest;
|
||||
import com.paypal.http.HttpResponse;
|
||||
import com.paypal.http.exceptions.HttpException;
|
||||
import com.paypal.http.serializer.Json;
|
||||
import com.paypal.orders.AddressPortable;
|
||||
import com.paypal.orders.AmountBreakdown;
|
||||
import com.paypal.orders.AmountWithBreakdown;
|
||||
import com.paypal.orders.ApplicationContext;
|
||||
import com.paypal.orders.Item;
|
||||
import com.paypal.orders.LinkDescription;
|
||||
import com.paypal.orders.Money;
|
||||
import com.paypal.orders.Name;
|
||||
import com.paypal.orders.Order;
|
||||
import com.paypal.orders.OrderRequest;
|
||||
import com.paypal.orders.OrdersCreateRequest;
|
||||
import com.paypal.orders.PurchaseUnitRequest;
|
||||
import com.paypal.orders.ShippingDetail;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class CreateOrder extends PayPalClient {
|
||||
private OrderRequest buildRequestBody() {
|
||||
OrderRequest orderRequest = new OrderRequest();
|
||||
orderRequest.checkoutPaymentIntent("CAPTURE");
|
||||
ApplicationContext applicationContext = new ApplicationContext().brandName("EXAMPLE INC").landingPage("BILLING")
|
||||
.cancelUrl("https://www.example.com").returnUrl("https://www.example.com").userAction("CONTINUE")
|
||||
.shippingPreference("SET_PROVIDED_ADDRESS");
|
||||
orderRequest.applicationContext(applicationContext);
|
||||
List<PurchaseUnitRequest> purchaseUnitRequests = new ArrayList<>();
|
||||
PurchaseUnitRequest purchaseUnitRequest = new PurchaseUnitRequest().referenceId("PUHF")
|
||||
.description("Sporting Goods").customId("CUST-HighFashions").softDescriptor("HighFashions")
|
||||
.amountWithBreakdown(new AmountWithBreakdown().currencyCode("USD").value("220.00")
|
||||
.amountBreakdown(new AmountBreakdown().itemTotal(new Money().currencyCode("USD").value("180.00"))
|
||||
.shipping(new Money().currencyCode("USD").value("20.00"))
|
||||
.handling(new Money().currencyCode("USD").value("10.00"))
|
||||
.taxTotal(new Money().currencyCode("USD").value("20.00"))
|
||||
.shippingDiscount(new Money().currencyCode("USD").value("10.00"))))
|
||||
.items(new ArrayList<>() {
|
||||
{
|
||||
add(new Item().name("T-shirt").description("Green XL").sku("sku01")
|
||||
.unitAmount(new Money().currencyCode("USD").value("90.00"))
|
||||
.tax(new Money().currencyCode("USD").value("10.00")).quantity("1")
|
||||
.category("PHYSICAL_GOODS"));
|
||||
add(new Item().name("Shoes").description("Running, Size 10.5").sku("sku02")
|
||||
.unitAmount(new Money().currencyCode("USD").value("45.00"))
|
||||
.tax(new Money().currencyCode("USD").value("5.00")).quantity("2")
|
||||
.category("PHYSICAL_GOODS"));
|
||||
}
|
||||
}).shippingDetail(new ShippingDetail().name(new Name().fullName("John Doe"))
|
||||
.addressPortable(new AddressPortable().addressLine1("123 Townsend St").addressLine2("Floor 6")
|
||||
.adminArea2("San Francisco").adminArea1("CA").postalCode("94107").countryCode("US")));
|
||||
purchaseUnitRequests.add(purchaseUnitRequest);
|
||||
orderRequest.purchaseUnits(purchaseUnitRequests);
|
||||
return orderRequest;
|
||||
}
|
||||
|
||||
public HttpResponse<Order> createOrder(boolean debug) throws IOException {
|
||||
OrdersCreateRequest request = new OrdersCreateRequest();
|
||||
request.header("prefer", "return=representation");
|
||||
request.requestBody(buildRequestBody());
|
||||
HttpResponse<Order> response = client().execute((HttpRequest)request);
|
||||
if (debug &&
|
||||
response.statusCode() == 201) {
|
||||
System.out.println("Status Code: " + response.statusCode());
|
||||
System.out.println("Status: " + ((Order)response.result()).status());
|
||||
System.out.println("Order ID: " + ((Order)response.result()).id());
|
||||
System.out.println("Intent: " + ((Order)response.result()).checkoutPaymentIntent());
|
||||
System.out.println("Links: ");
|
||||
for (LinkDescription link : (Iterable<LinkDescription>)((Order)response.result()).links())
|
||||
System.out.println("\t" + link.rel() + ": " + link.href() + "\tCall Type: " + link.method());
|
||||
System.out.println("Total Amount: " + ((Order)response.result()).purchaseUnits().get(0).amountWithBreakdown().currencyCode() + " " + ((Order)
|
||||
response.result()).purchaseUnits().get(0).amountWithBreakdown().value());
|
||||
System.out.println("Full response body:");
|
||||
System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4));
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
new CreateOrder().createOrder(true);
|
||||
} catch (HttpException e) {
|
||||
System.out.println(e.getLocalizedMessage());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package com.paypal.CaptureIntentExamples;
|
||||
|
||||
import com.paypal.AuthorizeIntentExamples.RefundOrder;
|
||||
import com.paypal.http.HttpResponse;
|
||||
import com.paypal.orders.Capture;
|
||||
import com.paypal.orders.LinkDescription;
|
||||
import com.paypal.orders.Order;
|
||||
import com.paypal.orders.PurchaseUnit;
|
||||
import com.paypal.payments.Refund;
|
||||
|
||||
public class RunAll {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
HttpResponse<Order> orderResponse = new CreateOrder().createOrder(false);
|
||||
String orderId = "";
|
||||
System.out.println("Creating Order...");
|
||||
if (orderResponse.statusCode() == 201) {
|
||||
orderId = ((Order)orderResponse.result()).id();
|
||||
System.out.println("Links:");
|
||||
for (LinkDescription link : (Iterable<LinkDescription>)((Order)orderResponse.result()).links())
|
||||
System.out.println("\t" + link.rel() + ": " + link.href());
|
||||
}
|
||||
System.out.println("Created Successfully\n");
|
||||
System.out.println("Copy approve link and paste it in browser. Login with buyer account and follow the instructions.\nOnce approved hit enter...");
|
||||
System.in.read();
|
||||
System.out.println("Capturing Order...");
|
||||
orderResponse = new CaptureOrder().captureOrder(orderId, false);
|
||||
String captureId = "";
|
||||
if (orderResponse.statusCode() == 201) {
|
||||
System.out.println("Captured Successfully");
|
||||
System.out.println("Status Code: " + orderResponse.statusCode());
|
||||
System.out.println("Status: " + ((Order)orderResponse.result()).status());
|
||||
System.out.println("Order ID: " + ((Order)orderResponse.result()).id());
|
||||
System.out.println("Links:");
|
||||
for (LinkDescription link : (Iterable<LinkDescription>)((Order)orderResponse.result()).links())
|
||||
System.out.println("\t" + link.rel() + ": " + link.href());
|
||||
System.out.println("Capture ids:");
|
||||
for (PurchaseUnit purchaseUnit : (Iterable<PurchaseUnit>)((Order)orderResponse.result()).purchaseUnits()) {
|
||||
for (Capture capture : (Iterable<Capture>)purchaseUnit.payments().captures()) {
|
||||
System.out.println("\t" + capture.id());
|
||||
captureId = capture.id();
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("Refunding Order...");
|
||||
HttpResponse<Refund> refundResponse = new RefundOrder().refundOrder(captureId, false);
|
||||
if (refundResponse.statusCode() == 201) {
|
||||
System.out.println("Refunded Successfully");
|
||||
System.out.println("Status Code: " + refundResponse.statusCode());
|
||||
System.out.println("Status: " + ((Refund)refundResponse.result()).status());
|
||||
System.out.println("Refund ID: " + ((Refund)refundResponse.result()).id());
|
||||
System.out.println("Links:");
|
||||
for (com.paypal.payments.LinkDescription link : (Iterable<com.paypal.payments.LinkDescription>)((Refund)refundResponse.result()).links())
|
||||
System.out.println("\t" + link.rel() + ": " + link.href());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.paypal;
|
||||
|
||||
import com.paypal.http.HttpRequest;
|
||||
import com.paypal.http.HttpResponse;
|
||||
import com.paypal.http.exceptions.HttpException;
|
||||
import com.paypal.orders.AmountWithBreakdown;
|
||||
import com.paypal.orders.OrderRequest;
|
||||
import com.paypal.orders.OrdersCreateRequest;
|
||||
import com.paypal.orders.PurchaseUnitRequest;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class ErrorSample extends PayPalClient {
|
||||
public void createError1() {
|
||||
OrdersCreateRequest request = new OrdersCreateRequest();
|
||||
request.requestBody(new OrderRequest());
|
||||
System.out.println("Request Body: {}\n");
|
||||
System.out.println("Response:");
|
||||
try {
|
||||
HttpResponse httpResponse = this.client.execute((HttpRequest)request);
|
||||
} catch (IOException e) {
|
||||
HttpException h = (HttpException)e;
|
||||
JSONObject message = new JSONObject(h.getMessage());
|
||||
System.out.println(prettyPrint(message, ""));
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
public void createError2() {
|
||||
OrdersCreateRequest request = new OrdersCreateRequest();
|
||||
request.requestBody(new OrderRequest()
|
||||
.checkoutPaymentIntent("INVALID")
|
||||
.purchaseUnits(new ArrayList<>() {
|
||||
{
|
||||
add(new PurchaseUnitRequest().amountWithBreakdown(new AmountWithBreakdown().currencyCode("USD").value("100.00")));
|
||||
}
|
||||
}));
|
||||
System.out.println("Request Body:");
|
||||
System.out.println("{\n\"intent\": \"INVALID\",\n\"purchase_units\": [\n{\n\"amount\": {\n\"currency_code\": \"USD\",\n\"value\": \"100.00\"\n}\n}\n]\n}\n");
|
||||
System.out.println("Response:");
|
||||
try {
|
||||
HttpResponse httpResponse = this.client.execute((HttpRequest)request);
|
||||
} catch (IOException e) {
|
||||
HttpException h = (HttpException)e;
|
||||
JSONObject message = new JSONObject(h.getMessage());
|
||||
System.out.println(prettyPrint(message, ""));
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
ErrorSample errorSample = new ErrorSample();
|
||||
System.out.println("Calling createError1 (Body has no required parameters (intent, purchase_units))");
|
||||
errorSample.createError1();
|
||||
System.out.println("Calling createError2 (Body has invalid parameter value for intent)");
|
||||
errorSample.createError2();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.paypal;
|
||||
|
||||
import com.paypal.AuthorizeIntentExamples.CreateOrder;
|
||||
import com.paypal.http.HttpRequest;
|
||||
import com.paypal.http.HttpResponse;
|
||||
import com.paypal.http.serializer.Json;
|
||||
import com.paypal.orders.Order;
|
||||
import com.paypal.orders.OrdersGetRequest;
|
||||
import java.io.IOException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class GetOrder extends PayPalClient {
|
||||
public void getOrder(String orderId) throws IOException {
|
||||
OrdersGetRequest request = new OrdersGetRequest(orderId);
|
||||
HttpResponse<Order> response = client().execute((HttpRequest)request);
|
||||
System.out.println("Full response body:");
|
||||
System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4));
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
HttpResponse<Order> response = new CreateOrder().createOrder(false);
|
||||
new GetOrder().getOrder(((Order)response.result()).id());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package com.paypal;
|
||||
|
||||
import com.paypal.AuthorizeIntentExamples.CreateOrder;
|
||||
import com.paypal.http.HttpRequest;
|
||||
import com.paypal.http.HttpResponse;
|
||||
import com.paypal.http.serializer.Json;
|
||||
import com.paypal.orders.AmountBreakdown;
|
||||
import com.paypal.orders.AmountWithBreakdown;
|
||||
import com.paypal.orders.LinkDescription;
|
||||
import com.paypal.orders.Money;
|
||||
import com.paypal.orders.Order;
|
||||
import com.paypal.orders.OrdersGetRequest;
|
||||
import com.paypal.orders.OrdersPatchRequest;
|
||||
import com.paypal.orders.Patch;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class PatchOrder extends PayPalClient {
|
||||
private List<Patch> buildRequestBody() throws IOException {
|
||||
List<Patch> patches = new ArrayList<>();
|
||||
patches.add(new Patch().op("replace").path("/intent").value("CAPTURE"));
|
||||
patches.add(new Patch().op("replace").path("/purchase_units/@reference_id=='PUHF'/amount")
|
||||
.value(new AmountWithBreakdown().currencyCode("USD").value("200.00")
|
||||
.amountBreakdown(new AmountBreakdown().itemTotal(new Money().currencyCode("USD").value("180.00"))
|
||||
.taxTotal(new Money().currencyCode("USD").value("20.00")))));
|
||||
return patches;
|
||||
}
|
||||
|
||||
public void patchOrder(String orderId) throws IOException {
|
||||
OrdersPatchRequest request = new OrdersPatchRequest(orderId);
|
||||
request.requestBody(buildRequestBody());
|
||||
client().execute((HttpRequest)request);
|
||||
OrdersGetRequest getRequest = new OrdersGetRequest(orderId);
|
||||
HttpResponse<Order> response = this.client.execute((HttpRequest)getRequest);
|
||||
System.out.println("After Patch:");
|
||||
System.out.println("Order ID: " + ((Order)response.result()).id());
|
||||
System.out.println("Intent: " + ((Order)response.result()).checkoutPaymentIntent());
|
||||
System.out.println("Links: ");
|
||||
for (LinkDescription link : (Iterable<LinkDescription>)((Order)response.result()).links())
|
||||
System.out.println("\t" + link.rel() + ": " + link.href() + "\tCall Type: " + link.method());
|
||||
System.out.println("Gross Amount: " + ((Order)response.result()).purchaseUnits().get(0).amountWithBreakdown().currencyCode() + " " + ((Order)
|
||||
response.result()).purchaseUnits().get(0).amountWithBreakdown().value());
|
||||
System.out.println("Full response body:");
|
||||
System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4));
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
System.out.println("Before PATCH:");
|
||||
HttpResponse<Order> response = new CreateOrder().createOrder(true);
|
||||
System.out.println("\nAfter PATCH (Changed Intent and Amount):");
|
||||
new PatchOrder().patchOrder(((Order)response.result()).id());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.paypal;
|
||||
|
||||
import com.paypal.core.PayPalEnvironment;
|
||||
import com.paypal.core.PayPalHttpClient;
|
||||
import java.util.Iterator;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class PayPalClient {
|
||||
private PayPalEnvironment environment = new PayPalEnvironment.Sandbox(
|
||||
(System.getProperty("PAYPAL_CLIENT_ID") != null) ? System.getProperty("PAYPAL_CLIENT_ID") :
|
||||
"<<PAYPAL-CLIENT-ID>>",
|
||||
(System.getProperty("PAYPAL_CLIENT_SECRET") != null) ? System.getProperty("PAYPAL_CLIENT_SECRET") :
|
||||
"<<PAYPAL-CLIENT-SECRET>>");
|
||||
|
||||
PayPalHttpClient client = new PayPalHttpClient(this.environment);
|
||||
|
||||
public PayPalHttpClient client() {
|
||||
return this.client;
|
||||
}
|
||||
|
||||
public String prettyPrint(JSONObject jo, String pre) {
|
||||
Iterator<?> keys = jo.keys();
|
||||
StringBuilder pretty = new StringBuilder();
|
||||
while (keys.hasNext()) {
|
||||
String key = (String)keys.next();
|
||||
pretty.append(String.format("%s%s: ", pre, StringUtils.capitalize(key)));
|
||||
if (jo.get(key) instanceof JSONObject) {
|
||||
pretty.append(prettyPrint(jo.getJSONObject(key), pre + "\t"));
|
||||
continue;
|
||||
}
|
||||
if (jo.get(key) instanceof org.json.JSONArray) {
|
||||
int sno = 1;
|
||||
for (Object jsonObject : (Iterable<Object>)jo.getJSONArray(key)) {
|
||||
pretty.append(String.format("\n%s\t%d:\n", pre, sno++));
|
||||
pretty.append(prettyPrint((JSONObject)jsonObject, pre + "\t\t"));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
pretty.append(String.format("%s\n", jo.getString(key)));
|
||||
}
|
||||
return pretty.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package it.acxent.bank;
|
||||
|
||||
import it.acxent.common.Parm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.util.Debug;
|
||||
|
||||
public abstract class _BankAdapter extends Debug {
|
||||
private ApplParmFull ap;
|
||||
|
||||
public static final String DEFAULT_OK_KO_PAGE = "payRes.jsp";
|
||||
|
||||
public ApplParmFull getApFull() {
|
||||
return this.ap;
|
||||
}
|
||||
|
||||
public void setAp(ApplParmFull ap) {
|
||||
this.ap = ap;
|
||||
}
|
||||
|
||||
public Parm getParm(String theKey) {
|
||||
if (getApFull() != null)
|
||||
return getApFull().getParm(theKey);
|
||||
return new Parm();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,323 @@
|
|||
package it.acxent.bank.consel;
|
||||
|
||||
import it.acxent.common.Parm;
|
||||
import it.acxent.common.StatusMsg;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
|
||||
public class ConselReq {
|
||||
public static final String P_COD_TIPO_PRODOTTO_CONSEL = "COD_TIPO_PRODOTTO_CONSEL";
|
||||
|
||||
private String tipoesec;
|
||||
|
||||
private String tabfin;
|
||||
|
||||
private String cognome;
|
||||
|
||||
private String nome;
|
||||
|
||||
private String indirizzo;
|
||||
|
||||
private String tel_num;
|
||||
|
||||
private String pref_num;
|
||||
|
||||
private String data_nascita;
|
||||
|
||||
private String testomail;
|
||||
|
||||
private ApplParmFull ap;
|
||||
|
||||
private String ordine;
|
||||
|
||||
private String descri1;
|
||||
|
||||
private String parz1;
|
||||
|
||||
private String h_merce;
|
||||
|
||||
private String h_prod;
|
||||
|
||||
private String convenz;
|
||||
|
||||
private String impdafin;
|
||||
|
||||
public static final String CONSEL_TAB_FIN_90 = "WIP";
|
||||
|
||||
private double anticipo;
|
||||
|
||||
private String impspe;
|
||||
|
||||
private String codfisc;
|
||||
|
||||
public static final String P_CONSEL_IMPORTO_MINIMO = "CONSEL_IMPORTO_MINIMO";
|
||||
|
||||
public static final String P_CONSEL_TEST = "CONSEL_TEST";
|
||||
|
||||
public static final String P_CONSEL_OK_PAGE = "CONSEL_OK_PAGE";
|
||||
|
||||
public static final String CONSEL_TAB_FIN_TASSO_0 = "MPF";
|
||||
|
||||
public static final String CONSEL_TAB_FIN_30 = "WIN";
|
||||
|
||||
public static final String CONSEL_REQUEST_SERVER = "https://reserved.e-consel.it/DOL/faces/frmECProntoTuo.jsp";
|
||||
|
||||
public static final String P_COD_TIPO_MERCE_CONSEL = "COD_TIPO_MERCE_CONSEL";
|
||||
|
||||
public static final String P_COD_CONVENZIONE_CONSEL = "COD_CONVENZIONE_CONSEL";
|
||||
|
||||
public static final String P_CONSEL_ERROR_PAGE = "CONSEL_ERROR_PAGE";
|
||||
|
||||
public static final String P_CONSEL_RATA0 = "CONSEL_RATA0";
|
||||
|
||||
public ConselReq(ApplParmFull l_ap) {
|
||||
setAp(l_ap);
|
||||
}
|
||||
|
||||
public ConselReq() {}
|
||||
|
||||
public String getTipoesec() {
|
||||
return "T";
|
||||
}
|
||||
|
||||
public void setTipoesec(String tipoesec) {
|
||||
this.tipoesec = tipoesec;
|
||||
}
|
||||
|
||||
public String getTabfin() {
|
||||
return (this.tabfin == null) ? "" : this.tabfin.trim();
|
||||
}
|
||||
|
||||
public void setTabfin(String tabfin) {
|
||||
this.tabfin = tabfin;
|
||||
}
|
||||
|
||||
public String getCognome() {
|
||||
return (this.cognome == null) ? "" : this.cognome.trim();
|
||||
}
|
||||
|
||||
public void setCognome(String cognome) {
|
||||
this.cognome = cognome;
|
||||
}
|
||||
|
||||
public String getNome() {
|
||||
return (this.nome == null) ? "" : this.nome.trim();
|
||||
}
|
||||
|
||||
public void setNome(String nome) {
|
||||
this.nome = nome;
|
||||
}
|
||||
|
||||
public String getIndirizzo() {
|
||||
return (this.indirizzo == null) ? "" : this.indirizzo.trim();
|
||||
}
|
||||
|
||||
public void setIndirizzo(String indirizzo) {
|
||||
this.indirizzo = indirizzo;
|
||||
}
|
||||
|
||||
public String getTel_num() {
|
||||
return (this.tel_num == null) ? "" : this.tel_num.trim();
|
||||
}
|
||||
|
||||
public void setTel_num(String tel_num) {
|
||||
this.tel_num = tel_num;
|
||||
}
|
||||
|
||||
public String getPref_num() {
|
||||
return (this.pref_num == null) ? "" : this.pref_num.trim();
|
||||
}
|
||||
|
||||
public void setPref_num(String pref_num) {
|
||||
this.pref_num = pref_num;
|
||||
}
|
||||
|
||||
public String getData_nascita() {
|
||||
return (this.data_nascita == null) ? "" : this.data_nascita.trim();
|
||||
}
|
||||
|
||||
public void setData_nascita(String data_nascita) {
|
||||
this.data_nascita = data_nascita;
|
||||
}
|
||||
|
||||
public String getTestomail() {
|
||||
return (this.testomail == null) ? "" : this.testomail.trim();
|
||||
}
|
||||
|
||||
public void setTestomail(String testomail) {
|
||||
this.testomail = testomail;
|
||||
}
|
||||
|
||||
public String getCodfisc() {
|
||||
return (this.codfisc == null) ? "" : this.codfisc.trim();
|
||||
}
|
||||
|
||||
public void setCodfisc(String codfisc) {
|
||||
this.codfisc = codfisc;
|
||||
}
|
||||
|
||||
public String getOrdine() {
|
||||
return (this.ordine == null) ? "" : this.ordine.trim();
|
||||
}
|
||||
|
||||
public void setOrdine(String ordine) {
|
||||
this.ordine = ordine;
|
||||
}
|
||||
|
||||
public String getDescri1() {
|
||||
return (this.descri1 == null) ? "" : this.descri1.trim();
|
||||
}
|
||||
|
||||
public void setDescri1(String descri1) {
|
||||
this.descri1 = descri1;
|
||||
}
|
||||
|
||||
public String getParz1() {
|
||||
return (this.parz1 == null) ? "" : this.parz1;
|
||||
}
|
||||
|
||||
public void setParz1(String parz1) {
|
||||
this.parz1 = parz1;
|
||||
}
|
||||
|
||||
public String getH_merce() {
|
||||
if (this.h_merce == null)
|
||||
this.h_merce = getApFull().getParm("COD_TIPO_MERCE_CONSEL").getTesto();
|
||||
return this.h_merce;
|
||||
}
|
||||
|
||||
public void setH_merce(String h_merce) {
|
||||
this.h_merce = h_merce;
|
||||
}
|
||||
|
||||
public String getH_prod() {
|
||||
if (this.h_prod == null)
|
||||
this.h_prod = getApFull().getParm("COD_TIPO_PRODOTTO_CONSEL").getTesto();
|
||||
return this.h_prod;
|
||||
}
|
||||
|
||||
public void setH_prod(String h_prod) {
|
||||
this.h_prod = h_prod;
|
||||
}
|
||||
|
||||
public String getConvenz() {
|
||||
if (this.convenz == null)
|
||||
this.convenz = getApFull().getParm("COD_CONVENZIONE_CONSEL").getTesto().trim();
|
||||
return this.convenz;
|
||||
}
|
||||
|
||||
public void setConvenz(String convenz) {
|
||||
this.convenz = convenz;
|
||||
}
|
||||
|
||||
public String getImpdafin() {
|
||||
return (this.impdafin == null) ? "" : this.impdafin;
|
||||
}
|
||||
|
||||
public void setImpdafin(String impdafin) {
|
||||
this.impdafin = impdafin;
|
||||
}
|
||||
|
||||
public double getAnticipo() {
|
||||
return this.anticipo;
|
||||
}
|
||||
|
||||
public void setAnticipo(double anticipo) {
|
||||
this.anticipo = anticipo;
|
||||
}
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
if (ap != null) {
|
||||
DBAdapter.logDebug(true, "CONSEL chechout initParms: start");
|
||||
String l_tipoParm = "";
|
||||
Parm bean = new Parm(ap);
|
||||
l_tipoParm = "CONSEL";
|
||||
StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm);
|
||||
bean.findByCodice("COD_CONVENZIONE_CONSEL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("COD_CONVENZIONE_CONSEL");
|
||||
bean.setDescrizione("COD_CONVENZIONE_CONSEL");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("CODICE CONVENZIONE CONSEL");
|
||||
bean.save();
|
||||
bean.findByCodice("COD_TIPO_MERCE_CONSEL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("COD_TIPO_MERCE_CONSEL");
|
||||
bean.setDescrizione("COD_TIPO_MERCE_CONSEL");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("CODICE INDICATIVO MERCE FINANZIATA ");
|
||||
bean.save();
|
||||
bean.findByCodice("COD_TIPO_PRODOTTO_CONSEL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("COD_TIPO_PRODOTTO_CONSEL");
|
||||
bean.setDescrizione("COD_TIPO_PRODOTTO_CONSEL");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("CODICE INDICATIVO PRODOTTO FINANZIATO");
|
||||
bean.save();
|
||||
bean.findByCodice("CONSEL_ERROR_PAGE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("CONSEL_ERROR_PAGE");
|
||||
bean.setDescrizione("CONSEL_ERROR_PAGE");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("conselRes.jsp");
|
||||
bean.setNota("CONSEL_ERROR_PAGE");
|
||||
bean.save();
|
||||
bean.findByCodice("CONSEL_OK_PAGE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("CONSEL_OK_PAGE");
|
||||
bean.setDescrizione("CONSEL_OK_PAGE");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("conselRes.jsp");
|
||||
bean.setNota("CONSEL_OK_PAGE");
|
||||
bean.save();
|
||||
bean.findByCodice("CONSEL_TEST");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("CONSEL_TEST");
|
||||
bean.setDescrizione("CONSEL_TEST");
|
||||
bean.setFlgTipo(1L);
|
||||
bean.setNota("0-->NO 1-->SI");
|
||||
bean.save();
|
||||
bean.findByCodice("CONSEL_IMPORTO_MINIMO");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("CONSEL_IMPORTO_MINIMO");
|
||||
bean.setDescrizione("CONSEL_IMPORTO_MINIMO");
|
||||
bean.setFlgTipo(1L);
|
||||
bean.setNota("CONSEL_IMPORTO_MINIMO");
|
||||
bean.save();
|
||||
bean.findByCodice("CONSEL_RATA0");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("CONSEL_RATA0");
|
||||
bean.setDescrizione("CONSEL_RATA0");
|
||||
bean.setFlgTipo(1L);
|
||||
bean.setNota(" ATTIVA ANCHE RATA 0 SOPRA L'IMPORTO DEFINITO DA CONSEL_IMPORTO_MINIMO<BR>0: RATA 0 NON ATTIVA<br>1: RATA 0 ATTIVA");
|
||||
bean.save();
|
||||
DBAdapter.logDebug(true, "CONSEL chechout initParms: stop");
|
||||
}
|
||||
}
|
||||
|
||||
public String getImpspe() {
|
||||
return (this.impspe == null) ? "" : this.impspe;
|
||||
}
|
||||
|
||||
public void setImpspe(String impspe) {
|
||||
this.impspe = impspe;
|
||||
}
|
||||
|
||||
public ApplParmFull getApFull() {
|
||||
return this.ap;
|
||||
}
|
||||
|
||||
public void setAp(ApplParmFull ap) {
|
||||
this.ap = ap;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package it.acxent.bank.consel;
|
||||
|
||||
import it.acxent.db.ApplParmFull;
|
||||
|
||||
public class ConselResp {
|
||||
private String pratica;
|
||||
|
||||
private ApplParmFull ap;
|
||||
|
||||
private String ordine;
|
||||
|
||||
private String praticabis;
|
||||
|
||||
private String stato;
|
||||
|
||||
public static final String CONSEL_VALUTAZIONE = "WW";
|
||||
|
||||
public static final String CONSEL_KO = "KO";
|
||||
|
||||
public static final String CONSEL_OK = "OK";
|
||||
|
||||
public ConselResp(ApplParmFull l_ap) {
|
||||
setAp(l_ap);
|
||||
}
|
||||
|
||||
public ConselResp() {}
|
||||
|
||||
public String getOrdine() {
|
||||
return (this.ordine == null) ? "" : this.ordine.trim();
|
||||
}
|
||||
|
||||
public void setOrdine(String ordine) {
|
||||
this.ordine = ordine;
|
||||
}
|
||||
|
||||
public ApplParmFull getApFull() {
|
||||
return this.ap;
|
||||
}
|
||||
|
||||
public void setAp(ApplParmFull ap) {
|
||||
this.ap = ap;
|
||||
}
|
||||
|
||||
public String getPratica() {
|
||||
return (this.pratica == null) ? "" : this.pratica.trim();
|
||||
}
|
||||
|
||||
public void setPratica(String pratica) {
|
||||
this.pratica = pratica;
|
||||
}
|
||||
|
||||
public String getPraticabis() {
|
||||
return (this.praticabis == null) ? "" : this.praticabis.trim();
|
||||
}
|
||||
|
||||
public void setPraticabis(String praticabis) {
|
||||
this.praticabis = praticabis;
|
||||
}
|
||||
|
||||
public String getStato() {
|
||||
return (this.stato == null) ? "" : this.stato.trim();
|
||||
}
|
||||
|
||||
public void setStato(String stato) {
|
||||
this.stato = stato;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,184 @@
|
|||
package it.acxent.bank.consel;
|
||||
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.db.WcString;
|
||||
import it.acxent.util.Vectumerator;
|
||||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class ConselTabfin extends DBAdapter implements Serializable {
|
||||
public static final double MIN_FIN = 168.0D;
|
||||
|
||||
public static final double MAX_FIN = 7500.0D;
|
||||
|
||||
private long id_conselTabfin;
|
||||
|
||||
private String flgTipo;
|
||||
|
||||
private double valoreBene;
|
||||
|
||||
private long durata;
|
||||
|
||||
private double importoRata;
|
||||
|
||||
private double tan;
|
||||
|
||||
private double taeg;
|
||||
|
||||
private double interessi;
|
||||
|
||||
private double speseGestSingolaRata;
|
||||
|
||||
private double speseGestTotaleRata;
|
||||
|
||||
private double impostaBollo;
|
||||
|
||||
private double importoTotaleDovuto;
|
||||
|
||||
public ConselTabfin(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public ConselTabfin() {}
|
||||
|
||||
public void setId_conselTabfin(long newId_conselTabfin) {
|
||||
this.id_conselTabfin = newId_conselTabfin;
|
||||
}
|
||||
|
||||
public void setFlgTipo(String newFlgTipo) {
|
||||
this.flgTipo = newFlgTipo;
|
||||
}
|
||||
|
||||
public void setValoreBene(double newValoreBene) {
|
||||
this.valoreBene = newValoreBene;
|
||||
}
|
||||
|
||||
public void setDurata(long newDurata) {
|
||||
this.durata = newDurata;
|
||||
}
|
||||
|
||||
public void setImportoRata(double newImportoRata) {
|
||||
this.importoRata = newImportoRata;
|
||||
}
|
||||
|
||||
public void setTan(double newTan) {
|
||||
this.tan = newTan;
|
||||
}
|
||||
|
||||
public void setTaeg(double newTaeg) {
|
||||
this.taeg = newTaeg;
|
||||
}
|
||||
|
||||
public void setInteressi(double newInteressi) {
|
||||
this.interessi = newInteressi;
|
||||
}
|
||||
|
||||
public void setSpeseGestSingolaRata(double newSpeseGestSingolaRata) {
|
||||
this.speseGestSingolaRata = newSpeseGestSingolaRata;
|
||||
}
|
||||
|
||||
public void setSpeseGestTotaleRata(double newSpeseGestTotaleRata) {
|
||||
this.speseGestTotaleRata = newSpeseGestTotaleRata;
|
||||
}
|
||||
|
||||
public void setImpostaBollo(double newImpostaBollo) {
|
||||
this.impostaBollo = newImpostaBollo;
|
||||
}
|
||||
|
||||
public void setImportoTotaleDovuto(double newImportoTotaleDovuto) {
|
||||
this.importoTotaleDovuto = newImportoTotaleDovuto;
|
||||
}
|
||||
|
||||
public long getId_conselTabfin() {
|
||||
return this.id_conselTabfin;
|
||||
}
|
||||
|
||||
public String getFlgTipo() {
|
||||
return (this.flgTipo == null) ? "" : this.flgTipo.trim();
|
||||
}
|
||||
|
||||
public double getValoreBene() {
|
||||
return this.valoreBene;
|
||||
}
|
||||
|
||||
public long getDurata() {
|
||||
return this.durata;
|
||||
}
|
||||
|
||||
public double getImportoRata() {
|
||||
return this.importoRata;
|
||||
}
|
||||
|
||||
public double getTan() {
|
||||
return this.tan;
|
||||
}
|
||||
|
||||
public double getTaeg() {
|
||||
return this.taeg;
|
||||
}
|
||||
|
||||
public double getInteressi() {
|
||||
return this.interessi;
|
||||
}
|
||||
|
||||
public double getSpeseGestSingolaRata() {
|
||||
return this.speseGestSingolaRata;
|
||||
}
|
||||
|
||||
public double getSpeseGestTotaleRata() {
|
||||
return this.speseGestTotaleRata;
|
||||
}
|
||||
|
||||
public double getImpostaBollo() {
|
||||
return this.impostaBollo;
|
||||
}
|
||||
|
||||
public double getImportoTotaleDovuto() {
|
||||
return this.importoTotaleDovuto;
|
||||
}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void deleteCascade() {}
|
||||
|
||||
public Vectumerator findByCR(ConselTabfinCR CR, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select A.* from CONSEL_TABFIN AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
if (CR.getValoreBene() > 0.0D)
|
||||
wc.addWc("A.valoreBene=" + CR.getValoreBene());
|
||||
if (!CR.getFlgTipo().isEmpty())
|
||||
wc.addWc("A.flgTipo='" + CR.getFlgTipo() + "'");
|
||||
if (CR.getDurata() > 0L)
|
||||
wc.addWc("A.durata=" + CR.getDurata());
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public void findByTipoValoreDurata(String l_flgTipo, double l_valore, long l_durata) {
|
||||
String s_Sql_Find = "select A.* from CONSEL_TABFIN AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.valoreBene=" + Math.round(l_valore));
|
||||
wc.addWc("A.flgTipo='" + l_flgTipo + "'");
|
||||
wc.addWc("A.durata=" + l_durata);
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
findFirstRecord(stmt);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
package it.acxent.bank.consel;
|
||||
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
|
||||
public class ConselTabfinCR extends CRAdapter {
|
||||
private long id_conselTabfin;
|
||||
|
||||
private String flgTipo;
|
||||
|
||||
private double valoreBene;
|
||||
|
||||
private long durata;
|
||||
|
||||
private double importoRata;
|
||||
|
||||
private double tan;
|
||||
|
||||
private double taeg;
|
||||
|
||||
private double interessi;
|
||||
|
||||
private double speseGestSingolaRata;
|
||||
|
||||
private double speseGestTotaleRata;
|
||||
|
||||
private double impostaBollo;
|
||||
|
||||
private double importoTotaleDovuto;
|
||||
|
||||
public ConselTabfinCR(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public ConselTabfinCR() {}
|
||||
|
||||
public void setId_conselTabfin(long newId_conselTabfin) {
|
||||
this.id_conselTabfin = newId_conselTabfin;
|
||||
}
|
||||
|
||||
public void setFlgTipo(String newFlgTipo) {
|
||||
this.flgTipo = newFlgTipo;
|
||||
}
|
||||
|
||||
public void setValoreBene(double newValoreBene) {
|
||||
this.valoreBene = newValoreBene;
|
||||
}
|
||||
|
||||
public void setDurata(long newDurata) {
|
||||
this.durata = newDurata;
|
||||
}
|
||||
|
||||
public void setImportoRata(double newImportoRata) {
|
||||
this.importoRata = newImportoRata;
|
||||
}
|
||||
|
||||
public void setTan(double newTan) {
|
||||
this.tan = newTan;
|
||||
}
|
||||
|
||||
public void setTaeg(double newTaeg) {
|
||||
this.taeg = newTaeg;
|
||||
}
|
||||
|
||||
public void setInteressi(double newInteressi) {
|
||||
this.interessi = newInteressi;
|
||||
}
|
||||
|
||||
public void setSpeseGestSingolaRata(double newSpeseGestSingolaRata) {
|
||||
this.speseGestSingolaRata = newSpeseGestSingolaRata;
|
||||
}
|
||||
|
||||
public void setSpeseGestTotaleRata(double newSpeseGestTotaleRata) {
|
||||
this.speseGestTotaleRata = newSpeseGestTotaleRata;
|
||||
}
|
||||
|
||||
public void setImpostaBollo(double newImpostaBollo) {
|
||||
this.impostaBollo = newImpostaBollo;
|
||||
}
|
||||
|
||||
public void setImportoTotaleDovuto(double newImportoTotaleDovuto) {
|
||||
this.importoTotaleDovuto = newImportoTotaleDovuto;
|
||||
}
|
||||
|
||||
public long getId_conselTabfin() {
|
||||
return this.id_conselTabfin;
|
||||
}
|
||||
|
||||
public String getFlgTipo() {
|
||||
return (this.flgTipo == null) ? "" : this.flgTipo.trim();
|
||||
}
|
||||
|
||||
public double getValoreBene() {
|
||||
return this.valoreBene;
|
||||
}
|
||||
|
||||
public long getDurata() {
|
||||
return this.durata;
|
||||
}
|
||||
|
||||
public double getImportoRata() {
|
||||
return this.importoRata;
|
||||
}
|
||||
|
||||
public double getTan() {
|
||||
return this.tan;
|
||||
}
|
||||
|
||||
public double getTaeg() {
|
||||
return this.taeg;
|
||||
}
|
||||
|
||||
public double getInteressi() {
|
||||
return this.interessi;
|
||||
}
|
||||
|
||||
public double getSpeseGestSingolaRata() {
|
||||
return this.speseGestSingolaRata;
|
||||
}
|
||||
|
||||
public double getSpeseGestTotaleRata() {
|
||||
return this.speseGestTotaleRata;
|
||||
}
|
||||
|
||||
public double getImpostaBollo() {
|
||||
return this.impostaBollo;
|
||||
}
|
||||
|
||||
public double getImportoTotaleDovuto() {
|
||||
return this.importoTotaleDovuto;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,251 @@
|
|||
package it.acxent.bank.infogroup;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
import it.acxent.common.Parm;
|
||||
import it.acxent.common.StatusMsg;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
public class ShopnetReq extends _BankAdapter {
|
||||
public static final String LANG_CODE_IT = "0";
|
||||
|
||||
public static final String LANG_CODE_EN = "1";
|
||||
|
||||
public static final String LANG_CODE_ES = "2";
|
||||
|
||||
public static final String LANG_CODE_DE = "3";
|
||||
|
||||
public static final String DIV_CODE_EURO = "1";
|
||||
|
||||
private static NumberFormat nf2;
|
||||
|
||||
private String f;
|
||||
|
||||
private String l;
|
||||
|
||||
private String m;
|
||||
|
||||
private String o;
|
||||
|
||||
private String i;
|
||||
|
||||
private String d;
|
||||
|
||||
private String p;
|
||||
|
||||
private String c;
|
||||
|
||||
private String u;
|
||||
|
||||
private String n;
|
||||
|
||||
private String e;
|
||||
|
||||
private String action;
|
||||
|
||||
public static final String P_PAYMENT_ERROR_PAGE = "PAY_KO";
|
||||
|
||||
public static final String P_PAYMENT_OK_PAGE = "PAY_OK";
|
||||
|
||||
public static final long CC_DINERS = 2L;
|
||||
|
||||
public static final long CC_MASTERCARD = 1L;
|
||||
|
||||
public static final long CC_AMEX = 3L;
|
||||
|
||||
public static final long CC_VISA = 0L;
|
||||
|
||||
public static final String P_SHOPNET_PID = "SHOPNET_PID";
|
||||
|
||||
public static final String P_SHOPNET_ID = "SHOPNET_ID";
|
||||
|
||||
public static final String DEFAULT_SHOPNET_ACTION = "https://ecommerce.infogroup.it/shopnetplus/do";
|
||||
|
||||
public ShopnetReq() {}
|
||||
|
||||
public ShopnetReq(String lang) {
|
||||
setlang(lang);
|
||||
}
|
||||
|
||||
private void setlang(String l_lang) {
|
||||
if (l_lang.toLowerCase().equals("it")) {
|
||||
setL("0");
|
||||
} else if (l_lang.toLowerCase().equals("en")) {
|
||||
setL("1");
|
||||
} else if (l_lang.toLowerCase().equals("es\t")) {
|
||||
setL("2");
|
||||
} else {
|
||||
setL("0");
|
||||
}
|
||||
}
|
||||
|
||||
public String getF() {
|
||||
return (this.f == null) ? "" : this.f.trim();
|
||||
}
|
||||
|
||||
public void setF(String f) {
|
||||
this.f = f;
|
||||
}
|
||||
|
||||
public String getL() {
|
||||
return (this.l == null) ? "" : this.l.trim();
|
||||
}
|
||||
|
||||
public void setL(String l) {
|
||||
this.l = l;
|
||||
}
|
||||
|
||||
public String getM() {
|
||||
return (this.m == null) ? "" : this.m.trim();
|
||||
}
|
||||
|
||||
public void setM(String m) {
|
||||
this.m = m;
|
||||
}
|
||||
|
||||
public String getO() {
|
||||
return (this.o == null) ? "" : this.o.trim();
|
||||
}
|
||||
|
||||
public void setO(String o) {
|
||||
this.o = o;
|
||||
}
|
||||
|
||||
public String getI() {
|
||||
return (this.i == null) ? "" : this.i.trim();
|
||||
}
|
||||
|
||||
public void setI(String i) {
|
||||
this.i = i;
|
||||
}
|
||||
|
||||
public String getD() {
|
||||
return (this.d == null) ? "" : this.d.trim();
|
||||
}
|
||||
|
||||
public void setD(String d) {
|
||||
this.d = d;
|
||||
}
|
||||
|
||||
public String getP() {
|
||||
return (this.p == null) ? "" : this.p.trim();
|
||||
}
|
||||
|
||||
public void setP(String p) {
|
||||
this.p = p;
|
||||
}
|
||||
|
||||
public String getC() {
|
||||
return (this.c == null) ? "" : this.c.trim();
|
||||
}
|
||||
|
||||
public void setC(String c) {
|
||||
this.c = c;
|
||||
}
|
||||
|
||||
public String getU() {
|
||||
return (this.u == null) ? "" : this.u.trim();
|
||||
}
|
||||
|
||||
public void setU(String u) {
|
||||
this.u = u;
|
||||
}
|
||||
|
||||
public String getN() {
|
||||
return (this.n == null) ? "" : this.n.trim();
|
||||
}
|
||||
|
||||
public void setN(String n) {
|
||||
this.n = n;
|
||||
}
|
||||
|
||||
public String getE() {
|
||||
return (this.e == null) ? "" : this.e.trim();
|
||||
}
|
||||
|
||||
public void setE(String e) {
|
||||
this.e = e;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return (this.action == null) ? "https://ecommerce.infogroup.it/shopnetplus/do" : this.action.trim();
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public void setImporto(double l_importo) {}
|
||||
|
||||
public NumberFormat getNf2() {
|
||||
if (nf2 == null) {
|
||||
nf2 = NumberFormat.getInstance(Locale.ITALIAN);
|
||||
nf2.setMaximumFractionDigits(2);
|
||||
nf2.setMinimumFractionDigits(2);
|
||||
}
|
||||
return nf2;
|
||||
}
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
if (ap != null) {
|
||||
DBAdapter.logDebug(true, "shopnet chechout initParms: start");
|
||||
String l_tipoParm = "SHOPNET";
|
||||
StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm);
|
||||
Parm bean = new Parm(ap);
|
||||
l_tipoParm = "SHOPNET";
|
||||
bean.findByCodice("PAY_KO");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAY_KO");
|
||||
bean.setDescrizione("PAY_KO");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payRes.jsp");
|
||||
bean.setNota("PAY_KO");
|
||||
bean.save();
|
||||
bean.findByCodice("PAY_OK");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAY_OK");
|
||||
bean.setDescrizione("PAY_OK");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payRes.jsp");
|
||||
bean.setNota("PAY_OK");
|
||||
bean.save();
|
||||
bean.findByCodice("SHOPNET_ID");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("SHOPNET_ID");
|
||||
bean.setDescrizione("SHOPNET_ID");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("SHOPNET_ID");
|
||||
bean.save();
|
||||
bean.findByCodice("SHOPNET_PID");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("SHOPNET_PID");
|
||||
bean.setDescrizione("SHOPNET_PID");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("SHOPNET_PID");
|
||||
bean.save();
|
||||
DBAdapter.logDebug(true, "shopnet chechout initParms: stop");
|
||||
}
|
||||
}
|
||||
|
||||
public static final String getCC(long l_cc) {
|
||||
switch ((int)l_cc) {
|
||||
case 3:
|
||||
return "American Express";
|
||||
case 2:
|
||||
return "Diners";
|
||||
case 1:
|
||||
return "Mastercard";
|
||||
case 0:
|
||||
return "Visa";
|
||||
}
|
||||
return "??";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
package it.acxent.bank.infogroup;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
|
||||
public class ShopnetResp extends _BankAdapter {
|
||||
private long m;
|
||||
|
||||
private long o;
|
||||
|
||||
private long l;
|
||||
|
||||
private String a;
|
||||
|
||||
private long s;
|
||||
|
||||
private long id_ordine;
|
||||
|
||||
public static final long STATO_TRANS_NON_RICH = 1L;
|
||||
|
||||
public static final long STATO_TRANS_GESTITA = 2L;
|
||||
|
||||
public void fillResponse(String bean) {}
|
||||
|
||||
public long getId_ordine() {
|
||||
return this.id_ordine;
|
||||
}
|
||||
|
||||
public String getA() {
|
||||
return (this.a == null) ? "" : this.a.trim();
|
||||
}
|
||||
|
||||
public void setA(String a) {
|
||||
this.a = a;
|
||||
}
|
||||
|
||||
public long getM() {
|
||||
return this.m;
|
||||
}
|
||||
|
||||
public void setM(long m) {
|
||||
this.m = m;
|
||||
}
|
||||
|
||||
public long getO() {
|
||||
return this.o;
|
||||
}
|
||||
|
||||
public void setO(long o) {
|
||||
this.o = o;
|
||||
}
|
||||
|
||||
public long getL() {
|
||||
return this.l;
|
||||
}
|
||||
|
||||
public void setL(long l) {
|
||||
this.l = l;
|
||||
}
|
||||
|
||||
public long getS() {
|
||||
return this.s;
|
||||
}
|
||||
|
||||
public void setS(long s) {
|
||||
this.s = s;
|
||||
}
|
||||
|
||||
public long getStato() {
|
||||
return getS();
|
||||
}
|
||||
|
||||
public String getCodiceAutorizzazione() {
|
||||
return getA();
|
||||
}
|
||||
|
||||
public void setId_ordine(long id_ordine) {
|
||||
this.id_ordine = id_ordine;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,346 @@
|
|||
package it.acxent.bank.keyclient;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
import it.acxent.common.Parm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.reg.EcDc;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
public class KeyClientReq extends _BankAdapter {
|
||||
public static final String LANG_CODE_IT = "ITA";
|
||||
|
||||
public static final String LANG_CODE_EN = "ENG";
|
||||
|
||||
public static final String LANG_CODE_ES = "SPA";
|
||||
|
||||
public static final String LANG_CODE_FR = "FRA";
|
||||
|
||||
public static final String LANG_CODE_DE = "GER";
|
||||
|
||||
public static final String LANG_CODE_ITA_ENG = "ITA-ENG";
|
||||
|
||||
public static final String LANG_CODE_JPN = "JPN";
|
||||
|
||||
public static final String DIV_CODE_LIRA = "18";
|
||||
|
||||
public static final String DIV_CODE_EURO = "242";
|
||||
|
||||
public static final String DIV_CODE_STERLINE = "2";
|
||||
|
||||
public static final String DIV_CODE_YEN = "71";
|
||||
|
||||
public static final String DIV_CODE_DOLLARL_HK = "103";
|
||||
|
||||
public static final String DIV_CODE_REAL = "234";
|
||||
|
||||
private String divisa;
|
||||
|
||||
private String codTrans;
|
||||
|
||||
private String mail;
|
||||
|
||||
private String importo;
|
||||
|
||||
private String languageId;
|
||||
|
||||
private String alias;
|
||||
|
||||
private String key;
|
||||
|
||||
private String url;
|
||||
|
||||
private String url_back;
|
||||
|
||||
public static final String P_KC_KEY = "KC_KEY";
|
||||
|
||||
public static final String P_URL_RESPONSE = "KC_URL_RESPONSE";
|
||||
|
||||
public static final String P_KC_ALIAS = "KC_ALIAS";
|
||||
|
||||
public static final String P_PAYMENT_OK_PAGE = "KC_PAY_OK";
|
||||
|
||||
public static final String P_PAYMENT_ERROR_PAGE = "KC_PAY_KO";
|
||||
|
||||
public static final String P_URL_RESPONSE_NULL = "KC_URL_RESPONSE_NULL";
|
||||
|
||||
public static final String TEST_ALIAS = "payment_testm_urlmac";
|
||||
|
||||
public static final String REQ_URL = "https://ecommerce.cim-italia.it/ecomm/DispatcherServlet";
|
||||
|
||||
public static final String DIV_CODE_DOLLARI = "1";
|
||||
|
||||
public String getCodTrans() {
|
||||
return (this.codTrans == null) ? "" : this.codTrans;
|
||||
}
|
||||
|
||||
public void setCodTrans(String myamount) {
|
||||
this.codTrans = myamount;
|
||||
}
|
||||
|
||||
public String getImporto() {
|
||||
return (this.importo == null) ? "" : this.importo;
|
||||
}
|
||||
|
||||
public void setImporto(String mybuyeremail) {
|
||||
this.importo = mybuyeremail;
|
||||
}
|
||||
|
||||
public String getMail() {
|
||||
return (this.mail == null) ? "" : this.mail;
|
||||
}
|
||||
|
||||
public void setMail(String mybuyername) {
|
||||
this.mail = mybuyername;
|
||||
}
|
||||
|
||||
public String getDivisa() {
|
||||
return (this.divisa == null) ? "" : this.divisa;
|
||||
}
|
||||
|
||||
public void setDivisa(String mycurrency) {
|
||||
this.divisa = mycurrency;
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return (this.alias == null) ? "" : this.alias;
|
||||
}
|
||||
|
||||
public void setAlias(String mycustominfo) {
|
||||
this.alias = mycustominfo;
|
||||
}
|
||||
|
||||
private String getMylanguageCode() {
|
||||
if (getLanguageId().toLowerCase().equals("it"))
|
||||
return "ITA";
|
||||
if (getLanguageId().toLowerCase().equals("en"))
|
||||
return "ENG";
|
||||
if (getLanguageId().toLowerCase().equals("es\t"))
|
||||
return "SPA";
|
||||
if (getLanguageId().toLowerCase().equals("fr"))
|
||||
return "FRA";
|
||||
if (getLanguageId().toLowerCase().equals("de"))
|
||||
return "GER";
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getMacEsempio() {
|
||||
String temp = "codTrans=" + getCodTrans() + "divisa=" + getDivisa() + "importo=1esempiodicalcolomac";
|
||||
String res = "";
|
||||
try {
|
||||
res = URLEncoder.encode(EcDc.encode64String(EcDc.cryptMD5Plain(temp)), "UTF-8");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public String getMac() {
|
||||
String temp = "codTrans=" + getCodTrans() + "divisa=" + getDivisa() + "importo=" +
|
||||
getImportoUrl() + getKey();
|
||||
String res = "";
|
||||
try {
|
||||
res = URLEncoder.encode(EcDc.encode64String(EcDc.cryptMD5Plain(temp)), "UTF-8");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public String getLanguageId() {
|
||||
return (this.languageId == null) ? "" : this.languageId;
|
||||
}
|
||||
|
||||
public void setLanguageId(String lang) {
|
||||
this.languageId = lang;
|
||||
}
|
||||
|
||||
public String getFullRequestUrl() {
|
||||
StringBuffer theUrl = new StringBuffer("https://ecommerce.cim-italia.it/ecomm/DispatcherServlet");
|
||||
theUrl.append("alias=");
|
||||
theUrl.append(getAlias());
|
||||
theUrl.append("&importo=");
|
||||
theUrl.append(getImporto());
|
||||
theUrl.append("&divisa=");
|
||||
theUrl.append(getDivisa());
|
||||
theUrl.append("&codTrans=");
|
||||
theUrl.append(getCodTrans());
|
||||
theUrl.append("&mail=");
|
||||
theUrl.append(getMail());
|
||||
theUrl.append("&mac=");
|
||||
try {
|
||||
theUrl.append(URLEncoder.encode(getMac(), "UTF-8"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
theUrl.append("&languageId=");
|
||||
theUrl.append(getLanguageId());
|
||||
theUrl.append("&url=");
|
||||
theUrl.append(getUrl());
|
||||
if (!getUrl_back().isEmpty()) {
|
||||
theUrl.append("&url_back=");
|
||||
theUrl.append(getUrl_back());
|
||||
}
|
||||
return theUrl.toString();
|
||||
}
|
||||
|
||||
public String getRequestUrl() {
|
||||
StringBuffer theUrl = new StringBuffer("https://ecommerce.cim-italia.it/ecomm/DispatcherServlet");
|
||||
theUrl.append("?alias=");
|
||||
theUrl.append(getAlias());
|
||||
theUrl.append("&importo=");
|
||||
theUrl.append(getImportoUrl());
|
||||
theUrl.append("&divisa=");
|
||||
theUrl.append(getDivisa());
|
||||
theUrl.append("&codTrans=");
|
||||
theUrl.append(getCodTrans());
|
||||
theUrl.append("&mail=");
|
||||
theUrl.append(getMail());
|
||||
theUrl.append("&mac=");
|
||||
try {
|
||||
theUrl.append(URLEncoder.encode(getMac(), "UTF-8"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
theUrl.append("&languageId=");
|
||||
theUrl.append(getLanguageId());
|
||||
theUrl.append("&url=");
|
||||
theUrl.append(getUrl());
|
||||
if (!getUrl_back().isEmpty()) {
|
||||
theUrl.append("&url_back=");
|
||||
theUrl.append(getUrl_back());
|
||||
}
|
||||
return theUrl.toString();
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getImportoUrl() {
|
||||
if (this.importo == null)
|
||||
return "0000";
|
||||
String temp = this.importo;
|
||||
if (temp.indexOf('.') < 0) {
|
||||
temp = temp + "00";
|
||||
} else if (temp.length() - temp.indexOf('.') < 3) {
|
||||
temp = temp + "0";
|
||||
}
|
||||
return temp.replace(".", "");
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return (this.url == null) ? "" : this.url.trim();
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getUrl_back() {
|
||||
return (this.url_back == null) ? "" : this.url_back.trim();
|
||||
}
|
||||
|
||||
public void setUrl_back(String url_back) {
|
||||
this.url_back = url_back;
|
||||
}
|
||||
|
||||
public String getTestRequestUrl() {
|
||||
StringBuffer theUrl = new StringBuffer("https://ecommerce.cim-italia.it/ecomm/DispatcherServlet");
|
||||
theUrl.append("?alias=");
|
||||
theUrl.append("payment_testm_urlmac");
|
||||
theUrl.append("&importo=1");
|
||||
theUrl.append("&divisa=");
|
||||
theUrl.append(getDivisa());
|
||||
theUrl.append("&codTrans=");
|
||||
theUrl.append(getCodTrans());
|
||||
theUrl.append("&mail=");
|
||||
theUrl.append(getMail());
|
||||
theUrl.append("&mac=");
|
||||
try {
|
||||
theUrl.append(URLEncoder.encode(getMacEsempio(), "UTF-8"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
theUrl.append("&languageId=");
|
||||
theUrl.append(getLanguageId());
|
||||
theUrl.append("&url=");
|
||||
theUrl.append(getUrl());
|
||||
if (!getUrl_back().isEmpty()) {
|
||||
theUrl.append("&url_back=");
|
||||
theUrl.append(getUrl_back());
|
||||
}
|
||||
return theUrl.toString();
|
||||
}
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
if (ap != null) {
|
||||
String l_tipoParm = "PAYPAL";
|
||||
Parm bean = new Parm(ap);
|
||||
l_tipoParm = "KEY CLIENT";
|
||||
bean.findByCodice("KC_PAY_KO");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("KC_PAY_KO");
|
||||
bean.setDescrizione("KC_PAY_KO");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payRes.jsp");
|
||||
bean.setNota("KC_PAY_KO");
|
||||
bean.save();
|
||||
bean.findByCodice("KC_PAY_OK");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("KC_PAY_OK");
|
||||
bean.setDescrizione("KC_PAY_OK");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payRes.jsp");
|
||||
bean.setNota("KC_PAY_OK");
|
||||
bean.save();
|
||||
bean.findByCodice("KC_KEY");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("KC_KEY");
|
||||
bean.setDescrizione("KC_KEY");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("esempiodicalcolomac");
|
||||
bean.setNota("KC_KEY. mac di esempio: esempiodicalcolomac");
|
||||
bean.save();
|
||||
bean.findByCodice("KC_ALIAS");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("KC_ALIAS");
|
||||
bean.setDescrizione("KC_ALIAS");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payment_testm_urlmac");
|
||||
bean.setNota("KC_KEY. ALIAS DI TEST: payment_testm_urlmac");
|
||||
bean.save();
|
||||
bean.findByCodice("KC_URL_RESPONSE_NULL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("KC_URL_RESPONSE_NULL");
|
||||
bean.setDescrizione("KC_URL_RESPONSE_NULL");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://localhost/td/RicevutaKC.abl");
|
||||
bean.setNota("KC_PAY_OK");
|
||||
bean.save();
|
||||
bean.findByCodice("KC_URL_RESPONSE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("KC_URL_RESPONSE");
|
||||
bean.setDescrizione("KC_URL_RESPONSE");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://localhost/td/RicevutaKC.abl");
|
||||
bean.setNota("KC_URL_RESPONSE");
|
||||
bean.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
package it.acxent.bank.keyclient;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
|
||||
public class KeyClientResp extends _BankAdapter {
|
||||
private long id_ordine;
|
||||
|
||||
private String importo;
|
||||
|
||||
private String data;
|
||||
|
||||
private String divisa;
|
||||
|
||||
private String session_id;
|
||||
|
||||
private String codTrans;
|
||||
|
||||
private String orario;
|
||||
|
||||
private String esito;
|
||||
|
||||
private String codAut;
|
||||
|
||||
private String BRAND;
|
||||
|
||||
private String nome;
|
||||
|
||||
private String cognome;
|
||||
|
||||
private String email;
|
||||
|
||||
private String mac;
|
||||
|
||||
public static final String ESITO_OK = "OK";
|
||||
|
||||
public static final String ESITO_KO = "KO";
|
||||
|
||||
public long getId_ordine() {
|
||||
return this.id_ordine;
|
||||
}
|
||||
|
||||
public void setId_ordine(long id_ordine) {
|
||||
this.id_ordine = id_ordine;
|
||||
}
|
||||
|
||||
public String getImporto() {
|
||||
return this.importo;
|
||||
}
|
||||
|
||||
public void setImporto(String importo) {
|
||||
this.importo = importo;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public String getDivisa() {
|
||||
return this.divisa;
|
||||
}
|
||||
|
||||
public void setDivisa(String divisa) {
|
||||
this.divisa = divisa;
|
||||
}
|
||||
|
||||
public String getSession_id() {
|
||||
return this.session_id;
|
||||
}
|
||||
|
||||
public void setSession_id(String session_id) {
|
||||
this.session_id = session_id;
|
||||
}
|
||||
|
||||
public String getCodTrans() {
|
||||
return this.codTrans;
|
||||
}
|
||||
|
||||
public void setCodTrans(String codTrans) {
|
||||
this.codTrans = codTrans;
|
||||
}
|
||||
|
||||
public String getOrario() {
|
||||
return this.orario;
|
||||
}
|
||||
|
||||
public void setOrario(String orario) {
|
||||
this.orario = orario;
|
||||
}
|
||||
|
||||
public String getEsito() {
|
||||
return this.esito;
|
||||
}
|
||||
|
||||
public void setEsito(String esito) {
|
||||
this.esito = esito;
|
||||
}
|
||||
|
||||
public String getCodAut() {
|
||||
return this.codAut;
|
||||
}
|
||||
|
||||
public void setCodAut(String codAut) {
|
||||
this.codAut = codAut;
|
||||
}
|
||||
|
||||
public String getBRAND() {
|
||||
return this.BRAND;
|
||||
}
|
||||
|
||||
public void setBRAND(String brand) {
|
||||
this.BRAND = brand;
|
||||
}
|
||||
|
||||
public String getNome() {
|
||||
return this.nome;
|
||||
}
|
||||
|
||||
public void setNome(String nome) {
|
||||
this.nome = nome;
|
||||
}
|
||||
|
||||
public String getCognome() {
|
||||
return this.cognome;
|
||||
}
|
||||
|
||||
public void setCognome(String cognome) {
|
||||
this.cognome = cognome;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return this.email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getMac() {
|
||||
return this.mac;
|
||||
}
|
||||
|
||||
public void setMac(String mac) {
|
||||
this.mac = mac;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,292 @@
|
|||
package it.acxent.bank.paypal;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
import it.acxent.common.Parm;
|
||||
import it.acxent.common.StatusMsg;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
public class PayPalReq extends _BankAdapter {
|
||||
private static final long serialVersionUID = -3355707562295063479L;
|
||||
|
||||
public static final String MTH_SET_EXPRESS_CHECKOUT = "SetExpressCheckout";
|
||||
|
||||
private double amt;
|
||||
|
||||
private long id_ordine;
|
||||
|
||||
private String cancelURL;
|
||||
|
||||
private String returnUrl;
|
||||
|
||||
private String TOKEN;
|
||||
|
||||
private String PAYERID;
|
||||
|
||||
private String SHIPTOCITY;
|
||||
|
||||
private String SHIPTOCOUNTRYCODE;
|
||||
|
||||
private String SHIPTONAME;
|
||||
|
||||
private String SHIPTOSTATE;
|
||||
|
||||
private String SHIPTOSTREET;
|
||||
|
||||
private String SHIPTOZIP;
|
||||
|
||||
private String DESC;
|
||||
|
||||
public static final String P_API_PASSWORD = "PAYPAL_API_PWD";
|
||||
|
||||
public static final String P_API_SIGNATURE = "PAYPAL_API_SIGNATURE";
|
||||
|
||||
public static final String P_API_USE_CERTIFICATE = "PAYPAL_USE_CERTIFICATE";
|
||||
|
||||
public static final String P_API_USERNAME = "PAYPAL_API_USERNAME";
|
||||
|
||||
public static final String P_CANCEL_URL = "PAYPAL_CANCELURL";
|
||||
|
||||
public static final String P_CURRENCY = "PAYPAL_CURRENCY";
|
||||
|
||||
public static final String P_PAGE_STYLE = "PAYPAL_PAGE_STYLE";
|
||||
|
||||
public static final String P_PAYMENT_DETAIL_PAGE = "PAYPAL_DETAIL";
|
||||
|
||||
public static final String P_PAYMENT_ERROR_PAGE = "PAY_PAL_KO";
|
||||
|
||||
public static final String P_PAYMENT_OK_PAGE = "PAYPAL_OK";
|
||||
|
||||
public static final String P_RETURN_URL = "PAYPAL_RETURNURL";
|
||||
|
||||
public static final String MTH_GET_EXPRESS_CHECKOUT_DETAIL = "GetExpressCheckoutDetails";
|
||||
|
||||
public static final String MTH_DO_EXPRESS_CHECKOUT_PAYMENT = "DoExpressCheckoutPayment";
|
||||
|
||||
public static final String CMD_ADDROVERRIDE = "ADDROVVERRIDE=1";
|
||||
|
||||
public static final String CMD_PAGESTILE = "PAGESTYLE";
|
||||
|
||||
public static final String CMD_PAYACT_AUTH = "PAYMENTACTION=Authorization";
|
||||
|
||||
public double getAmt() {
|
||||
return this.amt;
|
||||
}
|
||||
|
||||
public void setAmt(double amt) {
|
||||
this.amt = amt;
|
||||
}
|
||||
|
||||
public String getCancelURL() {
|
||||
return (this.cancelURL == null) ? "" : this.cancelURL;
|
||||
}
|
||||
|
||||
public void setCancelURL(String cancelURL) {
|
||||
this.cancelURL = cancelURL;
|
||||
}
|
||||
|
||||
public String getReturnUrl() {
|
||||
return (this.returnUrl == null) ? "" : this.returnUrl;
|
||||
}
|
||||
|
||||
public void setReturnUrl(String returnUrl) {
|
||||
this.returnUrl = returnUrl;
|
||||
}
|
||||
|
||||
public String getTOKEN() {
|
||||
return (this.TOKEN == null) ? "" : this.TOKEN;
|
||||
}
|
||||
|
||||
public void setTOKEN(String token) {
|
||||
this.TOKEN = token;
|
||||
}
|
||||
|
||||
public String getPAYERID() {
|
||||
return this.PAYERID;
|
||||
}
|
||||
|
||||
public void setPAYERID(String payerid) {
|
||||
this.PAYERID = payerid;
|
||||
}
|
||||
|
||||
public String getSHIPTOCITY() {
|
||||
return (this.SHIPTOCITY == null) ? "" : this.SHIPTOCITY;
|
||||
}
|
||||
|
||||
public String getSHIPTOCOUNTRYCODE() {
|
||||
return (this.SHIPTOCOUNTRYCODE == null) ? "" : this.SHIPTOCOUNTRYCODE;
|
||||
}
|
||||
|
||||
public String getSHIPTONAME() {
|
||||
return (this.SHIPTONAME == null) ? "" : this.SHIPTONAME;
|
||||
}
|
||||
|
||||
public String getSHIPTOSTATE() {
|
||||
return (this.SHIPTOSTATE == null) ? "" : this.SHIPTOSTATE;
|
||||
}
|
||||
|
||||
public String getSHIPTOSTREET() {
|
||||
return (this.SHIPTOSTREET == null) ? "" : this.SHIPTOSTREET;
|
||||
}
|
||||
|
||||
public String getSHIPTOZIP() {
|
||||
return (this.SHIPTOZIP == null) ? "" : this.SHIPTOZIP;
|
||||
}
|
||||
|
||||
public long getId_ordine() {
|
||||
return this.id_ordine;
|
||||
}
|
||||
|
||||
public void setId_ordine(long id_ordine) {
|
||||
this.id_ordine = id_ordine;
|
||||
}
|
||||
|
||||
public String getShippingAddressString() {
|
||||
return "SHIPTONAME=" + URLEncoder.encode(getSHIPTONAME()) + "&DESC=" + URLEncoder.encode(getDESC()) + "&SHIPTOSTREET=" +
|
||||
URLEncoder.encode(getSHIPTOSTREET()) + "&SHIPTOCITY=" + URLEncoder.encode(getSHIPTOCITY()) + "&SHIPTOSTATE=" +
|
||||
URLEncoder.encode(getSHIPTOSTATE()) + "&SHIPTOCOUNTRYCODE=" + URLEncoder.encode(getSHIPTOCOUNTRYCODE()) + "&SHIPTOZIP=" +
|
||||
URLEncoder.encode(getSHIPTOZIP()) + "&ADDROVERRIDE=1";
|
||||
}
|
||||
|
||||
public void setSHIPTOCITY(String shiptocity) {
|
||||
this.SHIPTOCITY = shiptocity;
|
||||
}
|
||||
|
||||
public void setSHIPTOCOUNTRYCODE(String shiptocountrycode) {
|
||||
this.SHIPTOCOUNTRYCODE = shiptocountrycode;
|
||||
}
|
||||
|
||||
public void setSHIPTONAME(String shiptoname) {
|
||||
this.SHIPTONAME = shiptoname;
|
||||
}
|
||||
|
||||
public void setSHIPTOSTATE(String shiptostate) {
|
||||
this.SHIPTOSTATE = shiptostate;
|
||||
}
|
||||
|
||||
public void setSHIPTOSTREET(String shiptostreet) {
|
||||
this.SHIPTOSTREET = shiptostreet;
|
||||
}
|
||||
|
||||
public void setSHIPTOZIP(String shiptozip) {
|
||||
this.SHIPTOZIP = shiptozip;
|
||||
}
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
boolean debug = true;
|
||||
if (ap != null) {
|
||||
DBAdapter.logDebug(debug, "Paypal initParms: start");
|
||||
String l_tipoParm = "PAYPAL";
|
||||
Parm bean = new Parm(ap);
|
||||
StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm);
|
||||
l_tipoParm = "PAYPAL";
|
||||
bean.findByCodice("PAYPAL_API_PWD");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_API_PWD");
|
||||
bean.setDescrizione("PAYPAL_API_PWD");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("PAYPAL_API_PWD");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_API_SIGNATURE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_API_SIGNATURE");
|
||||
bean.setDescrizione("PAYPAL_API_SIGNATURE");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("PAYPAL_API_SIGNATURE");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_USE_CERTIFICATE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_USE_CERTIFICATE");
|
||||
bean.setDescrizione("PAYPAL_USE_CERTIFICATE");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("PAYPAL_USE_CERTIFICATE");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_API_USERNAME");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_API_USERNAME");
|
||||
bean.setDescrizione("PAYPAL_API_USERNAME");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("PAYPAL_API_USERNAME");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_CANCELURL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_CANCELURL");
|
||||
bean.setDescrizione("PAYPAL_CANCELURL");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("PAYPAL_CANCELURL");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_CURRENCY");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_CURRENCY");
|
||||
bean.setDescrizione("PAYPAL_CURRENCY");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("EUR");
|
||||
bean.setNota("PAYPAL_CURRENCY");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_PAGE_STYLE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_PAGE_STYLE");
|
||||
bean.setDescrizione("PAYPAL_PAGE_STYLE");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("PAYPAL_PAGE_STYLE");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_DETAIL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_DETAIL");
|
||||
bean.setDescrizione("PAYPAL_DETAIL");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payPalRes.jsp");
|
||||
bean.setNota("PAYPAL_DETAIL");
|
||||
bean.save();
|
||||
bean.findByCodice("PAY_PAL_KO");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAY_PAL_KO");
|
||||
bean.setDescrizione("PAY_PAL_KO");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payPalRes.jsp");
|
||||
bean.setNota("PAY_PAL_KO");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_OK");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_OK");
|
||||
bean.setDescrizione("PAYPAL_OK");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payPalRes.jsp");
|
||||
bean.setNota("PAYPAL_OK");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_RETURNURL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_RETURNURL");
|
||||
bean.setDescrizione("PAYPAL_RETURNURL");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("PAYPAL_RETURNURL");
|
||||
bean.save();
|
||||
DBAdapter.logDebug(debug, "Paypal initParms: stop");
|
||||
StatusMsg.deleteMsgByTag(ap, "INIT");
|
||||
}
|
||||
}
|
||||
|
||||
public String getDESC() {
|
||||
return (this.DESC == null) ? "" : this.DESC.trim();
|
||||
}
|
||||
|
||||
public void setDESC(String dESC) {
|
||||
this.DESC = dESC;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,363 @@
|
|||
package it.acxent.bank.paypal;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
import java.io.BufferedReader;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
public class PayPalResp extends _BankAdapter {
|
||||
public static final String SESS_TOKEN = "_SESS_TOKEN";
|
||||
|
||||
private String ACK;
|
||||
|
||||
private String TIMESTAMP;
|
||||
|
||||
private String VERSION;
|
||||
|
||||
private String L_ERRORCODE0;
|
||||
|
||||
private String L_SHORTMESSAGE0;
|
||||
|
||||
private String L_SEVERITYCODE0;
|
||||
|
||||
private String L_LONGMESSAGE0;
|
||||
|
||||
private String CORRELATIONID;
|
||||
|
||||
private String BUILD;
|
||||
|
||||
private String AMT;
|
||||
|
||||
private String EMAIL;
|
||||
|
||||
private String PAYERID;
|
||||
|
||||
private String PAYERSTATUS;
|
||||
|
||||
private String FIRSTNAME;
|
||||
|
||||
private String LASTNAME;
|
||||
|
||||
private String SHIPTOSTREET;
|
||||
|
||||
private String COUNTRYCODE;
|
||||
|
||||
private String SHIPTOCITY;
|
||||
|
||||
private String SHIPTOSTATE;
|
||||
|
||||
private String SHIPTOCOUNTRYCODE;
|
||||
|
||||
private String SHIPTOZIP;
|
||||
|
||||
private String ADDRESSID;
|
||||
|
||||
private String ADDRESSSTATUS;
|
||||
|
||||
private String SHIPTONAME;
|
||||
|
||||
private String TRANSACTIONID;
|
||||
|
||||
private String TOKEN;
|
||||
|
||||
private long id_ordine;
|
||||
|
||||
private boolean paymentDone = false;
|
||||
|
||||
private boolean detailBuyer = false;
|
||||
|
||||
public static final String SESS_ID_ORDER = "_SESS_ID_ORDER";
|
||||
|
||||
public String getACK() {
|
||||
return (this.ACK == null) ? "" : this.ACK;
|
||||
}
|
||||
|
||||
public void setACK(String ack) {
|
||||
this.ACK = ack;
|
||||
}
|
||||
|
||||
public String getBUILD() {
|
||||
return (this.BUILD == null) ? "" : this.BUILD;
|
||||
}
|
||||
|
||||
public void setBUILD(String build) {
|
||||
this.BUILD = build;
|
||||
}
|
||||
|
||||
public String getCORRELATIONID() {
|
||||
return (this.CORRELATIONID == null) ? "" :
|
||||
this.CORRELATIONID;
|
||||
}
|
||||
|
||||
public void setCORRELATIONID(String correlationid) {
|
||||
this.CORRELATIONID = correlationid;
|
||||
}
|
||||
|
||||
public String getTIMESTAMP() {
|
||||
return (this.TIMESTAMP == null) ? "" : this.TIMESTAMP;
|
||||
}
|
||||
|
||||
public void setTIMESTAMP(String timestamp) {
|
||||
this.TIMESTAMP = timestamp;
|
||||
}
|
||||
|
||||
public String getVERSION() {
|
||||
return (this.VERSION == null) ? "" : this.VERSION;
|
||||
}
|
||||
|
||||
public void setVERSION(String version) {
|
||||
this.VERSION = version;
|
||||
}
|
||||
|
||||
public String getL_ERRORCODE0() {
|
||||
return (this.L_ERRORCODE0 == null) ? "" : this.L_ERRORCODE0;
|
||||
}
|
||||
|
||||
public void setL_ERRORCODE0(String l_errorcode0) {
|
||||
this.L_ERRORCODE0 = l_errorcode0;
|
||||
}
|
||||
|
||||
public String getL_LONGMESSAGE0() {
|
||||
return (this.L_LONGMESSAGE0 == null) ? "" :
|
||||
this.L_LONGMESSAGE0;
|
||||
}
|
||||
|
||||
public void setL_LONGMESSAGE0(String l_longmessage0) {
|
||||
this.L_LONGMESSAGE0 = l_longmessage0;
|
||||
}
|
||||
|
||||
public String getL_SEVERITYCODE0() {
|
||||
return (this.L_SEVERITYCODE0 == null) ? "" :
|
||||
this.L_SEVERITYCODE0;
|
||||
}
|
||||
|
||||
public void setL_SEVERITYCODE0(String l_severitycode0) {
|
||||
this.L_SEVERITYCODE0 = l_severitycode0;
|
||||
}
|
||||
|
||||
public String getL_SHORTMESSAGE0() {
|
||||
return (this.L_SHORTMESSAGE0 == null) ? "" :
|
||||
this.L_SHORTMESSAGE0;
|
||||
}
|
||||
|
||||
public void setL_SHORTMESSAGE0(String l_shortmessage0) {
|
||||
this.L_SHORTMESSAGE0 = l_shortmessage0;
|
||||
}
|
||||
|
||||
public String getTOKEN() {
|
||||
return (this.TOKEN == null) ? "" : this.TOKEN;
|
||||
}
|
||||
|
||||
public void setTOKEN(String token) {
|
||||
this.TOKEN = token;
|
||||
}
|
||||
|
||||
public String getADDRESSID() {
|
||||
return this.ADDRESSID;
|
||||
}
|
||||
|
||||
public void setADDRESSID(String addressid) {
|
||||
this.ADDRESSID = addressid;
|
||||
}
|
||||
|
||||
public String getADDRESSSTATUS() {
|
||||
return this.ADDRESSSTATUS;
|
||||
}
|
||||
|
||||
public void setADDRESSSTATUS(String addressstatus) {
|
||||
this.ADDRESSSTATUS = addressstatus;
|
||||
}
|
||||
|
||||
public String getCOUNTRYCODE() {
|
||||
return this.COUNTRYCODE;
|
||||
}
|
||||
|
||||
public boolean isResponseOk() {
|
||||
return getACK().equals("Success");
|
||||
}
|
||||
|
||||
public void setCOUNTRYCODE(String countrycode) {
|
||||
this.COUNTRYCODE = countrycode;
|
||||
}
|
||||
|
||||
public String getEMAIL() {
|
||||
return this.EMAIL;
|
||||
}
|
||||
|
||||
public void setEMAIL(String email) {
|
||||
this.EMAIL = email;
|
||||
}
|
||||
|
||||
public String getFIRSTNAME() {
|
||||
return this.FIRSTNAME;
|
||||
}
|
||||
|
||||
public void fillResponse(BufferedReader reader) {
|
||||
try {
|
||||
String response = URLDecoder.decode(reader.readLine());
|
||||
setACK("Success");
|
||||
setL_LONGMESSAGE0(response);
|
||||
setAMT(getAttribute(response, "AMT"));
|
||||
setACK(getAttribute(response, "ACK"));
|
||||
setTOKEN(getAttribute(response, "TOKEN"));
|
||||
setADDRESSID(getAttribute(response, "ADDRESSID"));
|
||||
setADDRESSSTATUS(getAttribute(response, "ADDRESSSTATUS"));
|
||||
setBUILD(getAttribute(response, "BUILD"));
|
||||
setCORRELATIONID(getAttribute(response, "CORRELATIONID"));
|
||||
setCOUNTRYCODE(getAttribute(response, "COUNTRYCODE"));
|
||||
setEMAIL(getAttribute(response, "EMAIL"));
|
||||
setFIRSTNAME(getAttribute(response, "FIRSTNAME"));
|
||||
setL_ERRORCODE0(getAttribute(response, "L_ERRORCODE0"));
|
||||
setL_LONGMESSAGE0(getAttribute(response, "L_LONGMESSAGE0"));
|
||||
setL_SEVERITYCODE0(getAttribute(response, "L_SEVERITCODE0"));
|
||||
setLASTNAME(getAttribute(response, "LASTNAME"));
|
||||
setPAYERID(getAttribute(response, "PAYERID"));
|
||||
setPAYERSTATUS(getAttribute(response, "PAYERSTATUS"));
|
||||
setSHIPTOCITY(getAttribute(response, "SHIPTOCITY"));
|
||||
setSHIPTOCOUNTRYCODE(getAttribute(response, "SHIPTOCOUNTRYCODE"));
|
||||
setSHIPTONAME(getAttribute(response, "SHIPTONAME"));
|
||||
setSHIPTOSTREET(getAttribute(response, "SHIPTOSTREET"));
|
||||
setSHIPTOSTATE(getAttribute(response, "SHIPTOSTATE"));
|
||||
setSHIPTOZIP(getAttribute(response, "SHIPTOZIP"));
|
||||
setTIMESTAMP(getAttribute(response, "TIMESTAMP"));
|
||||
setVERSION(getAttribute(response, "VERSION"));
|
||||
setTRANSACTIONID(getAttribute(response, "TRANSACTIONID"));
|
||||
} catch (Exception e) {
|
||||
setACK("Error");
|
||||
setL_LONGMESSAGE0(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private String getAttribute(String response, String key) {
|
||||
try {
|
||||
if (response.indexOf(key) >= 0) {
|
||||
int idxStart = response.indexOf(key) + key.length() + 1;
|
||||
int idxStop = response.substring(idxStart).indexOf("&") + idxStart;
|
||||
if (idxStop < idxStart)
|
||||
idxStop = response.length();
|
||||
return response.substring(idxStart, idxStop);
|
||||
}
|
||||
return "";
|
||||
} catch (Exception e) {
|
||||
System.out.println(key);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public void setFIRSTNAME(String firstname) {
|
||||
this.FIRSTNAME = firstname;
|
||||
}
|
||||
|
||||
public String getLASTNAME() {
|
||||
return this.LASTNAME;
|
||||
}
|
||||
|
||||
public void setLASTNAME(String lastname) {
|
||||
this.LASTNAME = lastname;
|
||||
}
|
||||
|
||||
public String getPAYERID() {
|
||||
return this.PAYERID;
|
||||
}
|
||||
|
||||
public void setPAYERID(String payerid) {
|
||||
this.PAYERID = payerid;
|
||||
}
|
||||
|
||||
public String getPAYERSTATUS() {
|
||||
return this.PAYERSTATUS;
|
||||
}
|
||||
|
||||
public void setPAYERSTATUS(String payerstatus) {
|
||||
this.PAYERSTATUS = payerstatus;
|
||||
}
|
||||
|
||||
public String getSHIPTOCITY() {
|
||||
return (this.SHIPTOCITY == null) ? "" : this.SHIPTOCITY;
|
||||
}
|
||||
|
||||
public void setSHIPTOCITY(String shiptocity) {
|
||||
this.SHIPTOCITY = shiptocity;
|
||||
}
|
||||
|
||||
public String getSHIPTOCOUNTRYCODE() {
|
||||
return (this.SHIPTOCOUNTRYCODE == null) ? "" :
|
||||
this.SHIPTOCOUNTRYCODE;
|
||||
}
|
||||
|
||||
public void setSHIPTOCOUNTRYCODE(String shiptocountrycode) {
|
||||
this.SHIPTOCOUNTRYCODE = shiptocountrycode;
|
||||
}
|
||||
|
||||
public String getSHIPTONAME() {
|
||||
return (this.SHIPTONAME == null) ? "" : this.SHIPTONAME;
|
||||
}
|
||||
|
||||
public void setSHIPTONAME(String shiptoname) {
|
||||
this.SHIPTONAME = shiptoname;
|
||||
}
|
||||
|
||||
public String getSHIPTOSTATE() {
|
||||
return (this.SHIPTOSTATE == null) ? "" : this.SHIPTOSTATE;
|
||||
}
|
||||
|
||||
public void setSHIPTOSTATE(String shiptostate) {
|
||||
this.SHIPTOSTATE = shiptostate;
|
||||
}
|
||||
|
||||
public String getSHIPTOSTREET() {
|
||||
return (this.SHIPTOSTREET == null) ? "" : this.SHIPTOSTREET;
|
||||
}
|
||||
|
||||
public void setSHIPTOSTREET(String shiptostreet) {
|
||||
this.SHIPTOSTREET = shiptostreet;
|
||||
}
|
||||
|
||||
public String getSHIPTOZIP() {
|
||||
return (this.SHIPTOZIP == null) ? "" : this.SHIPTOZIP;
|
||||
}
|
||||
|
||||
public void setSHIPTOZIP(String shiptozip) {
|
||||
this.SHIPTOZIP = shiptozip;
|
||||
}
|
||||
|
||||
public String getAMT() {
|
||||
return this.AMT;
|
||||
}
|
||||
|
||||
public void setAMT(String amt) {
|
||||
this.AMT = amt;
|
||||
}
|
||||
|
||||
public long getId_ordine() {
|
||||
return this.id_ordine;
|
||||
}
|
||||
|
||||
public void setId_ordine(long id_ordine) {
|
||||
this.id_ordine = id_ordine;
|
||||
}
|
||||
|
||||
public boolean isDetailBuyer() {
|
||||
return this.detailBuyer;
|
||||
}
|
||||
|
||||
public void setDetailBuyer(boolean detailBuyer) {
|
||||
this.detailBuyer = detailBuyer;
|
||||
}
|
||||
|
||||
public boolean isPaymentDone() {
|
||||
return this.paymentDone;
|
||||
}
|
||||
|
||||
public void setPaymentDone(boolean paymentDone) {
|
||||
this.paymentDone = paymentDone;
|
||||
}
|
||||
|
||||
public String getTRANSACTIONID() {
|
||||
return this.TRANSACTIONID;
|
||||
}
|
||||
|
||||
public void setTRANSACTIONID(String transactionid) {
|
||||
this.TRANSACTIONID = transactionid;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
package it.acxent.bank.paypalcheckout;
|
||||
|
||||
import com.paypal.core.PayPalEnvironment;
|
||||
import com.paypal.core.PayPalHttpClient;
|
||||
import com.paypal.http.HttpRequest;
|
||||
import com.paypal.http.HttpResponse;
|
||||
import com.paypal.http.exceptions.HttpException;
|
||||
import com.paypal.http.serializer.Json;
|
||||
import com.paypal.orders.AmountWithBreakdown;
|
||||
import com.paypal.orders.ApplicationContext;
|
||||
import com.paypal.orders.LinkDescription;
|
||||
import com.paypal.orders.Order;
|
||||
import com.paypal.orders.OrderRequest;
|
||||
import com.paypal.orders.OrdersCreateRequest;
|
||||
import com.paypal.orders.OrdersGetRequest;
|
||||
import com.paypal.orders.PurchaseUnitRequest;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class PayPalOrder {
|
||||
private PayPalHttpClient client;
|
||||
|
||||
private PayPalReq payPalReq;
|
||||
|
||||
private boolean useSandbox = true;
|
||||
|
||||
public PayPalOrder(PayPalReq payPalReq) {
|
||||
setPayPalReq(payPalReq);
|
||||
this.useSandbox = getPayPalReq().isUseSandbox();
|
||||
}
|
||||
|
||||
private OrderRequest buildMinimumRequestBody() {
|
||||
OrderRequest orderRequest = new OrderRequest();
|
||||
orderRequest.checkoutPaymentIntent("CAPTURE");
|
||||
ApplicationContext applicationContext = new ApplicationContext().cancelUrl(getPayPalReq().getCancelURL())
|
||||
.returnUrl(getPayPalReq().getReturnUrl());
|
||||
orderRequest.applicationContext(applicationContext);
|
||||
List<PurchaseUnitRequest> purchaseUnitRequests = new ArrayList<>();
|
||||
PurchaseUnitRequest purchaseUnitRequest = new PurchaseUnitRequest()
|
||||
.amountWithBreakdown(new AmountWithBreakdown()
|
||||
.currencyCode(getPayPalReq().getCurrency()).value(String.valueOf(getPayPalReq().getAmt())))
|
||||
.description(getPayPalReq().getDESC());
|
||||
purchaseUnitRequests.add(purchaseUnitRequest);
|
||||
orderRequest.purchaseUnits(purchaseUnitRequests);
|
||||
return orderRequest;
|
||||
}
|
||||
|
||||
public HttpResponse<Order> createOrder(boolean debug) throws IOException {
|
||||
OrdersCreateRequest request = new OrdersCreateRequest();
|
||||
request.header("prefer", "return=representation");
|
||||
request.requestBody(buildMinimumRequestBody());
|
||||
HttpResponse<Order> response = getClient().execute((HttpRequest)request);
|
||||
if (debug &&
|
||||
response.statusCode() == 201) {
|
||||
System.out.println("Order with Minimum Payload: ");
|
||||
System.out.println("Status Code: " + response.statusCode());
|
||||
System.out.println("Status: " + ((Order)response.result()).status());
|
||||
System.out.println("Order ID: " + ((Order)response.result()).id());
|
||||
System.out.println("Intent: " + ((Order)response.result()).checkoutPaymentIntent());
|
||||
System.out.println("Links: ");
|
||||
for (LinkDescription link : (Iterable<LinkDescription>)((Order)response.result()).links())
|
||||
System.out.println("\t" + link.rel() + ": " + link.href() + "\tCall Type: " + link.method());
|
||||
System.out.println("Total Amount: " + ((Order)response.result()).purchaseUnits().get(0).amountWithBreakdown().currencyCode() + " " + ((Order)
|
||||
response.result()).purchaseUnits().get(0).amountWithBreakdown().value());
|
||||
System.out.println("Full response body:");
|
||||
System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4));
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
PayPalReq ppr = new PayPalReq();
|
||||
new PayPalOrder(ppr).createOrder(true);
|
||||
} catch (HttpException e) {
|
||||
System.out.println(e.getLocalizedMessage());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public PayPalReq getPayPalReq() {
|
||||
return this.payPalReq;
|
||||
}
|
||||
|
||||
public void setPayPalReq(PayPalReq payPalReq) {
|
||||
this.payPalReq = payPalReq;
|
||||
}
|
||||
|
||||
public PayPalHttpClient getClient() {
|
||||
if (this.client == null) {
|
||||
System.out.println("clientid: " + getPayPalReq().getPaypalClientId());
|
||||
System.out.println("clientSc: " + getPayPalReq().getPaypalClientSecret());
|
||||
if (this.useSandbox) {
|
||||
PayPalEnvironment.Sandbox sandbox = new PayPalEnvironment.Sandbox(getPayPalReq().getPaypalClientId(),
|
||||
getPayPalReq().getPaypalClientSecret());
|
||||
this.client = new PayPalHttpClient((PayPalEnvironment)sandbox);
|
||||
} else {
|
||||
PayPalEnvironment.Live live = new PayPalEnvironment.Live(getPayPalReq().getPaypalClientId(),
|
||||
getPayPalReq().getPaypalClientSecret());
|
||||
this.client = new PayPalHttpClient((PayPalEnvironment)live);
|
||||
}
|
||||
}
|
||||
return this.client;
|
||||
}
|
||||
|
||||
public String prettyPrint(JSONObject jo, String pre) {
|
||||
Iterator<?> keys = jo.keys();
|
||||
StringBuilder pretty = new StringBuilder();
|
||||
while (keys.hasNext()) {
|
||||
String key = (String)keys.next();
|
||||
pretty.append(String.format("%s%s: ", pre, StringUtils.capitalize(key)));
|
||||
if (jo.get(key) instanceof JSONObject) {
|
||||
pretty.append(prettyPrint(jo.getJSONObject(key), pre + "\t"));
|
||||
continue;
|
||||
}
|
||||
if (jo.get(key) instanceof org.json.JSONArray) {
|
||||
int sno = 1;
|
||||
for (Object jsonObject : (Iterable<Object>)jo.getJSONArray(key)) {
|
||||
pretty.append(String.format("\n%s\t%d:\n", pre, sno++));
|
||||
pretty.append(prettyPrint((JSONObject)jsonObject, pre + "\t\t"));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
pretty.append(String.format("%s\n", jo.getString(key)));
|
||||
}
|
||||
return pretty.toString();
|
||||
}
|
||||
|
||||
public HttpResponse<Order> getOrder(String orderId) throws IOException {
|
||||
OrdersGetRequest request = new OrdersGetRequest(orderId);
|
||||
HttpResponse<Order> response = getClient().execute((HttpRequest)request);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,291 @@
|
|||
package it.acxent.bank.paypalcheckout;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
import it.acxent.common.Parm;
|
||||
import it.acxent.common.StatusMsg;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
public class PayPalReq extends _BankAdapter {
|
||||
private String paypalClientId;
|
||||
|
||||
private String paypalClientSecret;
|
||||
|
||||
private boolean useSandbox = false;
|
||||
|
||||
private double amt;
|
||||
|
||||
private long id_ordine;
|
||||
|
||||
private String cancelURL;
|
||||
|
||||
private String returnUrl;
|
||||
|
||||
private String paypalOrderId;
|
||||
|
||||
private String TOKEN;
|
||||
|
||||
private String PAYERID;
|
||||
|
||||
private String SHIPTOCITY;
|
||||
|
||||
private String SHIPTOCOUNTRYCODE;
|
||||
|
||||
private String SHIPTONAME;
|
||||
|
||||
private String SHIPTOSTATE;
|
||||
|
||||
private String SHIPTOSTREET;
|
||||
|
||||
private String SHIPTOZIP;
|
||||
|
||||
private String DESC;
|
||||
|
||||
private String currency;
|
||||
|
||||
public static final String P_CHECKOUT_APPLICATION_CLIENT_ID = "PAYPAL_CHECKOUT_APPLICATION_CLIENT_ID";
|
||||
|
||||
public static final String P_CHECKOUT_APPLICATION_CLIENT_SECRET = "PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET";
|
||||
|
||||
public static final String P_CHECKOUT_USE_SANDBOX = "P_PAYPAL_CHECKOUT_USE_SANDBOX";
|
||||
|
||||
public static final String P_CANCEL_URL = "PAYPAL_CANCELURL";
|
||||
|
||||
public static final String P_CURRENCY = "PAYPAL_CURRENCY";
|
||||
|
||||
public static final String P_PAYMENT_OK_PAGE = "PAYPAL_OK";
|
||||
|
||||
public static final String P_RETURN_URL = "PAYPAL_RETURNURL";
|
||||
|
||||
public double getAmt() {
|
||||
return this.amt;
|
||||
}
|
||||
|
||||
public void setAmt(double amt) {
|
||||
this.amt = amt;
|
||||
}
|
||||
|
||||
public String getCancelURL() {
|
||||
return (this.cancelURL == null) ? "" : this.cancelURL;
|
||||
}
|
||||
|
||||
public void setCancelURL(String cancelURL) {
|
||||
this.cancelURL = cancelURL;
|
||||
}
|
||||
|
||||
public String getReturnUrl() {
|
||||
return (this.returnUrl == null) ? "" : this.returnUrl;
|
||||
}
|
||||
|
||||
public void setReturnUrl(String returnUrl) {
|
||||
this.returnUrl = returnUrl;
|
||||
}
|
||||
|
||||
public String getTOKEN() {
|
||||
return (this.TOKEN == null) ? "" : this.TOKEN;
|
||||
}
|
||||
|
||||
public void setTOKEN(String token) {
|
||||
this.TOKEN = token;
|
||||
}
|
||||
|
||||
public String getPAYERID() {
|
||||
return this.PAYERID;
|
||||
}
|
||||
|
||||
public void setPAYERID(String payerid) {
|
||||
this.PAYERID = payerid;
|
||||
}
|
||||
|
||||
public String getSHIPTOCITY() {
|
||||
return (this.SHIPTOCITY == null) ? "" : this.SHIPTOCITY;
|
||||
}
|
||||
|
||||
public String getSHIPTOCOUNTRYCODE() {
|
||||
return (this.SHIPTOCOUNTRYCODE == null) ? "" : this.SHIPTOCOUNTRYCODE;
|
||||
}
|
||||
|
||||
public String getSHIPTONAME() {
|
||||
return (this.SHIPTONAME == null) ? "" : this.SHIPTONAME;
|
||||
}
|
||||
|
||||
public String getSHIPTOSTATE() {
|
||||
return (this.SHIPTOSTATE == null) ? "" : this.SHIPTOSTATE;
|
||||
}
|
||||
|
||||
public String getSHIPTOSTREET() {
|
||||
return (this.SHIPTOSTREET == null) ? "" : this.SHIPTOSTREET;
|
||||
}
|
||||
|
||||
public String getSHIPTOZIP() {
|
||||
return (this.SHIPTOZIP == null) ? "" : this.SHIPTOZIP;
|
||||
}
|
||||
|
||||
public long getId_ordine() {
|
||||
return this.id_ordine;
|
||||
}
|
||||
|
||||
public void setId_ordine(long id_ordine) {
|
||||
this.id_ordine = id_ordine;
|
||||
}
|
||||
|
||||
public String getShippingAddressString() {
|
||||
return "SHIPTONAME=" + URLEncoder.encode(getSHIPTONAME()) + "&DESC=" + URLEncoder.encode(getDESC()) + "&SHIPTOSTREET=" +
|
||||
URLEncoder.encode(getSHIPTOSTREET()) + "&SHIPTOCITY=" + URLEncoder.encode(getSHIPTOCITY()) + "&SHIPTOSTATE=" +
|
||||
URLEncoder.encode(getSHIPTOSTATE()) + "&SHIPTOCOUNTRYCODE=" + URLEncoder.encode(getSHIPTOCOUNTRYCODE()) + "&SHIPTOZIP=" +
|
||||
URLEncoder.encode(getSHIPTOZIP()) + "&ADDROVERRIDE=1";
|
||||
}
|
||||
|
||||
public void setSHIPTOCITY(String shiptocity) {
|
||||
this.SHIPTOCITY = shiptocity;
|
||||
}
|
||||
|
||||
public void setSHIPTOCOUNTRYCODE(String shiptocountrycode) {
|
||||
this.SHIPTOCOUNTRYCODE = shiptocountrycode;
|
||||
}
|
||||
|
||||
public void setSHIPTONAME(String shiptoname) {
|
||||
this.SHIPTONAME = shiptoname;
|
||||
}
|
||||
|
||||
public void setSHIPTOSTATE(String shiptostate) {
|
||||
this.SHIPTOSTATE = shiptostate;
|
||||
}
|
||||
|
||||
public void setSHIPTOSTREET(String shiptostreet) {
|
||||
this.SHIPTOSTREET = shiptostreet;
|
||||
}
|
||||
|
||||
public void setSHIPTOZIP(String shiptozip) {
|
||||
this.SHIPTOZIP = shiptozip;
|
||||
}
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
boolean debug = false;
|
||||
if (ap != null) {
|
||||
DBAdapter.logDebug(debug, "payPal chechout initParms: start");
|
||||
String l_tipoParm = "PAYPAL";
|
||||
Parm bean = new Parm(ap);
|
||||
l_tipoParm = "PAYPAL_CHECKOUT";
|
||||
StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm);
|
||||
bean.findByCodice("PAYPAL_CANCELURL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_CANCELURL");
|
||||
bean.setDescrizione("PAYPAL_CANCELURL");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("PAYPAL_CANCELURL");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_CURRENCY");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_CURRENCY");
|
||||
bean.setDescrizione("PAYPAL_CURRENCY");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("EUR");
|
||||
bean.setNota("PAYPAL_CURRENCY");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_OK");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_OK");
|
||||
bean.setDescrizione("PAYPAL_OK");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payPalRes.jsp");
|
||||
bean.setNota("PAYPAL_OK");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_RETURNURL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_RETURNURL");
|
||||
bean.setDescrizione("PAYPAL_RETURNURL");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("PAYPAL_RETURNURL");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_CHECKOUT_APPLICATION_CLIENT_ID");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_CHECKOUT_APPLICATION_CLIENT_ID");
|
||||
bean.setDescrizione("PAYPAL_CHECKOUT_APPLICATION_CLIENT_ID");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET");
|
||||
bean.setDescrizione("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET");
|
||||
bean.save();
|
||||
bean.findByCodice("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET");
|
||||
bean.setDescrizione("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET");
|
||||
bean.save();
|
||||
bean.findByCodice("P_PAYPAL_CHECKOUT_USE_SANDBOX");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("P_PAYPAL_CHECKOUT_USE_SANDBOX");
|
||||
bean.setDescrizione("P_PAYPAL_CHECKOUT_USE_SANDBOX");
|
||||
bean.setFlgTipo(5L);
|
||||
bean.setNota("P_PAYPAL_CHECKOUT_USE_SANDBOX");
|
||||
bean.save();
|
||||
DBAdapter.logDebug(debug, "payPal chechout initParms: stop");
|
||||
}
|
||||
}
|
||||
|
||||
public String getDESC() {
|
||||
return (this.DESC == null) ? "" : this.DESC.trim();
|
||||
}
|
||||
|
||||
public void setDESC(String dESC) {
|
||||
this.DESC = dESC;
|
||||
}
|
||||
|
||||
public String getCurrency() {
|
||||
return (this.currency == null) ? "EUR" : this.currency.trim();
|
||||
}
|
||||
|
||||
public void setCurrency(String currency) {
|
||||
this.currency = currency;
|
||||
}
|
||||
|
||||
public String getPaypalClientId() {
|
||||
return this.paypalClientId;
|
||||
}
|
||||
|
||||
public void setPaypalClientId(String paypalClientId) {
|
||||
this.paypalClientId = paypalClientId;
|
||||
}
|
||||
|
||||
public String getPaypalClientSecret() {
|
||||
return this.paypalClientSecret;
|
||||
}
|
||||
|
||||
public void setPaypalClientSecret(String paypalClientSecret) {
|
||||
this.paypalClientSecret = paypalClientSecret;
|
||||
}
|
||||
|
||||
public boolean isUseSandbox() {
|
||||
return this.useSandbox;
|
||||
}
|
||||
|
||||
public void setUseSandbox(boolean useSandbox) {
|
||||
this.useSandbox = useSandbox;
|
||||
}
|
||||
|
||||
public String getPaypalOrderId() {
|
||||
return (this.paypalOrderId == null) ? "" : this.paypalOrderId.trim();
|
||||
}
|
||||
|
||||
public void setPaypalOrderId(String paypalOrderId) {
|
||||
this.paypalOrderId = paypalOrderId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,303 @@
|
|||
package it.acxent.bank.poste;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
import it.acxent.common.Parm;
|
||||
import it.acxent.common.StatusMsg;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
|
||||
public class PeReq extends _BankAdapter {
|
||||
public static final String LANG_CODE_USA = "USA";
|
||||
|
||||
public static final String LANG_CODE_ITA = "ITA";
|
||||
|
||||
public static final String DIV_CODE_EURO = "978";
|
||||
|
||||
private String currency;
|
||||
|
||||
private String trackId;
|
||||
|
||||
private String mail;
|
||||
|
||||
private String resourcePath;
|
||||
|
||||
private String language;
|
||||
|
||||
private String alias;
|
||||
|
||||
private String responseURL;
|
||||
|
||||
private String errorURL;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String amt;
|
||||
|
||||
private String action;
|
||||
|
||||
private String flgTipoPagamentoPe;
|
||||
|
||||
private String merchantId;
|
||||
|
||||
private String shopId;
|
||||
|
||||
public static final String P_USE_IGFS = "PE_USE_IGFS";
|
||||
|
||||
public static final String P_NO_CERTIFICATO = "PE_NO_CERTIFICATO";
|
||||
|
||||
public static final String P_RESOURCE_PATH = "PE_RESOURCE_PATH";
|
||||
|
||||
public static final String P_URL_POST_RESPONSE = "PE_URL_POST_RESPONSE";
|
||||
|
||||
public static final String ALIAS_POSTEPAY = "03";
|
||||
|
||||
public static final String ALIAS_BPOPL = "01";
|
||||
|
||||
public static final String ALIAS_CC = "02";
|
||||
|
||||
public static final String ALIAS_BPIOL = "04";
|
||||
|
||||
public static final String ALIAS_POSTEPAY_IMPRESA = "06";
|
||||
|
||||
public static final String P_MERCHANT_ID = "PE_MERCHANT_ID";
|
||||
|
||||
public static final String DEFAULT_OK_KO_PAGE = "payResPe.jsp";
|
||||
|
||||
public static final String P_URL_REDIRECT_RESULT = "PE_URL_REDIRECT_RESULT";
|
||||
|
||||
public static final String P_PAYMENT_OK_PAGE = "PE_PAY_OK";
|
||||
|
||||
public static final String P_PAYMENT_ERROR_PAGE = "PE_PAY_KO";
|
||||
|
||||
public static final String P_URL_POST_RESPONSE_ERROR = "URL_POST_RESPONSE_ERROR";
|
||||
|
||||
public static final String TEST_ALIAS = "payment_testm_urlmac";
|
||||
|
||||
public static final String REQ_URL = "https://ecommerce.cim-italia.it/ecomm/DispatcherServlet";
|
||||
|
||||
public String getTrackId() {
|
||||
return (this.trackId == null) ? "" : this.trackId;
|
||||
}
|
||||
|
||||
public void setTrackId(String myamount) {
|
||||
this.trackId = myamount;
|
||||
}
|
||||
|
||||
public String getAmt() {
|
||||
return (this.amt == null) ? "" : this.amt;
|
||||
}
|
||||
|
||||
public void setAmt(String mybuyeremail) {
|
||||
this.amt = mybuyeremail;
|
||||
}
|
||||
|
||||
public String getMail() {
|
||||
return (this.mail == null) ? "" : this.mail;
|
||||
}
|
||||
|
||||
public void setMail(String mybuyername) {
|
||||
this.mail = mybuyername;
|
||||
}
|
||||
|
||||
public String getCurrency() {
|
||||
return (this.currency == null) ? "" : this.currency;
|
||||
}
|
||||
|
||||
public void setCurrency(String mycurrency) {
|
||||
this.currency = mycurrency;
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return getMerchantId() + getMerchantId();
|
||||
}
|
||||
|
||||
public void setAlias(String mycustominfo) {
|
||||
this.alias = mycustominfo;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return (this.language == null) ? "" : this.language;
|
||||
}
|
||||
|
||||
public void setLanguage(String lang) {
|
||||
this.language = lang;
|
||||
}
|
||||
|
||||
public String getImportoUrl() {
|
||||
return (this.amt == null) ? "" : this.amt;
|
||||
}
|
||||
|
||||
public String getResponseURL() {
|
||||
return (this.responseURL == null) ? "" : this.responseURL.trim();
|
||||
}
|
||||
|
||||
public void setResponseURL(String url) {
|
||||
this.responseURL = url;
|
||||
}
|
||||
|
||||
public String getErrorURL() {
|
||||
return (this.errorURL == null) ? "" : this.errorURL.trim();
|
||||
}
|
||||
|
||||
public void setErrorURL(String url_back) {
|
||||
this.errorURL = url_back;
|
||||
}
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
if (ap != null) {
|
||||
Parm bean = new Parm(ap);
|
||||
String l_tipoParm = "POST ECOMMERCE";
|
||||
StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm);
|
||||
bean.findByCodice("PE_MERCHANT_ID");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PE_MERCHANT_ID");
|
||||
bean.setDescrizione("PE_MERCHANT_ID");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("PE_MERCHANT_ID");
|
||||
bean.setNota("PE_MERCHANT_ID");
|
||||
bean.save();
|
||||
bean.findByCodice("PE_PAY_KO");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PE_PAY_KO");
|
||||
bean.setDescrizione("PE_PAY_KO");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payResPe.jsp");
|
||||
bean.setNota("PE_PAY_KO");
|
||||
bean.save();
|
||||
bean.findByCodice("PE_PAY_OK");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PE_PAY_OK");
|
||||
bean.setDescrizione("PE_PAY_OK");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payResPe.jsp");
|
||||
bean.setNota("PE_PAY_OK");
|
||||
bean.save();
|
||||
bean.findByCodice("PE_NO_CERTIFICATO");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PE_NO_CERTIFICATO");
|
||||
bean.setDescrizione("PE_NO_CERTIFICATO");
|
||||
bean.setFlgTipo(1L);
|
||||
bean.setNota("PE_NO_CERTIFICATOSOLO PER IGFS: 0--> CON CERTIFICATO, PRODUZIONE<br>1 --> SENZA CERTIFICATO, SOLO TEST");
|
||||
bean.save();
|
||||
bean.findByCodice("PE_USE_IGFS");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PE_USE_IGFS");
|
||||
bean.setDescrizione("PE_USE_IGFS");
|
||||
bean.setFlgTipo(1L);
|
||||
bean.setNota("PE_USE_IGFS: 0--> vecchia versione con resource.cgn<br>1 --> nuova versione con file properties");
|
||||
bean.save();
|
||||
bean.findByCodice("PE_RESOURCE_PATH");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PE_RESOURCE_PATH");
|
||||
bean.setDescrizione("PE_RESOURCE_PATH");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("/home/xxx/xxx/");
|
||||
bean.setNota("PE_RESOURCE_PATH: per la versione vecchia con / finale. Path assoluto dove trovare resource.cgn<br>per la versione nuova il percorso completo del .properties compreso il nome del file.");
|
||||
bean.save();
|
||||
bean.findByCodice("PE_URL_POST_RESPONSE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PE_URL_POST_RESPONSE");
|
||||
bean.setDescrizione("PE_URL_POST_RESPONSE");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://test.f3.com/tf/GetResponsePe.abl");
|
||||
bean.setNota("PE_URL_POST_RESPONSE: URL HTTP RICHIAMATA TRAMITE POST. DEVE ESSERE VISIBILE SU INTERNET (NO LOCALHOST)");
|
||||
bean.save();
|
||||
bean.findByCodice("URL_POST_RESPONSE_ERROR");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("URL_POST_RESPONSE_ERROR");
|
||||
bean.setDescrizione("URL_POST_RESPONSE_ERROR");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://test.f3.com/tf/RicevutaPE.abl");
|
||||
bean.setNota("URL_POST_RESPONSE_ERROR: URL HTTP RICHIAMATA TRAMITE REDIRECT. DEVE ESSERE VISIBILE SU INTERNET (NO LOCALHOST)");
|
||||
bean.save();
|
||||
bean.findByCodice("PE_URL_REDIRECT_RESULT");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PE_URL_REDIRECT_RESULT");
|
||||
bean.setDescrizione("PE_URL_REDIRECT_RESULT");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://localhost/tf/RicevutaPE.abl");
|
||||
bean.setNota("PE_URL_REDIRECT_RESULT: URL HTTP RICHIAMATA TRAMITE REDIRECT. PUO' ESSERE LOCALHOST IN FASE DI SVILUPPO");
|
||||
bean.save();
|
||||
StatusMsg.deleteMsgByTag(ap, "INIT");
|
||||
}
|
||||
}
|
||||
|
||||
public String getResourcePath() {
|
||||
return (this.resourcePath == null) ? "" : this.resourcePath;
|
||||
}
|
||||
|
||||
public void setResourcePath(String resourcePath) {
|
||||
this.resourcePath = resourcePath;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return (this.userName == null) ? "" : this.userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return "4";
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public String getTipoPagamentoPE(String tipoPagamento) {
|
||||
if (tipoPagamento.equals("04"))
|
||||
return "conto bpiol";
|
||||
if (tipoPagamento.equals("01"))
|
||||
return "conto bpiol";
|
||||
if (tipoPagamento.equals("04"))
|
||||
return "conto bpol";
|
||||
if (tipoPagamento.equals("02"))
|
||||
return "carta di credito";
|
||||
if (tipoPagamento.equals("03"))
|
||||
return "carta postepay";
|
||||
if (tipoPagamento.equals("06"))
|
||||
return "carta postepay Impresa";
|
||||
return "??";
|
||||
}
|
||||
|
||||
public String getFlgTipoPagamentoPe() {
|
||||
return (this.flgTipoPagamentoPe == null) ? "" : this.flgTipoPagamentoPe.trim();
|
||||
}
|
||||
|
||||
public void setFlgTipoPagamentoPe(String flgTipoPagamentoPe) {
|
||||
this.flgTipoPagamentoPe = flgTipoPagamentoPe;
|
||||
}
|
||||
|
||||
public String getMerchantId() {
|
||||
return (this.merchantId == null) ? "" : this.merchantId.trim();
|
||||
}
|
||||
|
||||
public void setMerchantId(String merchantId) {
|
||||
this.merchantId = merchantId;
|
||||
}
|
||||
|
||||
public String getShopId() {
|
||||
return (this.shopId == null) ? "" : this.shopId.trim();
|
||||
}
|
||||
|
||||
public void setShopId(String shopId) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
package it.acxent.bank.poste;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
|
||||
public class PeResp extends _BankAdapter {
|
||||
private long id_ordine;
|
||||
|
||||
private String errorText;
|
||||
|
||||
private String postdate;
|
||||
|
||||
private String paymentid;
|
||||
|
||||
private String trackid;
|
||||
|
||||
private String result;
|
||||
|
||||
private String tranid;
|
||||
|
||||
private String errorCode;
|
||||
|
||||
private String error;
|
||||
|
||||
private String auth;
|
||||
|
||||
private String errorService;
|
||||
|
||||
public static final String ESITO_OK = "APPROVED";
|
||||
|
||||
public long getId_ordine() {
|
||||
return this.id_ordine;
|
||||
}
|
||||
|
||||
public void setId_ordine(long id_ordine) {
|
||||
this.id_ordine = id_ordine;
|
||||
}
|
||||
|
||||
public String getErrorText() {
|
||||
return (this.errorText == null) ? "" : this.errorText.trim();
|
||||
}
|
||||
|
||||
public void setErrorText(String importo) {
|
||||
this.errorText = importo;
|
||||
}
|
||||
|
||||
public String getPostdate() {
|
||||
return (this.postdate == null) ? "" : this.postdate.trim();
|
||||
}
|
||||
|
||||
public void setPostdate(String data) {
|
||||
this.postdate = data;
|
||||
}
|
||||
|
||||
public String getPaymentid() {
|
||||
return (this.paymentid == null) ? "" : this.paymentid.trim();
|
||||
}
|
||||
|
||||
public void setPaymentid(String divisa) {
|
||||
this.paymentid = divisa;
|
||||
}
|
||||
|
||||
public String getTrackid() {
|
||||
return (this.trackid == null) ? "" : this.trackid.trim();
|
||||
}
|
||||
|
||||
public void setTrackid(String codTrans) {
|
||||
this.trackid = codTrans;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return (this.result == null) ? "" : this.result.trim();
|
||||
}
|
||||
|
||||
public void setResult(String esito) {
|
||||
this.result = esito;
|
||||
}
|
||||
|
||||
public String getTranid() {
|
||||
return (this.tranid == null) ? "" : this.tranid.trim();
|
||||
}
|
||||
|
||||
public void setTranid(String codAut) {
|
||||
this.tranid = codAut;
|
||||
}
|
||||
|
||||
public String getErrorCode() {
|
||||
return (this.errorCode == null) ? "" : this.errorCode.trim();
|
||||
}
|
||||
|
||||
public void setErrorCode(String nome) {
|
||||
this.errorCode = nome;
|
||||
}
|
||||
|
||||
public String getError() {
|
||||
return (this.error == null) ? "" : this.error.trim();
|
||||
}
|
||||
|
||||
public void setError(String cognome) {
|
||||
this.error = cognome;
|
||||
}
|
||||
|
||||
public String getAuth() {
|
||||
return (this.auth == null) ? "" : this.auth.trim();
|
||||
}
|
||||
|
||||
public void setAuth(String email) {
|
||||
this.auth = email;
|
||||
}
|
||||
|
||||
public String getErrorService() {
|
||||
return (this.errorService == null) ? "" :
|
||||
this.errorService.trim();
|
||||
}
|
||||
|
||||
public void setErrorService(String errorService) {
|
||||
this.errorService = errorService;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,363 @@
|
|||
package it.acxent.bank.poste2019;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
import it.acxent.common.Parm;
|
||||
import it.acxent.common.StatusMsg;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.reg.EcDc;
|
||||
|
||||
public class PosteReq extends _BankAdapter {
|
||||
private String VALUTA;
|
||||
|
||||
private String NUMORD;
|
||||
|
||||
private String IMPORTO;
|
||||
|
||||
private String LINGUA;
|
||||
|
||||
private String EMAILESERC;
|
||||
|
||||
private String EMAIL;
|
||||
|
||||
private String USERID;
|
||||
|
||||
public static final String TCONTAB_DIFFERITA = "D";
|
||||
|
||||
public static final String TCONTAB_IMMEDIATA = "I";
|
||||
|
||||
public static final String LANG_CODE_IT = "ITA";
|
||||
|
||||
public static final String LANG_CODE_EN = "EN";
|
||||
|
||||
public static final String P_POSTE19_MAC_KEY_START = "POSTE19_MAC_KEY_START";
|
||||
|
||||
public static final String P_POSTE19_URL_BACK = "POSTE19_URL_BACK";
|
||||
|
||||
public static final String P_POSTE19_URL_DONE = "POSTE19_URL_DONE";
|
||||
|
||||
public static final String P_POSTE19_URL_MS = "POSTE19_URL_MS";
|
||||
|
||||
public static final String P_POSTE19_EMAILESERC = "POSTE19_EMAILESERC";
|
||||
|
||||
public static final String P_POSTE19_MAC_KEY_ESITO = "POSTE19_MAC_KEY_ESITO";
|
||||
|
||||
public static final String P_POSTE19_IDNEGOZIO = "POSTE19_IDNEGOZIO";
|
||||
|
||||
public static final String P_POSTE19_TCONTAB = "POSTE19_TCONTAB";
|
||||
|
||||
public static final String P_POSTE19_OPTIONS = "POSTE19_OPTIONS";
|
||||
|
||||
public static final String URL_POSTE19_TEST = "https://acquistionlinetest.poste.it/poste/pagamenti/main?PAGE=MASTER";
|
||||
|
||||
public static final String URL_POSTE19_PROD = "https://acquistionline.poste.it/poste/pagamenti/main?PAGE=MASTER";
|
||||
|
||||
public static final String DEFAULT_URL_BACK_AND_DONE = "http://localhost/tf15/RicevutaPoste.abl";
|
||||
|
||||
public static final String DEFAULT_URL_MS = "http://localhost/tf15/RicevutaPoste.abl";
|
||||
|
||||
public static final String TEST_MAC = "CHENESOADESSO";
|
||||
|
||||
public static final String OPTIONS_G_REDIRIZIONE_IMMEDIATA = "G";
|
||||
|
||||
public static final String OPTIONS_L_ORDINE_DUPLICATO_CODE_07_URLMS = "L";
|
||||
|
||||
public static final String OPTIONS_N_NEGATA_SU_RULDONE = "N";
|
||||
|
||||
public static final String OPTIONS_P_SEND_RESPONSE_CODE_AUT = "P";
|
||||
|
||||
public PosteReq() {}
|
||||
|
||||
public PosteReq(ApplParmFull apFull) {
|
||||
setAp(apFull);
|
||||
}
|
||||
|
||||
public String getNUMORD() {
|
||||
return (this.NUMORD == null) ? "" : this.NUMORD.trim();
|
||||
}
|
||||
|
||||
public void setNUMORD(String myamount) {
|
||||
this.NUMORD = myamount;
|
||||
}
|
||||
|
||||
public String getIMPORTO() {
|
||||
return (this.IMPORTO == null) ? "" : this.IMPORTO;
|
||||
}
|
||||
|
||||
public void setIMPORTO(String mybuyeremail) {
|
||||
this.IMPORTO = mybuyeremail;
|
||||
}
|
||||
|
||||
public String getEMAILESERC() {
|
||||
return (this.EMAILESERC == null) ? "" : this.EMAILESERC;
|
||||
}
|
||||
|
||||
public void setEMAILESERC(String mybuyername) {
|
||||
this.EMAILESERC = mybuyername;
|
||||
}
|
||||
|
||||
public String getVALUTA() {
|
||||
return (this.VALUTA == null) ? "" : this.VALUTA;
|
||||
}
|
||||
|
||||
public void setVALUTA(String mycurrency) {
|
||||
this.VALUTA = mycurrency;
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return getParm("POSTE19_MAC_KEY_ESITO").getTesto();
|
||||
}
|
||||
|
||||
public String getMac() {
|
||||
return getMacPagamento();
|
||||
}
|
||||
|
||||
public String getMacPagamento() {
|
||||
StringBuffer theUrl = new StringBuffer();
|
||||
theUrl.append("&URLMS=");
|
||||
theUrl.append(getURLMS());
|
||||
theUrl.append("&URLDONE=");
|
||||
theUrl.append(getURLDONE());
|
||||
theUrl.append("&NUMORD=");
|
||||
theUrl.append(getNUMORD());
|
||||
theUrl.append("&IDNEGOZIO=");
|
||||
theUrl.append(getIDNEGOZIO());
|
||||
theUrl.append("&IMPORTO=");
|
||||
theUrl.append(getIMPORTO());
|
||||
theUrl.append("&VALUTA=");
|
||||
theUrl.append(getVALUTA());
|
||||
theUrl.append("&TCONTAB=");
|
||||
theUrl.append(getTCONTAB());
|
||||
theUrl.append("&TAUTOR=I");
|
||||
if (!getOPTIONS().isEmpty()) {
|
||||
theUrl.append("&OPTIONS=");
|
||||
theUrl.append(getOPTIONS());
|
||||
}
|
||||
theUrl.append("&USERID=");
|
||||
theUrl.append(getUSERID());
|
||||
String res = "";
|
||||
res = EcDc.encodeHMAC_256(getMAC_KEY_START(), theUrl.toString());
|
||||
System.out.println("stringa mac: " + res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public String getLINGUA() {
|
||||
return (this.LINGUA == null) ? "" : this.LINGUA;
|
||||
}
|
||||
|
||||
public void setLINGUA(String lang) {
|
||||
this.LINGUA = lang;
|
||||
}
|
||||
|
||||
public String getRequestUrl() {
|
||||
return getRequestUrl(false);
|
||||
}
|
||||
|
||||
public String getImportoUrl() {
|
||||
if (this.IMPORTO == null)
|
||||
return "0000";
|
||||
String temp = this.IMPORTO;
|
||||
if (temp.indexOf('.') < 0) {
|
||||
temp = temp + "00";
|
||||
} else if (temp.length() - temp.indexOf('.') < 3) {
|
||||
temp = temp + "0";
|
||||
}
|
||||
return temp.replace(".", "");
|
||||
}
|
||||
|
||||
public String getTestRequestUrl() {
|
||||
return getRequestUrl(true);
|
||||
}
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
if (ap != null) {
|
||||
DBAdapter.logDebug(true, "postepay 2019 chechout initParms: start");
|
||||
String l_tipoParm = "POSTEPAY 2019";
|
||||
StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm);
|
||||
Parm bean = new Parm(ap);
|
||||
bean.findByCodice("POSTE19_URL_BACK");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("POSTE19_URL_BACK");
|
||||
bean.setDescrizione("POSTE19_URL_BACK");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://localhost/tf15/RicevutaPoste.abl");
|
||||
bean.setNota("La URL verso la quale mandare l’utente in caso di annullamento del processo di pagamento e ritorno alla modifica del carrello");
|
||||
bean.save();
|
||||
bean.findByCodice("POSTE19_URL_DONE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("POSTE19_URL_DONE");
|
||||
bean.setDescrizione("POSTE19_URL_DONE");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://localhost/tf15/RicevutaPoste.abl");
|
||||
bean.setNota("POSTE19_URL_MS");
|
||||
bean.save();
|
||||
bean.findByCodice("POSTE19_URL_MS");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("POSTE19_URL_MS");
|
||||
bean.setDescrizione("POSTE19_URL_MS");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://localhost/tf15/RicevutaPoste.abl");
|
||||
bean.setNota("La URL che il sistema deve utilizzare per notificare direttamente al negozio l’esito della transazione compiuta ");
|
||||
bean.save();
|
||||
bean.findByCodice("POSTE19_MAC_KEY_START");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("POSTE19_MAC_KEY_START");
|
||||
bean.setDescrizione("POSTE19_MAC_KEY_START");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("CHENESOADESSO");
|
||||
bean.setNota("E' la chiave per il calcolo del MAC nei messaggi di avvio pagamento");
|
||||
bean.save();
|
||||
bean.findByCodice("POSTE19_MAC_KEY_ESITO");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("POSTE19_MAC_KEY_ESITO");
|
||||
bean.setDescrizione("POSTE19_MAC_KEY_ESITO");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""));
|
||||
if (bean.getNota().isEmpty())
|
||||
bean.setNota("E' la chiave per la verifica del MAC nei messaggi di esito emessi da Poste e per l’usodelle API.");
|
||||
bean.save();
|
||||
bean.findByCodice("POSTE19_EMAILESERC");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("POSTE19_EMAILESERC");
|
||||
bean.setDescrizione("POSTE19_EMAILESERC");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""));
|
||||
if (bean.getNota().isEmpty())
|
||||
bean.setNota("MAIL ESERCENTE AL QUALE INVIARE L'ESITO DELLA TRANSAZIONE. SE VUOTA VIENE UTILIZZATA QUELLA DELL'ANAGRAFICA DEL NEGOZIO");
|
||||
bean.save();
|
||||
bean.findByCodice("POSTE19_IDNEGOZIO");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("POSTE19_IDNEGOZIO");
|
||||
bean.setDescrizione("POSTE19_IDNEGOZIO");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""));
|
||||
if (bean.getNota().isEmpty())
|
||||
bean.setNota("Identificativo del negozio del merchant assegnato da Poste, Merchant ID (MID).");
|
||||
bean.save();
|
||||
bean.findByCodice("POSTE19_TCONTAB");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("POSTE19_TCONTAB");
|
||||
bean.setDescrizione("POSTE19_TCONTAB");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("I");
|
||||
if (bean.getNota().isEmpty())
|
||||
bean.setNota("Tipo di contabilizzazione da utilizzare in questo ordine. Obbligatorio.<br>D --> Differita<br>I --> Immediata");
|
||||
bean.save();
|
||||
bean.findByCodice("POSTE19_OPTIONS");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("POSTE19_OPTIONS");
|
||||
bean.setDescrizione("POSTE19_OPTIONS");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""));
|
||||
if (bean.getNota().isEmpty())
|
||||
bean.setNota("Opzioni aggiuntive per il pagamento in corso.<br>G – In caso di autorizzazione concessa il sistema invece di mostrare l’esito della transazione al consumatore effettua la redirezione immediata presso URLDONE in modo che il negozio virtuale possa mostrare un proprio “scontrino” personalizzato. In caso di autorizzazione negata all’utente viene riproposta la schermata di inserimento carta.<br>L – Nel caso di ordine duplicato il sistema invia una URLMS con codice di esito 07.<br>N – In caso di autorizzazione negata il sistema, invece di mostrare l’esito della transazione alconsumatore, effettua la redirezione immediata verso URLDONE.<br>P – Viene restituito, in URLMS E URDONE, il campo RESPONSE_CODE_AUT che rappresenta il codice di risposta ritornato dal backend autorizzativo.<br>");
|
||||
bean.save();
|
||||
DBAdapter.logDebug(true, "postepay 2019 chechout initParms: stop");
|
||||
}
|
||||
}
|
||||
|
||||
private String getIDNEGOZIO() {
|
||||
return getParm("POSTE19_IDNEGOZIO").getTesto();
|
||||
}
|
||||
|
||||
public String getURLBACK() {
|
||||
return getParm("POSTE19_URL_BACK").getTesto();
|
||||
}
|
||||
|
||||
public String getURLDONE() {
|
||||
return getParm("POSTE19_URL_DONE").getTesto();
|
||||
}
|
||||
|
||||
public String getURLMS() {
|
||||
return getParm("POSTE19_URL_MS").getTesto();
|
||||
}
|
||||
|
||||
public String getTCONTAB() {
|
||||
return getParm("POSTE19_TCONTAB").getTesto();
|
||||
}
|
||||
|
||||
public String getTAUTOR() {
|
||||
return "I";
|
||||
}
|
||||
|
||||
public String getOPTIONS() {
|
||||
return getParm("POSTE19_OPTIONS").getTesto();
|
||||
}
|
||||
|
||||
public String getEMAIL() {
|
||||
return this.EMAIL;
|
||||
}
|
||||
|
||||
public void setEMAIL(String eMAIL) {
|
||||
this.EMAIL = eMAIL;
|
||||
}
|
||||
|
||||
public String getUSERID() {
|
||||
return this.USERID;
|
||||
}
|
||||
|
||||
public void setUSERID(String uSERID) {
|
||||
this.USERID = uSERID;
|
||||
}
|
||||
|
||||
private String getMAC_KEY_START() {
|
||||
return getParm("POSTE19_MAC_KEY_START").getTesto();
|
||||
}
|
||||
|
||||
private String getRequestUrl(boolean test) {
|
||||
StringBuilder theUrl = new StringBuilder();
|
||||
if (test) {
|
||||
theUrl.append("https://acquistionlinetest.poste.it/poste/pagamenti/main?PAGE=MASTER");
|
||||
} else {
|
||||
theUrl.append("https://acquistionline.poste.it/poste/pagamenti/main?PAGE=MASTER");
|
||||
}
|
||||
theUrl.append("&IMPORTO=");
|
||||
theUrl.append(getIMPORTO());
|
||||
theUrl.append("&VALUTA=");
|
||||
theUrl.append(getVALUTA());
|
||||
theUrl.append("&NUMORD=");
|
||||
theUrl.append(getNUMORD());
|
||||
theUrl.append("&IDNEGOZIO=");
|
||||
theUrl.append(getIDNEGOZIO());
|
||||
theUrl.append("&URLBACK=");
|
||||
theUrl.append(getURLBACK());
|
||||
theUrl.append("&URLDONE=");
|
||||
theUrl.append(getURLDONE());
|
||||
theUrl.append("&URLMS=");
|
||||
theUrl.append(getURLMS());
|
||||
theUrl.append("&TCONTAB=");
|
||||
theUrl.append(getTCONTAB());
|
||||
theUrl.append("&TAUTOR=I");
|
||||
theUrl.append("&MAC=");
|
||||
theUrl.append(getMacPagamento());
|
||||
theUrl.append("&LINGUA=");
|
||||
theUrl.append(getLINGUA());
|
||||
if (!getEMAILESERC().isEmpty()) {
|
||||
theUrl.append("&EMAILESERC=");
|
||||
theUrl.append(getEMAILESERC());
|
||||
}
|
||||
if (!getOPTIONS().isEmpty()) {
|
||||
theUrl.append("&OPTIONS=");
|
||||
theUrl.append(getOPTIONS());
|
||||
}
|
||||
theUrl.append("&EMAIL=");
|
||||
theUrl.append(getEMAIL());
|
||||
theUrl.append("&USERID=");
|
||||
theUrl.append(getUSERID());
|
||||
return theUrl.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,258 @@
|
|||
package it.acxent.bank.poste2019;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.reg.EcDc;
|
||||
|
||||
public class PosteRes extends _BankAdapter {
|
||||
public static final String ESITO_OK = "00";
|
||||
|
||||
public static final String ESITO_KO_01 = "01";
|
||||
|
||||
public static final String ESITO_KO_02 = "02";
|
||||
|
||||
public static final String ESITO_KO_03 = "03";
|
||||
|
||||
public static final String ESITO_KO_04 = "04";
|
||||
|
||||
public static final String ESITO_KO_05 = "05";
|
||||
|
||||
public static final String ESITO_KO_06 = "06";
|
||||
|
||||
public static final String ESITO_KO_07 = "07";
|
||||
|
||||
public static final String ESITO_KO_60 = "60";
|
||||
|
||||
public static final String ESITO_KO_66 = "66";
|
||||
|
||||
private String IMPORTO;
|
||||
|
||||
private String NUMORD;
|
||||
|
||||
private String VALUTA;
|
||||
|
||||
private String ESITO;
|
||||
|
||||
private String AUT;
|
||||
|
||||
private String IDTRANS;
|
||||
|
||||
private String IDNEGOZIO;
|
||||
|
||||
private String MAC;
|
||||
|
||||
private String TCONTAB;
|
||||
|
||||
private String TAUTOR;
|
||||
|
||||
private String BPW_TIPO_TRANSAZIONE;
|
||||
|
||||
private String RESPONSE_CODE_AUT;
|
||||
|
||||
private String ALIASSTR;
|
||||
|
||||
private String EMAILTIT;
|
||||
|
||||
private String CFTIT;
|
||||
|
||||
public PosteRes() {}
|
||||
|
||||
public static final String getEsito(String l_esito) {
|
||||
if (l_esito.equals("01"))
|
||||
return "Negata dal sistema";
|
||||
if (l_esito.equals("02"))
|
||||
return "Negata per problemi sull'anagrafica negozio";
|
||||
if (l_esito.equals("03"))
|
||||
return "Negata per problemi di comunicazione con i circuiti autorizzativi";
|
||||
if (l_esito.equals("04"))
|
||||
return "Negata dall'emittente della carta";
|
||||
if (l_esito.equals("05"))
|
||||
return "Negata per numero carta errato";
|
||||
if (l_esito.equals("06"))
|
||||
return "Errore imprevisto durante l’elaborazione della richiesta";
|
||||
if (l_esito.equals("07"))
|
||||
return "Ordine duplicato";
|
||||
if (l_esito.equals("60"))
|
||||
return "Negata dai controlli antifrode di Poste";
|
||||
if (l_esito.equals("66"))
|
||||
return "Negata per mancata autenticazione dell’utente nelle procedure di verifica (ACS).";
|
||||
if (l_esito.equals("00"))
|
||||
return "Successo";
|
||||
return "??";
|
||||
}
|
||||
|
||||
public PosteRes(ApplParmFull apFull) {
|
||||
setAp(apFull);
|
||||
}
|
||||
|
||||
public boolean isMacRitornoOk() {
|
||||
String macCalcolato = getMacEsito();
|
||||
if (getMAC().equals(macCalcolato))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return getParm("XPAY_MAC_KEY").getTesto();
|
||||
}
|
||||
|
||||
public String getIMPORTO() {
|
||||
return this.IMPORTO;
|
||||
}
|
||||
|
||||
public void setIMPORTO(String iMPORTO) {
|
||||
this.IMPORTO = iMPORTO;
|
||||
}
|
||||
|
||||
public String getNUMORD() {
|
||||
return this.NUMORD;
|
||||
}
|
||||
|
||||
public void setNUMORD(String nUMORD) {
|
||||
this.NUMORD = nUMORD;
|
||||
}
|
||||
|
||||
public String getVALUTA() {
|
||||
return this.VALUTA;
|
||||
}
|
||||
|
||||
public void setVALUTA(String vALUTA) {
|
||||
this.VALUTA = vALUTA;
|
||||
}
|
||||
|
||||
public String getESITO() {
|
||||
return this.ESITO;
|
||||
}
|
||||
|
||||
public void setESITO(String eSITO) {
|
||||
this.ESITO = eSITO;
|
||||
}
|
||||
|
||||
public String getAUT() {
|
||||
return this.AUT;
|
||||
}
|
||||
|
||||
public void setAUT(String aUT) {
|
||||
this.AUT = aUT;
|
||||
}
|
||||
|
||||
public String getIDTRANS() {
|
||||
return this.IDTRANS;
|
||||
}
|
||||
|
||||
public void setIDTRANS(String iDTRANS) {
|
||||
this.IDTRANS = iDTRANS;
|
||||
}
|
||||
|
||||
public String getIDNEGOZIO() {
|
||||
return this.IDNEGOZIO;
|
||||
}
|
||||
|
||||
public void setIDNEGOZIO(String iDNEGOZIO) {
|
||||
this.IDNEGOZIO = iDNEGOZIO;
|
||||
}
|
||||
|
||||
public String getMAC() {
|
||||
return this.MAC;
|
||||
}
|
||||
|
||||
public void setMAC(String mAC) {
|
||||
this.MAC = mAC;
|
||||
}
|
||||
|
||||
private String getMAC_KEY_ESITO() {
|
||||
return getParm("POSTE19_MAC_KEY_ESITO").getTesto();
|
||||
}
|
||||
|
||||
public String getMacEsito() {
|
||||
StringBuffer theUrl = new StringBuffer();
|
||||
theUrl.append("&NUMORD=");
|
||||
theUrl.append(getNUMORD());
|
||||
theUrl.append("&IDNEGOZIO=");
|
||||
theUrl.append(getIDNEGOZIO());
|
||||
theUrl.append("&AUT=");
|
||||
theUrl.append(getAUT());
|
||||
theUrl.append("&IMPORTO=");
|
||||
theUrl.append(getIMPORTO());
|
||||
theUrl.append("&VALUTA=");
|
||||
theUrl.append(getVALUTA());
|
||||
theUrl.append("&IDTRANS=");
|
||||
theUrl.append(getIDTRANS());
|
||||
theUrl.append("&TCONTAB=");
|
||||
theUrl.append(getTCONTAB());
|
||||
theUrl.append("&TAUTOR=");
|
||||
theUrl.append(getTAUTOR());
|
||||
theUrl.append("&ESITO=");
|
||||
theUrl.append(getESITO());
|
||||
theUrl.append("&BPW_TIPO_TRANSAZIONE=");
|
||||
theUrl.append(getBPW_TIPO_TRANSAZIONE());
|
||||
if (getOPTIONS().equals("P")) {
|
||||
theUrl.append("&RESPONSE_CODE_AUT=");
|
||||
theUrl.append(getRESPONSE_CODE_AUT());
|
||||
}
|
||||
String res = "";
|
||||
res = EcDc.encodeHMAC_256(getMAC_KEY_ESITO(), theUrl.toString());
|
||||
System.out.println("stringa mac esito: " + res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public String getTCONTAB() {
|
||||
return this.TCONTAB;
|
||||
}
|
||||
|
||||
public void setTCONTAB(String tCONTAB) {
|
||||
this.TCONTAB = tCONTAB;
|
||||
}
|
||||
|
||||
public String getTAUTOR() {
|
||||
return this.TAUTOR;
|
||||
}
|
||||
|
||||
public void setTAUTOR(String tAUTOR) {
|
||||
this.TAUTOR = tAUTOR;
|
||||
}
|
||||
|
||||
public String getBPW_TIPO_TRANSAZIONE() {
|
||||
return this.BPW_TIPO_TRANSAZIONE;
|
||||
}
|
||||
|
||||
public void setBPW_TIPO_TRANSAZIONE(String bPW_TIPO_TRANSAZIONE) {
|
||||
this.BPW_TIPO_TRANSAZIONE = bPW_TIPO_TRANSAZIONE;
|
||||
}
|
||||
|
||||
public String getRESPONSE_CODE_AUT() {
|
||||
return this.RESPONSE_CODE_AUT;
|
||||
}
|
||||
|
||||
public void setRESPONSE_CODE_AUT(String rESPONSE_CODE_AUT) {
|
||||
this.RESPONSE_CODE_AUT = rESPONSE_CODE_AUT;
|
||||
}
|
||||
|
||||
public String getALIASSTR() {
|
||||
return this.ALIASSTR;
|
||||
}
|
||||
|
||||
public void setALIASSTR(String aLIASSTR) {
|
||||
this.ALIASSTR = aLIASSTR;
|
||||
}
|
||||
|
||||
public String getEMAILTIT() {
|
||||
return this.EMAILTIT;
|
||||
}
|
||||
|
||||
public void setEMAILTIT(String eMAILTIT) {
|
||||
this.EMAILTIT = eMAILTIT;
|
||||
}
|
||||
|
||||
public String getCFTIT() {
|
||||
return this.CFTIT;
|
||||
}
|
||||
|
||||
public void setCFTIT(String cFTIT) {
|
||||
this.CFTIT = cFTIT;
|
||||
}
|
||||
|
||||
public String getOPTIONS() {
|
||||
return getParm("POSTE19_OPTIONS").getTesto();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,721 @@
|
|||
package it.acxent.bank.sella;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.net.UnknownServiceException;
|
||||
|
||||
public class GestPayCrypt {
|
||||
private String ShopLogin = "";
|
||||
|
||||
private String Currency = "";
|
||||
|
||||
private String Amount = "";
|
||||
|
||||
private String ShopTransactionID = "";
|
||||
|
||||
private String BuyerName = "";
|
||||
|
||||
private String BuyerEmail = "";
|
||||
|
||||
private String Language = "";
|
||||
|
||||
private String CustomInfo = "";
|
||||
|
||||
private String AuthorizationCode = "";
|
||||
|
||||
private String ErrorCode = "";
|
||||
|
||||
private String ErrorDescription = "";
|
||||
|
||||
private String BankTransactionID = "";
|
||||
|
||||
private String AlertCode = "";
|
||||
|
||||
private String AlertDescription = "";
|
||||
|
||||
private String EncryptedString = "";
|
||||
|
||||
private String ToBeEncript = "";
|
||||
|
||||
private String Decripted = "";
|
||||
|
||||
private String TransactionResult = "";
|
||||
|
||||
private String ProtocolAuthServer = "";
|
||||
|
||||
private String DomainName = "";
|
||||
|
||||
private String separator = "";
|
||||
|
||||
private String errDescription = "";
|
||||
|
||||
private String errNumber = "";
|
||||
|
||||
private String Version = "";
|
||||
|
||||
private String Min = "";
|
||||
|
||||
private String CVV = "";
|
||||
|
||||
private String country = "";
|
||||
|
||||
private String vbvrisp = "";
|
||||
|
||||
private String vbv = "";
|
||||
|
||||
private String trans;
|
||||
|
||||
public GestPayCrypt() {
|
||||
this.ShopLogin = "";
|
||||
this.Currency = "";
|
||||
this.Amount = "";
|
||||
this.ShopTransactionID = "";
|
||||
this.BuyerName = "";
|
||||
this.BuyerEmail = "";
|
||||
this.Language = "";
|
||||
this.CustomInfo = "";
|
||||
this.AuthorizationCode = "";
|
||||
this.ErrorCode = "";
|
||||
this.ErrorDescription = "";
|
||||
this.BankTransactionID = "";
|
||||
this.AlertCode = "";
|
||||
this.AlertDescription = "";
|
||||
this.EncryptedString = "";
|
||||
this.ToBeEncript = "";
|
||||
this.Decripted = "";
|
||||
this.ProtocolAuthServer = "http://";
|
||||
this.DomainName = "";
|
||||
this.separator = "*P1*";
|
||||
this.errDescription = "";
|
||||
this.errNumber = "0";
|
||||
this.Version = "3.0";
|
||||
this.Min = "";
|
||||
this.CVV = "";
|
||||
this.country = "";
|
||||
this.vbvrisp = "";
|
||||
this.vbv = "";
|
||||
this.trans = "";
|
||||
}
|
||||
|
||||
public void setShopLogin(String xstr) {
|
||||
this.ShopLogin = xstr;
|
||||
}
|
||||
|
||||
public void setCurrency(String xstr) {
|
||||
this.Currency = xstr;
|
||||
}
|
||||
|
||||
public void setAmount(String xstr) {
|
||||
this.Amount = xstr;
|
||||
}
|
||||
|
||||
public void setShopTransactionID(String xstr) {
|
||||
this.ShopTransactionID = URLEncoder.encode(xstr.trim());
|
||||
}
|
||||
|
||||
public void setMIN(String xstr) {
|
||||
this.Min = xstr;
|
||||
}
|
||||
|
||||
public void setCVV(String xstr) {
|
||||
this.CVV = xstr;
|
||||
}
|
||||
|
||||
public void setBuyerName(String xstr) {
|
||||
this.BuyerName = URLEncoder.encode(xstr.trim());
|
||||
}
|
||||
|
||||
public void setBuyerEmail(String xstr) {
|
||||
this.BuyerEmail = xstr.trim();
|
||||
}
|
||||
|
||||
public void setLanguage(String xstr) {
|
||||
this.Language = xstr.trim();
|
||||
}
|
||||
|
||||
public void setCustomInfo(String xstr) {
|
||||
this.CustomInfo = URLEncoder.encode(xstr.trim());
|
||||
}
|
||||
|
||||
public void setEncryptedString(String xstr) {
|
||||
this.EncryptedString = xstr;
|
||||
}
|
||||
|
||||
public void setProtocolServer(String xstr) {
|
||||
this.ProtocolAuthServer = xstr;
|
||||
}
|
||||
|
||||
public void setDomainName(String xstr) {
|
||||
this.DomainName = xstr;
|
||||
}
|
||||
|
||||
public String getShopLogin() {
|
||||
return this.ShopLogin;
|
||||
}
|
||||
|
||||
public String getCurrency() {
|
||||
return this.Currency;
|
||||
}
|
||||
|
||||
public String getAmount() {
|
||||
return this.Amount;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return this.country;
|
||||
}
|
||||
|
||||
public String getVBV() {
|
||||
return this.vbv;
|
||||
}
|
||||
|
||||
public String getVBVrisp() {
|
||||
return this.vbvrisp;
|
||||
}
|
||||
|
||||
public String getShopTransactionID() {
|
||||
String app = "";
|
||||
try {
|
||||
app = URLDecode(this.ShopTransactionID);
|
||||
} catch (Exception e) {}
|
||||
return app;
|
||||
}
|
||||
|
||||
public String getBuyerName() {
|
||||
String appBuyername = "";
|
||||
try {
|
||||
appBuyername = URLDecode(this.BuyerName);
|
||||
} catch (Exception ex) {
|
||||
appBuyername = "errore";
|
||||
}
|
||||
return appBuyername;
|
||||
}
|
||||
|
||||
public String getBuyerEmail() {
|
||||
return this.BuyerEmail;
|
||||
}
|
||||
|
||||
public String getCustomInfo() {
|
||||
String appCustom = "";
|
||||
try {
|
||||
appCustom = URLDecode(this.CustomInfo);
|
||||
} catch (Exception e) {}
|
||||
return appCustom;
|
||||
}
|
||||
|
||||
public String getAuthorizationCode() {
|
||||
return this.AuthorizationCode;
|
||||
}
|
||||
|
||||
public String getErrorCode() {
|
||||
return this.ErrorCode;
|
||||
}
|
||||
|
||||
public String getErrorDescription() {
|
||||
return this.ErrorDescription;
|
||||
}
|
||||
|
||||
public String getBankTransactionID() {
|
||||
return this.BankTransactionID;
|
||||
}
|
||||
|
||||
public String getTransactionResult() {
|
||||
return this.TransactionResult;
|
||||
}
|
||||
|
||||
public String getAlertCode() {
|
||||
return this.AlertCode;
|
||||
}
|
||||
|
||||
public String getAlertDescription() {
|
||||
return this.AlertDescription;
|
||||
}
|
||||
|
||||
public String getEncryptedString() {
|
||||
return this.EncryptedString;
|
||||
}
|
||||
|
||||
public String getProtocolServer() {
|
||||
return this.ProtocolAuthServer;
|
||||
}
|
||||
|
||||
public String getDomainName() {
|
||||
return this.DomainName;
|
||||
}
|
||||
|
||||
public boolean Encrypt() {
|
||||
String sErr = "";
|
||||
this.ErrorCode = "0";
|
||||
this.ErrorDescription = "";
|
||||
try {
|
||||
if (this.ShopLogin.length() <= 0) {
|
||||
this.ErrorCode = "546";
|
||||
this.ErrorDescription = "IDshop not valid";
|
||||
return false;
|
||||
}
|
||||
if (controlValues(this.ProtocolAuthServer))
|
||||
this.ProtocolAuthServer = "http://";
|
||||
this.trans = this.ShopLogin.substring(0, 6);
|
||||
this.trans = this.trans.toLowerCase();
|
||||
if (controlValues(this.DomainName))
|
||||
if (this.trans.equals("gespay")) {
|
||||
this.DomainName = "testecomm.sella.it/CryptHTTP";
|
||||
} else {
|
||||
this.DomainName = "ecomms2s.sella.it/CryptHTTP";
|
||||
}
|
||||
if (this.Currency.length() <= 0) {
|
||||
this.ErrorCode = "552";
|
||||
this.ErrorDescription = "Currency not valid";
|
||||
return false;
|
||||
}
|
||||
if (this.Amount.length() <= 0) {
|
||||
this.ErrorCode = "553";
|
||||
this.ErrorDescription = "Amount not valid";
|
||||
return false;
|
||||
}
|
||||
if (this.ShopTransactionID.length() <= 0) {
|
||||
this.ErrorCode = "551";
|
||||
this.ErrorDescription = "Shop Transaction ID not valid";
|
||||
return false;
|
||||
}
|
||||
this.ToBeEncript = "";
|
||||
if (this.CVV.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_CVV=" + this.separator;
|
||||
if (this.Min.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_MIN=" + this.separator;
|
||||
if (this.Currency.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_UICCODE=" + this.separator;
|
||||
if (this.Amount.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_AMOUNT=" + this.separator;
|
||||
if (this.ShopTransactionID.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_SHOPTRANSACTIONID=" + this.separator;
|
||||
if (this.BuyerName.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_CHNAME=" + this.separator;
|
||||
if (this.BuyerEmail.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_CHEMAIL=" + this.separator;
|
||||
if (this.Language.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_IDLANGUAGE=" + this.separator;
|
||||
if (this.CustomInfo.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + this.separator;
|
||||
String urlString = this.ProtocolAuthServer + this.ProtocolAuthServer + "/Encrypt.asp?a=" + this.DomainName + "&b=" + this.ShopLogin + "&c=" +
|
||||
this.ToBeEncript.substring(4, this.ToBeEncript.length());
|
||||
URL url = new URL(urlString);
|
||||
URLConnection connection = url.openConnection();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
int nStart = 0;
|
||||
int nEnd = 0;
|
||||
String line = "";
|
||||
while (line != null) {
|
||||
line = in.readLine();
|
||||
if (line != null) {
|
||||
nStart = line.indexOf("#cryptstring#");
|
||||
nEnd = line.lastIndexOf("#/cryptstring#");
|
||||
if (((nStart != -1) ? true : false) & ((nEnd > nStart + 14) ? true : false))
|
||||
this.EncryptedString = line.substring(nStart + 13, nEnd);
|
||||
nStart = line.indexOf("#error#");
|
||||
nEnd = line.lastIndexOf("#/error#");
|
||||
if (((nStart != -1) ? true : false) & ((nEnd > nStart + 8) ? true : false)) {
|
||||
sErr = line.substring(nStart + 7, nEnd);
|
||||
int intsep = sErr.indexOf("-");
|
||||
this.ErrorCode = sErr.substring(0, intsep);
|
||||
this.ErrorDescription = sErr.substring(intsep + 1, sErr.length());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
return true;
|
||||
} catch (MalformedURLException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Bad URL";
|
||||
return false;
|
||||
} catch (UnknownServiceException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "ServiceException occurred.";
|
||||
return false;
|
||||
} catch (IOException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Bad URL Request";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean Decrypt() {
|
||||
this.ErrorCode = "0";
|
||||
this.ErrorDescription = "";
|
||||
String strdaelim = "";
|
||||
if (this.ShopLogin.length() <= 0) {
|
||||
this.ErrorCode = "546";
|
||||
this.ErrorDescription = "IDshop not valid";
|
||||
return false;
|
||||
}
|
||||
if (controlValues(this.ProtocolAuthServer))
|
||||
this.ProtocolAuthServer = "http://";
|
||||
this.trans = this.ShopLogin.substring(0, 6);
|
||||
this.trans = this.trans.toLowerCase();
|
||||
if (controlValues(this.DomainName))
|
||||
if (this.trans.equals("gespay")) {
|
||||
this.DomainName = "testecomm.sella.it/CryptHTTP";
|
||||
} else {
|
||||
this.DomainName = "ecomms2s.sella.it/CryptHTTP";
|
||||
}
|
||||
if (this.EncryptedString.length() <= 0) {
|
||||
this.ErrorCode = "1009";
|
||||
this.ErrorDescription = "String to Decrypt not valid";
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
String urlString = this.ProtocolAuthServer + this.ProtocolAuthServer + "/Decrypt.asp?a=" + this.DomainName + "&b=" + this.ShopLogin + "&c=" + this.EncryptedString;
|
||||
URL url = new URL(urlString);
|
||||
URLConnection connection = url.openConnection();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
int nStart = 0;
|
||||
int nEnd = 0;
|
||||
String line = "";
|
||||
while (line != null) {
|
||||
line = in.readLine();
|
||||
if (line != null) {
|
||||
nStart = line.indexOf("#decryptstring#");
|
||||
nEnd = line.lastIndexOf("#/decryptstring#");
|
||||
if (((nStart != -1) ? true : false) & ((nEnd > nStart + 16) ? true : false))
|
||||
this.Decripted = line.substring(nStart + 15, nEnd);
|
||||
nStart = line.indexOf("#error#");
|
||||
nEnd = line.lastIndexOf("#/error#");
|
||||
if (((nStart != -1) ? true : false) & ((nEnd > nStart + 8) ? true : false)) {
|
||||
String sErr = line.substring(nStart + 7, nEnd);
|
||||
int intsep = sErr.indexOf("-");
|
||||
this.ErrorCode = sErr.substring(0, intsep);
|
||||
this.ErrorDescription = sErr.substring(intsep + 1, sErr.length());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
if (this.Decripted.trim() == "") {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Void String";
|
||||
return false;
|
||||
}
|
||||
if (!Parsing(this.Decripted))
|
||||
return false;
|
||||
return true;
|
||||
} catch (MalformedURLException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Bad URL";
|
||||
return false;
|
||||
} catch (UnknownServiceException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Service Exception occurred.";
|
||||
return false;
|
||||
} catch (IOException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Bad URL Request";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean Parsing(String StringToBeParsed) {
|
||||
int nStart = 0;
|
||||
int nEnd = 0;
|
||||
this.ErrorCode = "";
|
||||
this.ErrorDescription = "";
|
||||
try {
|
||||
nStart = StringToBeParsed.indexOf("PAY1_UICCODE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.Currency = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.Currency = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_AMOUNT");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.Amount = StringToBeParsed.substring(nStart + 12, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.Amount = StringToBeParsed.substring(nStart + 12, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_SHOPTRANSACTIONID");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.ShopTransactionID = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.ShopTransactionID = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_CHNAME");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.BuyerName = StringToBeParsed.substring(nStart + 12, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.BuyerName = StringToBeParsed.substring(nStart + 12, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_CHEMAIL");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.BuyerEmail = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.BuyerEmail = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_AUTHORIZATIONCODE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.AuthorizationCode = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.AuthorizationCode = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_ERRORCODE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.ErrorCode = StringToBeParsed.substring(nStart + 15, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.ErrorCode = StringToBeParsed.substring(nStart + 15, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_ERRORDESCRIPTION");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.ErrorDescription = StringToBeParsed.substring(nStart + 22, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.ErrorDescription = StringToBeParsed.substring(nStart + 22, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_BANKTRANSACTIONID");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.BankTransactionID = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.BankTransactionID = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_ALERTCODE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.AlertCode = StringToBeParsed.substring(nStart + 15, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.AlertCode = StringToBeParsed.substring(nStart + 15, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_ALERTDESCRIPTION");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.AlertDescription = StringToBeParsed.substring(nStart + 22, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.AlertDescription = StringToBeParsed.substring(nStart + 22, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_COUNTRY");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.country = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.country = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_VBVRISP");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.vbvrisp = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.vbvrisp = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_VBV");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.vbv = StringToBeParsed.substring(nStart + 9, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.vbv = StringToBeParsed.substring(nStart + 9, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_IDLANGUAGE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.Language = StringToBeParsed.substring(nStart + 16, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.Language = StringToBeParsed.substring(nStart + 16, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_TRANSACTIONRESULT");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.TransactionResult = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.TransactionResult = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
this.CustomInfo = StringToBeParsed.trim();
|
||||
} catch (Exception e) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Error parsing String";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public String URLDecode(String str) throws Exception {
|
||||
if (str == null)
|
||||
return null;
|
||||
char[] res = new char[str.length()];
|
||||
int didx = 0;
|
||||
for (int sidx = 0; sidx < str.length(); sidx++) {
|
||||
char ch = str.charAt(sidx);
|
||||
if (ch == '+') {
|
||||
res[didx++] = ' ';
|
||||
} else if (ch == '%') {
|
||||
try {
|
||||
res[didx++] =
|
||||
(char)Integer.parseInt(str.substring(sidx + 1, sidx + 3), 16);
|
||||
sidx += 2;
|
||||
} catch (NumberFormatException e) {
|
||||
didx--;
|
||||
res[didx++] = ch;
|
||||
}
|
||||
} else {
|
||||
res[didx++] = ch;
|
||||
}
|
||||
}
|
||||
return String.valueOf(res, 0, didx);
|
||||
}
|
||||
|
||||
protected boolean controlValues(String str) {
|
||||
return (str == null || str.length() == 0);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,676 @@
|
|||
package it.acxent.bank.sella;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.net.UnknownServiceException;
|
||||
|
||||
public class GestPayCrypt20 {
|
||||
private String ShopLogin;
|
||||
|
||||
private String Currency;
|
||||
|
||||
private String Amount;
|
||||
|
||||
private String ShopTransactionID;
|
||||
|
||||
private String BuyerName;
|
||||
|
||||
private String BuyerEmail;
|
||||
|
||||
private String Language;
|
||||
|
||||
private String CustomInfo;
|
||||
|
||||
private String AuthorizationCode;
|
||||
|
||||
private String ErrorCode;
|
||||
|
||||
private String ErrorDescription;
|
||||
|
||||
private String BankTransactionID;
|
||||
|
||||
private String AlertCode;
|
||||
|
||||
private String AlertDescription;
|
||||
|
||||
private String EncryptedString;
|
||||
|
||||
private String ToBeEncript;
|
||||
|
||||
private String Decripted;
|
||||
|
||||
private String TransactionResult;
|
||||
|
||||
private String ProtocolAuthServer = "";
|
||||
|
||||
private String DomainName = "";
|
||||
|
||||
private String separator;
|
||||
|
||||
private String errDescription;
|
||||
|
||||
private String errNumber;
|
||||
|
||||
private String Version = "2.0";
|
||||
|
||||
private String Min = "";
|
||||
|
||||
private String CVV = "";
|
||||
|
||||
private String country = "";
|
||||
|
||||
private String vbvrisp = "";
|
||||
|
||||
private String vbv = "";
|
||||
|
||||
public GestPayCrypt20() {
|
||||
this.ShopLogin = "";
|
||||
this.Currency = "";
|
||||
this.Amount = "";
|
||||
this.ShopTransactionID = "";
|
||||
this.BuyerName = "";
|
||||
this.BuyerEmail = "";
|
||||
this.Language = "";
|
||||
this.CustomInfo = "";
|
||||
this.AuthorizationCode = "";
|
||||
this.ErrorCode = "";
|
||||
this.ErrorDescription = "";
|
||||
this.BankTransactionID = "";
|
||||
this.AlertCode = "";
|
||||
this.AlertDescription = "";
|
||||
this.EncryptedString = "";
|
||||
this.ToBeEncript = "";
|
||||
this.Decripted = "";
|
||||
this.ProtocolAuthServer = "http://";
|
||||
this.DomainName = "ecomm.sella.it/CryptHTTP";
|
||||
this.separator = "*P1*";
|
||||
this.errDescription = "";
|
||||
this.errNumber = "0";
|
||||
this.Min = "";
|
||||
this.CVV = "";
|
||||
this.country = "";
|
||||
this.vbvrisp = "";
|
||||
this.vbv = "";
|
||||
}
|
||||
|
||||
public void SetShopLogin(String xstr) {
|
||||
this.ShopLogin = xstr;
|
||||
}
|
||||
|
||||
public void SetCurrency(String xstr) {
|
||||
this.Currency = xstr;
|
||||
}
|
||||
|
||||
public void SetAmount(String xstr) {
|
||||
this.Amount = xstr;
|
||||
}
|
||||
|
||||
public void SetShopTransactionID(String xstr) {
|
||||
this.ShopTransactionID = URLEncoder.encode(xstr.trim());
|
||||
}
|
||||
|
||||
public void SetMIN(String xstr) {
|
||||
this.Min = xstr;
|
||||
}
|
||||
|
||||
public void SetCVV(String xstr) {
|
||||
this.CVV = xstr;
|
||||
}
|
||||
|
||||
public void SetBuyerName(String xstr) {
|
||||
this.BuyerName = URLEncoder.encode(xstr.trim());
|
||||
}
|
||||
|
||||
public void SetBuyerEmail(String xstr) {
|
||||
this.BuyerEmail = xstr.trim();
|
||||
}
|
||||
|
||||
public void SetLanguage(String xstr) {
|
||||
this.Language = xstr.trim();
|
||||
}
|
||||
|
||||
public void SetCustomInfo(String xstr) {
|
||||
this.CustomInfo = URLEncoder.encode(xstr.trim());
|
||||
}
|
||||
|
||||
public void SetEncryptedString(String xstr) {
|
||||
this.EncryptedString = xstr;
|
||||
}
|
||||
|
||||
public String GetShopLogin() {
|
||||
return this.ShopLogin;
|
||||
}
|
||||
|
||||
public String GetCurrency() {
|
||||
return this.Currency;
|
||||
}
|
||||
|
||||
public String GetAmount() {
|
||||
return this.Amount;
|
||||
}
|
||||
|
||||
public String GetCountry() {
|
||||
return this.country;
|
||||
}
|
||||
|
||||
public String GetVBV() {
|
||||
return this.vbv;
|
||||
}
|
||||
|
||||
public String GetVBVrisp() {
|
||||
return this.vbvrisp;
|
||||
}
|
||||
|
||||
public String GetShopTransactionID() {
|
||||
String app = "";
|
||||
try {
|
||||
app = URLDecode(this.ShopTransactionID);
|
||||
} catch (Exception e) {}
|
||||
return app;
|
||||
}
|
||||
|
||||
public String GetBuyerName() {
|
||||
String appBuyername = "";
|
||||
try {
|
||||
appBuyername = URLDecode(this.BuyerName);
|
||||
} catch (Exception ex) {
|
||||
appBuyername = "errore";
|
||||
}
|
||||
return appBuyername;
|
||||
}
|
||||
|
||||
public String GetBuyerEmail() {
|
||||
return this.BuyerEmail;
|
||||
}
|
||||
|
||||
public String GetCustomInfo() {
|
||||
String appCustom = "";
|
||||
try {
|
||||
appCustom = URLDecode(this.CustomInfo);
|
||||
} catch (Exception e) {}
|
||||
return appCustom;
|
||||
}
|
||||
|
||||
public String GetAuthorizationCode() {
|
||||
return this.AuthorizationCode;
|
||||
}
|
||||
|
||||
public String GetErrorCode() {
|
||||
return this.ErrorCode;
|
||||
}
|
||||
|
||||
public String GetErrorDescription() {
|
||||
return this.ErrorDescription;
|
||||
}
|
||||
|
||||
public String GetBankTransactionID() {
|
||||
return this.BankTransactionID;
|
||||
}
|
||||
|
||||
public String GetTransactionResult() {
|
||||
return this.TransactionResult;
|
||||
}
|
||||
|
||||
public String GetAlertCode() {
|
||||
return this.AlertCode;
|
||||
}
|
||||
|
||||
public String GetAlertDescription() {
|
||||
return this.AlertDescription;
|
||||
}
|
||||
|
||||
public String GetEncryptedString() {
|
||||
return this.EncryptedString;
|
||||
}
|
||||
|
||||
public boolean Encrypt() {
|
||||
String sErr = "";
|
||||
this.ErrorCode = "0";
|
||||
this.ErrorDescription = "";
|
||||
try {
|
||||
if (this.ShopLogin.length() <= 0) {
|
||||
this.ErrorCode = "546";
|
||||
this.ErrorDescription = "IDshop not valid";
|
||||
return false;
|
||||
}
|
||||
if (this.Currency.length() <= 0) {
|
||||
this.ErrorCode = "552";
|
||||
this.ErrorDescription = "Currency not valid";
|
||||
return false;
|
||||
}
|
||||
if (this.Amount.length() <= 0) {
|
||||
this.ErrorCode = "553";
|
||||
this.ErrorDescription = "Amount not valid";
|
||||
return false;
|
||||
}
|
||||
if (this.ShopTransactionID.length() <= 0) {
|
||||
this.ErrorCode = "551";
|
||||
this.ErrorDescription = "Shop Transaction ID not valid";
|
||||
return false;
|
||||
}
|
||||
this.ToBeEncript = "";
|
||||
if (this.CVV.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_CVV=" + this.separator;
|
||||
if (this.Min.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_MIN=" + this.separator;
|
||||
if (this.Currency.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_UICCODE=" + this.separator;
|
||||
if (this.Amount.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_AMOUNT=" + this.separator;
|
||||
if (this.ShopTransactionID.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_SHOPTRANSACTIONID=" + this.separator;
|
||||
if (this.BuyerName.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_CHNAME=" + this.separator;
|
||||
if (this.BuyerEmail.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_CHEMAIL=" + this.separator;
|
||||
if (this.Language.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_IDLANGUAGE=" + this.separator;
|
||||
if (this.CustomInfo.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + this.separator;
|
||||
String urlString = this.ProtocolAuthServer + this.ProtocolAuthServer + "/Encrypt.asp?a=" + this.DomainName + "&b=" + this.ShopLogin + "&c=" + this.ToBeEncript.substring(4, this.ToBeEncript.length());
|
||||
URL url = new URL(urlString);
|
||||
URLConnection connection = url.openConnection();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
int nStart = 0;
|
||||
int nEnd = 0;
|
||||
String line = "";
|
||||
while (line != null) {
|
||||
line = in.readLine();
|
||||
if (line != null) {
|
||||
nStart = line.indexOf("#cryptstring#");
|
||||
nEnd = line.lastIndexOf("#/cryptstring#");
|
||||
if (((nStart != -1) ? true : false) & ((nEnd > nStart + 14) ? true : false))
|
||||
this.EncryptedString = line.substring(nStart + 13, nEnd);
|
||||
nStart = line.indexOf("#error#");
|
||||
nEnd = line.lastIndexOf("#/error#");
|
||||
if (((nStart != -1) ? true : false) & ((nEnd > nStart + 8) ? true : false)) {
|
||||
sErr = line.substring(nStart + 7, nEnd);
|
||||
int intsep = sErr.indexOf("-");
|
||||
this.ErrorCode = sErr.substring(0, intsep);
|
||||
this.ErrorDescription = sErr.substring(intsep + 1, sErr.length());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
return true;
|
||||
} catch (MalformedURLException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Bad URL";
|
||||
return false;
|
||||
} catch (UnknownServiceException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "ServiceException occurred.";
|
||||
return false;
|
||||
} catch (IOException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Bad URL Request";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean Decrypt() {
|
||||
this.ErrorCode = "0";
|
||||
this.ErrorDescription = "";
|
||||
String strdaelim = "";
|
||||
if (this.ShopLogin.length() <= 0) {
|
||||
this.ErrorCode = "546";
|
||||
this.ErrorDescription = "IDshop not valid";
|
||||
return false;
|
||||
}
|
||||
if (this.EncryptedString.length() <= 0) {
|
||||
this.ErrorCode = "1009";
|
||||
this.ErrorDescription = "String to Decrypt not valid";
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
String urlString = this.ProtocolAuthServer + this.ProtocolAuthServer + "/Decrypt.asp?a=" + this.DomainName + "&b=" + this.ShopLogin + "&c=" + this.EncryptedString;
|
||||
URL url = new URL(urlString);
|
||||
URLConnection connection = url.openConnection();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
int nStart = 0;
|
||||
int nEnd = 0;
|
||||
String line = "";
|
||||
while (line != null) {
|
||||
line = in.readLine();
|
||||
if (line != null) {
|
||||
nStart = line.indexOf("#decryptstring#");
|
||||
nEnd = line.lastIndexOf("#/decryptstring#");
|
||||
if (((nStart != -1) ? true : false) & ((nEnd > nStart + 16) ? true : false))
|
||||
this.Decripted = line.substring(nStart + 15, nEnd);
|
||||
nStart = line.indexOf("#error#");
|
||||
nEnd = line.lastIndexOf("#/error#");
|
||||
if (((nStart != -1) ? true : false) & ((nEnd > nStart + 8) ? true : false)) {
|
||||
String sErr = line.substring(nStart + 7, nEnd);
|
||||
int intsep = sErr.indexOf("-");
|
||||
this.ErrorCode = sErr.substring(0, intsep);
|
||||
this.ErrorDescription = sErr.substring(intsep + 1, sErr.length());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
if (this.Decripted.trim() == "") {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Void String";
|
||||
return false;
|
||||
}
|
||||
if (!Parsing(this.Decripted))
|
||||
return false;
|
||||
return true;
|
||||
} catch (MalformedURLException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Bad URL";
|
||||
return false;
|
||||
} catch (UnknownServiceException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Service Exception occurred.";
|
||||
return false;
|
||||
} catch (IOException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Bad URL Request";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean Parsing(String StringToBeParsed) {
|
||||
int nStart = 0;
|
||||
int nEnd = 0;
|
||||
this.ErrorCode = "";
|
||||
this.ErrorDescription = "";
|
||||
try {
|
||||
nStart = StringToBeParsed.indexOf("PAY1_UICCODE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.Currency = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.Currency = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_AMOUNT");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.Amount = StringToBeParsed.substring(nStart + 12, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.Amount = StringToBeParsed.substring(nStart + 12, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_SHOPTRANSACTIONID");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.ShopTransactionID = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.ShopTransactionID = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_CHNAME");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.BuyerName = StringToBeParsed.substring(nStart + 12, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.BuyerName = StringToBeParsed.substring(nStart + 12, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_CHEMAIL");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.BuyerEmail = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.BuyerEmail = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_AUTHORIZATIONCODE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.AuthorizationCode = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.AuthorizationCode = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_ERRORCODE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.ErrorCode = StringToBeParsed.substring(nStart + 15, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.ErrorCode = StringToBeParsed.substring(nStart + 15, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_ERRORDESCRIPTION");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.ErrorDescription = StringToBeParsed.substring(nStart + 22, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.ErrorDescription = StringToBeParsed.substring(nStart + 22, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_BANKTRANSACTIONID");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.BankTransactionID = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.BankTransactionID = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_ALERTCODE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.AlertCode = StringToBeParsed.substring(nStart + 15, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.AlertCode = StringToBeParsed.substring(nStart + 15, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_ALERTDESCRIPTION");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.AlertDescription = StringToBeParsed.substring(nStart + 22, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.AlertDescription = StringToBeParsed.substring(nStart + 22, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_COUNTRY");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.country = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.country = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_VBVRISP");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.vbvrisp = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.vbvrisp = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_VBV");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.vbv = StringToBeParsed.substring(nStart + 9, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.vbv = StringToBeParsed.substring(nStart + 9, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_IDLANGUAGE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.Language = StringToBeParsed.substring(nStart + 16, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.Language = StringToBeParsed.substring(nStart + 16, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_TRANSACTIONRESULT");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.TransactionResult = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.TransactionResult = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
this.CustomInfo = StringToBeParsed.trim();
|
||||
} catch (Exception e) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Error parsing String";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public String URLDecode(String str) throws Exception {
|
||||
if (str == null)
|
||||
return null;
|
||||
char[] res = new char[str.length()];
|
||||
int didx = 0;
|
||||
for (int sidx = 0; sidx < str.length(); sidx++) {
|
||||
char ch = str.charAt(sidx);
|
||||
if (ch == '+') {
|
||||
res[didx++] = ' ';
|
||||
} else if (ch == '%') {
|
||||
try {
|
||||
res[didx++] =
|
||||
(char)Integer.parseInt(str.substring(sidx + 1, sidx + 3), 16);
|
||||
sidx += 2;
|
||||
} catch (NumberFormatException e) {
|
||||
didx--;
|
||||
res[didx++] = ch;
|
||||
}
|
||||
} else {
|
||||
res[didx++] = ch;
|
||||
}
|
||||
}
|
||||
return String.valueOf(res, 0, didx);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
package it.acxent.bank.sella;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
import it.acxent.common.Parm;
|
||||
import it.acxent.common.StatusMsg;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
|
||||
public class SellaReq extends _BankAdapter {
|
||||
public static final String LANG_CODE_IT = "1";
|
||||
|
||||
public static final String LANG_CODE_EN = "2";
|
||||
|
||||
public static final String LANG_CODE_ES = "3";
|
||||
|
||||
public static final String LANG_CODE_FR = "4";
|
||||
|
||||
public static final String LANG_CODE_DE = "5";
|
||||
|
||||
public static final String DIV_CODE_LIRA = "18";
|
||||
|
||||
public static final String DIV_CODE_EURO = "242";
|
||||
|
||||
public static final String P_COD_ESER_SELLA = "COD_ESER_SELLA";
|
||||
|
||||
public static final String P_SELLA_FULL = "SELLA_FULL";
|
||||
|
||||
public static final String DIV_CODE_STERLINE = "2";
|
||||
|
||||
public static final String DIV_CODE_YEN = "71";
|
||||
|
||||
public static final String DIV_CODE_DOLLARL_HK = "103";
|
||||
|
||||
public static final String DIV_CODE_REAL = "234";
|
||||
|
||||
private String myshoplogin;
|
||||
|
||||
private String mycurrency;
|
||||
|
||||
private String myamount;
|
||||
|
||||
private String myshoptransactionID;
|
||||
|
||||
private String mybuyername;
|
||||
|
||||
private String mybuyeremail;
|
||||
|
||||
private String mylanguage;
|
||||
|
||||
private String lang;
|
||||
|
||||
private String mycustominfo;
|
||||
|
||||
public static final String P_PAYMENT_OK_PAGE = "SELLA_OK";
|
||||
|
||||
public static final String P_PAYMENT_ERROR_PAGE = "SELLA_KO";
|
||||
|
||||
public static final String DIV_CODE_DOLLARI = "1";
|
||||
|
||||
public String getMyamount() {
|
||||
return (this.myamount == null) ? "" : this.myamount;
|
||||
}
|
||||
|
||||
public void setMyamount(String myamount) {
|
||||
this.myamount = myamount;
|
||||
}
|
||||
|
||||
public String getMybuyeremail() {
|
||||
return (this.mybuyeremail == null) ? "" : this.mybuyeremail;
|
||||
}
|
||||
|
||||
public void setMybuyeremail(String mybuyeremail) {
|
||||
this.mybuyeremail = mybuyeremail;
|
||||
}
|
||||
|
||||
public String getMybuyername() {
|
||||
return (this.mybuyername == null) ? "" : this.mybuyername;
|
||||
}
|
||||
|
||||
public void setMybuyername(String mybuyername) {
|
||||
this.mybuyername = mybuyername;
|
||||
}
|
||||
|
||||
public String getMycurrency() {
|
||||
return (this.mycurrency == null) ? "" : this.mycurrency;
|
||||
}
|
||||
|
||||
public void setMycurrency(String mycurrency) {
|
||||
this.mycurrency = mycurrency;
|
||||
}
|
||||
|
||||
public String getMycustominfo() {
|
||||
return (this.mycustominfo == null) ? "" : this.mycustominfo;
|
||||
}
|
||||
|
||||
public void setMycustominfo(String mycustominfo) {
|
||||
this.mycustominfo = mycustominfo;
|
||||
}
|
||||
|
||||
public String getMylanguage() {
|
||||
if (this.mylanguage == null || this.mylanguage.isEmpty())
|
||||
this.mylanguage = getMylanguageCode();
|
||||
return this.mylanguage;
|
||||
}
|
||||
|
||||
private String getMylanguageCode() {
|
||||
if (getLang().toLowerCase().equals("it"))
|
||||
return "1";
|
||||
if (getLang().toLowerCase().equals("en"))
|
||||
return "2";
|
||||
if (getLang().toLowerCase().equals("es"))
|
||||
return "3";
|
||||
if (getLang().toLowerCase().equals("fr"))
|
||||
return "4";
|
||||
if (getLang().toLowerCase().equals("de"))
|
||||
return "5";
|
||||
return "2";
|
||||
}
|
||||
|
||||
public String getMyshoplogin() {
|
||||
return (this.myshoplogin == null) ? "" : this.myshoplogin;
|
||||
}
|
||||
|
||||
public void setMyshoplogin(String myshoplogin) {
|
||||
this.myshoplogin = myshoplogin;
|
||||
}
|
||||
|
||||
public String getMyshoptransactionID() {
|
||||
return (this.myshoptransactionID == null) ? "" : this.myshoptransactionID;
|
||||
}
|
||||
|
||||
public void setMyshoptransactionID(String myshoptransactionID) {
|
||||
this.myshoptransactionID = myshoptransactionID;
|
||||
}
|
||||
|
||||
public void setMylanguage(String mylanguage) {
|
||||
this.mylanguage = mylanguage;
|
||||
}
|
||||
|
||||
public String getLang() {
|
||||
return (this.lang == null) ? "" : this.lang;
|
||||
}
|
||||
|
||||
public void setLang(String lang) {
|
||||
this.lang = lang;
|
||||
}
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
boolean debug = false;
|
||||
if (ap != null) {
|
||||
DBAdapter.logDebug(debug, "SELLA chechout initParms: start");
|
||||
String l_tipoParm = "SELLA";
|
||||
StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm);
|
||||
Parm bean = new Parm(ap);
|
||||
bean.findByCodice("COD_ESER_SELLA");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("COD_ESER_SELLA");
|
||||
bean.setDescrizione("COD_ESER_SELLA");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("CODICE ESERCENTE BANCA SELLA");
|
||||
bean.save();
|
||||
bean.findByCodice("SELLA_FULL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("SELLA_FULL");
|
||||
bean.setDescrizione("SELLA_FULL");
|
||||
bean.setFlgTipo(5L);
|
||||
bean.setNota("SPECIFICA SE IL CONTRATTO CON SELLA E' DI TIPO FULL");
|
||||
bean.save();
|
||||
bean.findByCodice("SELLA_KO");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("SELLA_KO");
|
||||
bean.setDescrizione("SELLA_KO");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payRes.jsp");
|
||||
bean.setNota("SELLA_KO");
|
||||
bean.save();
|
||||
bean.findByCodice("SELLA_OK");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("SELLA_OK");
|
||||
bean.setDescrizione("SELLA_OK");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payRes.jsp");
|
||||
bean.setNota("SELLA_OK");
|
||||
bean.save();
|
||||
DBAdapter.logDebug(debug, "SELLA chechout initParms: stop");
|
||||
StatusMsg.deleteMsgByTag(ap, "INIT");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,185 @@
|
|||
package it.acxent.bank.sella;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
|
||||
public class SellaResp extends _BankAdapter {
|
||||
private String myshoplogin;
|
||||
|
||||
private int mycurrency;
|
||||
|
||||
private float myamount;
|
||||
|
||||
private String myshoptrxID;
|
||||
|
||||
private String mybuyername;
|
||||
|
||||
private String mybuyeremail;
|
||||
|
||||
private String mytrxresult;
|
||||
|
||||
private String myauthcode;
|
||||
|
||||
private String myerrorcode;
|
||||
|
||||
private String myerrordescription;
|
||||
|
||||
private String myerrorbanktrxid;
|
||||
|
||||
private long id_ordine;
|
||||
|
||||
private String myalertcode;
|
||||
|
||||
private String myalertdescription;
|
||||
|
||||
private String mycustominfo;
|
||||
|
||||
public SellaResp() {}
|
||||
|
||||
public SellaResp(GestPayCrypt bean) {
|
||||
fillResponse(bean);
|
||||
}
|
||||
|
||||
public String getMyalertcode() {
|
||||
return (this.myalertcode == null) ? "" : this.myalertcode;
|
||||
}
|
||||
|
||||
public void fillResponse(GestPayCrypt bean) {
|
||||
setMyshoplogin(bean.getShopLogin().trim());
|
||||
if (!bean.getCurrency().isEmpty())
|
||||
setMycurrency(Integer.parseInt(bean.getCurrency()));
|
||||
if (!bean.getAmount().isEmpty())
|
||||
setMyamount(Float.parseFloat(bean.getAmount()));
|
||||
setMyshoptrxID(bean.getShopTransactionID().trim());
|
||||
setMybuyername(bean.getBuyerName().trim());
|
||||
setMybuyeremail(bean.getBuyerEmail().trim());
|
||||
setMytrxresult(bean.getTransactionResult().trim());
|
||||
setMyauthcode(bean.getAuthorizationCode());
|
||||
setMyerrorcode(bean.getErrorCode());
|
||||
setMyerrordescription(bean.getErrorDescription().trim());
|
||||
setMyerrorbanktrxid(bean.getBankTransactionID().trim());
|
||||
setMyalertcode(bean.getAlertCode().trim());
|
||||
setMyalertdescription(bean.getAlertDescription().trim());
|
||||
setMycustominfo(bean.getCustomInfo().trim());
|
||||
if (!bean.getShopTransactionID().isEmpty())
|
||||
setId_ordine(Long.parseLong(bean.getShopTransactionID()));
|
||||
}
|
||||
|
||||
public void setMyalertcode(String myalertcode) {
|
||||
this.myalertcode = myalertcode;
|
||||
}
|
||||
|
||||
public String getMyalertdescription() {
|
||||
return (this.myalertdescription == null) ? "" :
|
||||
this.myalertdescription;
|
||||
}
|
||||
|
||||
public void setMyalertdescription(String myalertdescription) {
|
||||
this.myalertdescription = myalertdescription;
|
||||
}
|
||||
|
||||
public float getMyamount() {
|
||||
return this.myamount;
|
||||
}
|
||||
|
||||
public void setMyamount(float myamount) {
|
||||
this.myamount = myamount;
|
||||
}
|
||||
|
||||
public String getMyauthcode() {
|
||||
return (this.myauthcode == null) ? "" : this.myauthcode;
|
||||
}
|
||||
|
||||
public void setMyauthcode(String myauthcode) {
|
||||
this.myauthcode = myauthcode;
|
||||
}
|
||||
|
||||
public String getMybuyeremail() {
|
||||
return (this.mybuyeremail == null) ? "" : this.mybuyeremail;
|
||||
}
|
||||
|
||||
public void setMybuyeremail(String mybuyeremail) {
|
||||
this.mybuyeremail = mybuyeremail;
|
||||
}
|
||||
|
||||
public String getMybuyername() {
|
||||
return (this.mybuyername == null) ? "" : this.mybuyername;
|
||||
}
|
||||
|
||||
public void setMybuyername(String mybuyername) {
|
||||
this.mybuyername = mybuyername;
|
||||
}
|
||||
|
||||
public int getMycurrency() {
|
||||
return this.mycurrency;
|
||||
}
|
||||
|
||||
public void setMycurrency(int mycurrency) {
|
||||
this.mycurrency = mycurrency;
|
||||
}
|
||||
|
||||
public String getMycustominfo() {
|
||||
return (this.mycustominfo == null) ? "" : this.mycustominfo;
|
||||
}
|
||||
|
||||
public void setMycustominfo(String mycustominfo) {
|
||||
this.mycustominfo = mycustominfo;
|
||||
}
|
||||
|
||||
public String getMyerrorbanktrxid() {
|
||||
return (this.myerrorbanktrxid == null) ? "" :
|
||||
this.myerrorbanktrxid;
|
||||
}
|
||||
|
||||
public void setMyerrorbanktrxid(String myerrorbanktrxid) {
|
||||
this.myerrorbanktrxid = myerrorbanktrxid;
|
||||
}
|
||||
|
||||
public String getMyerrorcode() {
|
||||
return (this.myerrorcode == null) ? "" : this.myerrorcode;
|
||||
}
|
||||
|
||||
public void setMyerrorcode(String myerrorcode) {
|
||||
this.myerrorcode = myerrorcode;
|
||||
}
|
||||
|
||||
public String getMyerrordescription() {
|
||||
return (this.myerrordescription == null) ? "" :
|
||||
this.myerrordescription;
|
||||
}
|
||||
|
||||
public void setMyerrordescription(String myerrordescription) {
|
||||
this.myerrordescription = myerrordescription;
|
||||
}
|
||||
|
||||
public String getMyshoplogin() {
|
||||
return (this.myshoplogin == null) ? "" : this.myshoplogin;
|
||||
}
|
||||
|
||||
public void setMyshoplogin(String myshoplogin) {
|
||||
this.myshoplogin = myshoplogin;
|
||||
}
|
||||
|
||||
public String getMyshoptrxID() {
|
||||
return (this.myshoptrxID == null) ? "" : this.myshoptrxID;
|
||||
}
|
||||
|
||||
public void setMyshoptrxID(String myshoptrxID) {
|
||||
this.myshoptrxID = myshoptrxID;
|
||||
}
|
||||
|
||||
public String getMytrxresult() {
|
||||
return (this.mytrxresult == null) ? "" : this.mytrxresult;
|
||||
}
|
||||
|
||||
public void setMytrxresult(String mytrxresult) {
|
||||
this.mytrxresult = mytrxresult;
|
||||
}
|
||||
|
||||
public long getId_ordine() {
|
||||
return this.id_ordine;
|
||||
}
|
||||
|
||||
public void setId_ordine(long id_ordine) {
|
||||
this.id_ordine = id_ordine;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,184 @@
|
|||
package it.acxent.bank.sellaPCredit;
|
||||
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.db.WcString;
|
||||
import it.acxent.util.Vectumerator;
|
||||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class ConselTabfin extends DBAdapter implements Serializable {
|
||||
public static final double MIN_FIN = 168.0D;
|
||||
|
||||
public static final double MAX_FIN = 7500.0D;
|
||||
|
||||
private long id_conselTabfin;
|
||||
|
||||
private String flgTipo;
|
||||
|
||||
private double valoreBene;
|
||||
|
||||
private long durata;
|
||||
|
||||
private double importoRata;
|
||||
|
||||
private double tan;
|
||||
|
||||
private double taeg;
|
||||
|
||||
private double interessi;
|
||||
|
||||
private double speseGestSingolaRata;
|
||||
|
||||
private double speseGestTotaleRata;
|
||||
|
||||
private double impostaBollo;
|
||||
|
||||
private double importoTotaleDovuto;
|
||||
|
||||
public ConselTabfin(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public ConselTabfin() {}
|
||||
|
||||
public void setId_conselTabfin(long newId_conselTabfin) {
|
||||
this.id_conselTabfin = newId_conselTabfin;
|
||||
}
|
||||
|
||||
public void setFlgTipo(String newFlgTipo) {
|
||||
this.flgTipo = newFlgTipo;
|
||||
}
|
||||
|
||||
public void setValoreBene(double newValoreBene) {
|
||||
this.valoreBene = newValoreBene;
|
||||
}
|
||||
|
||||
public void setDurata(long newDurata) {
|
||||
this.durata = newDurata;
|
||||
}
|
||||
|
||||
public void setImportoRata(double newImportoRata) {
|
||||
this.importoRata = newImportoRata;
|
||||
}
|
||||
|
||||
public void setTan(double newTan) {
|
||||
this.tan = newTan;
|
||||
}
|
||||
|
||||
public void setTaeg(double newTaeg) {
|
||||
this.taeg = newTaeg;
|
||||
}
|
||||
|
||||
public void setInteressi(double newInteressi) {
|
||||
this.interessi = newInteressi;
|
||||
}
|
||||
|
||||
public void setSpeseGestSingolaRata(double newSpeseGestSingolaRata) {
|
||||
this.speseGestSingolaRata = newSpeseGestSingolaRata;
|
||||
}
|
||||
|
||||
public void setSpeseGestTotaleRata(double newSpeseGestTotaleRata) {
|
||||
this.speseGestTotaleRata = newSpeseGestTotaleRata;
|
||||
}
|
||||
|
||||
public void setImpostaBollo(double newImpostaBollo) {
|
||||
this.impostaBollo = newImpostaBollo;
|
||||
}
|
||||
|
||||
public void setImportoTotaleDovuto(double newImportoTotaleDovuto) {
|
||||
this.importoTotaleDovuto = newImportoTotaleDovuto;
|
||||
}
|
||||
|
||||
public long getId_conselTabfin() {
|
||||
return this.id_conselTabfin;
|
||||
}
|
||||
|
||||
public String getFlgTipo() {
|
||||
return (this.flgTipo == null) ? "" : this.flgTipo.trim();
|
||||
}
|
||||
|
||||
public double getValoreBene() {
|
||||
return this.valoreBene;
|
||||
}
|
||||
|
||||
public long getDurata() {
|
||||
return this.durata;
|
||||
}
|
||||
|
||||
public double getImportoRata() {
|
||||
return this.importoRata;
|
||||
}
|
||||
|
||||
public double getTan() {
|
||||
return this.tan;
|
||||
}
|
||||
|
||||
public double getTaeg() {
|
||||
return this.taeg;
|
||||
}
|
||||
|
||||
public double getInteressi() {
|
||||
return this.interessi;
|
||||
}
|
||||
|
||||
public double getSpeseGestSingolaRata() {
|
||||
return this.speseGestSingolaRata;
|
||||
}
|
||||
|
||||
public double getSpeseGestTotaleRata() {
|
||||
return this.speseGestTotaleRata;
|
||||
}
|
||||
|
||||
public double getImpostaBollo() {
|
||||
return this.impostaBollo;
|
||||
}
|
||||
|
||||
public double getImportoTotaleDovuto() {
|
||||
return this.importoTotaleDovuto;
|
||||
}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void deleteCascade() {}
|
||||
|
||||
public Vectumerator findByCR(ConselTabfinCR CR, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select A.* from CONSEL_TABFIN AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
if (CR.getValoreBene() > 0.0D)
|
||||
wc.addWc("A.valoreBene=" + CR.getValoreBene());
|
||||
if (!CR.getFlgTipo().isEmpty())
|
||||
wc.addWc("A.flgTipo='" + CR.getFlgTipo() + "'");
|
||||
if (CR.getDurata() > 0L)
|
||||
wc.addWc("A.durata=" + CR.getDurata());
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public void findByTipoValoreDurata(String l_flgTipo, double l_valore, long l_durata) {
|
||||
String s_Sql_Find = "select A.* from CONSEL_TABFIN AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.valoreBene=" + Math.round(l_valore));
|
||||
wc.addWc("A.flgTipo='" + l_flgTipo + "'");
|
||||
wc.addWc("A.durata=" + l_durata);
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
findFirstRecord(stmt);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
package it.acxent.bank.sellaPCredit;
|
||||
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
|
||||
public class ConselTabfinCR extends CRAdapter {
|
||||
private long id_conselTabfin;
|
||||
|
||||
private String flgTipo;
|
||||
|
||||
private double valoreBene;
|
||||
|
||||
private long durata;
|
||||
|
||||
private double importoRata;
|
||||
|
||||
private double tan;
|
||||
|
||||
private double taeg;
|
||||
|
||||
private double interessi;
|
||||
|
||||
private double speseGestSingolaRata;
|
||||
|
||||
private double speseGestTotaleRata;
|
||||
|
||||
private double impostaBollo;
|
||||
|
||||
private double importoTotaleDovuto;
|
||||
|
||||
public ConselTabfinCR(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public ConselTabfinCR() {}
|
||||
|
||||
public void setId_conselTabfin(long newId_conselTabfin) {
|
||||
this.id_conselTabfin = newId_conselTabfin;
|
||||
}
|
||||
|
||||
public void setFlgTipo(String newFlgTipo) {
|
||||
this.flgTipo = newFlgTipo;
|
||||
}
|
||||
|
||||
public void setValoreBene(double newValoreBene) {
|
||||
this.valoreBene = newValoreBene;
|
||||
}
|
||||
|
||||
public void setDurata(long newDurata) {
|
||||
this.durata = newDurata;
|
||||
}
|
||||
|
||||
public void setImportoRata(double newImportoRata) {
|
||||
this.importoRata = newImportoRata;
|
||||
}
|
||||
|
||||
public void setTan(double newTan) {
|
||||
this.tan = newTan;
|
||||
}
|
||||
|
||||
public void setTaeg(double newTaeg) {
|
||||
this.taeg = newTaeg;
|
||||
}
|
||||
|
||||
public void setInteressi(double newInteressi) {
|
||||
this.interessi = newInteressi;
|
||||
}
|
||||
|
||||
public void setSpeseGestSingolaRata(double newSpeseGestSingolaRata) {
|
||||
this.speseGestSingolaRata = newSpeseGestSingolaRata;
|
||||
}
|
||||
|
||||
public void setSpeseGestTotaleRata(double newSpeseGestTotaleRata) {
|
||||
this.speseGestTotaleRata = newSpeseGestTotaleRata;
|
||||
}
|
||||
|
||||
public void setImpostaBollo(double newImpostaBollo) {
|
||||
this.impostaBollo = newImpostaBollo;
|
||||
}
|
||||
|
||||
public void setImportoTotaleDovuto(double newImportoTotaleDovuto) {
|
||||
this.importoTotaleDovuto = newImportoTotaleDovuto;
|
||||
}
|
||||
|
||||
public long getId_conselTabfin() {
|
||||
return this.id_conselTabfin;
|
||||
}
|
||||
|
||||
public String getFlgTipo() {
|
||||
return (this.flgTipo == null) ? "" : this.flgTipo.trim();
|
||||
}
|
||||
|
||||
public double getValoreBene() {
|
||||
return this.valoreBene;
|
||||
}
|
||||
|
||||
public long getDurata() {
|
||||
return this.durata;
|
||||
}
|
||||
|
||||
public double getImportoRata() {
|
||||
return this.importoRata;
|
||||
}
|
||||
|
||||
public double getTan() {
|
||||
return this.tan;
|
||||
}
|
||||
|
||||
public double getTaeg() {
|
||||
return this.taeg;
|
||||
}
|
||||
|
||||
public double getInteressi() {
|
||||
return this.interessi;
|
||||
}
|
||||
|
||||
public double getSpeseGestSingolaRata() {
|
||||
return this.speseGestSingolaRata;
|
||||
}
|
||||
|
||||
public double getSpeseGestTotaleRata() {
|
||||
return this.speseGestTotaleRata;
|
||||
}
|
||||
|
||||
public double getImpostaBollo() {
|
||||
return this.impostaBollo;
|
||||
}
|
||||
|
||||
public double getImportoTotaleDovuto() {
|
||||
return this.importoTotaleDovuto;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,369 @@
|
|||
package it.acxent.bank.sellaPCredit;
|
||||
|
||||
import it.acxent.common.Parm;
|
||||
import it.acxent.common.StatusMsg;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
|
||||
public class SellaPCreditReq {
|
||||
public static final String P_COD_TIPO_PRODOTTO_SELLA_P_CREDIT = "COD_TIPO_PRODOTTO_SELLA_P_CREDIT";
|
||||
|
||||
private String tipoesec;
|
||||
|
||||
private String tabellaFinanziaria;
|
||||
|
||||
private String cognome;
|
||||
|
||||
private String nome;
|
||||
|
||||
private String indirizzo;
|
||||
|
||||
private String cellulare;
|
||||
|
||||
private String pref_num;
|
||||
|
||||
private String data_nascita;
|
||||
|
||||
private String indirizzo_mail;
|
||||
|
||||
private ApplParmFull ap;
|
||||
|
||||
private String ordine;
|
||||
|
||||
private String descrizioneBene;
|
||||
|
||||
private String anticipoS;
|
||||
|
||||
private String codiceMerce;
|
||||
|
||||
private String codiceProdotto;
|
||||
|
||||
private String codiceConvenzionato;
|
||||
|
||||
private String importoDaFinanziare;
|
||||
|
||||
public static final String SELLA_P_CREDIT_TAB_FIN_90 = "WIP";
|
||||
|
||||
private double anticipo;
|
||||
|
||||
private String impspe;
|
||||
|
||||
private String codiceFiscale;
|
||||
|
||||
private String numeroTelefono;
|
||||
|
||||
private String commissioni;
|
||||
|
||||
public static final String P_SELLA_P_CREDIT_IMPORTO_MINIMO = "SELLA_P_CREDIT_IMPORTO_MINIMO";
|
||||
|
||||
public static final String P_SELLA_P_CREDIT_TEST = "SELLA_P_CREDIT_TEST";
|
||||
|
||||
public static final String P_SELLA_P_CREDIT_OK_PAGE = "SELLA_P_CREDIT_OK_PAGE";
|
||||
|
||||
public static final String SELLA_P_CREDIT_TAB_FIN_TASSO_0 = "MPF";
|
||||
|
||||
public static final String SELLA_P_CREDIT_TAB_FIN_30 = "WIN";
|
||||
|
||||
public static final String REQUEST_SERVER = "https://secure.sellapersonalcredit.it/econsel/public/entry/pf";
|
||||
|
||||
public static final String REQUEST_SERVER_TEST = "https://sandbox.sellapersonalcredit.it/econsel/public/entry/pf";
|
||||
|
||||
public static final String P_COD_TIPO_MERCE_SELLA_P_CREDIT = "COD_TIPO_MERCE_SELLA_P_CREDIT";
|
||||
|
||||
public static final String P_COD_CONVENZIONE_SELLA_P_CREDIT = "COD_CONVENZIONE_SELLA_P_CREDIT";
|
||||
|
||||
public static final String P_SELLA_P_CREDIT_ERROR_PAGE = "SELLA_P_CREDIT_ERROR_PAGE";
|
||||
|
||||
public static final String P_SELLA_P_CREDIT_RATA0 = "SELLA_P_CREDIT_RATA0";
|
||||
|
||||
public SellaPCreditReq(ApplParmFull l_ap) {
|
||||
setAp(l_ap);
|
||||
}
|
||||
|
||||
public SellaPCreditReq() {}
|
||||
|
||||
public String getTipoesec() {
|
||||
return "T";
|
||||
}
|
||||
|
||||
public void setTipoesec(String tipoesec) {
|
||||
this.tipoesec = tipoesec;
|
||||
}
|
||||
|
||||
public String getTabellaFinanziaria() {
|
||||
if (isTest())
|
||||
return "WIN";
|
||||
return (this.tabellaFinanziaria == null) ? "" : this.tabellaFinanziaria.trim();
|
||||
}
|
||||
|
||||
public void setTabellaFinanziaria(String tabfin) {
|
||||
this.tabellaFinanziaria = tabfin;
|
||||
}
|
||||
|
||||
public String getCognome() {
|
||||
return (this.cognome == null) ? "" : this.cognome.trim();
|
||||
}
|
||||
|
||||
public void setCognome(String cognome) {
|
||||
this.cognome = cognome;
|
||||
}
|
||||
|
||||
public String getNome() {
|
||||
return (this.nome == null) ? "" : this.nome.trim();
|
||||
}
|
||||
|
||||
public void setNome(String nome) {
|
||||
this.nome = nome;
|
||||
}
|
||||
|
||||
public String getIndirizzo() {
|
||||
return (this.indirizzo == null) ? "" : this.indirizzo.trim();
|
||||
}
|
||||
|
||||
public void setIndirizzo(String indirizzo) {
|
||||
this.indirizzo = indirizzo;
|
||||
}
|
||||
|
||||
public String getNumeroTelefono() {
|
||||
return (this.numeroTelefono == null) ? "" : this.numeroTelefono.trim();
|
||||
}
|
||||
|
||||
public void setNumeroTelefono(String tel_num) {
|
||||
this.numeroTelefono = tel_num;
|
||||
}
|
||||
|
||||
public String getPref_num() {
|
||||
return (this.pref_num == null) ? "" : this.pref_num.trim();
|
||||
}
|
||||
|
||||
public void setPref_num(String pref_num) {
|
||||
this.pref_num = pref_num;
|
||||
}
|
||||
|
||||
public String getData_nascita() {
|
||||
return (this.data_nascita == null) ? "" : this.data_nascita.trim();
|
||||
}
|
||||
|
||||
public void setData_nascita(String data_nascita) {
|
||||
this.data_nascita = data_nascita;
|
||||
}
|
||||
|
||||
public String getIndirizzo_mail() {
|
||||
return (this.indirizzo_mail == null) ? "" : this.indirizzo_mail.trim();
|
||||
}
|
||||
|
||||
public void setIndirizzo_mail(String testomail) {
|
||||
this.indirizzo_mail = testomail;
|
||||
}
|
||||
|
||||
public String getCodiceFiscale() {
|
||||
return (this.codiceFiscale == null) ? "" : this.codiceFiscale.trim();
|
||||
}
|
||||
|
||||
public void setCodiceFiscale(String codfisc) {
|
||||
this.codiceFiscale = codfisc;
|
||||
}
|
||||
|
||||
public String getOrdine() {
|
||||
return (this.ordine == null) ? "" : this.ordine.trim();
|
||||
}
|
||||
|
||||
public void setOrdine(String ordine) {
|
||||
this.ordine = ordine;
|
||||
}
|
||||
|
||||
public String getDescrizioneBene() {
|
||||
return (this.descrizioneBene == null) ? "" : this.descrizioneBene.trim();
|
||||
}
|
||||
|
||||
public void setDescrizioneBene(String descri1) {
|
||||
this.descrizioneBene = descri1;
|
||||
}
|
||||
|
||||
public String getAnticipoS() {
|
||||
return (this.anticipoS == null) ? "" : this.anticipoS;
|
||||
}
|
||||
|
||||
public void setAnticipoS(String parz1) {
|
||||
this.anticipoS = parz1;
|
||||
}
|
||||
|
||||
public String getCodiceMerce() {
|
||||
if (isTest())
|
||||
return "HT";
|
||||
if (this.codiceMerce == null)
|
||||
this.codiceMerce = getApFull().getParm("COD_TIPO_MERCE_SELLA_P_CREDIT").getTesto();
|
||||
return this.codiceMerce;
|
||||
}
|
||||
|
||||
public boolean isTest() {
|
||||
return getApFull().getParm("SELLA_P_CREDIT_TEST").isTrue();
|
||||
}
|
||||
|
||||
public void setCodiceMerce(String h_merce) {
|
||||
this.codiceMerce = h_merce;
|
||||
}
|
||||
|
||||
public String getCodiceProdotto() {
|
||||
if (isTest())
|
||||
return "50";
|
||||
if (this.codiceProdotto == null)
|
||||
this.codiceProdotto = getApFull().getParm("COD_TIPO_PRODOTTO_SELLA_P_CREDIT").getTesto();
|
||||
return this.codiceProdotto;
|
||||
}
|
||||
|
||||
public void setCodiceProdotto(String h_prod) {
|
||||
this.codiceProdotto = h_prod;
|
||||
}
|
||||
|
||||
public String getCodiceConvenzionato() {
|
||||
if (isTest())
|
||||
return "0049613";
|
||||
if (this.codiceConvenzionato == null)
|
||||
this.codiceConvenzionato = getApFull().getParm("COD_CONVENZIONE_SELLA_P_CREDIT").getTesto().trim();
|
||||
return this.codiceConvenzionato;
|
||||
}
|
||||
|
||||
public void setCodiceConvenzionato(String convenz) {
|
||||
this.codiceConvenzionato = convenz;
|
||||
}
|
||||
|
||||
public String getImportoDaFinanziare() {
|
||||
return (this.importoDaFinanziare == null) ? "" : this.importoDaFinanziare;
|
||||
}
|
||||
|
||||
public void setImportoDaFinanziare(String impdafin) {
|
||||
this.importoDaFinanziare = impdafin;
|
||||
}
|
||||
|
||||
public double getAnticipo() {
|
||||
return this.anticipo;
|
||||
}
|
||||
|
||||
public String getRequestServer() {
|
||||
if (isTest())
|
||||
return "https://sandbox.sellapersonalcredit.it/econsel/public/entry/pf";
|
||||
return "https://secure.sellapersonalcredit.it/econsel/public/entry/pf";
|
||||
}
|
||||
|
||||
public void setAnticipo(double anticipo) {
|
||||
this.anticipo = anticipo;
|
||||
}
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
if (ap != null) {
|
||||
DBAdapter.logDebug(true, "SELLA_P_CREDIT chechout initParms: start");
|
||||
String l_tipoParm = "";
|
||||
Parm bean = new Parm(ap);
|
||||
l_tipoParm = "SELLA_P_CREDIT";
|
||||
StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm);
|
||||
bean.findByCodice("COD_CONVENZIONE_SELLA_P_CREDIT");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("COD_CONVENZIONE_SELLA_P_CREDIT");
|
||||
bean.setDescrizione("COD_CONVENZIONE_SELLA_P_CREDIT");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("0026321");
|
||||
bean.setNota("CODICE CONVENZIONE SELLA_P_CREDIT");
|
||||
bean.save();
|
||||
bean.findByCodice("COD_TIPO_MERCE_SELLA_P_CREDIT");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("COD_TIPO_MERCE_SELLA_P_CREDIT");
|
||||
bean.setDescrizione("COD_TIPO_MERCE_SELLA_P_CREDIT");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("HT");
|
||||
bean.setNota("CODICE INDICATIVO MERCE FINANZIATA ");
|
||||
bean.save();
|
||||
bean.findByCodice("COD_TIPO_PRODOTTO_SELLA_P_CREDIT");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("COD_TIPO_PRODOTTO_SELLA_P_CREDIT");
|
||||
bean.setDescrizione("COD_TIPO_PRODOTTO_SELLA_P_CREDIT");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("50");
|
||||
bean.setNota("CODICE INDICATIVO PRODOTTO FINANZIATO");
|
||||
bean.save();
|
||||
bean.findByCodice("SELLA_P_CREDIT_ERROR_PAGE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("SELLA_P_CREDIT_ERROR_PAGE");
|
||||
bean.setDescrizione("SELLA_P_CREDIT_ERROR_PAGE");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("sellaPCreditRes.jsp");
|
||||
bean.setNota("SELLA_P_CREDIT_ERROR_PAGE");
|
||||
bean.save();
|
||||
bean.findByCodice("SELLA_P_CREDIT_OK_PAGE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("SELLA_P_CREDIT_OK_PAGE");
|
||||
bean.setDescrizione("SELLA_P_CREDIT_OK_PAGE");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("sellaPCreditRes.jsp");
|
||||
bean.setNota("SELLA_P_CREDIT_OK_PAGE");
|
||||
bean.save();
|
||||
bean.findByCodice("SELLA_P_CREDIT_TEST");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("SELLA_P_CREDIT_TEST");
|
||||
bean.setDescrizione("SELLA_P_CREDIT_TEST");
|
||||
bean.setFlgTipo(5L);
|
||||
bean.setNota("0-->NO 1-->SI");
|
||||
bean.save();
|
||||
bean.findByCodice("SELLA_P_CREDIT_IMPORTO_MINIMO");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("SELLA_P_CREDIT_IMPORTO_MINIMO");
|
||||
bean.setDescrizione("SELLA_P_CREDIT_IMPORTO_MINIMO");
|
||||
bean.setFlgTipo(1L);
|
||||
bean.setNota("SELLA_P_CREDIT_IMPORTO_MINIMO");
|
||||
bean.save();
|
||||
bean.findByCodice("SELLA_P_CREDIT_RATA0");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("SELLA_P_CREDIT_RATA0");
|
||||
bean.setDescrizione("SELLA_P_CREDIT_RATA0");
|
||||
bean.setFlgTipo(5L);
|
||||
bean.setNota(" ATTIVA ANCHE RATA 0 SOPRA L'IMPORTO DEFINITO DA SELLA_P_CREDIT_IMPORTO_MINIMO<BR>0: RATA 0 NON ATTIVA<br>1: RATA 0 ATTIVA");
|
||||
bean.save();
|
||||
DBAdapter.logDebug(true, "SELLA_P_CREDIT chechout initParms: stop");
|
||||
}
|
||||
}
|
||||
|
||||
public String getImpspe() {
|
||||
return (this.impspe == null) ? "" : this.impspe;
|
||||
}
|
||||
|
||||
public void setImpspe(String impspe) {
|
||||
this.impspe = impspe;
|
||||
}
|
||||
|
||||
public ApplParmFull getApFull() {
|
||||
return this.ap;
|
||||
}
|
||||
|
||||
public void setAp(ApplParmFull ap) {
|
||||
this.ap = ap;
|
||||
}
|
||||
|
||||
public String getCellulare() {
|
||||
return (this.cellulare == null) ? "" : this.cellulare.trim();
|
||||
}
|
||||
|
||||
public void setCellulare(String cellulare) {
|
||||
this.cellulare = cellulare;
|
||||
}
|
||||
|
||||
public String getCommissioni() {
|
||||
return (this.commissioni == null) ? "" : this.commissioni.trim();
|
||||
}
|
||||
|
||||
public void setCommissioni(String commissioni) {
|
||||
this.commissioni = commissioni;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package it.acxent.bank.sellaPCredit;
|
||||
|
||||
import it.acxent.db.ApplParmFull;
|
||||
|
||||
public class SellaPCreditResp {
|
||||
private String pratica;
|
||||
|
||||
private ApplParmFull ap;
|
||||
|
||||
private String ordine;
|
||||
|
||||
private String praticabis;
|
||||
|
||||
private String stato;
|
||||
|
||||
public static final String SELLA_P_CREDIT_VALUTAZIONE = "WW";
|
||||
|
||||
public static final String SELLA_P_CREDIT_KO = "KO";
|
||||
|
||||
public static final String SELLA_P_CREDIT_OK = "OK";
|
||||
|
||||
public SellaPCreditResp(ApplParmFull l_ap) {
|
||||
setAp(l_ap);
|
||||
}
|
||||
|
||||
public SellaPCreditResp() {}
|
||||
|
||||
public String getOrdine() {
|
||||
return (this.ordine == null) ? "" : this.ordine.trim();
|
||||
}
|
||||
|
||||
public void setOrdine(String ordine) {
|
||||
this.ordine = ordine;
|
||||
}
|
||||
|
||||
public ApplParmFull getApFull() {
|
||||
return this.ap;
|
||||
}
|
||||
|
||||
public void setAp(ApplParmFull ap) {
|
||||
this.ap = ap;
|
||||
}
|
||||
|
||||
public String getPratica() {
|
||||
return (this.pratica == null) ? "" : this.pratica.trim();
|
||||
}
|
||||
|
||||
public void setPratica(String pratica) {
|
||||
this.pratica = pratica;
|
||||
}
|
||||
|
||||
public String getPraticabis() {
|
||||
return (this.praticabis == null) ? "" : this.praticabis.trim();
|
||||
}
|
||||
|
||||
public void setPraticabis(String praticabis) {
|
||||
this.praticabis = praticabis;
|
||||
}
|
||||
|
||||
public String getStato() {
|
||||
return (this.stato == null) ? "" : this.stato.trim();
|
||||
}
|
||||
|
||||
public void setStato(String stato) {
|
||||
this.stato = stato;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
package it.acxent.bank.sellaPCredit;
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
package it.acxent.bank.servlet.consel;
|
||||
|
||||
import it.acxent.bank.consel.ConselReq;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class ConselReqSvlt extends ConselSvlt {
|
||||
protected void sendRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
String conselSite = "https://reserved.e-consel.it/DOL/faces/frmECProntoTuo.jsp";
|
||||
ConselReq conselReq = new ConselReq(getApFull());
|
||||
fillObject(req, conselReq);
|
||||
caricaConselRequest(req, conselReq);
|
||||
if (getParm("CONSEL_TEST").getNumeroLong() == 1L)
|
||||
caricaDemoRequest(req, conselReq);
|
||||
req.setAttribute("conselReq", conselReq);
|
||||
RequestDispatcher rd = getServletContext()
|
||||
.getRequestDispatcher("/conselReq.jsp");
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
sendRequest(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void caricaConselRequest(HttpServletRequest paramHttpServletRequest, ConselReq paramConselReq);
|
||||
|
||||
private void caricaDemoRequest(HttpServletRequest req, ConselReq conselReq) {
|
||||
conselReq.setCodfisc("CLMCST80A01D969I");
|
||||
conselReq.setCognome("COLOMBO");
|
||||
conselReq.setNome("CRISTOFORO");
|
||||
conselReq.setData_nascita("01/01/1980");
|
||||
}
|
||||
|
||||
protected void sendRequestOld(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
String conselSite = "https://reserved.e-consel.it/DOL/faces/frmECProntoTuo.jsp";
|
||||
ConselReq conselReq = new ConselReq(getApFull());
|
||||
fillObject(req, conselReq);
|
||||
caricaConselRequest(req, conselReq);
|
||||
if (getParm("TEST").getNumeroLong() == 1L)
|
||||
caricaDemoRequest(req, conselReq);
|
||||
StringBuffer data = new StringBuffer(URLEncoder.encode("tiposec", "UTF-8") + "=" + URLEncoder.encode("tiposec", "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("tabfin", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getTabfin(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("convenz", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getConvenz(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("h_merce", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getH_merce(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("h_prod", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getH_prod(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("cognome", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getCognome(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("nome", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getNome(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("ordine", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getOrdine(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("anticipo", "UTF-8") + "=" +
|
||||
conselReq.getAnticipo());
|
||||
data.append("&" + URLEncoder.encode("descr1", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getDescri1(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("parz1", "UTF-8") + "=" +
|
||||
conselReq.getParz1());
|
||||
data.append("&" + URLEncoder.encode("tel_num", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getTel_num(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("pref_num", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getPref_num(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("impspe", "UTF-8") + "=" +
|
||||
conselReq.getImpspe());
|
||||
data.append("&" + URLEncoder.encode("impdafin", "UTF-8") + "=" +
|
||||
conselReq.getImpdafin());
|
||||
data.append("&" + URLEncoder.encode("data_nascita", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getData_nascita(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("indirizzo", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getIndirizzo(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("testomail", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getTestomail(), "UTF-8"));
|
||||
data.append("&" + URLEncoder.encode("codifisc", "UTF-8") + "=" +
|
||||
URLEncoder.encode(conselReq.getCodfisc(), "UTF-8"));
|
||||
URL url = new URL(conselSite);
|
||||
URLConnection conn = url.openConnection();
|
||||
conn.setDoOutput(true);
|
||||
OutputStreamWriter wr = new OutputStreamWriter(
|
||||
conn.getOutputStream());
|
||||
wr.write(data.toString());
|
||||
wr.flush();
|
||||
BufferedReader rd = new BufferedReader(new InputStreamReader(
|
||||
conn.getInputStream()));
|
||||
ServletOutputStream sos = res.getOutputStream();
|
||||
String line;
|
||||
while ((line = rd.readLine()) != null)
|
||||
sos.write(line.getBytes(), 0, line.length());
|
||||
wr.close();
|
||||
sos.flush();
|
||||
sos.close();
|
||||
rd.close();
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package it.acxent.bank.servlet.consel;
|
||||
|
||||
import it.acxent.bank.consel.ConselResp;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class ConselRespSvlt extends ConselSvlt {
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
manageResponse(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void manageResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
ConselResp conselResp = new ConselResp(getApFull());
|
||||
fillObject(req, conselResp);
|
||||
if (conselResp.getStato().toLowerCase()
|
||||
.equals("OK".toLowerCase()) ||
|
||||
|
||||
conselResp.getStato()
|
||||
.toLowerCase()
|
||||
.equals("WW".toLowerCase())) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
} else {
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
}
|
||||
manageConselResponse(req, conselResp);
|
||||
req.setAttribute("conselResp", conselResp);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void manageConselResponse(HttpServletRequest paramHttpServletRequest, ConselResp paramConselResp);
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package it.acxent.bank.servlet.consel;
|
||||
|
||||
import it.acxent.bank.consel.ConselTabfin;
|
||||
import it.acxent.bank.consel.ConselTabfinCR;
|
||||
import it.acxent.servlet.AcServlet;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class ConselSvlt extends AcServlet {
|
||||
protected static final String CONSEL_REQ_JSP = "/conselReq.jsp";
|
||||
|
||||
protected static final String BEAN_CONSEL_REQ = "conselReq";
|
||||
|
||||
protected static final String BEAN_CONSEL_RESP = "conselResp";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getCodiceConvenzione(HttpServletRequest req) {
|
||||
return getParm("COD_CONVENZIONE_SELLA_P_CREDIT").getTesto();
|
||||
}
|
||||
|
||||
protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_P_CREDIT_ERROR_PAGE").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return getJspKoPage(req, res);
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_P_CREDIT_OK_PAGE").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "conselRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_P_CREDIT_OK_PAGE").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "conselRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
ConselTabfin ct = new ConselTabfin(getApFull());
|
||||
ConselTabfinCR CR = new ConselTabfinCR();
|
||||
fillObject(req, CR);
|
||||
req.setAttribute("list", ct.findByCR(CR, 0, 0));
|
||||
req.setAttribute("CR", CR);
|
||||
req.setAttribute("nf3", getNf3());
|
||||
setJspPageRelative("tabfin" + CR.getFlgTipo() + getAct(req) + ".jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package it.acxent.bank.servlet.infogroup;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class GetShopnetResponseSvlt extends ShopNetSvlt {
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
getResponse(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
package it.acxent.bank.servlet.infogroup;
|
||||
|
||||
import it.acxent.bank.infogroup.ShopnetResp;
|
||||
import it.acxent.servlet.AcServlet;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class ShopNetSvlt extends AcServlet {
|
||||
protected static final String BEAN_SHOPNETRES = "shopnetResp";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext()
|
||||
.getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void fillIdOrdineByShopnetRes(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, ShopnetResp paramShopnetResp);
|
||||
|
||||
protected void getResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
ShopnetResp snRes = new ShopnetResp();
|
||||
fillObject(req, snRes);
|
||||
fillIdOrdineByShopnetRes(req, res, snRes);
|
||||
if (snRes.getStato() == 2L) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
recordOrder(req, res, snRes);
|
||||
} else {
|
||||
sendMessage(req, "Errore! Transazione annullata.");
|
||||
payKoUpdateOrder(req, res, snRes);
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
}
|
||||
req.setAttribute("shopnetResp", snRes);
|
||||
preparePaymenResPage(req, res, snRes);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!Shopnet! Risposta non valida: ";
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
preparePaymenResPage(req, res, null);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return getJspKoPage(req, res);
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
getResponse(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected abstract void recordOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, ShopnetResp paramShopnetResp);
|
||||
|
||||
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, ShopnetResp snRes) {}
|
||||
|
||||
protected abstract void payKoUpdateOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, ShopnetResp paramShopnetResp);
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package it.acxent.bank.servlet.keyclient;
|
||||
|
||||
import it.acxent.bank.keyclient.KeyClientResp;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class GetKeyClientResponseSvlt extends KeyClientSvlt {
|
||||
protected abstract void preparePaymenResPage(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, KeyClientResp paramKeyClientResp);
|
||||
|
||||
protected abstract void recordOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, KeyClientResp paramKeyClientResp);
|
||||
|
||||
protected void getResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
KeyClientResp kcRes = new KeyClientResp();
|
||||
fillObject(req, kcRes);
|
||||
kcRes.setBRAND(getRequestParameter(req, "$BRAND"));
|
||||
if (kcRes.getEsito().equals("OK")) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
recordOrder(req, res, kcRes);
|
||||
} else {
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
}
|
||||
req.setAttribute("KCResp", kcRes);
|
||||
preparePaymenResPage(req, res, kcRes);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!Key Client! Risposta non valida: ";
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
preparePaymenResPage(req, res, null);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
getResponse(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
package it.acxent.bank.servlet.keyclient;
|
||||
|
||||
import it.acxent.bank.infogroup.ShopnetResp;
|
||||
import it.acxent.bank.keyclient.KeyClientReq;
|
||||
import it.acxent.servlet.AcServlet;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class KeyClientSvlt extends AcServlet {
|
||||
protected static final String BEAN_KC_RES = "KCResp";
|
||||
|
||||
protected static final String CMD_GET_RES = "res";
|
||||
|
||||
protected static final String CMD_SEND_REQ = "send";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext()
|
||||
.getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void getResponse(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("KC_PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return getJspKoPage(req, res);
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("KC_PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("KC_PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
String cmd = getCmd(req).toLowerCase();
|
||||
try {
|
||||
if (cmd.equals("send")) {
|
||||
sendRequest(req, res);
|
||||
} else if (cmd.equals("res")) {
|
||||
getResponse(req, res);
|
||||
} else {
|
||||
sendRequest(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void payKoUpdateOrder(HttpServletRequest req, HttpServletResponse res, ShopnetResp snRes) {}
|
||||
|
||||
protected void sendRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
String theUrl;
|
||||
KeyClientReq kcReq = new KeyClientReq();
|
||||
fillObject(req, kcReq);
|
||||
kcReq.setKey(getParm("KC_KEY").getTesto());
|
||||
kcReq.setAlias(getParm("KC_ALIAS").getTesto());
|
||||
kcReq.setUrl(getParm("KC_URL_RESPONSE").getTesto());
|
||||
kcReq.setUrl_back(getParm("KC_URL_RESPONSE_NULL")
|
||||
.getTesto());
|
||||
if (getParm("TEST").getNumeroLong() == 1L) {
|
||||
theUrl = kcReq.getTestRequestUrl();
|
||||
} else {
|
||||
theUrl = kcReq.getRequestUrl();
|
||||
System.out.println(theUrl);
|
||||
System.out.println(kcReq.getTestRequestUrl());
|
||||
}
|
||||
if (!theUrl.equals("")) {
|
||||
res.sendRedirect(theUrl);
|
||||
} else {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!KeyClient Svlt! Impossibile creare url di richiesta!";
|
||||
sendMessage(req, temp);
|
||||
getResponse(req, res);
|
||||
handleDebug(temp, 2);
|
||||
callJsp(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getUrlResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("KC_URL_RESPONSE").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "RicevutaKC.abl";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getUrlResponseNull(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("KC_URL_RESPONSE_NULL").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "RicevutaKC.abl";
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package it.acxent.bank.servlet.paypal;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@Deprecated
|
||||
public class GetPayPalResponseSvlt extends PayPalSvlt {
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
getPayerDatails(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,301 @@
|
|||
package it.acxent.bank.servlet.paypal;
|
||||
|
||||
import it.acxent.bank.paypal.PayPalReq;
|
||||
import it.acxent.bank.paypal.PayPalResp;
|
||||
import it.acxent.servlet.AcServlet;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@Deprecated
|
||||
public class PayPalSvlt extends AcServlet {
|
||||
private static final long serialVersionUID = 5690538301539954108L;
|
||||
|
||||
public static final String CMD_SET_EXPRESS_CEHCKOUT = "start";
|
||||
|
||||
public static final String CMD_DO_EXPRESS_CEHCKOUT = "dopayment";
|
||||
|
||||
protected static final String CMD_GET_RES = "res";
|
||||
|
||||
protected static final String BEAN_PAYPALRES = "payPalResp";
|
||||
|
||||
private String payPalHttpServer;
|
||||
|
||||
private static final boolean debug = false;
|
||||
|
||||
private static boolean debugRecordOrder = false;
|
||||
|
||||
private String API_VERSION = "98";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void doSetExpressCheckout(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
PayPalReq ppReq = new PayPalReq();
|
||||
fillObject(req, ppReq);
|
||||
String sec = getRequiredParameterstring() + "&CURRENCYCODE=" + getRequiredParameterstring() + "&METHOD=SetExpressCheckout&AMT=" + getCurrency() + "&RETURNURL=" +
|
||||
URLEncoder.encode(String.valueOf(ppReq.getAmt())) + "&CANCELURL=" +
|
||||
URLEncoder.encode(getReturnURL(req, res)) + "&" + URLEncoder.encode(getCancelURL(req, res));
|
||||
String pageStyle = getPageStyle();
|
||||
if (!pageStyle.equals(""))
|
||||
sec = sec + "&PAGESTYLE=" + sec;
|
||||
String urlString = getPayPalHttpServer(req) + "?" + getPayPalHttpServer(req);
|
||||
URL url = new URL(urlString);
|
||||
URLConnection connection = url.openConnection();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
PayPalResp ppResponse = new PayPalResp();
|
||||
ppResponse.fillResponse(in);
|
||||
ppResponse.setId_ordine(ppReq.getId_ordine());
|
||||
req.getSession().setAttribute("_SESS_ID_ORDER", new Long(ppReq.getId_ordine()));
|
||||
if (ppResponse.isResponseOk()) {
|
||||
String rediretUrl;
|
||||
if (getParm("TEST").getNumeroLong() == 1L) {
|
||||
rediretUrl = "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=" + ppResponse.getTOKEN();
|
||||
} else {
|
||||
rediretUrl = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=" + ppResponse.getTOKEN();
|
||||
}
|
||||
req.getSession().setAttribute("_SESS_TOKEN", ppResponse.getTOKEN());
|
||||
res.sendRedirect(rediretUrl);
|
||||
} else {
|
||||
req.setAttribute("payPalResp", ppResponse);
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!PayPal Error! Code: " + ppResponse.getL_ERRORCODE0() + ": " + ppResponse.getL_SHORTMESSAGE0() + " " +
|
||||
ppResponse.getL_LONGMESSAGE0();
|
||||
sendMessage(req, temp);
|
||||
preparePaymenResPage(req, res, ppResponse);
|
||||
handleDebug(temp, 2);
|
||||
callJsp(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void getPayerDatails(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
String token = (String)req.getSession().getAttribute("_SESS_TOKEN");
|
||||
String sec = getRequiredParameterstring() + "&METHOD=GetExpressCheckoutDetails&TOKEN=" + getRequiredParameterstring();
|
||||
String urlString = getPayPalHttpServer(req) + "?" + getPayPalHttpServer(req);
|
||||
URL url = new URL(urlString);
|
||||
URLConnection connection = url.openConnection();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
PayPalResp ppResponse = new PayPalResp();
|
||||
ppResponse.fillResponse(in);
|
||||
long l_id_ordine = (Long)req.getSession().getAttribute("_SESS_ID_ORDER");
|
||||
ppResponse.setId_ordine(l_id_ordine);
|
||||
fillObject(req, ppResponse);
|
||||
if (ppResponse.isResponseOk() && !ppResponse.getPAYERID().isEmpty()) {
|
||||
ppResponse.setDetailBuyer(true);
|
||||
setJspPageRelative(getJspPayerDetailsPage(req, res), req);
|
||||
} else {
|
||||
if (ppResponse.isResponseOk())
|
||||
sendMessage(req, "Transazione Abbandonata!");
|
||||
ppResponse.setDetailBuyer(false);
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
}
|
||||
req.setAttribute("payPalResp", ppResponse);
|
||||
preparePaymenResPage(req, res, ppResponse);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!PayPal Error! getPayerDetail: ";
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
preparePaymenResPage(req, res, null);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void doExpresssCheckout(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
PayPalResp ppResponse = new PayPalResp();
|
||||
if (!debugRecordOrder) {
|
||||
PayPalReq ppReq = new PayPalReq();
|
||||
fillObject(req, ppReq);
|
||||
long l_id_ordine = (Long)req.getSession().getAttribute("_SESS_ID_ORDER");
|
||||
String sec = getRequiredParameterstring() + "&CURRENCYCODE=" + getRequiredParameterstring() + "&METHOD=DoExpressCheckoutPayment&TOKEN=" + getCurrency() + "&AMT=" +
|
||||
ppReq.getTOKEN() + "&PAYERID=" + ppReq.getAmt() + "&PAYMENTACTION=Sale";
|
||||
String urlString = getPayPalHttpServer(req) + "?" + getPayPalHttpServer(req);
|
||||
URL url = new URL(urlString);
|
||||
URLConnection connection = url.openConnection();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
ppResponse.fillResponse(in);
|
||||
ppResponse.setId_ordine(l_id_ordine);
|
||||
fillObject(req, ppResponse);
|
||||
if (!ppResponse.isResponseOk()) {
|
||||
ppResponse.setDetailBuyer(false);
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
} else {
|
||||
ppResponse.setPaymentDone(true);
|
||||
ppResponse.setDetailBuyer(true);
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
recordOrder(req, res, ppResponse);
|
||||
}
|
||||
} else {
|
||||
fillObject(req, ppResponse);
|
||||
ppResponse.setACK("Success");
|
||||
ppResponse.setAMT("40.00");
|
||||
ppResponse.setPaymentDone(true);
|
||||
recordOrder(req, res, ppResponse);
|
||||
}
|
||||
req.setAttribute("payPalResp", ppResponse);
|
||||
preparePaymenResPage(req, res, ppResponse);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!PayPal Error! getPayerDetail: ";
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
preparePaymenResPage(req, res, null);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAYPAL_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payPalRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAYPAL_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payPalRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspPayerDetailsPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAYPAL_DETAIL").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payPalRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getReturnURL(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAYPAL_RETURNURL").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "http://localhost:8080/mrcocci/PayPalResp.abl";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getCancelURL(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAYPAL_CANCELURL").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "http://localhost:8080/mrcocci/PayPalResp.abl";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAYPAL_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payPalRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
String cmd = getCmd(req).toLowerCase();
|
||||
if (cmd.equals("start")) {
|
||||
doSetExpressCheckout(req, res);
|
||||
} else if (cmd.equals("res")) {
|
||||
getPayerDatails(req, res);
|
||||
} else if (cmd.equals("dopayment")) {
|
||||
doExpresssCheckout(req, res);
|
||||
} else {
|
||||
doSetExpressCheckout(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isApiCertificate(HttpServletRequest req) {
|
||||
long temp = getParm("PAYPAL_USE_CERTIFICATE").getNumeroLong();
|
||||
if (temp == 1L)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void recordOrder(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) {}
|
||||
|
||||
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) {}
|
||||
|
||||
private String getPayPalHttpServer(HttpServletRequest req) {
|
||||
if (getParm("TEST").getNumeroLong() == 1L) {
|
||||
System.out.println("PAYPAL TEST!!!! USING SANDBOX");
|
||||
if (isApiCertificate(req)) {
|
||||
this.payPalHttpServer = "https://api.sandbox.paypal.com/nvp";
|
||||
} else {
|
||||
this.payPalHttpServer = "https://api-aa-3t.sandbox.paypal.com/nvp";
|
||||
}
|
||||
} else if (isApiCertificate(req)) {
|
||||
this.payPalHttpServer = "https://api.paypal.com/nvp";
|
||||
} else {
|
||||
this.payPalHttpServer = "https://api-3t.paypal.com/nvp";
|
||||
}
|
||||
return this.payPalHttpServer;
|
||||
}
|
||||
|
||||
public void setPayPalHttpServer(String payPalHttpServer) {
|
||||
this.payPalHttpServer = payPalHttpServer;
|
||||
}
|
||||
|
||||
private String getRequiredParameterstring() {
|
||||
return "USER=" + getApiUsername() + "&PWD=" + getApiPassword() + "&SIGNATURE=" + getApiSignature() + "&VERSION=" + this.API_VERSION;
|
||||
}
|
||||
|
||||
protected String getApiPassword() {
|
||||
String temp = getParm("PAYPAL_API_PWD").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "1196089261";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getApiSignature() {
|
||||
String temp = getParm("PAYPAL_API_SIGNATURE").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "AGAgVmHK8-QsvPbEGnNP6SiFg7qvADQfsLa6GrW8G43-yqX46vNyyZzG";
|
||||
return temp;
|
||||
}
|
||||
|
||||
private String getPageStyle() {
|
||||
String temp = getParm("PAYPAL_PAGE_STYLE").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getApiUsername() {
|
||||
String temp = getParm("PAYPAL_API_USERNAME").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "acolzi_1196089239_biz_api1.f3.com";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getCurrency() {
|
||||
String temp = getParm("PAYPAL_CURRENCY").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "EUR";
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,182 @@
|
|||
package it.acxent.bank.servlet.paypalcheckout;
|
||||
|
||||
import com.paypal.http.HttpResponse;
|
||||
import com.paypal.http.serializer.Json;
|
||||
import com.paypal.orders.Order;
|
||||
import it.acxent.bank.paypalcheckout.PayPalOrder;
|
||||
import it.acxent.bank.paypalcheckout.PayPalReq;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.servlet.AcServlet;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class PaypalCheckoutSvlt extends AcServlet {
|
||||
private static final long serialVersionUID = 5690568301539954108L;
|
||||
|
||||
public static final String CMD_CREATE_ORDER = "createOrder";
|
||||
|
||||
public static final String CMD_GET_ORDER_DETAILS = "getOrderDetails";
|
||||
|
||||
protected static final String CMD_GET_RES = "res";
|
||||
|
||||
protected static final String BEAN_PAYPALRES = "payPalResp";
|
||||
|
||||
private static final boolean debug = false;
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void _createOrder(HttpServletRequest req, HttpServletResponse res) {
|
||||
PayPalReq pReq = getPayPalReq(req, res);
|
||||
pReq.setPaypalClientId(getApplicationClientId());
|
||||
pReq.setPaypalClientSecret(getApplicationClienteSecret());
|
||||
pReq.setUseSandbox(isUseSandbox(req));
|
||||
try {
|
||||
HttpResponse<Order> respOrd = new PayPalOrder(pReq).createOrder(false);
|
||||
String orderId = ((Order)respOrd.result()).id();
|
||||
String result = "{\"orderID\":\"" + orderId + "\"}";
|
||||
System.out.println(String.valueOf(DBAdapter.getNow()) + " _createOrder paypalcheckoutsvlt: " + String.valueOf(DBAdapter.getNow()));
|
||||
pReq.setPaypalOrderId(orderId);
|
||||
updatePaypalOrderId(req, pReq);
|
||||
sendHtmlMsgResponse(req, res, result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println(String.valueOf(DBAdapter.getNow()) + " _createOrder paypalcheckoutsvlt: exception; " + String.valueOf(DBAdapter.getNow()));
|
||||
}
|
||||
}
|
||||
|
||||
private String getJspOkPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAYPAL_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payPalRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
private String getCancelURL(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAYPAL_CANCELURL").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "http://localhost/cc/PayPalCOResp.abl";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
String cmd = getCmd(req);
|
||||
if (cmd.equals("createOrder")) {
|
||||
_createOrder(req, res);
|
||||
} else {
|
||||
_getPayerDatails(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isUseSandbox(HttpServletRequest req) {
|
||||
return getParm("P_PAYPAL_CHECKOUT_USE_SANDBOX").isTrue();
|
||||
}
|
||||
|
||||
protected void recordOrder(HttpServletRequest req, HttpServletResponse res, JSONObject jso) {}
|
||||
|
||||
private String getApplicationClientId() {
|
||||
String temp = getParm("PAYPAL_CHECKOUT_APPLICATION_CLIENT_ID").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "ASB7x1BxlkomVZ1BM0OesK2SuCLjRq9R4dyc5rtCVBzM7nHB0eunZyyxO4758BgXnZBV9JSCZ3bqpFw9";
|
||||
return temp;
|
||||
}
|
||||
|
||||
private String getApplicationClienteSecret() {
|
||||
String temp = getParm("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "EFiYhkh4tgv1d3Wnx2qUAG1_BtxddWoGhZTlV7EseRfP4uKFMRAub_5G9D9PIgTObVjB54SZd2UNyXlZ";
|
||||
return temp;
|
||||
}
|
||||
|
||||
private String getCurrency() {
|
||||
String temp = getParm("PAYPAL_CURRENCY").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "EUR";
|
||||
return temp;
|
||||
}
|
||||
|
||||
private String getReturnURL(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("PAYPAL_RETURNURL").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "http://localhost/cc/PayPalCOResp.abl";
|
||||
return temp;
|
||||
}
|
||||
|
||||
private void _getPayerDatails(HttpServletRequest req, HttpServletResponse res) {
|
||||
PayPalReq preq = new PayPalReq();
|
||||
fillObject(req, preq);
|
||||
preq.setPaypalClientId(getApplicationClientId());
|
||||
preq.setPaypalClientSecret(getApplicationClienteSecret());
|
||||
preq.setUseSandbox(isUseSandbox(req));
|
||||
System.out.println("PAYPALCHECKOUT _getPayerDatails .... ");
|
||||
try {
|
||||
String orderIdJson = IOUtils.toString(req.getReader());
|
||||
JSONObject jso = new JSONObject(orderIdJson);
|
||||
String orderId = jso.getString("orderID");
|
||||
HttpResponse<Order> respOrd = new PayPalOrder(preq).getOrder(orderId);
|
||||
JSONObject jsonRespObj = new JSONObject(new Json().serialize(respOrd.result()));
|
||||
String json = jsonRespObj.toString(4);
|
||||
String status = jsonRespObj.getString("status");
|
||||
System.out.println("PAYPALCHECKOUT _getPayerDatails status: " + status);
|
||||
if (status.equals("COMPLETED"))
|
||||
recordOrder(req, res, jsonRespObj);
|
||||
sendHtmlMsgResponse(req, res, json);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected PayPalReq getPayPalReq(HttpServletRequest req, HttpServletResponse res) {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void updatePaypalOrderId(HttpServletRequest req, PayPalReq pReq) {}
|
||||
|
||||
protected String extractTransactionId(JSONObject jo) {
|
||||
String transactionId = "";
|
||||
if (jo == null)
|
||||
return transactionId;
|
||||
try {
|
||||
if (!jo.has("purchase_units"))
|
||||
return transactionId;
|
||||
JSONArray purchaseUnits = jo.optJSONArray("purchase_units");
|
||||
if (purchaseUnits == null || purchaseUnits.isEmpty())
|
||||
return transactionId;
|
||||
JSONObject firstPurchaseUnit = purchaseUnits.optJSONObject(0);
|
||||
if (firstPurchaseUnit == null)
|
||||
return transactionId;
|
||||
JSONObject payments = firstPurchaseUnit.optJSONObject("payments");
|
||||
if (payments == null)
|
||||
return transactionId;
|
||||
JSONArray captures = payments.optJSONArray("captures");
|
||||
if (captures == null || captures.isEmpty())
|
||||
return transactionId;
|
||||
JSONObject firstCapture = captures.optJSONObject(0);
|
||||
if (firstCapture == null)
|
||||
return transactionId;
|
||||
transactionId = firstCapture.optString("id", "");
|
||||
} catch (Exception e) {}
|
||||
return transactionId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package it.acxent.bank.servlet.sella;
|
||||
|
||||
import it.acxent.bank.sella.GestPayCrypt;
|
||||
import it.acxent.bank.sella.SellaResp;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class GetSellaResponseSvlt extends SellaSvlt {
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
getResponse(req, res);
|
||||
}
|
||||
|
||||
protected void getResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
GestPayCrypt objCrypt = new GestPayCrypt();
|
||||
String a = req.getParameter("a");
|
||||
String b = req.getParameter("b");
|
||||
a = a.trim();
|
||||
b = b.trim();
|
||||
GestPayCrypt objdeCrypt = new GestPayCrypt();
|
||||
objdeCrypt.setShopLogin(a);
|
||||
objdeCrypt.setEncryptedString(b);
|
||||
objdeCrypt.Decrypt();
|
||||
SellaResp sellaRes = new SellaResp(objdeCrypt);
|
||||
if (sellaRes.getMyerrorcode().equals("0")) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
recordOrder(req, res, sellaRes);
|
||||
} else {
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
}
|
||||
req.setAttribute("sellaResp", sellaRes);
|
||||
preparePaymenResPage(req, res, sellaRes);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!GestPay Error! Risposta non valida: ";
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
preparePaymenResPage(req, res, null);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void preparePaymenResPage(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, SellaResp paramSellaResp);
|
||||
|
||||
protected abstract void recordOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, SellaResp paramSellaResp);
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
package it.acxent.bank.servlet.sella;
|
||||
|
||||
import it.acxent.bank.sella.GestPayCrypt;
|
||||
import it.acxent.bank.sella.SellaReq;
|
||||
import it.acxent.servlet.AcServlet;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class SellaSvlt extends AcServlet {
|
||||
protected static final String CMD_SEND_REQ = "send";
|
||||
|
||||
protected static final String CMD_GET_RES = "res";
|
||||
|
||||
protected static final String BEAN_SELLA_RES = "sellaResp";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void sendRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
GestPayCrypt objCrypt = new GestPayCrypt();
|
||||
SellaReq sellareq = new SellaReq();
|
||||
fillObject(req, sellareq);
|
||||
objCrypt.setShopLogin(getCodiceEsercente(req));
|
||||
objCrypt.setCurrency(sellareq.getMycurrency());
|
||||
if (getParm("TEST").getNumeroLong() == 1L) {
|
||||
objCrypt.setAmount("0.12");
|
||||
} else {
|
||||
objCrypt.setAmount(sellareq.getMyamount());
|
||||
}
|
||||
objCrypt.setShopTransactionID(sellareq.getMyshoptransactionID());
|
||||
if (getParm("SELLA_FULL").isTrue()) {
|
||||
if (!sellareq.getMybuyername().isEmpty())
|
||||
objCrypt.setBuyerName(sellareq.getMybuyername());
|
||||
if (!sellareq.getMybuyeremail().isEmpty())
|
||||
objCrypt.setBuyerEmail(sellareq.getMybuyeremail());
|
||||
if (!sellareq.getMylanguage().isEmpty())
|
||||
objCrypt.setLanguage(sellareq.getMylanguage());
|
||||
if (!sellareq.getMycustominfo().isEmpty())
|
||||
objCrypt.setCustomInfo(sellareq.getMycustominfo());
|
||||
}
|
||||
String tempX = "cod eserc.: " + objCrypt.getShopLogin() + " curr:" + objCrypt.getCurrency() + " amount:" + objCrypt.getAmount() + " shoptranid:" +
|
||||
objCrypt.getShopTransactionID() + " buyername:" + objCrypt.getBuyerName() + " buyeremail:" +
|
||||
objCrypt.getBuyerEmail() + " lang:" + sellareq.getMylanguage() + " custinfo:" + objCrypt.getCustomInfo();
|
||||
System.out.println("SELLA:SENDREQUEST ENCRYPT: " + tempX);
|
||||
objCrypt.Encrypt();
|
||||
String b = "";
|
||||
String a = "";
|
||||
if (objCrypt.getErrorCode().equals("0")) {
|
||||
String sellaSite;
|
||||
b = objCrypt.getEncryptedString();
|
||||
a = objCrypt.getShopLogin();
|
||||
if (getParm("TEST").getNumeroLong() == 1L) {
|
||||
sellaSite = "testecomm.sella.it";
|
||||
} else {
|
||||
sellaSite = "ecomm.sella.it";
|
||||
}
|
||||
String requestPage = "https://" + sellaSite + "/gestpay/pagam.asp?a=" + a + "&b=" + b;
|
||||
res.sendRedirect(requestPage);
|
||||
} else {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!GestPay Error! Code: " + objCrypt.getErrorCode() + ": " + objCrypt.getErrorDescription();
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
callJsp(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getCodiceEsercente(HttpServletRequest req) {
|
||||
return getParm("COD_ESER_SELLA").getTesto();
|
||||
}
|
||||
|
||||
protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return getJspKoPage(req, res);
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
sendRequest(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package it.acxent.bank.servlet.sellaPCredit;
|
||||
|
||||
import it.acxent.bank.sellaPCredit.SellaPCreditReq;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class SellaPCreditReqSvlt extends SellaPCreditlSvlt {
|
||||
protected void sendRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
SellaPCreditReq conselReq = new SellaPCreditReq(getApFull());
|
||||
String conselSite = conselReq.getRequestServer();
|
||||
fillObject(req, conselReq);
|
||||
if (!getRequestParameter(req, "tabfin").isEmpty())
|
||||
conselReq.setTabellaFinanziaria(getRequestParameter(req, "tabfin"));
|
||||
caricaSellaPCreditRequest(req, conselReq);
|
||||
if (getParm("SELLA_P_CREDIT_TEST").isTrue())
|
||||
caricaDemoRequest(req, conselReq);
|
||||
req.setAttribute("sellaPCreditReq", conselReq);
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher("/sellaPCreditReq.jsp");
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
sendRequest(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void caricaSellaPCreditRequest(HttpServletRequest paramHttpServletRequest, SellaPCreditReq paramSellaPCreditReq);
|
||||
|
||||
private void caricaDemoRequest(HttpServletRequest req, SellaPCreditReq conselReq) {
|
||||
conselReq.setCodiceFiscale("CLMCST80A01D969I");
|
||||
conselReq.setCognome("COLOMBO");
|
||||
conselReq.setNome("CRISTOFORO");
|
||||
conselReq.setData_nascita("01/01/1980");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package it.acxent.bank.servlet.sellaPCredit;
|
||||
|
||||
import it.acxent.bank.sellaPCredit.SellaPCreditResp;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class SellaPCreditRespSvlt extends SellaPCreditlSvlt {
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
manageResponse(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void manageResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
SellaPCreditResp conselResp = new SellaPCreditResp(getApFull());
|
||||
fillObject(req, conselResp);
|
||||
if (conselResp.getStato().toLowerCase()
|
||||
.equals("OK".toLowerCase()) ||
|
||||
|
||||
conselResp.getStato()
|
||||
.toLowerCase()
|
||||
.equals("WW".toLowerCase())) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
} else {
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
}
|
||||
manageSellaPCreditResponse(req, conselResp);
|
||||
req.setAttribute("sellaPCreditResp", conselResp);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void manageSellaPCreditResponse(HttpServletRequest paramHttpServletRequest, SellaPCreditResp paramSellaPCreditResp);
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package it.acxent.bank.servlet.sellaPCredit;
|
||||
|
||||
import it.acxent.bank.sellaPCredit.ConselTabfin;
|
||||
import it.acxent.bank.sellaPCredit.ConselTabfinCR;
|
||||
import it.acxent.servlet.AcServlet;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class SellaPCreditlSvlt extends AcServlet {
|
||||
protected static final String SELLA_P_CREDIT_REQ_JSP = "/sellaPCreditReq.jsp";
|
||||
|
||||
protected static final String BEAN_SELLA_P_CREDIT_REQ = "sellaPCreditReq";
|
||||
|
||||
protected static final String BEAN_SELLA_P_CREDIT_RESP = "sellaPCreditResp";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getCodiceConvenzione(HttpServletRequest req) {
|
||||
return getParm("COD_CONVENZIONE_SELLA_P_CREDIT").getTesto();
|
||||
}
|
||||
|
||||
protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_P_CREDIT_ERROR_PAGE").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return getJspKoPage(req, res);
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_P_CREDIT_OK_PAGE").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "conselRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_P_CREDIT_OK_PAGE").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "conselRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
ConselTabfin ct = new ConselTabfin(getApFull());
|
||||
ConselTabfinCR CR = new ConselTabfinCR();
|
||||
fillObject(req, CR);
|
||||
req.setAttribute("list", ct.findByCR(CR, 0, 0));
|
||||
req.setAttribute("CR", CR);
|
||||
req.setAttribute("nf3", getNf3());
|
||||
setJspPageRelative("tabfin" + CR.getFlgTipo() + getAct(req) + ".jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
package it.acxent.bank.servlet.sellaPCredit;
|
||||
|
|
@ -0,0 +1,176 @@
|
|||
package it.acxent.bank.servlet.setefi;
|
||||
|
||||
import it.acxent.bank.setefi.SetefiReq;
|
||||
import it.acxent.bank.setefi.SetefiResp;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.servlet.AcServlet;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class MonetaOnlineSvlt extends AcServlet {
|
||||
protected static final String CMD_GET_RES = "res";
|
||||
|
||||
protected static final String CMD_SEND_REQ = "send";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getResponsePage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext()
|
||||
.getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getResponsePage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("MONETAONLINE_RESPONSE_PAGE")
|
||||
.getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "http://www.miodominio.it/xxx_response-#-@.html";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
String cmd = getCmd(req).toLowerCase();
|
||||
if (cmd.equals("send")) {
|
||||
sendRequest(req, res);
|
||||
} else if (getCmd(req).equals("risultato") ||
|
||||
getCmd(req).equals("result")) {
|
||||
preparePaymentResultPage(req, res);
|
||||
setJspPage(getResponseJsp(req, res), req);
|
||||
callJsp(req, res);
|
||||
} else {
|
||||
getResponse(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void sendRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
boolean testMode = (getParm("TEST").getNumeroInt() == 1);
|
||||
SetefiReq setefiReq = new SetefiReq();
|
||||
fillObject(req, setefiReq);
|
||||
String theUrl = "https://test.monetaonline.it/monetaweb/hosted/init/http";
|
||||
if (testMode) {
|
||||
theUrl = "https://test.monetaonline.it/monetaweb/hosted/init/http";
|
||||
setefiReq.setId(getParm("MONETAONLINE_ID").getTesto());
|
||||
setefiReq.setPassword(getParm("MONETAONLINE_PASSWORD")
|
||||
.getTesto());
|
||||
} else {
|
||||
setefiReq.setId("99999999");
|
||||
setefiReq.setPassword("99999999");
|
||||
}
|
||||
setefiReq.setResponseurl(getResponseUrl(req, res));
|
||||
String rawData = setefiReq.getRawdata();
|
||||
if (!rawData.equals("")) {
|
||||
String type = "application/x-www-form-urlencoded";
|
||||
String encodedData = rawData;
|
||||
URL u = new URL("https://test.monetaonline.it/monetaweb/hosted/init/http");
|
||||
HttpURLConnection conn = (HttpURLConnection)u.openConnection();
|
||||
conn.setDoInput(true);
|
||||
conn.setDoOutput(true);
|
||||
conn.setUseCaches(false);
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setRequestProperty("Content-Type", type);
|
||||
conn.setRequestProperty("Content-Length",
|
||||
String.valueOf(encodedData.length()));
|
||||
conn.connect();
|
||||
DataOutputStream os = new DataOutputStream(
|
||||
conn.getOutputStream());
|
||||
os.writeBytes(encodedData);
|
||||
os.flush();
|
||||
os.close();
|
||||
BufferedReader read = new BufferedReader(new InputStreamReader(
|
||||
conn.getInputStream()));
|
||||
String line = read.readLine();
|
||||
String html = "";
|
||||
while (line != null) {
|
||||
html = html + html;
|
||||
line = read.readLine();
|
||||
}
|
||||
int idx2dot = html.indexOf(":");
|
||||
String paymentId = html.substring(0, html.indexOf(":"));
|
||||
String url = html.substring(idx2dot + 1, html.length());
|
||||
String paymentUrl = url + "?paymentid=" + url;
|
||||
System.out.println(paymentUrl);
|
||||
ResParm rp = recordPaymentId(req, res, paymentId);
|
||||
if (rp.getStatus()) {
|
||||
res.sendRedirect(paymentUrl);
|
||||
} else {
|
||||
setJspPageRelative(getResponsePage(req, res), req);
|
||||
sendMessage(req, rp.getErrMsg());
|
||||
getResponse(req, res);
|
||||
callJsp(req, res);
|
||||
}
|
||||
} else {
|
||||
setJspPageRelative(getResponsePage(req, res), req);
|
||||
String temp = "ERRORE!!MonetaOnline Svlt! Impossibile creare url di richiesta!";
|
||||
sendMessage(req, temp);
|
||||
getResponse(req, res);
|
||||
handleDebug(temp, 2);
|
||||
callJsp(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getResponseJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("MONETAONLINE_RESPONSE_JSP").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "/payResMO.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected abstract ResParm recordPaymentId(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, String paramString);
|
||||
|
||||
protected String getResponseUrl(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("MONETAONLINE_RESPONSE_URL").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "http://www.miodoninio.it/RicevutaMO.abl";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected abstract void preparePaymentResultPage(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse);
|
||||
|
||||
protected abstract void checkPaymentId(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, SetefiResp paramSetefiResp);
|
||||
|
||||
protected void getResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
req.setAttribute("responsecode", "000");
|
||||
req.setAttribute("result", "Accepted");
|
||||
req.setAttribute("trackid", "6");
|
||||
req.setAttribute("paymentid", "316061656072333389");
|
||||
req.setAttribute("tranid", "316061656072333389");
|
||||
SetefiResp setefiResp = new SetefiResp();
|
||||
fillObject(req, setefiResp);
|
||||
checkPaymentId(req, res, setefiResp);
|
||||
String theUrl = getResponsePage(req, res).replace("#",
|
||||
setefiResp.getTrackid());
|
||||
theUrl = theUrl.replace("@",
|
||||
String.valueOf(setefiResp.getPaymentid()));
|
||||
System.out.println("redirect url :" + theUrl);
|
||||
sendHtmlMsgResponse(req, res, "redirect=" + theUrl);
|
||||
} catch (Exception e) {
|
||||
setJspPageRelative(getResponsePage(req, res), req);
|
||||
String temp = "ERRORE!!MONETAONLINE ! Risposta non valida: ";
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
setJspPage(getResponsePage(req, res), req);
|
||||
callJsp(req, res);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package it.acxent.bank.servlet.stripe;
|
||||
|
||||
import it.acxent.bank.stripe.StripeResp;
|
||||
import it.acxent.db.ResParm;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class _StripeResponseSvlt extends _StripeSvlt {
|
||||
private static final long serialVersionUID = 571692091994662023L;
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
getResponse(req, res);
|
||||
}
|
||||
|
||||
protected void getResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
StripeResp stripeRes = new StripeResp();
|
||||
fillObject(req, stripeRes);
|
||||
if (stripeRes.getRedirect_status().equals("succeeded")) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
recordOrder(req, res, stripeRes);
|
||||
} else {
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
}
|
||||
req.setAttribute("stripeResp", stripeRes);
|
||||
preparePaymenResPage(req, res, stripeRes);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!Stripe Error! Risposta non valida: ";
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
preparePaymenResPage(req, res, null);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void preparePaymenResPage(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, StripeResp paramStripeResp);
|
||||
|
||||
protected abstract void recordOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, StripeResp paramStripeResp);
|
||||
|
||||
protected long getAmount(HttpServletRequest req, long l_id) {
|
||||
return 0L;
|
||||
}
|
||||
|
||||
protected ResParm saveClientSecret(HttpServletRequest req, long l_id, String l_clientSecret) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
package it.acxent.bank.servlet.stripe;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.stripe.Stripe;
|
||||
import com.stripe.model.PaymentIntent;
|
||||
import com.stripe.param.PaymentIntentCreateParams;
|
||||
import it.acxent.bank.stripe.CreatePaymentResponse;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.servlet.AcServlet;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public abstract class _StripeSvlt extends AcServlet {
|
||||
private static Gson gson = new Gson();
|
||||
|
||||
private static final long serialVersionUID = 7052017571211783636L;
|
||||
|
||||
protected static final String BEAN_STRIPE_RESP = "stripeResp";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getStripeSecretApiKey(HttpServletRequest req) {
|
||||
return getParm("STRIPE_PRIVATE_KEY").getTesto();
|
||||
}
|
||||
|
||||
protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return getJspKoPage(req, res);
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("STRIPE_OK_PAGE").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "stripeRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "stripeRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
_getPaymentIntent(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void _getPaymentIntent(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
Stripe.apiKey = getStripeSecretApiKey(req);
|
||||
String body = req.getReader().lines().reduce("", String::concat);
|
||||
JSONObject jo = new JSONObject(body).getJSONObject("orderData");
|
||||
long l_id = jo.getLong("id");
|
||||
String l_descrizione = jo.getString("descOrdine");
|
||||
System.out.println("" + l_id + " " + l_id);
|
||||
System.out.println("body: " + body);
|
||||
Long amount = getAmount(req, l_id);
|
||||
if (amount == 0L) {
|
||||
sendHtmlMsgResponse(req, res, "Error: amount==0!!!");
|
||||
} else {
|
||||
PaymentIntentCreateParams params = PaymentIntentCreateParams.builder().setAmount(amount).setCurrency("eur")
|
||||
.setAutomaticPaymentMethods(PaymentIntentCreateParams.AutomaticPaymentMethods.builder().setEnabled(Boolean.valueOf(true)).build())
|
||||
.build();
|
||||
PaymentIntent paymentIntent = PaymentIntent.create(params);
|
||||
CreatePaymentResponse paymentResponse = new CreatePaymentResponse(paymentIntent.getClientSecret());
|
||||
saveClientSecret(req, l_id, paymentIntent.getClientSecret());
|
||||
sendHtmlMsgResponse(req, res, gson.toJson(paymentResponse));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
sendHtmlMsgResponse(req, res, "Error: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract ResParm saveClientSecret(HttpServletRequest paramHttpServletRequest, long paramLong, String paramString);
|
||||
|
||||
protected abstract long getAmount(HttpServletRequest paramHttpServletRequest, long paramLong);
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
package it.acxent.bank.servlet.stripe;
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package it.acxent.bank.servlet.xpay;
|
||||
|
||||
import it.acxent.bank.xpay.XpayResp;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class GetXpayResponseSvlt extends XpaySvlt {
|
||||
protected abstract void preparePaymenResPage(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, XpayResp paramXpayResp);
|
||||
|
||||
protected abstract void recordOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, XpayResp paramXpayResp);
|
||||
|
||||
protected void getResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
XpayResp xpRes = new XpayResp(getApFull(req));
|
||||
fillObject(req, xpRes);
|
||||
xpRes.setBRAND(getRequestParameter(req, "$BRAND"));
|
||||
if (xpRes.isMacRitornoOk()) {
|
||||
if (xpRes.getEsito() != null && xpRes.getEsito().equals("OK")) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
recordOrder(req, res, xpRes);
|
||||
req.setAttribute("XPAYResp", xpRes);
|
||||
preparePaymenResPage(req, res, xpRes);
|
||||
} else {
|
||||
preparePaymenResPage(req, res, xpRes);
|
||||
resetId_documentoXpay(req, res, xpRes);
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
}
|
||||
callJsp(req, res);
|
||||
} else {
|
||||
xpRes.setEsito("KO");
|
||||
preparePaymenResPage(req, res, xpRes);
|
||||
resetId_documentoXpay(req, res, xpRes);
|
||||
setJspPageRelative(getJspKoPage(req, res), req);
|
||||
sendMessage(req, "ATTENZIONE!! Codice mac di controllo errato.");
|
||||
req.setAttribute("XPAYResp", xpRes);
|
||||
callJsp(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!XPAY ! Risposta non valida: ";
|
||||
sendMessage(req, temp);
|
||||
handleDebug(temp, 2);
|
||||
preparePaymenResPage(req, res, null);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
getResponse(req, res);
|
||||
}
|
||||
|
||||
protected void prepareSendRequest(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected abstract void resetId_documentoXpay(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, XpayResp paramXpayResp);
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package it.acxent.bank.servlet.xpay;
|
||||
|
||||
import it.acxent.bank.infogroup.ShopnetResp;
|
||||
import it.acxent.bank.xpay.XpayReq;
|
||||
import it.acxent.servlet.AcServlet;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class XpaySvlt extends AcServlet {
|
||||
protected static final String BEAN_XPAY_RES = "XPAYResp";
|
||||
|
||||
protected static final String CMD_GET_RES = "res";
|
||||
|
||||
protected static final String CMD_SEND_REQ = "send";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void getResponse(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("XPAY_PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return getJspKoPage(req, res);
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("XPAY_PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("XPAY_PAY_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
String cmd = getCmd(req).toLowerCase();
|
||||
try {
|
||||
if (cmd.equals("send")) {
|
||||
sendRequest(req, res);
|
||||
} else if (cmd.equals("res")) {
|
||||
getResponse(req, res);
|
||||
} else {
|
||||
sendRequest(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void payKoUpdateOrder(HttpServletRequest req, HttpServletResponse res, ShopnetResp snRes) {}
|
||||
|
||||
protected void sendRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
String theUrl;
|
||||
prepareSendRequest(req, res);
|
||||
XpayReq xpayReq = new XpayReq(getApFull(req));
|
||||
fillObject(req, xpayReq);
|
||||
if (getParm("TEST").isTrue()) {
|
||||
theUrl = xpayReq.getTestRequestUrl();
|
||||
} else {
|
||||
theUrl = xpayReq.getRequestUrl();
|
||||
}
|
||||
System.out.println(theUrl);
|
||||
if (!theUrl.equals("")) {
|
||||
res.sendRedirect(theUrl);
|
||||
} else {
|
||||
setJspPageRelative(getJspErrorPage(req, res), req);
|
||||
String temp = "ERRORE!!XPAY Svlt! Impossibile creare url di richiesta!";
|
||||
sendMessage(req, temp);
|
||||
getResponse(req, res);
|
||||
handleDebug(temp, 2);
|
||||
callJsp(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getUrlResponse(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("XPAY_URL_RESPONSE").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "RicevutaKC.abl";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getUrlResponseNull(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("XPAY_URL_RESPONSE_NULL").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "RicevutaKC.abl";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected abstract void prepareSendRequest(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse);
|
||||
}
|
||||
|
|
@ -0,0 +1,260 @@
|
|||
package it.acxent.bank.setefi;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
import it.acxent.common.Parm;
|
||||
import it.acxent.common.StatusMsg;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
|
||||
public class SetefiReq extends _BankAdapter {
|
||||
public static final String LANG_CODE_IT = "ITA";
|
||||
|
||||
public static final String LANG_CODE_EN = "USA";
|
||||
|
||||
public static final String LANG_CODE_ES = "SPA";
|
||||
|
||||
public static final String LANG_CODE_FR = "FRA";
|
||||
|
||||
public static final String LANG_CODE_DE = "DEU";
|
||||
|
||||
public static final String DIV_CODE_EURO = "978";
|
||||
|
||||
public static final String P_MONETAONLINE_ID = "MONETAONLINE_ID";
|
||||
|
||||
public static final String DEFAULT_RESPONSE_URL = "MONETAONLINE_ID";
|
||||
|
||||
public static final String DEFAULT_RESPONSE_PAGE = "payResMO.jsp";
|
||||
|
||||
public static final String DIV_CODE_DOLLARL_HK = "103";
|
||||
|
||||
public static final String TEST_URL = "https://test.monetaonline.it/monetaweb/hosted/init/http";
|
||||
|
||||
public static final String REQ_URL = "https://test.monetaonline.it/monetaweb/hosted/init/http";
|
||||
|
||||
private String id;
|
||||
|
||||
private String trackid;
|
||||
|
||||
private String titolareCarta;
|
||||
|
||||
private String email;
|
||||
|
||||
private String lang;
|
||||
|
||||
private String responseurl;
|
||||
|
||||
private double amt;
|
||||
|
||||
private String password;
|
||||
|
||||
private String descPagamento;
|
||||
|
||||
private String divisa;
|
||||
|
||||
public static final String BEAN_MO_RES = "MOResp";
|
||||
|
||||
public static final String P_MONETAONLINE_RESPONSE_JSP = "MONETAONLINE_RESPONSE_JSP";
|
||||
|
||||
public static final String TEST_PASSWORD = "99999999";
|
||||
|
||||
public static final String TEST_ID = "99999999";
|
||||
|
||||
public static final String P_MONETAONLINE_RESPONSE_URL = "MONETAONLINE_RESPONSE_URL";
|
||||
|
||||
public static final String P_MONETAONLINE_PASSWORD = "MONETAONLINE_PASSWORD";
|
||||
|
||||
public static final String P_MONETAONLINE_RESPONSE_PAGE = "MONETAONLINE_RESPONSE_PAGE";
|
||||
|
||||
public static final String DIV_CODE_DOLLARI = "1";
|
||||
|
||||
public double getAmt() {
|
||||
return this.amt;
|
||||
}
|
||||
|
||||
public void setAmt(double myamount) {
|
||||
this.amt = myamount;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return (this.email == null) ? "" : this.email;
|
||||
}
|
||||
|
||||
public void setEmail(String mybuyeremail) {
|
||||
this.email = mybuyeremail;
|
||||
}
|
||||
|
||||
public String getTitolareCarta() {
|
||||
return (this.titolareCarta == null) ? "" : this.titolareCarta;
|
||||
}
|
||||
|
||||
public void setTitolareCarta(String mybuyername) {
|
||||
this.titolareCarta = mybuyername;
|
||||
}
|
||||
|
||||
public String getCurrencycode() {
|
||||
if (getDivisa().toLowerCase().equals("eu"))
|
||||
return "978";
|
||||
return "978";
|
||||
}
|
||||
|
||||
public String getDescPagamento() {
|
||||
return (this.descPagamento == null) ? "" : this.descPagamento;
|
||||
}
|
||||
|
||||
public void setDescPagamento(String mycustominfo) {
|
||||
this.descPagamento = mycustominfo;
|
||||
}
|
||||
|
||||
private String getMylanguageCode() {
|
||||
if (getLang().toLowerCase().equals("it"))
|
||||
return "ITA";
|
||||
if (getLang().toLowerCase().equals("en"))
|
||||
return "USA";
|
||||
if (getLang().toLowerCase().equals("es\t"))
|
||||
return "SPA";
|
||||
if (getLang().toLowerCase().equals("fr"))
|
||||
return "FRA";
|
||||
if (getLang().toLowerCase().equals("de"))
|
||||
return "DEU";
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getTrackid() {
|
||||
return (this.trackid == null) ? "" : this.trackid;
|
||||
}
|
||||
|
||||
public void setTrackid(String myshoptransactionID) {
|
||||
this.trackid = myshoptransactionID;
|
||||
}
|
||||
|
||||
public String getLang() {
|
||||
return (this.lang == null) ? "" : this.lang;
|
||||
}
|
||||
|
||||
public void setLang(String lang) {
|
||||
this.lang = lang;
|
||||
}
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
boolean debug = true;
|
||||
if (ap != null) {
|
||||
DBAdapter.logDebug(debug, "Setefi initParms: start");
|
||||
String l_tipoParm = "MONETAONLINE";
|
||||
StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm);
|
||||
Parm bean = new Parm(ap);
|
||||
bean.findByCodice("MONETAONLINE_ID");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("MONETAONLINE_ID");
|
||||
bean.setDescrizione("MONETAONLINE_ID");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("99999999");
|
||||
bean.setNota("ID MONETAONLINE<BR>CODICE DI PROVA: 99999999");
|
||||
bean.save();
|
||||
bean.findByCodice("MONETAONLINE_PASSWORD");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("MONETAONLINE_PASSWORD");
|
||||
bean.setDescrizione("MONETAONLINE_PASSWORD");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("99999999");
|
||||
bean.setNota("PASSWORD MONETAONLINE<BR> PASSWORD DI PROVA: 99999999");
|
||||
bean.save();
|
||||
bean.findByCodice("MONETAONLINE_RESPONSE_URL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("MONETAONLINE_RESPONSE_URL");
|
||||
bean.setDescrizione("MONETAONLINE_RESPONSE_URL");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://www.nomedominio.it/PayMO.abl");
|
||||
bean.setNota("QUALCOSA DEL TIPO http://www.nomedominio.it/PayMO.abl<br>E' l'url chiamata da setefi. Su moneta Online è sempre la stessa servlet!!");
|
||||
bean.save();
|
||||
bean.findByCodice("MONETAONLINE_RESPONSE_JSP");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("MONETAONLINE_RESPONSE_JSP");
|
||||
bean.setDescrizione("MONETAONLINE_RESPONSE_JSP");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("/payResMO.jsp");
|
||||
bean.setNota("QUALCOSA DEL TIPO <br>/payResMO.jsp.<br> E' la pagina jsp dove visualizziamo il risultato.");
|
||||
bean.save();
|
||||
bean.findByCodice("MONETAONLINE_RESPONSE_PAGE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("MONETAONLINE_RESPONSE_PAGE");
|
||||
bean.setDescrizione("MONETAONLINE_RESPONSE_PAGE");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://www.nomedominio.it/transazione_result-#-@.html");
|
||||
bean.setNota("QUALCOSA DEL TIPO <br>http://www.nomedominio.it/xxx_result-#-@.html.<br> si userà una regola di rewrite rule dove # è il trackid mentre @ +è il paymentid<br>Esempio rewrite rule:<br>result,PayMO.abl,result,,@id_astaUtente@paymentid");
|
||||
bean.save();
|
||||
DBAdapter.logDebug(debug, "Setefi initParms: stop");
|
||||
}
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return (this.id == null) ? "" : this.id.trim();
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return (this.password == null) ? "" : this.password.trim();
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getResponseurl() {
|
||||
return (this.responseurl == null) ? "" : this.responseurl.trim();
|
||||
}
|
||||
|
||||
public void setResponseurl(String responseurl) {
|
||||
this.responseurl = responseurl;
|
||||
}
|
||||
|
||||
public String getRawdata() {
|
||||
StringBuffer theUrl = new StringBuffer();
|
||||
theUrl.append("id=");
|
||||
theUrl.append(getId());
|
||||
theUrl.append("&password=");
|
||||
theUrl.append(getPassword());
|
||||
theUrl.append("&action=4");
|
||||
theUrl.append("&amt=");
|
||||
theUrl.append(getAmt());
|
||||
theUrl.append("¤cycode=");
|
||||
theUrl.append(getCurrencycode());
|
||||
theUrl.append("&langid=");
|
||||
theUrl.append(getMylanguageCode());
|
||||
theUrl.append("&responseurl=");
|
||||
theUrl.append(getResponseurl());
|
||||
theUrl.append("&errorurl=");
|
||||
theUrl.append(getResponseurl());
|
||||
theUrl.append("&trackid=");
|
||||
theUrl.append(getTrackid());
|
||||
if (!getDescPagamento().trim().isEmpty()) {
|
||||
theUrl.append("&udf1=");
|
||||
theUrl.append(getDescPagamento());
|
||||
}
|
||||
if (!getTitolareCarta().trim().isEmpty()) {
|
||||
theUrl.append("&udf2=");
|
||||
theUrl.append(getTitolareCarta() + ";" + getTitolareCarta());
|
||||
}
|
||||
return theUrl.toString();
|
||||
}
|
||||
|
||||
public String getDivisa() {
|
||||
return (this.divisa == null) ? "" : this.divisa.trim();
|
||||
}
|
||||
|
||||
public void setDivisa(String divisa) {
|
||||
this.divisa = divisa;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package it.acxent.bank.setefi;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
|
||||
public class SetefiResp extends _BankAdapter {
|
||||
private String trackid;
|
||||
|
||||
private String paymentid;
|
||||
|
||||
private String udf3;
|
||||
|
||||
private String udf1;
|
||||
|
||||
private String result;
|
||||
|
||||
private String auth;
|
||||
|
||||
private long id_ordine;
|
||||
|
||||
private String responsecode;
|
||||
|
||||
private String tranid;
|
||||
|
||||
private String udf4;
|
||||
|
||||
private String udf2;
|
||||
|
||||
public String getResponsecode() {
|
||||
return (this.responsecode == null) ? "" : this.responsecode;
|
||||
}
|
||||
|
||||
public void setResponsecode(String myalertcode) {
|
||||
this.responsecode = myalertcode;
|
||||
}
|
||||
|
||||
public String getTranid() {
|
||||
return (this.tranid == null) ? "" : this.tranid;
|
||||
}
|
||||
|
||||
public void setTranid(String myalertdescription) {
|
||||
this.tranid = myalertdescription;
|
||||
}
|
||||
|
||||
public String getAuth() {
|
||||
return (this.auth == null) ? "" : this.auth;
|
||||
}
|
||||
|
||||
public void setAuth(String myauthcode) {
|
||||
this.auth = myauthcode;
|
||||
}
|
||||
|
||||
public String getUdf2() {
|
||||
return (this.udf2 == null) ? "" : this.udf2;
|
||||
}
|
||||
|
||||
public void setUdf2(String mybuyeremail) {
|
||||
this.udf2 = mybuyeremail;
|
||||
}
|
||||
|
||||
public String getUdf3() {
|
||||
return (this.udf3 == null) ? "" : this.udf3;
|
||||
}
|
||||
|
||||
public void setUdf3(String mybuyername) {
|
||||
this.udf3 = mybuyername;
|
||||
}
|
||||
|
||||
public String getTrackid() {
|
||||
return (this.trackid == null) ? "" : this.trackid;
|
||||
}
|
||||
|
||||
public void setTrackid(String myshoplogin) {
|
||||
this.trackid = myshoplogin;
|
||||
}
|
||||
|
||||
public String getPaymentid() {
|
||||
return this.paymentid;
|
||||
}
|
||||
|
||||
public void setPaymentid(String myshoptrxID) {
|
||||
this.paymentid = myshoptrxID;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return (this.result == null) ? "" : this.result;
|
||||
}
|
||||
|
||||
public void setResult(String mytrxresult) {
|
||||
this.result = mytrxresult;
|
||||
}
|
||||
|
||||
public long getId_ordine() {
|
||||
return this.id_ordine;
|
||||
}
|
||||
|
||||
public void setId_ordine(long id_ordine) {
|
||||
this.id_ordine = id_ordine;
|
||||
}
|
||||
|
||||
public String getUdf1() {
|
||||
return (this.udf1 == null) ? "" : this.udf1;
|
||||
}
|
||||
|
||||
public void setUdf1(String udf1) {
|
||||
this.udf1 = udf1;
|
||||
}
|
||||
|
||||
public String getUdf4() {
|
||||
return (this.udf4 == null) ? "" : this.udf4;
|
||||
}
|
||||
|
||||
public void setUdf4(String udf4) {
|
||||
this.udf4 = udf4;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package it.acxent.bank.stripe;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class CreatePayment {
|
||||
@SerializedName("items")
|
||||
Object[] items;
|
||||
|
||||
public Object[] getItems() {
|
||||
return this.items;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package it.acxent.bank.stripe;
|
||||
|
||||
public class CreatePaymentResponse {
|
||||
private String clientSecret;
|
||||
|
||||
public CreatePaymentResponse(String clientSecret) {
|
||||
this.clientSecret = clientSecret;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
package it.acxent.bank.stripe;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
import it.acxent.common.Parm;
|
||||
import it.acxent.common.StatusMsg;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
|
||||
public class StripeResp extends _BankAdapter {
|
||||
public static final String STATUS_OK = "succeeded";
|
||||
|
||||
private static final long serialVersionUID = -1758842932626231725L;
|
||||
|
||||
private String payment_intent_client_secret;
|
||||
|
||||
private String redirect_status;
|
||||
|
||||
public static final String P_STRIPE_PUBLIC_KEY = "STRIPE_PUBLIC_KEY";
|
||||
|
||||
public static final String P_STRIPE_PRIVATE_KEY = "STRIPE_PRIVATE_KEY";
|
||||
|
||||
public static final String P_STRIPE_OK_PAGE = "STRIPE_OK_PAGE";
|
||||
|
||||
public static final String P_STRIPE_ERROR_PAGE = "STRIPE_ERROR_PAGE";
|
||||
|
||||
public static final String P_STRIPE_RETURN_URL = "STRIPE_RETURN_URL";
|
||||
|
||||
public static final String DEFAULT_OK_KO_PAGE = "documento.jsp";
|
||||
|
||||
public String getPayment_intent_client_secret() {
|
||||
return (this.payment_intent_client_secret == null) ? "" : this.payment_intent_client_secret;
|
||||
}
|
||||
|
||||
public void setPayment_intent_client_secret(String payment_intent_client_secret) {
|
||||
this.payment_intent_client_secret = payment_intent_client_secret;
|
||||
}
|
||||
|
||||
public String getRedirect_status() {
|
||||
return (this.redirect_status == null) ? "" : this.redirect_status;
|
||||
}
|
||||
|
||||
public void setRedirect_status(String redirect_status) {
|
||||
this.redirect_status = redirect_status;
|
||||
}
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
boolean debug = false;
|
||||
if (ap != null) {
|
||||
DBAdapter.logDebug(debug, "STRIPE initParms: start");
|
||||
String l_tipoParm = "STRIPE";
|
||||
StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm);
|
||||
Parm bean = new Parm(ap);
|
||||
bean.findByCodice("STRIPE_PRIVATE_KEY");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("STRIPE_PRIVATE_KEY");
|
||||
bean.setDescrizione("STRIPE_PRIVATE_KEY");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("sk_test_51MHqBEFFhtsn3P5AuY6fj2eSYzDUabXnSINJXzvztxBsZUCg8KbZXrkhKBgYpJV4zxcxSFrrD228AgA5bHj6kTAT00cwVDtxCH");
|
||||
bean.setNota("SECRET KEY STRIPE");
|
||||
bean.save();
|
||||
bean.findByCodice("STRIPE_PUBLIC_KEY");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("STRIPE_PUBLIC_KEY");
|
||||
bean.setDescrizione("STRIPE_PUBLIC_KEY");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("pk_test_51MHqBEFFhtsn3P5AVGKxfuDIKk9Na3FNvcf5WfuMEvcWDt794JTsDfJilOs8r3JGmhknmfS97f77we0vqB8w99fB004zcxkFdk");
|
||||
bean.setNota("PUBLIC KEY STRIPE");
|
||||
bean.save();
|
||||
bean.findByCodice("STRIPE_RETURN_URL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("STRIPE_RETURN_URL");
|
||||
bean.setDescrizione("STRIPE_RETURN_URL");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://localhost/cc/StripeResponse.abl");
|
||||
bean.setNota("URL DI RITORNO. DI SOLITO StripeResponse.abl");
|
||||
bean.save();
|
||||
bean.findByCodice("STRIPE_ERROR_PAGE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("STRIPE_ERROR_PAGE");
|
||||
bean.setDescrizione("STRIPE_ERROR_PAGE");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("documento.jsp");
|
||||
bean.setNota("STRIPE_OK_PAGE");
|
||||
bean.save();
|
||||
bean.findByCodice("STRIPE_OK_PAGE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("STRIPE_OK_PAGE");
|
||||
bean.setDescrizione("STRIPE_OK_PAGE");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("documento.jsp");
|
||||
bean.setNota("STRIPE_OK_PAGE");
|
||||
bean.save();
|
||||
DBAdapter.logDebug(debug, "STRIPE initParms: start");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
package it.acxent.bank.stripe;
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
package it.acxent.bank.taglib;
|
||||
|
||||
import it.acxent.common.Parm;
|
||||
import it.acxent.taglib.AbstractDbTag;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
|
||||
public class SellaObjTag extends AbstractDbTag {
|
||||
private String value;
|
||||
|
||||
private boolean condition = true;
|
||||
|
||||
protected int currentNestedValue;
|
||||
|
||||
private String codice;
|
||||
|
||||
private Parm parm;
|
||||
|
||||
protected static final String _WC = "_WC";
|
||||
|
||||
protected static final String _NESTVAL = "_WCNESTVAL";
|
||||
|
||||
public int doAfterBody() throws JspException {
|
||||
try {
|
||||
this.bodyContent.writeOut((Writer)this.bodyContent.getEnclosingWriter());
|
||||
setNestedValue();
|
||||
return 0;
|
||||
} catch (IOException ex) {
|
||||
throw new JspTagException(ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public int doStartTag() {
|
||||
this.currentNestedValue = getNestedValue();
|
||||
this.pageContext.setAttribute("_WC" + this.currentNestedValue, new Boolean(
|
||||
getWherecondition()));
|
||||
if (getWherecondition())
|
||||
return 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected int getNestedValue() {
|
||||
if (this.pageContext.getAttribute("_WCNESTVAL") == null) {
|
||||
this.pageContext.setAttribute("_WCNESTVAL", "1");
|
||||
return 1;
|
||||
}
|
||||
int nv = Integer.parseInt((String)
|
||||
this.pageContext.getAttribute("_WCNESTVAL"));
|
||||
nv++;
|
||||
this.pageContext.setAttribute("_WCNESTVAL", String.valueOf(nv));
|
||||
return nv;
|
||||
}
|
||||
|
||||
public boolean getWherecondition() {
|
||||
getParm().findByCodice(getCodice());
|
||||
if (this.parm.getDBState() == 1) {
|
||||
if ((getParm().getValore().equals(getValue()) && getCondition()) || (
|
||||
!getParm().getValore().equals(getValue()) && !getCondition()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void setNestedValue() {
|
||||
this.pageContext.setAttribute("_WCNESTVAL", String.valueOf(this.currentNestedValue));
|
||||
}
|
||||
|
||||
public String getCodice() {
|
||||
return this.codice;
|
||||
}
|
||||
|
||||
public Parm getParm() {
|
||||
if (this.parm == null)
|
||||
this.parm = new Parm(getApFull());
|
||||
return this.parm;
|
||||
}
|
||||
|
||||
public void setCodice(String code) {
|
||||
this.codice = code;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return (this.value == null) ? "" : this.value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean getCondition() {
|
||||
return this.condition;
|
||||
}
|
||||
|
||||
public void setCondition(boolean condition) {
|
||||
this.condition = condition;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,340 @@
|
|||
package it.acxent.bank.xpay;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
import it.acxent.common.Parm;
|
||||
import it.acxent.common.StatusMsg;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.reg.EcDc;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
public class XpayReq extends _BankAdapter {
|
||||
public static final String LANG_CODE_IT = "ITA";
|
||||
|
||||
public static final String LANG_CODE_EN = "ENG";
|
||||
|
||||
public static final String LANG_CODE_ES = "SPA";
|
||||
|
||||
public static final String LANG_CODE_FR = "FRA";
|
||||
|
||||
public static final String LANG_CODE_DE = "GER";
|
||||
|
||||
public static final String LANG_CODE_ITA_ENG = "ITA-ENG";
|
||||
|
||||
public static final String LANG_CODE_JPN = "JPN";
|
||||
|
||||
public static final String DIV_CODE_LIRA = "18";
|
||||
|
||||
public static final String DIV_CODE_EURO = "242";
|
||||
|
||||
public static final String DIV_CODE_STERLINE = "2";
|
||||
|
||||
public static final String DIV_CODE_YEN = "71";
|
||||
|
||||
public static final String DIV_CODE_DOLLARL_HK = "103";
|
||||
|
||||
public static final String DIV_CODE_REAL = "234";
|
||||
|
||||
private String divisa;
|
||||
|
||||
private String codTrans;
|
||||
|
||||
private String mail;
|
||||
|
||||
private String importo;
|
||||
|
||||
private String languageId;
|
||||
|
||||
public static final String TEST_ALIAS = "payment_3444153";
|
||||
|
||||
public static final String P_XPAY_MAC_KEY = "XPAY_MAC_KEY";
|
||||
|
||||
public static final String P_XPAY_URL_RESPONSE = "XPAY_URL_RESPONSE";
|
||||
|
||||
public static final String P_XPAY_ALIAS = "XPAY_ALIAS";
|
||||
|
||||
public static final String P_XPAY_PAYMENT_OK_PAGE = "XPAY_PAY_OK";
|
||||
|
||||
public static final String P_XPAY_PAYMENT_ERROR_PAGE = "XPAY_PAY_KO";
|
||||
|
||||
public static final String P_XPAY_URL_RESPONSE_NULL = "XPAY_URL_RESPONSE_NULL";
|
||||
|
||||
public static final String TEST_MAC = "TLGHTOWIZXQPTIZRALWKG";
|
||||
|
||||
public static final String REQ_URL = "https://ecommerce.keyclient.it/ecomm/ecomm/DispatcherServlet";
|
||||
|
||||
public static final String TEST_REQ_URL = "https://coll-ecommerce.keyclient.it/ecomm/ecomm/DispatcherServlet";
|
||||
|
||||
public static final String DIV_CODE_DOLLARI = "1";
|
||||
|
||||
public XpayReq() {}
|
||||
|
||||
public XpayReq(ApplParmFull apFull) {
|
||||
setAp(apFull);
|
||||
}
|
||||
|
||||
public String getCodTrans() {
|
||||
return (this.codTrans == null) ? "" : this.codTrans;
|
||||
}
|
||||
|
||||
public void setCodTrans(String myamount) {
|
||||
this.codTrans = myamount;
|
||||
}
|
||||
|
||||
public String getImporto() {
|
||||
return (this.importo == null) ? "" : this.importo;
|
||||
}
|
||||
|
||||
public void setImporto(String mybuyeremail) {
|
||||
this.importo = mybuyeremail;
|
||||
}
|
||||
|
||||
public String getMail() {
|
||||
return (this.mail == null) ? "" : this.mail;
|
||||
}
|
||||
|
||||
public void setMail(String mybuyername) {
|
||||
this.mail = mybuyername;
|
||||
}
|
||||
|
||||
public String getDivisa() {
|
||||
return (this.divisa == null) ? "" : this.divisa;
|
||||
}
|
||||
|
||||
public void setDivisa(String mycurrency) {
|
||||
this.divisa = mycurrency;
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return getParm("XPAY_ALIAS").getTesto();
|
||||
}
|
||||
|
||||
private String getMylanguageCode() {
|
||||
if (getLanguageId().toLowerCase().equals("it"))
|
||||
return "ITA";
|
||||
if (getLanguageId().toLowerCase().equals("en"))
|
||||
return "ENG";
|
||||
if (getLanguageId().toLowerCase().equals("es\t"))
|
||||
return "SPA";
|
||||
if (getLanguageId().toLowerCase().equals("fr"))
|
||||
return "FRA";
|
||||
if (getLanguageId().toLowerCase().equals("de"))
|
||||
return "GER";
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getMacEsempio() {
|
||||
String temp = "codTrans=" + getCodTrans() + "divisa=" + getDivisa() + "importo=1" + getKey();
|
||||
System.out.println("stringa mac: " + temp);
|
||||
String res = "";
|
||||
try {
|
||||
res = EcDc.cryptSHA1Plain(temp);
|
||||
System.out.println(res);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public String getMac() {
|
||||
String temp = "codTrans=" + getCodTrans() + "divisa=" + getDivisa() + "importo=" + getImportoUrl() + getKey();
|
||||
String res = "";
|
||||
try {
|
||||
res = EcDc.cryptSHA1Plain(temp);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public String getLanguageId() {
|
||||
return (this.languageId == null) ? "" : this.languageId;
|
||||
}
|
||||
|
||||
public void setLanguageId(String lang) {
|
||||
this.languageId = lang;
|
||||
}
|
||||
|
||||
public String getFullRequestUrl() {
|
||||
StringBuffer theUrl = new StringBuffer("https://ecommerce.keyclient.it/ecomm/ecomm/DispatcherServlet");
|
||||
theUrl.append("alias=");
|
||||
theUrl.append(getAlias());
|
||||
theUrl.append("&importo=");
|
||||
theUrl.append(getImporto());
|
||||
theUrl.append("&divisa=");
|
||||
theUrl.append(getDivisa());
|
||||
theUrl.append("&codTrans=");
|
||||
theUrl.append(getCodTrans());
|
||||
theUrl.append("&mail=");
|
||||
theUrl.append(getMail());
|
||||
theUrl.append("&mac=");
|
||||
try {
|
||||
theUrl.append(URLEncoder.encode(getMac(), "UTF-8"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
theUrl.append("&languageId=");
|
||||
theUrl.append(getLanguageId());
|
||||
theUrl.append("&url=");
|
||||
theUrl.append(getUrl());
|
||||
if (!getUrl_back().isEmpty()) {
|
||||
theUrl.append("&url_back=");
|
||||
theUrl.append(getUrl_back());
|
||||
}
|
||||
return theUrl.toString();
|
||||
}
|
||||
|
||||
public String getRequestUrl() {
|
||||
StringBuffer theUrl = new StringBuffer("https://ecommerce.keyclient.it/ecomm/ecomm/DispatcherServlet");
|
||||
theUrl.append("?alias=");
|
||||
theUrl.append(getAlias());
|
||||
theUrl.append("&importo=");
|
||||
theUrl.append(getImportoUrl());
|
||||
theUrl.append("&divisa=");
|
||||
theUrl.append(getDivisa());
|
||||
theUrl.append("&codTrans=");
|
||||
theUrl.append(getCodTrans());
|
||||
theUrl.append("&mail=");
|
||||
theUrl.append(getMail());
|
||||
theUrl.append("&mac=");
|
||||
try {
|
||||
theUrl.append(URLEncoder.encode(getMac(), "UTF-8"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
theUrl.append("&languageId=");
|
||||
theUrl.append(getLanguageId());
|
||||
theUrl.append("&url=");
|
||||
theUrl.append(getUrl());
|
||||
if (!getUrl_back().isEmpty()) {
|
||||
theUrl.append("&url_back=");
|
||||
theUrl.append(getUrl_back());
|
||||
}
|
||||
return theUrl.toString();
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return getParm("XPAY_MAC_KEY").getTesto();
|
||||
}
|
||||
|
||||
public String getImportoUrl() {
|
||||
if (this.importo == null)
|
||||
return "0000";
|
||||
String temp = this.importo;
|
||||
if (temp.indexOf('.') < 0) {
|
||||
temp = temp + "00";
|
||||
} else if (temp.length() - temp.indexOf('.') < 3) {
|
||||
temp = temp + "0";
|
||||
}
|
||||
return temp.replace(".", "");
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return getParm("XPAY_URL_RESPONSE").getTesto();
|
||||
}
|
||||
|
||||
public String getUrl_back() {
|
||||
return getParm("XPAY_URL_RESPONSE_NULL").getTesto();
|
||||
}
|
||||
|
||||
public String getTestRequestUrl() {
|
||||
StringBuffer theUrl = new StringBuffer("https://coll-ecommerce.keyclient.it/ecomm/ecomm/DispatcherServlet");
|
||||
theUrl.append("?alias=");
|
||||
theUrl.append("payment_3444153");
|
||||
theUrl.append("&importo=1");
|
||||
theUrl.append("&divisa=");
|
||||
theUrl.append(getDivisa());
|
||||
theUrl.append("&codTrans=");
|
||||
theUrl.append(getCodTrans());
|
||||
theUrl.append("&mail=");
|
||||
theUrl.append(getMail());
|
||||
theUrl.append("&mac=");
|
||||
try {
|
||||
theUrl.append(URLEncoder.encode(getMacEsempio(), "UTF-8"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
theUrl.append("&languageId=");
|
||||
theUrl.append(getLanguageId());
|
||||
theUrl.append("&url=");
|
||||
theUrl.append(getUrl());
|
||||
if (!getUrl_back().isEmpty()) {
|
||||
theUrl.append("&url_back=");
|
||||
theUrl.append(getUrl_back());
|
||||
}
|
||||
return theUrl.toString();
|
||||
}
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
boolean debug = false;
|
||||
if (ap != null) {
|
||||
DBAdapter.logDebug(debug, "Xpay initParms: start");
|
||||
String l_tipoParm = "XPAY";
|
||||
StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm);
|
||||
Parm bean = new Parm(ap);
|
||||
bean.findByCodice("XPAY_PAY_KO");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("XPAY_PAY_KO");
|
||||
bean.setDescrizione("XPAY_PAY_KO");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payRes.jsp");
|
||||
bean.setNota("XPAY_PAY_KO");
|
||||
bean.save();
|
||||
bean.findByCodice("XPAY_PAY_OK");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("XPAY_PAY_OK");
|
||||
bean.setDescrizione("XPAY_PAY_OK");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payRes.jsp");
|
||||
bean.setNota("XPAY_PAY_OK");
|
||||
bean.save();
|
||||
bean.findByCodice("XPAY_MAC_KEY");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("XPAY_MAC_KEY");
|
||||
bean.setDescrizione("XPAY_MAC_KEY");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("TLGHTOWIZXQPTIZRALWKG");
|
||||
if (bean.getNota().isEmpty())
|
||||
bean.setNota("XPAY_MAC_KEY. mac di esempio: TLGHTOWIZXQPTIZRALWKG");
|
||||
bean.save();
|
||||
bean.findByCodice("XPAY_ALIAS");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("XPAY_ALIAS");
|
||||
bean.setDescrizione("XPAY_ALIAS");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("payment_3444153");
|
||||
if (bean.getNota().isEmpty())
|
||||
bean.setNota("XPAY_MAC_KEY. ALIAS DI TEST: payment_3444153");
|
||||
bean.save();
|
||||
bean.findByCodice("XPAY_URL_RESPONSE_NULL");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("XPAY_URL_RESPONSE_NULL");
|
||||
bean.setDescrizione("XPAY_URL_RESPONSE_NULL");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://localhost/td/RicevutaXPAY.abl");
|
||||
bean.setNota("XPAY_PAY_OK");
|
||||
bean.save();
|
||||
bean.findByCodice("XPAY_URL_RESPONSE");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("XPAY_URL_RESPONSE");
|
||||
bean.setDescrizione("XPAY_URL_RESPONSE");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().equals(""))
|
||||
bean.setTesto("http://localhost/td/RicevutaXPAY.abl");
|
||||
bean.setNota("XPAY_URL_RESPONSE");
|
||||
bean.save();
|
||||
DBAdapter.logDebug(debug, "Xpay initParms: false");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,186 @@
|
|||
package it.acxent.bank.xpay;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.reg.EcDc;
|
||||
|
||||
public class XpayResp extends _BankAdapter {
|
||||
private long id_ordine;
|
||||
|
||||
private String importo;
|
||||
|
||||
private String data;
|
||||
|
||||
private String divisa;
|
||||
|
||||
private String session_id;
|
||||
|
||||
private String codTrans;
|
||||
|
||||
private String orario;
|
||||
|
||||
private String esito;
|
||||
|
||||
private String codAut;
|
||||
|
||||
private String BRAND;
|
||||
|
||||
private String nome;
|
||||
|
||||
private String cognome;
|
||||
|
||||
private String email;
|
||||
|
||||
private String mac;
|
||||
|
||||
private String messaggio;
|
||||
|
||||
public static final String ESITO_OK = "OK";
|
||||
|
||||
public static final String ESITO_KO = "KO";
|
||||
|
||||
public XpayResp() {}
|
||||
|
||||
public XpayResp(ApplParmFull apFull) {
|
||||
setAp(apFull);
|
||||
}
|
||||
|
||||
public long getId_ordine() {
|
||||
return this.id_ordine;
|
||||
}
|
||||
|
||||
public void setId_ordine(long id_ordine) {
|
||||
this.id_ordine = id_ordine;
|
||||
}
|
||||
|
||||
public String getImporto() {
|
||||
return (this.importo == null) ? "" : this.importo;
|
||||
}
|
||||
|
||||
public void setImporto(String importo) {
|
||||
this.importo = importo;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return (this.data == null) ? "" : this.data;
|
||||
}
|
||||
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public String getDivisa() {
|
||||
return (this.divisa == null) ? "" : this.divisa;
|
||||
}
|
||||
|
||||
public void setDivisa(String divisa) {
|
||||
this.divisa = divisa;
|
||||
}
|
||||
|
||||
public String getSession_id() {
|
||||
return (this.session_id == null) ? "" : this.session_id;
|
||||
}
|
||||
|
||||
public void setSession_id(String session_id) {
|
||||
this.session_id = session_id;
|
||||
}
|
||||
|
||||
public String getCodTrans() {
|
||||
return (this.codTrans == null) ? "" : this.codTrans;
|
||||
}
|
||||
|
||||
public void setCodTrans(String codTrans) {
|
||||
this.codTrans = codTrans;
|
||||
}
|
||||
|
||||
public String getOrario() {
|
||||
return (this.orario == null) ? "" : this.orario;
|
||||
}
|
||||
|
||||
public void setOrario(String orario) {
|
||||
this.orario = orario;
|
||||
}
|
||||
|
||||
public String getEsito() {
|
||||
return (this.esito == null) ? "" : this.esito;
|
||||
}
|
||||
|
||||
public void setEsito(String esito) {
|
||||
this.esito = esito;
|
||||
}
|
||||
|
||||
public String getCodAut() {
|
||||
return (this.codAut == null) ? "" : this.codAut;
|
||||
}
|
||||
|
||||
public void setCodAut(String codAut) {
|
||||
this.codAut = codAut;
|
||||
}
|
||||
|
||||
public String getBRAND() {
|
||||
return (this.BRAND == null) ? "" : this.BRAND;
|
||||
}
|
||||
|
||||
public void setBRAND(String brand) {
|
||||
this.BRAND = brand;
|
||||
}
|
||||
|
||||
public String getNome() {
|
||||
return (this.nome == null) ? "" : this.nome;
|
||||
}
|
||||
|
||||
public void setNome(String nome) {
|
||||
this.nome = nome;
|
||||
}
|
||||
|
||||
public String getCognome() {
|
||||
return (this.cognome == null) ? "" : this.cognome;
|
||||
}
|
||||
|
||||
public void setCognome(String cognome) {
|
||||
this.cognome = cognome;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return (this.email == null) ? "" : this.email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getMac() {
|
||||
return (this.mac == null) ? "" : this.mac;
|
||||
}
|
||||
|
||||
public void setMac(String mac) {
|
||||
this.mac = mac;
|
||||
}
|
||||
|
||||
public String getMessaggio() {
|
||||
return (this.messaggio == null) ? "" : this.messaggio.trim();
|
||||
}
|
||||
|
||||
public void setMessaggio(String messaggio) {
|
||||
this.messaggio = messaggio;
|
||||
}
|
||||
|
||||
public boolean isMacRitornoOk() {
|
||||
String temp = "codTrans=" + getCodTrans() + "esito=" + getEsito() + "importo=" + getImporto() + "divisa=" + getDivisa() + "data=" +
|
||||
getData() + "orario=" + getOrario() + "codAut=" + getCodAut() + getKey();
|
||||
String res = "";
|
||||
try {
|
||||
res = EcDc.cryptSHA1Plain(temp);
|
||||
if (res.equals(getMac()))
|
||||
return true;
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return getParm("XPAY_MAC_KEY").getTesto();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
package it.acxent.gtbill;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
import it.acxent.common.Parm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
|
||||
public class GTBillReq extends _BankAdapter {
|
||||
public static final String P_GTBILL_MERCHANT_ID = "GTBILL_MERCHANT_ID";
|
||||
|
||||
public static final String P_GTBILL_SITE_ID = "GTBILL_SITE_ID";
|
||||
|
||||
public static final String P_GTBILL_RETURN_URL = "GTBILL_RETURN_URL";
|
||||
|
||||
public static final String DIV_CODE_EURO = "EUR";
|
||||
|
||||
public static final String DIV_CODE_DOLLARI = "USD";
|
||||
|
||||
public static final String DIV_CODE_STERLINE = "GBP";
|
||||
|
||||
public static final String DIV_CODE_CAN = "CAD";
|
||||
|
||||
public static final String DIV_CODE_REAL = "234";
|
||||
|
||||
private String mycurrencyid;
|
||||
|
||||
private String myamounttotal;
|
||||
|
||||
private String myamountshipping;
|
||||
|
||||
private String myitemname;
|
||||
|
||||
private String myitemquantity;
|
||||
|
||||
private String myitemamount;
|
||||
|
||||
private String myitemdesc;
|
||||
|
||||
public static final String FORM_URL_POST = "https://sale.GTBill.com/quickpay.aspx";
|
||||
|
||||
public static final String PROG_LANG_URL_POST = "https://sale.GTBill.com/quickpay2.aspx";
|
||||
|
||||
public static final String PROG_LANG_URL_POST_REDIRECT = "https://sale.GTBill.com/quickpay.aspx?refid=";
|
||||
|
||||
public static void initApplicationParms(ApplParmFull ap) {
|
||||
if (ap != null) {
|
||||
Parm bean = new Parm(ap);
|
||||
String l_tipoParm = "GTBILL";
|
||||
bean.findByCodice("GTBILL_MERCHANT_ID");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("GTBILL_MERCHANT_ID");
|
||||
bean.setDescrizione("GTBILL_MERCHANT_ID");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("MERCHANT ID ASSEGNATO DALLA BANCA");
|
||||
bean.save();
|
||||
bean.findByCodice("GTBILL_SITE_ID");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("GTBILL_SITE_ID");
|
||||
bean.setDescrizione("GTBILL_SITE_ID");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("SITE ID ASSEGNATO DALLA BANCA");
|
||||
bean.save();
|
||||
bean.findByCodice("GTBILL_RETURN_URL");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("GTBILL_RETURN_URL");
|
||||
bean.setDescrizione("GTBILL_RETURN_URL");
|
||||
bean.setFlgTipo(0L);
|
||||
bean.setNota("URL AL QUALE SI DEVE RITORNARE DOPO IL PAGAMENTO");
|
||||
bean.save();
|
||||
}
|
||||
}
|
||||
|
||||
public String getMyamounttotal() {
|
||||
return (this.myamounttotal == null) ? "" :
|
||||
this.myamounttotal.replace(".", ",").replace(",", ".");
|
||||
}
|
||||
|
||||
public void setMyamounttotal(String myamount) {
|
||||
this.myamounttotal = myamount;
|
||||
}
|
||||
|
||||
public String getMycurrencyid() {
|
||||
return (this.mycurrencyid == null) ? "" : this.mycurrencyid;
|
||||
}
|
||||
|
||||
public void setMycurrencyid(String mycurrency) {
|
||||
this.mycurrencyid = mycurrency;
|
||||
}
|
||||
|
||||
public String getMyamountshipping() {
|
||||
return (this.myamountshipping == null) ? "" :
|
||||
this.myamountshipping;
|
||||
}
|
||||
|
||||
public void setMyamountshipping(String myamountshipping) {
|
||||
this.myamountshipping = myamountshipping;
|
||||
}
|
||||
|
||||
public String getMyitemname() {
|
||||
return (this.myitemname == null) ? "" : this.myitemname;
|
||||
}
|
||||
|
||||
public void setMyitemname(String myitemname) {
|
||||
this.myitemname = myitemname;
|
||||
}
|
||||
|
||||
public String getMyitemquantity() {
|
||||
return (this.myitemquantity == null) ? "" :
|
||||
this.myitemquantity;
|
||||
}
|
||||
|
||||
public void setMyitemquantity(String myitemquantity) {
|
||||
this.myitemquantity = myitemquantity;
|
||||
}
|
||||
|
||||
public String getMyitemamount() {
|
||||
return (this.myitemamount == null) ? "" :
|
||||
this.myitemamount.replace(".", ",").replace(",", ".");
|
||||
}
|
||||
|
||||
public void setMyitemamount(String myitemamount) {
|
||||
this.myitemamount = myitemamount;
|
||||
}
|
||||
|
||||
public String getMyitemdesc() {
|
||||
return (this.myitemdesc == null) ? "" : this.myitemdesc;
|
||||
}
|
||||
|
||||
public void setMyitemdesc(String myitemdesc) {
|
||||
this.myitemdesc = myitemdesc;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,158 @@
|
|||
package it.acxent.gtbill;
|
||||
|
||||
import it.acxent.bank._BankAdapter;
|
||||
|
||||
public class GTBillRes extends _BankAdapter {
|
||||
private String myshoplogin;
|
||||
|
||||
private int mycurrency;
|
||||
|
||||
private float myamount;
|
||||
|
||||
private String myshoptrxID;
|
||||
|
||||
private String mybuyername;
|
||||
|
||||
private String mybuyeremail;
|
||||
|
||||
private String mytrxresult;
|
||||
|
||||
private String myauthcode;
|
||||
|
||||
private String myerrorcode;
|
||||
|
||||
private String myerrordescription;
|
||||
|
||||
private String myerrorbanktrxid;
|
||||
|
||||
private long id_ordine;
|
||||
|
||||
private String myalertcode;
|
||||
|
||||
private String myalertdescription;
|
||||
|
||||
private String mycustominfo;
|
||||
|
||||
public String getMyalertcode() {
|
||||
return (this.myalertcode == null) ? "" : this.myalertcode;
|
||||
}
|
||||
|
||||
public void setMyalertcode(String myalertcode) {
|
||||
this.myalertcode = myalertcode;
|
||||
}
|
||||
|
||||
public String getMyalertdescription() {
|
||||
return (this.myalertdescription == null) ? "" :
|
||||
this.myalertdescription;
|
||||
}
|
||||
|
||||
public void setMyalertdescription(String myalertdescription) {
|
||||
this.myalertdescription = myalertdescription;
|
||||
}
|
||||
|
||||
public float getMyamount() {
|
||||
return this.myamount;
|
||||
}
|
||||
|
||||
public void setMyamount(float myamount) {
|
||||
this.myamount = myamount;
|
||||
}
|
||||
|
||||
public String getMyauthcode() {
|
||||
return (this.myauthcode == null) ? "" : this.myauthcode;
|
||||
}
|
||||
|
||||
public void setMyauthcode(String myauthcode) {
|
||||
this.myauthcode = myauthcode;
|
||||
}
|
||||
|
||||
public String getMybuyeremail() {
|
||||
return (this.mybuyeremail == null) ? "" : this.mybuyeremail;
|
||||
}
|
||||
|
||||
public void setMybuyeremail(String mybuyeremail) {
|
||||
this.mybuyeremail = mybuyeremail;
|
||||
}
|
||||
|
||||
public String getMybuyername() {
|
||||
return (this.mybuyername == null) ? "" : this.mybuyername;
|
||||
}
|
||||
|
||||
public void setMybuyername(String mybuyername) {
|
||||
this.mybuyername = mybuyername;
|
||||
}
|
||||
|
||||
public int getMycurrency() {
|
||||
return this.mycurrency;
|
||||
}
|
||||
|
||||
public void setMycurrency(int mycurrency) {
|
||||
this.mycurrency = mycurrency;
|
||||
}
|
||||
|
||||
public String getMycustominfo() {
|
||||
return (this.mycustominfo == null) ? "" : this.mycustominfo;
|
||||
}
|
||||
|
||||
public void setMycustominfo(String mycustominfo) {
|
||||
this.mycustominfo = mycustominfo;
|
||||
}
|
||||
|
||||
public String getMyerrorbanktrxid() {
|
||||
return (this.myerrorbanktrxid == null) ? "" :
|
||||
this.myerrorbanktrxid;
|
||||
}
|
||||
|
||||
public void setMyerrorbanktrxid(String myerrorbanktrxid) {
|
||||
this.myerrorbanktrxid = myerrorbanktrxid;
|
||||
}
|
||||
|
||||
public String getMyerrorcode() {
|
||||
return (this.myerrorcode == null) ? "" : this.myerrorcode;
|
||||
}
|
||||
|
||||
public void setMyerrorcode(String myerrorcode) {
|
||||
this.myerrorcode = myerrorcode;
|
||||
}
|
||||
|
||||
public String getMyerrordescription() {
|
||||
return (this.myerrordescription == null) ? "" :
|
||||
this.myerrordescription;
|
||||
}
|
||||
|
||||
public void setMyerrordescription(String myerrordescription) {
|
||||
this.myerrordescription = myerrordescription;
|
||||
}
|
||||
|
||||
public String getMyshoplogin() {
|
||||
return (this.myshoplogin == null) ? "" : this.myshoplogin;
|
||||
}
|
||||
|
||||
public void setMyshoplogin(String myshoplogin) {
|
||||
this.myshoplogin = myshoplogin;
|
||||
}
|
||||
|
||||
public String getMyshoptrxID() {
|
||||
return (this.myshoptrxID == null) ? "" : this.myshoptrxID;
|
||||
}
|
||||
|
||||
public void setMyshoptrxID(String myshoptrxID) {
|
||||
this.myshoptrxID = myshoptrxID;
|
||||
}
|
||||
|
||||
public String getMytrxresult() {
|
||||
return (this.mytrxresult == null) ? "" : this.mytrxresult;
|
||||
}
|
||||
|
||||
public void setMytrxresult(String mytrxresult) {
|
||||
this.mytrxresult = mytrxresult;
|
||||
}
|
||||
|
||||
public long getId_ordine() {
|
||||
return this.id_ordine;
|
||||
}
|
||||
|
||||
public void setId_ordine(long id_ordine) {
|
||||
this.id_ordine = id_ordine;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package it.acxent.gtbill.servlet;
|
||||
|
||||
import it.acxent.gtbill.GTBillReq;
|
||||
import it.acxent.servlet.AcServlet;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class GTBillSvlt extends AcServlet {
|
||||
private static final long serialVersionUID = 6201212373211424420L;
|
||||
|
||||
protected static final String CMD_SEND_REQ = "send";
|
||||
|
||||
protected static final String CMD_GET_RES = "res";
|
||||
|
||||
protected static final String BEAN_SELLA_RES = "sellaResp";
|
||||
|
||||
protected final void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative(getJspOkPage(req, res), req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext()
|
||||
.getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void sendRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
GTBillReq gtbillreq = new GTBillReq();
|
||||
fillObject(req, gtbillreq);
|
||||
String theUrl = "https://sale.GTBill.com/quickpay2.aspx";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("?MerchantID=");
|
||||
sb.append(getApFull().getParm("GTBILL_MERCHANT_ID"));
|
||||
sb.append("&SiteID=");
|
||||
sb.append(getApFull().getParm("GTBILL_SITE_ID"));
|
||||
sb.append("&AmountTotal=");
|
||||
sb.append(gtbillreq.getMyamounttotal());
|
||||
sb.append("&CurrencyID=");
|
||||
sb.append("EUR");
|
||||
sb.append("&AmountShipping=");
|
||||
sb.append(gtbillreq.getMyamountshipping());
|
||||
sb.append("&ReturnURL=");
|
||||
sb.append(getApFull().getParm("GTBILL_RETURN_URL"));
|
||||
sb.append("&ItemAmount[0]=");
|
||||
sb.append(gtbillreq.getMyitemamount());
|
||||
sb.append("&ItemDesc[0]=");
|
||||
sb.append(gtbillreq.getMyitemdesc());
|
||||
sb.append("&ItemName[0]=");
|
||||
sb.append(gtbillreq.getMyitemname());
|
||||
sb.append("&ItemQuantity[0]=");
|
||||
sb.append(gtbillreq.getMyitemquantity());
|
||||
URL url = new URL(theUrl + theUrl);
|
||||
System.out.println("startremotecmd: chiamata a " + theUrl +
|
||||
sb.toString());
|
||||
HttpURLConnection connection = (HttpURLConnection)
|
||||
url.openConnection();
|
||||
BufferedReader read = new BufferedReader(new InputStreamReader(
|
||||
connection.getInputStream()));
|
||||
String line = read.readLine();
|
||||
String html = "";
|
||||
while (line != null) {
|
||||
html = html + html;
|
||||
line = read.readLine();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getCodiceEsercente(HttpServletRequest req) {
|
||||
return getParm("COD_ESER_SELLA").getTesto();
|
||||
}
|
||||
|
||||
protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return getJspKoPage(req, res);
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
String temp = getParm("SELLA_OK").getTesto();
|
||||
if (temp.isEmpty())
|
||||
return "payRes.jsp";
|
||||
return temp;
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
sendRequest(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
Manifest-Version: 1.0
|
||||
Archiver-Version: Plexus Archiver
|
||||
Created-By: Apache Maven 3.8.7
|
||||
Built-By: jenkins
|
||||
Build-Jdk: 17.0.16
|
||||
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Mon Jul 07 23:51:17 CEST 2025
|
||||
artifactId=acxent-checkvat
|
||||
groupId=it.acxent
|
||||
version=1.0.0
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>it.acxent</groupId>
|
||||
<artifactId>acxent-checkvat</artifactId>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<name>Check Vat Service</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.13.0</version>
|
||||
<configuration>
|
||||
<source>11</source>
|
||||
<target>11</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.7.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-toolchains-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>toolchain</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<toolchains>
|
||||
<jdk>
|
||||
<version>11</version>
|
||||
</jdk>
|
||||
</toolchains>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.axis</groupId>
|
||||
<artifactId>axis</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.xml.rpc</groupId>
|
||||
<artifactId>javax.xml.rpc-api</artifactId>
|
||||
<version>1.1.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>github-repo</id>
|
||||
<name>GitHub acolzi Apache Maven Packages</name>
|
||||
<url>https://maven.pkg.github.com/acolzi/repo</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,381 @@
|
|||
package checkVat.services.vies.taxud.eu.europa.ec;
|
||||
|
||||
import java.net.URL;
|
||||
import java.rmi.RemoteException;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.rpc.Service;
|
||||
import javax.xml.rpc.holders.BooleanHolder;
|
||||
import javax.xml.rpc.holders.StringHolder;
|
||||
import org.apache.axis.AxisFault;
|
||||
import org.apache.axis.NoEndPointException;
|
||||
import org.apache.axis.client.Call;
|
||||
import org.apache.axis.client.Stub;
|
||||
import org.apache.axis.constants.Style;
|
||||
import org.apache.axis.constants.Use;
|
||||
import org.apache.axis.description.OperationDesc;
|
||||
import org.apache.axis.description.ParameterDesc;
|
||||
import org.apache.axis.encoding.DeserializerFactory;
|
||||
import org.apache.axis.encoding.SerializerFactory;
|
||||
import org.apache.axis.encoding.XMLType;
|
||||
import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
|
||||
import org.apache.axis.encoding.ser.ArraySerializerFactory;
|
||||
import org.apache.axis.encoding.ser.BaseDeserializerFactory;
|
||||
import org.apache.axis.encoding.ser.BaseSerializerFactory;
|
||||
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
|
||||
import org.apache.axis.encoding.ser.BeanSerializerFactory;
|
||||
import org.apache.axis.encoding.ser.EnumDeserializerFactory;
|
||||
import org.apache.axis.encoding.ser.EnumSerializerFactory;
|
||||
import org.apache.axis.encoding.ser.SimpleDeserializerFactory;
|
||||
import org.apache.axis.encoding.ser.SimpleListDeserializerFactory;
|
||||
import org.apache.axis.encoding.ser.SimpleListSerializerFactory;
|
||||
import org.apache.axis.encoding.ser.SimpleSerializerFactory;
|
||||
import org.apache.axis.holders.DateHolder;
|
||||
import org.apache.axis.soap.SOAPConstants;
|
||||
import org.apache.axis.utils.JavaUtils;
|
||||
import types.checkVat.services.vies.taxud.eu.europa.ec.MatchCode;
|
||||
import types.checkVat.services.vies.taxud.eu.europa.ec.holders.MatchCodeHolder;
|
||||
|
||||
public class CheckVatBindingStub extends Stub implements CheckVatPortType {
|
||||
private Vector cachedSerClasses = new Vector();
|
||||
|
||||
private Vector cachedSerQNames = new Vector();
|
||||
|
||||
private Vector cachedSerFactories = new Vector();
|
||||
|
||||
private Vector cachedDeserFactories = new Vector();
|
||||
|
||||
static OperationDesc[] _operations = new OperationDesc[2];
|
||||
|
||||
static {
|
||||
_initOperationDesc1();
|
||||
}
|
||||
|
||||
private static void _initOperationDesc1() {
|
||||
OperationDesc oper = new OperationDesc();
|
||||
oper.setName("checkVat");
|
||||
ParameterDesc param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "countryCode"), (byte)3, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "vatNumber"), (byte)3, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requestDate"), (byte)2, new QName("http://www.w3.org/2001/XMLSchema", "date"), Date.class, false, false);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "valid"), (byte)2, new QName("http://www.w3.org/2001/XMLSchema", "boolean"), boolean.class, false, false);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "name"), (byte)2, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
|
||||
param.setOmittable(true);
|
||||
param.setNillable(true);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "address"), (byte)2, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
|
||||
param.setOmittable(true);
|
||||
param.setNillable(true);
|
||||
oper.addParameter(param);
|
||||
oper.setReturnType(XMLType.AXIS_VOID);
|
||||
oper.setStyle(Style.WRAPPED);
|
||||
oper.setUse(Use.LITERAL);
|
||||
_operations[0] = oper;
|
||||
oper = new OperationDesc();
|
||||
oper.setName("checkVatApprox");
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "countryCode"), (byte)3, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "vatNumber"), (byte)3, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderName"), (byte)3, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
|
||||
param.setOmittable(true);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCompanyType"), (byte)3, new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "companyTypeCode"), String.class, false, false);
|
||||
param.setOmittable(true);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderStreet"), (byte)3, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
|
||||
param.setOmittable(true);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderPostcode"), (byte)3, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
|
||||
param.setOmittable(true);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCity"), (byte)3, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
|
||||
param.setOmittable(true);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requesterCountryCode"), (byte)1, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
|
||||
param.setOmittable(true);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requesterVatNumber"), (byte)1, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
|
||||
param.setOmittable(true);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requestDate"), (byte)2, new QName("http://www.w3.org/2001/XMLSchema", "date"), Date.class, false, false);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "valid"), (byte)2, new QName("http://www.w3.org/2001/XMLSchema", "boolean"), boolean.class, false, false);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderAddress"), (byte)2, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
|
||||
param.setOmittable(true);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderNameMatch"), (byte)2, new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "matchCode"), MatchCode.class, false, false);
|
||||
param.setOmittable(true);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCompanyTypeMatch"), (byte)2, new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "matchCode"), MatchCode.class, false, false);
|
||||
param.setOmittable(true);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderStreetMatch"), (byte)2, new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "matchCode"), MatchCode.class, false, false);
|
||||
param.setOmittable(true);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderPostcodeMatch"), (byte)2, new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "matchCode"), MatchCode.class, false, false);
|
||||
param.setOmittable(true);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCityMatch"), (byte)2, new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "matchCode"), MatchCode.class, false, false);
|
||||
param.setOmittable(true);
|
||||
oper.addParameter(param);
|
||||
param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requestIdentifier"), (byte)2, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
|
||||
oper.addParameter(param);
|
||||
oper.setReturnType(XMLType.AXIS_VOID);
|
||||
oper.setStyle(Style.WRAPPED);
|
||||
oper.setUse(Use.LITERAL);
|
||||
_operations[1] = oper;
|
||||
}
|
||||
|
||||
public CheckVatBindingStub() throws AxisFault {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public CheckVatBindingStub(URL endpointURL, Service service) throws AxisFault {
|
||||
this(service);
|
||||
this.cachedEndpoint = endpointURL;
|
||||
}
|
||||
|
||||
public CheckVatBindingStub(Service service) throws AxisFault {
|
||||
if (service == null) {
|
||||
this.service = new org.apache.axis.client.Service();
|
||||
} else {
|
||||
this.service = service;
|
||||
}
|
||||
((org.apache.axis.client.Service)this.service).setTypeMappingVersion("1.2");
|
||||
Class<BeanSerializerFactory> beansf = BeanSerializerFactory.class;
|
||||
Class<BeanDeserializerFactory> beandf = BeanDeserializerFactory.class;
|
||||
Class<EnumSerializerFactory> enumsf = EnumSerializerFactory.class;
|
||||
Class<EnumDeserializerFactory> enumdf = EnumDeserializerFactory.class;
|
||||
Class<ArraySerializerFactory> arraysf = ArraySerializerFactory.class;
|
||||
Class<ArrayDeserializerFactory> arraydf = ArrayDeserializerFactory.class;
|
||||
Class<SimpleSerializerFactory> simplesf = SimpleSerializerFactory.class;
|
||||
Class<SimpleDeserializerFactory> simpledf = SimpleDeserializerFactory.class;
|
||||
Class<SimpleListSerializerFactory> simplelistsf = SimpleListSerializerFactory.class;
|
||||
Class<SimpleListDeserializerFactory> simplelistdf = SimpleListDeserializerFactory.class;
|
||||
QName qName = new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "companyTypeCode");
|
||||
this.cachedSerQNames.add(qName);
|
||||
Class<String> cls = String.class;
|
||||
this.cachedSerClasses.add(cls);
|
||||
this.cachedSerFactories.add(BaseSerializerFactory.createFactory(SimpleSerializerFactory.class, cls, qName));
|
||||
this.cachedDeserFactories.add(BaseDeserializerFactory.createFactory(SimpleDeserializerFactory.class, cls, qName));
|
||||
qName = new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "matchCode");
|
||||
this.cachedSerQNames.add(qName);
|
||||
Class<MatchCode> clazz = MatchCode.class;
|
||||
this.cachedSerClasses.add(clazz);
|
||||
this.cachedSerFactories.add(enumsf);
|
||||
this.cachedDeserFactories.add(enumdf);
|
||||
}
|
||||
|
||||
protected Call createCall() throws RemoteException {
|
||||
try {
|
||||
Call _call = _createCall();
|
||||
if (this.maintainSessionSet)
|
||||
_call.setMaintainSession(this.maintainSession);
|
||||
if (this.cachedUsername != null)
|
||||
_call.setUsername(this.cachedUsername);
|
||||
if (this.cachedPassword != null)
|
||||
_call.setPassword(this.cachedPassword);
|
||||
if (this.cachedEndpoint != null)
|
||||
_call.setTargetEndpointAddress(this.cachedEndpoint);
|
||||
if (this.cachedTimeout != null)
|
||||
_call.setTimeout(this.cachedTimeout);
|
||||
if (this.cachedPortName != null)
|
||||
_call.setPortName(this.cachedPortName);
|
||||
Enumeration<Object> keys = this.cachedProperties.keys();
|
||||
while (keys.hasMoreElements()) {
|
||||
String key = (String)keys.nextElement();
|
||||
_call.setProperty(key, this.cachedProperties.get(key));
|
||||
}
|
||||
synchronized (this) {
|
||||
if (firstCall()) {
|
||||
_call.setEncodingStyle(null);
|
||||
for (int i = 0; i < this.cachedSerFactories.size(); i++) {
|
||||
Class cls = this.cachedSerClasses.get(i);
|
||||
QName qName = this.cachedSerQNames.get(i);
|
||||
Object x = this.cachedSerFactories.get(i);
|
||||
if (x instanceof Class) {
|
||||
Class sf = this.cachedSerFactories.get(i);
|
||||
Class df = this.cachedDeserFactories.get(i);
|
||||
_call.registerTypeMapping(cls, qName, sf, df, false);
|
||||
} else if (x instanceof javax.xml.rpc.encoding.SerializerFactory) {
|
||||
SerializerFactory sf = this.cachedSerFactories.get(i);
|
||||
DeserializerFactory df = this.cachedDeserFactories.get(i);
|
||||
_call.registerTypeMapping(cls, qName, sf, df, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return _call;
|
||||
} catch (Throwable _t) {
|
||||
throw new AxisFault("Failure trying to get the Call object", _t);
|
||||
}
|
||||
}
|
||||
|
||||
public void checkVat(StringHolder countryCode, StringHolder vatNumber, DateHolder requestDate, BooleanHolder valid, StringHolder name, StringHolder address) throws RemoteException {
|
||||
if (this.cachedEndpoint == null)
|
||||
throw new NoEndPointException();
|
||||
Call _call = createCall();
|
||||
_call.setOperation(_operations[0]);
|
||||
_call.setUseSOAPAction(true);
|
||||
_call.setSOAPActionURI("");
|
||||
_call.setEncodingStyle(null);
|
||||
_call.setProperty("sendXsiTypes", Boolean.FALSE);
|
||||
_call.setProperty("sendMultiRefs", Boolean.FALSE);
|
||||
_call.setSOAPVersion((SOAPConstants)SOAPConstants.SOAP11_CONSTANTS);
|
||||
_call.setOperationName(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "checkVat"));
|
||||
setRequestHeaders(_call);
|
||||
setAttachments(_call);
|
||||
try {
|
||||
Object _resp = _call.invoke(new Object[] { countryCode.value, vatNumber.value });
|
||||
if (_resp instanceof RemoteException)
|
||||
throw (RemoteException)_resp;
|
||||
extractAttachments(_call);
|
||||
Map _output = _call.getOutputParams();
|
||||
try {
|
||||
countryCode.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "countryCode"));
|
||||
} catch (Exception _exception) {
|
||||
countryCode.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "countryCode")), String.class);
|
||||
}
|
||||
try {
|
||||
vatNumber.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "vatNumber"));
|
||||
} catch (Exception _exception) {
|
||||
vatNumber.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "vatNumber")), String.class);
|
||||
}
|
||||
try {
|
||||
requestDate.value = (Date)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requestDate"));
|
||||
} catch (Exception _exception) {
|
||||
requestDate.value = (Date)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requestDate")), Date.class);
|
||||
}
|
||||
try {
|
||||
valid.value = (Boolean)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "valid"));
|
||||
} catch (Exception _exception) {
|
||||
valid.value = (Boolean)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "valid")), boolean.class);
|
||||
}
|
||||
try {
|
||||
name.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "name"));
|
||||
} catch (Exception _exception) {
|
||||
name.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "name")), String.class);
|
||||
}
|
||||
try {
|
||||
address.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "address"));
|
||||
} catch (Exception _exception) {
|
||||
address.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "address")), String.class);
|
||||
}
|
||||
} catch (AxisFault axisFaultException) {
|
||||
throw axisFaultException;
|
||||
}
|
||||
}
|
||||
|
||||
public void checkVatApprox(StringHolder countryCode, StringHolder vatNumber, StringHolder traderName, StringHolder traderCompanyType, StringHolder traderStreet, StringHolder traderPostcode, StringHolder traderCity, String requesterCountryCode, String requesterVatNumber, DateHolder requestDate, BooleanHolder valid, StringHolder traderAddress, MatchCodeHolder traderNameMatch, MatchCodeHolder traderCompanyTypeMatch, MatchCodeHolder traderStreetMatch, MatchCodeHolder traderPostcodeMatch, MatchCodeHolder traderCityMatch, StringHolder requestIdentifier) throws RemoteException {
|
||||
if (this.cachedEndpoint == null)
|
||||
throw new NoEndPointException();
|
||||
Call _call = createCall();
|
||||
_call.setOperation(_operations[1]);
|
||||
_call.setUseSOAPAction(true);
|
||||
_call.setSOAPActionURI("");
|
||||
_call.setEncodingStyle(null);
|
||||
_call.setProperty("sendXsiTypes", Boolean.FALSE);
|
||||
_call.setProperty("sendMultiRefs", Boolean.FALSE);
|
||||
_call.setSOAPVersion((SOAPConstants)SOAPConstants.SOAP11_CONSTANTS);
|
||||
_call.setOperationName(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "checkVatApprox"));
|
||||
setRequestHeaders(_call);
|
||||
setAttachments(_call);
|
||||
try {
|
||||
Object _resp = _call.invoke(new Object[] { countryCode.value, vatNumber.value, traderName.value, traderCompanyType.value, traderStreet.value, traderPostcode.value, traderCity.value, requesterCountryCode, requesterVatNumber });
|
||||
if (_resp instanceof RemoteException)
|
||||
throw (RemoteException)_resp;
|
||||
extractAttachments(_call);
|
||||
Map _output = _call.getOutputParams();
|
||||
try {
|
||||
countryCode.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "countryCode"));
|
||||
} catch (Exception _exception) {
|
||||
countryCode.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "countryCode")), String.class);
|
||||
}
|
||||
try {
|
||||
vatNumber.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "vatNumber"));
|
||||
} catch (Exception _exception) {
|
||||
vatNumber.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "vatNumber")), String.class);
|
||||
}
|
||||
try {
|
||||
traderName.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderName"));
|
||||
} catch (Exception _exception) {
|
||||
traderName.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderName")), String.class);
|
||||
}
|
||||
try {
|
||||
traderCompanyType.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCompanyType"));
|
||||
} catch (Exception _exception) {
|
||||
traderCompanyType.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCompanyType")), String.class);
|
||||
}
|
||||
try {
|
||||
traderStreet.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderStreet"));
|
||||
} catch (Exception _exception) {
|
||||
traderStreet.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderStreet")), String.class);
|
||||
}
|
||||
try {
|
||||
traderPostcode.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderPostcode"));
|
||||
} catch (Exception _exception) {
|
||||
traderPostcode.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderPostcode")), String.class);
|
||||
}
|
||||
try {
|
||||
traderCity.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCity"));
|
||||
} catch (Exception _exception) {
|
||||
traderCity.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCity")), String.class);
|
||||
}
|
||||
try {
|
||||
requestDate.value = (Date)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requestDate"));
|
||||
} catch (Exception _exception) {
|
||||
requestDate.value = (Date)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requestDate")), Date.class);
|
||||
}
|
||||
try {
|
||||
valid.value = (Boolean)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "valid"));
|
||||
} catch (Exception _exception) {
|
||||
valid.value = (Boolean)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "valid")), boolean.class);
|
||||
}
|
||||
try {
|
||||
traderAddress.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderAddress"));
|
||||
} catch (Exception _exception) {
|
||||
traderAddress.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderAddress")), String.class);
|
||||
}
|
||||
try {
|
||||
traderNameMatch.value = (MatchCode)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderNameMatch"));
|
||||
} catch (Exception _exception) {
|
||||
traderNameMatch.value = (MatchCode)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderNameMatch")), MatchCode.class);
|
||||
}
|
||||
try {
|
||||
traderCompanyTypeMatch.value = (MatchCode)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCompanyTypeMatch"));
|
||||
} catch (Exception _exception) {
|
||||
traderCompanyTypeMatch.value = (MatchCode)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCompanyTypeMatch")), MatchCode.class);
|
||||
}
|
||||
try {
|
||||
traderStreetMatch.value = (MatchCode)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderStreetMatch"));
|
||||
} catch (Exception _exception) {
|
||||
traderStreetMatch.value = (MatchCode)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderStreetMatch")), MatchCode.class);
|
||||
}
|
||||
try {
|
||||
traderPostcodeMatch.value = (MatchCode)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderPostcodeMatch"));
|
||||
} catch (Exception _exception) {
|
||||
traderPostcodeMatch.value = (MatchCode)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderPostcodeMatch")), MatchCode.class);
|
||||
}
|
||||
try {
|
||||
traderCityMatch.value = (MatchCode)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCityMatch"));
|
||||
} catch (Exception _exception) {
|
||||
traderCityMatch.value = (MatchCode)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCityMatch")), MatchCode.class);
|
||||
}
|
||||
try {
|
||||
requestIdentifier.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requestIdentifier"));
|
||||
} catch (Exception _exception) {
|
||||
requestIdentifier.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requestIdentifier")), String.class);
|
||||
}
|
||||
} catch (AxisFault axisFaultException) {
|
||||
throw axisFaultException;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package checkVat.services.vies.taxud.eu.europa.ec;
|
||||
|
||||
import java.rmi.Remote;
|
||||
import java.rmi.RemoteException;
|
||||
import javax.xml.rpc.holders.BooleanHolder;
|
||||
import javax.xml.rpc.holders.StringHolder;
|
||||
import org.apache.axis.holders.DateHolder;
|
||||
import types.checkVat.services.vies.taxud.eu.europa.ec.holders.MatchCodeHolder;
|
||||
|
||||
public interface CheckVatPortType extends Remote {
|
||||
void checkVat(StringHolder paramStringHolder1, StringHolder paramStringHolder2, DateHolder paramDateHolder, BooleanHolder paramBooleanHolder, StringHolder paramStringHolder3, StringHolder paramStringHolder4) throws RemoteException;
|
||||
|
||||
void checkVatApprox(StringHolder paramStringHolder1, StringHolder paramStringHolder2, StringHolder paramStringHolder3, StringHolder paramStringHolder4, StringHolder paramStringHolder5, StringHolder paramStringHolder6, StringHolder paramStringHolder7, String paramString1, String paramString2, DateHolder paramDateHolder, BooleanHolder paramBooleanHolder, StringHolder paramStringHolder8, MatchCodeHolder paramMatchCodeHolder1, MatchCodeHolder paramMatchCodeHolder2, MatchCodeHolder paramMatchCodeHolder3, MatchCodeHolder paramMatchCodeHolder4, MatchCodeHolder paramMatchCodeHolder5, StringHolder paramStringHolder9) throws RemoteException;
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package checkVat.services.vies.taxud.eu.europa.ec;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
import javax.xml.rpc.ServiceException;
|
||||
import javax.xml.rpc.Stub;
|
||||
import javax.xml.rpc.holders.BooleanHolder;
|
||||
import javax.xml.rpc.holders.StringHolder;
|
||||
import org.apache.axis.holders.DateHolder;
|
||||
import types.checkVat.services.vies.taxud.eu.europa.ec.holders.MatchCodeHolder;
|
||||
|
||||
public class CheckVatPortTypeProxy implements CheckVatPortType {
|
||||
private String _endpoint = null;
|
||||
|
||||
private CheckVatPortType checkVatPortType = null;
|
||||
|
||||
public CheckVatPortTypeProxy() {
|
||||
_initCheckVatPortTypeProxy();
|
||||
}
|
||||
|
||||
public CheckVatPortTypeProxy(String endpoint) {
|
||||
this._endpoint = endpoint;
|
||||
_initCheckVatPortTypeProxy();
|
||||
}
|
||||
|
||||
private void _initCheckVatPortTypeProxy() {
|
||||
try {
|
||||
this.checkVatPortType = new CheckVatServiceLocator().getcheckVatPort();
|
||||
if (this.checkVatPortType != null)
|
||||
if (this._endpoint != null) {
|
||||
((Stub)this.checkVatPortType)._setProperty("javax.xml.rpc.service.endpoint.address", this._endpoint);
|
||||
} else {
|
||||
this._endpoint = (String)((Stub)this.checkVatPortType)._getProperty("javax.xml.rpc.service.endpoint.address");
|
||||
}
|
||||
} catch (ServiceException e) {}
|
||||
}
|
||||
|
||||
public String getEndpoint() {
|
||||
return this._endpoint;
|
||||
}
|
||||
|
||||
public void setEndpoint(String endpoint) {
|
||||
this._endpoint = endpoint;
|
||||
if (this.checkVatPortType != null)
|
||||
((Stub)this.checkVatPortType)._setProperty("javax.xml.rpc.service.endpoint.address", this._endpoint);
|
||||
}
|
||||
|
||||
public CheckVatPortType getCheckVatPortType() {
|
||||
if (this.checkVatPortType == null)
|
||||
_initCheckVatPortTypeProxy();
|
||||
return this.checkVatPortType;
|
||||
}
|
||||
|
||||
public void checkVat(StringHolder countryCode, StringHolder vatNumber, DateHolder requestDate, BooleanHolder valid, StringHolder name, StringHolder address) throws RemoteException {
|
||||
if (this.checkVatPortType == null)
|
||||
_initCheckVatPortTypeProxy();
|
||||
this.checkVatPortType.checkVat(countryCode, vatNumber, requestDate, valid, name, address);
|
||||
}
|
||||
|
||||
public void checkVatApprox(StringHolder countryCode, StringHolder vatNumber, StringHolder traderName, StringHolder traderCompanyType, StringHolder traderStreet, StringHolder traderPostcode, StringHolder traderCity, String requesterCountryCode, String requesterVatNumber, DateHolder requestDate, BooleanHolder valid, StringHolder traderAddress, MatchCodeHolder traderNameMatch, MatchCodeHolder traderCompanyTypeMatch, MatchCodeHolder traderStreetMatch, MatchCodeHolder traderPostcodeMatch, MatchCodeHolder traderCityMatch, StringHolder requestIdentifier) throws RemoteException {
|
||||
if (this.checkVatPortType == null)
|
||||
_initCheckVatPortTypeProxy();
|
||||
this.checkVatPortType.checkVatApprox(countryCode, vatNumber, traderName, traderCompanyType, traderStreet, traderPostcode, traderCity, requesterCountryCode, requesterVatNumber, requestDate, valid, traderAddress, traderNameMatch, traderCompanyTypeMatch, traderStreetMatch, traderPostcodeMatch, traderCityMatch, requestIdentifier);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package checkVat.services.vies.taxud.eu.europa.ec;
|
||||
|
||||
import java.net.URL;
|
||||
import javax.xml.rpc.Service;
|
||||
import javax.xml.rpc.ServiceException;
|
||||
|
||||
public interface CheckVatService extends Service {
|
||||
String getcheckVatPortAddress();
|
||||
|
||||
CheckVatPortType getcheckVatPort() throws ServiceException;
|
||||
|
||||
CheckVatPortType getcheckVatPort(URL paramURL) throws ServiceException;
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package checkVat.services.vies.taxud.eu.europa.ec;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.rmi.Remote;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.rpc.ServiceException;
|
||||
import org.apache.axis.AxisFault;
|
||||
import org.apache.axis.EngineConfiguration;
|
||||
import org.apache.axis.client.Service;
|
||||
import org.apache.axis.client.Stub;
|
||||
|
||||
public class CheckVatServiceLocator extends Service implements CheckVatService {
|
||||
public CheckVatServiceLocator() {}
|
||||
|
||||
public CheckVatServiceLocator(EngineConfiguration config) {
|
||||
super(config);
|
||||
}
|
||||
|
||||
public CheckVatServiceLocator(String wsdlLoc, QName sName) throws ServiceException {
|
||||
super(wsdlLoc, sName);
|
||||
}
|
||||
|
||||
private String checkVatPort_address = "http://ec.europa.eu/taxation_customs/vies/services/checkVatService";
|
||||
|
||||
public String getcheckVatPortAddress() {
|
||||
return this.checkVatPort_address;
|
||||
}
|
||||
|
||||
private String checkVatPortWSDDServiceName = "checkVatPort";
|
||||
|
||||
public String getcheckVatPortWSDDServiceName() {
|
||||
return this.checkVatPortWSDDServiceName;
|
||||
}
|
||||
|
||||
public void setcheckVatPortWSDDServiceName(String name) {
|
||||
this.checkVatPortWSDDServiceName = name;
|
||||
}
|
||||
|
||||
public CheckVatPortType getcheckVatPort() throws ServiceException {
|
||||
URL endpoint;
|
||||
try {
|
||||
endpoint = new URL(this.checkVatPort_address);
|
||||
} catch (MalformedURLException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
return getcheckVatPort(endpoint);
|
||||
}
|
||||
|
||||
public CheckVatPortType getcheckVatPort(URL portAddress) throws ServiceException {
|
||||
try {
|
||||
CheckVatBindingStub _stub = new CheckVatBindingStub(portAddress, this);
|
||||
_stub.setPortName(getcheckVatPortWSDDServiceName());
|
||||
return _stub;
|
||||
} catch (AxisFault e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setcheckVatPortEndpointAddress(String address) {
|
||||
this.checkVatPort_address = address;
|
||||
}
|
||||
|
||||
public Remote getPort(Class serviceEndpointInterface) throws ServiceException {
|
||||
try {
|
||||
if (CheckVatPortType.class.isAssignableFrom(serviceEndpointInterface)) {
|
||||
CheckVatBindingStub _stub = new CheckVatBindingStub(new URL(this.checkVatPort_address), this);
|
||||
_stub.setPortName(getcheckVatPortWSDDServiceName());
|
||||
return _stub;
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
throw new ServiceException(t);
|
||||
}
|
||||
throw new ServiceException("There is no stub implementation for the interface: " + ((serviceEndpointInterface == null) ? "null" : serviceEndpointInterface.getName()));
|
||||
}
|
||||
|
||||
public Remote getPort(QName portName, Class serviceEndpointInterface) throws ServiceException {
|
||||
if (portName == null)
|
||||
return getPort(serviceEndpointInterface);
|
||||
String inputPortName = portName.getLocalPart();
|
||||
if ("checkVatPort".equals(inputPortName))
|
||||
return getcheckVatPort();
|
||||
Remote _stub = getPort(serviceEndpointInterface);
|
||||
((Stub)_stub).setPortName(portName);
|
||||
return _stub;
|
||||
}
|
||||
|
||||
public QName getServiceName() {
|
||||
return new QName("urn:ec.europa.eu:taxud:vies:services:checkVat", "checkVatService");
|
||||
}
|
||||
|
||||
private HashSet ports = null;
|
||||
|
||||
public Iterator getPorts() {
|
||||
if (this.ports == null) {
|
||||
this.ports = new HashSet();
|
||||
this.ports.add(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat", "checkVatPort"));
|
||||
}
|
||||
return this.ports.iterator();
|
||||
}
|
||||
|
||||
public void setEndpointAddress(String portName, String address) throws ServiceException {
|
||||
if ("checkVatPort".equals(portName)) {
|
||||
setcheckVatPortEndpointAddress(address);
|
||||
} else {
|
||||
throw new ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName);
|
||||
}
|
||||
}
|
||||
|
||||
public void setEndpointAddress(QName portName, String address) throws ServiceException {
|
||||
setEndpointAddress(portName.getLocalPart(), address);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
package it.acxent.checkVatService;
|
||||
|
||||
import checkVat.services.vies.taxud.eu.europa.ec.CheckVatPortTypeProxy;
|
||||
import java.sql.Date;
|
||||
import javax.xml.rpc.holders.BooleanHolder;
|
||||
import javax.xml.rpc.holders.StringHolder;
|
||||
import org.apache.axis.holders.DateHolder;
|
||||
|
||||
public class CheckVatClient {
|
||||
private String name;
|
||||
|
||||
private String address;
|
||||
|
||||
private String vatNumber;
|
||||
|
||||
private String countryCode;
|
||||
|
||||
private Date requestDate;
|
||||
|
||||
private boolean valid;
|
||||
|
||||
public CheckVatClient(String countryCode, String vatNumber) {
|
||||
BooleanHolder validSH = new BooleanHolder();
|
||||
DateHolder requestDateSH = new DateHolder();
|
||||
StringHolder countryCodeSH = new StringHolder(countryCode);
|
||||
StringHolder vatNumberSH = new StringHolder(vatNumber);
|
||||
StringHolder nameSH = new StringHolder();
|
||||
StringHolder addressSH = new StringHolder();
|
||||
CheckVatPortTypeProxy service = new CheckVatPortTypeProxy();
|
||||
try {
|
||||
service.checkVat(countryCodeSH, vatNumberSH, requestDateSH, validSH, nameSH, addressSH);
|
||||
setAddress(addressSH.value);
|
||||
setName(nameSH.value);
|
||||
setValid(validSH.value);
|
||||
setRequestDate(new Date(requestDateSH.value.getTime()));
|
||||
setCountryCode(countryCode);
|
||||
setVatNumber(vatNumber);
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return (this.name == null) ? "" : this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return (this.address == null) ? "" : this.address.trim();
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getVatNumber() {
|
||||
return (this.vatNumber == null) ? "" : this.vatNumber;
|
||||
}
|
||||
|
||||
public void setVatNumber(String vatNumber) {
|
||||
this.vatNumber = vatNumber;
|
||||
}
|
||||
|
||||
public String getCountryCode() {
|
||||
return (this.countryCode == null) ? "" : this.countryCode;
|
||||
}
|
||||
|
||||
public void setCountryCode(String countryCode) {
|
||||
this.countryCode = countryCode;
|
||||
}
|
||||
|
||||
public Date getRequestDate() {
|
||||
return this.requestDate;
|
||||
}
|
||||
|
||||
public void setRequestDate(Date requestDate) {
|
||||
this.requestDate = requestDate;
|
||||
}
|
||||
|
||||
public boolean getValid() {
|
||||
return this.valid;
|
||||
}
|
||||
|
||||
public void setValid(boolean valid) {
|
||||
this.valid = valid;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package types.checkVat.services.vies.taxud.eu.europa.ec;
|
||||
|
||||
import java.io.ObjectStreamException;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import javax.xml.namespace.QName;
|
||||
import org.apache.axis.description.TypeDesc;
|
||||
import org.apache.axis.encoding.Deserializer;
|
||||
import org.apache.axis.encoding.Serializer;
|
||||
import org.apache.axis.encoding.ser.EnumDeserializer;
|
||||
import org.apache.axis.encoding.ser.EnumSerializer;
|
||||
|
||||
public class MatchCode implements Serializable {
|
||||
private String _value_;
|
||||
|
||||
private static HashMap _table_ = new HashMap();
|
||||
|
||||
public static final String _value1 = "1";
|
||||
|
||||
public static final String _value2 = "2";
|
||||
|
||||
protected MatchCode(String value) {
|
||||
this._value_ = value;
|
||||
_table_.put(this._value_, this);
|
||||
}
|
||||
|
||||
public static final MatchCode value1 = new MatchCode("1");
|
||||
|
||||
public static final MatchCode value2 = new MatchCode("2");
|
||||
|
||||
public String getValue() {
|
||||
return this._value_;
|
||||
}
|
||||
|
||||
public static MatchCode fromValue(String value) throws IllegalArgumentException {
|
||||
MatchCode enumeration = (MatchCode)
|
||||
_table_.get(value);
|
||||
if (enumeration == null)
|
||||
throw new IllegalArgumentException();
|
||||
return enumeration;
|
||||
}
|
||||
|
||||
public static MatchCode fromString(String value) throws IllegalArgumentException {
|
||||
return fromValue(value);
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
return (obj == this);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return toString().hashCode();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this._value_;
|
||||
}
|
||||
|
||||
public Object readResolve() throws ObjectStreamException {
|
||||
return fromValue(this._value_);
|
||||
}
|
||||
|
||||
public static Serializer getSerializer(String mechType, Class _javaType, QName _xmlType) {
|
||||
return new EnumSerializer(_javaType, _xmlType);
|
||||
}
|
||||
|
||||
public static Deserializer getDeserializer(String mechType, Class _javaType, QName _xmlType) {
|
||||
return new EnumDeserializer(_javaType, _xmlType);
|
||||
}
|
||||
|
||||
private static TypeDesc typeDesc = new TypeDesc(MatchCode.class);
|
||||
|
||||
static {
|
||||
typeDesc.setXmlType(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "matchCode"));
|
||||
}
|
||||
|
||||
public static TypeDesc getTypeDesc() {
|
||||
return typeDesc;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package types.checkVat.services.vies.taxud.eu.europa.ec.holders;
|
||||
|
||||
import javax.xml.rpc.holders.Holder;
|
||||
import types.checkVat.services.vies.taxud.eu.europa.ec.MatchCode;
|
||||
|
||||
public final class MatchCodeHolder implements Holder {
|
||||
public MatchCode value;
|
||||
|
||||
public MatchCodeHolder() {}
|
||||
|
||||
public MatchCodeHolder(MatchCode value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
32
decompiled-libs/www/acxent-common-1.0.1/AggAbiCab.java
Normal file
32
decompiled-libs/www/acxent-common-1.0.1/AggAbiCab.java
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import it.acxent.anag.AbiCab;
|
||||
import it.acxent.db.ApplParm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.util.DbConsole;
|
||||
|
||||
public class AggAbiCab extends DbConsole {
|
||||
public static void main(String[] args) {
|
||||
AggAbiCab bean = new AggAbiCab();
|
||||
bean.doImport();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void doImport() {
|
||||
String db = "ctexpress";
|
||||
int i = 0;
|
||||
int se1 = 10;
|
||||
int se2 = 100;
|
||||
String hostname = "localhost";
|
||||
String temp = getCi().readLine("Hostname (" + hostname + "):");
|
||||
if (!temp.isEmpty())
|
||||
hostname = temp;
|
||||
temp = getCi().readLine("Database name (" + db + "):");
|
||||
if (!temp.isEmpty())
|
||||
db = temp;
|
||||
System.out.println("Db: " + db);
|
||||
ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, db, "root", "root", 1, 10, 300));
|
||||
apTarget.setDebug(false);
|
||||
ResParm rp = new AbiCab(apTarget).importAbiCab("/Users/acolzi/Downloads/banche.csv");
|
||||
System.out.println(rp.getMsg());
|
||||
}
|
||||
}
|
||||
50
decompiled-libs/www/acxent-common-1.0.1/AggDocFiglio.java
Normal file
50
decompiled-libs/www/acxent-common-1.0.1/AggDocFiglio.java
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import it.acxent.contab.Documento;
|
||||
import it.acxent.db.ApplParm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.util.DbConsole;
|
||||
import it.acxent.util.Vectumerator;
|
||||
|
||||
public class AggDocFiglio extends DbConsole {
|
||||
public static void main(String[] args) {
|
||||
AggDocFiglio bean = new AggDocFiglio();
|
||||
bean.doImport();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void doImport() {
|
||||
String db = "guidoreni";
|
||||
int i = 0;
|
||||
int se1 = 10;
|
||||
int se2 = 100;
|
||||
String hostname = "localhost";
|
||||
String temp = getCi().readLine("Hostname (" + hostname + "):");
|
||||
if (!temp.isEmpty())
|
||||
hostname = temp;
|
||||
temp = getCi().readLine("Database name (" + db + "):");
|
||||
if (!temp.isEmpty())
|
||||
db = temp;
|
||||
System.out.println("Db: " + db);
|
||||
ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300));
|
||||
apTarget.setDebug(false);
|
||||
StringBuffer msg = new StringBuffer();
|
||||
try {
|
||||
System.out.println("calcolo tot record....");
|
||||
Vectumerator vec = new Documento(apTarget).findAll();
|
||||
System.out.println("Tot Record: " + vec.getTotNumberOfRecords());
|
||||
int updRec = 0;
|
||||
while (vec.hasMoreElements()) {
|
||||
Documento row = (Documento)vec.nextElement();
|
||||
if (row.getId_documentoFiglio() != 0L)
|
||||
updRec++;
|
||||
i++;
|
||||
if (se1 > 0 && i % se1 == 0)
|
||||
System.out.print(".");
|
||||
if (se2 > 0 && i % se2 == 0)
|
||||
System.out.println("" + i + " " + i);
|
||||
}
|
||||
System.out.println("--- fine ---");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,189 @@
|
|||
import it.acxent.anag.MagFisico;
|
||||
import it.acxent.art.Articolo;
|
||||
import it.acxent.art.ArticoloCR;
|
||||
import it.acxent.art.ArticoloVariante;
|
||||
import it.acxent.contab.Movimento;
|
||||
import it.acxent.contab.RigaDocumento;
|
||||
import it.acxent.contab.RigaDocumentoP;
|
||||
import it.acxent.contab.RigaDocumentoPCR;
|
||||
import it.acxent.db.ApplParm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.util.DbConsole;
|
||||
import it.acxent.util.Vectumerator;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class AggiornaMagMovimento extends DbConsole {
|
||||
public static void main(String[] args) {
|
||||
AggiornaMagMovimento bean = new AggiornaMagMovimento();
|
||||
bean.doImport();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void doImport() {
|
||||
int i = 0, j = 0;
|
||||
int se1 = 10;
|
||||
int se2 = 100;
|
||||
String hostname = "localhost";
|
||||
String db = "guidoreni";
|
||||
boolean step1 = true, step2 = true, step3 = true, step4 = true, step5 = true;
|
||||
System.out.println("Db: " + db);
|
||||
ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 60));
|
||||
apTarget.setDebug(false);
|
||||
StringBuffer msg = new StringBuffer();
|
||||
try {
|
||||
long l_id_articolo = 0L;
|
||||
ResParm rp = new ResParm(true);
|
||||
int pagerow = 1000;
|
||||
Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
System.out.println("START: " + start.toString());
|
||||
if (step1) {
|
||||
System.out.println("Delete All Movimento");
|
||||
Movimento mov = new Movimento(apTarget);
|
||||
String sqlDeleteMov = "delete from MOVIMENTO ";
|
||||
if (l_id_articolo > 0L)
|
||||
sqlDeleteMov = sqlDeleteMov + " where id_articolo=" + sqlDeleteMov;
|
||||
mov.delete(sqlDeleteMov);
|
||||
i = 0;
|
||||
System.out.println("Import All Movimento");
|
||||
RigaDocumento rd = new RigaDocumento(apTarget);
|
||||
long tot = rd.findAllPerRiordinoMagazzinoTot(l_id_articolo);
|
||||
System.out.println("tot record: " + tot);
|
||||
while ((long)j < tot / (long)pagerow + 1L) {
|
||||
j++;
|
||||
Vectumerator vec = rd.findAllPerRiordinoMagazzino(l_id_articolo, j, pagerow);
|
||||
while (vec.hasMoreElements()) {
|
||||
rd = (RigaDocumento)vec.nextElement();
|
||||
rp = RigaDocumento.aggiornaMovimento(rd);
|
||||
i++;
|
||||
if (se1 > 0 && i % se1 == 0)
|
||||
System.out.print(".");
|
||||
if (se2 > 0 && i % se2 == 0)
|
||||
System.out.println(i);
|
||||
}
|
||||
System.out.print("Tot: " + tot + " - Pag: " + j + " - Pag. Lette: " + j * pagerow);
|
||||
}
|
||||
}
|
||||
Timestamp stop = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
System.out.println("start 2: " + stop.toString());
|
||||
if (step2) {
|
||||
i = 0;
|
||||
j = 0;
|
||||
RigaDocumentoP rdp = new RigaDocumentoP(apTarget);
|
||||
Vectumerator vec = rdp.findAll();
|
||||
long tot = (long)vec.getTotNumberOfRecords();
|
||||
System.out.println("Riga documento P: tot record: " + vec.getTotNumberOfRecords());
|
||||
while ((long)j < tot / (long)pagerow + 1L) {
|
||||
j++;
|
||||
vec = rdp.findByCR(new RigaDocumentoPCR(), j, pagerow);
|
||||
while (vec.hasMoreElements()) {
|
||||
RigaDocumentoP row = (RigaDocumentoP)vec.nextElement();
|
||||
if (row.getRigaDocumentoPrelevata().getDocumento().getTipoDocumento()
|
||||
.getFlgTipologia() == 3L) {
|
||||
Movimento mov = new Movimento(apTarget);
|
||||
rp = mov.deleteP(row.getId_rigaDocumentoPrelevata());
|
||||
mov.setId_articolo(row.getRigaDocumentoPrelevata().getId_articolo());
|
||||
mov.setId_articoloVariante(row.getRigaDocumentoPrelevata().getId_articoloVariante());
|
||||
mov.setId_articoloTaglia(row.getRigaDocumentoPrelevata().getId_articoloTaglia());
|
||||
mov.setId_clifor(row.getRigaDocumentoPrelevata().getDocumento().getId_clifor());
|
||||
MagFisico mf = new MagFisico(apTarget);
|
||||
mf.findMagazzinoOrdinato();
|
||||
mov.setId_magFisico(mf.getId_magFisico());
|
||||
mov.setId_rigaDocumento(row.getId_rigaDocumento());
|
||||
mov.setNr(-1.0D * row.getQuantitaPrelevata());
|
||||
rp = mov.save();
|
||||
} else {
|
||||
System.out.println("!!! " + row.getRigaDocumentoPrelevata().getDocumento().getNumeroDocumentoCompleto());
|
||||
row.superDelete();
|
||||
}
|
||||
i++;
|
||||
if (se1 > 0 && i % se1 == 0)
|
||||
System.out.print(".");
|
||||
if (se2 > 0 && i % se2 == 0)
|
||||
System.out.println(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
stop = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
System.out.println("start 3: " + stop.toString());
|
||||
if (step3) {
|
||||
i = 0;
|
||||
j = 0;
|
||||
Articolo art = new Articolo(apTarget);
|
||||
ArticoloCR CR = new ArticoloCR();
|
||||
CR.setFlgQta(1L);
|
||||
CR.setQtaDa(1L);
|
||||
CR.setQtaA(99999999L);
|
||||
Vectumerator<Articolo> vec = art.findByCR(CR, 0, 0);
|
||||
long tot = (long)vec.getTotNumberOfRecords();
|
||||
Movimento mov = new Movimento(apTarget);
|
||||
System.out.println("Articolio: tot record: " + vec.getTotNumberOfRecords());
|
||||
while (vec.hasMoreElements()) {
|
||||
Articolo row = (Articolo)vec.nextElement();
|
||||
System.out.println(row.getNome());
|
||||
if (row.getFlgUsaVarianti() == 1L) {
|
||||
ArticoloVariante av = new ArticoloVariante(apTarget);
|
||||
Vectumerator vecAv = av.findById_articolo(row.getId_articolo(), 0, 0, -1L, -1L);
|
||||
while (vecAv.hasMoreElements()) {
|
||||
ArticoloVariante rowAV = (ArticoloVariante)vecAv.nextElement();
|
||||
Movimento.aggiornaDispo(apTarget, rowAV.getId_articolo(), rowAV.getId_articoloVariante(), 0L, 1L);
|
||||
}
|
||||
} else {
|
||||
Movimento.aggiornaDispo(apTarget, row.getId_articolo(), 0L, 0L, 1L);
|
||||
}
|
||||
i++;
|
||||
if (se1 > 0 && i % se1 == 0)
|
||||
System.out.print(".");
|
||||
if (se2 > 0 && i % se2 == 0)
|
||||
System.out.println(i);
|
||||
}
|
||||
}
|
||||
stop = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
System.out.println("start 4: " + stop.toString());
|
||||
if (step4) {
|
||||
i = 0;
|
||||
j = 0;
|
||||
RigaDocumento rd = new RigaDocumento(apTarget);
|
||||
Vectumerator vec = rd.findRigheDocumentoPrelevateDaStornare();
|
||||
long tot = (long)vec.getTotNumberOfRecords();
|
||||
Movimento mov = new Movimento(apTarget);
|
||||
System.out.println("Righe documento ordine da stornare: tot record: " + vec.getTotNumberOfRecords());
|
||||
while (vec.hasMoreElements()) {
|
||||
RigaDocumento row = (RigaDocumento)vec.nextElement();
|
||||
row.aggiornaMovimentoPareggioRigaPrelevata();
|
||||
i++;
|
||||
if (se1 > 0 && i % se1 == 0)
|
||||
System.out.print(".");
|
||||
if (se2 > 0 && i % se2 == 0)
|
||||
System.out.println(i);
|
||||
}
|
||||
}
|
||||
if (step5) {
|
||||
i = 0;
|
||||
j = 0;
|
||||
RigaDocumento rd = new RigaDocumento(apTarget);
|
||||
Vectumerator vec = rd.findRigheDocumentoPrelevateDaStornare();
|
||||
long tot = (long)vec.getTotNumberOfRecords();
|
||||
Movimento mov = new Movimento(apTarget);
|
||||
System.out.println("Righe documento ordine da stornare: tot record: " + vec.getTotNumberOfRecords());
|
||||
while (vec.hasMoreElements()) {
|
||||
RigaDocumento row = (RigaDocumento)vec.nextElement();
|
||||
row.aggiornaMovimentoPareggioRigaPrelevata();
|
||||
i++;
|
||||
if (se1 > 0 && i % se1 == 0)
|
||||
System.out.print(".");
|
||||
if (se2 > 0 && i % se2 == 0)
|
||||
System.out.println(i);
|
||||
}
|
||||
}
|
||||
stop = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
System.out.println("STOP: " + start.toString());
|
||||
System.out.println("DURATA: " + (double)(stop.getTime() - start.getTime()) / 60000.0D + " minuti");
|
||||
System.out.println("Fine");
|
||||
System.out.println(rp.getMsg());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
import it.acxent.contab.Documento;
|
||||
import it.acxent.contab.RigaDocumento;
|
||||
import it.acxent.db.ApplParm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.util.DbConsole;
|
||||
import it.acxent.util.Vectumerator;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class AggiornaMagRigaDocumento extends DbConsole {
|
||||
public static void main(String[] args) {
|
||||
AggiornaMagRigaDocumento bean = new AggiornaMagRigaDocumento();
|
||||
bean.doImport();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void doImport() {
|
||||
int i = 0, j = 0;
|
||||
int se1 = 10;
|
||||
int se2 = 100;
|
||||
String hostname = "localhost";
|
||||
String db = "ravinale";
|
||||
boolean step1 = true, step2 = true, step3 = true, step4 = true, step5 = true;
|
||||
System.out.println("Db: " + db);
|
||||
ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 60));
|
||||
apTarget.setDebug(false);
|
||||
StringBuffer msg = new StringBuffer();
|
||||
try {
|
||||
long l_id_articolo = 0L;
|
||||
ResParm rp = new ResParm(true);
|
||||
int pagerow = 1000;
|
||||
Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
System.out.println("START: " + start.toString());
|
||||
if (step1) {
|
||||
i = 0;
|
||||
System.out.println("Import All Movimento");
|
||||
RigaDocumento rd = new RigaDocumento(apTarget);
|
||||
Vectumerator<RigaDocumento> vec = rd.findByDocumento(51L, -1L, "", 0, 0, 0);
|
||||
Documento documento = new Documento(apTarget);
|
||||
documento.findByPrimaryKey(51L);
|
||||
System.out.println("tot record: " + vec.getTotNumberOfRecords());
|
||||
while (vec.hasMoreElements()) {
|
||||
rd = (RigaDocumento)vec.nextElement();
|
||||
System.out.println(rd.getArticoloVariante().getCodiceVariante() + " " + rd.getArticoloVariante().getCodiceVariante() + " " + rd.getArticoloVariante().getQuantitaEffettivaAv());
|
||||
if (rd.getArticoloVariante().getQuantitaEffettivaAv() == 0.0D) {
|
||||
rp = Documento.addRigaDocumento(documento, rd);
|
||||
if (rd.getArticoloVariante().getQuantitaEffettivaAv() == 0.0D)
|
||||
System.out.println("" +
|
||||
rd.getArticoloVariante().getQuantitaEffettivaAv() + " " + rd.getArticoloVariante().getQuantitaEffettivaAv());
|
||||
}
|
||||
i++;
|
||||
if (se1 > 0 && i % se1 == 0)
|
||||
System.out.print(".");
|
||||
if (se2 > 0 && i % se2 == 0)
|
||||
System.out.println(i);
|
||||
}
|
||||
}
|
||||
Timestamp stop = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
stop = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
System.out.println("STOP: " + start.toString());
|
||||
System.out.println("DURATA: " + (double)(stop.getTime() - start.getTime()) / 60000.0D + " minuti");
|
||||
System.out.println("Fine");
|
||||
System.out.println(rp.getMsg());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
77
decompiled-libs/www/acxent-common-1.0.1/AggiornaRDMOV.java
Normal file
77
decompiled-libs/www/acxent-common-1.0.1/AggiornaRDMOV.java
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
import it.acxent.contab.RigaDocumento;
|
||||
import it.acxent.contab.RigaDocumentoCR;
|
||||
import it.acxent.contab.RigaDocumentoP;
|
||||
import it.acxent.db.ApplParm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.util.DbConsole;
|
||||
import it.acxent.util.Vectumerator;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class AggiornaRDMOV extends DbConsole {
|
||||
public static void main(String[] args) {
|
||||
AggiornaRDMOV bean = new AggiornaRDMOV();
|
||||
bean.doImport();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void doImport() {
|
||||
int i = 0, j = 0;
|
||||
int se1 = 10;
|
||||
int se2 = 100;
|
||||
String hostname = "localhost";
|
||||
String db = "guidoreni14";
|
||||
boolean step1 = false, step2 = true, step3 = true, step4 = true, step5 = true;
|
||||
System.out.println("Db: " + db);
|
||||
ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 60));
|
||||
apTarget.setDebug(false);
|
||||
StringBuffer msg = new StringBuffer();
|
||||
try {
|
||||
long l_id_articolo = 0L;
|
||||
ResParm rp = new ResParm(true);
|
||||
int pagerow = 1000;
|
||||
Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
System.out.println("START: " + start.toString());
|
||||
if (step1) {
|
||||
System.out.println("CICLO RIGA DOCUMENTO");
|
||||
i = 0;
|
||||
RigaDocumento rd = new RigaDocumento(apTarget);
|
||||
RigaDocumentoCR CR = new RigaDocumentoCR(apTarget);
|
||||
int nrighe = 100000;
|
||||
int recordCancellati = 0;
|
||||
int npag = 1;
|
||||
Vectumerator<RigaDocumento> vec;
|
||||
while ((vec = rd.findByCR(CR, npag, nrighe)).hasMoreElements()) {
|
||||
npag++;
|
||||
while (vec.hasMoreElements()) {
|
||||
RigaDocumento row = (RigaDocumento)vec.nextElement();
|
||||
rp = row.saveMagSuRIgaDocumento();
|
||||
if (!rp.getStatus())
|
||||
System.out.println(rp.getMsg());
|
||||
i++;
|
||||
if (se1 > 0 && i % se1 == 0)
|
||||
System.out.print(".");
|
||||
if (se2 > 0 && i % se2 == 0)
|
||||
System.out.println("" + i + " PAG. " + i + " / " + npag);
|
||||
}
|
||||
}
|
||||
}
|
||||
Timestamp stop = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
System.out.println("STOP: " + start.toString());
|
||||
System.out.println("DURATA: " + (double)(stop.getTime() - start.getTime()) / 60000.0D + " minuti");
|
||||
start = stop;
|
||||
if (step2) {
|
||||
RigaDocumentoP rdp = new RigaDocumentoP(apTarget);
|
||||
rdp.aggiustaOrdiniSuRD();
|
||||
}
|
||||
stop = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
System.out.println("STOP: " + start.toString());
|
||||
System.out.println("DURATA: " + (double)(stop.getTime() - start.getTime()) / 60000.0D + " minuti");
|
||||
System.out.println("Fine");
|
||||
System.out.println(rp.getMsg());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
import it.acxent.art.Articolo;
|
||||
import it.acxent.art.ArticoloCR;
|
||||
import it.acxent.art.ArticoloUsato;
|
||||
import it.acxent.db.ApplParm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.util.DbConsole;
|
||||
import it.acxent.util.Vectumerator;
|
||||
import java.sql.Time;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
public class AggiustaArticoloUsato extends DbConsole {
|
||||
public static void main(String[] args) {
|
||||
AggiustaArticoloUsato bean = new AggiustaArticoloUsato();
|
||||
bean.doImport();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void doImport() {
|
||||
String db = "tf19";
|
||||
int i = 0;
|
||||
int se1 = 10;
|
||||
int se2 = 100;
|
||||
String hostname = "localhost";
|
||||
String temp = getCi().readLine("Hostname (" + hostname + "):");
|
||||
if (!temp.isEmpty())
|
||||
hostname = temp;
|
||||
temp = getCi().readLine("Database name (" + db + "):");
|
||||
if (!temp.isEmpty())
|
||||
db = temp;
|
||||
System.out.println("Db: " + db);
|
||||
ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300));
|
||||
apTarget.setDebug(false);
|
||||
StringBuffer msg = new StringBuffer();
|
||||
try {
|
||||
Articolo bean = new Articolo(apTarget);
|
||||
System.out.println("ciclo articoli");
|
||||
ArticoloCR CR = new ArticoloCR();
|
||||
CR.setFlgOrderBy(1L);
|
||||
CR.setFlgUsato(99L);
|
||||
CR.setFlgEscludiWeb(-1L);
|
||||
long currentidAU = 0L;
|
||||
Vectumerator<Articolo> vec = bean.findByCR(CR, 0, 0);
|
||||
ArticoloUsato au = new ArticoloUsato(apTarget);
|
||||
System.out.println("Tot Record: " + vec.getTotNumberOfRecords());
|
||||
boolean daInvertire = false;
|
||||
while (vec.hasMoreElements()) {
|
||||
Articolo row = (Articolo)vec.nextElement();
|
||||
Vectumerator<ArticoloUsato> vecAU = au.findByArticoloOrdineManuale(row.getId_articolo());
|
||||
currentidAU = 0L;
|
||||
daInvertire = false;
|
||||
while (vecAU.hasMoreElements()) {
|
||||
ArticoloUsato rowAU = (ArticoloUsato)vecAU.nextElement();
|
||||
if (rowAU.getId_articoloUsato() > currentidAU) {
|
||||
currentidAU = rowAU.getId_articoloUsato();
|
||||
continue;
|
||||
}
|
||||
System.out.println("DA INVERTIRE articolo: " + row.getId_articolo() + " " + row.getCodice());
|
||||
daInvertire = true;
|
||||
break;
|
||||
}
|
||||
if (daInvertire) {
|
||||
vecAU.moveFirst();
|
||||
while (vecAU.hasMoreElements()) {
|
||||
ArticoloUsato rowAU2 = (ArticoloUsato)vecAU.nextElement();
|
||||
ArticoloUsato rowNew = new ArticoloUsato(apTarget);
|
||||
rowNew.findByPrimaryKey(rowAU2.getId_articoloUsato());
|
||||
rowNew.setDBState(0);
|
||||
rowNew.setId_articoloUsato(0L);
|
||||
rowNew.save();
|
||||
rowAU2.delete();
|
||||
}
|
||||
}
|
||||
i++;
|
||||
if (se1 > 0 && i % se1 == 0)
|
||||
System.out.print(".");
|
||||
if (se2 > 0 && i % se2 == 0)
|
||||
System.out.println("" + i + " / " + i);
|
||||
}
|
||||
System.out.println("fine ciclo \n" + msg.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected Time getTimeFromString(String theTime) {
|
||||
try {
|
||||
if (theTime.matches("[0-9][0-9][0-9][0-9]"))
|
||||
theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2);
|
||||
if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) {
|
||||
StringTokenizer st = new StringTokenizer(theTime, ":");
|
||||
int hour = Integer.parseInt(st.nextToken());
|
||||
int min = Integer.parseInt(st.nextToken());
|
||||
int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0;
|
||||
return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000));
|
||||
}
|
||||
if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) {
|
||||
StringTokenizer st = new StringTokenizer(theTime, ":");
|
||||
int hour = Integer.parseInt(st.nextToken());
|
||||
int min = Integer.parseInt(st.nextToken());
|
||||
int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0;
|
||||
return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000));
|
||||
}
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
import it.acxent.art.Articolo;
|
||||
import it.acxent.art.ArticoloCR;
|
||||
import it.acxent.db.ApplParm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.util.DbConsole;
|
||||
import it.acxent.util.Vectumerator;
|
||||
import java.sql.Time;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
public class ArrotondaArticoli extends DbConsole {
|
||||
public static void main(String[] args) {
|
||||
ArrotondaArticoli bean = new ArrotondaArticoli();
|
||||
bean.doImport();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void doImport() {
|
||||
String db = "guidoreni";
|
||||
int i = 0;
|
||||
int se1 = 10;
|
||||
int se2 = 100;
|
||||
String hostname = "localhost";
|
||||
String temp = getCi().readLine("Hostname (" + hostname + "):");
|
||||
if (!temp.isEmpty())
|
||||
hostname = temp;
|
||||
temp = getCi().readLine("Database name (" + db + "):");
|
||||
if (!temp.isEmpty())
|
||||
db = temp;
|
||||
System.out.println("Db: " + db);
|
||||
ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300));
|
||||
apTarget.setDebug(false);
|
||||
StringBuffer msg = new StringBuffer();
|
||||
try {
|
||||
Articolo bean = new Articolo(apTarget);
|
||||
ArticoloCR CR = new ArticoloCR();
|
||||
CR.setId_iva((long)bean.getParm("CODICE_IVA_STD_VEND").getNumeroInt());
|
||||
Vectumerator<Articolo> vec = bean.findByCR(CR, 0, 0);
|
||||
System.out.println("ciclo articoli");
|
||||
System.out.println("Tot Record: " + vec.getTotNumberOfRecords());
|
||||
while (vec.hasMoreElements()) {
|
||||
Articolo row = (Articolo)vec.nextElement();
|
||||
row.arrotondaPrezzoPubblicoConIva();
|
||||
i++;
|
||||
if (se1 > 0 && i % se1 == 0)
|
||||
System.out.print(".");
|
||||
if (se2 > 0 && i % se2 == 0)
|
||||
System.out.println(i);
|
||||
}
|
||||
System.out.println("fine ciclo \n" + msg.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected Time getTimeFromString(String theTime) {
|
||||
try {
|
||||
if (theTime.matches("[0-9][0-9][0-9][0-9]"))
|
||||
theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2);
|
||||
if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) {
|
||||
StringTokenizer st = new StringTokenizer(theTime, ":");
|
||||
int hour = Integer.parseInt(st.nextToken());
|
||||
int min = Integer.parseInt(st.nextToken());
|
||||
int sec = st.hasMoreElements() ? Integer.parseInt(
|
||||
st.nextToken()) : 0;
|
||||
return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000));
|
||||
}
|
||||
if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) {
|
||||
StringTokenizer st = new StringTokenizer(theTime, ":");
|
||||
int hour = Integer.parseInt(st.nextToken());
|
||||
int min = Integer.parseInt(st.nextToken());
|
||||
int sec = st.hasMoreElements() ? Integer.parseInt(
|
||||
st.nextToken()) : 0;
|
||||
return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000));
|
||||
}
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
import it.acxent.art.Articolo;
|
||||
import it.acxent.art.ArticoloCR;
|
||||
import it.acxent.db.ApplParm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.util.DbConsole;
|
||||
import it.acxent.util.Vectumerator;
|
||||
import java.sql.Time;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
public class ArticoliPulisciImmagini extends DbConsole {
|
||||
public static void main(String[] args) {
|
||||
ArticoliPulisciImmagini bean = new ArticoliPulisciImmagini();
|
||||
bean.doImport();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void doImport() {
|
||||
String db = "tf19xxxxxx";
|
||||
int i = 0;
|
||||
int se1 = 10;
|
||||
int se2 = 100;
|
||||
String hostname = "localhost";
|
||||
String temp = getCi().readLine("Hostname (" + hostname + "):");
|
||||
if (!temp.isEmpty())
|
||||
hostname = temp;
|
||||
temp = getCi().readLine("Database name (" + db + "):");
|
||||
if (!temp.isEmpty())
|
||||
db = temp;
|
||||
System.out.println("Db: " + db);
|
||||
ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300));
|
||||
apTarget.setDebug(false);
|
||||
StringBuffer msg = new StringBuffer();
|
||||
try {
|
||||
Articolo bean = new Articolo(apTarget);
|
||||
System.out.println("ciclo articoli");
|
||||
ArticoloCR CR = new ArticoloCR();
|
||||
CR.setFlgEscludiWeb(0L);
|
||||
Vectumerator<Articolo> vec = bean.findByCR(CR, 0, 0);
|
||||
System.out.println("Tot Record: " + vec.getTotNumberOfRecords());
|
||||
while (vec.hasMoreElements()) {
|
||||
Articolo row = (Articolo)vec.nextElement();
|
||||
row.deleteImmaginiSporche();
|
||||
i++;
|
||||
if (se1 > 0 && i % se1 == 0)
|
||||
System.out.print(".");
|
||||
if (se2 > 0 && i % se2 == 0)
|
||||
System.out.println("" + i + " / " + i);
|
||||
}
|
||||
System.out.println("fine ciclo \n" + msg.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected Time getTimeFromString(String theTime) {
|
||||
try {
|
||||
if (theTime.matches("[0-9][0-9][0-9][0-9]"))
|
||||
theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2);
|
||||
if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) {
|
||||
StringTokenizer st = new StringTokenizer(theTime, ":");
|
||||
int hour = Integer.parseInt(st.nextToken());
|
||||
int min = Integer.parseInt(st.nextToken());
|
||||
int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0;
|
||||
return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000));
|
||||
}
|
||||
if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) {
|
||||
StringTokenizer st = new StringTokenizer(theTime, ":");
|
||||
int hour = Integer.parseInt(st.nextToken());
|
||||
int min = Integer.parseInt(st.nextToken());
|
||||
int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0;
|
||||
return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000));
|
||||
}
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
import it.acxent.art.Articolo;
|
||||
import it.acxent.art.ArticoloCR;
|
||||
import it.acxent.db.ApplParm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.util.DbConsole;
|
||||
import it.acxent.util.Vectumerator;
|
||||
import java.sql.Time;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
public class ArticoliSistemaCodiciAlternativi extends DbConsole {
|
||||
public static void main(String[] args) {
|
||||
ArticoliSistemaCodiciAlternativi bean = new ArticoliSistemaCodiciAlternativi();
|
||||
bean.doImport();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void doImport() {
|
||||
String db = "cc";
|
||||
int i = 0;
|
||||
int se1 = 10;
|
||||
int se2 = 100;
|
||||
String hostname = "localhost";
|
||||
String temp = getCi().readLine("Hostname (" + hostname + "):");
|
||||
if (!temp.isEmpty())
|
||||
hostname = temp;
|
||||
temp = getCi().readLine("Database name (" + db + "):");
|
||||
if (!temp.isEmpty())
|
||||
db = temp;
|
||||
System.out.println("Db: " + db);
|
||||
ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300));
|
||||
apTarget.setDebug(false);
|
||||
StringBuffer msg = new StringBuffer();
|
||||
try {
|
||||
Articolo bean = new Articolo(apTarget);
|
||||
ArticoloCR CR = new ArticoloCR();
|
||||
Vectumerator<Articolo> vec = bean.findByCR(CR, 0, 0);
|
||||
System.out.println("ciclo articoli sistema codici alternativi");
|
||||
System.out.println("Tot Record: " + vec.getTotNumberOfRecords());
|
||||
while (vec.hasMoreElements()) {
|
||||
Articolo row = (Articolo)vec.nextElement();
|
||||
String codiciAltDB = row.getCodiciAlternativi();
|
||||
row.aggiornaCodiciAlternativi(true);
|
||||
if (!codiciAltDB.equals(row.getCodiciAlternativi()))
|
||||
System.out.println("\n" + row.getCodice() + " " + codiciAltDB + " --> " + row.getCodiciAlternativi());
|
||||
if (row.getCodiciAlternativi().isEmpty()) {
|
||||
ResParm rp = row.delete();
|
||||
System.out.println("\n" + row.getCodice() + " cancellato: " + rp.getStatus());
|
||||
}
|
||||
i++;
|
||||
if (se1 > 0 && i % se1 == 0)
|
||||
System.out.print(".");
|
||||
if (se2 > 0 && i % se2 == 0)
|
||||
System.out.println("" + i + "/" + i);
|
||||
}
|
||||
System.out.println("fine ciclo \n" + msg.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected Time getTimeFromString(String theTime) {
|
||||
try {
|
||||
if (theTime.matches("[0-9][0-9][0-9][0-9]"))
|
||||
theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2);
|
||||
if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) {
|
||||
StringTokenizer st = new StringTokenizer(theTime, ":");
|
||||
int hour = Integer.parseInt(st.nextToken());
|
||||
int min = Integer.parseInt(st.nextToken());
|
||||
int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0;
|
||||
return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000));
|
||||
}
|
||||
if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) {
|
||||
StringTokenizer st = new StringTokenizer(theTime, ":");
|
||||
int hour = Integer.parseInt(st.nextToken());
|
||||
int min = Integer.parseInt(st.nextToken());
|
||||
int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0;
|
||||
return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000));
|
||||
}
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
91
decompiled-libs/www/acxent-common-1.0.1/ArticoliTipoAcc.java
Normal file
91
decompiled-libs/www/acxent-common-1.0.1/ArticoliTipoAcc.java
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
import it.acxent.art.Articolo;
|
||||
import it.acxent.art.ArticoloCR;
|
||||
import it.acxent.db.ApplParm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.util.DbConsole;
|
||||
import it.acxent.util.Vectumerator;
|
||||
import java.sql.Time;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
public class ArticoliTipoAcc extends DbConsole {
|
||||
public static void main(String[] args) {
|
||||
ArticoliTipoAcc bean = new ArticoliTipoAcc();
|
||||
bean.doImport();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void doImport() {
|
||||
String db = "guidoreni";
|
||||
int i = 0;
|
||||
int se1 = 10;
|
||||
int se2 = 100;
|
||||
String hostname = "localhost";
|
||||
String temp = getCi().readLine("Hostname (" + hostname + "):");
|
||||
if (!temp.isEmpty())
|
||||
hostname = temp;
|
||||
temp = getCi().readLine("Database name (" + db + "):");
|
||||
if (!temp.isEmpty())
|
||||
db = temp;
|
||||
System.out.println("Db: " + db);
|
||||
ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300));
|
||||
long l_id_tipoAcc = 196L;
|
||||
long l_id_tipoAccOrig = 214L;
|
||||
long l_id_tipoAccCompat = 229L;
|
||||
temp = getCi().readLine("id_tipo accessorio root (" + l_id_tipoAcc + "):");
|
||||
if (!temp.isEmpty())
|
||||
l_id_tipoAcc = Long.valueOf(temp);
|
||||
apTarget.setDebug(false);
|
||||
StringBuffer msg = new StringBuffer();
|
||||
try {
|
||||
Articolo bean = new Articolo(apTarget);
|
||||
System.out.println("ciclo articoli");
|
||||
ArticoloCR CR = new ArticoloCR(apTarget);
|
||||
CR.setId_tipo(l_id_tipoAcc);
|
||||
Vectumerator<Articolo> vec = bean.findByCR(CR, 0, 0);
|
||||
System.out.println("Tot Record: " + vec.getTotNumberOfRecords());
|
||||
while (vec.hasMoreElements()) {
|
||||
Articolo row = (Articolo)vec.nextElement();
|
||||
if (row.getTipo().getId_tipoPadre() == l_id_tipoAccCompat) {
|
||||
row.setId_tipoAccessorio(2L);
|
||||
} else {
|
||||
row.setId_tipoAccessorio(5L);
|
||||
}
|
||||
row.save();
|
||||
i++;
|
||||
if (se1 > 0 && i % se1 == 0)
|
||||
System.out.print(".");
|
||||
if (se2 > 0 && i % se2 == 0)
|
||||
System.out.println(i);
|
||||
}
|
||||
System.out.println("fine ciclo \n" + msg.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected Time getTimeFromString(String theTime) {
|
||||
try {
|
||||
if (theTime.matches("[0-9][0-9][0-9][0-9]"))
|
||||
theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2);
|
||||
if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) {
|
||||
StringTokenizer st = new StringTokenizer(theTime, ":");
|
||||
int hour = Integer.parseInt(st.nextToken());
|
||||
int min = Integer.parseInt(st.nextToken());
|
||||
int sec = st.hasMoreElements() ? Integer.parseInt(
|
||||
st.nextToken()) : 0;
|
||||
return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000));
|
||||
}
|
||||
if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) {
|
||||
StringTokenizer st = new StringTokenizer(theTime, ":");
|
||||
int hour = Integer.parseInt(st.nextToken());
|
||||
int min = Integer.parseInt(st.nextToken());
|
||||
int sec = st.hasMoreElements() ? Integer.parseInt(
|
||||
st.nextToken()) : 0;
|
||||
return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000));
|
||||
}
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
import it.acxent.art.Articolo;
|
||||
import it.acxent.db.ApplParm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.util.DbConsole;
|
||||
import java.sql.Time;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
public class ArticoliUnisciEan extends DbConsole {
|
||||
public static void main(String[] args) {
|
||||
ArticoliUnisciEan bean = new ArticoliUnisciEan();
|
||||
bean.doImport();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void doImport() {
|
||||
String db = "cc";
|
||||
int i = 0;
|
||||
int se1 = 10;
|
||||
int se2 = 100;
|
||||
String hostname = "localhost";
|
||||
String temp = getCi().readLine("Hostname (" + hostname + "):");
|
||||
if (!temp.isEmpty())
|
||||
hostname = temp;
|
||||
temp = getCi().readLine("Database name (" + db + "):");
|
||||
if (!temp.isEmpty())
|
||||
db = temp;
|
||||
System.out.println("Db: " + db);
|
||||
ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300));
|
||||
apTarget.setDebug(false);
|
||||
StringBuffer msg = new StringBuffer();
|
||||
try {
|
||||
Articolo bean = new Articolo(apTarget);
|
||||
System.out.println("ciclo articoli");
|
||||
bean.unisciArticoliByCodiceEan();
|
||||
System.out.println("fine ciclo \n" + msg.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected Time getTimeFromString(String theTime) {
|
||||
try {
|
||||
if (theTime.matches("[0-9][0-9][0-9][0-9]"))
|
||||
theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2);
|
||||
if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) {
|
||||
StringTokenizer st = new StringTokenizer(theTime, ":");
|
||||
int hour = Integer.parseInt(st.nextToken());
|
||||
int min = Integer.parseInt(st.nextToken());
|
||||
int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0;
|
||||
return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000));
|
||||
}
|
||||
if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) {
|
||||
StringTokenizer st = new StringTokenizer(theTime, ":");
|
||||
int hour = Integer.parseInt(st.nextToken());
|
||||
int min = Integer.parseInt(st.nextToken());
|
||||
int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0;
|
||||
return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000));
|
||||
}
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue