0

私はPHPでフォローしていますが、これをdjangoビューで使用する必要があります。基本的にこれは USAepay xml 用です。次のように HTTP ポストで送信する必要があります。

$result=$this->httpPost($url, array('xml'=>$data));

django のビューで次の代替を取得しようとしています。

$data = '<?xml version="1.0" encoding="UTF-8"?>' .
            '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:usaepay" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">' . 
            '<SOAP-ENV:Body>' .
            '<ns1:runCustomerTransaction>'.
            '<Token xsi:type="ns1:ueSecurityToken">' .
            '<ClientIP xsi:type="xsd:string">' . $_SERVER['REMOTE_ADDR'] . '</ClientIP>' .
            '<PinHash xsi:type="ns1:ueHash">' .
            '<HashValue xsi:type="xsd:string">' . $hash . '</HashValue>' .
            '<Seed xsi:type="xsd:string">' . $seed . '</Seed>' . 
            '<Type xsi:type="xsd:string">sha1</Type>' .
            '</PinHash>' .
            '<SourceKey xsi:type="xsd:string">' . $this->key . '</SourceKey>' .
            '</Token>' .
            '<CustNum xsi:type="xsd:integer">' . $CustNum . '</CustNum>'.
            '<PaymentMethodID xsi:type="xsd:integer">0</PaymentMethodID>'.
            '<Parameters xsi:type="ns1:CustomerTransactionRequest">'.
            '<Command xsi:type="xsd:string">Sale</Command>'.
            '<Details xsi:type="ns1:TransactionDetail">' . 
            '<Amount xsi:type="xsd:double">' . $this->xmlentities($this->amount) . '</Amount>' . 
            '<Description xsi:type="xsd:string">' . $this->xmlentities($this->description) . '</Description>'.
            '<Invoice xsi:type="xsd:string">' . $this->xmlentities($this->invoice) . '</Invoice>' .
            '<Currency xsi:type="xsd:string">484</Currency>'.
            '</Details>' .
            '</Parameters>'.
            '</ns1:runCustomerTransaction>'.
            '</SOAP-ENV:Body>' .
            '</SOAP-ENV:Envelope>';
4

1 に答える 1

0

を使ってやりました

dataquick = '<?xml version="10" encoding="UTF-8"?>'+
    '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemasxmlsoaporg/soap/envelope/" xmlns:ns1="urn:usaepay" xmlns:xsd="http://wwww3org/2001/XMLSchema" xmlns:xsi="http://wwww3org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemasxmlsoaporg/soap/encoding/" SOAP-ENV:encodingStyle="http://schemasxmlsoaporg/soap/encoding/">' +
    '<SOAP-ENV:Body>' +
    '<ns1:runCustomerTransaction>' +
    '<Token xsi:type="ns1:ueSecurityToken">' +
    '<ClientIP xsi:type="xsd:string">'+str(os.environ.get('REMOTE_ADDR'))+'</ClientIP>' +
    '<PinHash xsi:type="ns1:ueHash">' +
    '<HashValue xsi:type="xsd:string">'+str(UMhash)+'</HashValue>' + 
    '<Seed xsi:type="xsd:string">'+str(umSend)+'</Seed>' +
    '<Type xsi:type="xsd:string">sha1</Type>' +
    '</PinHash>' +
    '<SourceKey xsi:type="xsd:string">*******************</SourceKey>' +
    '</Token>' +
    '<CustNum xsi:type="xsd:integer">'+str(request.user.id)+'</CustNum>' +
    '<PaymentMethodID xsi:type="xsd:integer">0</PaymentMethodID>' +
    '<Parameters xsi:type="ns1:CustomerTransactionRequest">' +
    '<Command xsi:type="xsd:string">Sale</Command>' +
    '<Details xsi:type="ns1:TransactionDetail">'  +
    '<Amount xsi:type="xsd:double">499</Amount>'  +
    '<Description xsi:type="xsd:string"></Description>' +
    '<Invoice xsi:type="xsd:string"></Invoice>' +
    '<Currency xsi:type="xsd:string">484</Currency>' +
    '</Details>' +
    '</Parameters>' +
    '</ns1:runCustomerTransaction>' +
    '</SOAP-ENV:Body>' +
    '</SOAP-ENV:Envelope>'  
    #cursor.execute("INSERT INTO payments(customerNbr,transactionID,transactionType,authorizationID,cardHolderID,methodID,accountNumber,exchangeRate,transactionStatus,transactionResult,paymentDate,orderNumber,orderAmount,isRefunded,refundDate,refundStatus,RefundAmount,kountID,paymentGateway) VALUES (%s,%s,'Recurring',%s,%s,'0',%s,'',%s,%s,'','','',0,'','',0,0,'USAepay')",[request.user.id,parsed_results['UMrefNum'],parsed_results['UMauthCode'],parsed_results['UMcustnum'],UMcardinsert,parsed_results['UMstatus'],parsed_results['UMstatus']])
    headers = { 
    "xml": dataquick
    }
于 2013-02-14T05:57:54.863 に答える