コード例 #1
0
ファイル: app.py プロジェクト: shabanovanton/vipps-developers
def remove_consent(user_id):
    """
    This function does nothing, as this examples stores no permanent user information. A cookie delete could be done.
    For a complete implementation, this function needs to remove stored user details, as per the GDPR guidelines.

    :param user_id: ID for a Vipps user.
    :return: Nothing
    """
    log_callback(__name__ + ".remove_consent", path_var=user_id)
    return ""
コード例 #2
0
ファイル: app.py プロジェクト: shabanovanton/vipps-developers
def callback_route(order_id):
    """
    Endpoint for Vipps to provide transaction updates.

    :param order_id: The ID for the order there is updated information about.
    :return: Vipps requires no return for callback.
    """
    callback_msg = request.get_json()
    log_callback(__name__ + ".callback_route",
                 callback_msg=callback_msg,
                 path_var=order_id)
    return ""
コード例 #3
0
def callback_route(order_id):
    """
    Endpoint for Vipps to provide transaction updates.

    :param order_id: The ID for the order there is updated information about.
    :return: Vipps requires no return for callback.
    """
    callback_msg = request.get_json()
    log_callback(__name__ + ".callback_route", callback_msg=callback_msg, path_var=order_id)
    if callback_msg["transactionInfo"]["status"] == "RESERVE":
        access_token = token_request()["access_token"]
        capture_payment(order_id, access_token)
    return ""
コード例 #4
0
def provide_shipping_details(order_id):
    """
    Provides the shipping details for the specified order.

    This will return dummy data, as the application does not care for shipping information.

    :param order_id: ID for the order.
    :return: The required shipping details. Does not return this in example.
    """
    callback_msg = request.get_json()
    shipping_details_response = get_shipping_details_response(order_id, int(callback_msg["addressId"]))
    log_callback(__name__ + ".provide_shipping_details", callback_msg=callback_msg,
                 return_msg=shipping_details_response, path_var=order_id)
    return jsonify(shipping_details_response)