1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 from urllib2 import Request, urlopen, quote, URLError, HTTPError
31 import sys
32 import base64
33 import json
34 import hmac
35 import hashlib
36 import time
37 import random
38
39
40 from simplify.constants import Constants
41 from simplify.domain import DomainFactory, Domain
42
43
44
45
46
47 HTTP_SUCCESS = 200
48 HTTP_REDIRECTED = 302
49 HTTP_UNAUTHORIZED = 401
50 HTTP_NOT_FOUND = 404
51 HTTP_NOT_ALLOWED = 405
52 HTTP_BAD_REQUEST = 400
53
54 HTTP_METHOD_POST = "POST"
55 HTTP_METHOD_PUT = "PUT"
56 HTTP_METHOD_GET = "GET"
57 HTTP_METHOD_DELETE = "DELETE"
58
59
60
61
62
63
64
65 public_key = None
66 private_key = None
67 api_base_sandbox_url = Constants.api_base_sandbox_url
68 api_base_live_url = Constants.api_base_live_url
69 oauth_base_url = Constants.oauth_base_url
70 user_agent = None
78
79 if criteria == None:
80 return ''
81
82 query_string = []
83 if 'max' in criteria:
84 query_string.append("max=" + str(criteria['max']))
85
86 if 'offset' in criteria:
87 query_string.append("offset=" + str(criteria['offset']))
88
89 if 'sorting' in criteria:
90 for key, value in criteria['sorting'].iteritems():
91 query_string.append("sorting[" + key + "]=" + quote(str(value)))
92
93 if 'filter' in criteria:
94 for key, value in criteria['filter'].iteritems():
95 query_string.append("filter[" + key + "]=" + quote(str(value)))
96
97 return '&'.join(query_string)
98
100
101 if response_code == HTTP_REDIRECTED:
102 raise BadRequestError("Unexpected response code returned from the API, have you got the correct URL?", response_code, response_body)
103 elif response_code == HTTP_BAD_REQUEST:
104 raise BadRequestError("Bad request", response_code, response_body)
105
106 elif response_code == HTTP_UNAUTHORIZED:
107 raise AuthenticationError("You are not authorized to make this request. Are you using the correct API keys?", response_code, response_body)
108
109 elif response_code == HTTP_NOT_FOUND:
110 raise ObjectNotFoundError("Object not found", response_code, response_body)
111
112 elif response_code == HTTP_NOT_ALLOWED:
113 raise NotAllowedError("Operation not allowed", response_code, response_body)
114
115 elif response_code < 500:
116 raise BadRequestError("Bad request", response_code, response_body)
117
118 else:
119 raise SysError("An unexpected error has been raised. Looks like there's something wrong at our end." , response_code, response_body)
120
127
128 """
129 Holds authentication information used when accessing the API.
130
131 @ivar public_key: Public key used to access the API.
132 @ivar private_key: Private key used to access the API.
133 @ivar access_token: OAuth token used to access the API.
134 """
135
137 """
138 Constructs an Authentication object.
139
140 @param kwargs: contains initial values for the instance variables. Valid keywords
141 are public_key, private_key and access_token. If no value is passed for
142 public_key or its value is None then simplify.public_key is used. If no
143 value is passed for private_key or its value is None then simplify.private_key
144 is used.
145 @return: an Authentication object
146 """
147
148 self.public_key = kwargs['public_key'] if 'public_key' in kwargs else None
149 if self.public_key == None:
150 global public_key
151 self.public_key = public_key
152
153 self.private_key = kwargs['private_key'] if 'private_key' in kwargs else None
154 if self.private_key == None:
155 global private_key
156 self.private_key = private_key
157
158 self.access_token = kwargs['access_token'] if 'access_token' in kwargs else None
159
162 """
163 OAuth access token.
164
165 @ivar access_token: Access token used when making an API call authenticated using OAuth
166 @ivar refresh_token: Token used when refreshing an access token.
167 @ivar expires_in: Number of seconds from the time the token was created till it expires.
168 """
169
170 @staticmethod
171 - def create(auth_code, redirect_uri, *auth_args):
172 """
173 Creates an AccessToken object.
174
175 @param auth_codes: OAuth authentication code.
176 @param redirect_uri: URI to which OAuth requests are redirected.
177 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
178 @return: an AccessToken object object
179 """
180
181 props = {
182 'grant_type' : 'authorization_code',
183 'code' : auth_code,
184 'redirect_uri' : redirect_uri
185 }
186
187 h = PaymentsApi().send_auth_request(props, 'token', PaymentsApi.create_auth_object(auth_args))
188 return AccessToken(h)
189
190
192 """
193 Refreshes an AccessToken object. If successful the access_token, refresh_token and expires_in attributes are updated.
194
195 @param auth_args: an Authentication object used for the API call. If no value is passed the global keys simplify.public_key and simplify.private_key are used.
196 """
197
198 rt = self['refresh_token']
199 if not rt:
200 raise IllegalArgumentError("Cannot refresh access token; refresh token is invalid.")
201
202 props = {
203 'grant_type' : 'refresh_token',
204 'refresh_token' : rt
205 }
206
207 h = PaymentsApi().send_auth_request(props, 'token', PaymentsApi.create_auth_object(auth_args))
208 self.__dict__.update(h)
209
210
211 - def revoke(self, *auth_args):
212 """
213 Revokes an AccessToken object.
214
215 @param auth_args: an Authentication object used for the API call. If no value is passed the global keys simplify.public_key and simplify.private_key are used.
216 """
217
218 token = self['access_token']
219 if not token:
220 raise IllegalArgumentError("Cannot revoke access token; access token is invalid.")
221
222 props = {
223 'token' : token,
224 'refresh_token' : token
225 }
226
227 h = PaymentsApi().send_auth_request(props, 'revoke', PaymentsApi.create_auth_object(auth_args))
228 self.__dict__.clear()
229
230
231
232
233
234
235
236 -class ApiError(Exception):
237 """
238 Base class for all API errors.
239
240 @ivar status: HTTP status code (or None if there is no status).
241 @ivar reference: reference for the error (or None if there is no reference).
242 @ivar error_code: string code for the error (or None if there is no error code).
243 @ivar message: string description of the error (or None if there is no message).
244 @ivar error_data: dictionary containing all the error data (or None if there is no data)
245 """
246
247 - def __init__(self, message=None, status=500, error_data=None):
248 self.status = status
249
250 self.error_data = json.loads(error_data) if error_data else {}
251 err = self.error_data['error'] if 'error' in self.error_data else {}
252
253 self.reference = self.error_data['reference'] if 'reference' in self.error_data else None
254 self.error_code = err['code'] if 'code' in err else None
255 self.message = err['message'] if 'code' in err else message
256 super(ApiError, self).__init__(self.message)
257
258
260 """
261 Returns a string describing the error.
262 @return: a string describing the error.
263 """
264 return "{0}: \"{1}\" (status: {2}, error code: {3}, reference: {4})".format(self.__class__.__name__, self.message, self.status, self.error_code, self.reference)
265
268 """
269 Error raised when passing illegal arguments.
270 """
271 pass
272
274 """
275 Error raised when there are communication errors contacting the API.
276 """
277 pass
278
280 """
281 Error raised where there are problems authentication a request.
282 """
283 pass
284
286
287 """
288 Error raised when the request contains errors.
289
290 @ivar has_field_errors: boolean indicating whether there are field errors.
291 @ivar field_errors: a list containing all field errors.
292 """
293
295 """
296 Represents a single error in a field of data sent in a request to the API.
297
298 @ivar field_name: the name of the field with the error.
299 @ivar error_code: a string code for the error.
300 @ivar message: a string description of the error.
301 """
303 self.field_name = error_data['field']
304 self.error_code = error_data['code']
305 self.message = error_data['message']
306
308 return "Field error: {0} \"{1}\" ({2})".format(self.field_name, self.message, self.error_code)
309
310
311 - def __init__(self, message, status = 400, error_data = None):
312 super(BadRequestError, self).__init__(message, status, error_data)
313
314 self.field_errors = []
315 err = self.error_data['error'] if 'error' in self.error_data else {}
316 field_errors = err['fieldErrors'] if 'fieldErrors' in err else []
317 for field_error in field_errors:
318 self.field_errors.append(BadRequestError.FieldError(field_error))
319 self.has_field_errors = len(self.field_errors) > 0
320
322 """
323 Returns a string describing the error.
324 @return: a string describing the error.
325 """
326 txt = ApiError.describe(self)
327 for field_error in self.field_errors:
328 txt = txt + "\n" + str(field_error)
329 return txt + "\n"
330
332 """
333 Error raised when a requested object cannot be found.
334 """
335 pass
336
338 """
339 Error raised when a request was not allowed.
340 """
341 pass
342
344 """
345 Error raised when there was a system error processing a request.
346 """
347 pass
348
349
350
351
352
353
354 -class Http:
357
358 - def request(self, auth, url, method, params = None):
359
360 if params is None:
361 params = {}
362
363 jws_signature = Jws.encode(url, auth, params, method == HTTP_METHOD_POST or method == HTTP_METHOD_PUT)
364
365 if method == HTTP_METHOD_POST:
366 request = Request(url, jws_signature)
367 request.add_header("Content-Type", "application/json")
368
369 elif method == HTTP_METHOD_PUT:
370 request = Request(url, jws_signature)
371 request.add_header("Content-Type", "application/json")
372
373 elif method == HTTP_METHOD_DELETE:
374 request = Request(url)
375 request.add_header("Authorization", "JWS " + jws_signature)
376 request.get_method = lambda: HTTP_METHOD_DELETE
377
378 elif method == HTTP_METHOD_GET:
379 request = Request(url)
380 request.add_header("Authorization", "JWS " + jws_signature)
381
382 else:
383 raise ApiConnectionError("HTTP Method {0} not recognised".format(method))
384
385 request.add_header("Accept", "application/json")
386 global user_agent
387
388 user_agent_hdr = "Python-SDK/" + Constants.version
389 if user_agent != None:
390 user_agent_hdr = user_agent_hdr + " " + user_agent
391 request.add_header("User-Agent", user_agent_hdr)
392
393 try:
394 response = urlopen(request)
395 response_body = response.read()
396 response_code = response.code
397 except HTTPError as err:
398 response_body = err.read()
399 response_code = err.code
400 except URLError as err:
401 msg = "Looks like there's a problem connecting to the API endpoint: {0}\nError: {1}".format(url, str(err))
402 raise ApiConnectionError(msg)
403
404 return response_body, response_code
405
406
408
409 jws_signature = Jws.auth_encode(url, auth, params)
410
411 request = Request(url, jws_signature)
412 request.add_header("Content-Type", "application/json")
413 request.add_header("Accept", "application/json")
414
415 global user_agent
416 user_agent_hdr = "Python-SDK/" + Constants.version
417 if user_agent != None:
418 user_agent_hdr = user_agent_hdr + " " + user_agent
419 request.add_header("User-Agent", user_agent_hdr)
420
421 try:
422 response = urlopen(request)
423 response_body = response.read()
424 response_code = response.code
425 except HTTPError as err:
426 response_body = err.read()
427 response_code = err.code
428 except URLError as err:
429 msg = "Looks like there's a problem connecting to the API endpoint: {0}\nError: {1}".format(url, str(err))
430 raise ApiConnectionError(msg)
431
432 return response_body, response_code
433
434
435
436
437
438
439 -class Jws:
440
441 NUM_HEADERS = 7
442 ALGORITHM = 'HS256'
443 TYPE = 'JWS'
444 HDR_URI = 'api.simplifycommerce.com/uri'
445 HDR_TIMESTAMP = 'api.simplifycommerce.com/timestamp'
446 HDR_NONCE = 'api.simplifycommerce.com/nonce'
447 HDR_TOKEN = "api.simplifycommerce.com/token";
448 HDR_UNAME = 'uname'
449 HDR_ALGORITHM = 'alg'
450 HDR_TYPE = 'typ'
451 HDR_KEY_ID = 'kid'
452 TIMESTAMP_MAX_DIFF = 1000 * 60 * 5
453
456
457 @staticmethod
458 - def encode(url, auth, params, has_payload):
459
460 jws_hdr = {'typ': Jws.TYPE,
461 'alg': Jws.ALGORITHM,
462 'kid': auth.public_key,
463 Jws.HDR_URI: url,
464 Jws.HDR_TIMESTAMP: int(round(time.time() * 1000)),
465 Jws.HDR_NONCE: str(random.randint(1, 10*1000))}
466
467 token = auth.access_token
468 if token:
469 jws_hdr[Jws.HDR_TOKEN] = token
470
471 header = base64.urlsafe_b64encode(Jws().encode_json(jws_hdr)).replace('=', '')
472 payload = ''
473 if has_payload:
474 payload = Jws().encode_json(params)
475 payload = base64.urlsafe_b64encode(payload).replace('=', '')
476
477 msg = header + "." + payload
478 signature = Jws().sign(auth.private_key, msg)
479 return msg + "." + signature
480
481
482 @staticmethod
484
485 jws_hdr = {'typ': Jws.TYPE,
486 'alg': Jws.ALGORITHM,
487 'kid': auth.public_key,
488 Jws.HDR_URI: url,
489 Jws.HDR_TIMESTAMP: int(round(time.time() * 1000)),
490 Jws.HDR_NONCE: str(random.randint(1, 10*1000))}
491
492 header = base64.urlsafe_b64encode(Jws().encode_json(jws_hdr)).replace('=', '')
493
494
495 payload = '&'.join([ "%s=%s" % (k,v) for k,v in params.iteritems()])
496 payload = base64.urlsafe_b64encode(payload).replace('=', '')
497
498 msg = header + "." + payload
499 signature = Jws().sign(auth.private_key, msg)
500 return msg + "." + signature
501
502
503 @staticmethod
540
541 - def sign(self, private_api_key, msg):
542 decoded_private_api_key = Jws().safe_base64_decode(private_api_key)
543 signature = hmac.new(decoded_private_api_key, msg, hashlib.sha256).digest()
544 return base64.urlsafe_b64encode(signature).replace('=', '')
545
546 - def verify(self, header, url, public_api_key):
594
596
597 length = len(url) % 4
598 if length == 2:
599 return base64.urlsafe_b64decode(url + "==")
600 if length == 3:
601 return base64.urlsafe_b64decode(url + "=")
602
603 return base64.urlsafe_b64decode(url)
604
606
607 try:
608 return json.dumps(json_str).encode('utf-8')
609 except Exception:
610 raise ApiError("Invalid format for JSON request")
611
618
619
622
623 @staticmethod
650
651
652 @staticmethod
663
664
665
666 @staticmethod
667 - def create(object_type, auth_args, params):
674
675 @staticmethod
676 - def list(object_type, auth_args, criteria):
686
687 @staticmethod
688 - def find(object_type, auth_args, object_id):
698
699 @staticmethod
700 - def update(object_type, auth_args, object_id, params):
710
711 @staticmethod
712 - def delete(object_type, auth_args, object_id):
722
723 - def decode(self, auth_args, params):
729
730
731 - def execute(self, object_type, auth, url_suffix, method, params = None):
765
766
768
769 PaymentsApi.check_auth(auth)
770
771 http = Http()
772
773 global oauth_base_url
774
775 url = oauth_base_url + "/" + context
776
777 response_body, response_code = http.auth_request(auth, url, props)
778
779
780 try:
781 response = json.loads(response_body)
782 except Exception:
783 raise SysError("Invalid response format returned. Have you got the correct URL {0} \n HTTP Status: {1}".format(url, response_code))
784
785 if response_code == HTTP_SUCCESS:
786 return response
787 elif response_code == HTTP_REDIRECTED:
788 raise BadRequestError("", response_code)
789 elif response_code >= HTTP_BAD_REQUEST:
790 error_code = response['error']
791 error_desc = response['error_description']
792 if error_code == 'invalid_request':
793 raise BadRequestError("", response_code, self.get_oauth_error("Error during OAuth request", error_code, error_desc))
794 elif error_code == 'access_denied':
795 raise AuthenticationError("", response_code, self.get_oauth_error("Access denied for OAuth request", error_code, error_desc))
796 elif error_code == 'invalid_client':
797 raise AuthenticationError("", response_code, self.get_oauth_error("Invalid client ID in OAuth request", error_code, error_desc))
798 elif error_code == 'unauthorized_client':
799 raise AuthenticationError("", response_code, self.get_oauth_error("Unauthorized client in OAuth request", error_code, error_desc))
800 elif error_code == 'unsupported_grant_type':
801 raise BadRequestError("", response_code, self.get_oauth_error("Unsupported grant type in OAuth request", error_code, error_desc))
802 elif error_code == 'invalid_scope':
803 raise BadRequestError("", response_code, self.get_oauth_error("Invalid scope in OAuth request", error_code, error_desc))
804 else:
805 raise BadRequestError("", e.response_code, self.get_oauth_error("Unknown OAuth error", error_code, error_desc))
806 end
807 elif response_code < 500:
808 raise BadRequestError("Bad request", response_code, {})
809 else:
810 raise SysError("Bad request", response_code, {})
811
812
814 return """{"error" : {"code" : "oauth_error", "message" : "%s, error code '%s', description '%s'" }}""" % (msg, error_code, error_desc)
815
816
817 @classmethod
819
820 url = object_type
821 if object_id:
822 url = "{0}/{1}".format(url, object_id)
823
824 return url
825
826
827
828
829
830
831
832
833 -class Event(Domain):
834
835 """
836 A Event object.
837 """
838
839 @staticmethod
840 - def create(params, *auth_args):
841
842 """
843 Create an Event object.
844 @param params: a dict of parameters; valid keys are:
845 - C{payload}: The raw JWS message payload. B{required}
846 - C{url}: The URL for the webhook. If present it must match the URL registered for the webhook.
847 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
848 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
849 @return: an Event object
850 """
851
852 obj = PaymentsApi().decode(auth_args, params)
853
854 if not 'event' in obj:
855 raise ApiError("Incorrect data in webhook event")
856
857 return DomainFactory.factory('event', obj['event'])
858
860 """
861 A Authorization object.
862 """
863
864
865 @staticmethod
866 - def create(params, *auth_args):
867 """
868 Creates an Authorization object
869 @param params: a dict of parameters; valid keys are:
870 - C{amount}: Amount of the payment (in the smallest unit of your currency). Example: 100 = $1.00USD B{required }
871 - C{card => addressCity}: City of the cardholder. [max length: 50, min length: 2]
872 - C{card => addressCountry}: Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. [max length: 2, min length: 2]
873 - C{card => addressLine1}: Address of the cardholder. [max length: 255]
874 - C{card => addressLine2}: Address of the cardholder if needed. [max length: 255]
875 - C{card => addressState}: State of residence of the cardholder. For the US, this is a 2-digit USPS code. [max length: 255]
876 - C{card => addressZip}: Postal code of the cardholder. The postal code size is between 5 and 9 characters in length and only contains numbers or letters. [max length: 9, min length: 3]
877 - C{card => cvc}: CVC security code of the card. This is the code on the back of the card. Example: 123
878 - C{card => expMonth}: Expiration month of the card. Format is MM. Example: January = 01 [min value: 1, max value: 12] B{required }
879 - C{card => expYear}: Expiration year of the card. Format is YY. Example: 2013 = 13 [min value: 0, max value: 99] B{required }
880 - C{card => name}: Name as it appears on the card. [max length: 50, min length: 2]
881 - C{card => number}: Card number as it appears on the card. [max length: 19, min length: 13] B{required }
882 - C{currency}: Currency code (ISO-4217) for the transaction. Must match the currency associated with your account. [default: USD] B{required }
883 - C{customer}: ID of customer. If specified, card on file of customer will be used.
884 - C{description}: Free form text field to be used as a description of the payment. This field is echoed back with the payment on any find or list operations. [max length: 1024]
885 - C{order => commodityCode}: Standard classification code for products and services. [max length: 5]
886 - C{order => customer}: ID of the customer associated with the order.
887 - C{order => customerEmail}: Customer email address.
888 - C{order => customerName}: Customer name.
889 - C{order => customerNote}: Additional notes provided by the customer. [max length: 255]
890 - C{order => customerReference}: A merchant reference for the customer.
891 - C{order => items => amount}: Cost of the item.
892 - C{order => items => description}: Description of the item.
893 - C{order => items => name}: Item name.
894 - C{order => items => product}: Product information associated with the item.
895 - C{order => items => quantity}: Quantity of the item contained in the order [min value: 1, max value: 999999, default: 1] B{required }
896 - C{order => items => reference}: A merchant reference for the item. [max length: 255]
897 - C{order => items => tax}: Taxes associated with the item.
898 - C{order => merchantNote}: Additional notes provided by the merchant. [max length: 255]
899 - C{order => payment}: ID of the payment associated with the order.
900 - C{order => reference}: A merchant reference for the order. [max length: 255]
901 - C{order => shippingAddress => city}: City, town, or municipality. [max length: 255, min length: 2]
902 - C{order => shippingAddress => country}: 2-character country code. [max length: 2, min length: 2]
903 - C{order => shippingAddress => line1}: Street address. [max length: 255]
904 - C{order => shippingAddress => line2}: (Opt) Street address continued. [max length: 255]
905 - C{order => shippingAddress => name}: Name of the entity being shipped to. [max length: 255]
906 - C{order => shippingAddress => state}: State or province. [max length: 255]
907 - C{order => shippingAddress => zip}: Postal code. [max length: 32]
908 - C{order => shippingFromAddress => city}: City, town, or municipality. [max length: 255, min length: 2]
909 - C{order => shippingFromAddress => country}: 2-character country code. [max length: 2, min length: 2]
910 - C{order => shippingFromAddress => line1}: Street address. [max length: 255]
911 - C{order => shippingFromAddress => line2}: (Opt) Street address continued. [max length: 255]
912 - C{order => shippingFromAddress => name}: Name of the entity performing the shipping. [max length: 255]
913 - C{order => shippingFromAddress => state}: State or province. [max length: 255]
914 - C{order => shippingFromAddress => zip}: Postal code. [max length: 32]
915 - C{order => shippingName}: Name of the entity being shipped to.
916 - C{order => source}: Order source. [default: WEB] B{required }
917 - C{order => status}: Status of the order. [default: INCOMPLETE] B{required }
918 - C{reference}: Custom reference field to be used with outside systems.
919 - C{replayId}: An identifier that can be sent to uniquely identify a payment request to facilitate retries due to I/O related issues. This identifier must be unique for your account (sandbox or live) across all of your payments. If supplied, we will check for a payment on your account that matches this identifier, and if one is found we will attempt to return an identical response of the original request. [max length: 50, min length: 1]
920 - C{statementDescription => name}: Merchant name B{required }
921 - C{statementDescription => phoneNumber}: Merchant contact phone number.
922 - C{token}: If specified, card associated with card token will be used. [max length: 255]
923 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
924 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
925 @param private_api_key: Private key to use for the API call. If C{None}, the value of C{simplify.private_key} will be used.
926 @return: a Authorization object
927 """
928 return PaymentsApi.create("authorization", auth_args, params)
929
930 - def delete(self, *auth_args):
931 """
932 Delete this object
933 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
934 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
935 """
936 return PaymentsApi.delete("authorization", auth_args, self.object_id)
937
938 @staticmethod
939 - def list(criteria = None, *auth_args):
940 """
941 Retrieve Authorization objects.
942 @param criteria: a dict of parameters; valid keys are:
943 - C{filter} Filters to apply to the list.
944 - C{max} Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20]
945 - C{offset} Used in pagination of the list. This is the start offset of the page. [min value: 0, default: 0]
946 - C{sorting} Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either C{asc} for ascending or C{desc} for descending). Sortable properties are: C{dateCreated} C{amount} C{id} C{description} C{paymentDate}.
947 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
948 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
949 @return: an object which contains the list of Authorization objects in the <code>list</code> property and the total number
950 of objects available for the given criteria in the <code>total</code> property.
951 """
952 return PaymentsApi.list("authorization", auth_args, criteria)
953
954 @staticmethod
955 - def find(object_id, *auth_args):
956 """
957 Retrieve a Authorization object from the API
958 @param object_id: ID of object to retrieve
959 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
960 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
961 @return: a Authorization object
962 """
963 return PaymentsApi.find("authorization", auth_args, object_id)
964
966 """
967 A CardToken object.
968 """
969
970
971 @staticmethod
972 - def create(params, *auth_args):
973 """
974 Creates an CardToken object
975 @param params: a dict of parameters; valid keys are:
976 - C{callback}: The URL callback for the cardtoken
977 - C{card => addressCity}: City of the cardholder. [max length: 50, min length: 2]
978 - C{card => addressCountry}: Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. [max length: 2, min length: 2]
979 - C{card => addressLine1}: Address of the cardholder. [max length: 255]
980 - C{card => addressLine2}: Address of the cardholder if needed. [max length: 255]
981 - C{card => addressState}: State of residence of the cardholder. For the US, this is a 2-digit USPS code. [max length: 255]
982 - C{card => addressZip}: Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters. [max length: 9, min length: 3]
983 - C{card => cvc}: CVC security code of the card. This is the code on the back of the card. Example: 123
984 - C{card => expMonth}: Expiration month of the card. Format is MM. Example: January = 01 [min value: 1, max value: 12] B{required }
985 - C{card => expYear}: Expiration year of the card. Format is YY. Example: 2013 = 13 [min value: 0, max value: 99] B{required }
986 - C{card => name}: Name as appears on the card. [max length: 50, min length: 2]
987 - C{card => number}: Card number as it appears on the card. [max length: 19, min length: 13] B{required }
988 - C{key}: Key used to create the card token.
989 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
990 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
991 @param private_api_key: Private key to use for the API call. If C{None}, the value of C{simplify.private_key} will be used.
992 @return: a CardToken object
993 """
994 return PaymentsApi.create("cardToken", auth_args, params)
995
996 @staticmethod
997 - def find(object_id, *auth_args):
998 """
999 Retrieve a CardToken object from the API
1000 @param object_id: ID of object to retrieve
1001 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1002 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1003 @return: a CardToken object
1004 """
1005 return PaymentsApi.find("cardToken", auth_args, object_id)
1006
1008 """
1009 A Chargeback object.
1010 """
1011
1012
1013 @staticmethod
1014 - def list(criteria = None, *auth_args):
1015 """
1016 Retrieve Chargeback objects.
1017 @param criteria: a dict of parameters; valid keys are:
1018 - C{filter} Filters to apply to the list.
1019 - C{max} Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20]
1020 - C{offset} Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0]
1021 - C{sorting} Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either C{asc} for ascending or C{desc} for descending). Sortable properties are: C{id} C{amount} C{description} C{dateCreated}.
1022 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1023 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1024 @return: an object which contains the list of Chargeback objects in the <code>list</code> property and the total number
1025 of objects available for the given criteria in the <code>total</code> property.
1026 """
1027 return PaymentsApi.list("chargeback", auth_args, criteria)
1028
1029 @staticmethod
1030 - def find(object_id, *auth_args):
1031 """
1032 Retrieve a Chargeback object from the API
1033 @param object_id: ID of object to retrieve
1034 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1035 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1036 @return: a Chargeback object
1037 """
1038 return PaymentsApi.find("chargeback", auth_args, object_id)
1039
1041 """
1042 A Coupon object.
1043 """
1044
1045
1046 @staticmethod
1047 - def create(params, *auth_args):
1048 """
1049 Creates an Coupon object
1050 @param params: a dict of parameters; valid keys are:
1051 - C{amountOff}: Amount off of the price of the product in the smallest units of the currency of the merchant. While this field is optional, you must provide either amountOff or percentOff for a coupon. Example: 100 = $1.00USD [min value: 1]
1052 - C{couponCode}: Code that identifies the coupon to be used. [min length: 2] B{required }
1053 - C{description}: A brief section that describes the coupon.
1054 - C{durationInMonths}: DEPRECATED - Duration in months that the coupon will be applied after it has first been selected. [min value: 1, max value: 9999]
1055 - C{endDate}: Last date of the coupon in UTC millis that the coupon can be applied to a subscription. This ends at 23:59:59 of the merchant timezone.
1056 - C{maxRedemptions}: Maximum number of redemptions allowed for the coupon. A redemption is defined as when the coupon is applied to the subscription for the first time. [min value: 1]
1057 - C{numTimesApplied}: The number of times a coupon will be applied on a customer's subscription. [min value: 1, max value: 9999]
1058 - C{percentOff}: Percentage off of the price of the product. While this field is optional, you must provide either amountOff or percentOff for a coupon. The percent off is a whole number. [min value: 1, max value: 100]
1059 - C{startDate}: First date of the coupon in UTC millis that the coupon can be applied to a subscription. This starts at midnight of the merchant timezone. B{required }
1060 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1061 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1062 @param private_api_key: Private key to use for the API call. If C{None}, the value of C{simplify.private_key} will be used.
1063 @return: a Coupon object
1064 """
1065 return PaymentsApi.create("coupon", auth_args, params)
1066
1067 - def delete(self, *auth_args):
1068 """
1069 Delete this object
1070 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1071 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1072 """
1073 return PaymentsApi.delete("coupon", auth_args, self.object_id)
1074
1075 @staticmethod
1076 - def list(criteria = None, *auth_args):
1077 """
1078 Retrieve Coupon objects.
1079 @param criteria: a dict of parameters; valid keys are:
1080 - C{filter} Filters to apply to the list.
1081 - C{max} Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20]
1082 - C{offset} Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0]
1083 - C{sorting} Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either C{asc} for ascending or C{desc} for descending). Sortable properties are: C{dateCreated} C{maxRedemptions} C{timesRedeemed} C{id} C{startDate} C{endDate} C{percentOff} C{couponCode} C{durationInMonths} C{numTimesApplied} C{amountOff}.
1084 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1085 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1086 @return: an object which contains the list of Coupon objects in the <code>list</code> property and the total number
1087 of objects available for the given criteria in the <code>total</code> property.
1088 """
1089 return PaymentsApi.list("coupon", auth_args, criteria)
1090
1091 @staticmethod
1092 - def find(object_id, *auth_args):
1093 """
1094 Retrieve a Coupon object from the API
1095 @param object_id: ID of object to retrieve
1096 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1097 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1098 @return: a Coupon object
1099 """
1100 return PaymentsApi.find("coupon", auth_args, object_id)
1101
1102 - def update(self, *auth_args):
1103 """
1104 Updates this object
1105
1106 The properties that can be updated:
1107 - C{endDate} The ending date in UTC millis for the coupon. This must be after the starting date of the coupon.
1108
1109 - C{maxRedemptions} Maximum number of redemptions allowed for the coupon. A redemption is defined as when the coupon is applied to the subscription for the first time. [min value: 1]
1110
1111 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1112 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1113 @return: a Coupon object.
1114 """
1115 return PaymentsApi.update("coupon", auth_args, self.object_id, self.to_dict())
1116
1118 """
1119 A Customer object.
1120 """
1121
1122
1123 @staticmethod
1124 - def create(params, *auth_args):
1125 """
1126 Creates an Customer object
1127 @param params: a dict of parameters; valid keys are:
1128 - C{card => addressCity}: City of the cardholder. B{required }
1129 - C{card => addressCountry}: Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. B{required }
1130 - C{card => addressLine1}: Address of the cardholder B{required }
1131 - C{card => addressLine2}: Address of the cardholder if needed. B{required }
1132 - C{card => addressState}: State of residence of the cardholder. For the US, this is a 2-digit USPS code. B{required }
1133 - C{card => addressZip}: Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters. B{required }
1134 - C{card => cvc}: CVC security code of the card. This is the code on the back of the card. Example: 123 B{required }
1135 - C{card => expMonth}: Expiration month of the card. Format is MM. Example: January = 01 B{required }
1136 - C{card => expYear}: Expiration year of the card. Format is YY. Example: 2013 = 13 B{required }
1137 - C{card => id}: ID of card. Unused during customer create.
1138 - C{card => name}: Name as appears on the card. B{required }
1139 - C{card => number}: Card number as it appears on the card. [max length: 19, min length: 13]
1140 - C{email}: Email address of the customer B{required }
1141 - C{name}: Customer name [min length: 2] B{required }
1142 - C{reference}: Reference field for external applications use.
1143 - C{subscriptions => amount}: Amount of payment in the smallest unit of your currency. Example: 100 = $1.00USD
1144 - C{subscriptions => billingCycle}: How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles). [default: AUTO]
1145 - C{subscriptions => billingCycleLimit}: The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4
1146 - C{subscriptions => coupon}: Coupon associated with the subscription for the customer.
1147 - C{subscriptions => currency}: Currency code (ISO-4217). Must match the currency associated with your account. [default: USD]
1148 - C{subscriptions => customer}: The customer ID to create the subscription for. Do not supply this when creating a customer.
1149 - C{subscriptions => frequency}: Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY".
1150 - C{subscriptions => frequencyPeriod}: Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly.
1151 - C{subscriptions => name}: Name describing subscription
1152 - C{subscriptions => plan}: The plan ID that the subscription should be created from.
1153 - C{subscriptions => quantity}: Quantity of the plan for the subscription. [min value: 1]
1154 - C{subscriptions => renewalReminderLeadDays}: If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null, then no emails are sent. Minimum value is 7 if set.
1155 - C{token}: If specified, card associated with card token will be used
1156 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1157 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1158 @param private_api_key: Private key to use for the API call. If C{None}, the value of C{simplify.private_key} will be used.
1159 @return: a Customer object
1160 """
1161 return PaymentsApi.create("customer", auth_args, params)
1162
1163 - def delete(self, *auth_args):
1164 """
1165 Delete this object
1166 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1167 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1168 """
1169 return PaymentsApi.delete("customer", auth_args, self.object_id)
1170
1171 @staticmethod
1172 - def list(criteria = None, *auth_args):
1173 """
1174 Retrieve Customer objects.
1175 @param criteria: a dict of parameters; valid keys are:
1176 - C{filter} Filters to apply to the list.
1177 - C{max} Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20]
1178 - C{offset} Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0]
1179 - C{sorting} Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either C{asc} for ascending or C{desc} for descending). Sortable properties are: C{dateCreated} C{id} C{name} C{email} C{reference}.
1180 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1181 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1182 @return: an object which contains the list of Customer objects in the <code>list</code> property and the total number
1183 of objects available for the given criteria in the <code>total</code> property.
1184 """
1185 return PaymentsApi.list("customer", auth_args, criteria)
1186
1187 @staticmethod
1188 - def find(object_id, *auth_args):
1189 """
1190 Retrieve a Customer object from the API
1191 @param object_id: ID of object to retrieve
1192 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1193 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1194 @return: a Customer object
1195 """
1196 return PaymentsApi.find("customer", auth_args, object_id)
1197
1198 - def update(self, *auth_args):
1199 """
1200 Updates this object
1201
1202 The properties that can be updated:
1203 - C{card => addressCity} City of the cardholder. B{(required)}
1204
1205 - C{card => addressCountry} Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. B{(required)}
1206
1207 - C{card => addressLine1} Address of the cardholder. B{(required)}
1208
1209 - C{card => addressLine2} Address of the cardholder if needed. B{(required)}
1210
1211 - C{card => addressState} State of residence of the cardholder. For the US, this is a 2-digit USPS code. B{(required)}
1212
1213 - C{card => addressZip} Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters. B{(required)}
1214
1215 - C{card => cvc} CVC security code of the card. This is the code on the back of the card. Example: 123 B{(required)}
1216
1217 - C{card => expMonth} Expiration month of the card. Format is MM. Example: January = 01 B{(required)}
1218
1219 - C{card => expYear} Expiration year of the card. Format is YY. Example: 2013 = 13 B{(required)}
1220
1221 - C{card => id} ID of card. If present, card details for the customer will not be updated. If not present, the customer will be updated with the supplied card details.
1222
1223 - C{card => name} Name as appears on the card. B{(required)}
1224
1225 - C{card => number} Card number as it appears on the card. [max length: 19, min length: 13]
1226
1227 - C{email} Email address of the customer B{(required)}
1228
1229 - C{name} Customer name [min length: 2] B{(required)}
1230
1231 - C{reference} Reference field for external applications use.
1232
1233 - C{token} If specified, card associated with card token will be added to the customer
1234
1235 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1236 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1237 @return: a Customer object.
1238 """
1239 return PaymentsApi.update("customer", auth_args, self.object_id, self.to_dict())
1240
1242 """
1243 A DataToken object.
1244 """
1245
1246
1247 @staticmethod
1248 - def create(params, *auth_args):
1249 """
1250 Creates an DataToken object
1251 @param params: a dict of parameters; valid keys are:
1252 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1253 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1254 @param private_api_key: Private key to use for the API call. If C{None}, the value of C{simplify.private_key} will be used.
1255 @return: a DataToken object
1256 """
1257 return PaymentsApi.create("dataToken", auth_args, params)
1258
1259 @staticmethod
1260 - def find(object_id, *auth_args):
1261 """
1262 Retrieve a DataToken object from the API
1263 @param object_id: ID of object to retrieve
1264 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1265 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1266 @return: a DataToken object
1267 """
1268 return PaymentsApi.find("dataToken", auth_args, object_id)
1269
1271 """
1272 A Deposit object.
1273 """
1274
1275
1276 @staticmethod
1277 - def list(criteria = None, *auth_args):
1278 """
1279 Retrieve Deposit objects.
1280 @param criteria: a dict of parameters; valid keys are:
1281 - C{filter} Filters to apply to the list.
1282 - C{max} Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20]
1283 - C{offset} Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0]
1284 - C{sorting} Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either C{asc} for ascending or C{desc} for descending). Sortable properties are: C{amount} C{dateCreated} C{depositDate}.
1285 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1286 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1287 @return: an object which contains the list of Deposit objects in the <code>list</code> property and the total number
1288 of objects available for the given criteria in the <code>total</code> property.
1289 """
1290 return PaymentsApi.list("deposit", auth_args, criteria)
1291
1292 @staticmethod
1293 - def find(object_id, *auth_args):
1294 """
1295 Retrieve a Deposit object from the API
1296 @param object_id: ID of object to retrieve
1297 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1298 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1299 @return: a Deposit object
1300 """
1301 return PaymentsApi.find("deposit", auth_args, object_id)
1302
1304 """
1305 A FraudCheck object.
1306 """
1307
1308
1309 @staticmethod
1310 - def create(params, *auth_args):
1311 """
1312 Creates an FraudCheck object
1313 @param params: a dict of parameters; valid keys are:
1314 - C{amount}: Amount of the transaction to be checked for fraud (in the smallest unit of your currency). Example: 100 = $1.00USD. This field is required if using âfullâ or âadvancedâ mode.
1315 - C{card => addressCity}: City of the cardholder. [max length: 50, min length: 2]
1316 - C{card => addressCountry}: Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. [max length: 2, min length: 2]
1317 - C{card => addressLine1}: Address of the cardholder. [max length: 255]
1318 - C{card => addressLine2}: Address of the cardholder if needed. [max length: 255]
1319 - C{card => addressState}: State of residence of the cardholder. For the US, this is a 2-digit USPS code. [max length: 255]
1320 - C{card => addressZip}: Postal code of the cardholder. The postal code size is between 5 and 9 characters in length and only contains numbers or letters. [max length: 9, min length: 3]
1321 - C{card => cvc}: CVC security code of the card. This is the code on the back of the card. Example: 123
1322 - C{card => expMonth}: Expiration month of the card. Format is MM. Example: January = 01 [min value: 1, max value: 12] B{required }
1323 - C{card => expYear}: Expiration year of the card. Format is YY. Example: 2013 = 13 [min value: 0, max value: 99] B{required }
1324 - C{card => name}: Name as it appears on the card. [max length: 50, min length: 2]
1325 - C{card => number}: Card number as it appears on the card. [max length: 19, min length: 13] B{required }
1326 - C{currency}: Currency code (ISO-4217) for the transaction to be checked for fraud. This field is required if using âfullâ or âadvancedâ mode.
1327 - C{description}: - Description of the fraud check. [max length: 255]
1328 - C{ipAddress}: IP Address of the customer for which the fraud check is to be done. [max length: 45]
1329 - C{mode}: Fraud check mode. âsimpleâ only does an AVS and CVC check; âadvancedâ does a complete fraud check, running the input against the set up rules. [valid values: simple, advanced, full] B{required }
1330 - C{sessionId}: Session ID used during data collection. [max length: 255]
1331 - C{token}: Card token token representing card details for the card to be checked. [max length: 255]
1332 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1333 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1334 @param private_api_key: Private key to use for the API call. If C{None}, the value of C{simplify.private_key} will be used.
1335 @return: a FraudCheck object
1336 """
1337 return PaymentsApi.create("fraudCheck", auth_args, params)
1338
1339 @staticmethod
1340 - def list(criteria = None, *auth_args):
1341 """
1342 Retrieve FraudCheck objects.
1343 @param criteria: a dict of parameters; valid keys are:
1344 - C{filter} Allows for ascending or descending sorting of the list.
1345 - C{max} Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20]
1346 - C{offset} Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0]
1347 - C{sorting} Used in paging of the list. This is the start offset of the page. The value maps properties to the sort direction (either C{asc} for ascending or C{desc} for descending). Sortable properties are: C{amount} C{dateCreated} C{fraudResult}.
1348 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1349 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1350 @return: an object which contains the list of FraudCheck objects in the <code>list</code> property and the total number
1351 of objects available for the given criteria in the <code>total</code> property.
1352 """
1353 return PaymentsApi.list("fraudCheck", auth_args, criteria)
1354
1355 @staticmethod
1356 - def find(object_id, *auth_args):
1357 """
1358 Retrieve a FraudCheck object from the API
1359 @param object_id: ID of object to retrieve
1360 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1361 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1362 @return: a FraudCheck object
1363 """
1364 return PaymentsApi.find("fraudCheck", auth_args, object_id)
1365
1366 - def update(self, *auth_args):
1367 """
1368 Updates this object
1369
1370 The properties that can be updated:
1371 - C{integratorAuthCode} Authorization code for the transaction. [max length: 255]
1372
1373 - C{integratorAvsAddress} AVS address response. [max length: 255]
1374
1375 - C{integratorAvsZip} AVS zip response. [max length: 255]
1376
1377 - C{integratorCvc} CVC response. [max length: 255]
1378
1379 - C{integratorDeclineReason} Reason for the decline if applicable. [max length: 255]
1380
1381 - C{integratorTransactionRef} Reference id for the transaction. [max length: 255] B{(required)}
1382
1383 - C{integratorTransactionStatus} Status of the transaction, valid values are "APPROVED", "DECLINED", "SETTLED", "REFUNDED" or "VOIDED".
1384
1385 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1386 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1387 @return: a FraudCheck object.
1388 """
1389 return PaymentsApi.update("fraudCheck", auth_args, self.object_id, self.to_dict())
1390
1392 """
1393 A Invoice object.
1394 """
1395
1396
1397 @staticmethod
1398 - def create(params, *auth_args):
1399 """
1400 Creates an Invoice object
1401 @param params: a dict of parameters; valid keys are:
1402 - C{billingAddress => city}: Billing address city of the location where the goods or services were supplied. [max length: 255, min length: 2]
1403 - C{billingAddress => country}: Billing address country of the location where the goods or services were supplied. [max length: 2, min length: 2]
1404 - C{billingAddress => line1}: Billing address line 1 of the location where the goods or services were supplied. [max length: 255]
1405 - C{billingAddress => line2}: Billing address line 2 of the location where the goods or services were supplied. [max length: 255]
1406 - C{billingAddress => name}: Billing address name of the location where the goods or services were supplied. Will use the customer name if not provided. [max length: 255]
1407 - C{billingAddress => state}: Billing address state of the location where the goods or services were supplied. [max length: 255]
1408 - C{billingAddress => zip}: Billing address zip of the location where the goods or services were supplied. [max length: 32]
1409 - C{businessAddress => city}: Address city of the business that is sending the invoice. [max length: 255, min length: 2]
1410 - C{businessAddress => country}: Address country of the business that is sending the invoice. [max length: 2, min length: 2]
1411 - C{businessAddress => line1}: Address line 1 of the business that is sending the invoice. [max length: 255]
1412 - C{businessAddress => line2}: Address line 2 of the business that is sending the invoice. [max length: 255]
1413 - C{businessAddress => name}: The name of the business that is sending the invoice. [max length: 255]
1414 - C{businessAddress => state}: Address state of the business that is sending the invoice. [max length: 255]
1415 - C{businessAddress => zip}: Address zip of the business that is sending the invoice. [max length: 32]
1416 - C{currency}: Currency code (ISO-4217). Must match the currency associated with your account. [max length: 3, min length: 3, default: USD]
1417 - C{customer}: The customer ID of the customer we are invoicing. This is optional if invoiceToCopy or a name and email are provided
1418 - C{customerTaxNo}: The tax number or VAT id of the person to whom the goods or services were supplied. [max length: 255]
1419 - C{discountRate}: The discount percent as a decimal e.g. 12.5. This is used to calculate the discount amount which is subtracted from the total amount due before any tax is applied. [max length: 6]
1420 - C{dueDate}: The date invoice payment is due. If a late fee is provided this will be added to the invoice total is the due date has past.
1421 - C{email}: The email of the customer we are invoicing. This is optional if customer or invoiceToCopy is provided. A new customer will be created using the the name and email.
1422 - C{invoiceId}: User defined invoice id. If not provided the system will generate a numeric id. [max length: 255]
1423 - C{invoiceToCopy}: The id of an existing invoice to be copied. This is optional if customer or a name and email are provided
1424 - C{items => amount}: Amount of the invoice item (the smallest unit of your currency). Example: 100 = $1.00USD B{required }
1425 - C{items => description}: The description of the invoice item. [max length: 1024]
1426 - C{items => invoice}: The ID of the invoice this item belongs to.
1427 - C{items => product}: The product this invoice item refers to.
1428 - C{items => quantity}: Quantity of the item. This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999, default: 1]
1429 - C{items => reference}: User defined reference field. [max length: 255]
1430 - C{items => tax}: The tax ID of the tax charge in the invoice item.
1431 - C{lateFee}: The late fee amount that will be added to the invoice total is the due date is past due. Value provided must be in the smallest unit of your currency. Example: 100 = $1.00USD
1432 - C{memo}: A memo that is displayed to the customer on the invoice payment screen. [max length: 4000]
1433 - C{name}: The name of the customer we are invoicing. This is optional if customer or invoiceToCopy is provided. A new customer will be created using the the name and email. [max length: 50, min length: 2]
1434 - C{note}: This field can be used to store a note that is not displayed to the customer. [max length: 4000]
1435 - C{reference}: User defined reference field. [max length: 255]
1436 - C{shippingAddress => city}: Address city of the location where the goods or services were supplied. [max length: 255, min length: 2]
1437 - C{shippingAddress => country}: Address country of the location where the goods or services were supplied. [max length: 2, min length: 2]
1438 - C{shippingAddress => line1}: Address line 1 of the location where the goods or services were supplied. [max length: 255]
1439 - C{shippingAddress => line2}: Address line 2 of the location where the goods or services were supplied. [max length: 255]
1440 - C{shippingAddress => name}: Address name of the location where the goods or services were supplied. [max length: 255]
1441 - C{shippingAddress => state}: Address state of the location where the goods or services were supplied. [max length: 255]
1442 - C{shippingAddress => zip}: Address zip of the location where the goods or services were supplied. [max length: 32]
1443 - C{suppliedDate}: The date on which the goods or services were supplied.
1444 - C{taxNo}: The tax number or VAT id of the person who supplied the goods or services. [max length: 255]
1445 - C{type}: The type of invoice. One of WEB or MOBILE. [valid values: WEB, MOBILE, default: WEB]
1446 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1447 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1448 @param private_api_key: Private key to use for the API call. If C{None}, the value of C{simplify.private_key} will be used.
1449 @return: a Invoice object
1450 """
1451 return PaymentsApi.create("invoice", auth_args, params)
1452
1453 - def delete(self, *auth_args):
1454 """
1455 Delete this object
1456 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1457 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1458 """
1459 return PaymentsApi.delete("invoice", auth_args, self.object_id)
1460
1461 @staticmethod
1462 - def list(criteria = None, *auth_args):
1463 """
1464 Retrieve Invoice objects.
1465 @param criteria: a dict of parameters; valid keys are:
1466 - C{filter} Filters to apply to the list.
1467 - C{max} Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20]
1468 - C{offset} Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0]
1469 - C{sorting} Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either C{asc} for ascending or C{desc} for descending). Sortable properties are: C{id} C{invoiceDate} C{dueDate} C{datePaid} C{customer} C{status} C{dateCreated}.
1470 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1471 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1472 @return: an object which contains the list of Invoice objects in the <code>list</code> property and the total number
1473 of objects available for the given criteria in the <code>total</code> property.
1474 """
1475 return PaymentsApi.list("invoice", auth_args, criteria)
1476
1477 @staticmethod
1478 - def find(object_id, *auth_args):
1479 """
1480 Retrieve a Invoice object from the API
1481 @param object_id: ID of object to retrieve
1482 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1483 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1484 @return: a Invoice object
1485 """
1486 return PaymentsApi.find("invoice", auth_args, object_id)
1487
1488 - def update(self, *auth_args):
1489 """
1490 Updates this object
1491
1492 The properties that can be updated:
1493 - C{billingAddress => city} Billing address city of the location where the goods or services were supplied. [max length: 255, min length: 2]
1494
1495 - C{billingAddress => country} Billing address country of the location where the goods or services were supplied. [max length: 2, min length: 2]
1496
1497 - C{billingAddress => line1} Billing address line 1 of the location where the goods or services were supplied. [max length: 255]
1498
1499 - C{billingAddress => line2} Billing address line 2 of the location where the goods or services were supplied. [max length: 255]
1500
1501 - C{billingAddress => name} Billing address name of the location where the goods or services were supplied. [max length: 255]
1502
1503 - C{billingAddress => state} Billing address state of the location where the goods or services were supplied. [max length: 255]
1504
1505 - C{billingAddress => zip} Billing address zip of the location where the goods or services were supplied. [max length: 32]
1506
1507 - C{businessAddress => city} Business address city of the business that is sending the invoice. [max length: 255, min length: 2]
1508
1509 - C{businessAddress => country} Business address country of the business that is sending the invoice. [max length: 2, min length: 2]
1510
1511 - C{businessAddress => line1} Business address line 1 of the business that is sending the invoice. [max length: 255]
1512
1513 - C{businessAddress => line2} Business address line 2 of the business that is sending the invoice. [max length: 255]
1514
1515 - C{businessAddress => name} Business address name of the business that is sending the invoice. [max length: 255]
1516
1517 - C{businessAddress => state} Business address state of the business that is sending the invoice. [max length: 255]
1518
1519 - C{businessAddress => zip} Business address zip of the business that is sending the invoice. [max length: 32]
1520
1521 - C{currency} Currency code (ISO-4217). Must match the currency associated with your account. [max length: 3, min length: 3]
1522
1523 - C{customerTaxNo} The tax number or VAT id of the person to whom the goods or services were supplied. [max length: 255]
1524
1525 - C{datePaid} This is the date the invoice was PAID in UTC millis.
1526
1527 - C{discountRate} The discount percent as a decimal e.g. 12.5. This is used to calculate the discount amount which is subtracted from the total amount due before any tax is applied. [max length: 6]
1528
1529 - C{dueDate} The date invoice payment is due. If a late fee is provided this will be added to the invoice total is the due date has past.
1530
1531 - C{email} The email of the customer we are invoicing. This is optional if customer or invoiceToCopy is provided. A new customer will be created using the the name and email.
1532
1533 - C{invoiceId} User defined invoice id. If not provided the system will generate a numeric id. [max length: 255]
1534
1535 - C{items => amount} Amount of the invoice item in the smallest unit of your currency. Example: 100 = $1.00USD B{(required)}
1536
1537 - C{items => description} The description of the invoice item. [max length: 1024]
1538
1539 - C{items => invoice} The ID of the invoice this item belongs to.
1540
1541 - C{items => product} The Id of the product this item refers to.
1542
1543 - C{items => quantity} Quantity of the item. This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999, default: 1]
1544
1545 - C{items => reference} User defined reference field. [max length: 255]
1546
1547 - C{items => tax} The tax ID of the tax charge in the invoice item.
1548
1549 - C{lateFee} The late fee amount that will be added to the invoice total is the due date is past due. Value provided must be in the smallest unit of your currency. Example: 100 = $1.00USD
1550
1551 - C{memo} A memo that is displayed to the customer on the invoice payment screen. [max length: 4000]
1552
1553 - C{name} The name of the customer we are invoicing. This is optional if customer or invoiceToCopy is provided. A new customer will be created using the the name and email. [max length: 50, min length: 2]
1554
1555 - C{note} This field can be used to store a note that is not displayed to the customer. [max length: 4000]
1556
1557 - C{payment} The ID of the payment. Use this ID to query the /payment API. [max length: 255]
1558
1559 - C{reference} User defined reference field. [max length: 255]
1560
1561 - C{shippingAddress => city} Address city of the location where the goods or services were supplied. [max length: 255, min length: 2]
1562
1563 - C{shippingAddress => country} Address country of the location where the goods or services were supplied. [max length: 2, min length: 2]
1564
1565 - C{shippingAddress => line1} Address line 1 of the location where the goods or services were supplied. [max length: 255]
1566
1567 - C{shippingAddress => line2} Address line 2 of the location where the goods or services were supplied. [max length: 255]
1568
1569 - C{shippingAddress => name} Address name of the location where the goods or services were supplied. [max length: 255]
1570
1571 - C{shippingAddress => state} Address state of the location where the goods or services were supplied. [max length: 255]
1572
1573 - C{shippingAddress => zip} Address zip of the location where the goods or services were supplied. [max length: 32]
1574
1575 - C{status} New status of the invoice.
1576
1577 - C{suppliedDate} The date on which the goods or services were supplied.
1578
1579 - C{taxNo} The tax number or VAT id of the person who supplied the goods or services. [max length: 255]
1580
1581 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1582 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1583 @return: a Invoice object.
1584 """
1585 return PaymentsApi.update("invoice", auth_args, self.object_id, self.to_dict())
1586
1588 """
1589 A InvoiceItem object.
1590 """
1591
1592
1593 @staticmethod
1594 - def create(params, *auth_args):
1595 """
1596 Creates an InvoiceItem object
1597 @param params: a dict of parameters; valid keys are:
1598 - C{amount}: Amount of the invoice item in the smallest unit of your currency. Example: 100 = $1.00USD B{required }
1599 - C{description}: Individual items of an invoice [max length: 1024]
1600 - C{invoice}: The ID of the invoice this item belongs to.
1601 - C{product}: Product ID this item relates to.
1602 - C{quantity}: Quantity of the item. This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999, default: 1]
1603 - C{reference}: User defined reference field. [max length: 255]
1604 - C{tax}: The tax ID of the tax charge in the invoice item.
1605 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1606 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1607 @param private_api_key: Private key to use for the API call. If C{None}, the value of C{simplify.private_key} will be used.
1608 @return: a InvoiceItem object
1609 """
1610 return PaymentsApi.create("invoiceItem", auth_args, params)
1611
1612 - def delete(self, *auth_args):
1613 """
1614 Delete this object
1615 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1616 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1617 """
1618 return PaymentsApi.delete("invoiceItem", auth_args, self.object_id)
1619
1620 @staticmethod
1621 - def find(object_id, *auth_args):
1622 """
1623 Retrieve a InvoiceItem object from the API
1624 @param object_id: ID of object to retrieve
1625 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1626 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1627 @return: a InvoiceItem object
1628 """
1629 return PaymentsApi.find("invoiceItem", auth_args, object_id)
1630
1631 - def update(self, *auth_args):
1632 """
1633 Updates this object
1634
1635 The properties that can be updated:
1636 - C{amount} Amount of the invoice item in the smallest unit of your currency. Example: 100 = $1.00USD [min value: 1]
1637
1638 - C{description} Individual items of an invoice
1639
1640 - C{quantity} Quantity of the item. This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999]
1641
1642 - C{reference} User defined reference field.
1643
1644 - C{tax} The tax ID of the tax charge in the invoice item.
1645
1646 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1647 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1648 @return: a InvoiceItem object.
1649 """
1650 return PaymentsApi.update("invoiceItem", auth_args, self.object_id, self.to_dict())
1651
1653 """
1654 A Payment object.
1655 """
1656
1657
1658 @staticmethod
1659 - def create(params, *auth_args):
1660 """
1661 Creates an Payment object
1662 @param params: a dict of parameters; valid keys are:
1663 - C{amount}: Amount of the payment (in the smallest unit of your currency). Example: 100 = $1.00USD
1664 - C{authorization}: The ID of the authorization being used to capture the payment.
1665 - C{card => addressCity}: City of the cardholder. [max length: 50, min length: 2]
1666 - C{card => addressCountry}: Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. [max length: 2, min length: 2]
1667 - C{card => addressLine1}: Address of the cardholder. [max length: 255]
1668 - C{card => addressLine2}: Address of the cardholder if needed. [max length: 255]
1669 - C{card => addressState}: State of residence of the cardholder. For the US, this is a 2-digit USPS code. [max length: 255]
1670 - C{card => addressZip}: Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters. [max length: 9, min length: 3]
1671 - C{card => cvc}: CVC security code of the card. This is the code on the back of the card. Example: 123
1672 - C{card => expMonth}: Expiration month of the card. Format is MM. Example: January = 01 [min value: 1, max value: 12] B{required }
1673 - C{card => expYear}: Expiration year of the card. Format is YY. Example: 2013 = 13 [min value: 0, max value: 99] B{required }
1674 - C{card => name}: Name as it appears on the card. [max length: 50, min length: 2]
1675 - C{card => number}: Card number as it appears on the card. [max length: 19, min length: 13] B{required }
1676 - C{currency}: Currency code (ISO-4217) for the transaction. Must match the currency associated with your account. [default: USD] B{required }
1677 - C{customer}: ID of customer. If specified, card on file of customer will be used.
1678 - C{description}: Free form text field to be used as a description of the payment. This field is echoed back with the payment on any find or list operations. [max length: 1024]
1679 - C{invoice}: ID of invoice for which this payment is being made.
1680 - C{order => commodityCode}: Standard classification code for products and services. [max length: 5]
1681 - C{order => customer}: ID of the customer associated with the order.
1682 - C{order => customerEmail}: Customer email address.
1683 - C{order => customerName}: Customer name.
1684 - C{order => customerNote}: Additional notes provided by the customer. [max length: 255]
1685 - C{order => customerReference}: A merchant reference for the customer.
1686 - C{order => items => amount}: Cost of the item.
1687 - C{order => items => description}: Description of the item.
1688 - C{order => items => name}: Item name.
1689 - C{order => items => product}: Product information associated with the item.
1690 - C{order => items => quantity}: Quantity of the item contained in the order [min value: 1, max value: 999999, default: 1] B{required }
1691 - C{order => items => reference}: A merchant reference for the item. [max length: 255]
1692 - C{order => items => tax}: Taxes associated with the item.
1693 - C{order => merchantNote}: Additional notes provided by the merchant. [max length: 255]
1694 - C{order => payment}: ID of the payment associated with the order.
1695 - C{order => reference}: A merchant reference for the order. [max length: 255]
1696 - C{order => shippingAddress => city}: City, town, or municipality. [max length: 255, min length: 2]
1697 - C{order => shippingAddress => country}: 2-character country code. [max length: 2, min length: 2]
1698 - C{order => shippingAddress => line1}: Street address. [max length: 255]
1699 - C{order => shippingAddress => line2}: (Opt) Street address continued. [max length: 255]
1700 - C{order => shippingAddress => name}: Name of the entity being shipped to. [max length: 255]
1701 - C{order => shippingAddress => state}: State or province. [max length: 255]
1702 - C{order => shippingAddress => zip}: Postal code. [max length: 32]
1703 - C{order => shippingFromAddress => city}: City, town, or municipality. [max length: 255, min length: 2]
1704 - C{order => shippingFromAddress => country}: 2-character country code. [max length: 2, min length: 2]
1705 - C{order => shippingFromAddress => line1}: Street address. [max length: 255]
1706 - C{order => shippingFromAddress => line2}: (Opt) Street address continued. [max length: 255]
1707 - C{order => shippingFromAddress => name}: Name of the entity performing the shipping. [max length: 255]
1708 - C{order => shippingFromAddress => state}: State or province. [max length: 255]
1709 - C{order => shippingFromAddress => zip}: Postal code. [max length: 32]
1710 - C{order => shippingName}: Name of the entity being shipped to.
1711 - C{order => source}: Order source. [default: WEB] B{required }
1712 - C{order => status}: Status of the order. [default: INCOMPLETE] B{required }
1713 - C{reference}: Custom reference field to be used with outside systems.
1714 - C{replayId}: An identifier that can be sent to uniquely identify a payment request to facilitate retries due to I/O related issues. This identifier must be unique for your account (sandbox or live) across all of your payments. If supplied, we will check for a payment on your account that matches this identifier. If found will attempt to return an identical response of the original request. [max length: 50, min length: 1]
1715 - C{statementDescription => name}: Merchant name. B{required }
1716 - C{statementDescription => phoneNumber}: Merchant contact phone number.
1717 - C{taxExempt}: Specify true to indicate that the payment is tax-exempt.
1718 - C{token}: If specified, card associated with card token will be used. [max length: 255]
1719 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1720 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1721 @param private_api_key: Private key to use for the API call. If C{None}, the value of C{simplify.private_key} will be used.
1722 @return: a Payment object
1723 """
1724 return PaymentsApi.create("payment", auth_args, params)
1725
1726 @staticmethod
1727 - def list(criteria = None, *auth_args):
1728 """
1729 Retrieve Payment objects.
1730 @param criteria: a dict of parameters; valid keys are:
1731 - C{filter} Filters to apply to the list.
1732 - C{max} Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20]
1733 - C{offset} Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0]
1734 - C{sorting} Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either C{asc} for ascending or C{desc} for descending). Sortable properties are: C{dateCreated} C{createdBy} C{amount} C{id} C{description} C{paymentDate}.
1735 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1736 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1737 @return: an object which contains the list of Payment objects in the <code>list</code> property and the total number
1738 of objects available for the given criteria in the <code>total</code> property.
1739 """
1740 return PaymentsApi.list("payment", auth_args, criteria)
1741
1742 @staticmethod
1743 - def find(object_id, *auth_args):
1744 """
1745 Retrieve a Payment object from the API
1746 @param object_id: ID of object to retrieve
1747 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1748 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1749 @return: a Payment object
1750 """
1751 return PaymentsApi.find("payment", auth_args, object_id)
1752
1753 - def update(self, *auth_args):
1754 """
1755 Updates this object
1756
1757 The properties that can be updated:
1758 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1759 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1760 @return: a Payment object.
1761 """
1762 return PaymentsApi.update("payment", auth_args, self.object_id, self.to_dict())
1763
1764 -class Plan(Domain):
1765 """
1766 A Plan object.
1767 """
1768
1769
1770 @staticmethod
1771 - def create(params, *auth_args):
1772 """
1773 Creates an Plan object
1774 @param params: a dict of parameters; valid keys are:
1775 - C{amount}: Amount of payment for the plan in the smallest unit of your currency. Example: 100 = $1.00USD B{required }
1776 - C{billingCycle}: How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles). [default: AUTO]
1777 - C{billingCycleLimit}: The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4
1778 - C{currency}: Currency code (ISO-4217) for the plan. Must match the currency associated with your account. [default: USD] B{required }
1779 - C{frequency}: Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY". [default: MONTHLY] B{required }
1780 - C{frequencyPeriod}: Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly. [min value: 1, default: 1] B{required }
1781 - C{name}: Name of the plan [max length: 50, min length: 2] B{required }
1782 - C{renewalReminderLeadDays}: If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null, then no emails are sent. Minimum value is 7 if set.
1783 - C{trialPeriod}: Plan free trial period selection. Must be Days, Weeks, or Month [default: NONE] B{required }
1784 - C{trialPeriodQuantity}: Quantity of the trial period. Must be greater than 0 and a whole number. [min value: 1]
1785 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1786 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1787 @param private_api_key: Private key to use for the API call. If C{None}, the value of C{simplify.private_key} will be used.
1788 @return: a Plan object
1789 """
1790 return PaymentsApi.create("plan", auth_args, params)
1791
1792 - def delete(self, *auth_args):
1793 """
1794 Delete this object
1795 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1796 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1797 """
1798 return PaymentsApi.delete("plan", auth_args, self.object_id)
1799
1800 @staticmethod
1801 - def list(criteria = None, *auth_args):
1802 """
1803 Retrieve Plan objects.
1804 @param criteria: a dict of parameters; valid keys are:
1805 - C{filter} Filters to apply to the list.
1806 - C{max} Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20]
1807 - C{offset} Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0]
1808 - C{sorting} Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either C{asc} for ascending or C{desc} for descending). Sortable properties are: C{dateCreated} C{amount} C{frequency} C{name} C{id}.
1809 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1810 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1811 @return: an object which contains the list of Plan objects in the <code>list</code> property and the total number
1812 of objects available for the given criteria in the <code>total</code> property.
1813 """
1814 return PaymentsApi.list("plan", auth_args, criteria)
1815
1816 @staticmethod
1817 - def find(object_id, *auth_args):
1818 """
1819 Retrieve a Plan object from the API
1820 @param object_id: ID of object to retrieve
1821 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1822 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1823 @return: a Plan object
1824 """
1825 return PaymentsApi.find("plan", auth_args, object_id)
1826
1827 - def update(self, *auth_args):
1828 """
1829 Updates this object
1830
1831 The properties that can be updated:
1832 - C{name} Name of the plan. [min length: 2] B{(required)}
1833
1834 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1835 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1836 @return: a Plan object.
1837 """
1838 return PaymentsApi.update("plan", auth_args, self.object_id, self.to_dict())
1839
1841 """
1842 A Refund object.
1843 """
1844
1845
1846 @staticmethod
1847 - def create(params, *auth_args):
1848 """
1849 Creates an Refund object
1850 @param params: a dict of parameters; valid keys are:
1851 - C{amount}: Amount of the refund in the smallest unit of your currency. Example: 100 = $1.00USD B{required }
1852 - C{payment}: ID of the payment for the refund
1853 - C{reason}: Reason for the refund
1854 - C{reference}: Custom reference field to be used with outside systems.
1855 - C{replayId}: An identifier that can be sent to uniquely identify a refund request to facilitate retries due to I/O related issues. This identifier must be unique for your account (sandbox or live) across all of your refunds. If supplied, we will check for a refund on your account that matches this identifier. If found we will return an identical response to that of the original request. [max length: 50, min length: 1]
1856 - C{statementDescription => name}: Merchant name. B{required }
1857 - C{statementDescription => phoneNumber}: Merchant contact phone number.
1858 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1859 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1860 @param private_api_key: Private key to use for the API call. If C{None}, the value of C{simplify.private_key} will be used.
1861 @return: a Refund object
1862 """
1863 return PaymentsApi.create("refund", auth_args, params)
1864
1865 @staticmethod
1866 - def list(criteria = None, *auth_args):
1867 """
1868 Retrieve Refund objects.
1869 @param criteria: a dict of parameters; valid keys are:
1870 - C{filter} Filters to apply to the list.
1871 - C{max} Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20]
1872 - C{offset} Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0]
1873 - C{sorting} Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either C{asc} for ascending or C{desc} for descending). Sortable properties are: C{id} C{amount} C{description} C{dateCreated} C{paymentDate}.
1874 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1875 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1876 @return: an object which contains the list of Refund objects in the <code>list</code> property and the total number
1877 of objects available for the given criteria in the <code>total</code> property.
1878 """
1879 return PaymentsApi.list("refund", auth_args, criteria)
1880
1881 @staticmethod
1882 - def find(object_id, *auth_args):
1883 """
1884 Retrieve a Refund object from the API
1885 @param object_id: ID of object to retrieve
1886 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1887 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1888 @return: a Refund object
1889 """
1890 return PaymentsApi.find("refund", auth_args, object_id)
1891
1893 """
1894 A Subscription object.
1895 """
1896
1897
1898 @staticmethod
1899 - def create(params, *auth_args):
1900 """
1901 Creates an Subscription object
1902 @param params: a dict of parameters; valid keys are:
1903 - C{amount}: Amount of the payment in the smallest unit of your currency. Example: 100 = $1.00USD
1904 - C{billingCycle}: How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles). [default: AUTO]
1905 - C{billingCycleLimit}: The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4
1906 - C{coupon}: Coupon ID associated with the subscription
1907 - C{currency}: Currency code (ISO-4217). Must match the currency associated with your account. [default: USD]
1908 - C{customer}: Customer that is enrolling in the subscription.
1909 - C{frequency}: Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY".
1910 - C{frequencyPeriod}: Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly.
1911 - C{name}: Name describing subscription
1912 - C{plan}: The ID of the plan that should be used for the subscription.
1913 - C{quantity}: Quantity of the plan for the subscription. [min value: 1]
1914 - C{renewalReminderLeadDays}: If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null, then no emails are sent. Minimum value is 7 if set.
1915 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1916 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1917 @param private_api_key: Private key to use for the API call. If C{None}, the value of C{simplify.private_key} will be used.
1918 @return: a Subscription object
1919 """
1920 return PaymentsApi.create("subscription", auth_args, params)
1921
1922 - def delete(self, *auth_args):
1923 """
1924 Delete this object
1925 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1926 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1927 """
1928 return PaymentsApi.delete("subscription", auth_args, self.object_id)
1929
1930 @staticmethod
1931 - def list(criteria = None, *auth_args):
1932 """
1933 Retrieve Subscription objects.
1934 @param criteria: a dict of parameters; valid keys are:
1935 - C{filter} Filters to apply to the list.
1936 - C{max} Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20]
1937 - C{offset} Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0]
1938 - C{sorting} Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either C{asc} for ascending or C{desc} for descending). Sortable properties are: C{id} C{plan}.
1939 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1940 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1941 @return: an object which contains the list of Subscription objects in the <code>list</code> property and the total number
1942 of objects available for the given criteria in the <code>total</code> property.
1943 """
1944 return PaymentsApi.list("subscription", auth_args, criteria)
1945
1946 @staticmethod
1947 - def find(object_id, *auth_args):
1948 """
1949 Retrieve a Subscription object from the API
1950 @param object_id: ID of object to retrieve
1951 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1952 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1953 @return: a Subscription object
1954 """
1955 return PaymentsApi.find("subscription", auth_args, object_id)
1956
1957 - def update(self, *auth_args):
1958 """
1959 Updates this object
1960
1961 The properties that can be updated:
1962 - C{amount} Amount of the payment in the smallest unit of your currency. Example: 100 = $1.00USD
1963
1964 - C{billingCycle} How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles). [default: AUTO]
1965
1966 - C{billingCycleLimit} The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4
1967
1968 - C{coupon} Coupon being assigned to this subscription
1969
1970 - C{currency} Currency code (ISO-4217). Must match the currency associated with your account. [default: USD]
1971
1972 - C{frequency} Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY".
1973
1974 - C{frequencyPeriod} Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly. [min value: 1]
1975
1976 - C{name} Name describing subscription
1977
1978 - C{plan} Plan that should be used for the subscription.
1979
1980 - C{prorate} Whether to prorate existing subscription. [default: true] B{(required)}
1981
1982 - C{quantity} Quantity of the plan for the subscription. [min value: 1]
1983
1984 - C{renewalReminderLeadDays} If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null or 0, no emails are sent. Minimum value is 7 if set.
1985
1986 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
1987 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
1988 @return: a Subscription object.
1989 """
1990 return PaymentsApi.update("subscription", auth_args, self.object_id, self.to_dict())
1991
1993 """
1994 A Tax object.
1995 """
1996
1997
1998 @staticmethod
1999 - def create(params, *auth_args):
2000 """
2001 Creates an Tax object
2002 @param params: a dict of parameters; valid keys are:
2003 - C{label}: The label of the tax object. [max length: 255] B{required }
2004 - C{rate}: The tax rate. Decimal value up three decimal places. e.g 12.501. [max length: 6] B{required }
2005 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
2006 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
2007 @param private_api_key: Private key to use for the API call. If C{None}, the value of C{simplify.private_key} will be used.
2008 @return: a Tax object
2009 """
2010 return PaymentsApi.create("tax", auth_args, params)
2011
2012 - def delete(self, *auth_args):
2013 """
2014 Delete this object
2015 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
2016 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
2017 """
2018 return PaymentsApi.delete("tax", auth_args, self.object_id)
2019
2020 @staticmethod
2021 - def list(criteria = None, *auth_args):
2022 """
2023 Retrieve Tax objects.
2024 @param criteria: a dict of parameters; valid keys are:
2025 - C{filter} Filters to apply to the list.
2026 - C{max} Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20]
2027 - C{offset} Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0]
2028 - C{sorting} Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either C{asc} for ascending or C{desc} for descending). Sortable properties are: C{id} C{label}.
2029 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
2030 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
2031 @return: an object which contains the list of Tax objects in the <code>list</code> property and the total number
2032 of objects available for the given criteria in the <code>total</code> property.
2033 """
2034 return PaymentsApi.list("tax", auth_args, criteria)
2035
2036 @staticmethod
2037 - def find(object_id, *auth_args):
2038 """
2039 Retrieve a Tax object from the API
2040 @param object_id: ID of object to retrieve
2041 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
2042 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
2043 @return: a Tax object
2044 """
2045 return PaymentsApi.find("tax", auth_args, object_id)
2046
2048 """
2049 A TransactionReview object.
2050 """
2051
2052
2053 @staticmethod
2054 - def create(params, *auth_args):
2055 """
2056 Creates an TransactionReview object
2057 @param params: a dict of parameters; valid keys are:
2058 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
2059 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
2060 @param private_api_key: Private key to use for the API call. If C{None}, the value of C{simplify.private_key} will be used.
2061 @return: a TransactionReview object
2062 """
2063 return PaymentsApi.create("transactionReview", auth_args, params)
2064
2065 - def delete(self, *auth_args):
2066 """
2067 Delete this object
2068 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
2069 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
2070 """
2071 return PaymentsApi.delete("transactionReview", auth_args, self.object_id)
2072
2073 @staticmethod
2074 - def list(criteria = None, *auth_args):
2075 """
2076 Retrieve TransactionReview objects.
2077 @param criteria: a dict of parameters; valid keys are:
2078 - C{filter} Allows for ascending or descending sorting of the list.
2079 - C{max} Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20]
2080 - C{offset} Filters to apply to the list. [min value: 0, default: 0]
2081 - C{sorting} Used in paging of the list. This is the start offset of the page. The value maps properties to the sort direction (either C{asc} for ascending or C{desc} for descending). Sortable properties are: C{dateCreated} C{status}.
2082 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
2083 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
2084 @return: an object which contains the list of TransactionReview objects in the <code>list</code> property and the total number
2085 of objects available for the given criteria in the <code>total</code> property.
2086 """
2087 return PaymentsApi.list("transactionReview", auth_args, criteria)
2088
2089 @staticmethod
2090 - def find(object_id, *auth_args):
2091 """
2092 Retrieve a TransactionReview object from the API
2093 @param object_id: ID of object to retrieve
2094 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
2095 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
2096 @return: a TransactionReview object
2097 """
2098 return PaymentsApi.find("transactionReview", auth_args, object_id)
2099
2100 - def update(self, *auth_args):
2101 """
2102 Updates this object
2103
2104 The properties that can be updated:
2105 - C{status} Status of the transaction review.
2106
2107 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
2108 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
2109 @return: a TransactionReview object.
2110 """
2111 return PaymentsApi.update("transactionReview", auth_args, self.object_id, self.to_dict())
2112
2114 """
2115 A Webhook object.
2116 """
2117
2118
2119 @staticmethod
2120 - def create(params, *auth_args):
2121 """
2122 Creates an Webhook object
2123 @param params: a dict of parameters; valid keys are:
2124 - C{url}: Endpoint URL B{required }
2125 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
2126 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
2127 @param private_api_key: Private key to use for the API call. If C{None}, the value of C{simplify.private_key} will be used.
2128 @return: a Webhook object
2129 """
2130 return PaymentsApi.create("webhook", auth_args, params)
2131
2132 - def delete(self, *auth_args):
2133 """
2134 Delete this object
2135 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
2136 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
2137 """
2138 return PaymentsApi.delete("webhook", auth_args, self.object_id)
2139
2140 @staticmethod
2141 - def list(criteria = None, *auth_args):
2142 """
2143 Retrieve Webhook objects.
2144 @param criteria: a dict of parameters; valid keys are:
2145 - C{filter} Filters to apply to the list.
2146 - C{max} Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20]
2147 - C{offset} Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0]
2148 - C{sorting} Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either C{asc} for ascending or C{desc} for descending). Sortable properties are: C{dateCreated}.
2149 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
2150 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
2151 @return: an object which contains the list of Webhook objects in the <code>list</code> property and the total number
2152 of objects available for the given criteria in the <code>total</code> property.
2153 """
2154 return PaymentsApi.list("webhook", auth_args, criteria)
2155
2156 @staticmethod
2157 - def find(object_id, *auth_args):
2158 """
2159 Retrieve a Webhook object from the API
2160 @param object_id: ID of object to retrieve
2161 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
2162 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
2163 @return: a Webhook object
2164 """
2165 return PaymentsApi.find("webhook", auth_args, object_id)
2166
2167 - def update(self, *auth_args):
2168 """
2169 Updates this object
2170
2171 The properties that can be updated:
2172 - C{url} Endpoint URL B{(required)}
2173
2174 @param auth_args: an Authentication object used for the API call. If no value is passed the gloabl keys simplify.public_key and simplify.private_key are used.
2175 For backwards compatibility the public and private keys may be passed instead of an Authentication object.
2176 @return: a Webhook object.
2177 """
2178 return PaymentsApi.update("webhook", auth_args, self.object_id, self.to_dict())
2179