From b7683d27dfe8e0826b9bbc5b314f29799bf84f1d Mon Sep 17 00:00:00 2001 From: Musikhin Andrey Date: Thu, 8 Mar 2018 19:55:29 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BB=D0=BE=D0=BA=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cloudpayments/client.py | 9 +++++++-- cloudpayments/enums.py | 10 ++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/cloudpayments/client.py b/cloudpayments/client.py index 0b3aec8..5d5df10 100644 --- a/cloudpayments/client.py +++ b/cloudpayments/client.py @@ -3,6 +3,7 @@ import requests from requests.auth import HTTPBasicAuth +from .enums import CultureName from .errors import CloudPaymentsError, PaymentError from .models import Transaction, Secure3d, Subscription, Order, Receipt from .utils import format_datetime, format_date @@ -11,13 +12,17 @@ class CloudPayments(object): URL = 'https://api.cloudpayments.ru/' - def __init__(self, public_id, api_secret): + def __init__(self, public_id, api_secret, language=CultureName.RU_RU): self.public_id = public_id self.api_secret = api_secret + self.language = language def _send_request(self, endpoint, params=None, headers=None): + params = params or {} + params.update({'CultureName': self.language}) + auth = HTTPBasicAuth(self.public_id, self.api_secret) - response = requests.post(self.URL + endpoint, json=params, auth=auth, + response = requests.post(self.URL + endpoint, json=params, auth=auth, headers=headers) return response.json(parse_float=decimal.Decimal) diff --git a/cloudpayments/enums.py b/cloudpayments/enums.py index c634e95..4319364 100644 --- a/cloudpayments/enums.py +++ b/cloudpayments/enums.py @@ -141,6 +141,16 @@ class CultureInfo(object): EN_US = 'en-US' +class CultureName(object): + RU_RU = 'ru-RU' + EN_US = 'en-US' + LV = 'lv' + AZ = 'az' + KK = 'kk' + UK = 'uk' + PL = 'pl' + + class ReceiptType(object): INCOME = 'Income' INCOME_RETURN = 'IncomeReturn'