# Path: payway/merchants/models.py
# class Merchant(RandomUIDAbstractModel):
# 
#     URL_METHODS = Choices(
#         ('POST', 'POST'),
#         ('GET',  'GET'),
#     )
# 
#     user = models.ForeignKey(User, related_name='merchants', verbose_name=_('user'))
#     name = models.CharField('Имя', max_length=255)
#     secret_key = models.CharField(_('secret key'), max_length=50)
# 
#     result_url = models.URLField(_('result url'))
#     result_url_method = models.CharField(_('result url method'), max_length=4, choices=URL_METHODS)
# 
#     success_url = models.URLField(_('success url'))
#     fail_url = models.URLField(_('fail url'))
# 
#     class Meta:
#         verbose_name = 'продавец'
#         verbose_name_plural = 'продавцы'
#         db_table = 'payway_merchants'


import logging
from model_utils import Choices
from simptools.wrappers.http import HttpClient, HttpRequest
from requests.exceptions import ConnectionError
from payway.merchants.models import Merchant
# -*- coding: UTF-8 -*-

__author__ = 'Razzhivin Alexander'
__email__ = 'admin@httpbots.com'

RESPONSE_STATUS = Choices(
    ('OK', 'OK'),
)

class MerchantHttpRequest(HttpRequest):

    def __init__(self, merchant, order):
        self.merchant = merchant
        self.order = order


# Path: payway/merchants/models.py
# class Merchant(RandomUIDAbstractModel):
# 
#     URL_METHODS = Choices(
#         ('POST', 'POST'),
#         ('GET',  'GET'),
#     )
# 
#     user = models.ForeignKey(User, related_name='merchants', verbose_name=_('user'))
#     name = models.CharField('Имя', max_length=255)
#     secret_key = models.CharField(_('secret key'), max_length=50)
# 
#     result_url = models.URLField(_('result url'))
#     result_url_method = models.CharField(_('result url method'), max_length=4, choices=URL_METHODS)
# 
#     success_url = models.URLField(_('success url'))
#     fail_url = models.URLField(_('fail url'))
# 
#     class Meta:
#         verbose_name = 'продавец'
#         verbose_name_plural = 'продавцы'
#         db_table = 'payway_merchants'


# Path: payway/merchants/http.py
import logging
from model_utils import Choices
from simptools.wrappers.http import HttpClient, HttpRequest
from requests.exceptions import ConnectionError
from payway.merchants.models import Merchant

# -*- coding: UTF-8 -*-

__author__ = 'Razzhivin Alexander'
__email__ = 'admin@httpbots.com'

RESPONSE_STATUS = Choices(
    ('OK', 'OK'),
)

class MerchantHttpRequest(HttpRequest):

    def __init__(self, merchant, order):
        self.merchant = merchant
        self.order = order


        if self.merchant.result_url_method == Merchant.URL_METHODS.GET: