×

MYGIFTCARD SOAP API DOCUMENTATION

 

MYGIFTCARD SOAP API DOCUMENTATION

INDEX

GENERAL INFORMATIONS

Magento SOAP API

To connect to Magento SOAP web services, load the WSDL into your SOAP client from this URL: https://www.mygiftcard.it/api/v2_soap?wsdl=1 (Click here to see complete WSDL)

Genaral faults
CodeMessage
0 Unknown Error
1 Internal Error. Please see log for details
2 Access denied
3 Invalid api path
4 Resource path is not callable

METHODS

Authentication (login)

login((string) apiUser(string) apiKey)

Every call to Magento web-servicces need an authentication obtained calling login method with these parametsrs:

If authentication was successful a session is started for next API calls. Site administrator will provide credentials needed.

Request
TypeNameDescription
string apiUser Username (provided by site admin)
string apiKey Password (provided by site admin)
Response
TypeNameDescription
string sessionId Session Id (use this for all next API calls (lifetime 3600 seconds)

Check Pin

epipoliCheckPin((string) sessionId(string) pin)

If correct, returns an array containing the list of fields of the beneficiary's form.

Request
TypeNameDescription
string sessionId Session ID (obtained by call to login method)
string pin PIN that must be activated
Response
TypeNameDescription
epipoliCheckPinResponseEntity result Complex type of the response (see complex type section for details)
Faults
CodeMessage
99 Pin cannot be activated
98 Pin is not correct
97 Pin is blocked
96 Pin is already activated
95 Pin is expired

Register data

epipoliRegisterData((string) sessionId(string) pin(array) data)

Receives the array of data and tries to register them.

Request
TypeNameDescription
string sessionId Session ID (obtained by call to login method)
string pin PIN that must be activated
associativeArray data Array of data (see complex type section for details)
Response
TypeNameDescription
int result 1 if call succeded.
Faults
CodeMessage
99 Pin cannot be activated
98 Pin is not correct
97 Pin is blocked
96 Pin is already activated
95 Pin is expired

Block Pin

epipoliBlockPin((string) sessionId(string) pin(integer) serial_number)

Checks the pin and tries to block it. At least one of two parameters serial number or pin code is required.

Request
TypeNameDescription
string sessionId Session ID (obtained by call to login method)
string pin PIN code that must be blocked
integer serial_number PIN's serial number that must be blocked
Response
TypeNameDescription
int result 1 if call succeded.
Faults
CodeMessage
99 Pin cannot be blocked
98 Pin is not correct
97 Pin is already blocked
96 Pin is already activated
95 Pin is expired

Activate PIN from ecommerce order

epipoliEcommOrderPinActivation((string) sessionId(string) pin, [(string) card_code1], [(string) card_code2])

Searches the pin in the orders table and activates it.

Request
TypeNameDescription
string sessionId Session ID (obtained by call to login method)
string pin PIN code that has to be activated
string card_code1 The card code associated to the PIN. This field is optional.
string card_code2 The second card code associated to the PIN. This field is optional.
Response
TypeNameDescription
int result 1 if call succeded.
Faults
CodeMessage
99 Pin cannot be activated
98 Pin is not correct
97 Pin is blocked
96 Pin is already activated
95 Pin is expired
93 Pin not found in orders table

COMPLEX TYPES

epipoliCheckPinResponseEntity

TypeNameDescription
epipoliCheckPinFieldsEntity fields array containing all saveable data
associativeArray pin_info array containing all details of the PIN that must be activated
associativeArray card_info array containing all the details of the card that must be activated
string card_ean EAN of the card
string sold_at Date sold

epipoliCheckPinFieldsEntity

TypeNameDescription
string name Field name
boolean required If the field is required or not
associativeArray values Value labels pairs that field can assume (tipically for select inputs)

associativeArray

TypeNameDescription
string key Key of the array
string value Value of the array

CODE SAMPLES

Php code sample

1
<?php
2
$client = new SoapClient('http://fabdev.mygiftcard.it/index.php/api/v2_soap?wsdl=1');
3
$sessionId = $client->login('apiUser', 'apiKey'); //authentication
4
5
$pin = "123456";
6
$checkpinResult = $client->epipoliCheckPin($sessionId, $pin);
7
8
$data = array(
9
            array("key" => "value_of_key1", "value" => "value_of_value1"),
10
            array("key" => "value_of_key2", "value" => "value_of_value3")
11
        );
12
$registerDataResult = $client->epipoliRegisterData($sessionId, $pin, $data);

EXAMPLES OF SOAP REQUESTS / RESPONSES

epipoliCheckPin response

1
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
2
        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento" 
3
        xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
4
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5
   <SOAP-ENV:Body>
6
      <ns1:epipoliCheckPinResponse>
7
         <result xsi:type="ns1:epipoliCheckPinResponseEntity">
8
            <fields SOAP-ENC:arrayType="ns1:epipoliCheckPinFieldsEntity[6]" xsi:type="ns1:epipoliCheckPinFieldsEntityArray">
9
               <item xsi:type="ns1:epipoliCheckPinFieldsEntity">
10
                  <name xsi:type="xsd:string">email</name>
11
                  <required xsi:type="xsd:boolean">true</required>
12
               </item>
13
               <item xsi:type="ns1:epipoliCheckPinFieldsEntity">
14
                  <name xsi:type="xsd:string">privacy</name>
15
                  <required xsi:type="xsd:boolean">true</required>
16
               </item>
17
               <item xsi:type="ns1:epipoliCheckPinFieldsEntity">
18
                  <name xsi:type="xsd:string">privacy2</name>
19
                  <required xsi:type="xsd:boolean">false</required>
20
               </item>
21
               <item xsi:type="ns1:epipoliCheckPinFieldsEntity">
22
                  <name xsi:type="xsd:string">codice_carta</name>
23
                  <required xsi:type="xsd:boolean">true</required>
24
               </item>
25
               <item xsi:type="ns1:epipoliCheckPinFieldsEntity">
26
                  <name xsi:type="xsd:string">select</name>
27
                  <required xsi:type="xsd:boolean">false</required>
28
                  <values SOAP-ENC:arrayType="ns1:associativeEntity[3]" xsi:type="ns1:associativeArray">
29
                     <item xsi:type="ns1:associativeEntity">
30
                        <key xsi:type="xsd:string">val1</key>
31
                        <value xsi:type="xsd:string">label1</value>
32
                     </item>
33
                     <item xsi:type="ns1:associativeEntity">
34
                        <key xsi:type="xsd:string">val2</key>
35
                        <value xsi:type="xsd:string">label2</value>
36
                     </item>
37
                     <item xsi:type="ns1:associativeEntity">
38
                        <key xsi:type="xsd:string">val3</key>
39
                        <value xsi:type="xsd:string">label3</value>
40
                     </item>
41
                  </values>
42
               </item>
43
               <item xsi:type="ns1:epipoliCheckPinFieldsEntity">
44
                  <name xsi:type="xsd:string">agreement</name>
45
                  <required xsi:type="xsd:boolean">true</required>
46
               </item>
47
            </fields>
48
            <pin_info SOAP-ENC:arrayType="ns1:associativeEntity[2]" xsi:type="ns1:associativeArray">
49
               <item xsi:type="ns1:associativeEntity">
50
                  <key xsi:type="xsd:string">serial_number</key>
51
                  <value xsi:type="xsd:string">1234567890</value>
52
               </item>
53
               <item xsi:type="ns1:associativeEntity">
54
                  <key xsi:type="xsd:string">lotto</key>
55
                  <value xsi:type="xsd:string">83</value>
56
               </item>
57
               <item xsi:type="ns1:associativeEntity">
58
                  <key xsi:type="xsd:string">prezzo_vendita</key>
59
                  <value xsi:type="xsd:string">9.99</value>
60
               </item>
61
            </pin_info>
62
            <card_info SOAP-ENC:arrayType="ns1:associativeEntity[2]" xsi:type="ns1:associativeArray">
63
               <item xsi:type="ns1:associativeEntity">
64
                  <key xsi:type="xsd:string">taglio</key>
65
                  <value xsi:type="xsd:string">10.00</value>
66
               </item>
67
               <item xsi:type="ns1:associativeEntity">
68
                  <key xsi:type="xsd:string">name</key>
69
                  <value xsi:type="xsd:string">Carta Prepagata MasterCard 200€</value>
70
               </item>
71
            </card_info>
72
            <card_ean xsi:type="xsd:string">1234567890</card_ean>
73
            <sold_at xsi:type="xsd:string">2015-03-16 10:04:10</sold_at>
74
         </result>
75
      </ns1:epipoliCheckPinResponse>
76
   </SOAP-ENV:Body>
77
</SOAP-ENV:Envelope>

epipoliRegisterData request

1
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
2
            xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Magento">
3
   <soapenv:Header/>
4
   <soapenv:Body>
5
      <urn:epipoliRegisterData soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
6
         <sessionId xsi:type="xsd:string">4687acc870ed855840dec99b0dd2fe2a</sessionId>
7
         <pin xsi:type="xsd:string">1234567890</pin>
8
         <data xsi:type="urn:associativeArray" soapenc:arrayType="xsd:associativeEntity[]">
9
            <item xsi:type="ns1:associativeEntity">
10
                <key xsi:type="xsd:string">email</key>
11
                <value xsi:type="xsd:string">test@test.com</value>
12
             </item>
13
            <item xsi:type="ns1:associativeEntity">
14
                <key xsi:type="xsd:string">privacy</key>
15
                <value xsi:type="xsd:string">1</value>
16
             </item>
17
         </data>
18
      </urn:epipoliRegisterData>
19
   </soapenv:Body>
20
</soapenv:Envelope>

Top>