import requests


def PaymentGateway(deposit_id=None, amount=None, order_id=None):
    data = {
        "amount": amount,
        "orderId": order_id,
        "additionalData": deposit_id,

    }
    req = requests.post(
        url='https://ravandno.ir/cumulative-dynamic-pay-request/',
        data=data,
        verify=False
    )
    if req.status_code == 200:
        return {req.status_code: req.json()['refId']}
    else:
        return {req.status_code: req.json()['error']}

    # result = req.json()['refId'] if req.status_code == 200 else 'error'
    # return result
    # return {req.status_code: req.content}


# def PaymentGatewayZarinPal(amount=None, description=None, province_code=None, wages=None, link=None):
#     data = {
#         "amount": amount,
#         "description": description,
#         "provincecode": province_code,
#         "wages": wages,
#         "isLink": link
#     }
#
#     headers = {
#         'Content-Type': 'application/json'
#     }
#
#     req = requests.post(
#         url='https://pay.rasadyaar.ir/zarinpay',
#         json=data,
#         headers=headers,
#         verify=False
#     )
#     if req.status_code == 201:
#         return {req.status_code: req.json()['authority']}
#
#     else:
#         return {req.status_code: req.json()['error']}


def PaymentGatewayZarinPal(amount=None, phone=None, province_code=None,  link=None,wages=None):
    data = {
        "amount": amount,
        "phone": phone,
        "provincecode": province_code,
        "isLink": link,
        "wages": wages
    }

    headers = {
        'Content-Type': 'application/json'
    }

    req = requests.post(
        url='https://pay.rasadyar.net/sep-pay-request/',
        json=data,
        headers=headers,
        verify=False
    )
    if req.status_code == 201:
        return {req.status_code: req.json()['token']}

    else:
        return {req.status_code: req.json()['error']}