Created
December 4, 2012 12:31
-
-
Save amka/4203331 to your computer and use it in GitHub Desktop.
soap test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
import pprint | |
import socket | |
import ssl | |
from suds.client import Client | |
from mtse.connectors.transport import HTTPSClientCertTransport | |
SERVICE_URL = 'https://85.21.20.109/Payment/gateway.wsdl' | |
#HOST = 'services.elecsnet.ru' | |
#HOST = '192.168.255.146' | |
PEM_FILE = '../../cert/MTSLight_key.pem' | |
CLIENT_CERT_FILE = '../../cert/MTSLight_cert.crt' | |
CA_CERT_FILE = '../../cert/MTSLight_ca.crt' | |
if __name__ == '__main__': | |
import logging | |
logging.getLogger('suds.client').setLevel(logging.DEBUG) | |
logging.basicConfig(level=logging.DEBUG) | |
transport = HTTPSClientCertTransport(key=PEM_FILE, cert=CLIENT_CERT_FILE) | |
client = Client(SERVICE_URL, transport=transport) | |
# print client | |
client.set_options(port='Elecsnet_x0020_Payment_x0020_Gateway_x0020_ServiceSoap') | |
TERM_TYPE = '2' # Terminal type | |
TERM_ID = '64000000' # Terminal number | |
REQ_NUM = '8980' # in range 0000-9999 | |
REQ_DATETIME = datetime.now().strftime('%Y%m%d%H%M%S') | |
MERCHANT_CODE = 'MTS' # Contragent's code | |
REQ_ID = '9164125171' # Contragent's ID | |
SUM = '0' # Int(12) amount in min. currency | |
CURRENCY = '810' # Currency code in ISO4217 | |
MERCHANT_DATA = '' | |
PAYMENT_NAME = '' | |
PAYMENT_ID = '' # | |
host_request = client.factory.create('HostRequestType') | |
host_request.termType = TERM_TYPE | |
host_request.termID = TERM_ID | |
host_request.reqNum = REQ_NUM | |
host_request.reqDateTime = REQ_DATETIME | |
host_request.merchantCode = MERCHANT_CODE | |
host_request.reqID = REQ_ID | |
host_request.sum = SUM | |
host_request.currency = CURRENCY | |
host_request.merchantData = MERCHANT_DATA | |
host_request.paymentName = PAYMENT_NAME | |
host_request.paymentID = PAYMENT_ID | |
host_request._operation = 'auth' | |
print host_request | |
print client.service[0].Transaction(host_request,) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment