-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc0ca3e
commit 34067b3
Showing
5 changed files
with
162 additions
and
2 deletions.
There are no files selected for viewing
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
49 changes: 49 additions & 0 deletions
49
src/hope_payment_gateway/apps/fsp/western_union/api/wsdl/PayStatus_Service_H2HService.wsdl
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.westernunion.com/PayStatus_H2H" xmlns:xrsi="http://www.westernunion.com/schema/xrsi" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="PayStatus_Service_H2H" targetNamespace="http://www.westernunion.com/PayStatus_H2H"> | ||
<wsdl:types> | ||
<xsd:schema xmlns:mrm="http://www.westernunion.com/PayStatus" targetNamespace="http://www.westernunion.com/PayStatus" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
<xsd:import namespace="http://www.westernunion.com/schema/xrsi" schemaLocation="../schema/XRSIPayStatusInquiryRequest.xsd"/> | ||
<xsd:import namespace="http://www.westernunion.com/schema/xrsi" schemaLocation="../schema/XRSIPayStatusInquiryReply.xsd"/> | ||
<xsd:import namespace="http://www.westernunion.com/schema/xrsi" schemaLocation="../schema/XRSIErrorReply.xsd"/> | ||
</xsd:schema> | ||
</wsdl:types> | ||
<wsdl:message name="PayStatus_in"> | ||
<wsdl:part element="xrsi:pay-status-inquiry-request-data" name="pay-status-inquiry-request-data"/> | ||
</wsdl:message> | ||
<wsdl:message name="PayStatus_out"> | ||
<wsdl:part element="xrsi:pay-status-inquiry-reply" name="pay-status-inquiry-reply"/> | ||
</wsdl:message> | ||
<wsdl:message name="PayStatus_fault1"> | ||
<wsdl:part element="xrsi:error-reply" name="error-reply"/> | ||
</wsdl:message> | ||
<wsdl:portType name="PayStatusPortType"> | ||
<wsdl:operation name="PayStatus"> | ||
<wsdl:input message="tns:PayStatus_in" name="PayStatus_Input"/> | ||
<wsdl:output message="tns:PayStatus_out" name="PayStatus_Output"/> | ||
<wsdl:fault message="tns:PayStatus_fault1" name="PayStatus_Fault"/> | ||
</wsdl:operation> | ||
</wsdl:portType> | ||
<wsdl:binding name="PayStatus_H2H_SOAP_HTTP_Binding" type="tns:PayStatusPortType"> | ||
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> | ||
<wsdl:operation name="PayStatus"> | ||
<soap:operation/> | ||
<wsdl:input name="PayStatus_Input"> | ||
<soap:body parts="pay-status-inquiry-request-data" use="literal"/> | ||
</wsdl:input> | ||
<wsdl:output name="PayStatus_Output"> | ||
<soap:body parts="pay-status-inquiry-reply" use="literal"/> | ||
</wsdl:output> | ||
<wsdl:fault name="PayStatus_Fault"> | ||
<soap:fault name="PayStatus_Fault" use="literal"/> | ||
</wsdl:fault> | ||
</wsdl:operation> | ||
</wsdl:binding> | ||
<wsdl:service name="PayStatus_Service_H2H"> | ||
<wsdl:port binding="tns:PayStatus_H2H_SOAP_HTTP_Binding" name="SOAP_HTTP_Port_uat"> | ||
<soap:address location="https://wugateway2pi.westernunion.com/PayStatus_Service_H2H"/> | ||
</wsdl:port> | ||
<wsdl:port binding="tns:PayStatus_H2H_SOAP_HTTP_Binding" name="SOAP_HTTP_Port_prd"> | ||
<soap:address location="https://wugateway2.westernunion.com/PayStatus_Service_H2H"/> | ||
</wsdl:port> | ||
</wsdl:service> | ||
</wsdl:definitions> |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
responses: | ||
- response: | ||
auto_calculate_content_length: false | ||
body: '<?xml version="1.0" encoding="UTF-8"?> | ||
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" | ||
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><soapenv:Body><xrsi:pay-status-inquiry-reply | ||
xmlns:xrsi="http://www.westernunion.com/schema/xrsi"><payment_transactions><payment_transaction><sender><name | ||
name_type="C"><business_name>UNICEF</business_name></name></sender><receiver><name | ||
name_type="D"><first_name>CONTE</first_name><last_name>ALBERTO</last_name></name></receiver><financials><originators_principal_amount>100000</originators_principal_amount></financials><payment_details><originating_country_currency><iso_code><country_code>SD</country_code><currency_code>SDG</currency_code></iso_code></originating_country_currency></payment_details><filing_date>12/18/24 | ||
</filing_date><filing_time>04:41:18</filing_time><money_transfer_key>1048645159</money_transfer_key><pay_status_description>PAID</pay_status_description></payment_transaction></payment_transactions><foreign_remote_system><identifier>IDENTIFIER</identifier><reference_no>REFNO</reference_no><counter_id>COUNTER</counter_id></foreign_remote_system><number_matches>1</number_matches><current_page_number>1</current_page_number><last_page_number>1</last_page_number></xrsi:pay-status-inquiry-reply></soapenv:Body></soapenv:Envelope>' | ||
content_type: text/plain | ||
headers: | ||
Content-Security-Policy: 'frame-ancestors *;script-src ''self'' ''unsafe-inline'' | ||
''unsafe-eval'' ; style-src ''self'' ''unsafe-inline'' ; img-src ''self'' | ||
data: ; connect-src ''self'' wss:;' | ||
Transfer-Encoding: chunked | ||
X-Backside-Transport: OK OK | ||
X-Content-Type-Options: nosniff | ||
X-Frame-Options: SAMEORIGIN | ||
X-Global-Transaction-ID: 4bc148eb6762b637012641b4 | ||
X-XSS-Protection: 1; mode=block | ||
method: POST | ||
status: 200 | ||
url: https://wugateway2pi.westernunion.com/PayStatus_Service_H2H |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import responses | ||
from constance.test import override_config | ||
from factories import PaymentRecordFactory | ||
|
||
from hope_payment_gateway.apps.fsp.western_union.api.client import WesternUnionClient | ||
from hope_payment_gateway.apps.gateway.models import PaymentRecordState | ||
|
||
|
||
# @_recorder.record(file_path="tests/western_union/endpoints/status.yaml") | ||
@responses.activate | ||
@override_config(WESTERN_UNION_VENDOR_NUMBER="12345") | ||
def test_status(django_app, admin_user, wu): | ||
responses.patch("https://wugateway2pi.westernunion.com/Search_Service_H2H") | ||
responses._add_from_file(file_path="tests/western_union/endpoints/status.yaml") | ||
ref_no, mtcn, frm = ( | ||
"Y3snz233UkGt1Gw4", | ||
"8560724095", | ||
{ | ||
"identifier": "IDENTIFIER", | ||
"reference_no": "REFNO", | ||
"counter_id": "COUNTER", | ||
}, | ||
) | ||
pr = PaymentRecordFactory( | ||
fsp_code=mtcn, | ||
record_code=ref_no, | ||
extra_data={ | ||
"mtcn": mtcn, | ||
"foreign_remote_system": frm, | ||
"channel": {"type": "H2H", "name": "TEST", "version": "9500"}, | ||
}, | ||
parent__fsp=wu, | ||
status=PaymentRecordState.TRANSFERRED_TO_FSP, | ||
) | ||
resp = WesternUnionClient().query_status(pr.fsp_code, True) | ||
pr.refresh_from_db() | ||
assert pr.status == PaymentRecordState.TRANSFERRED_TO_BENEFICIARY | ||
assert (resp["title"], resp["code"]) == ("PayStatus", 200) |