|
| 1 | +try: |
| 2 | + from urllib.parse import quote_plus |
| 3 | +except ImportError: |
| 4 | + from urllib import quote_plus |
| 5 | + |
| 6 | +import processout |
| 7 | + |
| 8 | +from processout.networking.request import Request |
| 9 | +from processout.networking.response import Response |
| 10 | + |
| 11 | +# The content of this file was automatically generated |
| 12 | + |
| 13 | +class CardInformation(object): |
| 14 | + def __init__(self, client, prefill = None): |
| 15 | + self._client = client |
| 16 | + |
| 17 | + self._iin = None |
| 18 | + self._scheme = None |
| 19 | + self._type = None |
| 20 | + self._bank_name = None |
| 21 | + self._brand = None |
| 22 | + self._country = None |
| 23 | + if prefill != None: |
| 24 | + self.fill_with_data(prefill) |
| 25 | + |
| 26 | + |
| 27 | + @property |
| 28 | + def iin(self): |
| 29 | + """Get iin""" |
| 30 | + return self._iin |
| 31 | + |
| 32 | + @iin.setter |
| 33 | + def iin(self, val): |
| 34 | + """Set iin |
| 35 | + Keyword argument: |
| 36 | + val -- New iin value""" |
| 37 | + self._iin = val |
| 38 | + return self |
| 39 | + |
| 40 | + @property |
| 41 | + def scheme(self): |
| 42 | + """Get scheme""" |
| 43 | + return self._scheme |
| 44 | + |
| 45 | + @scheme.setter |
| 46 | + def scheme(self, val): |
| 47 | + """Set scheme |
| 48 | + Keyword argument: |
| 49 | + val -- New scheme value""" |
| 50 | + self._scheme = val |
| 51 | + return self |
| 52 | + |
| 53 | + @property |
| 54 | + def type(self): |
| 55 | + """Get type""" |
| 56 | + return self._type |
| 57 | + |
| 58 | + @type.setter |
| 59 | + def type(self, val): |
| 60 | + """Set type |
| 61 | + Keyword argument: |
| 62 | + val -- New type value""" |
| 63 | + self._type = val |
| 64 | + return self |
| 65 | + |
| 66 | + @property |
| 67 | + def bank_name(self): |
| 68 | + """Get bank_name""" |
| 69 | + return self._bank_name |
| 70 | + |
| 71 | + @bank_name.setter |
| 72 | + def bank_name(self, val): |
| 73 | + """Set bank_name |
| 74 | + Keyword argument: |
| 75 | + val -- New bank_name value""" |
| 76 | + self._bank_name = val |
| 77 | + return self |
| 78 | + |
| 79 | + @property |
| 80 | + def brand(self): |
| 81 | + """Get brand""" |
| 82 | + return self._brand |
| 83 | + |
| 84 | + @brand.setter |
| 85 | + def brand(self, val): |
| 86 | + """Set brand |
| 87 | + Keyword argument: |
| 88 | + val -- New brand value""" |
| 89 | + self._brand = val |
| 90 | + return self |
| 91 | + |
| 92 | + @property |
| 93 | + def country(self): |
| 94 | + """Get country""" |
| 95 | + return self._country |
| 96 | + |
| 97 | + @country.setter |
| 98 | + def country(self, val): |
| 99 | + """Set country |
| 100 | + Keyword argument: |
| 101 | + val -- New country value""" |
| 102 | + self._country = val |
| 103 | + return self |
| 104 | + |
| 105 | + |
| 106 | + def fill_with_data(self, data): |
| 107 | + """Fill the current object with the new values pulled from data |
| 108 | + Keyword argument: |
| 109 | + data -- The data from which to pull the new values""" |
| 110 | + if "iin" in data.keys(): |
| 111 | + self.iin = data["iin"] |
| 112 | + if "scheme" in data.keys(): |
| 113 | + self.scheme = data["scheme"] |
| 114 | + if "type" in data.keys(): |
| 115 | + self.type = data["type"] |
| 116 | + if "bank_name" in data.keys(): |
| 117 | + self.bank_name = data["bank_name"] |
| 118 | + if "brand" in data.keys(): |
| 119 | + self.brand = data["brand"] |
| 120 | + if "country" in data.keys(): |
| 121 | + self.country = data["country"] |
| 122 | + |
| 123 | + return self |
| 124 | + |
| 125 | + def fetch(self, iin, options = {}): |
| 126 | + """Fetch card information from the IIN. |
| 127 | + Keyword argument: |
| 128 | + iin -- IIN of the card (first 6 digits) |
| 129 | + options -- Options for the request""" |
| 130 | + self.fill_with_data(options) |
| 131 | + |
| 132 | + request = Request(self._client) |
| 133 | + path = "/iins/" + quote_plus(iin) + "" |
| 134 | + data = { |
| 135 | + |
| 136 | + } |
| 137 | + |
| 138 | + response = Response(request.get(path, data, options)) |
| 139 | + return_values = [] |
| 140 | + |
| 141 | + body = response.body |
| 142 | + body = body["coupon"] |
| 143 | + |
| 144 | + |
| 145 | + obj = processout.CardInformation(self._client) |
| 146 | + return_values.append(obj.fill_with_data(body)) |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | + return return_values[0] |
| 151 | + |
| 152 | + |
0 commit comments