repo
string
commit
string
message
string
diff
string
ztangent/checkergen
7549ccb0da9913e79194bea8e6e066410fe51fbc
Small bugfixes, auto generate makepy module for VET.
diff --git a/src/cli.py b/src/cli.py index 101daee..38fceb9 100644 --- a/src/cli.py +++ b/src/cli.py @@ -352,733 +352,731 @@ class CkgCmd(cmd.Cmd): self.__class__.edgrp_parser.print_usage() rmgrp_parser = CmdParser(add_help=False, prog='rmgrp', description='''Removes display groups specified by ids.''') rmgrp_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='ids of display groups to be removed') rmgrp_parser.add_argument('-a', '--all', action='store_true', help='remove all groups from the project') def help_rmgrp(self): self.__class__.rmgrp_parser.print_help() def do_rmgrp(self, line): """Removes display groups specified by ids""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups to remove' return try: args = self.__class__.rmgrp_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.rmgrp_parser.print_usage() return rmlist = [] if args.all: for group in self.cur_proj.groups[:]: self.cur_proj.del_group(group) print "all display groups removed" return elif len(args.idlist) == 0: print "please specify at least one id" # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist: if x >= len(self.cur_proj.groups) or x < 0: print "display group", x, "does not exist" continue rmlist.append(self.cur_proj.groups[x]) print "display group", x, "removed" for group in rmlist: self.cur_proj.del_group(group) # Remember to point self.cur_group somewhere sane if self.cur_group not in self.cur_proj.groups: if len(self.cur_proj.groups) == 0: self.cur_group = None else: self.cur_group = self.cur_proj.groups[0] print "group 0 is now the current display group" chgrp_parser = CmdParser(add_help=False, prog='chgrp', description='''Changes display group that is currently active for editing. Prints current group id if no group id is specified''') chgrp_parser.add_argument('gid', metavar='id', type=int, nargs='?', help='id of display group to be made active') def help_chgrp(self): self.__class__.chgrp_parser.print_help() def do_chgrp(self, line): """Changes group that is currently active for editing.""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups that can be made active' return try: args = self.__class__.chgrp_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.chgrp_parser.print_usage() return if args.gid == None: print "group",\ self.cur_proj.groups.index(self.cur_group),\ "is the current display group" elif args.gid >= len(self.cur_proj.groups) or args.gid < 0: print "group", args.gid, "does not exist" else: self.cur_group = self.cur_proj.groups[args.gid] print "group", args.gid, "is now the current display group" mk_parser = CmdParser(add_help=False, prog='mk', description='''Makes a new checkerboard in the current group with the given parameters.''') mk_parser.add_argument('dims', action=store_tuple(2, ',', to_decimal), help='''width,height of checkerboard in no. of unit cells''') mk_parser.add_argument('init_unit', action=store_tuple(2, ',', to_decimal), help='width,height of initial unit cell in pixels') mk_parser.add_argument('end_unit', action=store_tuple(2, ',', to_decimal), help='width,height of final unit cell in pixels') mk_parser.add_argument('position', action=store_tuple(2, ',', to_decimal), help='x,y position of checkerboard in pixels') mk_parser.add_argument('anchor', choices=sorted(locations.keys()), help='''location of anchor point of checkerboard (choices: %(choices)s)''', metavar='anchor') mk_parser.add_argument('cols', action=store_tuple(2, ',', to_color, [';']), help='''color1,color2 of the checkerboard (color format: R;G;B, component range from 0-255)''') mk_parser.add_argument('freq', type=to_decimal, help='frequency of color reversal in Hz') mk_parser.add_argument('phase', type=to_decimal, nargs='?', default='0', help='initial phase of animation in degrees') def help_mk(self): self.__class__.mk_parser.print_help() def do_mk(self, line): """Makes a checkerboard with the given parameters.""" if self.cur_proj == None: print 'no project open, automatically creating project...' self.do_new('') if self.cur_group == None: print 'automatically adding display group...' self.do_mkgrp('') try: args = self.__class__.mk_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.mk_parser.print_usage() return shape_dict = dict([(name, getattr(args, name)) for name in public_dir(args)]) new_shape = core.CheckerBoard(**shape_dict) new_id = self.cur_proj.add_shape_to_group(self.cur_group, new_shape) print "checkerboard", new_id, "added" ed_parser = CmdParser(add_help=False, prog='ed', description='''Edits attributes of checkerboards specified by ids.''') ed_parser.add_argument('idlist', nargs='+', metavar='id', type=int, help='''ids of checkerboards in the current group to be edited''') ed_parser.add_argument('--dims', action=store_tuple(2, ',', to_decimal), help='checkerboard dimensions in unit cells', metavar='WIDTH,HEIGHT') ed_parser.add_argument('--init_unit', action=store_tuple(2, ',', to_decimal), help='initial unit cell dimensions in pixels', metavar='WIDTH,HEIGHT') ed_parser.add_argument('--end_unit', action=store_tuple(2, ',', to_decimal), help='final unit cell dimensions in pixels', metavar='WIDTH,HEIGHT') ed_parser.add_argument('--position', action=store_tuple(2, ',', to_decimal), help='position of checkerboard in pixels', metavar='X,Y') ed_parser.add_argument('--anchor', choices=sorted(locations.keys()), help='''location of anchor point of checkerboard (choices: %(choices)s)''', metavar='LOCATION') ed_parser.add_argument('--cols', metavar='COLOR1,COLOR2', action=store_tuple(2, ',', to_color, [';']), help='''checkerboard colors (color format: R;G;B, component range from 0-255)''') ed_parser.add_argument('--freq', type=to_decimal, help='frequency of color reversal in Hz') ed_parser.add_argument('--phase', type=to_decimal, help='initial phase of animation in degrees') def help_ed(self): self.__class__.ed_parser.print_help() def do_ed(self, line): """Edits attributes of checkerboards specified by ids.""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups, please create one first' return try: args = self.__class__.ed_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.ed_parser.print_usage() return # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist[:]: if x >= len(self.cur_group.shapes) or x < 0: args.idlist.remove(x) print "checkerboard", x, "does not exist" if args.idlist == []: return names = public_dir(args) names.remove('idlist') noflags = True for name in names: val = getattr(args, name) if val != None: for x in args.idlist: self.cur_proj.set_shape_attr(self.cur_group, x, name, val) noflags = False if noflags: print "no options specified, please specify at least one" self.__class__.ed_parser.print_usage() rm_parser = CmdParser(add_help=False, prog='rm', description='''Removes checkerboards specified by ids.''') rm_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''ids of checkerboards in the current group to be removed''') rm_parser.add_argument('-a', '--all', action='store_true', help='''remove all checkerboards in the current group''') def help_rm(self): self.__class__.rm_parser.print_help() def do_rm(self, line): """Removes checkerboards specified by ids""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups, no boards to remove' return try: args = self.__class__.rm_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.rm_parser.print_usage() return rmlist = [] if args.all: for shape in self.cur_group.shapes: self.cur_proj.del_shape_from_group(self.cur_group, shape) print "all checkerboards removed" return elif len(args.idlist) == 0: print "please specify at least one id" # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist: if x >= len(self.cur_group.shapes) or x < 0: print "checkerboard", x, "does not exist" continue rmlist.append(self.cur_group.shapes[x]) print "checkerboard", x, "removed" for shape in rmlist: self.cur_proj.del_shape_from_group(self.cur_group, shape) ls_parser = CmdParser(add_help=False, prog='ls', description='''Lists project, display group and checkerboard settings. If no group ids are specified, all display groups are listed.''') ls_parser.add_argument('gidlist', nargs='*', metavar='gid', type=int, help='''ids of the display groups to be listed''') ls_group = ls_parser.add_mutually_exclusive_group() ls_group.add_argument('-s', '--settings', action='store_true', help='list only project settings') ls_group.add_argument('-g', '--groups', action='store_true', help='list only display groups') def help_ls(self): self.__class__.ls_parser.print_help() def do_ls(self, line): """Lists project, display group and checkerboard settings.""" def ls_str(s, seps=[',',';']): """Special space-saving output formatter.""" if type(s) in [tuple, list]: if len(seps) > 1: newseps = seps[1:] else: newseps = seps return seps[0].join([ls_str(i, newseps) for i in s]) else: return str(s) if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.ls_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.ls_parser.print_usage() return # Remove duplicates and ascending sort args.gidlist = sorted(set(args.gidlist)) if len(self.cur_proj.groups) == 0: if len(args.gidlist) > 0: print 'this project has no display groups that can be listed' args.settings = True else: for gid in args.gidlist[:]: if gid >= len(self.cur_proj.groups) or gid < 0: args.gidlist.remove(gid) print 'display group', gid, 'does not exist' if args.gidlist == []: args.gidlist = range(len(self.cur_proj.groups)) else: # If any (valid) groups are specified # don't show project settings args.groups = True if not args.groups: print 'PROJECT SETTINGS'.center(70,'*') print \ 'name'.rjust(16),\ 'fps'.rjust(7),\ 'resolution'.rjust(14),\ 'bg color'.rjust(18) # 'format'.rjust(7) print \ ls_str(self.cur_proj.name).rjust(16),\ ls_str(self.cur_proj.fps).rjust(7),\ ls_str(self.cur_proj.res).rjust(14),\ ls_str(self.cur_proj.bg).rjust(18) # ls_str(self.cur_proj.export_fmt).rjust(7) print \ 'pre-display'.rjust(26),\ 'post-display'.rjust(26) print \ ls_str(self.cur_proj.pre).rjust(26),\ ls_str(self.cur_proj.post).rjust(26) print \ 'cross colors'.rjust(26),\ 'cross times'.rjust(26) print \ ls_str(self.cur_proj.cross_cols).rjust(26),\ ls_str(self.cur_proj.cross_times).rjust(26) if not args.settings and not args.groups: # Insert empty line if both groups and project # settings are listed print '' if not args.settings: for i, n in enumerate(args.gidlist): if i != 0: # Print newline seperator between each group print '' group = self.cur_proj.groups[n] print 'GROUP {n}'.format(n=n).center(70,'*') print \ 'pre-display'.rjust(20),\ 'display'.rjust(20),\ 'post-display'.rjust(20) print \ ls_str(group.pre).rjust(20),\ ls_str(group.disp).rjust(20),\ ls_str(group.post).rjust(20) if len(group.shapes) > 0: print \ ''.rjust(2),\ 'shape id'.rjust(8),\ 'dims'.rjust(10),\ 'init_unit'.rjust(14),\ 'end_unit'.rjust(14),\ 'position'.rjust(14) for m, shape in enumerate(group.shapes): print \ ''.rjust(2),\ ls_str(m).rjust(8),\ ls_str(shape.dims).rjust(10),\ ls_str(shape.init_unit).rjust(14),\ ls_str(shape.end_unit).rjust(14),\ ls_str(shape.position).rjust(14) print '\n',\ ''.rjust(2),\ 'shape id'.rjust(8),\ 'colors'.rjust(27),\ 'anchor'.rjust(12),\ 'freq'.rjust(6),\ 'phase'.rjust(7) for m, shape in enumerate(group.shapes): print \ ''.rjust(2),\ ls_str(m).rjust(8),\ ls_str(shape.cols).rjust(27),\ ls_str(shape.anchor).rjust(12),\ ls_str(shape.freq).rjust(6),\ ls_str(shape.phase).rjust(7) display_parser = CmdParser(add_help=False, prog='display', description='''Displays the animation in a window or in fullscreen.''') display_parser.add_argument('-b', '--block', metavar='PATH', help='''read flags and dislay group order from specified file, ignore other flags''') display_parser.add_argument('-f', '--fullscreen', action='store_true', help='sets fullscreen mode, ESC to quit') display_parser.add_argument('-p', '--priority', metavar='LEVEL', help='''set priority while displaying, higher priority results in less dropped frames (choices: 0-3, low, normal, high, realtime)''') display_parser.add_argument('-r', '--repeat', metavar='N', type=int, help='''repeatedly display specified display groups N number of times''') display_parser.add_argument('-pt', '--phototest', action='store_true', help='''draw white test rectangle in topleft corner of screen when groups become visible for a photodiode to detect''') display_parser.add_argument('-lt', '--logtime', action='store_true', help='output frame timestamps to a log file') display_parser.add_argument('-ld', '--logdur', action='store_true', help='output frame durations to a log file') display_parser.add_argument('-ss', '--sigser', action='store_true', help='''send signals through the serial port when shapes are being displayed''') display_parser.add_argument('-sp', '--sigpar', action='store_true', help='''send signals through the parallel port when shapes are being displayed''') display_parser.add_argument('-fpbs', metavar='N', type=int, default=0, help='''unique signal corresponding to a checkerboard is sent after the board undergoes N color reversals (flips), set to 0 to disable''') display_parser.add_argument('-et', '--eyetrack', action='store_true', help='''use eyetracking to ensure that subject fixates on the cross in the center''') display_parser.add_argument('-eu', '--etuser', action='store_true', help='''allow user to select eyetracking video source from a dialog''') display_parser.add_argument('-ev', '--etvideo', metavar='path', help='''path (with no spaces) to eyetracking video file to be used as the source''') display_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''list of display groups to be displayed in the specified order (default: order by id, i.e. group 0 is first)''') def help_display(self): self.__class__.display_parser.print_help() def do_display(self, line): """Displays the animation in a window or in fullscreen""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.display_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.display_parser.print_usage() return if args.block != None: try: blkdict = core.CkgProj.readblk(args.block) flags = blkdict['flags'] try: args = self.__class__.\ display_parser.parse_args(shlex.split(flags)) args.idlist = blkdict['idlist'] except CmdParserError: print 'error: invalid flags stored in block file' return except IOError: print "error:", str(sys.exc_value) return group_queue = [] if len(args.idlist) > 0: for i in set(args.idlist): if i >= len(self.cur_proj.groups) or i < -1: print 'error: group', i, 'does not exist' return for i in args.idlist: if i == -1: group_queue.append(core.CkgWaitScreen()) else: group_queue.append(self.cur_proj.groups[i]) else: group_queue = list(self.cur_proj.groups) if args.repeat != None: group_queue = list(group_queue * args.repeat) if args.priority != None: if not priority.available: print "error: setting priority not avaible on", sys.platform print "continuing..." else: if args.priority.isdigit(): args.priority = int(args.priority) try: priority.set(args.priority) except ValueError: print "error:", str(sys.exc_value) print "continuing..." if args.eyetrack and eyetracking.available: if not eyetracking.is_calibrated(): try: self.do_calibrate('',True) except eyetracking.EyetrackingError: print "error:", str(sys.exc_value) return - if len(path) > 0: - print "calibration file successfully loaded" try: self.cur_proj.display(fullscreen=args.fullscreen, logtime=args.logtime, logdur=args.logdur, sigser=args.sigser, sigpar=args.sigpar, fpbs=args.fpbs, phototest=args.phototest, eyetrack=args.eyetrack, etuser=args.etuser, etvideo=args.etvideo, group_queue=group_queue) except (IOError, NotImplementedError, eyetracking.EyetrackingError): print "error:", str(sys.exc_value) return if args.priority != None: try: priority.set('normal') except: pass export_parser = CmdParser(add_help=False, prog='export', description='''Exports animation as an image sequence (in a folder) to the specified directory.''') # export_parser.add_argument('--fmt', dest='export_fmt', # choices=core.EXPORT_FMTS, # help='image format for export') export_parser.add_argument('-n','--nofolder', dest='folder', action='store_false', help='''force images not to exported in a containing folder''') export_parser.add_argument('-r', '--repeat', metavar='N', type=int, help='''repeatedly export specified display groups N number of times''') export_parser.add_argument('duration', nargs='?', type=to_decimal, default='Infinity', help='''number of seconds of the animation that should be exported (default: as long as the entire animation)''') export_parser.add_argument('dir', nargs='?', default=os.getcwd(), help='''destination directory for export (default: current working directory)''') export_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''list of display groups to be exported in the specified order (default: order by id, i.e. group 0 is first)''') def help_export(self): self.__class__.export_parser.print_help() def do_export(self, line): """Exports animation an image sequence to the specified directory.""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.export_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.export_parser.print_usage() return if len(args.idlist) > 0: for i in set(args.idlist): if i >= len(self.cur_proj.groups) or i < 0: print 'error: group', i, 'does not exist' return group_queue = [self.cur_proj.groups[i] for i in args.idlist] else: group_queue = list(self.cur_proj.groups) if args.repeat != None: group_queue = list(group_queue * args.repeat) try: self.cur_proj.export(export_dir=args.dir, export_duration=args.duration, group_queue=group_queue, folder=args.folder) except IOError: print "error:", str(sys.exc_value) return except core.FrameOverflowError: print "warning:", str(sys.exc_value) print "Are you sure you want to continue?" while True: try: if self.__class__.yn_parse(raw_input()): self.cur_proj.export(export_dir=args.dir, export_duration=args.duration, group_queue=group_queue, export_fmt=None, folder=args.folder, force=True) break else: return except TypeError: print str(sys.exc_value) except EOFError: return print "Export done." mkblks_parser = CmdParser(add_help=False, prog='mkblks', description='''Generates randomized experimental blocks from display groups and saves each as a CSV file.''') mkblks_parser.add_argument('-n','--nofolder', dest='folder', action='store_false', help='''force block files not to be saved in a containing folder''') mkblks_parser.add_argument('-d','--dir', default=os.getcwd(), help='''where to save block files (default: current working directory)''') mkblks_parser.add_argument('length', type=int, help='''no. of repeated trials in a block''') mkblks_parser.add_argument('flags', nargs='?', default='', help='''flags passed to the display command that should be used when the block file is run (enclose in quotes and use '+' or '++' in place of '-' or '--')''') def help_mkblks(self): self.__class__.mkblks_parser.print_help() def do_mkblks(self, line): """Generates randomized experimental blocks from display groups.""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.mkblks_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.mkblks_parser.print_usage() return args.flags = args.flags.replace('+','-') try: disp_args = self.__class__.display_parser.\ parse_args(shlex.split(args.flags)) except CmdParserError: print "error: invalid flags to display command" print str(sys.exc_value) self.__class__.display_parser.print_usage() return try: self.cur_proj.mkblks(args.length, path=args.dir, folder=args.folder, flags=args.flags) except IOError: print "error:", str(sys.exc_value) return print "Experimental blocks generated." def do_calibrate(self, line, query=False): """Calibrate subject for eyetracking, or load a calibration file.""" if not eyetracking.available: print "error: eyetracking functionality not available" return if query: print "path to calibration file (leave empty for GUI tool):" try: path = raw_input().strip().strip('"\'') except EOFError: msg = "calibration cancelled" raise eyetracking.EyetrackingError(msg) else: path = line.strip().strip('"\'') if len(path) == 0: path = None if not eyetracking.is_source_ready(): # Select default source if none has been selected eyetracking.select_source() try: eyetracking.calibrate(path) except eyetracking.EyetrackingError: if query: raise else: print "error:", str(sys.exc_value) return if len(path) > 0: print "calibration file successfully loaded" def do_quit(self, line): """Quits the program.""" if self.save_check(): return return True def help_EOF(self): print "Typing {0} issues this command, which quits the program."\ .format(CMD_EOF_STRING) def do_EOF(self, line): """Typing Ctrl-D issues this command, which quits the program.""" print '\r' if self.save_check(): return return True def help_help(self): print 'Prints a list of commands.' print "Type 'help <topic>' for more details on each command." def default(self, line): command = line.split()[0] print \ "'{0}' is not a checkergen command.".format(command),\ "Type 'help' for a list of commands" diff --git a/src/core.py b/src/core.py index b23027e..1af042c 100755 --- a/src/core.py +++ b/src/core.py @@ -37,1024 +37,1026 @@ FIX_POS = (0, 0) FIX_RANGE = (20, 20) SANS_SERIF = ('Helvetica', 'Arial', 'FreeSans') def xml_get(parent, namespace, name, index=0): """Returns concatenated text node values inside an element.""" element = [node for node in parent.childNodes if node.localName == name and node.namespaceURI == namespace][index] strings = [] for node in element.childNodes: if node.nodeType == node.TEXT_NODE: strings.append(node.data) return ''.join(strings) def xml_set(document, parent, name, string): """Stores value as a text node in a new DOM element.""" element = document.createElement(name) parent.appendChild(element) text = document.createTextNode(string) element.appendChild(text) def xml_pretty_print(document, indent): """Hack to prettify minidom's not so pretty print.""" ugly_xml = document.toprettyxml(indent=indent) prettifier_re = re.compile('>\n\s+([^<>\s].*?)\n\s+</', re.DOTALL) pretty_xml = prettifier_re.sub('>\g<1></', ugly_xml) return pretty_xml class FileFormatError(ValueError): """Raised when correct file format/extension is not supplied.""" pass class FrameOverflowError(Exception): """Raised when more than MAX_EXPORT_FRAMES are going to be exported.""" pass class CkgProj: """Defines a checkergen project, with checkerboards and other settings.""" DEFAULTS = {'name': 'untitled', 'fps': 60, 'res': (800, 600), 'bg': (127, 127, 127), 'export_fmt': 'png', 'pre': 0, 'post': 0, 'cross_cols': ((0, 0, 0), (255, 0, 0)), 'cross_times': ('Infinity', 1)} def __init__(self, **keywords): """Initializes a new project, or loads it from a path. path -- if specified, ignore other arguments and load project from path name -- name of the project, always the same as the filename without the extension fps -- frames per second of the animation to be displayed res -- screen resolution / window size at which project will be displayed bg -- background color of the animation as a 3-tuple (R, G, B) export_fmt -- image format for animation to be exported as pre -- time in seconds a blank screen will be shown before any display groups post --time in seconds a blank screen will be shown after any display groups """ if 'path' in keywords.keys(): self.load(keywords['path']) return for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.groups = [] def __setattr__(self, name, value): # Type conversions if name == 'name': value = str(value) elif name in ['fps', 'pre', 'post']: value = to_decimal(value) elif name == 'res': if len(value) != 2: raise ValueError value = tuple([int(v) for v in value]) elif name == 'bg': if len(value) != 3: raise ValueError value = tuple([int(v) for v in value]) elif name == 'export_fmt': if value not in EXPORT_FMTS: msg = 'image format not recognized or supported' raise FileFormatError(msg) elif name == 'cross_cols': if len(value) != 2: raise ValueError for col in value: if len(col) != 3: raise ValueError value = tuple([tuple([int(c) for c in col]) for col in value]) elif name == 'cross_times': if len(value) != 2: raise ValueError value = tuple([to_decimal(x) for x in value]) # Store value self.__dict__[name] = value # Set dirty bit if name != '_dirty': self._dirty = True def add_group(self, group): """Append group to list and set dirty bit.""" self.groups.append(group) self._dirty = True return self.groups.index(group) def del_group(self, group): """Remove group to list and set dirty bit.""" self.groups.remove(group) self._dirty = True def add_shape_to_group(self, group, shape): """Add shape to group specified by id and set dirty bit.""" if group not in self.groups: raise ValueError group.shapes.append(shape) self._dirty = True return group.shapes.index(shape) def del_shape_from_group(self, group, shape): """Removes shape from group specified by id and set dirty bit.""" if group not in self.groups: raise ValueError group.shapes.remove(shape) self._dirty = True def set_group_attr(self, gid, name, value): """Set attribute of a group specified by id and set dirty bit.""" setattr(self.groups[gid], name, value) self._dirty = True def set_shape_attr(self, group, sid, name, value): """Set attribute of a shape specified by id and set dirty bit.""" if group not in self.groups: raise ValueError setattr(group.shapes[sid], name, value) self._dirty = True def is_dirty(self): return self._dirty def load(self, path): """Loads project from specified path.""" # Get project name from filename name, ext = os.path.splitext(os.path.basename(path)) if ext == '.{0}'.format(CKG_FMT): self.name = name else: msg = "path lacks '.{0}' extension".format(CKG_FMT) raise FileFormatError(msg) with open(path, 'r') as project_file: doc = minidom.parse(project_file) project = doc.documentElement vars_to_load = self.__class__.DEFAULTS.keys() # Name is not stored in project file vars_to_load.remove('name') for var in vars_to_load: try: value = eval(xml_get(project, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) self.groups = [] group_els = [node for node in project.childNodes if node.localName == 'group' and node.namespaceURI == XML_NAMESPACE] for group_el in group_els: new_group = CkgDisplayGroup() new_group.load(group_el) self.groups.append(new_group) self._dirty = False def save(self, path): """Saves project to specified path as an XML document.""" self.name, ext = os.path.splitext(os.path.basename(path)) if ext != '.{0}'.format(CKG_FMT): path = '{0}.{1}'.format(path, CKG_FMT) impl = minidom.getDOMImplementation() doc = impl.createDocument(XML_NAMESPACE, 'project', None) project = doc.documentElement # Hack below because minidom doesn't support namespaces properly project.setAttribute('xmlns', XML_NAMESPACE) vars_to_save = self.__class__.DEFAULTS.keys() # Name is not stored in project file vars_to_save.remove('name') for var in vars_to_save: xml_set(doc, project, var, repr(getattr(self, var))) for group in self.groups: group.save(doc, project) with open(path, 'w') as project_file: project_file.write(xml_pretty_print(doc,indent=' ')) self._dirty = False return path def mkblks(self, length, path=None, folder=True, flags=''): """Generates randomized experimental blocks from display groups. Each block is saved as a CSV file. length -- number of repeated trials within a block path -- directory in which experimental blocks will be saved folder -- blocks will be saved in a containing folder if true flags -- string of flags to be issued to the display command when block file is run """ if path == None: path = os.getcwd() if not os.path.isdir(path): msg = "specified directory does not exist" raise IOError(msg) if folder: path = os.path.join(path, self.name + BLOCK_DIR_SUFFIX) if not os.path.isdir(path): os.mkdir(path) group_ids = range(len(self.groups)) for n, sequence in enumerate(itertools.permutations(group_ids)): blkname = 'block{0}.csv'.format(repr(n).zfill(numdigits(length))) blkfile = open(os.path.join(path, blkname), 'wb') blkwriter = csv.writer(blkfile, dialect='excel-tab') blkwriter.writerow(['checkergen experimental block file']) blkwriter.writerow(['flags:', flags]) blkwriter.writerow(['repeats:', length]) blkwriter.writerow(['sequence:'] + list(sequence)) blkfile.close() @staticmethod def readblk(path): """Reads the information in a block file and returns it in a dict.""" if not os.path.isfile(path): msg = "specified file does not exist" raise IOError(msg) blkdict = dict() blkfile = open(path, 'rb') blkreader = csv.reader(blkfile, dialect='excel-tab') for n, row in enumerate(blkreader): if n == 1: blkdict['flags'] = row[1] elif n == 2: repeats = int(row[1]) elif n == 3: sequence = row[1:] sequence = [int(i) for i in sequence] blkfile.close() blkdict['idlist'] = ([-1] + sequence) * repeats return blkdict def display(self, fullscreen=False, logtime=False, logdur=False, sigser=False, sigpar=False, fpbs=0, phototest=False, eyetrack=False, etuser=False, etvideo=None, tryagain=0, trybreak=0, group_queue=[]): """Displays the project animation on the screen. fullscreen -- animation is displayed fullscreen if true, stretched to fit if necessary logtime -- timestamp of each frame is saved to a logfile if true logdur -- duration of each frame is saved to a logfile if true sigser -- send signals through serial port when each group is shown sigpar -- send signals through parallel port when each group is shown fpbs -- flips per board signal, i.e. number of shape color reversals (flips) that occur for a unique signal to be sent for that shape phototest -- draw white rectangle in topleft corner when each group is shown for photodiode to detect eyetrack -- use eyetracking to ensure subject is fixating on cross etuser -- if true, user gets to select eyetracking video source in GUI etvideo -- optional eyetracking video source file to use instead of live feed tryagain -- Append groups during which subject failed to fixated up to this number of times to the group queue trybreak -- Append a wait screen to the group queue every time after this many groups have been appended to the queue group_queue -- queue of groups to be displayed, defaults to order of groups in project (i.e. groups[0] first, etc.) """ # Create fixation crosses fix_crosses = [graphics.Cross([r/2 for r in self.res], (20, 20), col = cross_col) for cross_col in self.cross_cols] # Create test rectangle if phototest: test_rect = graphics.Rect((0, self.res[1]), [r/8 for r in self.res], anchor='topleft') # Set-up groups and variables that control their display if group_queue == []: group_queue = list(self.groups) cur_group = None cur_id = -1 flipped = 0 flip_id = -1 groups_duration = sum([group.duration() for group in group_queue]) groups_start = self.pre * self.fps groups_stop = (self.pre + groups_duration) * self.fps disp_end = (self.pre + groups_duration + self.post) * self.fps if groups_start == 0 and groups_stop > 0: groups_visible = True else: groups_visible = False count = 0 # Initialize ports if sigser: if not signals.available['serial']: msg = 'serial port functionality not available' raise NotImplementedError(msg) if sigpar: if not signals.available['parallel']: msg = 'parallel port functionality not available' raise NotImplementedError(msg) signals.init(sigser, sigpar) # Initialize eyetracking if eyetrack: if not eyetracking.available: msg = 'eyetracking functionality not available' raise NotImplementedError(msg) fixated = False old_fixated = False tracked = False old_tracked = False cur_fix_fail = False fix_fail_queue = [] eyetracking.select_source(etuser, etvideo) eyetracking.start() # Stretch to fit screen only if project res does not equal screen res scaling = False if fullscreen: window = pyglet.window.Window(fullscreen=True, visible=False) if (window.width, window.height) != self.res: scaling = True else: window = pyglet.window.Window(*self.res, visible=False) # Set up KeyStateHandler to handle keyboard input keystates = pyglet.window.key.KeyStateHandler() window.push_handlers(keystates) # Create framebuffer object for drawing unscaled scene if scaling: canvas = pyglet.image.Texture.create(*self.res) fbo = graphics.Framebuffer(canvas) fbo.start_render() graphics.set_clear_color(self.bg) fbo.clear() fbo.end_render() # Clear window and make visible window.switch_to() graphics.set_clear_color(self.bg) window.clear() window.set_visible() # Initialize logging variables if logtime and logdur: logstring = '' stamp = Timer() dur = Timer() stamp.start() dur.start() elif logtime or logdur: logstring = '' timer = Timer() timer.start() # Main loop while not window.has_exit and count < disp_end: # Clear canvas if scaling: fbo.start_render() fbo.clear() else: window.clear() # Assume no change to group visibility flipped = 0 signals.set_null() # Manage groups when they are on_screen if groups_visible: # Send special signal if waitscreen ends if isinstance(cur_group, CkgWaitScreen): if cur_group.over: signals.set_user_start() cur_group = None elif cur_group != None: # Check whether group changes in visibility if cur_group.visible != cur_group.old_visible: flip_id = self.groups.index(cur_group) if cur_group.visible: flipped = 1 elif cur_group.old_visible: flipped = -1 # Check if current group is over if cur_group.over: cur_group = None # Get next group from queue if cur_group == None: cur_id += 1 if cur_id >= len(group_queue): groups_visible = False else: cur_group = group_queue[cur_id] cur_group.reset() if eyetrack: cur_fix_fail = False if cur_group.visible: flip_id = self.groups.index(cur_group) flipped = 1 # Draw and then update group if cur_group != None: cur_group.draw() cur_group.update(fps=self.fps, fpbs=fpbs, keystates=keystates) # Send signals upon group visibility change if flipped == 1: signals.set_group_start(flip_id) # Draw test rectangle if phototest: test_rect.draw() elif flipped == -1: signals.set_group_stop(flip_id) if eyetrack: # First check if eye is being tracked and send signals old_tracked = tracked tracked = eyetracking.is_tracked() if tracked: if not old_tracked: # Send signal if eye starts being tracked signals.set_track_start() else: if old_tracked: # Send signal if eye stops being tracked signals.set_track_stop() # Next check for fixation old_fixated = fixated fixated = eyetracking.is_fixated(FIX_POS, FIX_RANGE) if fixated: # Draw normal cross color if fixating fix_crosses[0].draw() if not old_fixated: # Send signal if fixation starts signals.set_fix_start() else: # Draw alternative cross color if not fixating fix_crosses[1].draw() if old_fixated: # Send signal if fixation stops signals.set_fix_stop() # Take note of which groups in which fixation failed if not cur_fix_fail and cur_group.visible and\ (tracked and not fixated): cur_fix_fail = True + if len(fix_fail_queue) == 0 and trybreak > 0: + group_queue.append(CkgWaitScreen()) fix_fail_queue.append(self.groups.index(cur_group)) # Append failed group to group queue if tryagain > 0: group_queue.append(cur_group) groups_stop += cur_group.duration() * self.fps disp_end += cur_group.duration() * self.fps # Insert waitscreen every tryagainbreak failed groups if trybreak > 0: if len(fix_fail_queue) % trybreak == 0: group_queue.append(CkgWaitScreen()) tryagain -= 1 # Change cross color based on time if eyetracking is not enabled if not eyetrack: if (count % (sum(self.cross_times) * self.fps) < self.cross_times[0] * self.fps): fix_crosses[0].draw() else: fix_crosses[1].draw() # Increment count and set whether groups should be shown if not isinstance(cur_group, CkgWaitScreen): count += 1 if groups_start <= count < groups_stop: groups_visible = True else: groups_visible = False # Blit canvas to screen if necessary if scaling: fbo.end_render() window.switch_to() canvas.blit(0, 0) window.dispatch_events() window.flip() # Make sure everything has been drawn pyglet.gl.glFinish() # Append time information to log string if logtime and logdur: logstring = '\n'.join([logstring, str(stamp.elapsed())]) logstring = '\t'.join([logstring, str(dur.restart())]) elif logtime: logstring = '\n'.join([logstring, str(timer.elapsed())]) elif logdur: logstring = '\n'.join([logstring, str(timer.restart())]) # Send signals ASAP after flip signals.send(sigser, sigpar) # Log when signals are sent if logtime or logdur: if flipped != 0 and (sigser or sigpar): sigmsg = '{0} sent'.format(signals.STATE) logstring = '\t'.join([logstring, sigmsg]) # Clean up if eyetrack: eyetracking.stop() window.close() if scaling: fbo.delete() del canvas signals.quit(sigser, sigpar) # Write log string to file if logtime or logdur: filename = '{0}.log'.format(self.name) with open(filename, 'w') as logfile: logfile.write(logstring) # Return list of ids of failed groups if eyetrack: return fix_fail_queue def export(self, export_dir, export_duration, group_queue=[], export_fmt=None, folder=True, force=False): if not os.path.isdir(export_dir): msg = 'export path is not a directory' raise IOError(msg) if export_fmt == None: export_fmt = self.export_fmt # Set-up groups and variables that control their display if group_queue == []: group_queue = list(self.groups) cur_group = None cur_id = -1 groups_duration = sum([group.duration() for group in group_queue]) groups_start = self.pre * self.fps groups_stop = (self.pre + groups_duration) * self.fps disp_end = (self.pre + groups_duration + self.post) * self.fps if groups_start == 0 and groups_stop > 0: groups_visible = True else: groups_visible = False count = 0 # Limit export duration to display duration frames = export_duration * self.fps frames = min(frames, disp_end) # Warn user if a lot of frames will be exported if frames > MAX_EXPORT_FRAMES and not force: msg = 'very large number ({0}) of frames to be exported'.\ format(frames) raise FrameOverflowError(msg) # Create folder to store images if necessary if folder: export_dir = os.path.join(export_dir, self.name + EXPORT_DIR_SUFFIX) if not os.path.isdir(export_dir): os.mkdir(export_dir) # Create fixation crosses fix_crosses = [graphics.Cross([r/2 for r in self.res], (20, 20), col = cross_col) for cross_col in self.cross_cols] # Set up canvas and framebuffer object canvas = pyglet.image.Texture.create(*self.res) fbo = graphics.Framebuffer(canvas) fbo.start_render() graphics.set_clear_color(self.bg) fbo.clear() # Main loop while count < frames: fbo.clear() if groups_visible: # Check if current group is over if cur_group != None: if cur_group.over: cur_group = None # Get next group from queue if cur_group == None: cur_id += 1 if cur_id >= len(group_queue): groups_visible = False else: cur_group = group_queue[cur_id] cur_group.reset() # Draw and then update group if cur_group != None: cur_group.draw() cur_group.update(fps=self.fps, fpbs=0) # Draw fixation cross based on current count if (count % (sum(self.cross_times) * self.fps) < self.cross_times[0] * self.fps): fix_crosses[0].draw() else: fix_crosses[1].draw() # Save current frame to file savepath = \ os.path.join(export_dir, '{0}{2}.{1}'. format(self.name, export_fmt, repr(count).zfill(numdigits(frames-1)))) canvas.save(savepath) # Increment count and set whether groups should be shown count += 1 if groups_start <= count < groups_stop: groups_visible = True else: groups_visible = False fbo.delete() class CkgDisplayGroup: DEFAULTS = {'pre': 0, 'disp': 'Infinity', 'post': 0} def __init__(self, **keywords): """Create a new group of shapes to be displayed together. pre -- time in seconds a blank screen is shown before shapes in group are displayed disp -- time in seconds the shapes in the group are displayed, negative numbers result in shapes being displayed forever post -- time in seconds a blank screen is shown after shapes in group are displayed """ for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.shapes = [] self.reset() def __setattr__(self, name, value): if name in self.__class__.DEFAULTS: value = to_decimal(value) self.__dict__[name] = value def duration(self): """Returns total duration of display group.""" return self.pre + self.disp + self.post def reset(self): """Resets internal count and all contained shapes.""" self._count = 0 self._start = self.pre self._stop = self.pre + self.disp self._end = self.pre + self.disp + self.post self.over = False self.old_visible = False if self._start == 0 and self._stop > 0: self.visible = True else: self.visible = False if self._end == 0: self.over = True self._flip_count = [0] * len(self.shapes) for shape in self.shapes: shape.reset() def draw(self, lazy=False): """Draws all contained shapes during the appropriate interval.""" if self.visible: for shape in self.shapes: if lazy: shape.lazydraw() else: shape.draw() def update(self, **keywords): """Increments internal count, makes group visible when appropriate. fps -- refresh rate of the display in frames per second fpbs -- flips per board signal, i.e. number of shape color reversals (flips) that occur for a unique signal to be sent for that shape """ fps = keywords['fps'] fpbs = keywords['fpbs'] if self.visible: # Set triggers to be sent if fpbs > 0: for n, shape in enumerate(self.shapes): if shape.flipped: self._flip_count[n] += 1 if self._flip_count[n] >= fpbs: signals.set_board_flip(n) self._flip_count[n] = 0 # Update contained shapes for shape in self.shapes: shape.update(fps) # Increment count and set flags for the next frame self._count += 1 self.old_visible = self.visible if (self._start * fps) <= self._count < (self._stop * fps): self.visible = True else: self.visible = False if self._count >= (self._end * fps): self.over = True else: self.over = False def save(self, document, parent): """Saves group in specified XML document as child of parent.""" group_el = document.createElement('group') parent.appendChild(group_el) for var in self.__class__.DEFAULTS.keys(): xml_set(document, group_el, var, repr(getattr(self, var))) for shape in self.shapes: shape.save(document, group_el) def load(self, element): """Loads group from XML DOM element.""" for var in self.__class__.DEFAULTS.keys(): try: value = eval(xml_get(element, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) shape_els = [node for node in element.childNodes if node.localName == 'shape' and node.namespaceURI == XML_NAMESPACE] for shape_el in shape_els: # TODO: Make load code shape-agnostic new_shape = CheckerBoard() new_shape.load(shape_el) self.shapes.append(new_shape) class CkgWaitScreen(CkgDisplayGroup): """Dummy display group, waits for user input to proceed.""" DEFAULTS = {'g_keys': (pyglet.window.key.SPACE,), 'r_keys': (pyglet.window.key.NUM_ENTER, pyglet.window.key.ENTER), 'res': CkgProj.DEFAULTS['res'], 'g_info': "the experiment will start soon", 'r_info': "press enter when ready", 'font_color': (0, 0, 0, 255), 'font_size': 16} def __init__(self, **keywords): """Create an informative waitscreen that proceeds after user input.""" for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.g_label = pyglet.text.Label(self.g_info, font_name=SANS_SERIF, font_size=self.font_size, color=self.font_color, bold=True, x=self.res[0]//2, y=self.res[1]*16//30, anchor_x='center', anchor_y='center') self.r_label = pyglet.text.Label(self.r_info, font_name=SANS_SERIF, font_size=self.font_size, color=self.font_color, bold=True, x=self.res[0]//2, y=self.res[1]*16//30, anchor_x='center', anchor_y='center') self.reset() def __setattr__(self, name, value): self.__dict__[name] = value def duration(self): """Returns zero since wait times are arbitrary.""" return to_decimal(0) def reset(self): """Resets some flags.""" self.visible = False self.old_visible = False self.ready = False self.over = False def draw(self): """Draw informative text.""" if not self.ready: self.r_label.draw() else: self.g_label.draw() def update(self, **keywords): """Checks for keypress, sends signal upon end.""" keystates = keywords['keystates'] if self.r_keys == None: if max([keystates[key] for key in self.g_keys]): self.ready = True self.over = True elif not self.ready: if max([keystates[key] for key in self.r_keys]): self.ready = True else: if max([keystates[key] for key in self.g_keys]): self.over = True class CheckerShape: # Abstract class, to be implemented. pass class CheckerDisc(CheckerShape): # Circular checker pattern, to be implemented pass class CheckerBoard(CheckerShape): DEFAULTS = {'dims': (5, 5), 'init_unit': (30, 30), 'end_unit': (50, 50), 'position': (0, 0), 'anchor': 'bottomleft', 'cols': ((0, 0, 0), (255, 255, 255)), 'freq': 1, 'phase': 0} # TODO: Reimplement mid/center anchor functionality in cool new way def __init__(self, **keywords): for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.reset() def __setattr__(self, name, value): # Type conversions if name == 'dims': if len(value) != 2: raise ValueError value = tuple([int(x) for x in value]) elif name in ['init_unit', 'end_unit', 'position']: if len(value) != 2: raise ValueError value = tuple([to_decimal(x) for x in value]) elif name == 'anchor': if value not in graphics.locations.keys(): raise ValueError elif name == 'cols': if len(value) != 2: raise ValueError for col in value: if len(col) != 3: raise ValueError value = tuple([tuple([int(c) for c in col]) for col in value]) elif name in ['freq', 'phase']: value = to_decimal(value) # Store value self.__dict__[name] = value # Recompute if necessary if name in ['dims', 'init_unit', 'end_unit', 'position', 'anchor','cols']: self._computed = False def save(self, document, parent): """Saves board in specified XML document as child of parent.""" board_el = document.createElement('shape') board_el.setAttribute('type', 'board') parent.appendChild(board_el) for var in self.__class__.DEFAULTS.keys(): xml_set(document, board_el, var, repr(getattr(self, var))) def load(self, element): """Loads group from XML DOM element.""" for var in self.__class__.DEFAULTS.keys(): try: value = eval(xml_get(element, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) def reset(self, new_phase=None): """Resets checkerboard animation back to initial phase.""" if new_phase == None: new_phase = self.phase self._cur_phase = new_phase self._prev_phase = new_phase self.flipped = False self._first_draw = True if not self._computed: self.compute() def update(self, fps): """Increase the current phase of the checkerboard animation.""" self._prev_phase = self._cur_phase if self.freq != 0: degs_per_frame = 360 * self.freq / fps self._cur_phase += degs_per_frame if self._cur_phase >= 360: self._cur_phase %= 360 cur_n = int(self._cur_phase // 180) prev_n = int(self._prev_phase // 180) if cur_n != prev_n: self.flipped = True else: self.flipped = False def compute(self): """Computes a model of the checkerboard for drawing later.""" # Create batches to store model self._batches = [pyglet.graphics.Batch() for n in range(2)] # Calculate size of checkerboard in pixels self._size = tuple([(y1 + y2) / 2 * n for y1, y2, n in zip(self.init_unit, self.end_unit, self.dims)]) # Calculate unit size gradient unit_grad = tuple([(2 if (flag == 0) else 1) * (y2 - y1) / n for y1, y2, n, flag in zip(self.init_unit, self.end_unit, self.dims, graphics.locations[self.anchor])]) # Set initial values if PRERENDER_TO_TEXTURE: init_pos = [(1 - a)* s/to_decimal(2) for s, a in zip(self._size, graphics.locations[self.anchor])] else: init_pos = list(self.position) init_unit = [c + m/2 for c, m in zip(self.init_unit, unit_grad)] cur_unit = list(init_unit) cur_unit_pos = list(init_pos) # Add unit cells to batches in nested for loop for j in range(self.dims[1]): for i in range(self.dims[0]): cur_unit_rect = graphics.Rect(cur_unit_pos, cur_unit, anchor=self.anchor) cur_unit_rect.col = self.cols[(i + j) % 2] cur_unit_rect.add_to_batch(self._batches[0]) cur_unit_rect.col = self.cols[(i + j + 1) % 2] cur_unit_rect.add_to_batch(self._batches[1]) # Increase x values diff --git a/src/eyetracking.py b/src/eyetracking.py index 0063b97..982780a 100644 --- a/src/eyetracking.py +++ b/src/eyetracking.py @@ -1,133 +1,138 @@ """Provides support for CRS VideoEyetracker Toolbox.""" import os.path try: import win32com.client available = True except ImportError: available = False # COM ProgID of the Toolbox ProgID = "crsVET.VideoEyeTracker" RecordName = "etResultSet" # VET application object VET = None class EyetrackingError(Exception): """Raised when something goes wrong with VET.""" pass if available: # Try dispatching object, else unavailable try: + from win32com.client import gencache + # Ensure makepy module is generated + gencache.EnsureModule('{248DBF0C-A874-4032-82CE-DC5B307BB6E7}', + 0, 3, 11) VET = win32com.client.Dispatch(ProgID) DummyResultSet = win32com.client.Record(RecordName, VET) except: available = False if available: # For easier access to constants and standardization with MATLAB interface CRS = win32com.client.constants def select_source(user_select = False, path = None): if user_select: if not VET.SelectVideoSource(CRS.vsUserSelect, ''): msg = 'could not select video source' raise EyetrackingError(msg) elif path != None: # Open from file if not VET.SelectVideoSource(CRS.vsFile, path): msg = 'could not use path as video source' raise EyetrackingError(msg) else: # Default to 250 Hz High Speed Camera if not VET.SelectVideoSource(CRS.vsHighSpeedCamera250, ''): msg = 'could not select video source' raise EyetrackingError(msg) def is_source_ready(): """Returns true if a video source has been selected.""" if VET.VideoSourceType == 0: return False else: return True def show_camera(): VET.CreateCameraScreen(0) def quit_camera(): VET.DestroyCameraScreen() - def setup(viewing_distance, screen_dims, - fixation_period = None, fixation_range = None): + def setup(viewing_distance=None, screen_dims=None, + fixation_period=None, fixation_range=None): """Calibrates the display and sets fixation properties.""" - if len(screen_dims) != 2: - msg = 'screen_dims must be a 2-tuple' - raise ValueError(msg) - VET.SetDeviceParameters(CRS.deUser, viewing_distance, - screen_dims[0], screen_dims[1]) + if viewing_distance != None and screen_dims != None: + if len(screen_dims) != 2: + msg = 'screen_dims must be a 2-tuple' + raise ValueError(msg) + VET.SetDeviceParameters(CRS.deUser, viewing_distance, + screen_dims[0], screen_dims[1]) if fixation_period != None: VET.FixationPeriod = fixation_period if fixation_range != None: VET.FixationRange = fixation_range def calibrate(path = None): """Calibrate the subject. Optionally supply a path with no spaces to a calibration file to load.""" if path == None: if not VET.Calibrate(): msg = 'calibration failed' raise EyetrackingError(msg) else: if not os.path.isfile(path): msg = 'specified file does not exist' raise EyetrackingError(msg) if not VET.LoadCalibrationFile(path): msg = 'file could not be loaded' raise EyetrackingError(msg) def is_calibrated(): if VET.CalibrationStatus()[0] != 0: return True else: return False def start(): """Start tracking the eye.""" if VET.CalibrationStatus()[0] == 0: msg = 'subject not yet calibrated' raise EyetrackingError(msg) VET.ClearDataBuffer() VET.StartTracking() def stop(): """Stop tracking the eye.""" VET.StopTracking() def is_tracked(): """Returns true if the eye is being tracked.""" - data = VET.GetLatestEyePosition(results)[1] + data = VET.GetLatestEyePosition(DummyResultSet)[1] return data.Tracked def is_fixated(fix_pos, fix_range): """Checks whether subject is fixating on specificied location. fix_pos -- (x, y) position of desired fixation location in mm from center of screen fix_range -- (width, height) of box surrounding fix_pos within which fixation is allowed (in mm) """ if VET.CalibrationStatus()[0] == 0: msg = 'subject not yet calibrated' raise EyetrackingError(msg) if VET.FixationLocation.Fixation: xdiff = abs(VET.FixationLocation.Xposition - fix_pos[0]) ydiff = abs(VET.FixationLocation.Yposition - fix_pos[1]) if (xdiff <= fix_range[0]/2) and (ydiff <= fix_range[1]/2): return True return False
ztangent/checkergen
41951a631596775a39a6be9013cc06b0fb70fa17
is_tracked now works as intended, display can repeat failed groups/trials
diff --git a/src/core.py b/src/core.py index 171aafe..b23027e 100755 --- a/src/core.py +++ b/src/core.py @@ -1,1083 +1,1115 @@ """Contains core functionality of checkergen. Errors and Exceptions: FileFormatError FrameOverflowError Classes: CkgProj -- A checkergen project, contains settings and CkgDisplayGroups. CkgDisplayGroup -- A set of CheckerShapes to be displayed simultaneously. CheckerShapes -- Abstract checkered shape class CheckerBoard -- A (distorted) checkerboard pattern, can color-flip. """ import os import sys import re import csv import itertools from xml.dom import minidom import pyglet import graphics import signals import eyetracking from utils import * CKG_FMT = 'ckg' XML_NAMESPACE = 'http://github.com/ZOMGxuan/checkergen' MAX_EXPORT_FRAMES = 100000 PRERENDER_TO_TEXTURE = False EXPORT_FMTS = ['png'] EXPORT_DIR_SUFFIX = '-anim' BLOCK_DIR_SUFFIX = '-blks' FIX_POS = (0, 0) FIX_RANGE = (20, 20) SANS_SERIF = ('Helvetica', 'Arial', 'FreeSans') def xml_get(parent, namespace, name, index=0): """Returns concatenated text node values inside an element.""" element = [node for node in parent.childNodes if node.localName == name and node.namespaceURI == namespace][index] strings = [] for node in element.childNodes: if node.nodeType == node.TEXT_NODE: strings.append(node.data) return ''.join(strings) def xml_set(document, parent, name, string): """Stores value as a text node in a new DOM element.""" element = document.createElement(name) parent.appendChild(element) text = document.createTextNode(string) element.appendChild(text) def xml_pretty_print(document, indent): """Hack to prettify minidom's not so pretty print.""" ugly_xml = document.toprettyxml(indent=indent) prettifier_re = re.compile('>\n\s+([^<>\s].*?)\n\s+</', re.DOTALL) pretty_xml = prettifier_re.sub('>\g<1></', ugly_xml) return pretty_xml class FileFormatError(ValueError): """Raised when correct file format/extension is not supplied.""" pass class FrameOverflowError(Exception): """Raised when more than MAX_EXPORT_FRAMES are going to be exported.""" pass class CkgProj: """Defines a checkergen project, with checkerboards and other settings.""" DEFAULTS = {'name': 'untitled', 'fps': 60, 'res': (800, 600), 'bg': (127, 127, 127), 'export_fmt': 'png', 'pre': 0, 'post': 0, 'cross_cols': ((0, 0, 0), (255, 0, 0)), 'cross_times': ('Infinity', 1)} def __init__(self, **keywords): """Initializes a new project, or loads it from a path. path -- if specified, ignore other arguments and load project from path name -- name of the project, always the same as the filename without the extension fps -- frames per second of the animation to be displayed res -- screen resolution / window size at which project will be displayed bg -- background color of the animation as a 3-tuple (R, G, B) export_fmt -- image format for animation to be exported as pre -- time in seconds a blank screen will be shown before any display groups post --time in seconds a blank screen will be shown after any display groups """ if 'path' in keywords.keys(): self.load(keywords['path']) return for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.groups = [] def __setattr__(self, name, value): # Type conversions if name == 'name': value = str(value) elif name in ['fps', 'pre', 'post']: value = to_decimal(value) elif name == 'res': if len(value) != 2: raise ValueError value = tuple([int(v) for v in value]) elif name == 'bg': if len(value) != 3: raise ValueError value = tuple([int(v) for v in value]) elif name == 'export_fmt': if value not in EXPORT_FMTS: msg = 'image format not recognized or supported' raise FileFormatError(msg) elif name == 'cross_cols': if len(value) != 2: raise ValueError for col in value: if len(col) != 3: raise ValueError value = tuple([tuple([int(c) for c in col]) for col in value]) elif name == 'cross_times': if len(value) != 2: raise ValueError value = tuple([to_decimal(x) for x in value]) # Store value self.__dict__[name] = value # Set dirty bit if name != '_dirty': self._dirty = True def add_group(self, group): """Append group to list and set dirty bit.""" self.groups.append(group) self._dirty = True return self.groups.index(group) def del_group(self, group): """Remove group to list and set dirty bit.""" self.groups.remove(group) self._dirty = True def add_shape_to_group(self, group, shape): """Add shape to group specified by id and set dirty bit.""" if group not in self.groups: raise ValueError group.shapes.append(shape) self._dirty = True return group.shapes.index(shape) def del_shape_from_group(self, group, shape): """Removes shape from group specified by id and set dirty bit.""" if group not in self.groups: raise ValueError group.shapes.remove(shape) self._dirty = True def set_group_attr(self, gid, name, value): """Set attribute of a group specified by id and set dirty bit.""" setattr(self.groups[gid], name, value) self._dirty = True def set_shape_attr(self, group, sid, name, value): """Set attribute of a shape specified by id and set dirty bit.""" if group not in self.groups: raise ValueError setattr(group.shapes[sid], name, value) self._dirty = True def is_dirty(self): return self._dirty def load(self, path): """Loads project from specified path.""" # Get project name from filename name, ext = os.path.splitext(os.path.basename(path)) if ext == '.{0}'.format(CKG_FMT): self.name = name else: msg = "path lacks '.{0}' extension".format(CKG_FMT) raise FileFormatError(msg) with open(path, 'r') as project_file: doc = minidom.parse(project_file) project = doc.documentElement vars_to_load = self.__class__.DEFAULTS.keys() # Name is not stored in project file vars_to_load.remove('name') for var in vars_to_load: try: value = eval(xml_get(project, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) self.groups = [] group_els = [node for node in project.childNodes if node.localName == 'group' and node.namespaceURI == XML_NAMESPACE] for group_el in group_els: new_group = CkgDisplayGroup() new_group.load(group_el) self.groups.append(new_group) self._dirty = False def save(self, path): """Saves project to specified path as an XML document.""" self.name, ext = os.path.splitext(os.path.basename(path)) if ext != '.{0}'.format(CKG_FMT): path = '{0}.{1}'.format(path, CKG_FMT) impl = minidom.getDOMImplementation() doc = impl.createDocument(XML_NAMESPACE, 'project', None) project = doc.documentElement # Hack below because minidom doesn't support namespaces properly project.setAttribute('xmlns', XML_NAMESPACE) vars_to_save = self.__class__.DEFAULTS.keys() # Name is not stored in project file vars_to_save.remove('name') for var in vars_to_save: xml_set(doc, project, var, repr(getattr(self, var))) for group in self.groups: group.save(doc, project) with open(path, 'w') as project_file: project_file.write(xml_pretty_print(doc,indent=' ')) self._dirty = False return path def mkblks(self, length, path=None, folder=True, flags=''): """Generates randomized experimental blocks from display groups. Each block is saved as a CSV file. length -- number of repeated trials within a block path -- directory in which experimental blocks will be saved folder -- blocks will be saved in a containing folder if true flags -- string of flags to be issued to the display command when block file is run """ if path == None: path = os.getcwd() if not os.path.isdir(path): msg = "specified directory does not exist" raise IOError(msg) if folder: path = os.path.join(path, self.name + BLOCK_DIR_SUFFIX) if not os.path.isdir(path): os.mkdir(path) group_ids = range(len(self.groups)) for n, sequence in enumerate(itertools.permutations(group_ids)): blkname = 'block{0}.csv'.format(repr(n).zfill(numdigits(length))) blkfile = open(os.path.join(path, blkname), 'wb') blkwriter = csv.writer(blkfile, dialect='excel-tab') blkwriter.writerow(['checkergen experimental block file']) blkwriter.writerow(['flags:', flags]) blkwriter.writerow(['repeats:', length]) blkwriter.writerow(['sequence:'] + list(sequence)) blkfile.close() @staticmethod def readblk(path): """Reads the information in a block file and returns it in a dict.""" if not os.path.isfile(path): msg = "specified file does not exist" raise IOError(msg) blkdict = dict() blkfile = open(path, 'rb') blkreader = csv.reader(blkfile, dialect='excel-tab') for n, row in enumerate(blkreader): if n == 1: blkdict['flags'] = row[1] elif n == 2: repeats = int(row[1]) elif n == 3: sequence = row[1:] sequence = [int(i) for i in sequence] blkfile.close() blkdict['idlist'] = ([-1] + sequence) * repeats return blkdict def display(self, fullscreen=False, logtime=False, logdur=False, sigser=False, sigpar=False, fpbs=0, phototest=False, - eyetrack=False, etuser=False, etvideo=None, group_queue=[]): + eyetrack=False, etuser=False, etvideo=None, + tryagain=0, trybreak=0, group_queue=[]): """Displays the project animation on the screen. fullscreen -- animation is displayed fullscreen if true, stretched to fit if necessary logtime -- timestamp of each frame is saved to a logfile if true logdur -- duration of each frame is saved to a logfile if true sigser -- send signals through serial port when each group is shown sigpar -- send signals through parallel port when each group is shown fpbs -- flips per board signal, i.e. number of shape color reversals (flips) that occur for a unique signal to be sent for that shape phototest -- draw white rectangle in topleft corner when each group is shown for photodiode to detect eyetrack -- use eyetracking to ensure subject is fixating on cross etuser -- if true, user gets to select eyetracking video source in GUI etvideo -- optional eyetracking video source file to use instead of live feed + + tryagain -- Append groups during which subject failed to fixated up to + this number of times to the group queue + + trybreak -- Append a wait screen to the group queue every time + after this many groups have been appended to the queue group_queue -- queue of groups to be displayed, defaults to order of groups in project (i.e. groups[0] first, etc.) """ # Create fixation crosses fix_crosses = [graphics.Cross([r/2 for r in self.res], (20, 20), col = cross_col) for cross_col in self.cross_cols] # Create test rectangle if phototest: test_rect = graphics.Rect((0, self.res[1]), [r/8 for r in self.res], anchor='topleft') # Set-up groups and variables that control their display if group_queue == []: group_queue = list(self.groups) cur_group = None cur_id = -1 flipped = 0 flip_id = -1 groups_duration = sum([group.duration() for group in group_queue]) groups_start = self.pre * self.fps groups_stop = (self.pre + groups_duration) * self.fps disp_end = (self.pre + groups_duration + self.post) * self.fps if groups_start == 0 and groups_stop > 0: groups_visible = True else: groups_visible = False count = 0 # Initialize ports if sigser: if not signals.available['serial']: msg = 'serial port functionality not available' raise NotImplementedError(msg) if sigpar: if not signals.available['parallel']: msg = 'parallel port functionality not available' raise NotImplementedError(msg) signals.init(sigser, sigpar) # Initialize eyetracking if eyetrack: if not eyetracking.available: msg = 'eyetracking functionality not available' raise NotImplementedError(msg) - fixating = False - old_fixating = False - tracking = False - old_tracking = False + fixated = False + old_fixated = False + tracked = False + old_tracked = False + cur_fix_fail = False + fix_fail_queue = [] eyetracking.select_source(etuser, etvideo) eyetracking.start() # Stretch to fit screen only if project res does not equal screen res scaling = False if fullscreen: window = pyglet.window.Window(fullscreen=True, visible=False) if (window.width, window.height) != self.res: scaling = True else: window = pyglet.window.Window(*self.res, visible=False) # Set up KeyStateHandler to handle keyboard input keystates = pyglet.window.key.KeyStateHandler() window.push_handlers(keystates) # Create framebuffer object for drawing unscaled scene if scaling: canvas = pyglet.image.Texture.create(*self.res) fbo = graphics.Framebuffer(canvas) fbo.start_render() graphics.set_clear_color(self.bg) fbo.clear() fbo.end_render() # Clear window and make visible window.switch_to() graphics.set_clear_color(self.bg) window.clear() window.set_visible() # Initialize logging variables if logtime and logdur: logstring = '' stamp = Timer() dur = Timer() stamp.start() dur.start() elif logtime or logdur: logstring = '' timer = Timer() timer.start() # Main loop while not window.has_exit and count < disp_end: # Clear canvas if scaling: fbo.start_render() fbo.clear() else: window.clear() # Assume no change to group visibility flipped = 0 signals.set_null() # Manage groups when they are on_screen if groups_visible: # Send special signal if waitscreen ends if isinstance(cur_group, CkgWaitScreen): if cur_group.over: signals.set_user_start() cur_group = None elif cur_group != None: # Check whether group changes in visibility if cur_group.visible != cur_group.old_visible: flip_id = self.groups.index(cur_group) if cur_group.visible: flipped = 1 elif cur_group.old_visible: flipped = -1 # Check if current group is over if cur_group.over: cur_group = None # Get next group from queue if cur_group == None: cur_id += 1 if cur_id >= len(group_queue): groups_visible = False else: cur_group = group_queue[cur_id] cur_group.reset() - if not isinstance(cur_group, CkgWaitScreen): - if cur_group.visible: - flip_id = cur_id - flipped = 1 + if eyetrack: + cur_fix_fail = False + if cur_group.visible: + flip_id = self.groups.index(cur_group) + flipped = 1 # Draw and then update group if cur_group != None: cur_group.draw() cur_group.update(fps=self.fps, fpbs=fpbs, keystates=keystates) # Send signals upon group visibility change if flipped == 1: signals.set_group_start(flip_id) # Draw test rectangle if phototest: test_rect.draw() elif flipped == -1: signals.set_group_stop(flip_id) if eyetrack: - # First check if tracking and send signals - old_tracking = tracking - tracking = eyetracking.is_tracking() - if tracking: - if not old_tracking: - # Send signal if tracking starts + # First check if eye is being tracked and send signals + old_tracked = tracked + tracked = eyetracking.is_tracked() + if tracked: + if not old_tracked: + # Send signal if eye starts being tracked signals.set_track_start() else: - if old_tracking: - # Send signal if tracking stops + if old_tracked: + # Send signal if eye stops being tracked signals.set_track_stop() # Next check for fixation - old_fixating = fixating - fixating = eyetracking.fixating(FIX_POS, FIX_RANGE) - if fixating: + old_fixated = fixated + fixated = eyetracking.is_fixated(FIX_POS, FIX_RANGE) + if fixated: # Draw normal cross color if fixating fix_crosses[0].draw() - if not old_fixating: + if not old_fixated: # Send signal if fixation starts signals.set_fix_start() else: # Draw alternative cross color if not fixating fix_crosses[1].draw() - if old_fixating: + if old_fixated: # Send signal if fixation stops signals.set_fix_stop() + # Take note of which groups in which fixation failed + if not cur_fix_fail and cur_group.visible and\ + (tracked and not fixated): + cur_fix_fail = True + fix_fail_queue.append(self.groups.index(cur_group)) + # Append failed group to group queue + if tryagain > 0: + group_queue.append(cur_group) + groups_stop += cur_group.duration() * self.fps + disp_end += cur_group.duration() * self.fps + # Insert waitscreen every tryagainbreak failed groups + if trybreak > 0: + if len(fix_fail_queue) % trybreak == 0: + group_queue.append(CkgWaitScreen()) + tryagain -= 1 + # Change cross color based on time if eyetracking is not enabled if not eyetrack: if (count % (sum(self.cross_times) * self.fps) < self.cross_times[0] * self.fps): fix_crosses[0].draw() else: fix_crosses[1].draw() # Increment count and set whether groups should be shown if not isinstance(cur_group, CkgWaitScreen): count += 1 if groups_start <= count < groups_stop: groups_visible = True else: groups_visible = False # Blit canvas to screen if necessary if scaling: fbo.end_render() window.switch_to() canvas.blit(0, 0) window.dispatch_events() window.flip() # Make sure everything has been drawn pyglet.gl.glFinish() # Append time information to log string if logtime and logdur: logstring = '\n'.join([logstring, str(stamp.elapsed())]) logstring = '\t'.join([logstring, str(dur.restart())]) elif logtime: logstring = '\n'.join([logstring, str(timer.elapsed())]) elif logdur: logstring = '\n'.join([logstring, str(timer.restart())]) # Send signals ASAP after flip signals.send(sigser, sigpar) # Log when signals are sent if logtime or logdur: if flipped != 0 and (sigser or sigpar): sigmsg = '{0} sent'.format(signals.STATE) logstring = '\t'.join([logstring, sigmsg]) # Clean up if eyetrack: eyetracking.stop() window.close() if scaling: fbo.delete() del canvas signals.quit(sigser, sigpar) # Write log string to file if logtime or logdur: filename = '{0}.log'.format(self.name) with open(filename, 'w') as logfile: logfile.write(logstring) + # Return list of ids of failed groups + if eyetrack: + return fix_fail_queue + def export(self, export_dir, export_duration, group_queue=[], export_fmt=None, folder=True, force=False): if not os.path.isdir(export_dir): msg = 'export path is not a directory' raise IOError(msg) if export_fmt == None: export_fmt = self.export_fmt # Set-up groups and variables that control their display if group_queue == []: group_queue = list(self.groups) cur_group = None cur_id = -1 groups_duration = sum([group.duration() for group in group_queue]) groups_start = self.pre * self.fps groups_stop = (self.pre + groups_duration) * self.fps disp_end = (self.pre + groups_duration + self.post) * self.fps if groups_start == 0 and groups_stop > 0: groups_visible = True else: groups_visible = False count = 0 # Limit export duration to display duration frames = export_duration * self.fps frames = min(frames, disp_end) # Warn user if a lot of frames will be exported if frames > MAX_EXPORT_FRAMES and not force: msg = 'very large number ({0}) of frames to be exported'.\ format(frames) raise FrameOverflowError(msg) # Create folder to store images if necessary if folder: export_dir = os.path.join(export_dir, self.name + EXPORT_DIR_SUFFIX) if not os.path.isdir(export_dir): os.mkdir(export_dir) # Create fixation crosses fix_crosses = [graphics.Cross([r/2 for r in self.res], (20, 20), col = cross_col) for cross_col in self.cross_cols] # Set up canvas and framebuffer object canvas = pyglet.image.Texture.create(*self.res) fbo = graphics.Framebuffer(canvas) fbo.start_render() graphics.set_clear_color(self.bg) fbo.clear() # Main loop while count < frames: fbo.clear() if groups_visible: # Check if current group is over if cur_group != None: if cur_group.over: cur_group = None # Get next group from queue if cur_group == None: cur_id += 1 if cur_id >= len(group_queue): groups_visible = False else: cur_group = group_queue[cur_id] cur_group.reset() # Draw and then update group if cur_group != None: cur_group.draw() cur_group.update(fps=self.fps, fpbs=0) # Draw fixation cross based on current count if (count % (sum(self.cross_times) * self.fps) < self.cross_times[0] * self.fps): fix_crosses[0].draw() else: fix_crosses[1].draw() # Save current frame to file savepath = \ os.path.join(export_dir, '{0}{2}.{1}'. format(self.name, export_fmt, repr(count).zfill(numdigits(frames-1)))) canvas.save(savepath) # Increment count and set whether groups should be shown count += 1 if groups_start <= count < groups_stop: groups_visible = True else: groups_visible = False fbo.delete() class CkgDisplayGroup: DEFAULTS = {'pre': 0, 'disp': 'Infinity', 'post': 0} def __init__(self, **keywords): """Create a new group of shapes to be displayed together. pre -- time in seconds a blank screen is shown before shapes in group are displayed disp -- time in seconds the shapes in the group are displayed, negative numbers result in shapes being displayed forever post -- time in seconds a blank screen is shown after shapes in group are displayed """ for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.shapes = [] self.reset() def __setattr__(self, name, value): if name in self.__class__.DEFAULTS: value = to_decimal(value) self.__dict__[name] = value def duration(self): """Returns total duration of display group.""" return self.pre + self.disp + self.post def reset(self): """Resets internal count and all contained shapes.""" self._count = 0 self._start = self.pre self._stop = self.pre + self.disp self._end = self.pre + self.disp + self.post self.over = False self.old_visible = False if self._start == 0 and self._stop > 0: self.visible = True else: self.visible = False if self._end == 0: self.over = True self._flip_count = [0] * len(self.shapes) for shape in self.shapes: shape.reset() def draw(self, lazy=False): """Draws all contained shapes during the appropriate interval.""" if self.visible: for shape in self.shapes: if lazy: shape.lazydraw() else: shape.draw() def update(self, **keywords): """Increments internal count, makes group visible when appropriate. fps -- refresh rate of the display in frames per second fpbs -- flips per board signal, i.e. number of shape color reversals (flips) that occur for a unique signal to be sent for that shape """ fps = keywords['fps'] fpbs = keywords['fpbs'] if self.visible: # Set triggers to be sent if fpbs > 0: for n, shape in enumerate(self.shapes): if shape.flipped: self._flip_count[n] += 1 if self._flip_count[n] >= fpbs: signals.set_board_flip(n) self._flip_count[n] = 0 # Update contained shapes for shape in self.shapes: shape.update(fps) # Increment count and set flags for the next frame self._count += 1 self.old_visible = self.visible if (self._start * fps) <= self._count < (self._stop * fps): self.visible = True else: self.visible = False if self._count >= (self._end * fps): self.over = True else: self.over = False def save(self, document, parent): """Saves group in specified XML document as child of parent.""" group_el = document.createElement('group') parent.appendChild(group_el) for var in self.__class__.DEFAULTS.keys(): xml_set(document, group_el, var, repr(getattr(self, var))) for shape in self.shapes: shape.save(document, group_el) def load(self, element): """Loads group from XML DOM element.""" for var in self.__class__.DEFAULTS.keys(): try: value = eval(xml_get(element, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) shape_els = [node for node in element.childNodes if node.localName == 'shape' and node.namespaceURI == XML_NAMESPACE] for shape_el in shape_els: # TODO: Make load code shape-agnostic new_shape = CheckerBoard() new_shape.load(shape_el) self.shapes.append(new_shape) class CkgWaitScreen(CkgDisplayGroup): """Dummy display group, waits for user input to proceed.""" DEFAULTS = {'g_keys': (pyglet.window.key.SPACE,), 'r_keys': (pyglet.window.key.NUM_ENTER, pyglet.window.key.ENTER), 'res': CkgProj.DEFAULTS['res'], 'g_info': "the experiment will start soon", 'r_info': "press enter when ready", 'font_color': (0, 0, 0, 255), 'font_size': 16} def __init__(self, **keywords): """Create an informative waitscreen that proceeds after user input.""" for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.g_label = pyglet.text.Label(self.g_info, font_name=SANS_SERIF, font_size=self.font_size, color=self.font_color, bold=True, x=self.res[0]//2, y=self.res[1]*16//30, anchor_x='center', anchor_y='center') self.r_label = pyglet.text.Label(self.r_info, font_name=SANS_SERIF, font_size=self.font_size, color=self.font_color, bold=True, x=self.res[0]//2, y=self.res[1]*16//30, anchor_x='center', anchor_y='center') self.reset() def __setattr__(self, name, value): self.__dict__[name] = value def duration(self): """Returns zero since wait times are arbitrary.""" return to_decimal(0) def reset(self): """Resets some flags.""" + self.visible = False + self.old_visible = False self.ready = False self.over = False def draw(self): """Draw informative text.""" if not self.ready: self.r_label.draw() else: self.g_label.draw() def update(self, **keywords): """Checks for keypress, sends signal upon end.""" keystates = keywords['keystates'] if self.r_keys == None: if max([keystates[key] for key in self.g_keys]): self.ready = True self.over = True elif not self.ready: if max([keystates[key] for key in self.r_keys]): self.ready = True else: if max([keystates[key] for key in self.g_keys]): self.over = True class CheckerShape: # Abstract class, to be implemented. pass class CheckerDisc(CheckerShape): # Circular checker pattern, to be implemented pass class CheckerBoard(CheckerShape): DEFAULTS = {'dims': (5, 5), 'init_unit': (30, 30), 'end_unit': (50, 50), 'position': (0, 0), 'anchor': 'bottomleft', 'cols': ((0, 0, 0), (255, 255, 255)), 'freq': 1, 'phase': 0} # TODO: Reimplement mid/center anchor functionality in cool new way def __init__(self, **keywords): for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.reset() def __setattr__(self, name, value): # Type conversions if name == 'dims': if len(value) != 2: raise ValueError value = tuple([int(x) for x in value]) elif name in ['init_unit', 'end_unit', 'position']: if len(value) != 2: raise ValueError value = tuple([to_decimal(x) for x in value]) elif name == 'anchor': if value not in graphics.locations.keys(): raise ValueError elif name == 'cols': if len(value) != 2: raise ValueError for col in value: if len(col) != 3: raise ValueError value = tuple([tuple([int(c) for c in col]) for col in value]) elif name in ['freq', 'phase']: value = to_decimal(value) # Store value self.__dict__[name] = value # Recompute if necessary if name in ['dims', 'init_unit', 'end_unit', 'position', 'anchor','cols']: self._computed = False def save(self, document, parent): """Saves board in specified XML document as child of parent.""" board_el = document.createElement('shape') board_el.setAttribute('type', 'board') parent.appendChild(board_el) for var in self.__class__.DEFAULTS.keys(): xml_set(document, board_el, var, repr(getattr(self, var))) def load(self, element): """Loads group from XML DOM element.""" for var in self.__class__.DEFAULTS.keys(): try: value = eval(xml_get(element, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) def reset(self, new_phase=None): """Resets checkerboard animation back to initial phase.""" if new_phase == None: new_phase = self.phase self._cur_phase = new_phase self._prev_phase = new_phase self.flipped = False self._first_draw = True if not self._computed: self.compute() def update(self, fps): """Increase the current phase of the checkerboard animation.""" self._prev_phase = self._cur_phase if self.freq != 0: degs_per_frame = 360 * self.freq / fps self._cur_phase += degs_per_frame if self._cur_phase >= 360: self._cur_phase %= 360 cur_n = int(self._cur_phase // 180) prev_n = int(self._prev_phase // 180) if cur_n != prev_n: self.flipped = True else: self.flipped = False def compute(self): """Computes a model of the checkerboard for drawing later.""" # Create batches to store model self._batches = [pyglet.graphics.Batch() for n in range(2)] # Calculate size of checkerboard in pixels self._size = tuple([(y1 + y2) / 2 * n for y1, y2, n in zip(self.init_unit, self.end_unit, self.dims)]) # Calculate unit size gradient unit_grad = tuple([(2 if (flag == 0) else 1) * (y2 - y1) / n for y1, y2, n, flag in zip(self.init_unit, self.end_unit, self.dims, graphics.locations[self.anchor])]) # Set initial values if PRERENDER_TO_TEXTURE: init_pos = [(1 - a)* s/to_decimal(2) for s, a in zip(self._size, graphics.locations[self.anchor])] else: init_pos = list(self.position) init_unit = [c + m/2 for c, m in zip(self.init_unit, unit_grad)] cur_unit = list(init_unit) cur_unit_pos = list(init_pos) # Add unit cells to batches in nested for loop for j in range(self.dims[1]): for i in range(self.dims[0]): cur_unit_rect = graphics.Rect(cur_unit_pos, cur_unit, anchor=self.anchor) cur_unit_rect.col = self.cols[(i + j) % 2] cur_unit_rect.add_to_batch(self._batches[0]) cur_unit_rect.col = self.cols[(i + j + 1) % 2] cur_unit_rect.add_to_batch(self._batches[1]) # Increase x values cur_unit_pos[0] += \ graphics.locations[self.anchor][0] * cur_unit[0] cur_unit[0] += unit_grad[0] # Reset x values cur_unit_pos[0] = init_pos[0] cur_unit[0] = init_unit[0] # Increase y values cur_unit_pos[1] += \ graphics.locations[self.anchor][1] * cur_unit[1] cur_unit[1] += unit_grad[1] if PRERENDER_TO_TEXTURE: # Create textures int_size = [int(round(s)) for s in self._size] self._prerenders =\ [pyglet.image.Texture.create(*int_size) for n in range(2)] # Set up framebuffer fbo = graphics.Framebuffer() for n in range(2): fbo.attach_texture(self._prerenders[n]) # Draw batch to texture fbo.start_render() self._batches[n].draw() fbo.end_render() # Anchor textures for correct blitting later self._prerenders[n].anchor_x, self._prerenders[n].anchor_y =\ [int(round((1 - a)* s/to_decimal(2))) for s, a in zip(self._size, graphics.locations[self.anchor])] fbo.delete() # Delete batches since they won't be used del self._batches self._computed = True def draw(self, always_compute=False): """Draws appropriate prerender depending on current phase.""" if not self._computed or always_compute: self.compute() self._cur_phase %= 360 n = int(self._cur_phase // 180) if PRERENDER_TO_TEXTURE: self._prerenders[n].blit(*self.position) else: self._batches[n].draw() def lazydraw(self): """Only draws on color reversal.""" cur_n = int(self._cur_phase // 180) prev_n = int(self._prev_phase // 180) if (cur_n != prev_n) or self._first_draw: self.draw() if self._first_draw: self._first_draw = False diff --git a/src/eyetracking.py b/src/eyetracking.py index de00e81..0063b97 100644 --- a/src/eyetracking.py +++ b/src/eyetracking.py @@ -1,130 +1,133 @@ """Provides support for CRS VideoEyetracker Toolbox.""" import os.path try: import win32com.client available = True except ImportError: available = False # COM ProgID of the Toolbox ProgID = "crsVET.VideoEyeTracker" +RecordName = "etResultSet" # VET application object VET = None class EyetrackingError(Exception): """Raised when something goes wrong with VET.""" pass if available: # Try dispatching object, else unavailable try: VET = win32com.client.Dispatch(ProgID) + DummyResultSet = win32com.client.Record(RecordName, VET) except: available = False if available: # For easier access to constants and standardization with MATLAB interface CRS = win32com.client.constants def select_source(user_select = False, path = None): if user_select: if not VET.SelectVideoSource(CRS.vsUserSelect, ''): msg = 'could not select video source' raise EyetrackingError(msg) elif path != None: # Open from file if not VET.SelectVideoSource(CRS.vsFile, path): msg = 'could not use path as video source' raise EyetrackingError(msg) else: # Default to 250 Hz High Speed Camera if not VET.SelectVideoSource(CRS.vsHighSpeedCamera250, ''): msg = 'could not select video source' raise EyetrackingError(msg) def is_source_ready(): """Returns true if a video source has been selected.""" if VET.VideoSourceType == 0: return False else: return True def show_camera(): VET.CreateCameraScreen(0) def quit_camera(): VET.DestroyCameraScreen() def setup(viewing_distance, screen_dims, fixation_period = None, fixation_range = None): """Calibrates the display and sets fixation properties.""" if len(screen_dims) != 2: msg = 'screen_dims must be a 2-tuple' raise ValueError(msg) VET.SetDeviceParameters(CRS.deUser, viewing_distance, screen_dims[0], screen_dims[1]) if fixation_period != None: VET.FixationPeriod = fixation_period if fixation_range != None: VET.FixationRange = fixation_range def calibrate(path = None): """Calibrate the subject. Optionally supply a path with no spaces to a calibration file to load.""" if path == None: if not VET.Calibrate(): msg = 'calibration failed' raise EyetrackingError(msg) else: if not os.path.isfile(path): msg = 'specified file does not exist' raise EyetrackingError(msg) if not VET.LoadCalibrationFile(path): msg = 'file could not be loaded' raise EyetrackingError(msg) def is_calibrated(): if VET.CalibrationStatus()[0] != 0: return True else: return False def start(): """Start tracking the eye.""" if VET.CalibrationStatus()[0] == 0: msg = 'subject not yet calibrated' raise EyetrackingError(msg) VET.ClearDataBuffer() VET.StartTracking() def stop(): """Stop tracking the eye.""" VET.StopTracking() - def is_tracking(): + def is_tracked(): """Returns true if the eye is being tracked.""" - return bool(VET.Tracking) + data = VET.GetLatestEyePosition(results)[1] + return data.Tracked - def fixating(fix_pos, fix_range): + def is_fixated(fix_pos, fix_range): """Checks whether subject is fixating on specificied location. fix_pos -- (x, y) position of desired fixation location in mm from center of screen fix_range -- (width, height) of box surrounding fix_pos within which fixation is allowed (in mm) """ if VET.CalibrationStatus()[0] == 0: msg = 'subject not yet calibrated' raise EyetrackingError(msg) if VET.FixationLocation.Fixation: xdiff = abs(VET.FixationLocation.Xposition - fix_pos[0]) ydiff = abs(VET.FixationLocation.Yposition - fix_pos[1]) if (xdiff <= fix_range[0]/2) and (ydiff <= fix_range[1]/2): return True return False
ztangent/checkergen
bb45644b1ed5291651a537af569cf14515304aa1
Moved descriptive text nearer to fixation cross.
diff --git a/src/core.py b/src/core.py index 444e153..171aafe 100755 --- a/src/core.py +++ b/src/core.py @@ -331,753 +331,753 @@ class CkgProj: logtime -- timestamp of each frame is saved to a logfile if true logdur -- duration of each frame is saved to a logfile if true sigser -- send signals through serial port when each group is shown sigpar -- send signals through parallel port when each group is shown fpbs -- flips per board signal, i.e. number of shape color reversals (flips) that occur for a unique signal to be sent for that shape phototest -- draw white rectangle in topleft corner when each group is shown for photodiode to detect eyetrack -- use eyetracking to ensure subject is fixating on cross etuser -- if true, user gets to select eyetracking video source in GUI etvideo -- optional eyetracking video source file to use instead of live feed group_queue -- queue of groups to be displayed, defaults to order of groups in project (i.e. groups[0] first, etc.) """ # Create fixation crosses fix_crosses = [graphics.Cross([r/2 for r in self.res], (20, 20), col = cross_col) for cross_col in self.cross_cols] # Create test rectangle if phototest: test_rect = graphics.Rect((0, self.res[1]), [r/8 for r in self.res], anchor='topleft') # Set-up groups and variables that control their display if group_queue == []: group_queue = list(self.groups) cur_group = None cur_id = -1 flipped = 0 flip_id = -1 groups_duration = sum([group.duration() for group in group_queue]) groups_start = self.pre * self.fps groups_stop = (self.pre + groups_duration) * self.fps disp_end = (self.pre + groups_duration + self.post) * self.fps if groups_start == 0 and groups_stop > 0: groups_visible = True else: groups_visible = False count = 0 # Initialize ports if sigser: if not signals.available['serial']: msg = 'serial port functionality not available' raise NotImplementedError(msg) if sigpar: if not signals.available['parallel']: msg = 'parallel port functionality not available' raise NotImplementedError(msg) signals.init(sigser, sigpar) # Initialize eyetracking if eyetrack: if not eyetracking.available: msg = 'eyetracking functionality not available' raise NotImplementedError(msg) fixating = False old_fixating = False tracking = False old_tracking = False eyetracking.select_source(etuser, etvideo) eyetracking.start() # Stretch to fit screen only if project res does not equal screen res scaling = False if fullscreen: window = pyglet.window.Window(fullscreen=True, visible=False) if (window.width, window.height) != self.res: scaling = True else: window = pyglet.window.Window(*self.res, visible=False) # Set up KeyStateHandler to handle keyboard input keystates = pyglet.window.key.KeyStateHandler() window.push_handlers(keystates) # Create framebuffer object for drawing unscaled scene if scaling: canvas = pyglet.image.Texture.create(*self.res) fbo = graphics.Framebuffer(canvas) fbo.start_render() graphics.set_clear_color(self.bg) fbo.clear() fbo.end_render() # Clear window and make visible window.switch_to() graphics.set_clear_color(self.bg) window.clear() window.set_visible() # Initialize logging variables if logtime and logdur: logstring = '' stamp = Timer() dur = Timer() stamp.start() dur.start() elif logtime or logdur: logstring = '' timer = Timer() timer.start() # Main loop while not window.has_exit and count < disp_end: # Clear canvas if scaling: fbo.start_render() fbo.clear() else: window.clear() # Assume no change to group visibility flipped = 0 signals.set_null() # Manage groups when they are on_screen if groups_visible: # Send special signal if waitscreen ends if isinstance(cur_group, CkgWaitScreen): if cur_group.over: signals.set_user_start() cur_group = None elif cur_group != None: # Check whether group changes in visibility if cur_group.visible != cur_group.old_visible: flip_id = self.groups.index(cur_group) if cur_group.visible: flipped = 1 elif cur_group.old_visible: flipped = -1 # Check if current group is over if cur_group.over: cur_group = None # Get next group from queue if cur_group == None: cur_id += 1 if cur_id >= len(group_queue): groups_visible = False else: cur_group = group_queue[cur_id] cur_group.reset() if not isinstance(cur_group, CkgWaitScreen): if cur_group.visible: flip_id = cur_id flipped = 1 # Draw and then update group if cur_group != None: cur_group.draw() cur_group.update(fps=self.fps, fpbs=fpbs, keystates=keystates) # Send signals upon group visibility change if flipped == 1: signals.set_group_start(flip_id) # Draw test rectangle if phototest: test_rect.draw() elif flipped == -1: signals.set_group_stop(flip_id) if eyetrack: # First check if tracking and send signals old_tracking = tracking tracking = eyetracking.is_tracking() if tracking: if not old_tracking: # Send signal if tracking starts signals.set_track_start() else: if old_tracking: # Send signal if tracking stops signals.set_track_stop() # Next check for fixation old_fixating = fixating fixating = eyetracking.fixating(FIX_POS, FIX_RANGE) if fixating: # Draw normal cross color if fixating fix_crosses[0].draw() if not old_fixating: # Send signal if fixation starts signals.set_fix_start() else: # Draw alternative cross color if not fixating fix_crosses[1].draw() if old_fixating: # Send signal if fixation stops signals.set_fix_stop() # Change cross color based on time if eyetracking is not enabled if not eyetrack: if (count % (sum(self.cross_times) * self.fps) < self.cross_times[0] * self.fps): fix_crosses[0].draw() else: fix_crosses[1].draw() # Increment count and set whether groups should be shown if not isinstance(cur_group, CkgWaitScreen): count += 1 if groups_start <= count < groups_stop: groups_visible = True else: groups_visible = False # Blit canvas to screen if necessary if scaling: fbo.end_render() window.switch_to() canvas.blit(0, 0) window.dispatch_events() window.flip() # Make sure everything has been drawn pyglet.gl.glFinish() # Append time information to log string if logtime and logdur: logstring = '\n'.join([logstring, str(stamp.elapsed())]) logstring = '\t'.join([logstring, str(dur.restart())]) elif logtime: logstring = '\n'.join([logstring, str(timer.elapsed())]) elif logdur: logstring = '\n'.join([logstring, str(timer.restart())]) # Send signals ASAP after flip signals.send(sigser, sigpar) # Log when signals are sent if logtime or logdur: if flipped != 0 and (sigser or sigpar): sigmsg = '{0} sent'.format(signals.STATE) logstring = '\t'.join([logstring, sigmsg]) # Clean up if eyetrack: eyetracking.stop() window.close() if scaling: fbo.delete() del canvas signals.quit(sigser, sigpar) # Write log string to file if logtime or logdur: filename = '{0}.log'.format(self.name) with open(filename, 'w') as logfile: logfile.write(logstring) def export(self, export_dir, export_duration, group_queue=[], export_fmt=None, folder=True, force=False): if not os.path.isdir(export_dir): msg = 'export path is not a directory' raise IOError(msg) if export_fmt == None: export_fmt = self.export_fmt # Set-up groups and variables that control their display if group_queue == []: group_queue = list(self.groups) cur_group = None cur_id = -1 groups_duration = sum([group.duration() for group in group_queue]) groups_start = self.pre * self.fps groups_stop = (self.pre + groups_duration) * self.fps disp_end = (self.pre + groups_duration + self.post) * self.fps if groups_start == 0 and groups_stop > 0: groups_visible = True else: groups_visible = False count = 0 # Limit export duration to display duration frames = export_duration * self.fps frames = min(frames, disp_end) # Warn user if a lot of frames will be exported if frames > MAX_EXPORT_FRAMES and not force: msg = 'very large number ({0}) of frames to be exported'.\ format(frames) raise FrameOverflowError(msg) # Create folder to store images if necessary if folder: export_dir = os.path.join(export_dir, self.name + EXPORT_DIR_SUFFIX) if not os.path.isdir(export_dir): os.mkdir(export_dir) # Create fixation crosses fix_crosses = [graphics.Cross([r/2 for r in self.res], (20, 20), col = cross_col) for cross_col in self.cross_cols] # Set up canvas and framebuffer object canvas = pyglet.image.Texture.create(*self.res) fbo = graphics.Framebuffer(canvas) fbo.start_render() graphics.set_clear_color(self.bg) fbo.clear() # Main loop while count < frames: fbo.clear() if groups_visible: # Check if current group is over if cur_group != None: if cur_group.over: cur_group = None # Get next group from queue if cur_group == None: cur_id += 1 if cur_id >= len(group_queue): groups_visible = False else: cur_group = group_queue[cur_id] cur_group.reset() # Draw and then update group if cur_group != None: cur_group.draw() cur_group.update(fps=self.fps, fpbs=0) # Draw fixation cross based on current count if (count % (sum(self.cross_times) * self.fps) < self.cross_times[0] * self.fps): fix_crosses[0].draw() else: fix_crosses[1].draw() # Save current frame to file savepath = \ os.path.join(export_dir, '{0}{2}.{1}'. format(self.name, export_fmt, repr(count).zfill(numdigits(frames-1)))) canvas.save(savepath) # Increment count and set whether groups should be shown count += 1 if groups_start <= count < groups_stop: groups_visible = True else: groups_visible = False fbo.delete() class CkgDisplayGroup: DEFAULTS = {'pre': 0, 'disp': 'Infinity', 'post': 0} def __init__(self, **keywords): """Create a new group of shapes to be displayed together. pre -- time in seconds a blank screen is shown before shapes in group are displayed disp -- time in seconds the shapes in the group are displayed, negative numbers result in shapes being displayed forever post -- time in seconds a blank screen is shown after shapes in group are displayed """ for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.shapes = [] self.reset() def __setattr__(self, name, value): if name in self.__class__.DEFAULTS: value = to_decimal(value) self.__dict__[name] = value def duration(self): """Returns total duration of display group.""" return self.pre + self.disp + self.post def reset(self): """Resets internal count and all contained shapes.""" self._count = 0 self._start = self.pre self._stop = self.pre + self.disp self._end = self.pre + self.disp + self.post self.over = False self.old_visible = False if self._start == 0 and self._stop > 0: self.visible = True else: self.visible = False if self._end == 0: self.over = True self._flip_count = [0] * len(self.shapes) for shape in self.shapes: shape.reset() def draw(self, lazy=False): """Draws all contained shapes during the appropriate interval.""" if self.visible: for shape in self.shapes: if lazy: shape.lazydraw() else: shape.draw() def update(self, **keywords): """Increments internal count, makes group visible when appropriate. fps -- refresh rate of the display in frames per second fpbs -- flips per board signal, i.e. number of shape color reversals (flips) that occur for a unique signal to be sent for that shape """ fps = keywords['fps'] fpbs = keywords['fpbs'] if self.visible: # Set triggers to be sent if fpbs > 0: for n, shape in enumerate(self.shapes): if shape.flipped: self._flip_count[n] += 1 if self._flip_count[n] >= fpbs: signals.set_board_flip(n) self._flip_count[n] = 0 # Update contained shapes for shape in self.shapes: shape.update(fps) # Increment count and set flags for the next frame self._count += 1 self.old_visible = self.visible if (self._start * fps) <= self._count < (self._stop * fps): self.visible = True else: self.visible = False if self._count >= (self._end * fps): self.over = True else: self.over = False def save(self, document, parent): """Saves group in specified XML document as child of parent.""" group_el = document.createElement('group') parent.appendChild(group_el) for var in self.__class__.DEFAULTS.keys(): xml_set(document, group_el, var, repr(getattr(self, var))) for shape in self.shapes: shape.save(document, group_el) def load(self, element): """Loads group from XML DOM element.""" for var in self.__class__.DEFAULTS.keys(): try: value = eval(xml_get(element, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) shape_els = [node for node in element.childNodes if node.localName == 'shape' and node.namespaceURI == XML_NAMESPACE] for shape_el in shape_els: # TODO: Make load code shape-agnostic new_shape = CheckerBoard() new_shape.load(shape_el) self.shapes.append(new_shape) class CkgWaitScreen(CkgDisplayGroup): """Dummy display group, waits for user input to proceed.""" DEFAULTS = {'g_keys': (pyglet.window.key.SPACE,), 'r_keys': (pyglet.window.key.NUM_ENTER, pyglet.window.key.ENTER), 'res': CkgProj.DEFAULTS['res'], 'g_info': "the experiment will start soon", 'r_info': "press enter when ready", 'font_color': (0, 0, 0, 255), 'font_size': 16} def __init__(self, **keywords): """Create an informative waitscreen that proceeds after user input.""" for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.g_label = pyglet.text.Label(self.g_info, font_name=SANS_SERIF, font_size=self.font_size, color=self.font_color, bold=True, x=self.res[0]//2, - y=self.res[1]//8, + y=self.res[1]*16//30, anchor_x='center', anchor_y='center') self.r_label = pyglet.text.Label(self.r_info, font_name=SANS_SERIF, font_size=self.font_size, color=self.font_color, bold=True, x=self.res[0]//2, - y=self.res[1]//8, + y=self.res[1]*16//30, anchor_x='center', anchor_y='center') self.reset() def __setattr__(self, name, value): self.__dict__[name] = value def duration(self): """Returns zero since wait times are arbitrary.""" return to_decimal(0) def reset(self): """Resets some flags.""" self.ready = False self.over = False def draw(self): """Draw informative text.""" if not self.ready: self.r_label.draw() else: self.g_label.draw() def update(self, **keywords): """Checks for keypress, sends signal upon end.""" keystates = keywords['keystates'] if self.r_keys == None: if max([keystates[key] for key in self.g_keys]): self.ready = True self.over = True elif not self.ready: if max([keystates[key] for key in self.r_keys]): self.ready = True else: if max([keystates[key] for key in self.g_keys]): self.over = True class CheckerShape: # Abstract class, to be implemented. pass class CheckerDisc(CheckerShape): # Circular checker pattern, to be implemented pass class CheckerBoard(CheckerShape): DEFAULTS = {'dims': (5, 5), 'init_unit': (30, 30), 'end_unit': (50, 50), 'position': (0, 0), 'anchor': 'bottomleft', 'cols': ((0, 0, 0), (255, 255, 255)), 'freq': 1, 'phase': 0} # TODO: Reimplement mid/center anchor functionality in cool new way def __init__(self, **keywords): for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.reset() def __setattr__(self, name, value): # Type conversions if name == 'dims': if len(value) != 2: raise ValueError value = tuple([int(x) for x in value]) elif name in ['init_unit', 'end_unit', 'position']: if len(value) != 2: raise ValueError value = tuple([to_decimal(x) for x in value]) elif name == 'anchor': if value not in graphics.locations.keys(): raise ValueError elif name == 'cols': if len(value) != 2: raise ValueError for col in value: if len(col) != 3: raise ValueError value = tuple([tuple([int(c) for c in col]) for col in value]) elif name in ['freq', 'phase']: value = to_decimal(value) # Store value self.__dict__[name] = value # Recompute if necessary if name in ['dims', 'init_unit', 'end_unit', 'position', 'anchor','cols']: self._computed = False def save(self, document, parent): """Saves board in specified XML document as child of parent.""" board_el = document.createElement('shape') board_el.setAttribute('type', 'board') parent.appendChild(board_el) for var in self.__class__.DEFAULTS.keys(): xml_set(document, board_el, var, repr(getattr(self, var))) def load(self, element): """Loads group from XML DOM element.""" for var in self.__class__.DEFAULTS.keys(): try: value = eval(xml_get(element, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) def reset(self, new_phase=None): """Resets checkerboard animation back to initial phase.""" if new_phase == None: new_phase = self.phase self._cur_phase = new_phase self._prev_phase = new_phase self.flipped = False self._first_draw = True if not self._computed: self.compute() def update(self, fps): """Increase the current phase of the checkerboard animation.""" self._prev_phase = self._cur_phase if self.freq != 0: degs_per_frame = 360 * self.freq / fps self._cur_phase += degs_per_frame if self._cur_phase >= 360: self._cur_phase %= 360 cur_n = int(self._cur_phase // 180) prev_n = int(self._prev_phase // 180) if cur_n != prev_n: self.flipped = True else: self.flipped = False def compute(self): """Computes a model of the checkerboard for drawing later.""" # Create batches to store model self._batches = [pyglet.graphics.Batch() for n in range(2)] # Calculate size of checkerboard in pixels self._size = tuple([(y1 + y2) / 2 * n for y1, y2, n in zip(self.init_unit, self.end_unit, self.dims)]) # Calculate unit size gradient unit_grad = tuple([(2 if (flag == 0) else 1) * (y2 - y1) / n for y1, y2, n, flag in zip(self.init_unit, self.end_unit, self.dims, graphics.locations[self.anchor])]) # Set initial values if PRERENDER_TO_TEXTURE: init_pos = [(1 - a)* s/to_decimal(2) for s, a in zip(self._size, graphics.locations[self.anchor])] else: init_pos = list(self.position) init_unit = [c + m/2 for c, m in zip(self.init_unit, unit_grad)] cur_unit = list(init_unit) cur_unit_pos = list(init_pos) # Add unit cells to batches in nested for loop for j in range(self.dims[1]): for i in range(self.dims[0]): cur_unit_rect = graphics.Rect(cur_unit_pos, cur_unit, anchor=self.anchor) cur_unit_rect.col = self.cols[(i + j) % 2] cur_unit_rect.add_to_batch(self._batches[0]) cur_unit_rect.col = self.cols[(i + j + 1) % 2] cur_unit_rect.add_to_batch(self._batches[1]) # Increase x values cur_unit_pos[0] += \ graphics.locations[self.anchor][0] * cur_unit[0] cur_unit[0] += unit_grad[0] # Reset x values cur_unit_pos[0] = init_pos[0] cur_unit[0] = init_unit[0] # Increase y values cur_unit_pos[1] += \ graphics.locations[self.anchor][1] * cur_unit[1] cur_unit[1] += unit_grad[1] if PRERENDER_TO_TEXTURE: # Create textures int_size = [int(round(s)) for s in self._size] self._prerenders =\ [pyglet.image.Texture.create(*int_size) for n in range(2)] # Set up framebuffer fbo = graphics.Framebuffer() for n in range(2): fbo.attach_texture(self._prerenders[n]) # Draw batch to texture fbo.start_render() self._batches[n].draw() fbo.end_render() # Anchor textures for correct blitting later self._prerenders[n].anchor_x, self._prerenders[n].anchor_y =\ [int(round((1 - a)* s/to_decimal(2))) for s, a in zip(self._size, graphics.locations[self.anchor])] fbo.delete() # Delete batches since they won't be used del self._batches self._computed = True def draw(self, always_compute=False): """Draws appropriate prerender depending on current phase.""" if not self._computed or always_compute: self.compute() self._cur_phase %= 360 n = int(self._cur_phase // 180) if PRERENDER_TO_TEXTURE: self._prerenders[n].blit(*self.position) else: self._batches[n].draw() def lazydraw(self): """Only draws on color reversal.""" cur_n = int(self._cur_phase // 180) prev_n = int(self._prev_phase // 180) if (cur_n != prev_n) or self._first_draw: self.draw() if self._first_draw: self._first_draw = False
ztangent/checkergen
0da13c578d1bbf97a664dd95fca5c9ddb8bab0f6
Made calibrate query handle EOFs.
diff --git a/src/cli.py b/src/cli.py index 4356f12..101daee 100644 --- a/src/cli.py +++ b/src/cli.py @@ -524,553 +524,561 @@ class CkgCmd(cmd.Cmd): def help_ed(self): self.__class__.ed_parser.print_help() def do_ed(self, line): """Edits attributes of checkerboards specified by ids.""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups, please create one first' return try: args = self.__class__.ed_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.ed_parser.print_usage() return # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist[:]: if x >= len(self.cur_group.shapes) or x < 0: args.idlist.remove(x) print "checkerboard", x, "does not exist" if args.idlist == []: return names = public_dir(args) names.remove('idlist') noflags = True for name in names: val = getattr(args, name) if val != None: for x in args.idlist: self.cur_proj.set_shape_attr(self.cur_group, x, name, val) noflags = False if noflags: print "no options specified, please specify at least one" self.__class__.ed_parser.print_usage() rm_parser = CmdParser(add_help=False, prog='rm', description='''Removes checkerboards specified by ids.''') rm_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''ids of checkerboards in the current group to be removed''') rm_parser.add_argument('-a', '--all', action='store_true', help='''remove all checkerboards in the current group''') def help_rm(self): self.__class__.rm_parser.print_help() def do_rm(self, line): """Removes checkerboards specified by ids""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups, no boards to remove' return try: args = self.__class__.rm_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.rm_parser.print_usage() return rmlist = [] if args.all: for shape in self.cur_group.shapes: self.cur_proj.del_shape_from_group(self.cur_group, shape) print "all checkerboards removed" return elif len(args.idlist) == 0: print "please specify at least one id" # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist: if x >= len(self.cur_group.shapes) or x < 0: print "checkerboard", x, "does not exist" continue rmlist.append(self.cur_group.shapes[x]) print "checkerboard", x, "removed" for shape in rmlist: self.cur_proj.del_shape_from_group(self.cur_group, shape) ls_parser = CmdParser(add_help=False, prog='ls', description='''Lists project, display group and checkerboard settings. If no group ids are specified, all display groups are listed.''') ls_parser.add_argument('gidlist', nargs='*', metavar='gid', type=int, help='''ids of the display groups to be listed''') ls_group = ls_parser.add_mutually_exclusive_group() ls_group.add_argument('-s', '--settings', action='store_true', help='list only project settings') ls_group.add_argument('-g', '--groups', action='store_true', help='list only display groups') def help_ls(self): self.__class__.ls_parser.print_help() def do_ls(self, line): """Lists project, display group and checkerboard settings.""" def ls_str(s, seps=[',',';']): """Special space-saving output formatter.""" if type(s) in [tuple, list]: if len(seps) > 1: newseps = seps[1:] else: newseps = seps return seps[0].join([ls_str(i, newseps) for i in s]) else: return str(s) if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.ls_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.ls_parser.print_usage() return # Remove duplicates and ascending sort args.gidlist = sorted(set(args.gidlist)) if len(self.cur_proj.groups) == 0: if len(args.gidlist) > 0: print 'this project has no display groups that can be listed' args.settings = True else: for gid in args.gidlist[:]: if gid >= len(self.cur_proj.groups) or gid < 0: args.gidlist.remove(gid) print 'display group', gid, 'does not exist' if args.gidlist == []: args.gidlist = range(len(self.cur_proj.groups)) else: # If any (valid) groups are specified # don't show project settings args.groups = True if not args.groups: print 'PROJECT SETTINGS'.center(70,'*') print \ 'name'.rjust(16),\ 'fps'.rjust(7),\ 'resolution'.rjust(14),\ 'bg color'.rjust(18) # 'format'.rjust(7) print \ ls_str(self.cur_proj.name).rjust(16),\ ls_str(self.cur_proj.fps).rjust(7),\ ls_str(self.cur_proj.res).rjust(14),\ ls_str(self.cur_proj.bg).rjust(18) # ls_str(self.cur_proj.export_fmt).rjust(7) print \ 'pre-display'.rjust(26),\ 'post-display'.rjust(26) print \ ls_str(self.cur_proj.pre).rjust(26),\ ls_str(self.cur_proj.post).rjust(26) print \ 'cross colors'.rjust(26),\ 'cross times'.rjust(26) print \ ls_str(self.cur_proj.cross_cols).rjust(26),\ ls_str(self.cur_proj.cross_times).rjust(26) if not args.settings and not args.groups: # Insert empty line if both groups and project # settings are listed print '' if not args.settings: for i, n in enumerate(args.gidlist): if i != 0: # Print newline seperator between each group print '' group = self.cur_proj.groups[n] print 'GROUP {n}'.format(n=n).center(70,'*') print \ 'pre-display'.rjust(20),\ 'display'.rjust(20),\ 'post-display'.rjust(20) print \ ls_str(group.pre).rjust(20),\ ls_str(group.disp).rjust(20),\ ls_str(group.post).rjust(20) if len(group.shapes) > 0: print \ ''.rjust(2),\ 'shape id'.rjust(8),\ 'dims'.rjust(10),\ 'init_unit'.rjust(14),\ 'end_unit'.rjust(14),\ 'position'.rjust(14) for m, shape in enumerate(group.shapes): print \ ''.rjust(2),\ ls_str(m).rjust(8),\ ls_str(shape.dims).rjust(10),\ ls_str(shape.init_unit).rjust(14),\ ls_str(shape.end_unit).rjust(14),\ ls_str(shape.position).rjust(14) print '\n',\ ''.rjust(2),\ 'shape id'.rjust(8),\ 'colors'.rjust(27),\ 'anchor'.rjust(12),\ 'freq'.rjust(6),\ 'phase'.rjust(7) for m, shape in enumerate(group.shapes): print \ ''.rjust(2),\ ls_str(m).rjust(8),\ ls_str(shape.cols).rjust(27),\ ls_str(shape.anchor).rjust(12),\ ls_str(shape.freq).rjust(6),\ ls_str(shape.phase).rjust(7) display_parser = CmdParser(add_help=False, prog='display', description='''Displays the animation in a window or in fullscreen.''') display_parser.add_argument('-b', '--block', metavar='PATH', help='''read flags and dislay group order from specified file, ignore other flags''') display_parser.add_argument('-f', '--fullscreen', action='store_true', help='sets fullscreen mode, ESC to quit') display_parser.add_argument('-p', '--priority', metavar='LEVEL', help='''set priority while displaying, higher priority results in less dropped frames (choices: 0-3, low, normal, high, realtime)''') display_parser.add_argument('-r', '--repeat', metavar='N', type=int, help='''repeatedly display specified display groups N number of times''') display_parser.add_argument('-pt', '--phototest', action='store_true', help='''draw white test rectangle in topleft corner of screen when groups become visible for a photodiode to detect''') display_parser.add_argument('-lt', '--logtime', action='store_true', help='output frame timestamps to a log file') display_parser.add_argument('-ld', '--logdur', action='store_true', help='output frame durations to a log file') display_parser.add_argument('-ss', '--sigser', action='store_true', help='''send signals through the serial port when shapes are being displayed''') display_parser.add_argument('-sp', '--sigpar', action='store_true', help='''send signals through the parallel port when shapes are being displayed''') display_parser.add_argument('-fpbs', metavar='N', type=int, default=0, help='''unique signal corresponding to a checkerboard is sent after the board undergoes N color reversals (flips), set to 0 to disable''') display_parser.add_argument('-et', '--eyetrack', action='store_true', help='''use eyetracking to ensure that subject fixates on the cross in the center''') display_parser.add_argument('-eu', '--etuser', action='store_true', help='''allow user to select eyetracking video source from a dialog''') display_parser.add_argument('-ev', '--etvideo', metavar='path', help='''path (with no spaces) to eyetracking video file to be used as the source''') display_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''list of display groups to be displayed in the specified order (default: order by id, i.e. group 0 is first)''') def help_display(self): self.__class__.display_parser.print_help() def do_display(self, line): """Displays the animation in a window or in fullscreen""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.display_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.display_parser.print_usage() return if args.block != None: try: blkdict = core.CkgProj.readblk(args.block) flags = blkdict['flags'] try: args = self.__class__.\ display_parser.parse_args(shlex.split(flags)) args.idlist = blkdict['idlist'] except CmdParserError: print 'error: invalid flags stored in block file' return except IOError: print "error:", str(sys.exc_value) return group_queue = [] if len(args.idlist) > 0: for i in set(args.idlist): if i >= len(self.cur_proj.groups) or i < -1: print 'error: group', i, 'does not exist' return for i in args.idlist: if i == -1: group_queue.append(core.CkgWaitScreen()) else: group_queue.append(self.cur_proj.groups[i]) else: group_queue = list(self.cur_proj.groups) if args.repeat != None: group_queue = list(group_queue * args.repeat) if args.priority != None: if not priority.available: print "error: setting priority not avaible on", sys.platform print "continuing..." else: if args.priority.isdigit(): args.priority = int(args.priority) try: priority.set(args.priority) except ValueError: print "error:", str(sys.exc_value) print "continuing..." if args.eyetrack and eyetracking.available: if not eyetracking.is_calibrated(): try: self.do_calibrate('',True) except eyetracking.EyetrackingError: print "error:", str(sys.exc_value) return if len(path) > 0: print "calibration file successfully loaded" try: self.cur_proj.display(fullscreen=args.fullscreen, logtime=args.logtime, logdur=args.logdur, sigser=args.sigser, sigpar=args.sigpar, fpbs=args.fpbs, phototest=args.phototest, eyetrack=args.eyetrack, etuser=args.etuser, etvideo=args.etvideo, group_queue=group_queue) except (IOError, NotImplementedError, eyetracking.EyetrackingError): print "error:", str(sys.exc_value) return if args.priority != None: try: priority.set('normal') except: pass export_parser = CmdParser(add_help=False, prog='export', description='''Exports animation as an image sequence (in a folder) to the specified directory.''') # export_parser.add_argument('--fmt', dest='export_fmt', # choices=core.EXPORT_FMTS, # help='image format for export') export_parser.add_argument('-n','--nofolder', dest='folder', action='store_false', help='''force images not to exported in a containing folder''') export_parser.add_argument('-r', '--repeat', metavar='N', type=int, help='''repeatedly export specified display groups N number of times''') export_parser.add_argument('duration', nargs='?', type=to_decimal, default='Infinity', help='''number of seconds of the animation that should be exported (default: as long as the entire animation)''') export_parser.add_argument('dir', nargs='?', default=os.getcwd(), help='''destination directory for export (default: current working directory)''') export_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''list of display groups to be exported in the specified order (default: order by id, i.e. group 0 is first)''') def help_export(self): self.__class__.export_parser.print_help() def do_export(self, line): """Exports animation an image sequence to the specified directory.""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.export_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.export_parser.print_usage() return if len(args.idlist) > 0: for i in set(args.idlist): if i >= len(self.cur_proj.groups) or i < 0: print 'error: group', i, 'does not exist' return group_queue = [self.cur_proj.groups[i] for i in args.idlist] else: group_queue = list(self.cur_proj.groups) if args.repeat != None: group_queue = list(group_queue * args.repeat) try: self.cur_proj.export(export_dir=args.dir, export_duration=args.duration, group_queue=group_queue, folder=args.folder) except IOError: print "error:", str(sys.exc_value) return except core.FrameOverflowError: print "warning:", str(sys.exc_value) print "Are you sure you want to continue?" while True: try: if self.__class__.yn_parse(raw_input()): self.cur_proj.export(export_dir=args.dir, export_duration=args.duration, group_queue=group_queue, export_fmt=None, folder=args.folder, force=True) break else: return except TypeError: print str(sys.exc_value) except EOFError: return print "Export done." mkblks_parser = CmdParser(add_help=False, prog='mkblks', description='''Generates randomized experimental blocks from display groups and saves each as a CSV file.''') mkblks_parser.add_argument('-n','--nofolder', dest='folder', action='store_false', help='''force block files not to be saved in a containing folder''') mkblks_parser.add_argument('-d','--dir', default=os.getcwd(), help='''where to save block files (default: current working directory)''') mkblks_parser.add_argument('length', type=int, help='''no. of repeated trials in a block''') mkblks_parser.add_argument('flags', nargs='?', default='', help='''flags passed to the display command that should be used when the block file is run (enclose in quotes and use '+' or '++' in place of '-' or '--')''') def help_mkblks(self): self.__class__.mkblks_parser.print_help() def do_mkblks(self, line): """Generates randomized experimental blocks from display groups.""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.mkblks_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.mkblks_parser.print_usage() return args.flags = args.flags.replace('+','-') try: disp_args = self.__class__.display_parser.\ parse_args(shlex.split(args.flags)) except CmdParserError: print "error: invalid flags to display command" print str(sys.exc_value) self.__class__.display_parser.print_usage() return try: self.cur_proj.mkblks(args.length, path=args.dir, folder=args.folder, flags=args.flags) except IOError: print "error:", str(sys.exc_value) return print "Experimental blocks generated." def do_calibrate(self, line, query=False): """Calibrate subject for eyetracking, or load a calibration file.""" if not eyetracking.available: print "error: eyetracking functionality not available" return if query: print "path to calibration file (leave empty for GUI tool):" - path = raw_input().strip().strip('"\'') + try: + path = raw_input().strip().strip('"\'') + except EOFError: + msg = "calibration cancelled" + raise eyetracking.EyetrackingError(msg) else: path = line.strip().strip('"\'') if len(path) == 0: path = None if not eyetracking.is_source_ready(): # Select default source if none has been selected eyetracking.select_source() try: eyetracking.calibrate(path) except eyetracking.EyetrackingError: if query: raise else: print "error:", str(sys.exc_value) return if len(path) > 0: print "calibration file successfully loaded" def do_quit(self, line): """Quits the program.""" if self.save_check(): return return True + def help_EOF(self): + print "Typing {0} issues this command, which quits the program."\ + .format(CMD_EOF_STRING) + def do_EOF(self, line): """Typing Ctrl-D issues this command, which quits the program.""" print '\r' if self.save_check(): return return True def help_help(self): print 'Prints a list of commands.' print "Type 'help <topic>' for more details on each command." def default(self, line): command = line.split()[0] print \ "'{0}' is not a checkergen command.".format(command),\ "Type 'help' for a list of commands"
ztangent/checkergen
3df0f2ace0c8f5404aeaa8bbdbbf17f5f98e62e7
fpbs - flips per board sig - now can be set by the user
diff --git a/src/cli.py b/src/cli.py index 627251c..4356f12 100644 --- a/src/cli.py +++ b/src/cli.py @@ -266,805 +266,811 @@ class CkgCmd(cmd.Cmd): mkgrp_parser = CmdParser(add_help=False, prog='mkgrp', formatter_class= argparse.ArgumentDefaultsHelpFormatter, description='''Makes a new display group with the given parameters.''') mkgrp_parser.add_argument('pre', type=to_decimal, default=0, nargs='?', help='''time in seconds a blank screen will be shown before shapes are displayed''') mkgrp_parser.add_argument('disp', type=to_decimal, nargs='?', default='Infinity', help='''time in seconds shapes will be displayed''') mkgrp_parser.add_argument('post', type=to_decimal, default=0, nargs='?', help='''time in seconds a blank screen will be shown after shapes are displayed''') def help_mkgrp(self): self.__class__.mkgrp_parser.print_help() def do_mkgrp(self, line): """Makes a display group with the given parameters.""" if self.cur_proj == None: print 'no project open, automatically creating project...' self.do_new('') try: args = self.__class__.mkgrp_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.mkgrp_parser.print_usage() return group_dict = dict([(name, getattr(args, name)) for name in public_dir(args)]) new_group = core.CkgDisplayGroup(**group_dict) new_id = self.cur_proj.add_group(new_group) print "display group", new_id, "added" self.cur_group = new_group print "group", new_id, "is now the current display group" edgrp_parser = CmdParser(add_help=False, prog='edgrp', description='''Edits attributes of display groups specified by ids.''') edgrp_parser.add_argument('idlist', nargs='+', metavar='id', type=int, help='ids of display groups to be edited') edgrp_parser.add_argument('--pre', type=to_decimal, metavar='SECONDS', help='''time in seconds a blank screen will be shown before shapes are displayed''') edgrp_parser.add_argument('--disp', type=to_decimal, metavar='SECONDS', help='''time in seconds shapes will be displayed''') edgrp_parser.add_argument('--post', type=to_decimal, metavar='SECONDS', help='''time in seconds a blank screen will be shown after shapes are displayed''') def help_edgrp(self): self.__class__.edgrp_parser.print_help() def do_edgrp(self, line): """Edits attributes of checkerboards specified by ids.""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.edgrp_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.edgrp_parser.print_usage() return # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist[:]: if x >= len(self.cur_proj.groups) or x < 0: args.idlist.remove(x) print "checkerboard", x, "does not exist" if args.idlist == []: return names = public_dir(args) names.remove('idlist') noflags = True for name in names: val = getattr(args, name) if val != None: for x in args.idlist: self.cur_proj.set_group_attr(x, name, val) noflags = False if noflags: print "no options specified, please specify at least one" self.__class__.edgrp_parser.print_usage() rmgrp_parser = CmdParser(add_help=False, prog='rmgrp', description='''Removes display groups specified by ids.''') rmgrp_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='ids of display groups to be removed') rmgrp_parser.add_argument('-a', '--all', action='store_true', help='remove all groups from the project') def help_rmgrp(self): self.__class__.rmgrp_parser.print_help() def do_rmgrp(self, line): """Removes display groups specified by ids""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups to remove' return try: args = self.__class__.rmgrp_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.rmgrp_parser.print_usage() return rmlist = [] if args.all: for group in self.cur_proj.groups[:]: self.cur_proj.del_group(group) print "all display groups removed" return elif len(args.idlist) == 0: print "please specify at least one id" # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist: if x >= len(self.cur_proj.groups) or x < 0: print "display group", x, "does not exist" continue rmlist.append(self.cur_proj.groups[x]) print "display group", x, "removed" for group in rmlist: self.cur_proj.del_group(group) # Remember to point self.cur_group somewhere sane if self.cur_group not in self.cur_proj.groups: if len(self.cur_proj.groups) == 0: self.cur_group = None else: self.cur_group = self.cur_proj.groups[0] print "group 0 is now the current display group" chgrp_parser = CmdParser(add_help=False, prog='chgrp', description='''Changes display group that is currently active for editing. Prints current group id if no group id is specified''') chgrp_parser.add_argument('gid', metavar='id', type=int, nargs='?', help='id of display group to be made active') def help_chgrp(self): self.__class__.chgrp_parser.print_help() def do_chgrp(self, line): """Changes group that is currently active for editing.""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups that can be made active' return try: args = self.__class__.chgrp_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.chgrp_parser.print_usage() return if args.gid == None: print "group",\ self.cur_proj.groups.index(self.cur_group),\ "is the current display group" elif args.gid >= len(self.cur_proj.groups) or args.gid < 0: print "group", args.gid, "does not exist" else: self.cur_group = self.cur_proj.groups[args.gid] print "group", args.gid, "is now the current display group" mk_parser = CmdParser(add_help=False, prog='mk', description='''Makes a new checkerboard in the current group with the given parameters.''') mk_parser.add_argument('dims', action=store_tuple(2, ',', to_decimal), help='''width,height of checkerboard in no. of unit cells''') mk_parser.add_argument('init_unit', action=store_tuple(2, ',', to_decimal), help='width,height of initial unit cell in pixels') mk_parser.add_argument('end_unit', action=store_tuple(2, ',', to_decimal), help='width,height of final unit cell in pixels') mk_parser.add_argument('position', action=store_tuple(2, ',', to_decimal), help='x,y position of checkerboard in pixels') mk_parser.add_argument('anchor', choices=sorted(locations.keys()), help='''location of anchor point of checkerboard (choices: %(choices)s)''', metavar='anchor') mk_parser.add_argument('cols', action=store_tuple(2, ',', to_color, [';']), help='''color1,color2 of the checkerboard (color format: R;G;B, component range from 0-255)''') mk_parser.add_argument('freq', type=to_decimal, help='frequency of color reversal in Hz') mk_parser.add_argument('phase', type=to_decimal, nargs='?', default='0', help='initial phase of animation in degrees') def help_mk(self): self.__class__.mk_parser.print_help() def do_mk(self, line): """Makes a checkerboard with the given parameters.""" if self.cur_proj == None: print 'no project open, automatically creating project...' self.do_new('') if self.cur_group == None: print 'automatically adding display group...' self.do_mkgrp('') try: args = self.__class__.mk_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.mk_parser.print_usage() return shape_dict = dict([(name, getattr(args, name)) for name in public_dir(args)]) new_shape = core.CheckerBoard(**shape_dict) new_id = self.cur_proj.add_shape_to_group(self.cur_group, new_shape) print "checkerboard", new_id, "added" ed_parser = CmdParser(add_help=False, prog='ed', description='''Edits attributes of checkerboards specified by ids.''') ed_parser.add_argument('idlist', nargs='+', metavar='id', type=int, help='''ids of checkerboards in the current group to be edited''') ed_parser.add_argument('--dims', action=store_tuple(2, ',', to_decimal), help='checkerboard dimensions in unit cells', metavar='WIDTH,HEIGHT') ed_parser.add_argument('--init_unit', action=store_tuple(2, ',', to_decimal), help='initial unit cell dimensions in pixels', metavar='WIDTH,HEIGHT') ed_parser.add_argument('--end_unit', action=store_tuple(2, ',', to_decimal), help='final unit cell dimensions in pixels', metavar='WIDTH,HEIGHT') ed_parser.add_argument('--position', action=store_tuple(2, ',', to_decimal), help='position of checkerboard in pixels', metavar='X,Y') ed_parser.add_argument('--anchor', choices=sorted(locations.keys()), help='''location of anchor point of checkerboard (choices: %(choices)s)''', metavar='LOCATION') ed_parser.add_argument('--cols', metavar='COLOR1,COLOR2', action=store_tuple(2, ',', to_color, [';']), help='''checkerboard colors (color format: R;G;B, component range from 0-255)''') ed_parser.add_argument('--freq', type=to_decimal, help='frequency of color reversal in Hz') ed_parser.add_argument('--phase', type=to_decimal, help='initial phase of animation in degrees') def help_ed(self): self.__class__.ed_parser.print_help() def do_ed(self, line): """Edits attributes of checkerboards specified by ids.""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups, please create one first' return try: args = self.__class__.ed_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.ed_parser.print_usage() return # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist[:]: if x >= len(self.cur_group.shapes) or x < 0: args.idlist.remove(x) print "checkerboard", x, "does not exist" if args.idlist == []: return names = public_dir(args) names.remove('idlist') noflags = True for name in names: val = getattr(args, name) if val != None: for x in args.idlist: self.cur_proj.set_shape_attr(self.cur_group, x, name, val) noflags = False if noflags: print "no options specified, please specify at least one" self.__class__.ed_parser.print_usage() rm_parser = CmdParser(add_help=False, prog='rm', description='''Removes checkerboards specified by ids.''') rm_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''ids of checkerboards in the current group to be removed''') rm_parser.add_argument('-a', '--all', action='store_true', help='''remove all checkerboards in the current group''') def help_rm(self): self.__class__.rm_parser.print_help() def do_rm(self, line): """Removes checkerboards specified by ids""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups, no boards to remove' return try: args = self.__class__.rm_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.rm_parser.print_usage() return rmlist = [] if args.all: for shape in self.cur_group.shapes: self.cur_proj.del_shape_from_group(self.cur_group, shape) print "all checkerboards removed" return elif len(args.idlist) == 0: print "please specify at least one id" # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist: if x >= len(self.cur_group.shapes) or x < 0: print "checkerboard", x, "does not exist" continue rmlist.append(self.cur_group.shapes[x]) print "checkerboard", x, "removed" for shape in rmlist: self.cur_proj.del_shape_from_group(self.cur_group, shape) ls_parser = CmdParser(add_help=False, prog='ls', description='''Lists project, display group and checkerboard settings. If no group ids are specified, all display groups are listed.''') ls_parser.add_argument('gidlist', nargs='*', metavar='gid', type=int, help='''ids of the display groups to be listed''') ls_group = ls_parser.add_mutually_exclusive_group() ls_group.add_argument('-s', '--settings', action='store_true', help='list only project settings') ls_group.add_argument('-g', '--groups', action='store_true', help='list only display groups') def help_ls(self): self.__class__.ls_parser.print_help() def do_ls(self, line): """Lists project, display group and checkerboard settings.""" def ls_str(s, seps=[',',';']): """Special space-saving output formatter.""" if type(s) in [tuple, list]: if len(seps) > 1: newseps = seps[1:] else: newseps = seps return seps[0].join([ls_str(i, newseps) for i in s]) else: return str(s) if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.ls_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.ls_parser.print_usage() return # Remove duplicates and ascending sort args.gidlist = sorted(set(args.gidlist)) if len(self.cur_proj.groups) == 0: if len(args.gidlist) > 0: print 'this project has no display groups that can be listed' args.settings = True else: for gid in args.gidlist[:]: if gid >= len(self.cur_proj.groups) or gid < 0: args.gidlist.remove(gid) print 'display group', gid, 'does not exist' if args.gidlist == []: args.gidlist = range(len(self.cur_proj.groups)) else: # If any (valid) groups are specified # don't show project settings args.groups = True if not args.groups: print 'PROJECT SETTINGS'.center(70,'*') print \ 'name'.rjust(16),\ 'fps'.rjust(7),\ 'resolution'.rjust(14),\ 'bg color'.rjust(18) # 'format'.rjust(7) print \ ls_str(self.cur_proj.name).rjust(16),\ ls_str(self.cur_proj.fps).rjust(7),\ ls_str(self.cur_proj.res).rjust(14),\ ls_str(self.cur_proj.bg).rjust(18) # ls_str(self.cur_proj.export_fmt).rjust(7) print \ 'pre-display'.rjust(26),\ 'post-display'.rjust(26) print \ ls_str(self.cur_proj.pre).rjust(26),\ ls_str(self.cur_proj.post).rjust(26) print \ 'cross colors'.rjust(26),\ 'cross times'.rjust(26) print \ ls_str(self.cur_proj.cross_cols).rjust(26),\ ls_str(self.cur_proj.cross_times).rjust(26) if not args.settings and not args.groups: # Insert empty line if both groups and project # settings are listed print '' if not args.settings: for i, n in enumerate(args.gidlist): if i != 0: # Print newline seperator between each group print '' group = self.cur_proj.groups[n] print 'GROUP {n}'.format(n=n).center(70,'*') print \ 'pre-display'.rjust(20),\ 'display'.rjust(20),\ 'post-display'.rjust(20) print \ ls_str(group.pre).rjust(20),\ ls_str(group.disp).rjust(20),\ ls_str(group.post).rjust(20) if len(group.shapes) > 0: print \ ''.rjust(2),\ 'shape id'.rjust(8),\ 'dims'.rjust(10),\ 'init_unit'.rjust(14),\ 'end_unit'.rjust(14),\ 'position'.rjust(14) for m, shape in enumerate(group.shapes): print \ ''.rjust(2),\ ls_str(m).rjust(8),\ ls_str(shape.dims).rjust(10),\ ls_str(shape.init_unit).rjust(14),\ ls_str(shape.end_unit).rjust(14),\ ls_str(shape.position).rjust(14) print '\n',\ ''.rjust(2),\ 'shape id'.rjust(8),\ 'colors'.rjust(27),\ 'anchor'.rjust(12),\ 'freq'.rjust(6),\ 'phase'.rjust(7) for m, shape in enumerate(group.shapes): print \ ''.rjust(2),\ ls_str(m).rjust(8),\ ls_str(shape.cols).rjust(27),\ ls_str(shape.anchor).rjust(12),\ ls_str(shape.freq).rjust(6),\ ls_str(shape.phase).rjust(7) display_parser = CmdParser(add_help=False, prog='display', description='''Displays the animation in a window or in fullscreen.''') display_parser.add_argument('-b', '--block', metavar='PATH', help='''read flags and dislay group order from specified file, ignore other flags''') display_parser.add_argument('-f', '--fullscreen', action='store_true', help='sets fullscreen mode, ESC to quit') display_parser.add_argument('-p', '--priority', metavar='LEVEL', help='''set priority while displaying, higher priority results in less dropped frames (choices: 0-3, low, normal, high, realtime)''') display_parser.add_argument('-r', '--repeat', metavar='N', type=int, help='''repeatedly display specified display groups N number of times''') display_parser.add_argument('-pt', '--phototest', action='store_true', help='''draw white test rectangle in topleft corner of screen when groups become visible for a photodiode to detect''') display_parser.add_argument('-lt', '--logtime', action='store_true', help='output frame timestamps to a log file') display_parser.add_argument('-ld', '--logdur', action='store_true', help='output frame durations to a log file') display_parser.add_argument('-ss', '--sigser', action='store_true', help='''send signals through the serial port when shapes are being displayed''') display_parser.add_argument('-sp', '--sigpar', action='store_true', help='''send signals through the parallel port when shapes are being displayed''') + display_parser.add_argument('-fpbs', metavar='N', type=int, default=0, + help='''unique signal corresponding to a + checkerboard is sent after the board + undergoes N color reversals (flips), + set to 0 to disable''') display_parser.add_argument('-et', '--eyetrack', action='store_true', help='''use eyetracking to ensure that subject fixates on the cross in the center''') display_parser.add_argument('-eu', '--etuser', action='store_true', help='''allow user to select eyetracking video source from a dialog''') display_parser.add_argument('-ev', '--etvideo', metavar='path', help='''path (with no spaces) to eyetracking video file to be used as the source''') display_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''list of display groups to be displayed in the specified order (default: order by id, i.e. group 0 is first)''') def help_display(self): self.__class__.display_parser.print_help() def do_display(self, line): """Displays the animation in a window or in fullscreen""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.display_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.display_parser.print_usage() return if args.block != None: try: blkdict = core.CkgProj.readblk(args.block) flags = blkdict['flags'] try: args = self.__class__.\ display_parser.parse_args(shlex.split(flags)) args.idlist = blkdict['idlist'] except CmdParserError: print 'error: invalid flags stored in block file' return except IOError: print "error:", str(sys.exc_value) return group_queue = [] if len(args.idlist) > 0: for i in set(args.idlist): if i >= len(self.cur_proj.groups) or i < -1: print 'error: group', i, 'does not exist' return for i in args.idlist: if i == -1: group_queue.append(core.CkgWaitScreen()) else: group_queue.append(self.cur_proj.groups[i]) else: group_queue = list(self.cur_proj.groups) if args.repeat != None: group_queue = list(group_queue * args.repeat) if args.priority != None: if not priority.available: print "error: setting priority not avaible on", sys.platform print "continuing..." else: if args.priority.isdigit(): args.priority = int(args.priority) try: priority.set(args.priority) except ValueError: print "error:", str(sys.exc_value) print "continuing..." if args.eyetrack and eyetracking.available: if not eyetracking.is_calibrated(): try: self.do_calibrate('',True) except eyetracking.EyetrackingError: print "error:", str(sys.exc_value) return if len(path) > 0: print "calibration file successfully loaded" try: self.cur_proj.display(fullscreen=args.fullscreen, logtime=args.logtime, logdur=args.logdur, sigser=args.sigser, sigpar=args.sigpar, + fpbs=args.fpbs, phototest=args.phototest, eyetrack=args.eyetrack, etuser=args.etuser, etvideo=args.etvideo, group_queue=group_queue) except (IOError, NotImplementedError, eyetracking.EyetrackingError): print "error:", str(sys.exc_value) return if args.priority != None: try: priority.set('normal') except: pass export_parser = CmdParser(add_help=False, prog='export', description='''Exports animation as an image sequence (in a folder) to the specified directory.''') # export_parser.add_argument('--fmt', dest='export_fmt', # choices=core.EXPORT_FMTS, # help='image format for export') export_parser.add_argument('-n','--nofolder', dest='folder', action='store_false', help='''force images not to exported in a containing folder''') export_parser.add_argument('-r', '--repeat', metavar='N', type=int, help='''repeatedly export specified display groups N number of times''') export_parser.add_argument('duration', nargs='?', type=to_decimal, default='Infinity', help='''number of seconds of the animation that should be exported (default: as long as the entire animation)''') export_parser.add_argument('dir', nargs='?', default=os.getcwd(), help='''destination directory for export (default: current working directory)''') export_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''list of display groups to be exported in the specified order (default: order by id, i.e. group 0 is first)''') def help_export(self): self.__class__.export_parser.print_help() def do_export(self, line): """Exports animation an image sequence to the specified directory.""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.export_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.export_parser.print_usage() return if len(args.idlist) > 0: for i in set(args.idlist): if i >= len(self.cur_proj.groups) or i < 0: print 'error: group', i, 'does not exist' return group_queue = [self.cur_proj.groups[i] for i in args.idlist] else: group_queue = list(self.cur_proj.groups) if args.repeat != None: group_queue = list(group_queue * args.repeat) try: self.cur_proj.export(export_dir=args.dir, export_duration=args.duration, group_queue=group_queue, folder=args.folder) except IOError: print "error:", str(sys.exc_value) return except core.FrameOverflowError: print "warning:", str(sys.exc_value) print "Are you sure you want to continue?" while True: try: if self.__class__.yn_parse(raw_input()): self.cur_proj.export(export_dir=args.dir, export_duration=args.duration, group_queue=group_queue, export_fmt=None, folder=args.folder, force=True) break else: return except TypeError: print str(sys.exc_value) except EOFError: return print "Export done." mkblks_parser = CmdParser(add_help=False, prog='mkblks', description='''Generates randomized experimental blocks from display groups and saves each as a CSV file.''') mkblks_parser.add_argument('-n','--nofolder', dest='folder', action='store_false', help='''force block files not to be saved in a containing folder''') mkblks_parser.add_argument('-d','--dir', default=os.getcwd(), help='''where to save block files (default: current working directory)''') mkblks_parser.add_argument('length', type=int, help='''no. of repeated trials in a block''') mkblks_parser.add_argument('flags', nargs='?', default='', help='''flags passed to the display command that should be used when the block file is run (enclose in quotes and use '+' or '++' in place of '-' or '--')''') def help_mkblks(self): self.__class__.mkblks_parser.print_help() def do_mkblks(self, line): """Generates randomized experimental blocks from display groups.""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.mkblks_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.mkblks_parser.print_usage() return args.flags = args.flags.replace('+','-') try: disp_args = self.__class__.display_parser.\ parse_args(shlex.split(args.flags)) except CmdParserError: print "error: invalid flags to display command" print str(sys.exc_value) self.__class__.display_parser.print_usage() return try: self.cur_proj.mkblks(args.length, path=args.dir, folder=args.folder, flags=args.flags) except IOError: print "error:", str(sys.exc_value) return print "Experimental blocks generated." def do_calibrate(self, line, query=False): """Calibrate subject for eyetracking, or load a calibration file.""" if not eyetracking.available: print "error: eyetracking functionality not available" return if query: print "path to calibration file (leave empty for GUI tool):" path = raw_input().strip().strip('"\'') else: path = line.strip().strip('"\'') if len(path) == 0: path = None if not eyetracking.is_source_ready(): # Select default source if none has been selected eyetracking.select_source() try: eyetracking.calibrate(path) except eyetracking.EyetrackingError: if query: raise else: print "error:", str(sys.exc_value) return if len(path) > 0: print "calibration file successfully loaded" def do_quit(self, line): """Quits the program.""" if self.save_check(): return return True def do_EOF(self, line): """Typing Ctrl-D issues this command, which quits the program.""" print '\r' if self.save_check(): return return True def help_help(self): print 'Prints a list of commands.' print "Type 'help <topic>' for more details on each command." def default(self, line): command = line.split()[0] print \ "'{0}' is not a checkergen command.".format(command),\ "Type 'help' for a list of commands" diff --git a/src/core.py b/src/core.py index 931a4ef..444e153 100755 --- a/src/core.py +++ b/src/core.py @@ -1,1080 +1,1083 @@ """Contains core functionality of checkergen. Errors and Exceptions: FileFormatError FrameOverflowError Classes: CkgProj -- A checkergen project, contains settings and CkgDisplayGroups. CkgDisplayGroup -- A set of CheckerShapes to be displayed simultaneously. CheckerShapes -- Abstract checkered shape class CheckerBoard -- A (distorted) checkerboard pattern, can color-flip. """ import os import sys import re import csv import itertools from xml.dom import minidom import pyglet import graphics import signals import eyetracking from utils import * CKG_FMT = 'ckg' XML_NAMESPACE = 'http://github.com/ZOMGxuan/checkergen' MAX_EXPORT_FRAMES = 100000 PRERENDER_TO_TEXTURE = False EXPORT_FMTS = ['png'] EXPORT_DIR_SUFFIX = '-anim' BLOCK_DIR_SUFFIX = '-blks' FIX_POS = (0, 0) FIX_RANGE = (20, 20) SANS_SERIF = ('Helvetica', 'Arial', 'FreeSans') def xml_get(parent, namespace, name, index=0): """Returns concatenated text node values inside an element.""" element = [node for node in parent.childNodes if node.localName == name and node.namespaceURI == namespace][index] strings = [] for node in element.childNodes: if node.nodeType == node.TEXT_NODE: strings.append(node.data) return ''.join(strings) def xml_set(document, parent, name, string): """Stores value as a text node in a new DOM element.""" element = document.createElement(name) parent.appendChild(element) text = document.createTextNode(string) element.appendChild(text) def xml_pretty_print(document, indent): """Hack to prettify minidom's not so pretty print.""" ugly_xml = document.toprettyxml(indent=indent) prettifier_re = re.compile('>\n\s+([^<>\s].*?)\n\s+</', re.DOTALL) pretty_xml = prettifier_re.sub('>\g<1></', ugly_xml) return pretty_xml class FileFormatError(ValueError): """Raised when correct file format/extension is not supplied.""" pass class FrameOverflowError(Exception): """Raised when more than MAX_EXPORT_FRAMES are going to be exported.""" pass class CkgProj: """Defines a checkergen project, with checkerboards and other settings.""" DEFAULTS = {'name': 'untitled', 'fps': 60, 'res': (800, 600), 'bg': (127, 127, 127), 'export_fmt': 'png', 'pre': 0, 'post': 0, 'cross_cols': ((0, 0, 0), (255, 0, 0)), 'cross_times': ('Infinity', 1)} def __init__(self, **keywords): """Initializes a new project, or loads it from a path. path -- if specified, ignore other arguments and load project from path name -- name of the project, always the same as the filename without the extension fps -- frames per second of the animation to be displayed res -- screen resolution / window size at which project will be displayed bg -- background color of the animation as a 3-tuple (R, G, B) export_fmt -- image format for animation to be exported as pre -- time in seconds a blank screen will be shown before any display groups post --time in seconds a blank screen will be shown after any display groups """ if 'path' in keywords.keys(): self.load(keywords['path']) return for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.groups = [] def __setattr__(self, name, value): # Type conversions if name == 'name': value = str(value) elif name in ['fps', 'pre', 'post']: value = to_decimal(value) elif name == 'res': if len(value) != 2: raise ValueError value = tuple([int(v) for v in value]) elif name == 'bg': if len(value) != 3: raise ValueError value = tuple([int(v) for v in value]) elif name == 'export_fmt': if value not in EXPORT_FMTS: msg = 'image format not recognized or supported' raise FileFormatError(msg) elif name == 'cross_cols': if len(value) != 2: raise ValueError for col in value: if len(col) != 3: raise ValueError value = tuple([tuple([int(c) for c in col]) for col in value]) elif name == 'cross_times': if len(value) != 2: raise ValueError value = tuple([to_decimal(x) for x in value]) # Store value self.__dict__[name] = value # Set dirty bit if name != '_dirty': self._dirty = True def add_group(self, group): """Append group to list and set dirty bit.""" self.groups.append(group) self._dirty = True return self.groups.index(group) def del_group(self, group): """Remove group to list and set dirty bit.""" self.groups.remove(group) self._dirty = True def add_shape_to_group(self, group, shape): """Add shape to group specified by id and set dirty bit.""" if group not in self.groups: raise ValueError group.shapes.append(shape) self._dirty = True return group.shapes.index(shape) def del_shape_from_group(self, group, shape): """Removes shape from group specified by id and set dirty bit.""" if group not in self.groups: raise ValueError group.shapes.remove(shape) self._dirty = True def set_group_attr(self, gid, name, value): """Set attribute of a group specified by id and set dirty bit.""" setattr(self.groups[gid], name, value) self._dirty = True def set_shape_attr(self, group, sid, name, value): """Set attribute of a shape specified by id and set dirty bit.""" if group not in self.groups: raise ValueError setattr(group.shapes[sid], name, value) self._dirty = True def is_dirty(self): return self._dirty def load(self, path): """Loads project from specified path.""" # Get project name from filename name, ext = os.path.splitext(os.path.basename(path)) if ext == '.{0}'.format(CKG_FMT): self.name = name else: msg = "path lacks '.{0}' extension".format(CKG_FMT) raise FileFormatError(msg) with open(path, 'r') as project_file: doc = minidom.parse(project_file) project = doc.documentElement vars_to_load = self.__class__.DEFAULTS.keys() # Name is not stored in project file vars_to_load.remove('name') for var in vars_to_load: try: value = eval(xml_get(project, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) self.groups = [] group_els = [node for node in project.childNodes if node.localName == 'group' and node.namespaceURI == XML_NAMESPACE] for group_el in group_els: new_group = CkgDisplayGroup() new_group.load(group_el) self.groups.append(new_group) self._dirty = False def save(self, path): """Saves project to specified path as an XML document.""" self.name, ext = os.path.splitext(os.path.basename(path)) if ext != '.{0}'.format(CKG_FMT): path = '{0}.{1}'.format(path, CKG_FMT) impl = minidom.getDOMImplementation() doc = impl.createDocument(XML_NAMESPACE, 'project', None) project = doc.documentElement # Hack below because minidom doesn't support namespaces properly project.setAttribute('xmlns', XML_NAMESPACE) vars_to_save = self.__class__.DEFAULTS.keys() # Name is not stored in project file vars_to_save.remove('name') for var in vars_to_save: xml_set(doc, project, var, repr(getattr(self, var))) for group in self.groups: group.save(doc, project) with open(path, 'w') as project_file: project_file.write(xml_pretty_print(doc,indent=' ')) self._dirty = False return path def mkblks(self, length, path=None, folder=True, flags=''): """Generates randomized experimental blocks from display groups. Each block is saved as a CSV file. length -- number of repeated trials within a block path -- directory in which experimental blocks will be saved folder -- blocks will be saved in a containing folder if true flags -- string of flags to be issued to the display command when block file is run """ if path == None: path = os.getcwd() if not os.path.isdir(path): msg = "specified directory does not exist" raise IOError(msg) if folder: path = os.path.join(path, self.name + BLOCK_DIR_SUFFIX) if not os.path.isdir(path): os.mkdir(path) group_ids = range(len(self.groups)) for n, sequence in enumerate(itertools.permutations(group_ids)): blkname = 'block{0}.csv'.format(repr(n).zfill(numdigits(length))) blkfile = open(os.path.join(path, blkname), 'wb') blkwriter = csv.writer(blkfile, dialect='excel-tab') blkwriter.writerow(['checkergen experimental block file']) blkwriter.writerow(['flags:', flags]) blkwriter.writerow(['repeats:', length]) blkwriter.writerow(['sequence:'] + list(sequence)) blkfile.close() @staticmethod def readblk(path): """Reads the information in a block file and returns it in a dict.""" if not os.path.isfile(path): msg = "specified file does not exist" raise IOError(msg) blkdict = dict() blkfile = open(path, 'rb') blkreader = csv.reader(blkfile, dialect='excel-tab') for n, row in enumerate(blkreader): if n == 1: blkdict['flags'] = row[1] elif n == 2: repeats = int(row[1]) elif n == 3: sequence = row[1:] sequence = [int(i) for i in sequence] blkfile.close() blkdict['idlist'] = ([-1] + sequence) * repeats return blkdict def display(self, fullscreen=False, logtime=False, logdur=False, - sigser=False, sigpar=False, phototest=False, + sigser=False, sigpar=False, fpbs=0, phototest=False, eyetrack=False, etuser=False, etvideo=None, group_queue=[]): """Displays the project animation on the screen. fullscreen -- animation is displayed fullscreen if true, stretched to fit if necessary logtime -- timestamp of each frame is saved to a logfile if true logdur -- duration of each frame is saved to a logfile if true sigser -- send signals through serial port when each group is shown sigpar -- send signals through parallel port when each group is shown + fpbs -- flips per board signal, i.e. number of shape color reversals + (flips) that occur for a unique signal to be sent for that shape + phototest -- draw white rectangle in topleft corner when each group is shown for photodiode to detect eyetrack -- use eyetracking to ensure subject is fixating on cross etuser -- if true, user gets to select eyetracking video source in GUI etvideo -- optional eyetracking video source file to use instead of live feed group_queue -- queue of groups to be displayed, defaults to order of groups in project (i.e. groups[0] first, etc.) """ # Create fixation crosses fix_crosses = [graphics.Cross([r/2 for r in self.res], (20, 20), col = cross_col) for cross_col in self.cross_cols] # Create test rectangle if phototest: test_rect = graphics.Rect((0, self.res[1]), [r/8 for r in self.res], anchor='topleft') # Set-up groups and variables that control their display if group_queue == []: group_queue = list(self.groups) cur_group = None cur_id = -1 flipped = 0 flip_id = -1 groups_duration = sum([group.duration() for group in group_queue]) groups_start = self.pre * self.fps groups_stop = (self.pre + groups_duration) * self.fps disp_end = (self.pre + groups_duration + self.post) * self.fps if groups_start == 0 and groups_stop > 0: groups_visible = True else: groups_visible = False count = 0 # Initialize ports if sigser: if not signals.available['serial']: msg = 'serial port functionality not available' raise NotImplementedError(msg) if sigpar: if not signals.available['parallel']: msg = 'parallel port functionality not available' raise NotImplementedError(msg) signals.init(sigser, sigpar) # Initialize eyetracking if eyetrack: if not eyetracking.available: msg = 'eyetracking functionality not available' raise NotImplementedError(msg) fixating = False old_fixating = False tracking = False old_tracking = False eyetracking.select_source(etuser, etvideo) eyetracking.start() # Stretch to fit screen only if project res does not equal screen res scaling = False if fullscreen: window = pyglet.window.Window(fullscreen=True, visible=False) if (window.width, window.height) != self.res: scaling = True else: window = pyglet.window.Window(*self.res, visible=False) # Set up KeyStateHandler to handle keyboard input keystates = pyglet.window.key.KeyStateHandler() window.push_handlers(keystates) # Create framebuffer object for drawing unscaled scene if scaling: canvas = pyglet.image.Texture.create(*self.res) fbo = graphics.Framebuffer(canvas) fbo.start_render() graphics.set_clear_color(self.bg) fbo.clear() fbo.end_render() # Clear window and make visible window.switch_to() graphics.set_clear_color(self.bg) window.clear() window.set_visible() # Initialize logging variables if logtime and logdur: logstring = '' stamp = Timer() dur = Timer() stamp.start() dur.start() elif logtime or logdur: logstring = '' timer = Timer() timer.start() # Main loop while not window.has_exit and count < disp_end: # Clear canvas if scaling: fbo.start_render() fbo.clear() else: window.clear() # Assume no change to group visibility flipped = 0 signals.set_null() # Manage groups when they are on_screen if groups_visible: # Send special signal if waitscreen ends if isinstance(cur_group, CkgWaitScreen): if cur_group.over: signals.set_user_start() cur_group = None elif cur_group != None: # Check whether group changes in visibility if cur_group.visible != cur_group.old_visible: flip_id = self.groups.index(cur_group) if cur_group.visible: flipped = 1 elif cur_group.old_visible: flipped = -1 # Check if current group is over if cur_group.over: cur_group = None # Get next group from queue if cur_group == None: cur_id += 1 if cur_id >= len(group_queue): groups_visible = False else: cur_group = group_queue[cur_id] cur_group.reset() if not isinstance(cur_group, CkgWaitScreen): if cur_group.visible: flip_id = cur_id flipped = 1 # Draw and then update group if cur_group != None: cur_group.draw() - cur_group.update(fps=self.fps, keystates=keystates) + cur_group.update(fps=self.fps, + fpbs=fpbs, + keystates=keystates) # Send signals upon group visibility change if flipped == 1: signals.set_group_start(flip_id) # Draw test rectangle if phototest: test_rect.draw() elif flipped == -1: signals.set_group_stop(flip_id) if eyetrack: # First check if tracking and send signals old_tracking = tracking tracking = eyetracking.is_tracking() if tracking: if not old_tracking: # Send signal if tracking starts signals.set_track_start() else: if old_tracking: # Send signal if tracking stops signals.set_track_stop() # Next check for fixation old_fixating = fixating fixating = eyetracking.fixating(FIX_POS, FIX_RANGE) if fixating: # Draw normal cross color if fixating fix_crosses[0].draw() if not old_fixating: # Send signal if fixation starts signals.set_fix_start() else: # Draw alternative cross color if not fixating fix_crosses[1].draw() if old_fixating: # Send signal if fixation stops signals.set_fix_stop() # Change cross color based on time if eyetracking is not enabled if not eyetrack: if (count % (sum(self.cross_times) * self.fps) < self.cross_times[0] * self.fps): fix_crosses[0].draw() else: fix_crosses[1].draw() # Increment count and set whether groups should be shown if not isinstance(cur_group, CkgWaitScreen): count += 1 if groups_start <= count < groups_stop: groups_visible = True else: groups_visible = False # Blit canvas to screen if necessary if scaling: fbo.end_render() window.switch_to() canvas.blit(0, 0) window.dispatch_events() window.flip() # Make sure everything has been drawn pyglet.gl.glFinish() # Append time information to log string if logtime and logdur: logstring = '\n'.join([logstring, str(stamp.elapsed())]) logstring = '\t'.join([logstring, str(dur.restart())]) elif logtime: logstring = '\n'.join([logstring, str(timer.elapsed())]) elif logdur: logstring = '\n'.join([logstring, str(timer.restart())]) # Send signals ASAP after flip signals.send(sigser, sigpar) # Log when signals are sent if logtime or logdur: if flipped != 0 and (sigser or sigpar): sigmsg = '{0} sent'.format(signals.STATE) logstring = '\t'.join([logstring, sigmsg]) # Clean up if eyetrack: eyetracking.stop() window.close() if scaling: fbo.delete() del canvas signals.quit(sigser, sigpar) # Write log string to file if logtime or logdur: filename = '{0}.log'.format(self.name) with open(filename, 'w') as logfile: logfile.write(logstring) def export(self, export_dir, export_duration, group_queue=[], export_fmt=None, folder=True, force=False): if not os.path.isdir(export_dir): msg = 'export path is not a directory' raise IOError(msg) if export_fmt == None: export_fmt = self.export_fmt # Set-up groups and variables that control their display if group_queue == []: group_queue = list(self.groups) cur_group = None cur_id = -1 groups_duration = sum([group.duration() for group in group_queue]) groups_start = self.pre * self.fps groups_stop = (self.pre + groups_duration) * self.fps disp_end = (self.pre + groups_duration + self.post) * self.fps if groups_start == 0 and groups_stop > 0: groups_visible = True else: groups_visible = False count = 0 # Limit export duration to display duration frames = export_duration * self.fps frames = min(frames, disp_end) # Warn user if a lot of frames will be exported if frames > MAX_EXPORT_FRAMES and not force: msg = 'very large number ({0}) of frames to be exported'.\ format(frames) raise FrameOverflowError(msg) # Create folder to store images if necessary if folder: export_dir = os.path.join(export_dir, self.name + EXPORT_DIR_SUFFIX) if not os.path.isdir(export_dir): os.mkdir(export_dir) # Create fixation crosses fix_crosses = [graphics.Cross([r/2 for r in self.res], (20, 20), col = cross_col) for cross_col in self.cross_cols] # Set up canvas and framebuffer object canvas = pyglet.image.Texture.create(*self.res) fbo = graphics.Framebuffer(canvas) fbo.start_render() graphics.set_clear_color(self.bg) fbo.clear() # Main loop while count < frames: fbo.clear() if groups_visible: # Check if current group is over if cur_group != None: if cur_group.over: cur_group = None # Get next group from queue if cur_group == None: cur_id += 1 if cur_id >= len(group_queue): groups_visible = False else: cur_group = group_queue[cur_id] cur_group.reset() # Draw and then update group if cur_group != None: cur_group.draw() - cur_group.update(fps=self.fps) + cur_group.update(fps=self.fps, fpbs=0) # Draw fixation cross based on current count if (count % (sum(self.cross_times) * self.fps) < self.cross_times[0] * self.fps): fix_crosses[0].draw() else: fix_crosses[1].draw() # Save current frame to file savepath = \ os.path.join(export_dir, '{0}{2}.{1}'. format(self.name, export_fmt, repr(count).zfill(numdigits(frames-1)))) canvas.save(savepath) # Increment count and set whether groups should be shown count += 1 if groups_start <= count < groups_stop: groups_visible = True else: groups_visible = False fbo.delete() class CkgDisplayGroup: DEFAULTS = {'pre': 0, 'disp': 'Infinity', 'post': 0} def __init__(self, **keywords): """Create a new group of shapes to be displayed together. pre -- time in seconds a blank screen is shown before shapes in group are displayed disp -- time in seconds the shapes in the group are displayed, negative numbers result in shapes being displayed forever post -- time in seconds a blank screen is shown after shapes in group are displayed """ for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.shapes = [] self.reset() def __setattr__(self, name, value): if name in self.__class__.DEFAULTS: value = to_decimal(value) self.__dict__[name] = value def duration(self): """Returns total duration of display group.""" return self.pre + self.disp + self.post def reset(self): """Resets internal count and all contained shapes.""" self._count = 0 self._start = self.pre self._stop = self.pre + self.disp self._end = self.pre + self.disp + self.post self.over = False self.old_visible = False if self._start == 0 and self._stop > 0: self.visible = True else: self.visible = False if self._end == 0: self.over = True self._flip_count = [0] * len(self.shapes) for shape in self.shapes: shape.reset() def draw(self, lazy=False): """Draws all contained shapes during the appropriate interval.""" if self.visible: for shape in self.shapes: if lazy: shape.lazydraw() else: shape.draw() def update(self, **keywords): """Increments internal count, makes group visible when appropriate. fps -- refresh rate of the display in frames per second - flip_sig_per -- number of shape colour reversals that have to occur - for a unique signal to be sent for that shape + fpbs -- flips per board signal, i.e. number of shape color reversals + (flips) that occur for a unique signal to be sent for that shape """ fps = keywords['fps'] - if 'flip_sig_per' in keywords.keys(): - flip_sig_per = keywords['flip_sig_per'] - else: - flip_sig_per = signals.FLIP_SIG_PER - + fpbs = keywords['fpbs'] + if self.visible: # Set triggers to be sent - for n, shape in enumerate(self.shapes): - if shape.flipped: - self._flip_count[n] += 1 - if self._flip_count[n] >= flip_sig_per: + if fpbs > 0: + for n, shape in enumerate(self.shapes): + if shape.flipped: + self._flip_count[n] += 1 + if self._flip_count[n] >= fpbs: signals.set_board_flip(n) self._flip_count[n] = 0 # Update contained shapes for shape in self.shapes: shape.update(fps) # Increment count and set flags for the next frame self._count += 1 self.old_visible = self.visible if (self._start * fps) <= self._count < (self._stop * fps): self.visible = True else: self.visible = False if self._count >= (self._end * fps): self.over = True else: self.over = False def save(self, document, parent): """Saves group in specified XML document as child of parent.""" group_el = document.createElement('group') parent.appendChild(group_el) for var in self.__class__.DEFAULTS.keys(): xml_set(document, group_el, var, repr(getattr(self, var))) for shape in self.shapes: shape.save(document, group_el) def load(self, element): """Loads group from XML DOM element.""" for var in self.__class__.DEFAULTS.keys(): try: value = eval(xml_get(element, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) shape_els = [node for node in element.childNodes if node.localName == 'shape' and node.namespaceURI == XML_NAMESPACE] for shape_el in shape_els: # TODO: Make load code shape-agnostic new_shape = CheckerBoard() new_shape.load(shape_el) self.shapes.append(new_shape) class CkgWaitScreen(CkgDisplayGroup): """Dummy display group, waits for user input to proceed.""" DEFAULTS = {'g_keys': (pyglet.window.key.SPACE,), 'r_keys': (pyglet.window.key.NUM_ENTER, pyglet.window.key.ENTER), 'res': CkgProj.DEFAULTS['res'], 'g_info': "the experiment will start soon", 'r_info': "press enter when ready", 'font_color': (0, 0, 0, 255), 'font_size': 16} def __init__(self, **keywords): """Create an informative waitscreen that proceeds after user input.""" for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.g_label = pyglet.text.Label(self.g_info, font_name=SANS_SERIF, font_size=self.font_size, color=self.font_color, bold=True, x=self.res[0]//2, y=self.res[1]//8, anchor_x='center', anchor_y='center') self.r_label = pyglet.text.Label(self.r_info, font_name=SANS_SERIF, font_size=self.font_size, color=self.font_color, bold=True, x=self.res[0]//2, y=self.res[1]//8, anchor_x='center', anchor_y='center') self.reset() def __setattr__(self, name, value): self.__dict__[name] = value def duration(self): """Returns zero since wait times are arbitrary.""" return to_decimal(0) def reset(self): """Resets some flags.""" self.ready = False self.over = False def draw(self): """Draw informative text.""" if not self.ready: self.r_label.draw() else: self.g_label.draw() def update(self, **keywords): """Checks for keypress, sends signal upon end.""" keystates = keywords['keystates'] if self.r_keys == None: if max([keystates[key] for key in self.g_keys]): self.ready = True self.over = True elif not self.ready: if max([keystates[key] for key in self.r_keys]): self.ready = True else: if max([keystates[key] for key in self.g_keys]): self.over = True class CheckerShape: # Abstract class, to be implemented. pass class CheckerDisc(CheckerShape): # Circular checker pattern, to be implemented pass class CheckerBoard(CheckerShape): DEFAULTS = {'dims': (5, 5), 'init_unit': (30, 30), 'end_unit': (50, 50), 'position': (0, 0), 'anchor': 'bottomleft', 'cols': ((0, 0, 0), (255, 255, 255)), 'freq': 1, 'phase': 0} # TODO: Reimplement mid/center anchor functionality in cool new way def __init__(self, **keywords): for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.reset() def __setattr__(self, name, value): # Type conversions if name == 'dims': if len(value) != 2: raise ValueError value = tuple([int(x) for x in value]) elif name in ['init_unit', 'end_unit', 'position']: if len(value) != 2: raise ValueError value = tuple([to_decimal(x) for x in value]) elif name == 'anchor': if value not in graphics.locations.keys(): raise ValueError elif name == 'cols': if len(value) != 2: raise ValueError for col in value: if len(col) != 3: raise ValueError value = tuple([tuple([int(c) for c in col]) for col in value]) elif name in ['freq', 'phase']: value = to_decimal(value) # Store value self.__dict__[name] = value # Recompute if necessary if name in ['dims', 'init_unit', 'end_unit', 'position', 'anchor','cols']: self._computed = False def save(self, document, parent): """Saves board in specified XML document as child of parent.""" board_el = document.createElement('shape') board_el.setAttribute('type', 'board') parent.appendChild(board_el) for var in self.__class__.DEFAULTS.keys(): xml_set(document, board_el, var, repr(getattr(self, var))) def load(self, element): """Loads group from XML DOM element.""" for var in self.__class__.DEFAULTS.keys(): try: value = eval(xml_get(element, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) def reset(self, new_phase=None): """Resets checkerboard animation back to initial phase.""" if new_phase == None: new_phase = self.phase self._cur_phase = new_phase self._prev_phase = new_phase self.flipped = False self._first_draw = True if not self._computed: self.compute() def update(self, fps): """Increase the current phase of the checkerboard animation.""" self._prev_phase = self._cur_phase if self.freq != 0: degs_per_frame = 360 * self.freq / fps self._cur_phase += degs_per_frame if self._cur_phase >= 360: self._cur_phase %= 360 cur_n = int(self._cur_phase // 180) prev_n = int(self._prev_phase // 180) if cur_n != prev_n: self.flipped = True else: self.flipped = False def compute(self): """Computes a model of the checkerboard for drawing later.""" # Create batches to store model self._batches = [pyglet.graphics.Batch() for n in range(2)] # Calculate size of checkerboard in pixels self._size = tuple([(y1 + y2) / 2 * n for y1, y2, n in zip(self.init_unit, self.end_unit, self.dims)]) # Calculate unit size gradient unit_grad = tuple([(2 if (flag == 0) else 1) * (y2 - y1) / n for y1, y2, n, flag in zip(self.init_unit, self.end_unit, self.dims, graphics.locations[self.anchor])]) # Set initial values if PRERENDER_TO_TEXTURE: init_pos = [(1 - a)* s/to_decimal(2) for s, a in zip(self._size, graphics.locations[self.anchor])] else: init_pos = list(self.position) init_unit = [c + m/2 for c, m in zip(self.init_unit, unit_grad)] cur_unit = list(init_unit) cur_unit_pos = list(init_pos) # Add unit cells to batches in nested for loop for j in range(self.dims[1]): for i in range(self.dims[0]): cur_unit_rect = graphics.Rect(cur_unit_pos, cur_unit, anchor=self.anchor) cur_unit_rect.col = self.cols[(i + j) % 2] cur_unit_rect.add_to_batch(self._batches[0]) cur_unit_rect.col = self.cols[(i + j + 1) % 2] cur_unit_rect.add_to_batch(self._batches[1]) # Increase x values cur_unit_pos[0] += \ graphics.locations[self.anchor][0] * cur_unit[0] cur_unit[0] += unit_grad[0] # Reset x values cur_unit_pos[0] = init_pos[0] cur_unit[0] = init_unit[0] # Increase y values cur_unit_pos[1] += \ graphics.locations[self.anchor][1] * cur_unit[1] cur_unit[1] += unit_grad[1] if PRERENDER_TO_TEXTURE: # Create textures int_size = [int(round(s)) for s in self._size] self._prerenders =\ [pyglet.image.Texture.create(*int_size) for n in range(2)] # Set up framebuffer fbo = graphics.Framebuffer() for n in range(2): fbo.attach_texture(self._prerenders[n]) # Draw batch to texture fbo.start_render() self._batches[n].draw() fbo.end_render() # Anchor textures for correct blitting later self._prerenders[n].anchor_x, self._prerenders[n].anchor_y =\ [int(round((1 - a)* s/to_decimal(2))) for s, a in zip(self._size, graphics.locations[self.anchor])] fbo.delete() # Delete batches since they won't be used del self._batches self._computed = True def draw(self, always_compute=False): """Draws appropriate prerender depending on current phase.""" if not self._computed or always_compute: self.compute() self._cur_phase %= 360 n = int(self._cur_phase // 180) if PRERENDER_TO_TEXTURE: self._prerenders[n].blit(*self.position) else: self._batches[n].draw() def lazydraw(self): """Only draws on color reversal.""" cur_n = int(self._cur_phase // 180) prev_n = int(self._prev_phase // 180) if (cur_n != prev_n) or self._first_draw: self.draw() if self._first_draw: self._first_draw = False diff --git a/src/signals.py b/src/signals.py index 500664d..c972759 100644 --- a/src/signals.py +++ b/src/signals.py @@ -1,140 +1,138 @@ """Module for signalling upon stimuli appearance using the serial or parallel ports.""" SERPORT = None PARPORT = None STATE = None OLD_STATE = None # Arranged in order of decreasing priority USER_START = 128 # 0b10000000 FIX_START = 99 # 0b01100011 TRACK_START = 98 # 0b01100010 TRACK_STOP = 89 # 0b01011001 FIX_STOP = 88 # 0b01011000 GROUP_START = 60 # 0b00111100 GROUP_STOP = 40 # 0b00101000 BOARD_FLIP = 10 # 0b00001010 -FLIP_SIG_PER = 10 - available = {'serial': False, 'parallel': False} try: import serial try: test_port = serial.Serial(0) test_port.close() del test_port available['serial'] = True except serial.serialutil.SerialException: pass except ImportError: pass try: import parallel try: test_port = parallel.Parallel() del test_port available['parallel'] = True except: pass except ImportError: pass if available['serial']: def ser_init(): global SERPORT SERPORT = serial.Serial(0) def ser_send(): global SERPORT global STATE if STATE != None: SERPORT.write(str(STATE)) def ser_quit(): global SERPORT SERPORT.close() SERPORT = None if available['parallel']: def par_init(): global PARPORT PARPORT = parallel.Parallel() PARPORT.setData(0) def par_send(): global PARPORT global STATE if STATE != None: PARPORT.setData(STATE) else: PARPORT.setData(0) def par_quit(): global PARPORT PARPORT.setData(0) PARPORT = None def init(sigser, sigpar): global STATE global OLD_STATE STATE = None OLD_STATE = None if sigser: ser_init() if sigpar: par_init() def set_state(NEW_STATE): global STATE global OLD_STATE if NEW_STATE == None or NEW_STATE >= STATE: OLD_STATE = STATE STATE = NEW_STATE def set_board_flip(board_id): set_state(BOARD_FLIP + board_id) def set_group_start(group_id): set_state(GROUP_START + group_id) def set_group_stop(group_id): set_state(GROUP_STOP + group_id) def set_user_start(): set_state(USER_START) def set_fix_start(): set_state(FIX_START) def set_fix_stop(): set_state(FIX_STOP) def set_track_start(): set_state(TRACK_START) def set_track_stop(): set_state(TRACK_STOP) def set_null(): set_state(None) def send(sigser, sigpar): if sigser: ser_send() if STATE != OLD_STATE: if sigpar: par_send() def quit(sigser, sigpar): set_null() if sigser: ser_quit() if sigpar: par_quit()
ztangent/checkergen
cb34702294c2459d299e798d3733401c7b220611
Introduced signal priority, signal sending upon tracking start/stop.
diff --git a/src/cli.py b/src/cli.py index 0a4b1e6..627251c 100644 --- a/src/cli.py +++ b/src/cli.py @@ -523,548 +523,548 @@ class CkgCmd(cmd.Cmd): def help_ed(self): self.__class__.ed_parser.print_help() def do_ed(self, line): """Edits attributes of checkerboards specified by ids.""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups, please create one first' return try: args = self.__class__.ed_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.ed_parser.print_usage() return # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist[:]: if x >= len(self.cur_group.shapes) or x < 0: args.idlist.remove(x) print "checkerboard", x, "does not exist" if args.idlist == []: return names = public_dir(args) names.remove('idlist') noflags = True for name in names: val = getattr(args, name) if val != None: for x in args.idlist: self.cur_proj.set_shape_attr(self.cur_group, x, name, val) noflags = False if noflags: print "no options specified, please specify at least one" self.__class__.ed_parser.print_usage() rm_parser = CmdParser(add_help=False, prog='rm', description='''Removes checkerboards specified by ids.''') rm_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''ids of checkerboards in the current group to be removed''') rm_parser.add_argument('-a', '--all', action='store_true', help='''remove all checkerboards in the current group''') def help_rm(self): self.__class__.rm_parser.print_help() def do_rm(self, line): """Removes checkerboards specified by ids""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups, no boards to remove' return try: args = self.__class__.rm_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.rm_parser.print_usage() return rmlist = [] if args.all: for shape in self.cur_group.shapes: self.cur_proj.del_shape_from_group(self.cur_group, shape) print "all checkerboards removed" return elif len(args.idlist) == 0: print "please specify at least one id" # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist: if x >= len(self.cur_group.shapes) or x < 0: print "checkerboard", x, "does not exist" continue rmlist.append(self.cur_group.shapes[x]) print "checkerboard", x, "removed" for shape in rmlist: self.cur_proj.del_shape_from_group(self.cur_group, shape) ls_parser = CmdParser(add_help=False, prog='ls', description='''Lists project, display group and checkerboard settings. If no group ids are specified, all display groups are listed.''') ls_parser.add_argument('gidlist', nargs='*', metavar='gid', type=int, help='''ids of the display groups to be listed''') ls_group = ls_parser.add_mutually_exclusive_group() ls_group.add_argument('-s', '--settings', action='store_true', help='list only project settings') ls_group.add_argument('-g', '--groups', action='store_true', help='list only display groups') def help_ls(self): self.__class__.ls_parser.print_help() def do_ls(self, line): """Lists project, display group and checkerboard settings.""" def ls_str(s, seps=[',',';']): """Special space-saving output formatter.""" if type(s) in [tuple, list]: if len(seps) > 1: newseps = seps[1:] else: newseps = seps return seps[0].join([ls_str(i, newseps) for i in s]) else: return str(s) if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.ls_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.ls_parser.print_usage() return # Remove duplicates and ascending sort args.gidlist = sorted(set(args.gidlist)) if len(self.cur_proj.groups) == 0: if len(args.gidlist) > 0: print 'this project has no display groups that can be listed' args.settings = True else: for gid in args.gidlist[:]: if gid >= len(self.cur_proj.groups) or gid < 0: args.gidlist.remove(gid) print 'display group', gid, 'does not exist' if args.gidlist == []: args.gidlist = range(len(self.cur_proj.groups)) else: # If any (valid) groups are specified # don't show project settings args.groups = True if not args.groups: print 'PROJECT SETTINGS'.center(70,'*') print \ 'name'.rjust(16),\ 'fps'.rjust(7),\ 'resolution'.rjust(14),\ 'bg color'.rjust(18) # 'format'.rjust(7) print \ ls_str(self.cur_proj.name).rjust(16),\ ls_str(self.cur_proj.fps).rjust(7),\ ls_str(self.cur_proj.res).rjust(14),\ ls_str(self.cur_proj.bg).rjust(18) # ls_str(self.cur_proj.export_fmt).rjust(7) print \ 'pre-display'.rjust(26),\ 'post-display'.rjust(26) print \ ls_str(self.cur_proj.pre).rjust(26),\ ls_str(self.cur_proj.post).rjust(26) print \ 'cross colors'.rjust(26),\ 'cross times'.rjust(26) print \ ls_str(self.cur_proj.cross_cols).rjust(26),\ ls_str(self.cur_proj.cross_times).rjust(26) if not args.settings and not args.groups: # Insert empty line if both groups and project # settings are listed print '' if not args.settings: for i, n in enumerate(args.gidlist): if i != 0: # Print newline seperator between each group print '' group = self.cur_proj.groups[n] print 'GROUP {n}'.format(n=n).center(70,'*') print \ 'pre-display'.rjust(20),\ 'display'.rjust(20),\ 'post-display'.rjust(20) print \ ls_str(group.pre).rjust(20),\ ls_str(group.disp).rjust(20),\ ls_str(group.post).rjust(20) if len(group.shapes) > 0: print \ ''.rjust(2),\ 'shape id'.rjust(8),\ 'dims'.rjust(10),\ 'init_unit'.rjust(14),\ 'end_unit'.rjust(14),\ 'position'.rjust(14) for m, shape in enumerate(group.shapes): print \ ''.rjust(2),\ ls_str(m).rjust(8),\ ls_str(shape.dims).rjust(10),\ ls_str(shape.init_unit).rjust(14),\ ls_str(shape.end_unit).rjust(14),\ ls_str(shape.position).rjust(14) print '\n',\ ''.rjust(2),\ 'shape id'.rjust(8),\ 'colors'.rjust(27),\ 'anchor'.rjust(12),\ 'freq'.rjust(6),\ 'phase'.rjust(7) for m, shape in enumerate(group.shapes): print \ ''.rjust(2),\ ls_str(m).rjust(8),\ ls_str(shape.cols).rjust(27),\ ls_str(shape.anchor).rjust(12),\ ls_str(shape.freq).rjust(6),\ ls_str(shape.phase).rjust(7) display_parser = CmdParser(add_help=False, prog='display', description='''Displays the animation in a window or in fullscreen.''') display_parser.add_argument('-b', '--block', metavar='PATH', help='''read flags and dislay group order from specified file, ignore other flags''') display_parser.add_argument('-f', '--fullscreen', action='store_true', help='sets fullscreen mode, ESC to quit') display_parser.add_argument('-p', '--priority', metavar='LEVEL', help='''set priority while displaying, higher priority results in less dropped frames (choices: 0-3, low, normal, high, realtime)''') display_parser.add_argument('-r', '--repeat', metavar='N', type=int, help='''repeatedly display specified display groups N number of times''') display_parser.add_argument('-pt', '--phototest', action='store_true', help='''draw white test rectangle in topleft corner of screen when groups become visible for a photodiode to detect''') display_parser.add_argument('-lt', '--logtime', action='store_true', help='output frame timestamps to a log file') display_parser.add_argument('-ld', '--logdur', action='store_true', help='output frame durations to a log file') display_parser.add_argument('-ss', '--sigser', action='store_true', help='''send signals through the serial port when shapes are being displayed''') display_parser.add_argument('-sp', '--sigpar', action='store_true', help='''send signals through the parallel port when shapes are being displayed''') display_parser.add_argument('-et', '--eyetrack', action='store_true', help='''use eyetracking to ensure that subject fixates on the cross in the center''') display_parser.add_argument('-eu', '--etuser', action='store_true', help='''allow user to select eyetracking video source from a dialog''') display_parser.add_argument('-ev', '--etvideo', metavar='path', help='''path (with no spaces) to eyetracking video file to be used as the source''') display_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''list of display groups to be displayed in the specified order (default: order by id, i.e. group 0 is first)''') def help_display(self): self.__class__.display_parser.print_help() def do_display(self, line): """Displays the animation in a window or in fullscreen""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.display_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.display_parser.print_usage() return if args.block != None: try: blkdict = core.CkgProj.readblk(args.block) flags = blkdict['flags'] try: args = self.__class__.\ display_parser.parse_args(shlex.split(flags)) args.idlist = blkdict['idlist'] except CmdParserError: print 'error: invalid flags stored in block file' return except IOError: print "error:", str(sys.exc_value) return group_queue = [] if len(args.idlist) > 0: for i in set(args.idlist): if i >= len(self.cur_proj.groups) or i < -1: print 'error: group', i, 'does not exist' return for i in args.idlist: if i == -1: group_queue.append(core.CkgWaitScreen()) else: group_queue.append(self.cur_proj.groups[i]) else: group_queue = list(self.cur_proj.groups) if args.repeat != None: group_queue = list(group_queue * args.repeat) if args.priority != None: if not priority.available: print "error: setting priority not avaible on", sys.platform print "continuing..." else: if args.priority.isdigit(): args.priority = int(args.priority) try: priority.set(args.priority) except ValueError: print "error:", str(sys.exc_value) print "continuing..." if args.eyetrack and eyetracking.available: if not eyetracking.is_calibrated(): try: self.do_calibrate('',True) except eyetracking.EyetrackingError: print "error:", str(sys.exc_value) return if len(path) > 0: print "calibration file successfully loaded" try: self.cur_proj.display(fullscreen=args.fullscreen, logtime=args.logtime, logdur=args.logdur, sigser=args.sigser, sigpar=args.sigpar, phototest=args.phototest, eyetrack=args.eyetrack, etuser=args.etuser, etvideo=args.etvideo, group_queue=group_queue) except (IOError, NotImplementedError, eyetracking.EyetrackingError): print "error:", str(sys.exc_value) return if args.priority != None: try: priority.set('normal') except: pass export_parser = CmdParser(add_help=False, prog='export', description='''Exports animation as an image sequence (in a folder) to the specified directory.''') # export_parser.add_argument('--fmt', dest='export_fmt', # choices=core.EXPORT_FMTS, # help='image format for export') export_parser.add_argument('-n','--nofolder', dest='folder', action='store_false', help='''force images not to exported in a containing folder''') export_parser.add_argument('-r', '--repeat', metavar='N', type=int, help='''repeatedly export specified display groups N number of times''') export_parser.add_argument('duration', nargs='?', type=to_decimal, default='Infinity', help='''number of seconds of the animation that should be exported (default: as long as the entire animation)''') export_parser.add_argument('dir', nargs='?', default=os.getcwd(), help='''destination directory for export (default: current working directory)''') export_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''list of display groups to be exported in the specified order (default: order by id, i.e. group 0 is first)''') def help_export(self): self.__class__.export_parser.print_help() def do_export(self, line): """Exports animation an image sequence to the specified directory.""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.export_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.export_parser.print_usage() return if len(args.idlist) > 0: for i in set(args.idlist): if i >= len(self.cur_proj.groups) or i < 0: print 'error: group', i, 'does not exist' return group_queue = [self.cur_proj.groups[i] for i in args.idlist] else: group_queue = list(self.cur_proj.groups) if args.repeat != None: group_queue = list(group_queue * args.repeat) try: self.cur_proj.export(export_dir=args.dir, export_duration=args.duration, group_queue=group_queue, folder=args.folder) except IOError: print "error:", str(sys.exc_value) return except core.FrameOverflowError: print "warning:", str(sys.exc_value) print "Are you sure you want to continue?" while True: try: if self.__class__.yn_parse(raw_input()): self.cur_proj.export(export_dir=args.dir, export_duration=args.duration, group_queue=group_queue, export_fmt=None, folder=args.folder, force=True) break else: return except TypeError: print str(sys.exc_value) except EOFError: return print "Export done." mkblks_parser = CmdParser(add_help=False, prog='mkblks', description='''Generates randomized experimental blocks from display groups and saves each as a CSV file.''') mkblks_parser.add_argument('-n','--nofolder', dest='folder', action='store_false', help='''force block files not to be saved in a containing folder''') mkblks_parser.add_argument('-d','--dir', default=os.getcwd(), help='''where to save block files (default: current working directory)''') mkblks_parser.add_argument('length', type=int, help='''no. of repeated trials in a block''') mkblks_parser.add_argument('flags', nargs='?', default='', help='''flags passed to the display command that should be used when the block file is run (enclose in quotes and use '+' or '++' in place of '-' or '--')''') def help_mkblks(self): self.__class__.mkblks_parser.print_help() def do_mkblks(self, line): """Generates randomized experimental blocks from display groups.""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.mkblks_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.mkblks_parser.print_usage() return args.flags = args.flags.replace('+','-') try: disp_args = self.__class__.display_parser.\ parse_args(shlex.split(args.flags)) except CmdParserError: print "error: invalid flags to display command" print str(sys.exc_value) self.__class__.display_parser.print_usage() return try: self.cur_proj.mkblks(args.length, path=args.dir, folder=args.folder, flags=args.flags) except IOError: print "error:", str(sys.exc_value) return print "Experimental blocks generated." def do_calibrate(self, line, query=False): """Calibrate subject for eyetracking, or load a calibration file.""" if not eyetracking.available: print "error: eyetracking functionality not available" return if query: print "path to calibration file (leave empty for GUI tool):" path = raw_input().strip().strip('"\'') else: path = line.strip().strip('"\'') if len(path) == 0: path = None - if eyetracking.VET.VideoSourceType == 0: + if not eyetracking.is_source_ready(): # Select default source if none has been selected eyetracking.select_source() try: eyetracking.calibrate(path) except eyetracking.EyetrackingError: if query: raise else: print "error:", str(sys.exc_value) return if len(path) > 0: print "calibration file successfully loaded" def do_quit(self, line): """Quits the program.""" if self.save_check(): return return True def do_EOF(self, line): """Typing Ctrl-D issues this command, which quits the program.""" print '\r' if self.save_check(): return return True def help_help(self): print 'Prints a list of commands.' print "Type 'help <topic>' for more details on each command." def default(self, line): command = line.split()[0] print \ "'{0}' is not a checkergen command.".format(command),\ "Type 'help' for a list of commands" diff --git a/src/core.py b/src/core.py index 0f49dc7..931a4ef 100755 --- a/src/core.py +++ b/src/core.py @@ -1,1028 +1,1048 @@ """Contains core functionality of checkergen. Errors and Exceptions: FileFormatError FrameOverflowError Classes: CkgProj -- A checkergen project, contains settings and CkgDisplayGroups. CkgDisplayGroup -- A set of CheckerShapes to be displayed simultaneously. CheckerShapes -- Abstract checkered shape class CheckerBoard -- A (distorted) checkerboard pattern, can color-flip. """ import os import sys import re import csv import itertools from xml.dom import minidom import pyglet import graphics import signals import eyetracking from utils import * CKG_FMT = 'ckg' XML_NAMESPACE = 'http://github.com/ZOMGxuan/checkergen' MAX_EXPORT_FRAMES = 100000 PRERENDER_TO_TEXTURE = False EXPORT_FMTS = ['png'] EXPORT_DIR_SUFFIX = '-anim' BLOCK_DIR_SUFFIX = '-blks' FIX_POS = (0, 0) FIX_RANGE = (20, 20) SANS_SERIF = ('Helvetica', 'Arial', 'FreeSans') def xml_get(parent, namespace, name, index=0): """Returns concatenated text node values inside an element.""" element = [node for node in parent.childNodes if node.localName == name and node.namespaceURI == namespace][index] strings = [] for node in element.childNodes: if node.nodeType == node.TEXT_NODE: strings.append(node.data) return ''.join(strings) def xml_set(document, parent, name, string): """Stores value as a text node in a new DOM element.""" element = document.createElement(name) parent.appendChild(element) text = document.createTextNode(string) element.appendChild(text) def xml_pretty_print(document, indent): """Hack to prettify minidom's not so pretty print.""" ugly_xml = document.toprettyxml(indent=indent) prettifier_re = re.compile('>\n\s+([^<>\s].*?)\n\s+</', re.DOTALL) pretty_xml = prettifier_re.sub('>\g<1></', ugly_xml) return pretty_xml class FileFormatError(ValueError): """Raised when correct file format/extension is not supplied.""" pass class FrameOverflowError(Exception): """Raised when more than MAX_EXPORT_FRAMES are going to be exported.""" pass class CkgProj: """Defines a checkergen project, with checkerboards and other settings.""" DEFAULTS = {'name': 'untitled', 'fps': 60, 'res': (800, 600), 'bg': (127, 127, 127), 'export_fmt': 'png', 'pre': 0, 'post': 0, 'cross_cols': ((0, 0, 0), (255, 0, 0)), 'cross_times': ('Infinity', 1)} def __init__(self, **keywords): """Initializes a new project, or loads it from a path. path -- if specified, ignore other arguments and load project from path name -- name of the project, always the same as the filename without the extension fps -- frames per second of the animation to be displayed res -- screen resolution / window size at which project will be displayed bg -- background color of the animation as a 3-tuple (R, G, B) export_fmt -- image format for animation to be exported as pre -- time in seconds a blank screen will be shown before any display groups post --time in seconds a blank screen will be shown after any display groups """ if 'path' in keywords.keys(): self.load(keywords['path']) return for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.groups = [] def __setattr__(self, name, value): # Type conversions if name == 'name': value = str(value) elif name in ['fps', 'pre', 'post']: value = to_decimal(value) elif name == 'res': if len(value) != 2: raise ValueError value = tuple([int(v) for v in value]) elif name == 'bg': if len(value) != 3: raise ValueError value = tuple([int(v) for v in value]) elif name == 'export_fmt': if value not in EXPORT_FMTS: msg = 'image format not recognized or supported' raise FileFormatError(msg) elif name == 'cross_cols': if len(value) != 2: raise ValueError for col in value: if len(col) != 3: raise ValueError value = tuple([tuple([int(c) for c in col]) for col in value]) elif name == 'cross_times': if len(value) != 2: raise ValueError value = tuple([to_decimal(x) for x in value]) # Store value self.__dict__[name] = value # Set dirty bit if name != '_dirty': self._dirty = True def add_group(self, group): """Append group to list and set dirty bit.""" self.groups.append(group) self._dirty = True return self.groups.index(group) def del_group(self, group): """Remove group to list and set dirty bit.""" self.groups.remove(group) self._dirty = True def add_shape_to_group(self, group, shape): """Add shape to group specified by id and set dirty bit.""" if group not in self.groups: raise ValueError group.shapes.append(shape) self._dirty = True return group.shapes.index(shape) def del_shape_from_group(self, group, shape): """Removes shape from group specified by id and set dirty bit.""" if group not in self.groups: raise ValueError group.shapes.remove(shape) self._dirty = True def set_group_attr(self, gid, name, value): """Set attribute of a group specified by id and set dirty bit.""" setattr(self.groups[gid], name, value) self._dirty = True def set_shape_attr(self, group, sid, name, value): """Set attribute of a shape specified by id and set dirty bit.""" if group not in self.groups: raise ValueError setattr(group.shapes[sid], name, value) self._dirty = True def is_dirty(self): return self._dirty def load(self, path): """Loads project from specified path.""" # Get project name from filename name, ext = os.path.splitext(os.path.basename(path)) if ext == '.{0}'.format(CKG_FMT): self.name = name else: msg = "path lacks '.{0}' extension".format(CKG_FMT) raise FileFormatError(msg) with open(path, 'r') as project_file: doc = minidom.parse(project_file) project = doc.documentElement vars_to_load = self.__class__.DEFAULTS.keys() # Name is not stored in project file vars_to_load.remove('name') for var in vars_to_load: try: value = eval(xml_get(project, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) self.groups = [] group_els = [node for node in project.childNodes if node.localName == 'group' and node.namespaceURI == XML_NAMESPACE] for group_el in group_els: new_group = CkgDisplayGroup() new_group.load(group_el) self.groups.append(new_group) self._dirty = False def save(self, path): """Saves project to specified path as an XML document.""" self.name, ext = os.path.splitext(os.path.basename(path)) if ext != '.{0}'.format(CKG_FMT): path = '{0}.{1}'.format(path, CKG_FMT) impl = minidom.getDOMImplementation() doc = impl.createDocument(XML_NAMESPACE, 'project', None) project = doc.documentElement # Hack below because minidom doesn't support namespaces properly project.setAttribute('xmlns', XML_NAMESPACE) vars_to_save = self.__class__.DEFAULTS.keys() # Name is not stored in project file vars_to_save.remove('name') for var in vars_to_save: xml_set(doc, project, var, repr(getattr(self, var))) for group in self.groups: group.save(doc, project) with open(path, 'w') as project_file: project_file.write(xml_pretty_print(doc,indent=' ')) self._dirty = False return path def mkblks(self, length, path=None, folder=True, flags=''): """Generates randomized experimental blocks from display groups. Each block is saved as a CSV file. length -- number of repeated trials within a block path -- directory in which experimental blocks will be saved folder -- blocks will be saved in a containing folder if true flags -- string of flags to be issued to the display command when block file is run """ if path == None: path = os.getcwd() if not os.path.isdir(path): msg = "specified directory does not exist" raise IOError(msg) if folder: path = os.path.join(path, self.name + BLOCK_DIR_SUFFIX) if not os.path.isdir(path): os.mkdir(path) group_ids = range(len(self.groups)) for n, sequence in enumerate(itertools.permutations(group_ids)): blkname = 'block{0}.csv'.format(repr(n).zfill(numdigits(length))) blkfile = open(os.path.join(path, blkname), 'wb') blkwriter = csv.writer(blkfile, dialect='excel-tab') blkwriter.writerow(['checkergen experimental block file']) blkwriter.writerow(['flags:', flags]) blkwriter.writerow(['repeats:', length]) blkwriter.writerow(['sequence:'] + list(sequence)) blkfile.close() @staticmethod def readblk(path): """Reads the information in a block file and returns it in a dict.""" if not os.path.isfile(path): msg = "specified file does not exist" raise IOError(msg) blkdict = dict() blkfile = open(path, 'rb') blkreader = csv.reader(blkfile, dialect='excel-tab') for n, row in enumerate(blkreader): if n == 1: blkdict['flags'] = row[1] elif n == 2: repeats = int(row[1]) elif n == 3: sequence = row[1:] sequence = [int(i) for i in sequence] blkfile.close() blkdict['idlist'] = ([-1] + sequence) * repeats return blkdict def display(self, fullscreen=False, logtime=False, logdur=False, sigser=False, sigpar=False, phototest=False, eyetrack=False, etuser=False, etvideo=None, group_queue=[]): """Displays the project animation on the screen. fullscreen -- animation is displayed fullscreen if true, stretched to fit if necessary logtime -- timestamp of each frame is saved to a logfile if true logdur -- duration of each frame is saved to a logfile if true sigser -- send signals through serial port when each group is shown sigpar -- send signals through parallel port when each group is shown phototest -- draw white rectangle in topleft corner when each group is shown for photodiode to detect eyetrack -- use eyetracking to ensure subject is fixating on cross etuser -- if true, user gets to select eyetracking video source in GUI etvideo -- optional eyetracking video source file to use instead of live feed group_queue -- queue of groups to be displayed, defaults to order of groups in project (i.e. groups[0] first, etc.) """ # Create fixation crosses fix_crosses = [graphics.Cross([r/2 for r in self.res], (20, 20), col = cross_col) for cross_col in self.cross_cols] # Create test rectangle if phototest: test_rect = graphics.Rect((0, self.res[1]), [r/8 for r in self.res], anchor='topleft') # Set-up groups and variables that control their display if group_queue == []: group_queue = list(self.groups) cur_group = None cur_id = -1 flipped = 0 flip_id = -1 groups_duration = sum([group.duration() for group in group_queue]) groups_start = self.pre * self.fps groups_stop = (self.pre + groups_duration) * self.fps disp_end = (self.pre + groups_duration + self.post) * self.fps if groups_start == 0 and groups_stop > 0: groups_visible = True else: groups_visible = False count = 0 # Initialize ports if sigser: if not signals.available['serial']: msg = 'serial port functionality not available' raise NotImplementedError(msg) if sigpar: if not signals.available['parallel']: msg = 'parallel port functionality not available' raise NotImplementedError(msg) signals.init(sigser, sigpar) # Initialize eyetracking if eyetrack: if not eyetracking.available: msg = 'eyetracking functionality not available' raise NotImplementedError(msg) fixating = False old_fixating = False + tracking = False + old_tracking = False eyetracking.select_source(etuser, etvideo) eyetracking.start() # Stretch to fit screen only if project res does not equal screen res scaling = False if fullscreen: window = pyglet.window.Window(fullscreen=True, visible=False) if (window.width, window.height) != self.res: scaling = True else: window = pyglet.window.Window(*self.res, visible=False) # Set up KeyStateHandler to handle keyboard input keystates = pyglet.window.key.KeyStateHandler() window.push_handlers(keystates) # Create framebuffer object for drawing unscaled scene if scaling: canvas = pyglet.image.Texture.create(*self.res) fbo = graphics.Framebuffer(canvas) fbo.start_render() graphics.set_clear_color(self.bg) fbo.clear() fbo.end_render() # Clear window and make visible window.switch_to() graphics.set_clear_color(self.bg) window.clear() window.set_visible() # Initialize logging variables if logtime and logdur: logstring = '' stamp = Timer() dur = Timer() stamp.start() dur.start() elif logtime or logdur: logstring = '' timer = Timer() timer.start() # Main loop while not window.has_exit and count < disp_end: # Clear canvas if scaling: fbo.start_render() fbo.clear() else: window.clear() # Assume no change to group visibility flipped = 0 signals.set_null() # Manage groups when they are on_screen if groups_visible: # Send special signal if waitscreen ends if isinstance(cur_group, CkgWaitScreen): if cur_group.over: signals.set_user_start() cur_group = None elif cur_group != None: # Check whether group changes in visibility if cur_group.visible != cur_group.old_visible: flip_id = self.groups.index(cur_group) if cur_group.visible: flipped = 1 elif cur_group.old_visible: flipped = -1 # Check if current group is over if cur_group.over: cur_group = None # Get next group from queue if cur_group == None: cur_id += 1 if cur_id >= len(group_queue): groups_visible = False else: cur_group = group_queue[cur_id] cur_group.reset() if not isinstance(cur_group, CkgWaitScreen): if cur_group.visible: flip_id = cur_id flipped = 1 # Draw and then update group if cur_group != None: cur_group.draw() cur_group.update(fps=self.fps, keystates=keystates) # Send signals upon group visibility change if flipped == 1: signals.set_group_start(flip_id) # Draw test rectangle if phototest: test_rect.draw() elif flipped == -1: signals.set_group_stop(flip_id) - # Draw normal cross color if fixating, other color if not if eyetrack: + # First check if tracking and send signals + old_tracking = tracking + tracking = eyetracking.is_tracking() + if tracking: + if not old_tracking: + # Send signal if tracking starts + signals.set_track_start() + else: + if old_tracking: + # Send signal if tracking stops + signals.set_track_stop() + + # Next check for fixation old_fixating = fixating fixating = eyetracking.fixating(FIX_POS, FIX_RANGE) if fixating: + # Draw normal cross color if fixating fix_crosses[0].draw() if not old_fixating: + # Send signal if fixation starts signals.set_fix_start() else: + # Draw alternative cross color if not fixating fix_crosses[1].draw() if old_fixating: + # Send signal if fixation stops signals.set_fix_stop() + # Change cross color based on time if eyetracking is not enabled - elif (count % (sum(self.cross_times) * self.fps) - < self.cross_times[0] * self.fps): - fix_crosses[0].draw() - else: - fix_crosses[1].draw() + if not eyetrack: + if (count % (sum(self.cross_times) * self.fps) + < self.cross_times[0] * self.fps): + fix_crosses[0].draw() + else: + fix_crosses[1].draw() # Increment count and set whether groups should be shown if not isinstance(cur_group, CkgWaitScreen): count += 1 if groups_start <= count < groups_stop: groups_visible = True else: groups_visible = False # Blit canvas to screen if necessary if scaling: fbo.end_render() window.switch_to() canvas.blit(0, 0) window.dispatch_events() window.flip() # Make sure everything has been drawn pyglet.gl.glFinish() # Append time information to log string if logtime and logdur: logstring = '\n'.join([logstring, str(stamp.elapsed())]) logstring = '\t'.join([logstring, str(dur.restart())]) elif logtime: logstring = '\n'.join([logstring, str(timer.elapsed())]) elif logdur: logstring = '\n'.join([logstring, str(timer.restart())]) # Send signals ASAP after flip signals.send(sigser, sigpar) # Log when signals are sent if logtime or logdur: if flipped != 0 and (sigser or sigpar): sigmsg = '{0} sent'.format(signals.STATE) logstring = '\t'.join([logstring, sigmsg]) # Clean up if eyetrack: eyetracking.stop() window.close() if scaling: fbo.delete() del canvas signals.quit(sigser, sigpar) # Write log string to file if logtime or logdur: filename = '{0}.log'.format(self.name) with open(filename, 'w') as logfile: logfile.write(logstring) def export(self, export_dir, export_duration, group_queue=[], export_fmt=None, folder=True, force=False): if not os.path.isdir(export_dir): msg = 'export path is not a directory' raise IOError(msg) if export_fmt == None: export_fmt = self.export_fmt # Set-up groups and variables that control their display if group_queue == []: group_queue = list(self.groups) cur_group = None cur_id = -1 groups_duration = sum([group.duration() for group in group_queue]) groups_start = self.pre * self.fps groups_stop = (self.pre + groups_duration) * self.fps disp_end = (self.pre + groups_duration + self.post) * self.fps if groups_start == 0 and groups_stop > 0: groups_visible = True else: groups_visible = False count = 0 # Limit export duration to display duration frames = export_duration * self.fps frames = min(frames, disp_end) # Warn user if a lot of frames will be exported if frames > MAX_EXPORT_FRAMES and not force: msg = 'very large number ({0}) of frames to be exported'.\ format(frames) raise FrameOverflowError(msg) # Create folder to store images if necessary if folder: export_dir = os.path.join(export_dir, self.name + EXPORT_DIR_SUFFIX) if not os.path.isdir(export_dir): os.mkdir(export_dir) # Create fixation crosses fix_crosses = [graphics.Cross([r/2 for r in self.res], (20, 20), col = cross_col) for cross_col in self.cross_cols] # Set up canvas and framebuffer object canvas = pyglet.image.Texture.create(*self.res) fbo = graphics.Framebuffer(canvas) fbo.start_render() graphics.set_clear_color(self.bg) fbo.clear() # Main loop while count < frames: fbo.clear() if groups_visible: # Check if current group is over if cur_group != None: if cur_group.over: cur_group = None # Get next group from queue if cur_group == None: cur_id += 1 if cur_id >= len(group_queue): groups_visible = False else: cur_group = group_queue[cur_id] cur_group.reset() # Draw and then update group if cur_group != None: cur_group.draw() cur_group.update(fps=self.fps) # Draw fixation cross based on current count if (count % (sum(self.cross_times) * self.fps) < self.cross_times[0] * self.fps): fix_crosses[0].draw() else: fix_crosses[1].draw() # Save current frame to file savepath = \ os.path.join(export_dir, '{0}{2}.{1}'. format(self.name, export_fmt, repr(count).zfill(numdigits(frames-1)))) canvas.save(savepath) # Increment count and set whether groups should be shown count += 1 if groups_start <= count < groups_stop: groups_visible = True else: groups_visible = False fbo.delete() class CkgDisplayGroup: DEFAULTS = {'pre': 0, 'disp': 'Infinity', 'post': 0} def __init__(self, **keywords): """Create a new group of shapes to be displayed together. pre -- time in seconds a blank screen is shown before shapes in group are displayed disp -- time in seconds the shapes in the group are displayed, negative numbers result in shapes being displayed forever post -- time in seconds a blank screen is shown after shapes in group are displayed """ for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.shapes = [] self.reset() def __setattr__(self, name, value): if name in self.__class__.DEFAULTS: value = to_decimal(value) self.__dict__[name] = value def duration(self): """Returns total duration of display group.""" return self.pre + self.disp + self.post def reset(self): """Resets internal count and all contained shapes.""" self._count = 0 self._start = self.pre self._stop = self.pre + self.disp self._end = self.pre + self.disp + self.post self.over = False self.old_visible = False if self._start == 0 and self._stop > 0: self.visible = True else: self.visible = False if self._end == 0: self.over = True self._flip_count = [0] * len(self.shapes) for shape in self.shapes: shape.reset() def draw(self, lazy=False): """Draws all contained shapes during the appropriate interval.""" if self.visible: for shape in self.shapes: if lazy: shape.lazydraw() else: shape.draw() def update(self, **keywords): """Increments internal count, makes group visible when appropriate. fps -- refresh rate of the display in frames per second flip_sig_per -- number of shape colour reversals that have to occur for a unique signal to be sent for that shape """ fps = keywords['fps'] if 'flip_sig_per' in keywords.keys(): flip_sig_per = keywords['flip_sig_per'] else: flip_sig_per = signals.FLIP_SIG_PER if self.visible: # Set triggers to be sent for n, shape in enumerate(self.shapes): if shape.flipped: self._flip_count[n] += 1 if self._flip_count[n] >= flip_sig_per: signals.set_board_flip(n) self._flip_count[n] = 0 # Update contained shapes for shape in self.shapes: shape.update(fps) # Increment count and set flags for the next frame self._count += 1 self.old_visible = self.visible if (self._start * fps) <= self._count < (self._stop * fps): self.visible = True else: self.visible = False if self._count >= (self._end * fps): self.over = True else: self.over = False def save(self, document, parent): """Saves group in specified XML document as child of parent.""" group_el = document.createElement('group') parent.appendChild(group_el) for var in self.__class__.DEFAULTS.keys(): xml_set(document, group_el, var, repr(getattr(self, var))) for shape in self.shapes: shape.save(document, group_el) def load(self, element): """Loads group from XML DOM element.""" for var in self.__class__.DEFAULTS.keys(): try: value = eval(xml_get(element, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) shape_els = [node for node in element.childNodes if node.localName == 'shape' and node.namespaceURI == XML_NAMESPACE] for shape_el in shape_els: # TODO: Make load code shape-agnostic new_shape = CheckerBoard() new_shape.load(shape_el) self.shapes.append(new_shape) class CkgWaitScreen(CkgDisplayGroup): """Dummy display group, waits for user input to proceed.""" DEFAULTS = {'g_keys': (pyglet.window.key.SPACE,), 'r_keys': (pyglet.window.key.NUM_ENTER, pyglet.window.key.ENTER), 'res': CkgProj.DEFAULTS['res'], 'g_info': "the experiment will start soon", 'r_info': "press enter when ready", 'font_color': (0, 0, 0, 255), 'font_size': 16} def __init__(self, **keywords): """Create an informative waitscreen that proceeds after user input.""" for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.g_label = pyglet.text.Label(self.g_info, font_name=SANS_SERIF, font_size=self.font_size, color=self.font_color, bold=True, x=self.res[0]//2, y=self.res[1]//8, anchor_x='center', anchor_y='center') self.r_label = pyglet.text.Label(self.r_info, font_name=SANS_SERIF, font_size=self.font_size, color=self.font_color, bold=True, x=self.res[0]//2, y=self.res[1]//8, anchor_x='center', anchor_y='center') self.reset() def __setattr__(self, name, value): self.__dict__[name] = value def duration(self): """Returns zero since wait times are arbitrary.""" return to_decimal(0) def reset(self): """Resets some flags.""" self.ready = False self.over = False def draw(self): """Draw informative text.""" if not self.ready: self.r_label.draw() else: self.g_label.draw() def update(self, **keywords): """Checks for keypress, sends signal upon end.""" keystates = keywords['keystates'] if self.r_keys == None: if max([keystates[key] for key in self.g_keys]): self.ready = True self.over = True elif not self.ready: if max([keystates[key] for key in self.r_keys]): self.ready = True else: if max([keystates[key] for key in self.g_keys]): self.over = True class CheckerShape: # Abstract class, to be implemented. pass class CheckerDisc(CheckerShape): # Circular checker pattern, to be implemented pass class CheckerBoard(CheckerShape): DEFAULTS = {'dims': (5, 5), 'init_unit': (30, 30), 'end_unit': (50, 50), 'position': (0, 0), 'anchor': 'bottomleft', 'cols': ((0, 0, 0), (255, 255, 255)), 'freq': 1, 'phase': 0} # TODO: Reimplement mid/center anchor functionality in cool new way def __init__(self, **keywords): for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.reset() def __setattr__(self, name, value): # Type conversions if name == 'dims': if len(value) != 2: raise ValueError value = tuple([int(x) for x in value]) elif name in ['init_unit', 'end_unit', 'position']: if len(value) != 2: raise ValueError value = tuple([to_decimal(x) for x in value]) elif name == 'anchor': if value not in graphics.locations.keys(): raise ValueError elif name == 'cols': if len(value) != 2: raise ValueError for col in value: if len(col) != 3: raise ValueError value = tuple([tuple([int(c) for c in col]) for col in value]) elif name in ['freq', 'phase']: value = to_decimal(value) # Store value self.__dict__[name] = value # Recompute if necessary if name in ['dims', 'init_unit', 'end_unit', 'position', 'anchor','cols']: self._computed = False def save(self, document, parent): """Saves board in specified XML document as child of parent.""" board_el = document.createElement('shape') board_el.setAttribute('type', 'board') parent.appendChild(board_el) for var in self.__class__.DEFAULTS.keys(): xml_set(document, board_el, var, repr(getattr(self, var))) def load(self, element): """Loads group from XML DOM element.""" for var in self.__class__.DEFAULTS.keys(): try: value = eval(xml_get(element, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) def reset(self, new_phase=None): """Resets checkerboard animation back to initial phase.""" if new_phase == None: new_phase = self.phase self._cur_phase = new_phase self._prev_phase = new_phase self.flipped = False self._first_draw = True if not self._computed: self.compute() def update(self, fps): """Increase the current phase of the checkerboard animation.""" self._prev_phase = self._cur_phase if self.freq != 0: degs_per_frame = 360 * self.freq / fps self._cur_phase += degs_per_frame if self._cur_phase >= 360: self._cur_phase %= 360 cur_n = int(self._cur_phase // 180) prev_n = int(self._prev_phase // 180) if cur_n != prev_n: self.flipped = True else: self.flipped = False def compute(self): """Computes a model of the checkerboard for drawing later.""" # Create batches to store model self._batches = [pyglet.graphics.Batch() for n in range(2)] # Calculate size of checkerboard in pixels self._size = tuple([(y1 + y2) / 2 * n for y1, y2, n in zip(self.init_unit, self.end_unit, self.dims)]) # Calculate unit size gradient unit_grad = tuple([(2 if (flag == 0) else 1) * (y2 - y1) / n for y1, y2, n, flag in zip(self.init_unit, self.end_unit, self.dims, graphics.locations[self.anchor])]) # Set initial values if PRERENDER_TO_TEXTURE: init_pos = [(1 - a)* s/to_decimal(2) for s, a in zip(self._size, graphics.locations[self.anchor])] else: init_pos = list(self.position) init_unit = [c + m/2 for c, m in zip(self.init_unit, unit_grad)] cur_unit = list(init_unit) cur_unit_pos = list(init_pos) # Add unit cells to batches in nested for loop for j in range(self.dims[1]): for i in range(self.dims[0]): cur_unit_rect = graphics.Rect(cur_unit_pos, cur_unit, anchor=self.anchor) cur_unit_rect.col = self.cols[(i + j) % 2] cur_unit_rect.add_to_batch(self._batches[0]) cur_unit_rect.col = self.cols[(i + j + 1) % 2] cur_unit_rect.add_to_batch(self._batches[1]) # Increase x values cur_unit_pos[0] += \ graphics.locations[self.anchor][0] * cur_unit[0] cur_unit[0] += unit_grad[0] # Reset x values cur_unit_pos[0] = init_pos[0] cur_unit[0] = init_unit[0] # Increase y values cur_unit_pos[1] += \ graphics.locations[self.anchor][1] * cur_unit[1] cur_unit[1] += unit_grad[1] if PRERENDER_TO_TEXTURE: # Create textures int_size = [int(round(s)) for s in self._size] self._prerenders =\ [pyglet.image.Texture.create(*int_size) for n in range(2)] # Set up framebuffer fbo = graphics.Framebuffer() for n in range(2): fbo.attach_texture(self._prerenders[n]) # Draw batch to texture diff --git a/src/eyetracking.py b/src/eyetracking.py index 1ee9adc..de00e81 100644 --- a/src/eyetracking.py +++ b/src/eyetracking.py @@ -1,119 +1,130 @@ """Provides support for CRS VideoEyetracker Toolbox.""" import os.path try: import win32com.client available = True except ImportError: available = False # COM ProgID of the Toolbox ProgID = "crsVET.VideoEyeTracker" # VET application object VET = None class EyetrackingError(Exception): """Raised when something goes wrong with VET.""" pass if available: # Try dispatching object, else unavailable try: VET = win32com.client.Dispatch(ProgID) except: available = False if available: # For easier access to constants and standardization with MATLAB interface CRS = win32com.client.constants def select_source(user_select = False, path = None): if user_select: if not VET.SelectVideoSource(CRS.vsUserSelect, ''): msg = 'could not select video source' raise EyetrackingError(msg) elif path != None: # Open from file if not VET.SelectVideoSource(CRS.vsFile, path): msg = 'could not use path as video source' raise EyetrackingError(msg) else: # Default to 250 Hz High Speed Camera if not VET.SelectVideoSource(CRS.vsHighSpeedCamera250, ''): msg = 'could not select video source' raise EyetrackingError(msg) + def is_source_ready(): + """Returns true if a video source has been selected.""" + if VET.VideoSourceType == 0: + return False + else: + return True + def show_camera(): VET.CreateCameraScreen(0) def quit_camera(): VET.DestroyCameraScreen() def setup(viewing_distance, screen_dims, fixation_period = None, fixation_range = None): """Calibrates the display and sets fixation properties.""" if len(screen_dims) != 2: msg = 'screen_dims must be a 2-tuple' raise ValueError(msg) VET.SetDeviceParameters(CRS.deUser, viewing_distance, screen_dims[0], screen_dims[1]) if fixation_period != None: VET.FixationPeriod = fixation_period if fixation_range != None: VET.FixationRange = fixation_range def calibrate(path = None): """Calibrate the subject. Optionally supply a path with no spaces to a calibration file to load.""" if path == None: if not VET.Calibrate(): msg = 'calibration failed' raise EyetrackingError(msg) else: if not os.path.isfile(path): msg = 'specified file does not exist' raise EyetrackingError(msg) if not VET.LoadCalibrationFile(path): msg = 'file could not be loaded' raise EyetrackingError(msg) def is_calibrated(): if VET.CalibrationStatus()[0] != 0: return True else: return False def start(): """Start tracking the eye.""" if VET.CalibrationStatus()[0] == 0: msg = 'subject not yet calibrated' raise EyetrackingError(msg) VET.ClearDataBuffer() VET.StartTracking() def stop(): """Stop tracking the eye.""" VET.StopTracking() + def is_tracking(): + """Returns true if the eye is being tracked.""" + return bool(VET.Tracking) + def fixating(fix_pos, fix_range): """Checks whether subject is fixating on specificied location. fix_pos -- (x, y) position of desired fixation location in mm from center of screen fix_range -- (width, height) of box surrounding fix_pos within which fixation is allowed (in mm) """ if VET.CalibrationStatus()[0] == 0: msg = 'subject not yet calibrated' raise EyetrackingError(msg) if VET.FixationLocation.Fixation: xdiff = abs(VET.FixationLocation.Xposition - fix_pos[0]) ydiff = abs(VET.FixationLocation.Yposition - fix_pos[1]) if (xdiff <= fix_range[0]/2) and (ydiff <= fix_range[1]/2): return True return False diff --git a/src/signals.py b/src/signals.py index 126b87e..500664d 100644 --- a/src/signals.py +++ b/src/signals.py @@ -1,130 +1,140 @@ """Module for signalling upon stimuli appearance using the serial or parallel ports.""" SERPORT = None PARPORT = None STATE = None OLD_STATE = None +# Arranged in order of decreasing priority USER_START = 128 # 0b10000000 -BOARD_FLIP = 64 # 0b01000000 -GROUP_START = 32 # 0b00100000 -GROUP_STOP = 16 # 0b00010000 -FIX_START = 4 # 0b00000100 -FIX_STOP = 2 # 0b00000010 +FIX_START = 99 # 0b01100011 +TRACK_START = 98 # 0b01100010 +TRACK_STOP = 89 # 0b01011001 +FIX_STOP = 88 # 0b01011000 +GROUP_START = 60 # 0b00111100 +GROUP_STOP = 40 # 0b00101000 +BOARD_FLIP = 10 # 0b00001010 FLIP_SIG_PER = 10 available = {'serial': False, 'parallel': False} try: import serial try: test_port = serial.Serial(0) test_port.close() del test_port available['serial'] = True except serial.serialutil.SerialException: pass except ImportError: pass try: import parallel try: test_port = parallel.Parallel() del test_port available['parallel'] = True except: pass except ImportError: pass if available['serial']: def ser_init(): global SERPORT SERPORT = serial.Serial(0) def ser_send(): global SERPORT global STATE if STATE != None: SERPORT.write(str(STATE)) def ser_quit(): global SERPORT SERPORT.close() SERPORT = None if available['parallel']: def par_init(): global PARPORT PARPORT = parallel.Parallel() PARPORT.setData(0) def par_send(): global PARPORT global STATE if STATE != None: PARPORT.setData(STATE) else: PARPORT.setData(0) def par_quit(): global PARPORT PARPORT.setData(0) PARPORT = None def init(sigser, sigpar): global STATE global OLD_STATE STATE = None OLD_STATE = None if sigser: ser_init() if sigpar: par_init() -def set_state(state): +def set_state(NEW_STATE): global STATE global OLD_STATE - OLD_STATE = STATE - STATE = state + if NEW_STATE == None or NEW_STATE >= STATE: + OLD_STATE = STATE + STATE = NEW_STATE def set_board_flip(board_id): set_state(BOARD_FLIP + board_id) def set_group_start(group_id): set_state(GROUP_START + group_id) def set_group_stop(group_id): set_state(GROUP_STOP + group_id) def set_user_start(): set_state(USER_START) def set_fix_start(): set_state(FIX_START) def set_fix_stop(): set_state(FIX_STOP) +def set_track_start(): + set_state(TRACK_START) + +def set_track_stop(): + set_state(TRACK_STOP) + def set_null(): set_state(None) def send(sigser, sigpar): if sigser: ser_send() if STATE != OLD_STATE: if sigpar: par_send() def quit(sigser, sigpar): set_null() if sigser: ser_quit() if sigpar: par_quit()
ztangent/checkergen
53e9c7416947d2922e41ea588a0d3c365c4f9242
Reading and running experiments from block files implemented.
diff --git a/src/cli.py b/src/cli.py index eaf336f..0a4b1e6 100644 --- a/src/cli.py +++ b/src/cli.py @@ -238,815 +238,833 @@ class CkgCmd(cmd.Cmd): set_parser.add_argument('--cross_times', metavar='TIME1,TIME2', action=store_tuple(2, ',', to_decimal), help='''time in seconds each cross color will be displayed''') def help_set(self): self.__class__.set_parser.print_help() def do_set(self, line): if self.cur_proj == None: print 'no project open, automatically creating project...' self.do_new('') try: args = self.__class__.set_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.set_parser.print_usage() return names = public_dir(args) noflags = True for name in names: val = getattr(args, name) if val != None: setattr(self.cur_proj, name, val) noflags = False if noflags: print "no options specified, please specify at least one" self.__class__.set_parser.print_usage() mkgrp_parser = CmdParser(add_help=False, prog='mkgrp', formatter_class= argparse.ArgumentDefaultsHelpFormatter, description='''Makes a new display group with the given parameters.''') mkgrp_parser.add_argument('pre', type=to_decimal, default=0, nargs='?', help='''time in seconds a blank screen will be shown before shapes are displayed''') mkgrp_parser.add_argument('disp', type=to_decimal, nargs='?', default='Infinity', help='''time in seconds shapes will be displayed''') mkgrp_parser.add_argument('post', type=to_decimal, default=0, nargs='?', help='''time in seconds a blank screen will be shown after shapes are displayed''') def help_mkgrp(self): self.__class__.mkgrp_parser.print_help() def do_mkgrp(self, line): """Makes a display group with the given parameters.""" if self.cur_proj == None: print 'no project open, automatically creating project...' self.do_new('') try: args = self.__class__.mkgrp_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.mkgrp_parser.print_usage() return group_dict = dict([(name, getattr(args, name)) for name in public_dir(args)]) new_group = core.CkgDisplayGroup(**group_dict) new_id = self.cur_proj.add_group(new_group) print "display group", new_id, "added" self.cur_group = new_group print "group", new_id, "is now the current display group" edgrp_parser = CmdParser(add_help=False, prog='edgrp', description='''Edits attributes of display groups specified by ids.''') edgrp_parser.add_argument('idlist', nargs='+', metavar='id', type=int, help='ids of display groups to be edited') edgrp_parser.add_argument('--pre', type=to_decimal, metavar='SECONDS', help='''time in seconds a blank screen will be shown before shapes are displayed''') edgrp_parser.add_argument('--disp', type=to_decimal, metavar='SECONDS', help='''time in seconds shapes will be displayed''') edgrp_parser.add_argument('--post', type=to_decimal, metavar='SECONDS', help='''time in seconds a blank screen will be shown after shapes are displayed''') def help_edgrp(self): self.__class__.edgrp_parser.print_help() def do_edgrp(self, line): """Edits attributes of checkerboards specified by ids.""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.edgrp_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.edgrp_parser.print_usage() return # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist[:]: if x >= len(self.cur_proj.groups) or x < 0: args.idlist.remove(x) print "checkerboard", x, "does not exist" if args.idlist == []: return names = public_dir(args) names.remove('idlist') noflags = True for name in names: val = getattr(args, name) if val != None: for x in args.idlist: self.cur_proj.set_group_attr(x, name, val) noflags = False if noflags: print "no options specified, please specify at least one" self.__class__.edgrp_parser.print_usage() rmgrp_parser = CmdParser(add_help=False, prog='rmgrp', description='''Removes display groups specified by ids.''') rmgrp_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='ids of display groups to be removed') rmgrp_parser.add_argument('-a', '--all', action='store_true', help='remove all groups from the project') def help_rmgrp(self): self.__class__.rmgrp_parser.print_help() def do_rmgrp(self, line): """Removes display groups specified by ids""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups to remove' return try: args = self.__class__.rmgrp_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.rmgrp_parser.print_usage() return rmlist = [] if args.all: for group in self.cur_proj.groups[:]: self.cur_proj.del_group(group) print "all display groups removed" return elif len(args.idlist) == 0: print "please specify at least one id" # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist: if x >= len(self.cur_proj.groups) or x < 0: print "display group", x, "does not exist" continue rmlist.append(self.cur_proj.groups[x]) print "display group", x, "removed" for group in rmlist: self.cur_proj.del_group(group) # Remember to point self.cur_group somewhere sane if self.cur_group not in self.cur_proj.groups: if len(self.cur_proj.groups) == 0: self.cur_group = None else: self.cur_group = self.cur_proj.groups[0] print "group 0 is now the current display group" chgrp_parser = CmdParser(add_help=False, prog='chgrp', description='''Changes display group that is currently active for editing. Prints current group id if no group id is specified''') chgrp_parser.add_argument('gid', metavar='id', type=int, nargs='?', help='id of display group to be made active') def help_chgrp(self): self.__class__.chgrp_parser.print_help() def do_chgrp(self, line): """Changes group that is currently active for editing.""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups that can be made active' return try: args = self.__class__.chgrp_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.chgrp_parser.print_usage() return if args.gid == None: print "group",\ self.cur_proj.groups.index(self.cur_group),\ "is the current display group" elif args.gid >= len(self.cur_proj.groups) or args.gid < 0: print "group", args.gid, "does not exist" else: self.cur_group = self.cur_proj.groups[args.gid] print "group", args.gid, "is now the current display group" mk_parser = CmdParser(add_help=False, prog='mk', description='''Makes a new checkerboard in the current group with the given parameters.''') mk_parser.add_argument('dims', action=store_tuple(2, ',', to_decimal), help='''width,height of checkerboard in no. of unit cells''') mk_parser.add_argument('init_unit', action=store_tuple(2, ',', to_decimal), help='width,height of initial unit cell in pixels') mk_parser.add_argument('end_unit', action=store_tuple(2, ',', to_decimal), help='width,height of final unit cell in pixels') mk_parser.add_argument('position', action=store_tuple(2, ',', to_decimal), help='x,y position of checkerboard in pixels') mk_parser.add_argument('anchor', choices=sorted(locations.keys()), help='''location of anchor point of checkerboard (choices: %(choices)s)''', metavar='anchor') mk_parser.add_argument('cols', action=store_tuple(2, ',', to_color, [';']), help='''color1,color2 of the checkerboard (color format: R;G;B, component range from 0-255)''') mk_parser.add_argument('freq', type=to_decimal, help='frequency of color reversal in Hz') mk_parser.add_argument('phase', type=to_decimal, nargs='?', default='0', help='initial phase of animation in degrees') def help_mk(self): self.__class__.mk_parser.print_help() def do_mk(self, line): """Makes a checkerboard with the given parameters.""" if self.cur_proj == None: print 'no project open, automatically creating project...' self.do_new('') if self.cur_group == None: print 'automatically adding display group...' self.do_mkgrp('') try: args = self.__class__.mk_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.mk_parser.print_usage() return shape_dict = dict([(name, getattr(args, name)) for name in public_dir(args)]) new_shape = core.CheckerBoard(**shape_dict) new_id = self.cur_proj.add_shape_to_group(self.cur_group, new_shape) print "checkerboard", new_id, "added" ed_parser = CmdParser(add_help=False, prog='ed', description='''Edits attributes of checkerboards specified by ids.''') ed_parser.add_argument('idlist', nargs='+', metavar='id', type=int, help='''ids of checkerboards in the current group to be edited''') ed_parser.add_argument('--dims', action=store_tuple(2, ',', to_decimal), help='checkerboard dimensions in unit cells', metavar='WIDTH,HEIGHT') ed_parser.add_argument('--init_unit', action=store_tuple(2, ',', to_decimal), help='initial unit cell dimensions in pixels', metavar='WIDTH,HEIGHT') ed_parser.add_argument('--end_unit', action=store_tuple(2, ',', to_decimal), help='final unit cell dimensions in pixels', metavar='WIDTH,HEIGHT') ed_parser.add_argument('--position', action=store_tuple(2, ',', to_decimal), help='position of checkerboard in pixels', metavar='X,Y') ed_parser.add_argument('--anchor', choices=sorted(locations.keys()), help='''location of anchor point of checkerboard (choices: %(choices)s)''', metavar='LOCATION') ed_parser.add_argument('--cols', metavar='COLOR1,COLOR2', action=store_tuple(2, ',', to_color, [';']), help='''checkerboard colors (color format: R;G;B, component range from 0-255)''') ed_parser.add_argument('--freq', type=to_decimal, help='frequency of color reversal in Hz') ed_parser.add_argument('--phase', type=to_decimal, help='initial phase of animation in degrees') def help_ed(self): self.__class__.ed_parser.print_help() def do_ed(self, line): """Edits attributes of checkerboards specified by ids.""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups, please create one first' return try: args = self.__class__.ed_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.ed_parser.print_usage() return # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist[:]: if x >= len(self.cur_group.shapes) or x < 0: args.idlist.remove(x) print "checkerboard", x, "does not exist" if args.idlist == []: return names = public_dir(args) names.remove('idlist') noflags = True for name in names: val = getattr(args, name) if val != None: for x in args.idlist: self.cur_proj.set_shape_attr(self.cur_group, x, name, val) noflags = False if noflags: print "no options specified, please specify at least one" self.__class__.ed_parser.print_usage() rm_parser = CmdParser(add_help=False, prog='rm', description='''Removes checkerboards specified by ids.''') rm_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''ids of checkerboards in the current group to be removed''') rm_parser.add_argument('-a', '--all', action='store_true', help='''remove all checkerboards in the current group''') def help_rm(self): self.__class__.rm_parser.print_help() def do_rm(self, line): """Removes checkerboards specified by ids""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups, no boards to remove' return try: args = self.__class__.rm_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.rm_parser.print_usage() return rmlist = [] if args.all: for shape in self.cur_group.shapes: self.cur_proj.del_shape_from_group(self.cur_group, shape) print "all checkerboards removed" return elif len(args.idlist) == 0: print "please specify at least one id" # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist: if x >= len(self.cur_group.shapes) or x < 0: print "checkerboard", x, "does not exist" continue rmlist.append(self.cur_group.shapes[x]) print "checkerboard", x, "removed" for shape in rmlist: self.cur_proj.del_shape_from_group(self.cur_group, shape) ls_parser = CmdParser(add_help=False, prog='ls', description='''Lists project, display group and checkerboard settings. If no group ids are specified, all display groups are listed.''') ls_parser.add_argument('gidlist', nargs='*', metavar='gid', type=int, help='''ids of the display groups to be listed''') ls_group = ls_parser.add_mutually_exclusive_group() ls_group.add_argument('-s', '--settings', action='store_true', help='list only project settings') ls_group.add_argument('-g', '--groups', action='store_true', help='list only display groups') def help_ls(self): self.__class__.ls_parser.print_help() def do_ls(self, line): """Lists project, display group and checkerboard settings.""" def ls_str(s, seps=[',',';']): """Special space-saving output formatter.""" if type(s) in [tuple, list]: if len(seps) > 1: newseps = seps[1:] else: newseps = seps return seps[0].join([ls_str(i, newseps) for i in s]) else: return str(s) if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.ls_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.ls_parser.print_usage() return # Remove duplicates and ascending sort args.gidlist = sorted(set(args.gidlist)) if len(self.cur_proj.groups) == 0: if len(args.gidlist) > 0: print 'this project has no display groups that can be listed' args.settings = True else: for gid in args.gidlist[:]: if gid >= len(self.cur_proj.groups) or gid < 0: args.gidlist.remove(gid) print 'display group', gid, 'does not exist' if args.gidlist == []: args.gidlist = range(len(self.cur_proj.groups)) else: # If any (valid) groups are specified # don't show project settings args.groups = True if not args.groups: print 'PROJECT SETTINGS'.center(70,'*') print \ 'name'.rjust(16),\ 'fps'.rjust(7),\ 'resolution'.rjust(14),\ 'bg color'.rjust(18) # 'format'.rjust(7) print \ ls_str(self.cur_proj.name).rjust(16),\ ls_str(self.cur_proj.fps).rjust(7),\ ls_str(self.cur_proj.res).rjust(14),\ ls_str(self.cur_proj.bg).rjust(18) # ls_str(self.cur_proj.export_fmt).rjust(7) print \ 'pre-display'.rjust(26),\ 'post-display'.rjust(26) print \ ls_str(self.cur_proj.pre).rjust(26),\ ls_str(self.cur_proj.post).rjust(26) print \ 'cross colors'.rjust(26),\ 'cross times'.rjust(26) print \ ls_str(self.cur_proj.cross_cols).rjust(26),\ ls_str(self.cur_proj.cross_times).rjust(26) if not args.settings and not args.groups: # Insert empty line if both groups and project # settings are listed print '' if not args.settings: for i, n in enumerate(args.gidlist): if i != 0: # Print newline seperator between each group print '' group = self.cur_proj.groups[n] print 'GROUP {n}'.format(n=n).center(70,'*') print \ 'pre-display'.rjust(20),\ 'display'.rjust(20),\ 'post-display'.rjust(20) print \ ls_str(group.pre).rjust(20),\ ls_str(group.disp).rjust(20),\ ls_str(group.post).rjust(20) if len(group.shapes) > 0: print \ ''.rjust(2),\ 'shape id'.rjust(8),\ 'dims'.rjust(10),\ 'init_unit'.rjust(14),\ 'end_unit'.rjust(14),\ 'position'.rjust(14) for m, shape in enumerate(group.shapes): print \ ''.rjust(2),\ ls_str(m).rjust(8),\ ls_str(shape.dims).rjust(10),\ ls_str(shape.init_unit).rjust(14),\ ls_str(shape.end_unit).rjust(14),\ ls_str(shape.position).rjust(14) print '\n',\ ''.rjust(2),\ 'shape id'.rjust(8),\ 'colors'.rjust(27),\ 'anchor'.rjust(12),\ 'freq'.rjust(6),\ 'phase'.rjust(7) for m, shape in enumerate(group.shapes): print \ ''.rjust(2),\ ls_str(m).rjust(8),\ ls_str(shape.cols).rjust(27),\ ls_str(shape.anchor).rjust(12),\ ls_str(shape.freq).rjust(6),\ ls_str(shape.phase).rjust(7) display_parser = CmdParser(add_help=False, prog='display', description='''Displays the animation in a window or in fullscreen.''') + display_parser.add_argument('-b', '--block', metavar='PATH', + help='''read flags and dislay group order from + specified file, ignore other flags''') display_parser.add_argument('-f', '--fullscreen', action='store_true', help='sets fullscreen mode, ESC to quit') display_parser.add_argument('-p', '--priority', metavar='LEVEL', help='''set priority while displaying, higher priority results in less dropped frames (choices: 0-3, low, normal, high, realtime)''') display_parser.add_argument('-r', '--repeat', metavar='N', type=int, help='''repeatedly display specified display groups N number of times''') display_parser.add_argument('-pt', '--phototest', action='store_true', help='''draw white test rectangle in topleft corner of screen when groups become visible for a photodiode to detect''') display_parser.add_argument('-lt', '--logtime', action='store_true', help='output frame timestamps to a log file') display_parser.add_argument('-ld', '--logdur', action='store_true', help='output frame durations to a log file') display_parser.add_argument('-ss', '--sigser', action='store_true', help='''send signals through the serial port when shapes are being displayed''') display_parser.add_argument('-sp', '--sigpar', action='store_true', help='''send signals through the parallel port when shapes are being displayed''') display_parser.add_argument('-et', '--eyetrack', action='store_true', help='''use eyetracking to ensure that subject - fixates on the cross in the center''') + fixates on the cross in the center''') display_parser.add_argument('-eu', '--etuser', action='store_true', help='''allow user to select eyetracking video - source from a dialog''') + source from a dialog''') display_parser.add_argument('-ev', '--etvideo', metavar='path', help='''path (with no spaces) to eyetracking - video file to be used as the source''') + video file to be used as the source''') display_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''list of display groups to be displayed in the specified order (default: order by id, i.e. group 0 is first)''') def help_display(self): self.__class__.display_parser.print_help() def do_display(self, line): """Displays the animation in a window or in fullscreen""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.display_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.display_parser.print_usage() return + if args.block != None: + try: + blkdict = core.CkgProj.readblk(args.block) + flags = blkdict['flags'] + try: + args = self.__class__.\ + display_parser.parse_args(shlex.split(flags)) + args.idlist = blkdict['idlist'] + except CmdParserError: + print 'error: invalid flags stored in block file' + return + except IOError: + print "error:", str(sys.exc_value) + return + group_queue = [] if len(args.idlist) > 0: for i in set(args.idlist): if i >= len(self.cur_proj.groups) or i < -1: print 'error: group', i, 'does not exist' return for i in args.idlist: if i == -1: group_queue.append(core.CkgWaitScreen()) else: group_queue.append(self.cur_proj.groups[i]) else: group_queue = list(self.cur_proj.groups) if args.repeat != None: group_queue = list(group_queue * args.repeat) if args.priority != None: if not priority.available: print "error: setting priority not avaible on", sys.platform print "continuing..." else: if args.priority.isdigit(): args.priority = int(args.priority) try: priority.set(args.priority) except ValueError: print "error:", str(sys.exc_value) print "continuing..." if args.eyetrack and eyetracking.available: if not eyetracking.is_calibrated(): try: self.do_calibrate('',True) except eyetracking.EyetrackingError: print "error:", str(sys.exc_value) return if len(path) > 0: print "calibration file successfully loaded" try: self.cur_proj.display(fullscreen=args.fullscreen, logtime=args.logtime, logdur=args.logdur, sigser=args.sigser, sigpar=args.sigpar, phototest=args.phototest, eyetrack=args.eyetrack, etuser=args.etuser, etvideo=args.etvideo, group_queue=group_queue) except (IOError, NotImplementedError, eyetracking.EyetrackingError): print "error:", str(sys.exc_value) return if args.priority != None: try: priority.set('normal') except: pass export_parser = CmdParser(add_help=False, prog='export', description='''Exports animation as an image sequence (in a folder) to the specified directory.''') # export_parser.add_argument('--fmt', dest='export_fmt', # choices=core.EXPORT_FMTS, # help='image format for export') export_parser.add_argument('-n','--nofolder', dest='folder', action='store_false', help='''force images not to exported in a containing folder''') export_parser.add_argument('-r', '--repeat', metavar='N', type=int, help='''repeatedly export specified display groups N number of times''') export_parser.add_argument('duration', nargs='?', type=to_decimal, default='Infinity', help='''number of seconds of the animation that should be exported (default: as long as the entire animation)''') export_parser.add_argument('dir', nargs='?', default=os.getcwd(), help='''destination directory for export (default: current working directory)''') export_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''list of display groups to be exported in the specified order (default: order by id, i.e. group 0 is first)''') def help_export(self): self.__class__.export_parser.print_help() def do_export(self, line): """Exports animation an image sequence to the specified directory.""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.export_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.export_parser.print_usage() return if len(args.idlist) > 0: for i in set(args.idlist): if i >= len(self.cur_proj.groups) or i < 0: print 'error: group', i, 'does not exist' return group_queue = [self.cur_proj.groups[i] for i in args.idlist] else: group_queue = list(self.cur_proj.groups) if args.repeat != None: group_queue = list(group_queue * args.repeat) try: self.cur_proj.export(export_dir=args.dir, export_duration=args.duration, group_queue=group_queue, folder=args.folder) except IOError: print "error:", str(sys.exc_value) return except core.FrameOverflowError: print "warning:", str(sys.exc_value) print "Are you sure you want to continue?" while True: try: if self.__class__.yn_parse(raw_input()): self.cur_proj.export(export_dir=args.dir, export_duration=args.duration, group_queue=group_queue, export_fmt=None, folder=args.folder, force=True) break else: return except TypeError: print str(sys.exc_value) except EOFError: return print "Export done." mkblks_parser = CmdParser(add_help=False, prog='mkblks', description='''Generates randomized experimental blocks from display groups and saves each as a CSV file.''') mkblks_parser.add_argument('-n','--nofolder', dest='folder', action='store_false', help='''force block files not to be saved in a containing folder''') mkblks_parser.add_argument('-d','--dir', default=os.getcwd(), help='''where to save block files (default: current working directory)''') mkblks_parser.add_argument('length', type=int, help='''no. of repeated trials in a block''') - mkblks_parser.add_argument('flags', nargs='?', + mkblks_parser.add_argument('flags', nargs='?', default='', help='''flags passed to the display command that should be used when the block file is run (enclose in quotes and use '+' or '++' in place of '-' or '--')''') def help_mkblks(self): self.__class__.mkblks_parser.print_help() def do_mkblks(self, line): """Generates randomized experimental blocks from display groups.""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.mkblks_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.mkblks_parser.print_usage() return args.flags = args.flags.replace('+','-') try: disp_args = self.__class__.display_parser.\ parse_args(shlex.split(args.flags)) except CmdParserError: print "error: invalid flags to display command" print str(sys.exc_value) self.__class__.display_parser.print_usage() return try: self.cur_proj.mkblks(args.length, path=args.dir, folder=args.folder, flags=args.flags) except IOError: print "error:", str(sys.exc_value) return print "Experimental blocks generated." def do_calibrate(self, line, query=False): """Calibrate subject for eyetracking, or load a calibration file.""" if not eyetracking.available: print "error: eyetracking functionality not available" return if query: print "path to calibration file (leave empty for GUI tool):" path = raw_input().strip().strip('"\'') else: path = line.strip().strip('"\'') if len(path) == 0: path = None if eyetracking.VET.VideoSourceType == 0: # Select default source if none has been selected eyetracking.select_source() try: eyetracking.calibrate(path) except eyetracking.EyetrackingError: if query: raise else: print "error:", str(sys.exc_value) return if len(path) > 0: print "calibration file successfully loaded" def do_quit(self, line): """Quits the program.""" if self.save_check(): return return True def do_EOF(self, line): """Typing Ctrl-D issues this command, which quits the program.""" print '\r' if self.save_check(): return return True def help_help(self): print 'Prints a list of commands.' print "Type 'help <topic>' for more details on each command." def default(self, line): command = line.split()[0] print \ "'{0}' is not a checkergen command.".format(command),\ "Type 'help' for a list of commands" diff --git a/src/core.py b/src/core.py index 6e161d8..0f49dc7 100755 --- a/src/core.py +++ b/src/core.py @@ -1,807 +1,834 @@ """Contains core functionality of checkergen. Errors and Exceptions: FileFormatError FrameOverflowError Classes: CkgProj -- A checkergen project, contains settings and CkgDisplayGroups. CkgDisplayGroup -- A set of CheckerShapes to be displayed simultaneously. CheckerShapes -- Abstract checkered shape class CheckerBoard -- A (distorted) checkerboard pattern, can color-flip. """ import os import sys import re import csv import itertools from xml.dom import minidom import pyglet import graphics import signals import eyetracking from utils import * CKG_FMT = 'ckg' XML_NAMESPACE = 'http://github.com/ZOMGxuan/checkergen' MAX_EXPORT_FRAMES = 100000 PRERENDER_TO_TEXTURE = False EXPORT_FMTS = ['png'] EXPORT_DIR_SUFFIX = '-anim' BLOCK_DIR_SUFFIX = '-blks' FIX_POS = (0, 0) FIX_RANGE = (20, 20) SANS_SERIF = ('Helvetica', 'Arial', 'FreeSans') def xml_get(parent, namespace, name, index=0): """Returns concatenated text node values inside an element.""" element = [node for node in parent.childNodes if node.localName == name and node.namespaceURI == namespace][index] strings = [] for node in element.childNodes: if node.nodeType == node.TEXT_NODE: strings.append(node.data) return ''.join(strings) def xml_set(document, parent, name, string): """Stores value as a text node in a new DOM element.""" element = document.createElement(name) parent.appendChild(element) text = document.createTextNode(string) element.appendChild(text) def xml_pretty_print(document, indent): """Hack to prettify minidom's not so pretty print.""" ugly_xml = document.toprettyxml(indent=indent) prettifier_re = re.compile('>\n\s+([^<>\s].*?)\n\s+</', re.DOTALL) pretty_xml = prettifier_re.sub('>\g<1></', ugly_xml) return pretty_xml class FileFormatError(ValueError): """Raised when correct file format/extension is not supplied.""" pass class FrameOverflowError(Exception): """Raised when more than MAX_EXPORT_FRAMES are going to be exported.""" pass class CkgProj: """Defines a checkergen project, with checkerboards and other settings.""" DEFAULTS = {'name': 'untitled', 'fps': 60, 'res': (800, 600), 'bg': (127, 127, 127), 'export_fmt': 'png', 'pre': 0, 'post': 0, 'cross_cols': ((0, 0, 0), (255, 0, 0)), 'cross_times': ('Infinity', 1)} def __init__(self, **keywords): """Initializes a new project, or loads it from a path. path -- if specified, ignore other arguments and load project from path name -- name of the project, always the same as the filename without the extension fps -- frames per second of the animation to be displayed res -- screen resolution / window size at which project will be displayed bg -- background color of the animation as a 3-tuple (R, G, B) export_fmt -- image format for animation to be exported as pre -- time in seconds a blank screen will be shown before any display groups post --time in seconds a blank screen will be shown after any display groups """ if 'path' in keywords.keys(): self.load(keywords['path']) return for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.groups = [] def __setattr__(self, name, value): # Type conversions if name == 'name': value = str(value) elif name in ['fps', 'pre', 'post']: value = to_decimal(value) elif name == 'res': if len(value) != 2: raise ValueError value = tuple([int(v) for v in value]) elif name == 'bg': if len(value) != 3: raise ValueError value = tuple([int(v) for v in value]) elif name == 'export_fmt': if value not in EXPORT_FMTS: msg = 'image format not recognized or supported' raise FileFormatError(msg) elif name == 'cross_cols': if len(value) != 2: raise ValueError for col in value: if len(col) != 3: raise ValueError value = tuple([tuple([int(c) for c in col]) for col in value]) elif name == 'cross_times': if len(value) != 2: raise ValueError value = tuple([to_decimal(x) for x in value]) # Store value self.__dict__[name] = value # Set dirty bit if name != '_dirty': self._dirty = True def add_group(self, group): """Append group to list and set dirty bit.""" self.groups.append(group) self._dirty = True return self.groups.index(group) def del_group(self, group): """Remove group to list and set dirty bit.""" self.groups.remove(group) self._dirty = True def add_shape_to_group(self, group, shape): """Add shape to group specified by id and set dirty bit.""" if group not in self.groups: raise ValueError group.shapes.append(shape) self._dirty = True return group.shapes.index(shape) def del_shape_from_group(self, group, shape): """Removes shape from group specified by id and set dirty bit.""" if group not in self.groups: raise ValueError group.shapes.remove(shape) self._dirty = True def set_group_attr(self, gid, name, value): """Set attribute of a group specified by id and set dirty bit.""" setattr(self.groups[gid], name, value) self._dirty = True def set_shape_attr(self, group, sid, name, value): """Set attribute of a shape specified by id and set dirty bit.""" if group not in self.groups: raise ValueError setattr(group.shapes[sid], name, value) self._dirty = True def is_dirty(self): return self._dirty def load(self, path): """Loads project from specified path.""" # Get project name from filename name, ext = os.path.splitext(os.path.basename(path)) if ext == '.{0}'.format(CKG_FMT): self.name = name else: msg = "path lacks '.{0}' extension".format(CKG_FMT) raise FileFormatError(msg) with open(path, 'r') as project_file: doc = minidom.parse(project_file) project = doc.documentElement vars_to_load = self.__class__.DEFAULTS.keys() # Name is not stored in project file vars_to_load.remove('name') for var in vars_to_load: try: value = eval(xml_get(project, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) self.groups = [] group_els = [node for node in project.childNodes if node.localName == 'group' and node.namespaceURI == XML_NAMESPACE] for group_el in group_els: new_group = CkgDisplayGroup() new_group.load(group_el) self.groups.append(new_group) self._dirty = False def save(self, path): """Saves project to specified path as an XML document.""" self.name, ext = os.path.splitext(os.path.basename(path)) if ext != '.{0}'.format(CKG_FMT): path = '{0}.{1}'.format(path, CKG_FMT) impl = minidom.getDOMImplementation() doc = impl.createDocument(XML_NAMESPACE, 'project', None) project = doc.documentElement # Hack below because minidom doesn't support namespaces properly project.setAttribute('xmlns', XML_NAMESPACE) vars_to_save = self.__class__.DEFAULTS.keys() # Name is not stored in project file vars_to_save.remove('name') for var in vars_to_save: xml_set(doc, project, var, repr(getattr(self, var))) for group in self.groups: group.save(doc, project) with open(path, 'w') as project_file: project_file.write(xml_pretty_print(doc,indent=' ')) self._dirty = False return path def mkblks(self, length, path=None, folder=True, flags=''): """Generates randomized experimental blocks from display groups. Each block is saved as a CSV file. length -- number of repeated trials within a block path -- directory in which experimental blocks will be saved folder -- blocks will be saved in a containing folder if true flags -- string of flags to be issued to the display command when block file is run """ if path == None: path = os.getcwd() + if not os.path.isdir(path): + msg = "specified directory does not exist" + raise IOError(msg) + if folder: path = os.path.join(path, self.name + BLOCK_DIR_SUFFIX) if not os.path.isdir(path): os.mkdir(path) group_ids = range(len(self.groups)) for n, sequence in enumerate(itertools.permutations(group_ids)): blkname = 'block{0}.csv'.format(repr(n).zfill(numdigits(length))) blkfile = open(os.path.join(path, blkname), 'wb') blkwriter = csv.writer(blkfile, dialect='excel-tab') blkwriter.writerow(['checkergen experimental block file']) blkwriter.writerow(['flags:', flags]) blkwriter.writerow(['repeats:', length]) blkwriter.writerow(['sequence:'] + list(sequence)) blkfile.close() + @staticmethod + def readblk(path): + """Reads the information in a block file and returns it in a dict.""" + + if not os.path.isfile(path): + msg = "specified file does not exist" + raise IOError(msg) + + blkdict = dict() + blkfile = open(path, 'rb') + blkreader = csv.reader(blkfile, dialect='excel-tab') + for n, row in enumerate(blkreader): + if n == 1: + blkdict['flags'] = row[1] + elif n == 2: + repeats = int(row[1]) + elif n == 3: + sequence = row[1:] + sequence = [int(i) for i in sequence] + blkfile.close() + blkdict['idlist'] = ([-1] + sequence) * repeats + return blkdict + def display(self, fullscreen=False, logtime=False, logdur=False, sigser=False, sigpar=False, phototest=False, eyetrack=False, etuser=False, etvideo=None, group_queue=[]): """Displays the project animation on the screen. fullscreen -- animation is displayed fullscreen if true, stretched to fit if necessary logtime -- timestamp of each frame is saved to a logfile if true logdur -- duration of each frame is saved to a logfile if true sigser -- send signals through serial port when each group is shown sigpar -- send signals through parallel port when each group is shown phototest -- draw white rectangle in topleft corner when each group is shown for photodiode to detect eyetrack -- use eyetracking to ensure subject is fixating on cross etuser -- if true, user gets to select eyetracking video source in GUI etvideo -- optional eyetracking video source file to use instead of live feed group_queue -- queue of groups to be displayed, defaults to order of groups in project (i.e. groups[0] first, etc.) """ # Create fixation crosses fix_crosses = [graphics.Cross([r/2 for r in self.res], (20, 20), col = cross_col) for cross_col in self.cross_cols] # Create test rectangle if phototest: test_rect = graphics.Rect((0, self.res[1]), [r/8 for r in self.res], anchor='topleft') # Set-up groups and variables that control their display if group_queue == []: group_queue = list(self.groups) cur_group = None cur_id = -1 flipped = 0 flip_id = -1 groups_duration = sum([group.duration() for group in group_queue]) groups_start = self.pre * self.fps groups_stop = (self.pre + groups_duration) * self.fps disp_end = (self.pre + groups_duration + self.post) * self.fps if groups_start == 0 and groups_stop > 0: groups_visible = True else: groups_visible = False count = 0 # Initialize ports if sigser: if not signals.available['serial']: msg = 'serial port functionality not available' raise NotImplementedError(msg) if sigpar: if not signals.available['parallel']: msg = 'parallel port functionality not available' raise NotImplementedError(msg) signals.init(sigser, sigpar) # Initialize eyetracking if eyetrack: if not eyetracking.available: msg = 'eyetracking functionality not available' raise NotImplementedError(msg) fixating = False old_fixating = False eyetracking.select_source(etuser, etvideo) eyetracking.start() # Stretch to fit screen only if project res does not equal screen res scaling = False if fullscreen: window = pyglet.window.Window(fullscreen=True, visible=False) if (window.width, window.height) != self.res: scaling = True else: window = pyglet.window.Window(*self.res, visible=False) # Set up KeyStateHandler to handle keyboard input keystates = pyglet.window.key.KeyStateHandler() window.push_handlers(keystates) # Create framebuffer object for drawing unscaled scene if scaling: canvas = pyglet.image.Texture.create(*self.res) fbo = graphics.Framebuffer(canvas) fbo.start_render() graphics.set_clear_color(self.bg) fbo.clear() fbo.end_render() # Clear window and make visible window.switch_to() graphics.set_clear_color(self.bg) window.clear() window.set_visible() # Initialize logging variables if logtime and logdur: logstring = '' stamp = Timer() dur = Timer() stamp.start() dur.start() elif logtime or logdur: logstring = '' timer = Timer() timer.start() # Main loop while not window.has_exit and count < disp_end: # Clear canvas if scaling: fbo.start_render() fbo.clear() else: window.clear() # Assume no change to group visibility flipped = 0 signals.set_null() # Manage groups when they are on_screen if groups_visible: # Send special signal if waitscreen ends if isinstance(cur_group, CkgWaitScreen): if cur_group.over: signals.set_user_start() cur_group = None elif cur_group != None: # Check whether group changes in visibility if cur_group.visible != cur_group.old_visible: flip_id = self.groups.index(cur_group) if cur_group.visible: flipped = 1 elif cur_group.old_visible: flipped = -1 # Check if current group is over if cur_group.over: cur_group = None # Get next group from queue if cur_group == None: cur_id += 1 if cur_id >= len(group_queue): groups_visible = False else: cur_group = group_queue[cur_id] cur_group.reset() if not isinstance(cur_group, CkgWaitScreen): if cur_group.visible: flip_id = cur_id flipped = 1 # Draw and then update group if cur_group != None: cur_group.draw() cur_group.update(fps=self.fps, keystates=keystates) # Send signals upon group visibility change if flipped == 1: signals.set_group_start(flip_id) # Draw test rectangle if phototest: test_rect.draw() elif flipped == -1: signals.set_group_stop(flip_id) # Draw normal cross color if fixating, other color if not if eyetrack: old_fixating = fixating fixating = eyetracking.fixating(FIX_POS, FIX_RANGE) if fixating: fix_crosses[0].draw() if not old_fixating: signals.set_fix_start() else: fix_crosses[1].draw() if old_fixating: signals.set_fix_stop() # Change cross color based on time if eyetracking is not enabled elif (count % (sum(self.cross_times) * self.fps) < self.cross_times[0] * self.fps): fix_crosses[0].draw() else: fix_crosses[1].draw() # Increment count and set whether groups should be shown if not isinstance(cur_group, CkgWaitScreen): count += 1 if groups_start <= count < groups_stop: groups_visible = True else: groups_visible = False # Blit canvas to screen if necessary if scaling: fbo.end_render() window.switch_to() canvas.blit(0, 0) window.dispatch_events() window.flip() # Make sure everything has been drawn pyglet.gl.glFinish() # Append time information to log string if logtime and logdur: logstring = '\n'.join([logstring, str(stamp.elapsed())]) logstring = '\t'.join([logstring, str(dur.restart())]) elif logtime: logstring = '\n'.join([logstring, str(timer.elapsed())]) elif logdur: logstring = '\n'.join([logstring, str(timer.restart())]) # Send signals ASAP after flip signals.send(sigser, sigpar) # Log when signals are sent if logtime or logdur: if flipped != 0 and (sigser or sigpar): sigmsg = '{0} sent'.format(signals.STATE) logstring = '\t'.join([logstring, sigmsg]) # Clean up if eyetrack: eyetracking.stop() window.close() if scaling: fbo.delete() del canvas signals.quit(sigser, sigpar) # Write log string to file if logtime or logdur: filename = '{0}.log'.format(self.name) with open(filename, 'w') as logfile: logfile.write(logstring) def export(self, export_dir, export_duration, group_queue=[], export_fmt=None, folder=True, force=False): if not os.path.isdir(export_dir): msg = 'export path is not a directory' raise IOError(msg) if export_fmt == None: export_fmt = self.export_fmt # Set-up groups and variables that control their display if group_queue == []: group_queue = list(self.groups) cur_group = None cur_id = -1 groups_duration = sum([group.duration() for group in group_queue]) groups_start = self.pre * self.fps groups_stop = (self.pre + groups_duration) * self.fps disp_end = (self.pre + groups_duration + self.post) * self.fps if groups_start == 0 and groups_stop > 0: groups_visible = True else: groups_visible = False count = 0 # Limit export duration to display duration frames = export_duration * self.fps frames = min(frames, disp_end) # Warn user if a lot of frames will be exported if frames > MAX_EXPORT_FRAMES and not force: msg = 'very large number ({0}) of frames to be exported'.\ format(frames) raise FrameOverflowError(msg) # Create folder to store images if necessary if folder: export_dir = os.path.join(export_dir, self.name + EXPORT_DIR_SUFFIX) if not os.path.isdir(export_dir): os.mkdir(export_dir) # Create fixation crosses fix_crosses = [graphics.Cross([r/2 for r in self.res], (20, 20), col = cross_col) for cross_col in self.cross_cols] # Set up canvas and framebuffer object canvas = pyglet.image.Texture.create(*self.res) fbo = graphics.Framebuffer(canvas) fbo.start_render() graphics.set_clear_color(self.bg) fbo.clear() # Main loop while count < frames: fbo.clear() if groups_visible: # Check if current group is over if cur_group != None: if cur_group.over: cur_group = None # Get next group from queue if cur_group == None: cur_id += 1 if cur_id >= len(group_queue): groups_visible = False else: cur_group = group_queue[cur_id] cur_group.reset() # Draw and then update group if cur_group != None: cur_group.draw() cur_group.update(fps=self.fps) # Draw fixation cross based on current count if (count % (sum(self.cross_times) * self.fps) < self.cross_times[0] * self.fps): fix_crosses[0].draw() else: fix_crosses[1].draw() # Save current frame to file savepath = \ os.path.join(export_dir, '{0}{2}.{1}'. format(self.name, export_fmt, repr(count).zfill(numdigits(frames-1)))) canvas.save(savepath) # Increment count and set whether groups should be shown count += 1 if groups_start <= count < groups_stop: groups_visible = True else: groups_visible = False fbo.delete() class CkgDisplayGroup: DEFAULTS = {'pre': 0, 'disp': 'Infinity', 'post': 0} def __init__(self, **keywords): """Create a new group of shapes to be displayed together. pre -- time in seconds a blank screen is shown before shapes in group are displayed disp -- time in seconds the shapes in the group are displayed, negative numbers result in shapes being displayed forever post -- time in seconds a blank screen is shown after shapes in group are displayed """ for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.shapes = [] self.reset() def __setattr__(self, name, value): if name in self.__class__.DEFAULTS: value = to_decimal(value) self.__dict__[name] = value def duration(self): """Returns total duration of display group.""" return self.pre + self.disp + self.post def reset(self): """Resets internal count and all contained shapes.""" self._count = 0 self._start = self.pre self._stop = self.pre + self.disp self._end = self.pre + self.disp + self.post self.over = False self.old_visible = False if self._start == 0 and self._stop > 0: self.visible = True else: self.visible = False if self._end == 0: self.over = True self._flip_count = [0] * len(self.shapes) for shape in self.shapes: shape.reset() def draw(self, lazy=False): """Draws all contained shapes during the appropriate interval.""" if self.visible: for shape in self.shapes: if lazy: shape.lazydraw() else: shape.draw() def update(self, **keywords): """Increments internal count, makes group visible when appropriate. fps -- refresh rate of the display in frames per second flip_sig_per -- number of shape colour reversals that have to occur for a unique signal to be sent for that shape """ fps = keywords['fps'] if 'flip_sig_per' in keywords.keys(): flip_sig_per = keywords['flip_sig_per'] else: flip_sig_per = signals.FLIP_SIG_PER if self.visible: # Set triggers to be sent for n, shape in enumerate(self.shapes): if shape.flipped: self._flip_count[n] += 1 if self._flip_count[n] >= flip_sig_per: signals.set_board_flip(n) self._flip_count[n] = 0 # Update contained shapes for shape in self.shapes: shape.update(fps) # Increment count and set flags for the next frame self._count += 1 self.old_visible = self.visible if (self._start * fps) <= self._count < (self._stop * fps): self.visible = True else: self.visible = False if self._count >= (self._end * fps): self.over = True else: self.over = False def save(self, document, parent): """Saves group in specified XML document as child of parent.""" group_el = document.createElement('group') parent.appendChild(group_el) for var in self.__class__.DEFAULTS.keys(): xml_set(document, group_el, var, repr(getattr(self, var))) for shape in self.shapes: shape.save(document, group_el) def load(self, element): """Loads group from XML DOM element.""" for var in self.__class__.DEFAULTS.keys(): try: value = eval(xml_get(element, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) shape_els = [node for node in element.childNodes if node.localName == 'shape' and node.namespaceURI == XML_NAMESPACE] for shape_el in shape_els: # TODO: Make load code shape-agnostic new_shape = CheckerBoard() new_shape.load(shape_el) self.shapes.append(new_shape) class CkgWaitScreen(CkgDisplayGroup): """Dummy display group, waits for user input to proceed.""" DEFAULTS = {'g_keys': (pyglet.window.key.SPACE,), 'r_keys': (pyglet.window.key.NUM_ENTER, pyglet.window.key.ENTER), 'res': CkgProj.DEFAULTS['res'], 'g_info': "the experiment will start soon", 'r_info': "press enter when ready", 'font_color': (0, 0, 0, 255), 'font_size': 16} def __init__(self, **keywords): """Create an informative waitscreen that proceeds after user input.""" for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.g_label = pyglet.text.Label(self.g_info, font_name=SANS_SERIF, font_size=self.font_size, color=self.font_color, bold=True, x=self.res[0]//2, y=self.res[1]//8, anchor_x='center', anchor_y='center') self.r_label = pyglet.text.Label(self.r_info, font_name=SANS_SERIF, font_size=self.font_size, color=self.font_color, bold=True, x=self.res[0]//2, y=self.res[1]//8, anchor_x='center', anchor_y='center') self.reset() def __setattr__(self, name, value):
ztangent/checkergen
c89347318fa234a9ab0732dbfd64a2bdbbf2aeb8
Changed default board flip signal period to 10 flips before sending signal.
diff --git a/src/signals.py b/src/signals.py index a5adfc8..126b87e 100644 --- a/src/signals.py +++ b/src/signals.py @@ -1,130 +1,130 @@ """Module for signalling upon stimuli appearance using the serial or parallel ports.""" SERPORT = None PARPORT = None STATE = None OLD_STATE = None USER_START = 128 # 0b10000000 BOARD_FLIP = 64 # 0b01000000 GROUP_START = 32 # 0b00100000 GROUP_STOP = 16 # 0b00010000 FIX_START = 4 # 0b00000100 FIX_STOP = 2 # 0b00000010 -FLIP_SIG_PER = 1 +FLIP_SIG_PER = 10 available = {'serial': False, 'parallel': False} try: import serial try: test_port = serial.Serial(0) test_port.close() del test_port available['serial'] = True except serial.serialutil.SerialException: pass except ImportError: pass try: import parallel try: test_port = parallel.Parallel() del test_port available['parallel'] = True except: pass except ImportError: pass if available['serial']: def ser_init(): global SERPORT SERPORT = serial.Serial(0) def ser_send(): global SERPORT global STATE if STATE != None: SERPORT.write(str(STATE)) def ser_quit(): global SERPORT SERPORT.close() SERPORT = None if available['parallel']: def par_init(): global PARPORT PARPORT = parallel.Parallel() PARPORT.setData(0) def par_send(): global PARPORT global STATE if STATE != None: PARPORT.setData(STATE) else: PARPORT.setData(0) def par_quit(): global PARPORT PARPORT.setData(0) PARPORT = None def init(sigser, sigpar): global STATE global OLD_STATE STATE = None OLD_STATE = None if sigser: ser_init() if sigpar: par_init() def set_state(state): global STATE global OLD_STATE OLD_STATE = STATE STATE = state def set_board_flip(board_id): set_state(BOARD_FLIP + board_id) def set_group_start(group_id): set_state(GROUP_START + group_id) def set_group_stop(group_id): set_state(GROUP_STOP + group_id) def set_user_start(): set_state(USER_START) def set_fix_start(): set_state(FIX_START) def set_fix_stop(): set_state(FIX_STOP) def set_null(): set_state(None) def send(sigser, sigpar): if sigser: ser_send() if STATE != OLD_STATE: if sigpar: par_send() def quit(sigser, sigpar): set_null() if sigser: ser_quit() if sigpar: par_quit()
ztangent/checkergen
119608866108b64b3afa858bb57227e788ea39d8
Fixed board flip signals not being sent, added option to send signals after set number of flips.
diff --git a/src/core.py b/src/core.py index 88c7c52..6e161d8 100755 --- a/src/core.py +++ b/src/core.py @@ -1,1019 +1,1033 @@ """Contains core functionality of checkergen. Errors and Exceptions: FileFormatError FrameOverflowError Classes: CkgProj -- A checkergen project, contains settings and CkgDisplayGroups. CkgDisplayGroup -- A set of CheckerShapes to be displayed simultaneously. CheckerShapes -- Abstract checkered shape class CheckerBoard -- A (distorted) checkerboard pattern, can color-flip. """ import os import sys import re import csv import itertools from xml.dom import minidom import pyglet import graphics import signals import eyetracking from utils import * CKG_FMT = 'ckg' XML_NAMESPACE = 'http://github.com/ZOMGxuan/checkergen' MAX_EXPORT_FRAMES = 100000 PRERENDER_TO_TEXTURE = False EXPORT_FMTS = ['png'] EXPORT_DIR_SUFFIX = '-anim' BLOCK_DIR_SUFFIX = '-blks' FIX_POS = (0, 0) FIX_RANGE = (20, 20) SANS_SERIF = ('Helvetica', 'Arial', 'FreeSans') def xml_get(parent, namespace, name, index=0): """Returns concatenated text node values inside an element.""" element = [node for node in parent.childNodes if node.localName == name and node.namespaceURI == namespace][index] strings = [] for node in element.childNodes: if node.nodeType == node.TEXT_NODE: strings.append(node.data) return ''.join(strings) def xml_set(document, parent, name, string): """Stores value as a text node in a new DOM element.""" element = document.createElement(name) parent.appendChild(element) text = document.createTextNode(string) element.appendChild(text) def xml_pretty_print(document, indent): """Hack to prettify minidom's not so pretty print.""" ugly_xml = document.toprettyxml(indent=indent) prettifier_re = re.compile('>\n\s+([^<>\s].*?)\n\s+</', re.DOTALL) pretty_xml = prettifier_re.sub('>\g<1></', ugly_xml) return pretty_xml class FileFormatError(ValueError): """Raised when correct file format/extension is not supplied.""" pass class FrameOverflowError(Exception): """Raised when more than MAX_EXPORT_FRAMES are going to be exported.""" pass class CkgProj: """Defines a checkergen project, with checkerboards and other settings.""" DEFAULTS = {'name': 'untitled', 'fps': 60, 'res': (800, 600), 'bg': (127, 127, 127), 'export_fmt': 'png', 'pre': 0, 'post': 0, 'cross_cols': ((0, 0, 0), (255, 0, 0)), 'cross_times': ('Infinity', 1)} def __init__(self, **keywords): """Initializes a new project, or loads it from a path. path -- if specified, ignore other arguments and load project from path name -- name of the project, always the same as the filename without the extension fps -- frames per second of the animation to be displayed res -- screen resolution / window size at which project will be displayed bg -- background color of the animation as a 3-tuple (R, G, B) export_fmt -- image format for animation to be exported as pre -- time in seconds a blank screen will be shown before any display groups post --time in seconds a blank screen will be shown after any display groups """ if 'path' in keywords.keys(): self.load(keywords['path']) return for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.groups = [] def __setattr__(self, name, value): # Type conversions if name == 'name': value = str(value) elif name in ['fps', 'pre', 'post']: value = to_decimal(value) elif name == 'res': if len(value) != 2: raise ValueError value = tuple([int(v) for v in value]) elif name == 'bg': if len(value) != 3: raise ValueError value = tuple([int(v) for v in value]) elif name == 'export_fmt': if value not in EXPORT_FMTS: msg = 'image format not recognized or supported' raise FileFormatError(msg) elif name == 'cross_cols': if len(value) != 2: raise ValueError for col in value: if len(col) != 3: raise ValueError value = tuple([tuple([int(c) for c in col]) for col in value]) elif name == 'cross_times': if len(value) != 2: raise ValueError value = tuple([to_decimal(x) for x in value]) # Store value self.__dict__[name] = value # Set dirty bit if name != '_dirty': self._dirty = True def add_group(self, group): """Append group to list and set dirty bit.""" self.groups.append(group) self._dirty = True return self.groups.index(group) def del_group(self, group): """Remove group to list and set dirty bit.""" self.groups.remove(group) self._dirty = True def add_shape_to_group(self, group, shape): """Add shape to group specified by id and set dirty bit.""" if group not in self.groups: raise ValueError group.shapes.append(shape) self._dirty = True return group.shapes.index(shape) def del_shape_from_group(self, group, shape): """Removes shape from group specified by id and set dirty bit.""" if group not in self.groups: raise ValueError group.shapes.remove(shape) self._dirty = True def set_group_attr(self, gid, name, value): """Set attribute of a group specified by id and set dirty bit.""" setattr(self.groups[gid], name, value) self._dirty = True def set_shape_attr(self, group, sid, name, value): """Set attribute of a shape specified by id and set dirty bit.""" if group not in self.groups: raise ValueError setattr(group.shapes[sid], name, value) self._dirty = True def is_dirty(self): return self._dirty def load(self, path): """Loads project from specified path.""" # Get project name from filename name, ext = os.path.splitext(os.path.basename(path)) if ext == '.{0}'.format(CKG_FMT): self.name = name else: msg = "path lacks '.{0}' extension".format(CKG_FMT) raise FileFormatError(msg) with open(path, 'r') as project_file: doc = minidom.parse(project_file) project = doc.documentElement vars_to_load = self.__class__.DEFAULTS.keys() # Name is not stored in project file vars_to_load.remove('name') for var in vars_to_load: try: value = eval(xml_get(project, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) self.groups = [] group_els = [node for node in project.childNodes if node.localName == 'group' and node.namespaceURI == XML_NAMESPACE] for group_el in group_els: new_group = CkgDisplayGroup() new_group.load(group_el) self.groups.append(new_group) self._dirty = False def save(self, path): """Saves project to specified path as an XML document.""" self.name, ext = os.path.splitext(os.path.basename(path)) if ext != '.{0}'.format(CKG_FMT): path = '{0}.{1}'.format(path, CKG_FMT) impl = minidom.getDOMImplementation() doc = impl.createDocument(XML_NAMESPACE, 'project', None) project = doc.documentElement # Hack below because minidom doesn't support namespaces properly project.setAttribute('xmlns', XML_NAMESPACE) vars_to_save = self.__class__.DEFAULTS.keys() # Name is not stored in project file vars_to_save.remove('name') for var in vars_to_save: xml_set(doc, project, var, repr(getattr(self, var))) for group in self.groups: group.save(doc, project) with open(path, 'w') as project_file: project_file.write(xml_pretty_print(doc,indent=' ')) self._dirty = False return path def mkblks(self, length, path=None, folder=True, flags=''): """Generates randomized experimental blocks from display groups. Each block is saved as a CSV file. length -- number of repeated trials within a block path -- directory in which experimental blocks will be saved folder -- blocks will be saved in a containing folder if true flags -- string of flags to be issued to the display command when block file is run """ if path == None: path = os.getcwd() if folder: path = os.path.join(path, self.name + BLOCK_DIR_SUFFIX) if not os.path.isdir(path): os.mkdir(path) group_ids = range(len(self.groups)) for n, sequence in enumerate(itertools.permutations(group_ids)): blkname = 'block{0}.csv'.format(repr(n).zfill(numdigits(length))) blkfile = open(os.path.join(path, blkname), 'wb') blkwriter = csv.writer(blkfile, dialect='excel-tab') blkwriter.writerow(['checkergen experimental block file']) blkwriter.writerow(['flags:', flags]) blkwriter.writerow(['repeats:', length]) blkwriter.writerow(['sequence:'] + list(sequence)) blkfile.close() def display(self, fullscreen=False, logtime=False, logdur=False, sigser=False, sigpar=False, phototest=False, eyetrack=False, etuser=False, etvideo=None, group_queue=[]): """Displays the project animation on the screen. fullscreen -- animation is displayed fullscreen if true, stretched to fit if necessary logtime -- timestamp of each frame is saved to a logfile if true logdur -- duration of each frame is saved to a logfile if true sigser -- send signals through serial port when each group is shown sigpar -- send signals through parallel port when each group is shown phototest -- draw white rectangle in topleft corner when each group is shown for photodiode to detect eyetrack -- use eyetracking to ensure subject is fixating on cross etuser -- if true, user gets to select eyetracking video source in GUI etvideo -- optional eyetracking video source file to use instead of live feed group_queue -- queue of groups to be displayed, defaults to order of groups in project (i.e. groups[0] first, etc.) """ # Create fixation crosses fix_crosses = [graphics.Cross([r/2 for r in self.res], (20, 20), col = cross_col) for cross_col in self.cross_cols] # Create test rectangle if phototest: test_rect = graphics.Rect((0, self.res[1]), [r/8 for r in self.res], anchor='topleft') # Set-up groups and variables that control their display if group_queue == []: group_queue = list(self.groups) cur_group = None cur_id = -1 flipped = 0 flip_id = -1 groups_duration = sum([group.duration() for group in group_queue]) groups_start = self.pre * self.fps groups_stop = (self.pre + groups_duration) * self.fps disp_end = (self.pre + groups_duration + self.post) * self.fps if groups_start == 0 and groups_stop > 0: groups_visible = True else: groups_visible = False count = 0 # Initialize ports if sigser: if not signals.available['serial']: msg = 'serial port functionality not available' raise NotImplementedError(msg) if sigpar: if not signals.available['parallel']: msg = 'parallel port functionality not available' raise NotImplementedError(msg) signals.init(sigser, sigpar) # Initialize eyetracking if eyetrack: if not eyetracking.available: msg = 'eyetracking functionality not available' raise NotImplementedError(msg) fixating = False old_fixating = False eyetracking.select_source(etuser, etvideo) eyetracking.start() # Stretch to fit screen only if project res does not equal screen res scaling = False if fullscreen: window = pyglet.window.Window(fullscreen=True, visible=False) if (window.width, window.height) != self.res: scaling = True else: window = pyglet.window.Window(*self.res, visible=False) # Set up KeyStateHandler to handle keyboard input keystates = pyglet.window.key.KeyStateHandler() window.push_handlers(keystates) # Create framebuffer object for drawing unscaled scene if scaling: canvas = pyglet.image.Texture.create(*self.res) fbo = graphics.Framebuffer(canvas) fbo.start_render() graphics.set_clear_color(self.bg) fbo.clear() fbo.end_render() # Clear window and make visible window.switch_to() graphics.set_clear_color(self.bg) window.clear() window.set_visible() # Initialize logging variables if logtime and logdur: logstring = '' stamp = Timer() dur = Timer() stamp.start() dur.start() elif logtime or logdur: logstring = '' timer = Timer() timer.start() # Main loop while not window.has_exit and count < disp_end: # Clear canvas if scaling: fbo.start_render() fbo.clear() else: window.clear() # Assume no change to group visibility flipped = 0 + signals.set_null() # Manage groups when they are on_screen if groups_visible: # Send special signal if waitscreen ends if isinstance(cur_group, CkgWaitScreen): if cur_group.over: signals.set_user_start() cur_group = None elif cur_group != None: # Check whether group changes in visibility if cur_group.visible != cur_group.old_visible: flip_id = self.groups.index(cur_group) if cur_group.visible: flipped = 1 elif cur_group.old_visible: flipped = -1 # Check if current group is over if cur_group.over: cur_group = None # Get next group from queue if cur_group == None: cur_id += 1 if cur_id >= len(group_queue): groups_visible = False else: cur_group = group_queue[cur_id] cur_group.reset() if not isinstance(cur_group, CkgWaitScreen): if cur_group.visible: - flip_id = self.groups.index(cur_group) + flip_id = cur_id flipped = 1 # Draw and then update group if cur_group != None: cur_group.draw() cur_group.update(fps=self.fps, keystates=keystates) # Send signals upon group visibility change if flipped == 1: signals.set_group_start(flip_id) # Draw test rectangle if phototest: test_rect.draw() elif flipped == -1: signals.set_group_stop(flip_id) - else: - signals.set_null() # Draw normal cross color if fixating, other color if not if eyetrack: old_fixating = fixating fixating = eyetracking.fixating(FIX_POS, FIX_RANGE) if fixating: fix_crosses[0].draw() if not old_fixating: signals.set_fix_start() else: fix_crosses[1].draw() if old_fixating: signals.set_fix_stop() # Change cross color based on time if eyetracking is not enabled elif (count % (sum(self.cross_times) * self.fps) < self.cross_times[0] * self.fps): fix_crosses[0].draw() else: fix_crosses[1].draw() # Increment count and set whether groups should be shown if not isinstance(cur_group, CkgWaitScreen): count += 1 if groups_start <= count < groups_stop: groups_visible = True else: groups_visible = False # Blit canvas to screen if necessary if scaling: fbo.end_render() window.switch_to() canvas.blit(0, 0) window.dispatch_events() window.flip() # Make sure everything has been drawn pyglet.gl.glFinish() # Append time information to log string if logtime and logdur: logstring = '\n'.join([logstring, str(stamp.elapsed())]) logstring = '\t'.join([logstring, str(dur.restart())]) elif logtime: logstring = '\n'.join([logstring, str(timer.elapsed())]) elif logdur: logstring = '\n'.join([logstring, str(timer.restart())]) # Send signals ASAP after flip signals.send(sigser, sigpar) # Log when signals are sent if logtime or logdur: if flipped != 0 and (sigser or sigpar): sigmsg = '{0} sent'.format(signals.STATE) logstring = '\t'.join([logstring, sigmsg]) # Clean up if eyetrack: eyetracking.stop() window.close() if scaling: fbo.delete() del canvas signals.quit(sigser, sigpar) # Write log string to file if logtime or logdur: filename = '{0}.log'.format(self.name) with open(filename, 'w') as logfile: logfile.write(logstring) def export(self, export_dir, export_duration, group_queue=[], export_fmt=None, folder=True, force=False): if not os.path.isdir(export_dir): msg = 'export path is not a directory' raise IOError(msg) if export_fmt == None: export_fmt = self.export_fmt # Set-up groups and variables that control their display if group_queue == []: group_queue = list(self.groups) cur_group = None cur_id = -1 groups_duration = sum([group.duration() for group in group_queue]) groups_start = self.pre * self.fps groups_stop = (self.pre + groups_duration) * self.fps disp_end = (self.pre + groups_duration + self.post) * self.fps if groups_start == 0 and groups_stop > 0: groups_visible = True else: groups_visible = False count = 0 # Limit export duration to display duration frames = export_duration * self.fps frames = min(frames, disp_end) # Warn user if a lot of frames will be exported if frames > MAX_EXPORT_FRAMES and not force: msg = 'very large number ({0}) of frames to be exported'.\ format(frames) raise FrameOverflowError(msg) # Create folder to store images if necessary if folder: export_dir = os.path.join(export_dir, self.name + EXPORT_DIR_SUFFIX) if not os.path.isdir(export_dir): os.mkdir(export_dir) # Create fixation crosses fix_crosses = [graphics.Cross([r/2 for r in self.res], (20, 20), col = cross_col) for cross_col in self.cross_cols] # Set up canvas and framebuffer object canvas = pyglet.image.Texture.create(*self.res) fbo = graphics.Framebuffer(canvas) fbo.start_render() graphics.set_clear_color(self.bg) fbo.clear() # Main loop while count < frames: fbo.clear() if groups_visible: # Check if current group is over if cur_group != None: if cur_group.over: cur_group = None # Get next group from queue if cur_group == None: cur_id += 1 if cur_id >= len(group_queue): groups_visible = False else: cur_group = group_queue[cur_id] cur_group.reset() # Draw and then update group if cur_group != None: cur_group.draw() cur_group.update(fps=self.fps) # Draw fixation cross based on current count if (count % (sum(self.cross_times) * self.fps) < self.cross_times[0] * self.fps): fix_crosses[0].draw() else: fix_crosses[1].draw() # Save current frame to file savepath = \ os.path.join(export_dir, '{0}{2}.{1}'. format(self.name, export_fmt, repr(count).zfill(numdigits(frames-1)))) canvas.save(savepath) # Increment count and set whether groups should be shown count += 1 if groups_start <= count < groups_stop: groups_visible = True else: groups_visible = False fbo.delete() class CkgDisplayGroup: DEFAULTS = {'pre': 0, 'disp': 'Infinity', 'post': 0} def __init__(self, **keywords): """Create a new group of shapes to be displayed together. pre -- time in seconds a blank screen is shown before shapes in group are displayed disp -- time in seconds the shapes in the group are displayed, negative numbers result in shapes being displayed forever post -- time in seconds a blank screen is shown after shapes in group are displayed """ for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.shapes = [] self.reset() def __setattr__(self, name, value): if name in self.__class__.DEFAULTS: value = to_decimal(value) self.__dict__[name] = value def duration(self): """Returns total duration of display group.""" return self.pre + self.disp + self.post def reset(self): """Resets internal count and all contained shapes.""" self._count = 0 self._start = self.pre self._stop = self.pre + self.disp self._end = self.pre + self.disp + self.post self.over = False self.old_visible = False if self._start == 0 and self._stop > 0: self.visible = True else: self.visible = False if self._end == 0: self.over = True + self._flip_count = [0] * len(self.shapes) for shape in self.shapes: shape.reset() def draw(self, lazy=False): """Draws all contained shapes during the appropriate interval.""" if self.visible: for shape in self.shapes: if lazy: shape.lazydraw() else: shape.draw() def update(self, **keywords): - """Increments internal count, makes group visible when appropriate.""" + """Increments internal count, makes group visible when appropriate. + + fps -- refresh rate of the display in frames per second + + flip_sig_per -- number of shape colour reversals that have to occur + for a unique signal to be sent for that shape + + """ fps = keywords['fps'] + if 'flip_sig_per' in keywords.keys(): + flip_sig_per = keywords['flip_sig_per'] + else: + flip_sig_per = signals.FLIP_SIG_PER if self.visible: # Set triggers to be sent for n, shape in enumerate(self.shapes): if shape.flipped: - signals.set_board_flip(n) + self._flip_count[n] += 1 + if self._flip_count[n] >= flip_sig_per: + signals.set_board_flip(n) + self._flip_count[n] = 0 # Update contained shapes for shape in self.shapes: shape.update(fps) # Increment count and set flags for the next frame self._count += 1 self.old_visible = self.visible if (self._start * fps) <= self._count < (self._stop * fps): self.visible = True else: self.visible = False if self._count >= (self._end * fps): self.over = True else: self.over = False def save(self, document, parent): """Saves group in specified XML document as child of parent.""" group_el = document.createElement('group') parent.appendChild(group_el) for var in self.__class__.DEFAULTS.keys(): xml_set(document, group_el, var, repr(getattr(self, var))) for shape in self.shapes: shape.save(document, group_el) def load(self, element): """Loads group from XML DOM element.""" for var in self.__class__.DEFAULTS.keys(): try: value = eval(xml_get(element, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) shape_els = [node for node in element.childNodes if node.localName == 'shape' and node.namespaceURI == XML_NAMESPACE] for shape_el in shape_els: # TODO: Make load code shape-agnostic new_shape = CheckerBoard() new_shape.load(shape_el) self.shapes.append(new_shape) class CkgWaitScreen(CkgDisplayGroup): """Dummy display group, waits for user input to proceed.""" DEFAULTS = {'g_keys': (pyglet.window.key.SPACE,), 'r_keys': (pyglet.window.key.NUM_ENTER, pyglet.window.key.ENTER), 'res': CkgProj.DEFAULTS['res'], 'g_info': "the experiment will start soon", 'r_info': "press enter when ready", 'font_color': (0, 0, 0, 255), 'font_size': 16} def __init__(self, **keywords): """Create an informative waitscreen that proceeds after user input.""" for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.g_label = pyglet.text.Label(self.g_info, font_name=SANS_SERIF, font_size=self.font_size, color=self.font_color, bold=True, x=self.res[0]//2, y=self.res[1]//8, anchor_x='center', anchor_y='center') self.r_label = pyglet.text.Label(self.r_info, font_name=SANS_SERIF, font_size=self.font_size, color=self.font_color, bold=True, x=self.res[0]//2, y=self.res[1]//8, anchor_x='center', anchor_y='center') self.reset() def __setattr__(self, name, value): self.__dict__[name] = value def duration(self): """Returns zero since wait times are arbitrary.""" return to_decimal(0) def reset(self): """Resets some flags.""" self.ready = False self.over = False def draw(self): """Draw informative text.""" if not self.ready: self.r_label.draw() else: self.g_label.draw() def update(self, **keywords): """Checks for keypress, sends signal upon end.""" keystates = keywords['keystates'] if self.r_keys == None: if max([keystates[key] for key in self.g_keys]): self.ready = True self.over = True elif not self.ready: if max([keystates[key] for key in self.r_keys]): self.ready = True else: if max([keystates[key] for key in self.g_keys]): self.over = True class CheckerShape: # Abstract class, to be implemented. pass class CheckerDisc(CheckerShape): # Circular checker pattern, to be implemented pass class CheckerBoard(CheckerShape): DEFAULTS = {'dims': (5, 5), 'init_unit': (30, 30), 'end_unit': (50, 50), 'position': (0, 0), 'anchor': 'bottomleft', 'cols': ((0, 0, 0), (255, 255, 255)), 'freq': 1, 'phase': 0} # TODO: Reimplement mid/center anchor functionality in cool new way def __init__(self, **keywords): for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.reset() def __setattr__(self, name, value): # Type conversions if name == 'dims': if len(value) != 2: raise ValueError value = tuple([int(x) for x in value]) elif name in ['init_unit', 'end_unit', 'position']: if len(value) != 2: raise ValueError value = tuple([to_decimal(x) for x in value]) elif name == 'anchor': if value not in graphics.locations.keys(): raise ValueError elif name == 'cols': if len(value) != 2: raise ValueError for col in value: if len(col) != 3: raise ValueError value = tuple([tuple([int(c) for c in col]) for col in value]) elif name in ['freq', 'phase']: value = to_decimal(value) # Store value self.__dict__[name] = value # Recompute if necessary if name in ['dims', 'init_unit', 'end_unit', 'position', 'anchor','cols']: self._computed = False def save(self, document, parent): """Saves board in specified XML document as child of parent.""" board_el = document.createElement('shape') board_el.setAttribute('type', 'board') parent.appendChild(board_el) for var in self.__class__.DEFAULTS.keys(): xml_set(document, board_el, var, repr(getattr(self, var))) def load(self, element): """Loads group from XML DOM element.""" for var in self.__class__.DEFAULTS.keys(): try: value = eval(xml_get(element, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) def reset(self, new_phase=None): """Resets checkerboard animation back to initial phase.""" if new_phase == None: new_phase = self.phase self._cur_phase = new_phase self._prev_phase = new_phase self.flipped = False self._first_draw = True if not self._computed: self.compute() def update(self, fps): """Increase the current phase of the checkerboard animation.""" self._prev_phase = self._cur_phase if self.freq != 0: degs_per_frame = 360 * self.freq / fps self._cur_phase += degs_per_frame if self._cur_phase >= 360: self._cur_phase %= 360 cur_n = int(self._cur_phase // 180) prev_n = int(self._prev_phase // 180) if cur_n != prev_n: self.flipped = True else: self.flipped = False def compute(self): """Computes a model of the checkerboard for drawing later.""" # Create batches to store model self._batches = [pyglet.graphics.Batch() for n in range(2)] # Calculate size of checkerboard in pixels self._size = tuple([(y1 + y2) / 2 * n for y1, y2, n in zip(self.init_unit, self.end_unit, self.dims)]) # Calculate unit size gradient unit_grad = tuple([(2 if (flag == 0) else 1) * (y2 - y1) / n for y1, y2, n, flag in zip(self.init_unit, self.end_unit, self.dims, graphics.locations[self.anchor])]) # Set initial values if PRERENDER_TO_TEXTURE: init_pos = [(1 - a)* s/to_decimal(2) for s, a in zip(self._size, graphics.locations[self.anchor])] else: init_pos = list(self.position) init_unit = [c + m/2 for c, m in zip(self.init_unit, unit_grad)] cur_unit = list(init_unit) cur_unit_pos = list(init_pos) # Add unit cells to batches in nested for loop for j in range(self.dims[1]): for i in range(self.dims[0]): cur_unit_rect = graphics.Rect(cur_unit_pos, cur_unit, anchor=self.anchor) cur_unit_rect.col = self.cols[(i + j) % 2] cur_unit_rect.add_to_batch(self._batches[0]) cur_unit_rect.col = self.cols[(i + j + 1) % 2] cur_unit_rect.add_to_batch(self._batches[1]) # Increase x values cur_unit_pos[0] += \ graphics.locations[self.anchor][0] * cur_unit[0] cur_unit[0] += unit_grad[0] # Reset x values cur_unit_pos[0] = init_pos[0] cur_unit[0] = init_unit[0] # Increase y values cur_unit_pos[1] += \ graphics.locations[self.anchor][1] * cur_unit[1] cur_unit[1] += unit_grad[1] if PRERENDER_TO_TEXTURE: # Create textures int_size = [int(round(s)) for s in self._size] self._prerenders =\ [pyglet.image.Texture.create(*int_size) for n in range(2)] # Set up framebuffer fbo = graphics.Framebuffer() for n in range(2): fbo.attach_texture(self._prerenders[n]) # Draw batch to texture fbo.start_render() self._batches[n].draw() fbo.end_render() # Anchor textures for correct blitting later self._prerenders[n].anchor_x, self._prerenders[n].anchor_y =\ [int(round((1 - a)* s/to_decimal(2))) for s, a in zip(self._size, graphics.locations[self.anchor])] fbo.delete() # Delete batches since they won't be used del self._batches self._computed = True def draw(self, always_compute=False): """Draws appropriate prerender depending on current phase.""" if not self._computed or always_compute: self.compute() self._cur_phase %= 360 n = int(self._cur_phase // 180) if PRERENDER_TO_TEXTURE: self._prerenders[n].blit(*self.position) else: self._batches[n].draw() def lazydraw(self): """Only draws on color reversal.""" cur_n = int(self._cur_phase // 180) prev_n = int(self._prev_phase // 180) if (cur_n != prev_n) or self._first_draw: self.draw() if self._first_draw: self._first_draw = False diff --git a/src/signals.py b/src/signals.py index a2497f4..a5adfc8 100644 --- a/src/signals.py +++ b/src/signals.py @@ -1,126 +1,130 @@ """Module for signalling upon stimuli appearance using the serial or parallel ports.""" SERPORT = None PARPORT = None + STATE = None OLD_STATE = None + USER_START = 128 # 0b10000000 BOARD_FLIP = 64 # 0b01000000 GROUP_START = 32 # 0b00100000 GROUP_STOP = 16 # 0b00010000 FIX_START = 4 # 0b00000100 FIX_STOP = 2 # 0b00000010 +FLIP_SIG_PER = 1 + available = {'serial': False, 'parallel': False} try: import serial try: test_port = serial.Serial(0) test_port.close() del test_port available['serial'] = True except serial.serialutil.SerialException: pass except ImportError: pass try: import parallel try: test_port = parallel.Parallel() del test_port available['parallel'] = True except: pass except ImportError: pass if available['serial']: def ser_init(): global SERPORT SERPORT = serial.Serial(0) def ser_send(): global SERPORT global STATE if STATE != None: SERPORT.write(str(STATE)) def ser_quit(): global SERPORT SERPORT.close() SERPORT = None if available['parallel']: def par_init(): global PARPORT PARPORT = parallel.Parallel() PARPORT.setData(0) def par_send(): global PARPORT global STATE if STATE != None: PARPORT.setData(STATE) else: PARPORT.setData(0) def par_quit(): global PARPORT PARPORT.setData(0) PARPORT = None def init(sigser, sigpar): global STATE global OLD_STATE STATE = None OLD_STATE = None if sigser: ser_init() if sigpar: par_init() def set_state(state): global STATE global OLD_STATE OLD_STATE = STATE STATE = state def set_board_flip(board_id): set_state(BOARD_FLIP + board_id) def set_group_start(group_id): set_state(GROUP_START + group_id) def set_group_stop(group_id): set_state(GROUP_STOP + group_id) def set_user_start(): set_state(USER_START) def set_fix_start(): set_state(FIX_START) def set_fix_stop(): set_state(FIX_STOP) def set_null(): set_state(None) def send(sigser, sigpar): if sigser: ser_send() if STATE != OLD_STATE: if sigpar: par_send() def quit(sigser, sigpar): set_null() if sigser: ser_quit() if sigpar: par_quit()
ztangent/checkergen
71a5f3006c7bc55ed7718df6fda078569c8df3f2
Experimental block generation working.
diff --git a/src/cli.py b/src/cli.py index b5510b2..eaf336f 100644 --- a/src/cli.py +++ b/src/cli.py @@ -437,560 +437,616 @@ class CkgCmd(cmd.Cmd): self.cur_group = self.cur_proj.groups[args.gid] print "group", args.gid, "is now the current display group" mk_parser = CmdParser(add_help=False, prog='mk', description='''Makes a new checkerboard in the current group with the given parameters.''') mk_parser.add_argument('dims', action=store_tuple(2, ',', to_decimal), help='''width,height of checkerboard in no. of unit cells''') mk_parser.add_argument('init_unit', action=store_tuple(2, ',', to_decimal), help='width,height of initial unit cell in pixels') mk_parser.add_argument('end_unit', action=store_tuple(2, ',', to_decimal), help='width,height of final unit cell in pixels') mk_parser.add_argument('position', action=store_tuple(2, ',', to_decimal), help='x,y position of checkerboard in pixels') mk_parser.add_argument('anchor', choices=sorted(locations.keys()), help='''location of anchor point of checkerboard (choices: %(choices)s)''', metavar='anchor') mk_parser.add_argument('cols', action=store_tuple(2, ',', to_color, [';']), help='''color1,color2 of the checkerboard (color format: R;G;B, component range from 0-255)''') mk_parser.add_argument('freq', type=to_decimal, help='frequency of color reversal in Hz') mk_parser.add_argument('phase', type=to_decimal, nargs='?', default='0', help='initial phase of animation in degrees') def help_mk(self): self.__class__.mk_parser.print_help() def do_mk(self, line): """Makes a checkerboard with the given parameters.""" if self.cur_proj == None: print 'no project open, automatically creating project...' self.do_new('') if self.cur_group == None: print 'automatically adding display group...' self.do_mkgrp('') try: args = self.__class__.mk_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.mk_parser.print_usage() return shape_dict = dict([(name, getattr(args, name)) for name in public_dir(args)]) new_shape = core.CheckerBoard(**shape_dict) new_id = self.cur_proj.add_shape_to_group(self.cur_group, new_shape) print "checkerboard", new_id, "added" ed_parser = CmdParser(add_help=False, prog='ed', description='''Edits attributes of checkerboards specified by ids.''') ed_parser.add_argument('idlist', nargs='+', metavar='id', type=int, help='''ids of checkerboards in the current group to be edited''') ed_parser.add_argument('--dims', action=store_tuple(2, ',', to_decimal), help='checkerboard dimensions in unit cells', metavar='WIDTH,HEIGHT') ed_parser.add_argument('--init_unit', action=store_tuple(2, ',', to_decimal), help='initial unit cell dimensions in pixels', metavar='WIDTH,HEIGHT') ed_parser.add_argument('--end_unit', action=store_tuple(2, ',', to_decimal), help='final unit cell dimensions in pixels', metavar='WIDTH,HEIGHT') ed_parser.add_argument('--position', action=store_tuple(2, ',', to_decimal), help='position of checkerboard in pixels', metavar='X,Y') ed_parser.add_argument('--anchor', choices=sorted(locations.keys()), help='''location of anchor point of checkerboard (choices: %(choices)s)''', metavar='LOCATION') ed_parser.add_argument('--cols', metavar='COLOR1,COLOR2', action=store_tuple(2, ',', to_color, [';']), help='''checkerboard colors (color format: R;G;B, component range from 0-255)''') ed_parser.add_argument('--freq', type=to_decimal, help='frequency of color reversal in Hz') ed_parser.add_argument('--phase', type=to_decimal, help='initial phase of animation in degrees') def help_ed(self): self.__class__.ed_parser.print_help() def do_ed(self, line): """Edits attributes of checkerboards specified by ids.""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups, please create one first' return try: args = self.__class__.ed_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.ed_parser.print_usage() return # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist[:]: if x >= len(self.cur_group.shapes) or x < 0: args.idlist.remove(x) print "checkerboard", x, "does not exist" if args.idlist == []: return names = public_dir(args) names.remove('idlist') noflags = True for name in names: val = getattr(args, name) if val != None: for x in args.idlist: self.cur_proj.set_shape_attr(self.cur_group, x, name, val) noflags = False if noflags: print "no options specified, please specify at least one" self.__class__.ed_parser.print_usage() rm_parser = CmdParser(add_help=False, prog='rm', description='''Removes checkerboards specified by ids.''') rm_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''ids of checkerboards in the current group to be removed''') rm_parser.add_argument('-a', '--all', action='store_true', help='''remove all checkerboards in the current group''') def help_rm(self): self.__class__.rm_parser.print_help() def do_rm(self, line): """Removes checkerboards specified by ids""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups, no boards to remove' return try: args = self.__class__.rm_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.rm_parser.print_usage() return rmlist = [] if args.all: for shape in self.cur_group.shapes: self.cur_proj.del_shape_from_group(self.cur_group, shape) print "all checkerboards removed" return elif len(args.idlist) == 0: print "please specify at least one id" # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist: if x >= len(self.cur_group.shapes) or x < 0: print "checkerboard", x, "does not exist" continue rmlist.append(self.cur_group.shapes[x]) print "checkerboard", x, "removed" for shape in rmlist: self.cur_proj.del_shape_from_group(self.cur_group, shape) ls_parser = CmdParser(add_help=False, prog='ls', description='''Lists project, display group and checkerboard settings. If no group ids are specified, all display groups are listed.''') ls_parser.add_argument('gidlist', nargs='*', metavar='gid', type=int, help='''ids of the display groups to be listed''') ls_group = ls_parser.add_mutually_exclusive_group() ls_group.add_argument('-s', '--settings', action='store_true', help='list only project settings') ls_group.add_argument('-g', '--groups', action='store_true', help='list only display groups') def help_ls(self): self.__class__.ls_parser.print_help() def do_ls(self, line): """Lists project, display group and checkerboard settings.""" def ls_str(s, seps=[',',';']): """Special space-saving output formatter.""" if type(s) in [tuple, list]: if len(seps) > 1: newseps = seps[1:] else: newseps = seps return seps[0].join([ls_str(i, newseps) for i in s]) else: return str(s) if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.ls_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.ls_parser.print_usage() return # Remove duplicates and ascending sort args.gidlist = sorted(set(args.gidlist)) if len(self.cur_proj.groups) == 0: if len(args.gidlist) > 0: print 'this project has no display groups that can be listed' args.settings = True else: for gid in args.gidlist[:]: if gid >= len(self.cur_proj.groups) or gid < 0: args.gidlist.remove(gid) print 'display group', gid, 'does not exist' if args.gidlist == []: args.gidlist = range(len(self.cur_proj.groups)) else: # If any (valid) groups are specified # don't show project settings args.groups = True if not args.groups: print 'PROJECT SETTINGS'.center(70,'*') print \ 'name'.rjust(16),\ 'fps'.rjust(7),\ 'resolution'.rjust(14),\ 'bg color'.rjust(18) # 'format'.rjust(7) print \ ls_str(self.cur_proj.name).rjust(16),\ ls_str(self.cur_proj.fps).rjust(7),\ ls_str(self.cur_proj.res).rjust(14),\ ls_str(self.cur_proj.bg).rjust(18) # ls_str(self.cur_proj.export_fmt).rjust(7) print \ 'pre-display'.rjust(26),\ 'post-display'.rjust(26) print \ ls_str(self.cur_proj.pre).rjust(26),\ ls_str(self.cur_proj.post).rjust(26) print \ 'cross colors'.rjust(26),\ 'cross times'.rjust(26) print \ ls_str(self.cur_proj.cross_cols).rjust(26),\ ls_str(self.cur_proj.cross_times).rjust(26) if not args.settings and not args.groups: # Insert empty line if both groups and project # settings are listed print '' if not args.settings: for i, n in enumerate(args.gidlist): if i != 0: # Print newline seperator between each group print '' group = self.cur_proj.groups[n] print 'GROUP {n}'.format(n=n).center(70,'*') print \ 'pre-display'.rjust(20),\ 'display'.rjust(20),\ 'post-display'.rjust(20) print \ ls_str(group.pre).rjust(20),\ ls_str(group.disp).rjust(20),\ ls_str(group.post).rjust(20) if len(group.shapes) > 0: print \ ''.rjust(2),\ 'shape id'.rjust(8),\ 'dims'.rjust(10),\ 'init_unit'.rjust(14),\ 'end_unit'.rjust(14),\ 'position'.rjust(14) for m, shape in enumerate(group.shapes): print \ ''.rjust(2),\ ls_str(m).rjust(8),\ ls_str(shape.dims).rjust(10),\ ls_str(shape.init_unit).rjust(14),\ ls_str(shape.end_unit).rjust(14),\ ls_str(shape.position).rjust(14) print '\n',\ ''.rjust(2),\ 'shape id'.rjust(8),\ 'colors'.rjust(27),\ 'anchor'.rjust(12),\ 'freq'.rjust(6),\ 'phase'.rjust(7) for m, shape in enumerate(group.shapes): print \ ''.rjust(2),\ ls_str(m).rjust(8),\ ls_str(shape.cols).rjust(27),\ ls_str(shape.anchor).rjust(12),\ ls_str(shape.freq).rjust(6),\ ls_str(shape.phase).rjust(7) display_parser = CmdParser(add_help=False, prog='display', description='''Displays the animation in a window or in fullscreen.''') display_parser.add_argument('-f', '--fullscreen', action='store_true', help='sets fullscreen mode, ESC to quit') display_parser.add_argument('-p', '--priority', metavar='LEVEL', help='''set priority while displaying, higher priority results in less dropped frames (choices: 0-3, low, normal, high, realtime)''') display_parser.add_argument('-r', '--repeat', metavar='N', type=int, help='''repeatedly display specified display groups N number of times''') display_parser.add_argument('-pt', '--phototest', action='store_true', help='''draw white test rectangle in topleft corner of screen when groups become visible for a photodiode to detect''') display_parser.add_argument('-lt', '--logtime', action='store_true', help='output frame timestamps to a log file') display_parser.add_argument('-ld', '--logdur', action='store_true', help='output frame durations to a log file') display_parser.add_argument('-ss', '--sigser', action='store_true', help='''send signals through the serial port when shapes are being displayed''') display_parser.add_argument('-sp', '--sigpar', action='store_true', help='''send signals through the parallel port when shapes are being displayed''') display_parser.add_argument('-et', '--eyetrack', action='store_true', help='''use eyetracking to ensure that subject fixates on the cross in the center''') display_parser.add_argument('-eu', '--etuser', action='store_true', help='''allow user to select eyetracking video source from a dialog''') display_parser.add_argument('-ev', '--etvideo', metavar='path', help='''path (with no spaces) to eyetracking video file to be used as the source''') display_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''list of display groups to be displayed in the specified order (default: order by id, i.e. group 0 is first)''') def help_display(self): self.__class__.display_parser.print_help() def do_display(self, line): """Displays the animation in a window or in fullscreen""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.display_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.display_parser.print_usage() return group_queue = [] if len(args.idlist) > 0: for i in set(args.idlist): if i >= len(self.cur_proj.groups) or i < -1: print 'error: group', i, 'does not exist' return for i in args.idlist: if i == -1: group_queue.append(core.CkgWaitScreen()) else: group_queue.append(self.cur_proj.groups[i]) else: group_queue = list(self.cur_proj.groups) if args.repeat != None: group_queue = list(group_queue * args.repeat) if args.priority != None: if not priority.available: print "error: setting priority not avaible on", sys.platform print "continuing..." else: if args.priority.isdigit(): args.priority = int(args.priority) try: priority.set(args.priority) except ValueError: print "error:", str(sys.exc_value) print "continuing..." if args.eyetrack and eyetracking.available: if not eyetracking.is_calibrated(): try: self.do_calibrate('',True) except eyetracking.EyetrackingError: print "error:", str(sys.exc_value) return if len(path) > 0: print "calibration file successfully loaded" try: self.cur_proj.display(fullscreen=args.fullscreen, logtime=args.logtime, logdur=args.logdur, sigser=args.sigser, sigpar=args.sigpar, phototest=args.phototest, eyetrack=args.eyetrack, etuser=args.etuser, etvideo=args.etvideo, group_queue=group_queue) except (IOError, NotImplementedError, eyetracking.EyetrackingError): print "error:", str(sys.exc_value) return if args.priority != None: try: priority.set('normal') except: pass export_parser = CmdParser(add_help=False, prog='export', description='''Exports animation as an image sequence (in a folder) to the specified directory.''') # export_parser.add_argument('--fmt', dest='export_fmt', # choices=core.EXPORT_FMTS, # help='image format for export') export_parser.add_argument('-n','--nofolder', dest='folder', action='store_false', help='''force images not to exported in a containing folder''') export_parser.add_argument('-r', '--repeat', metavar='N', type=int, help='''repeatedly export specified display groups N number of times''') export_parser.add_argument('duration', nargs='?', type=to_decimal, default='Infinity', help='''number of seconds of the animation that should be exported (default: as long as the entire animation)''') export_parser.add_argument('dir', nargs='?', default=os.getcwd(), help='''destination directory for export (default: current working directory)''') export_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''list of display groups to be exported in the specified order (default: order by id, i.e. group 0 is first)''') def help_export(self): self.__class__.export_parser.print_help() def do_export(self, line): """Exports animation an image sequence to the specified directory.""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.export_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.export_parser.print_usage() return if len(args.idlist) > 0: for i in set(args.idlist): if i >= len(self.cur_proj.groups) or i < 0: print 'error: group', i, 'does not exist' return group_queue = [self.cur_proj.groups[i] for i in args.idlist] else: group_queue = list(self.cur_proj.groups) if args.repeat != None: group_queue = list(group_queue * args.repeat) try: self.cur_proj.export(export_dir=args.dir, export_duration=args.duration, group_queue=group_queue, folder=args.folder) except IOError: print "error:", str(sys.exc_value) return except core.FrameOverflowError: print "warning:", str(sys.exc_value) print "Are you sure you want to continue?" while True: try: if self.__class__.yn_parse(raw_input()): self.cur_proj.export(export_dir=args.dir, export_duration=args.duration, group_queue=group_queue, export_fmt=None, folder=args.folder, force=True) break else: return except TypeError: print str(sys.exc_value) except EOFError: return print "Export done." + mkblks_parser = CmdParser(add_help=False, prog='mkblks', + description='''Generates randomized experimental + blocks from display groups and + saves each as a CSV file.''') + mkblks_parser.add_argument('-n','--nofolder', + dest='folder', action='store_false', + help='''force block files not to be saved in + a containing folder''') + mkblks_parser.add_argument('-d','--dir', default=os.getcwd(), + help='''where to save block files + (default: current working directory)''') + mkblks_parser.add_argument('length', type=int, + help='''no. of repeated trials in a block''') + mkblks_parser.add_argument('flags', nargs='?', + help='''flags passed to the display command + that should be used when the block + file is run (enclose in quotes and use + '+' or '++' in place of '-' or '--')''') + + def help_mkblks(self): + self.__class__.mkblks_parser.print_help() + + def do_mkblks(self, line): + """Generates randomized experimental blocks from display groups.""" + if self.cur_proj == None: + print 'please create or open a project first' + return + + try: + args = self.__class__.mkblks_parser.parse_args(shlex.split(line)) + except CmdParserError: + print "error:", str(sys.exc_value) + self.__class__.mkblks_parser.print_usage() + return + + args.flags = args.flags.replace('+','-') + try: + disp_args = self.__class__.display_parser.\ + parse_args(shlex.split(args.flags)) + except CmdParserError: + print "error: invalid flags to display command" + print str(sys.exc_value) + self.__class__.display_parser.print_usage() + return + + try: + self.cur_proj.mkblks(args.length, + path=args.dir, + folder=args.folder, + flags=args.flags) + except IOError: + print "error:", str(sys.exc_value) + return + + print "Experimental blocks generated." + def do_calibrate(self, line, query=False): """Calibrate subject for eyetracking, or load a calibration file.""" if not eyetracking.available: print "error: eyetracking functionality not available" return if query: print "path to calibration file (leave empty for GUI tool):" path = raw_input().strip().strip('"\'') else: path = line.strip().strip('"\'') if len(path) == 0: path = None if eyetracking.VET.VideoSourceType == 0: # Select default source if none has been selected eyetracking.select_source() try: eyetracking.calibrate(path) except eyetracking.EyetrackingError: if query: raise else: print "error:", str(sys.exc_value) return if len(path) > 0: print "calibration file successfully loaded" def do_quit(self, line): """Quits the program.""" if self.save_check(): return return True def do_EOF(self, line): """Typing Ctrl-D issues this command, which quits the program.""" print '\r' if self.save_check(): return return True def help_help(self): print 'Prints a list of commands.' print "Type 'help <topic>' for more details on each command." def default(self, line): command = line.split()[0] print \ "'{0}' is not a checkergen command.".format(command),\ "Type 'help' for a list of commands" diff --git a/src/core.py b/src/core.py index ee1670c..88c7c52 100755 --- a/src/core.py +++ b/src/core.py @@ -1,1003 +1,1019 @@ """Contains core functionality of checkergen. Errors and Exceptions: FileFormatError FrameOverflowError Classes: CkgProj -- A checkergen project, contains settings and CkgDisplayGroups. CkgDisplayGroup -- A set of CheckerShapes to be displayed simultaneously. CheckerShapes -- Abstract checkered shape class CheckerBoard -- A (distorted) checkerboard pattern, can color-flip. """ import os import sys import re import csv import itertools from xml.dom import minidom import pyglet import graphics import signals import eyetracking from utils import * CKG_FMT = 'ckg' XML_NAMESPACE = 'http://github.com/ZOMGxuan/checkergen' MAX_EXPORT_FRAMES = 100000 PRERENDER_TO_TEXTURE = False EXPORT_FMTS = ['png'] +EXPORT_DIR_SUFFIX = '-anim' +BLOCK_DIR_SUFFIX = '-blks' FIX_POS = (0, 0) FIX_RANGE = (20, 20) SANS_SERIF = ('Helvetica', 'Arial', 'FreeSans') def xml_get(parent, namespace, name, index=0): """Returns concatenated text node values inside an element.""" element = [node for node in parent.childNodes if node.localName == name and node.namespaceURI == namespace][index] strings = [] for node in element.childNodes: if node.nodeType == node.TEXT_NODE: strings.append(node.data) return ''.join(strings) def xml_set(document, parent, name, string): """Stores value as a text node in a new DOM element.""" element = document.createElement(name) parent.appendChild(element) text = document.createTextNode(string) element.appendChild(text) def xml_pretty_print(document, indent): """Hack to prettify minidom's not so pretty print.""" ugly_xml = document.toprettyxml(indent=indent) prettifier_re = re.compile('>\n\s+([^<>\s].*?)\n\s+</', re.DOTALL) pretty_xml = prettifier_re.sub('>\g<1></', ugly_xml) return pretty_xml class FileFormatError(ValueError): """Raised when correct file format/extension is not supplied.""" pass class FrameOverflowError(Exception): """Raised when more than MAX_EXPORT_FRAMES are going to be exported.""" pass class CkgProj: """Defines a checkergen project, with checkerboards and other settings.""" DEFAULTS = {'name': 'untitled', 'fps': 60, 'res': (800, 600), 'bg': (127, 127, 127), 'export_fmt': 'png', 'pre': 0, 'post': 0, 'cross_cols': ((0, 0, 0), (255, 0, 0)), 'cross_times': ('Infinity', 1)} def __init__(self, **keywords): """Initializes a new project, or loads it from a path. path -- if specified, ignore other arguments and load project from path name -- name of the project, always the same as the filename without the extension fps -- frames per second of the animation to be displayed res -- screen resolution / window size at which project will be displayed bg -- background color of the animation as a 3-tuple (R, G, B) export_fmt -- image format for animation to be exported as pre -- time in seconds a blank screen will be shown before any display groups post --time in seconds a blank screen will be shown after any display groups """ if 'path' in keywords.keys(): self.load(keywords['path']) return for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.groups = [] def __setattr__(self, name, value): # Type conversions if name == 'name': value = str(value) elif name in ['fps', 'pre', 'post']: value = to_decimal(value) elif name == 'res': if len(value) != 2: raise ValueError value = tuple([int(v) for v in value]) elif name == 'bg': if len(value) != 3: raise ValueError value = tuple([int(v) for v in value]) elif name == 'export_fmt': if value not in EXPORT_FMTS: msg = 'image format not recognized or supported' raise FileFormatError(msg) elif name == 'cross_cols': if len(value) != 2: raise ValueError for col in value: if len(col) != 3: raise ValueError value = tuple([tuple([int(c) for c in col]) for col in value]) elif name == 'cross_times': if len(value) != 2: raise ValueError value = tuple([to_decimal(x) for x in value]) # Store value self.__dict__[name] = value # Set dirty bit if name != '_dirty': self._dirty = True def add_group(self, group): """Append group to list and set dirty bit.""" self.groups.append(group) self._dirty = True return self.groups.index(group) def del_group(self, group): """Remove group to list and set dirty bit.""" self.groups.remove(group) self._dirty = True def add_shape_to_group(self, group, shape): """Add shape to group specified by id and set dirty bit.""" if group not in self.groups: raise ValueError group.shapes.append(shape) self._dirty = True return group.shapes.index(shape) def del_shape_from_group(self, group, shape): """Removes shape from group specified by id and set dirty bit.""" if group not in self.groups: raise ValueError group.shapes.remove(shape) self._dirty = True def set_group_attr(self, gid, name, value): """Set attribute of a group specified by id and set dirty bit.""" setattr(self.groups[gid], name, value) self._dirty = True def set_shape_attr(self, group, sid, name, value): """Set attribute of a shape specified by id and set dirty bit.""" if group not in self.groups: raise ValueError setattr(group.shapes[sid], name, value) self._dirty = True def is_dirty(self): return self._dirty def load(self, path): """Loads project from specified path.""" # Get project name from filename name, ext = os.path.splitext(os.path.basename(path)) if ext == '.{0}'.format(CKG_FMT): self.name = name else: msg = "path lacks '.{0}' extension".format(CKG_FMT) raise FileFormatError(msg) with open(path, 'r') as project_file: doc = minidom.parse(project_file) project = doc.documentElement vars_to_load = self.__class__.DEFAULTS.keys() # Name is not stored in project file vars_to_load.remove('name') for var in vars_to_load: try: value = eval(xml_get(project, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) self.groups = [] group_els = [node for node in project.childNodes if node.localName == 'group' and node.namespaceURI == XML_NAMESPACE] for group_el in group_els: new_group = CkgDisplayGroup() new_group.load(group_el) self.groups.append(new_group) self._dirty = False def save(self, path): """Saves project to specified path as an XML document.""" self.name, ext = os.path.splitext(os.path.basename(path)) if ext != '.{0}'.format(CKG_FMT): path = '{0}.{1}'.format(path, CKG_FMT) impl = minidom.getDOMImplementation() doc = impl.createDocument(XML_NAMESPACE, 'project', None) project = doc.documentElement # Hack below because minidom doesn't support namespaces properly project.setAttribute('xmlns', XML_NAMESPACE) vars_to_save = self.__class__.DEFAULTS.keys() # Name is not stored in project file vars_to_save.remove('name') for var in vars_to_save: xml_set(doc, project, var, repr(getattr(self, var))) for group in self.groups: group.save(doc, project) with open(path, 'w') as project_file: project_file.write(xml_pretty_print(doc,indent=' ')) self._dirty = False return path - def blockgen(self, length, path=None, folder=True, **flags): + def mkblks(self, length, path=None, folder=True, flags=''): """Generates randomized experimental blocks from display groups. Each block is saved as a CSV file. length -- number of repeated trials within a block path -- directory in which experimental blocks will be saved folder -- blocks will be saved in a containing folder if true - flags -- flags to be issued to the display command when block file - is run + flags -- string of flags to be issued to the display command when + block file is run """ if path == None: path = os.getcwd() - for order in itertools.permutations(range(len(self.groups))): - pass + if folder: + path = os.path.join(path, self.name + BLOCK_DIR_SUFFIX) + if not os.path.isdir(path): + os.mkdir(path) + + group_ids = range(len(self.groups)) + for n, sequence in enumerate(itertools.permutations(group_ids)): + blkname = 'block{0}.csv'.format(repr(n).zfill(numdigits(length))) + blkfile = open(os.path.join(path, blkname), 'wb') + blkwriter = csv.writer(blkfile, dialect='excel-tab') + blkwriter.writerow(['checkergen experimental block file']) + blkwriter.writerow(['flags:', flags]) + blkwriter.writerow(['repeats:', length]) + blkwriter.writerow(['sequence:'] + list(sequence)) + blkfile.close() def display(self, fullscreen=False, logtime=False, logdur=False, sigser=False, sigpar=False, phototest=False, eyetrack=False, etuser=False, etvideo=None, group_queue=[]): """Displays the project animation on the screen. fullscreen -- animation is displayed fullscreen if true, stretched to fit if necessary logtime -- timestamp of each frame is saved to a logfile if true logdur -- duration of each frame is saved to a logfile if true sigser -- send signals through serial port when each group is shown sigpar -- send signals through parallel port when each group is shown phototest -- draw white rectangle in topleft corner when each group is shown for photodiode to detect eyetrack -- use eyetracking to ensure subject is fixating on cross etuser -- if true, user gets to select eyetracking video source in GUI etvideo -- optional eyetracking video source file to use instead of live feed group_queue -- queue of groups to be displayed, defaults to order of groups in project (i.e. groups[0] first, etc.) """ # Create fixation crosses fix_crosses = [graphics.Cross([r/2 for r in self.res], (20, 20), col = cross_col) for cross_col in self.cross_cols] # Create test rectangle if phototest: test_rect = graphics.Rect((0, self.res[1]), [r/8 for r in self.res], anchor='topleft') # Set-up groups and variables that control their display if group_queue == []: group_queue = list(self.groups) cur_group = None cur_id = -1 flipped = 0 flip_id = -1 groups_duration = sum([group.duration() for group in group_queue]) groups_start = self.pre * self.fps groups_stop = (self.pre + groups_duration) * self.fps disp_end = (self.pre + groups_duration + self.post) * self.fps if groups_start == 0 and groups_stop > 0: groups_visible = True else: groups_visible = False count = 0 # Initialize ports if sigser: if not signals.available['serial']: msg = 'serial port functionality not available' raise NotImplementedError(msg) if sigpar: if not signals.available['parallel']: msg = 'parallel port functionality not available' raise NotImplementedError(msg) signals.init(sigser, sigpar) # Initialize eyetracking if eyetrack: if not eyetracking.available: msg = 'eyetracking functionality not available' raise NotImplementedError(msg) fixating = False old_fixating = False eyetracking.select_source(etuser, etvideo) eyetracking.start() # Stretch to fit screen only if project res does not equal screen res scaling = False if fullscreen: window = pyglet.window.Window(fullscreen=True, visible=False) if (window.width, window.height) != self.res: scaling = True else: window = pyglet.window.Window(*self.res, visible=False) # Set up KeyStateHandler to handle keyboard input keystates = pyglet.window.key.KeyStateHandler() window.push_handlers(keystates) # Create framebuffer object for drawing unscaled scene if scaling: canvas = pyglet.image.Texture.create(*self.res) fbo = graphics.Framebuffer(canvas) fbo.start_render() graphics.set_clear_color(self.bg) fbo.clear() fbo.end_render() # Clear window and make visible window.switch_to() graphics.set_clear_color(self.bg) window.clear() window.set_visible() # Initialize logging variables if logtime and logdur: logstring = '' stamp = Timer() dur = Timer() stamp.start() dur.start() elif logtime or logdur: logstring = '' timer = Timer() timer.start() # Main loop while not window.has_exit and count < disp_end: # Clear canvas if scaling: fbo.start_render() fbo.clear() else: window.clear() # Assume no change to group visibility flipped = 0 # Manage groups when they are on_screen if groups_visible: # Send special signal if waitscreen ends if isinstance(cur_group, CkgWaitScreen): if cur_group.over: signals.set_user_start() cur_group = None elif cur_group != None: # Check whether group changes in visibility if cur_group.visible != cur_group.old_visible: flip_id = self.groups.index(cur_group) if cur_group.visible: flipped = 1 elif cur_group.old_visible: flipped = -1 # Check if current group is over if cur_group.over: cur_group = None # Get next group from queue if cur_group == None: cur_id += 1 if cur_id >= len(group_queue): groups_visible = False else: cur_group = group_queue[cur_id] cur_group.reset() if not isinstance(cur_group, CkgWaitScreen): if cur_group.visible: flip_id = self.groups.index(cur_group) flipped = 1 # Draw and then update group if cur_group != None: cur_group.draw() cur_group.update(fps=self.fps, keystates=keystates) # Send signals upon group visibility change if flipped == 1: signals.set_group_start(flip_id) # Draw test rectangle if phototest: test_rect.draw() elif flipped == -1: signals.set_group_stop(flip_id) else: signals.set_null() # Draw normal cross color if fixating, other color if not if eyetrack: old_fixating = fixating fixating = eyetracking.fixating(FIX_POS, FIX_RANGE) if fixating: fix_crosses[0].draw() if not old_fixating: signals.set_fix_start() else: fix_crosses[1].draw() if old_fixating: signals.set_fix_stop() # Change cross color based on time if eyetracking is not enabled elif (count % (sum(self.cross_times) * self.fps) < self.cross_times[0] * self.fps): fix_crosses[0].draw() else: fix_crosses[1].draw() # Increment count and set whether groups should be shown if not isinstance(cur_group, CkgWaitScreen): count += 1 if groups_start <= count < groups_stop: groups_visible = True else: groups_visible = False # Blit canvas to screen if necessary if scaling: fbo.end_render() window.switch_to() canvas.blit(0, 0) window.dispatch_events() window.flip() # Make sure everything has been drawn pyglet.gl.glFinish() # Append time information to log string if logtime and logdur: logstring = '\n'.join([logstring, str(stamp.elapsed())]) logstring = '\t'.join([logstring, str(dur.restart())]) elif logtime: logstring = '\n'.join([logstring, str(timer.elapsed())]) elif logdur: logstring = '\n'.join([logstring, str(timer.restart())]) # Send signals ASAP after flip signals.send(sigser, sigpar) # Log when signals are sent if logtime or logdur: if flipped != 0 and (sigser or sigpar): sigmsg = '{0} sent'.format(signals.STATE) logstring = '\t'.join([logstring, sigmsg]) # Clean up if eyetrack: eyetracking.stop() window.close() if scaling: fbo.delete() del canvas signals.quit(sigser, sigpar) # Write log string to file if logtime or logdur: filename = '{0}.log'.format(self.name) with open(filename, 'w') as logfile: logfile.write(logstring) def export(self, export_dir, export_duration, group_queue=[], export_fmt=None, folder=True, force=False): if not os.path.isdir(export_dir): msg = 'export path is not a directory' raise IOError(msg) if export_fmt == None: export_fmt = self.export_fmt # Set-up groups and variables that control their display if group_queue == []: group_queue = list(self.groups) cur_group = None cur_id = -1 groups_duration = sum([group.duration() for group in group_queue]) groups_start = self.pre * self.fps groups_stop = (self.pre + groups_duration) * self.fps disp_end = (self.pre + groups_duration + self.post) * self.fps if groups_start == 0 and groups_stop > 0: groups_visible = True else: groups_visible = False count = 0 # Limit export duration to display duration frames = export_duration * self.fps frames = min(frames, disp_end) # Warn user if a lot of frames will be exported if frames > MAX_EXPORT_FRAMES and not force: msg = 'very large number ({0}) of frames to be exported'.\ format(frames) raise FrameOverflowError(msg) # Create folder to store images if necessary if folder: - export_dir = os.path.join(export_dir, self.name) + export_dir = os.path.join(export_dir, + self.name + EXPORT_DIR_SUFFIX) if not os.path.isdir(export_dir): os.mkdir(export_dir) # Create fixation crosses fix_crosses = [graphics.Cross([r/2 for r in self.res], (20, 20), col = cross_col) for cross_col in self.cross_cols] # Set up canvas and framebuffer object canvas = pyglet.image.Texture.create(*self.res) fbo = graphics.Framebuffer(canvas) fbo.start_render() graphics.set_clear_color(self.bg) fbo.clear() # Main loop while count < frames: fbo.clear() if groups_visible: # Check if current group is over if cur_group != None: if cur_group.over: cur_group = None # Get next group from queue if cur_group == None: cur_id += 1 if cur_id >= len(group_queue): groups_visible = False else: cur_group = group_queue[cur_id] cur_group.reset() # Draw and then update group if cur_group != None: cur_group.draw() cur_group.update(fps=self.fps) # Draw fixation cross based on current count if (count % (sum(self.cross_times) * self.fps) < self.cross_times[0] * self.fps): fix_crosses[0].draw() else: fix_crosses[1].draw() # Save current frame to file savepath = \ os.path.join(export_dir, '{0}{2}.{1}'. format(self.name, export_fmt, repr(count).zfill(numdigits(frames-1)))) canvas.save(savepath) # Increment count and set whether groups should be shown count += 1 if groups_start <= count < groups_stop: groups_visible = True else: groups_visible = False fbo.delete() class CkgDisplayGroup: DEFAULTS = {'pre': 0, 'disp': 'Infinity', 'post': 0} def __init__(self, **keywords): """Create a new group of shapes to be displayed together. pre -- time in seconds a blank screen is shown before shapes in group are displayed disp -- time in seconds the shapes in the group are displayed, negative numbers result in shapes being displayed forever post -- time in seconds a blank screen is shown after shapes in group are displayed """ for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.shapes = [] self.reset() def __setattr__(self, name, value): if name in self.__class__.DEFAULTS: value = to_decimal(value) self.__dict__[name] = value def duration(self): """Returns total duration of display group.""" return self.pre + self.disp + self.post def reset(self): """Resets internal count and all contained shapes.""" self._count = 0 self._start = self.pre self._stop = self.pre + self.disp self._end = self.pre + self.disp + self.post self.over = False self.old_visible = False if self._start == 0 and self._stop > 0: self.visible = True else: self.visible = False if self._end == 0: self.over = True for shape in self.shapes: shape.reset() def draw(self, lazy=False): """Draws all contained shapes during the appropriate interval.""" if self.visible: for shape in self.shapes: if lazy: shape.lazydraw() else: shape.draw() def update(self, **keywords): """Increments internal count, makes group visible when appropriate.""" fps = keywords['fps'] if self.visible: # Set triggers to be sent for n, shape in enumerate(self.shapes): if shape.flipped: signals.set_board_flip(n) # Update contained shapes for shape in self.shapes: shape.update(fps) # Increment count and set flags for the next frame self._count += 1 self.old_visible = self.visible if (self._start * fps) <= self._count < (self._stop * fps): self.visible = True else: self.visible = False if self._count >= (self._end * fps): self.over = True else: self.over = False def save(self, document, parent): """Saves group in specified XML document as child of parent.""" group_el = document.createElement('group') parent.appendChild(group_el) for var in self.__class__.DEFAULTS.keys(): xml_set(document, group_el, var, repr(getattr(self, var))) for shape in self.shapes: shape.save(document, group_el) def load(self, element): """Loads group from XML DOM element.""" for var in self.__class__.DEFAULTS.keys(): try: value = eval(xml_get(element, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) shape_els = [node for node in element.childNodes if node.localName == 'shape' and node.namespaceURI == XML_NAMESPACE] for shape_el in shape_els: # TODO: Make load code shape-agnostic new_shape = CheckerBoard() new_shape.load(shape_el) self.shapes.append(new_shape) class CkgWaitScreen(CkgDisplayGroup): """Dummy display group, waits for user input to proceed.""" DEFAULTS = {'g_keys': (pyglet.window.key.SPACE,), 'r_keys': (pyglet.window.key.NUM_ENTER, pyglet.window.key.ENTER), 'res': CkgProj.DEFAULTS['res'], 'g_info': "the experiment will start soon", 'r_info': "press enter when ready", 'font_color': (0, 0, 0, 255), 'font_size': 16} def __init__(self, **keywords): """Create an informative waitscreen that proceeds after user input.""" for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.g_label = pyglet.text.Label(self.g_info, font_name=SANS_SERIF, font_size=self.font_size, color=self.font_color, bold=True, x=self.res[0]//2, y=self.res[1]//8, anchor_x='center', anchor_y='center') self.r_label = pyglet.text.Label(self.r_info, font_name=SANS_SERIF, font_size=self.font_size, color=self.font_color, bold=True, x=self.res[0]//2, y=self.res[1]//8, anchor_x='center', anchor_y='center') self.reset() def __setattr__(self, name, value): self.__dict__[name] = value def duration(self): """Returns zero since wait times are arbitrary.""" return to_decimal(0) def reset(self): """Resets some flags.""" self.ready = False self.over = False def draw(self): """Draw informative text.""" if not self.ready: self.r_label.draw() else: self.g_label.draw() def update(self, **keywords): """Checks for keypress, sends signal upon end.""" keystates = keywords['keystates'] if self.r_keys == None: if max([keystates[key] for key in self.g_keys]): self.ready = True self.over = True elif not self.ready: if max([keystates[key] for key in self.r_keys]): self.ready = True else: if max([keystates[key] for key in self.g_keys]): self.over = True class CheckerShape: # Abstract class, to be implemented. pass class CheckerDisc(CheckerShape): # Circular checker pattern, to be implemented pass class CheckerBoard(CheckerShape): DEFAULTS = {'dims': (5, 5), 'init_unit': (30, 30), 'end_unit': (50, 50), 'position': (0, 0), 'anchor': 'bottomleft', 'cols': ((0, 0, 0), (255, 255, 255)), 'freq': 1, 'phase': 0} # TODO: Reimplement mid/center anchor functionality in cool new way def __init__(self, **keywords): for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.reset() def __setattr__(self, name, value): # Type conversions if name == 'dims': if len(value) != 2: raise ValueError value = tuple([int(x) for x in value]) elif name in ['init_unit', 'end_unit', 'position']: if len(value) != 2: raise ValueError value = tuple([to_decimal(x) for x in value]) elif name == 'anchor': if value not in graphics.locations.keys(): raise ValueError elif name == 'cols': if len(value) != 2: raise ValueError for col in value: if len(col) != 3: raise ValueError value = tuple([tuple([int(c) for c in col]) for col in value]) elif name in ['freq', 'phase']: value = to_decimal(value) # Store value self.__dict__[name] = value # Recompute if necessary if name in ['dims', 'init_unit', 'end_unit', 'position', 'anchor','cols']: self._computed = False def save(self, document, parent): """Saves board in specified XML document as child of parent.""" board_el = document.createElement('shape') board_el.setAttribute('type', 'board') parent.appendChild(board_el) for var in self.__class__.DEFAULTS.keys(): xml_set(document, board_el, var, repr(getattr(self, var))) def load(self, element): """Loads group from XML DOM element.""" for var in self.__class__.DEFAULTS.keys(): try: value = eval(xml_get(element, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) def reset(self, new_phase=None): """Resets checkerboard animation back to initial phase.""" if new_phase == None: new_phase = self.phase self._cur_phase = new_phase self._prev_phase = new_phase self.flipped = False self._first_draw = True if not self._computed: self.compute() def update(self, fps): """Increase the current phase of the checkerboard animation.""" self._prev_phase = self._cur_phase if self.freq != 0: degs_per_frame = 360 * self.freq / fps self._cur_phase += degs_per_frame if self._cur_phase >= 360: self._cur_phase %= 360 cur_n = int(self._cur_phase // 180) prev_n = int(self._prev_phase // 180) if cur_n != prev_n: self.flipped = True else: self.flipped = False def compute(self): """Computes a model of the checkerboard for drawing later.""" # Create batches to store model self._batches = [pyglet.graphics.Batch() for n in range(2)] # Calculate size of checkerboard in pixels self._size = tuple([(y1 + y2) / 2 * n for y1, y2, n in zip(self.init_unit, self.end_unit, self.dims)]) # Calculate unit size gradient unit_grad = tuple([(2 if (flag == 0) else 1) * (y2 - y1) / n for y1, y2, n, flag in zip(self.init_unit, self.end_unit, self.dims, graphics.locations[self.anchor])]) # Set initial values if PRERENDER_TO_TEXTURE: init_pos = [(1 - a)* s/to_decimal(2) for s, a in zip(self._size, graphics.locations[self.anchor])] else: init_pos = list(self.position) init_unit = [c + m/2 for c, m in zip(self.init_unit, unit_grad)] cur_unit = list(init_unit) cur_unit_pos = list(init_pos) # Add unit cells to batches in nested for loop for j in range(self.dims[1]): for i in range(self.dims[0]): cur_unit_rect = graphics.Rect(cur_unit_pos, cur_unit, anchor=self.anchor) cur_unit_rect.col = self.cols[(i + j) % 2] cur_unit_rect.add_to_batch(self._batches[0]) cur_unit_rect.col = self.cols[(i + j + 1) % 2] cur_unit_rect.add_to_batch(self._batches[1]) # Increase x values cur_unit_pos[0] += \ graphics.locations[self.anchor][0] * cur_unit[0] cur_unit[0] += unit_grad[0] # Reset x values cur_unit_pos[0] = init_pos[0] cur_unit[0] = init_unit[0] # Increase y values cur_unit_pos[1] += \ graphics.locations[self.anchor][1] * cur_unit[1] cur_unit[1] += unit_grad[1] if PRERENDER_TO_TEXTURE: # Create textures int_size = [int(round(s)) for s in self._size] self._prerenders =\ [pyglet.image.Texture.create(*int_size) for n in range(2)] # Set up framebuffer fbo = graphics.Framebuffer() for n in range(2): fbo.attach_texture(self._prerenders[n]) # Draw batch to texture fbo.start_render() self._batches[n].draw() fbo.end_render() # Anchor textures for correct blitting later self._prerenders[n].anchor_x, self._prerenders[n].anchor_y =\ [int(round((1 - a)* s/to_decimal(2))) for s, a in zip(self._size, graphics.locations[self.anchor])] fbo.delete() # Delete batches since they won't be used del self._batches self._computed = True def draw(self, always_compute=False): """Draws appropriate prerender depending on current phase.""" if not self._computed or always_compute: self.compute() self._cur_phase %= 360 n = int(self._cur_phase // 180) if PRERENDER_TO_TEXTURE: self._prerenders[n].blit(*self.position) else: self._batches[n].draw() def lazydraw(self): """Only draws on color reversal.""" cur_n = int(self._cur_phase // 180) prev_n = int(self._prev_phase // 180) if (cur_n != prev_n) or self._first_draw: self.draw() if self._first_draw: self._first_draw = False
ztangent/checkergen
f4351b2446214252779cc92a2b93eceb67e99b60
started blockgen function
diff --git a/src/core.py b/src/core.py index 227e5dc..ee1670c 100755 --- a/src/core.py +++ b/src/core.py @@ -1,769 +1,792 @@ """Contains core functionality of checkergen. Errors and Exceptions: FileFormatError FrameOverflowError Classes: CkgProj -- A checkergen project, contains settings and CkgDisplayGroups. CkgDisplayGroup -- A set of CheckerShapes to be displayed simultaneously. CheckerShapes -- Abstract checkered shape class CheckerBoard -- A (distorted) checkerboard pattern, can color-flip. """ import os import sys import re +import csv +import itertools from xml.dom import minidom import pyglet import graphics import signals import eyetracking from utils import * CKG_FMT = 'ckg' XML_NAMESPACE = 'http://github.com/ZOMGxuan/checkergen' MAX_EXPORT_FRAMES = 100000 PRERENDER_TO_TEXTURE = False EXPORT_FMTS = ['png'] FIX_POS = (0, 0) FIX_RANGE = (20, 20) SANS_SERIF = ('Helvetica', 'Arial', 'FreeSans') def xml_get(parent, namespace, name, index=0): """Returns concatenated text node values inside an element.""" element = [node for node in parent.childNodes if node.localName == name and node.namespaceURI == namespace][index] strings = [] for node in element.childNodes: if node.nodeType == node.TEXT_NODE: strings.append(node.data) return ''.join(strings) def xml_set(document, parent, name, string): """Stores value as a text node in a new DOM element.""" element = document.createElement(name) parent.appendChild(element) text = document.createTextNode(string) element.appendChild(text) def xml_pretty_print(document, indent): """Hack to prettify minidom's not so pretty print.""" ugly_xml = document.toprettyxml(indent=indent) prettifier_re = re.compile('>\n\s+([^<>\s].*?)\n\s+</', re.DOTALL) pretty_xml = prettifier_re.sub('>\g<1></', ugly_xml) return pretty_xml class FileFormatError(ValueError): """Raised when correct file format/extension is not supplied.""" pass class FrameOverflowError(Exception): """Raised when more than MAX_EXPORT_FRAMES are going to be exported.""" pass class CkgProj: """Defines a checkergen project, with checkerboards and other settings.""" DEFAULTS = {'name': 'untitled', 'fps': 60, 'res': (800, 600), 'bg': (127, 127, 127), 'export_fmt': 'png', 'pre': 0, 'post': 0, 'cross_cols': ((0, 0, 0), (255, 0, 0)), 'cross_times': ('Infinity', 1)} def __init__(self, **keywords): """Initializes a new project, or loads it from a path. path -- if specified, ignore other arguments and load project from path name -- name of the project, always the same as the filename without the extension fps -- frames per second of the animation to be displayed res -- screen resolution / window size at which project will be displayed bg -- background color of the animation as a 3-tuple (R, G, B) export_fmt -- image format for animation to be exported as pre -- time in seconds a blank screen will be shown before any display groups post --time in seconds a blank screen will be shown after any display groups """ if 'path' in keywords.keys(): self.load(keywords['path']) return for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.groups = [] def __setattr__(self, name, value): # Type conversions if name == 'name': value = str(value) elif name in ['fps', 'pre', 'post']: value = to_decimal(value) elif name == 'res': if len(value) != 2: raise ValueError value = tuple([int(v) for v in value]) elif name == 'bg': if len(value) != 3: raise ValueError value = tuple([int(v) for v in value]) elif name == 'export_fmt': if value not in EXPORT_FMTS: msg = 'image format not recognized or supported' raise FileFormatError(msg) elif name == 'cross_cols': if len(value) != 2: raise ValueError for col in value: if len(col) != 3: raise ValueError value = tuple([tuple([int(c) for c in col]) for col in value]) elif name == 'cross_times': if len(value) != 2: raise ValueError value = tuple([to_decimal(x) for x in value]) # Store value self.__dict__[name] = value # Set dirty bit if name != '_dirty': self._dirty = True def add_group(self, group): """Append group to list and set dirty bit.""" self.groups.append(group) self._dirty = True return self.groups.index(group) def del_group(self, group): """Remove group to list and set dirty bit.""" self.groups.remove(group) self._dirty = True def add_shape_to_group(self, group, shape): """Add shape to group specified by id and set dirty bit.""" if group not in self.groups: raise ValueError group.shapes.append(shape) self._dirty = True return group.shapes.index(shape) def del_shape_from_group(self, group, shape): """Removes shape from group specified by id and set dirty bit.""" if group not in self.groups: raise ValueError group.shapes.remove(shape) self._dirty = True def set_group_attr(self, gid, name, value): """Set attribute of a group specified by id and set dirty bit.""" setattr(self.groups[gid], name, value) self._dirty = True def set_shape_attr(self, group, sid, name, value): """Set attribute of a shape specified by id and set dirty bit.""" if group not in self.groups: raise ValueError setattr(group.shapes[sid], name, value) self._dirty = True def is_dirty(self): return self._dirty def load(self, path): """Loads project from specified path.""" # Get project name from filename name, ext = os.path.splitext(os.path.basename(path)) if ext == '.{0}'.format(CKG_FMT): self.name = name else: msg = "path lacks '.{0}' extension".format(CKG_FMT) raise FileFormatError(msg) with open(path, 'r') as project_file: doc = minidom.parse(project_file) project = doc.documentElement vars_to_load = self.__class__.DEFAULTS.keys() # Name is not stored in project file vars_to_load.remove('name') for var in vars_to_load: try: value = eval(xml_get(project, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) self.groups = [] group_els = [node for node in project.childNodes if node.localName == 'group' and node.namespaceURI == XML_NAMESPACE] for group_el in group_els: new_group = CkgDisplayGroup() new_group.load(group_el) self.groups.append(new_group) self._dirty = False def save(self, path): """Saves project to specified path as an XML document.""" self.name, ext = os.path.splitext(os.path.basename(path)) if ext != '.{0}'.format(CKG_FMT): path = '{0}.{1}'.format(path, CKG_FMT) impl = minidom.getDOMImplementation() doc = impl.createDocument(XML_NAMESPACE, 'project', None) project = doc.documentElement # Hack below because minidom doesn't support namespaces properly project.setAttribute('xmlns', XML_NAMESPACE) vars_to_save = self.__class__.DEFAULTS.keys() # Name is not stored in project file vars_to_save.remove('name') for var in vars_to_save: xml_set(doc, project, var, repr(getattr(self, var))) for group in self.groups: group.save(doc, project) with open(path, 'w') as project_file: project_file.write(xml_pretty_print(doc,indent=' ')) self._dirty = False return path + def blockgen(self, length, path=None, folder=True, **flags): + """Generates randomized experimental blocks from display groups. + Each block is saved as a CSV file. + + length -- number of repeated trials within a block + + path -- directory in which experimental blocks will be saved + + folder -- blocks will be saved in a containing folder if true + + flags -- flags to be issued to the display command when block file + is run + + """ + + if path == None: + path = os.getcwd() + + for order in itertools.permutations(range(len(self.groups))): + pass + def display(self, fullscreen=False, logtime=False, logdur=False, sigser=False, sigpar=False, phototest=False, eyetrack=False, etuser=False, etvideo=None, group_queue=[]): """Displays the project animation on the screen. fullscreen -- animation is displayed fullscreen if true, stretched to fit if necessary logtime -- timestamp of each frame is saved to a logfile if true logdur -- duration of each frame is saved to a logfile if true sigser -- send signals through serial port when each group is shown sigpar -- send signals through parallel port when each group is shown phototest -- draw white rectangle in topleft corner when each group is shown for photodiode to detect eyetrack -- use eyetracking to ensure subject is fixating on cross etuser -- if true, user gets to select eyetracking video source in GUI etvideo -- optional eyetracking video source file to use instead of live feed group_queue -- queue of groups to be displayed, defaults to order of groups in project (i.e. groups[0] first, etc.) """ # Create fixation crosses fix_crosses = [graphics.Cross([r/2 for r in self.res], (20, 20), col = cross_col) for cross_col in self.cross_cols] # Create test rectangle if phototest: test_rect = graphics.Rect((0, self.res[1]), [r/8 for r in self.res], anchor='topleft') # Set-up groups and variables that control their display if group_queue == []: group_queue = list(self.groups) cur_group = None cur_id = -1 flipped = 0 flip_id = -1 groups_duration = sum([group.duration() for group in group_queue]) groups_start = self.pre * self.fps groups_stop = (self.pre + groups_duration) * self.fps disp_end = (self.pre + groups_duration + self.post) * self.fps if groups_start == 0 and groups_stop > 0: groups_visible = True else: groups_visible = False count = 0 # Initialize ports if sigser: if not signals.available['serial']: msg = 'serial port functionality not available' raise NotImplementedError(msg) if sigpar: if not signals.available['parallel']: msg = 'parallel port functionality not available' raise NotImplementedError(msg) signals.init(sigser, sigpar) # Initialize eyetracking if eyetrack: if not eyetracking.available: msg = 'eyetracking functionality not available' raise NotImplementedError(msg) fixating = False old_fixating = False eyetracking.select_source(etuser, etvideo) eyetracking.start() # Stretch to fit screen only if project res does not equal screen res scaling = False if fullscreen: window = pyglet.window.Window(fullscreen=True, visible=False) if (window.width, window.height) != self.res: scaling = True else: window = pyglet.window.Window(*self.res, visible=False) # Set up KeyStateHandler to handle keyboard input keystates = pyglet.window.key.KeyStateHandler() window.push_handlers(keystates) # Create framebuffer object for drawing unscaled scene if scaling: canvas = pyglet.image.Texture.create(*self.res) fbo = graphics.Framebuffer(canvas) fbo.start_render() graphics.set_clear_color(self.bg) fbo.clear() fbo.end_render() # Clear window and make visible window.switch_to() graphics.set_clear_color(self.bg) window.clear() window.set_visible() # Initialize logging variables if logtime and logdur: logstring = '' stamp = Timer() dur = Timer() stamp.start() dur.start() elif logtime or logdur: logstring = '' timer = Timer() timer.start() # Main loop while not window.has_exit and count < disp_end: # Clear canvas if scaling: fbo.start_render() fbo.clear() else: window.clear() # Assume no change to group visibility flipped = 0 # Manage groups when they are on_screen if groups_visible: # Send special signal if waitscreen ends if isinstance(cur_group, CkgWaitScreen): if cur_group.over: signals.set_user_start() cur_group = None elif cur_group != None: # Check whether group changes in visibility if cur_group.visible != cur_group.old_visible: flip_id = self.groups.index(cur_group) if cur_group.visible: flipped = 1 elif cur_group.old_visible: flipped = -1 # Check if current group is over if cur_group.over: cur_group = None # Get next group from queue if cur_group == None: cur_id += 1 if cur_id >= len(group_queue): groups_visible = False else: cur_group = group_queue[cur_id] cur_group.reset() if not isinstance(cur_group, CkgWaitScreen): if cur_group.visible: flip_id = self.groups.index(cur_group) flipped = 1 # Draw and then update group if cur_group != None: cur_group.draw() cur_group.update(fps=self.fps, keystates=keystates) # Send signals upon group visibility change if flipped == 1: signals.set_group_start(flip_id) # Draw test rectangle if phototest: test_rect.draw() elif flipped == -1: signals.set_group_stop(flip_id) else: signals.set_null() # Draw normal cross color if fixating, other color if not if eyetrack: old_fixating = fixating fixating = eyetracking.fixating(FIX_POS, FIX_RANGE) if fixating: fix_crosses[0].draw() if not old_fixating: signals.set_fix_start() else: fix_crosses[1].draw() if old_fixating: signals.set_fix_stop() # Change cross color based on time if eyetracking is not enabled elif (count % (sum(self.cross_times) * self.fps) < self.cross_times[0] * self.fps): fix_crosses[0].draw() else: fix_crosses[1].draw() # Increment count and set whether groups should be shown if not isinstance(cur_group, CkgWaitScreen): count += 1 if groups_start <= count < groups_stop: groups_visible = True else: groups_visible = False # Blit canvas to screen if necessary if scaling: fbo.end_render() window.switch_to() canvas.blit(0, 0) window.dispatch_events() window.flip() # Make sure everything has been drawn pyglet.gl.glFinish() # Append time information to log string if logtime and logdur: logstring = '\n'.join([logstring, str(stamp.elapsed())]) logstring = '\t'.join([logstring, str(dur.restart())]) elif logtime: logstring = '\n'.join([logstring, str(timer.elapsed())]) elif logdur: logstring = '\n'.join([logstring, str(timer.restart())]) # Send signals ASAP after flip signals.send(sigser, sigpar) # Log when signals are sent if logtime or logdur: if flipped != 0 and (sigser or sigpar): sigmsg = '{0} sent'.format(signals.STATE) logstring = '\t'.join([logstring, sigmsg]) # Clean up if eyetrack: eyetracking.stop() window.close() if scaling: fbo.delete() del canvas signals.quit(sigser, sigpar) # Write log string to file if logtime or logdur: filename = '{0}.log'.format(self.name) with open(filename, 'w') as logfile: logfile.write(logstring) def export(self, export_dir, export_duration, group_queue=[], export_fmt=None, folder=True, force=False): if not os.path.isdir(export_dir): msg = 'export path is not a directory' raise IOError(msg) if export_fmt == None: export_fmt = self.export_fmt # Set-up groups and variables that control their display if group_queue == []: group_queue = list(self.groups) cur_group = None cur_id = -1 groups_duration = sum([group.duration() for group in group_queue]) groups_start = self.pre * self.fps groups_stop = (self.pre + groups_duration) * self.fps disp_end = (self.pre + groups_duration + self.post) * self.fps if groups_start == 0 and groups_stop > 0: groups_visible = True else: groups_visible = False count = 0 # Limit export duration to display duration frames = export_duration * self.fps frames = min(frames, disp_end) # Warn user if a lot of frames will be exported if frames > MAX_EXPORT_FRAMES and not force: msg = 'very large number ({0}) of frames to be exported'.\ format(frames) raise FrameOverflowError(msg) # Create folder to store images if necessary if folder: export_dir = os.path.join(export_dir, self.name) if not os.path.isdir(export_dir): os.mkdir(export_dir) # Create fixation crosses fix_crosses = [graphics.Cross([r/2 for r in self.res], (20, 20), col = cross_col) for cross_col in self.cross_cols] # Set up canvas and framebuffer object canvas = pyglet.image.Texture.create(*self.res) fbo = graphics.Framebuffer(canvas) fbo.start_render() graphics.set_clear_color(self.bg) fbo.clear() # Main loop while count < frames: fbo.clear() if groups_visible: # Check if current group is over if cur_group != None: if cur_group.over: cur_group = None # Get next group from queue if cur_group == None: cur_id += 1 if cur_id >= len(group_queue): groups_visible = False else: cur_group = group_queue[cur_id] cur_group.reset() # Draw and then update group if cur_group != None: cur_group.draw() cur_group.update(fps=self.fps) # Draw fixation cross based on current count if (count % (sum(self.cross_times) * self.fps) < self.cross_times[0] * self.fps): fix_crosses[0].draw() else: fix_crosses[1].draw() # Save current frame to file savepath = \ os.path.join(export_dir, '{0}{2}.{1}'. format(self.name, export_fmt, repr(count).zfill(numdigits(frames-1)))) canvas.save(savepath) # Increment count and set whether groups should be shown count += 1 if groups_start <= count < groups_stop: groups_visible = True else: groups_visible = False fbo.delete() class CkgDisplayGroup: DEFAULTS = {'pre': 0, 'disp': 'Infinity', 'post': 0} def __init__(self, **keywords): """Create a new group of shapes to be displayed together. pre -- time in seconds a blank screen is shown before shapes in group are displayed disp -- time in seconds the shapes in the group are displayed, negative numbers result in shapes being displayed forever post -- time in seconds a blank screen is shown after shapes in group are displayed """ for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.shapes = [] self.reset() def __setattr__(self, name, value): if name in self.__class__.DEFAULTS: value = to_decimal(value) self.__dict__[name] = value def duration(self): """Returns total duration of display group.""" return self.pre + self.disp + self.post def reset(self): """Resets internal count and all contained shapes.""" self._count = 0 self._start = self.pre self._stop = self.pre + self.disp self._end = self.pre + self.disp + self.post self.over = False self.old_visible = False if self._start == 0 and self._stop > 0: self.visible = True else: self.visible = False if self._end == 0: self.over = True for shape in self.shapes: shape.reset() def draw(self, lazy=False): """Draws all contained shapes during the appropriate interval.""" if self.visible: for shape in self.shapes: if lazy: shape.lazydraw() else: shape.draw() def update(self, **keywords): """Increments internal count, makes group visible when appropriate.""" fps = keywords['fps'] if self.visible: # Set triggers to be sent for n, shape in enumerate(self.shapes): if shape.flipped: signals.set_board_flip(n) # Update contained shapes for shape in self.shapes: shape.update(fps) # Increment count and set flags for the next frame self._count += 1 self.old_visible = self.visible if (self._start * fps) <= self._count < (self._stop * fps): self.visible = True else: self.visible = False if self._count >= (self._end * fps): self.over = True else: self.over = False def save(self, document, parent): """Saves group in specified XML document as child of parent.""" group_el = document.createElement('group') parent.appendChild(group_el) for var in self.__class__.DEFAULTS.keys(): xml_set(document, group_el, var, repr(getattr(self, var))) for shape in self.shapes: shape.save(document, group_el) def load(self, element): """Loads group from XML DOM element.""" for var in self.__class__.DEFAULTS.keys(): try: value = eval(xml_get(element, XML_NAMESPACE, var)) except IndexError: print "warning: missing attribute '{0}'".format(var) value = self.__class__.DEFAULTS[var] print "using default value '{0}' instead...".format(value) setattr(self, var, value) shape_els = [node for node in element.childNodes if node.localName == 'shape' and node.namespaceURI == XML_NAMESPACE] for shape_el in shape_els: # TODO: Make load code shape-agnostic new_shape = CheckerBoard() new_shape.load(shape_el) self.shapes.append(new_shape) class CkgWaitScreen(CkgDisplayGroup): """Dummy display group, waits for user input to proceed.""" DEFAULTS = {'g_keys': (pyglet.window.key.SPACE,), 'r_keys': (pyglet.window.key.NUM_ENTER, pyglet.window.key.ENTER), 'res': CkgProj.DEFAULTS['res'], 'g_info': "the experiment will start soon", 'r_info': "press enter when ready", 'font_color': (0, 0, 0, 255), 'font_size': 16} def __init__(self, **keywords): """Create an informative waitscreen that proceeds after user input.""" for kw in self.__class__.DEFAULTS.keys(): if kw in keywords.keys(): setattr(self, kw, keywords[kw]) else: setattr(self, kw, self.__class__.DEFAULTS[kw]) self.g_label = pyglet.text.Label(self.g_info, font_name=SANS_SERIF, font_size=self.font_size, color=self.font_color, bold=True, x=self.res[0]//2, y=self.res[1]//8, anchor_x='center', anchor_y='center') self.r_label = pyglet.text.Label(self.r_info, font_name=SANS_SERIF, font_size=self.font_size, color=self.font_color, bold=True, x=self.res[0]//2, y=self.res[1]//8, anchor_x='center', anchor_y='center') self.reset() def __setattr__(self, name, value): self.__dict__[name] = value def duration(self): """Returns zero since wait times are arbitrary.""" return to_decimal(0) def reset(self): """Resets some flags.""" self.ready = False self.over = False def draw(self): """Draw informative text.""" if not self.ready: self.r_label.draw()
ztangent/checkergen
d6366c703fae96475cb06f095a5cc6c2a5e2f7e4
cleaned up calibration check in do_display
diff --git a/src/cli.py b/src/cli.py index c94615a..b5510b2 100644 --- a/src/cli.py +++ b/src/cli.py @@ -324,674 +324,673 @@ class CkgCmd(cmd.Cmd): if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.edgrp_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.edgrp_parser.print_usage() return # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist[:]: if x >= len(self.cur_proj.groups) or x < 0: args.idlist.remove(x) print "checkerboard", x, "does not exist" if args.idlist == []: return names = public_dir(args) names.remove('idlist') noflags = True for name in names: val = getattr(args, name) if val != None: for x in args.idlist: self.cur_proj.set_group_attr(x, name, val) noflags = False if noflags: print "no options specified, please specify at least one" self.__class__.edgrp_parser.print_usage() rmgrp_parser = CmdParser(add_help=False, prog='rmgrp', description='''Removes display groups specified by ids.''') rmgrp_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='ids of display groups to be removed') rmgrp_parser.add_argument('-a', '--all', action='store_true', help='remove all groups from the project') def help_rmgrp(self): self.__class__.rmgrp_parser.print_help() def do_rmgrp(self, line): """Removes display groups specified by ids""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups to remove' return try: args = self.__class__.rmgrp_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.rmgrp_parser.print_usage() return rmlist = [] if args.all: for group in self.cur_proj.groups[:]: self.cur_proj.del_group(group) print "all display groups removed" return elif len(args.idlist) == 0: print "please specify at least one id" # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist: if x >= len(self.cur_proj.groups) or x < 0: print "display group", x, "does not exist" continue rmlist.append(self.cur_proj.groups[x]) print "display group", x, "removed" for group in rmlist: self.cur_proj.del_group(group) # Remember to point self.cur_group somewhere sane if self.cur_group not in self.cur_proj.groups: if len(self.cur_proj.groups) == 0: self.cur_group = None else: self.cur_group = self.cur_proj.groups[0] print "group 0 is now the current display group" chgrp_parser = CmdParser(add_help=False, prog='chgrp', description='''Changes display group that is currently active for editing. Prints current group id if no group id is specified''') chgrp_parser.add_argument('gid', metavar='id', type=int, nargs='?', help='id of display group to be made active') def help_chgrp(self): self.__class__.chgrp_parser.print_help() def do_chgrp(self, line): """Changes group that is currently active for editing.""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups that can be made active' return try: args = self.__class__.chgrp_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.chgrp_parser.print_usage() return if args.gid == None: print "group",\ self.cur_proj.groups.index(self.cur_group),\ "is the current display group" elif args.gid >= len(self.cur_proj.groups) or args.gid < 0: print "group", args.gid, "does not exist" else: self.cur_group = self.cur_proj.groups[args.gid] print "group", args.gid, "is now the current display group" mk_parser = CmdParser(add_help=False, prog='mk', description='''Makes a new checkerboard in the current group with the given parameters.''') mk_parser.add_argument('dims', action=store_tuple(2, ',', to_decimal), help='''width,height of checkerboard in no. of unit cells''') mk_parser.add_argument('init_unit', action=store_tuple(2, ',', to_decimal), help='width,height of initial unit cell in pixels') mk_parser.add_argument('end_unit', action=store_tuple(2, ',', to_decimal), help='width,height of final unit cell in pixels') mk_parser.add_argument('position', action=store_tuple(2, ',', to_decimal), help='x,y position of checkerboard in pixels') mk_parser.add_argument('anchor', choices=sorted(locations.keys()), help='''location of anchor point of checkerboard (choices: %(choices)s)''', metavar='anchor') mk_parser.add_argument('cols', action=store_tuple(2, ',', to_color, [';']), help='''color1,color2 of the checkerboard (color format: R;G;B, component range from 0-255)''') mk_parser.add_argument('freq', type=to_decimal, help='frequency of color reversal in Hz') mk_parser.add_argument('phase', type=to_decimal, nargs='?', default='0', help='initial phase of animation in degrees') def help_mk(self): self.__class__.mk_parser.print_help() def do_mk(self, line): """Makes a checkerboard with the given parameters.""" if self.cur_proj == None: print 'no project open, automatically creating project...' self.do_new('') if self.cur_group == None: print 'automatically adding display group...' self.do_mkgrp('') try: args = self.__class__.mk_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.mk_parser.print_usage() return shape_dict = dict([(name, getattr(args, name)) for name in public_dir(args)]) new_shape = core.CheckerBoard(**shape_dict) new_id = self.cur_proj.add_shape_to_group(self.cur_group, new_shape) print "checkerboard", new_id, "added" ed_parser = CmdParser(add_help=False, prog='ed', description='''Edits attributes of checkerboards specified by ids.''') ed_parser.add_argument('idlist', nargs='+', metavar='id', type=int, help='''ids of checkerboards in the current group to be edited''') ed_parser.add_argument('--dims', action=store_tuple(2, ',', to_decimal), help='checkerboard dimensions in unit cells', metavar='WIDTH,HEIGHT') ed_parser.add_argument('--init_unit', action=store_tuple(2, ',', to_decimal), help='initial unit cell dimensions in pixels', metavar='WIDTH,HEIGHT') ed_parser.add_argument('--end_unit', action=store_tuple(2, ',', to_decimal), help='final unit cell dimensions in pixels', metavar='WIDTH,HEIGHT') ed_parser.add_argument('--position', action=store_tuple(2, ',', to_decimal), help='position of checkerboard in pixels', metavar='X,Y') ed_parser.add_argument('--anchor', choices=sorted(locations.keys()), help='''location of anchor point of checkerboard (choices: %(choices)s)''', metavar='LOCATION') ed_parser.add_argument('--cols', metavar='COLOR1,COLOR2', action=store_tuple(2, ',', to_color, [';']), help='''checkerboard colors (color format: R;G;B, component range from 0-255)''') ed_parser.add_argument('--freq', type=to_decimal, help='frequency of color reversal in Hz') ed_parser.add_argument('--phase', type=to_decimal, help='initial phase of animation in degrees') def help_ed(self): self.__class__.ed_parser.print_help() def do_ed(self, line): """Edits attributes of checkerboards specified by ids.""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups, please create one first' return try: args = self.__class__.ed_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.ed_parser.print_usage() return # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist[:]: if x >= len(self.cur_group.shapes) or x < 0: args.idlist.remove(x) print "checkerboard", x, "does not exist" if args.idlist == []: return names = public_dir(args) names.remove('idlist') noflags = True for name in names: val = getattr(args, name) if val != None: for x in args.idlist: self.cur_proj.set_shape_attr(self.cur_group, x, name, val) noflags = False if noflags: print "no options specified, please specify at least one" self.__class__.ed_parser.print_usage() rm_parser = CmdParser(add_help=False, prog='rm', description='''Removes checkerboards specified by ids.''') rm_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''ids of checkerboards in the current group to be removed''') rm_parser.add_argument('-a', '--all', action='store_true', help='''remove all checkerboards in the current group''') def help_rm(self): self.__class__.rm_parser.print_help() def do_rm(self, line): """Removes checkerboards specified by ids""" if self.cur_proj == None: print 'please create or open a project first' return elif self.cur_group == None: print 'current project has no groups, no boards to remove' return try: args = self.__class__.rm_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.rm_parser.print_usage() return rmlist = [] if args.all: for shape in self.cur_group.shapes: self.cur_proj.del_shape_from_group(self.cur_group, shape) print "all checkerboards removed" return elif len(args.idlist) == 0: print "please specify at least one id" # Remove duplicates and ascending sort args.idlist = sorted(set(args.idlist)) for x in args.idlist: if x >= len(self.cur_group.shapes) or x < 0: print "checkerboard", x, "does not exist" continue rmlist.append(self.cur_group.shapes[x]) print "checkerboard", x, "removed" for shape in rmlist: self.cur_proj.del_shape_from_group(self.cur_group, shape) ls_parser = CmdParser(add_help=False, prog='ls', description='''Lists project, display group and checkerboard settings. If no group ids are specified, all display groups are listed.''') ls_parser.add_argument('gidlist', nargs='*', metavar='gid', type=int, help='''ids of the display groups to be listed''') ls_group = ls_parser.add_mutually_exclusive_group() ls_group.add_argument('-s', '--settings', action='store_true', help='list only project settings') ls_group.add_argument('-g', '--groups', action='store_true', help='list only display groups') def help_ls(self): self.__class__.ls_parser.print_help() def do_ls(self, line): """Lists project, display group and checkerboard settings.""" def ls_str(s, seps=[',',';']): """Special space-saving output formatter.""" if type(s) in [tuple, list]: if len(seps) > 1: newseps = seps[1:] else: newseps = seps return seps[0].join([ls_str(i, newseps) for i in s]) else: return str(s) if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.ls_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.ls_parser.print_usage() return # Remove duplicates and ascending sort args.gidlist = sorted(set(args.gidlist)) if len(self.cur_proj.groups) == 0: if len(args.gidlist) > 0: print 'this project has no display groups that can be listed' args.settings = True else: for gid in args.gidlist[:]: if gid >= len(self.cur_proj.groups) or gid < 0: args.gidlist.remove(gid) print 'display group', gid, 'does not exist' if args.gidlist == []: args.gidlist = range(len(self.cur_proj.groups)) else: # If any (valid) groups are specified # don't show project settings args.groups = True if not args.groups: print 'PROJECT SETTINGS'.center(70,'*') print \ 'name'.rjust(16),\ 'fps'.rjust(7),\ 'resolution'.rjust(14),\ 'bg color'.rjust(18) # 'format'.rjust(7) print \ ls_str(self.cur_proj.name).rjust(16),\ ls_str(self.cur_proj.fps).rjust(7),\ ls_str(self.cur_proj.res).rjust(14),\ ls_str(self.cur_proj.bg).rjust(18) # ls_str(self.cur_proj.export_fmt).rjust(7) print \ 'pre-display'.rjust(26),\ 'post-display'.rjust(26) print \ ls_str(self.cur_proj.pre).rjust(26),\ ls_str(self.cur_proj.post).rjust(26) print \ 'cross colors'.rjust(26),\ 'cross times'.rjust(26) print \ ls_str(self.cur_proj.cross_cols).rjust(26),\ ls_str(self.cur_proj.cross_times).rjust(26) if not args.settings and not args.groups: # Insert empty line if both groups and project # settings are listed print '' if not args.settings: for i, n in enumerate(args.gidlist): if i != 0: # Print newline seperator between each group print '' group = self.cur_proj.groups[n] print 'GROUP {n}'.format(n=n).center(70,'*') print \ 'pre-display'.rjust(20),\ 'display'.rjust(20),\ 'post-display'.rjust(20) print \ ls_str(group.pre).rjust(20),\ ls_str(group.disp).rjust(20),\ ls_str(group.post).rjust(20) if len(group.shapes) > 0: print \ ''.rjust(2),\ 'shape id'.rjust(8),\ 'dims'.rjust(10),\ 'init_unit'.rjust(14),\ 'end_unit'.rjust(14),\ 'position'.rjust(14) for m, shape in enumerate(group.shapes): print \ ''.rjust(2),\ ls_str(m).rjust(8),\ ls_str(shape.dims).rjust(10),\ ls_str(shape.init_unit).rjust(14),\ ls_str(shape.end_unit).rjust(14),\ ls_str(shape.position).rjust(14) print '\n',\ ''.rjust(2),\ 'shape id'.rjust(8),\ 'colors'.rjust(27),\ 'anchor'.rjust(12),\ 'freq'.rjust(6),\ 'phase'.rjust(7) for m, shape in enumerate(group.shapes): print \ ''.rjust(2),\ ls_str(m).rjust(8),\ ls_str(shape.cols).rjust(27),\ ls_str(shape.anchor).rjust(12),\ ls_str(shape.freq).rjust(6),\ ls_str(shape.phase).rjust(7) display_parser = CmdParser(add_help=False, prog='display', description='''Displays the animation in a window or in fullscreen.''') display_parser.add_argument('-f', '--fullscreen', action='store_true', help='sets fullscreen mode, ESC to quit') display_parser.add_argument('-p', '--priority', metavar='LEVEL', help='''set priority while displaying, higher priority results in less dropped frames (choices: 0-3, low, normal, high, realtime)''') display_parser.add_argument('-r', '--repeat', metavar='N', type=int, help='''repeatedly display specified display groups N number of times''') display_parser.add_argument('-pt', '--phototest', action='store_true', help='''draw white test rectangle in topleft corner of screen when groups become visible for a photodiode to detect''') display_parser.add_argument('-lt', '--logtime', action='store_true', help='output frame timestamps to a log file') display_parser.add_argument('-ld', '--logdur', action='store_true', help='output frame durations to a log file') display_parser.add_argument('-ss', '--sigser', action='store_true', help='''send signals through the serial port when shapes are being displayed''') display_parser.add_argument('-sp', '--sigpar', action='store_true', help='''send signals through the parallel port when shapes are being displayed''') display_parser.add_argument('-et', '--eyetrack', action='store_true', help='''use eyetracking to ensure that subject fixates on the cross in the center''') display_parser.add_argument('-eu', '--etuser', action='store_true', help='''allow user to select eyetracking video source from a dialog''') display_parser.add_argument('-ev', '--etvideo', metavar='path', help='''path (with no spaces) to eyetracking video file to be used as the source''') display_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''list of display groups to be displayed in the specified order (default: order by id, i.e. group 0 is first)''') def help_display(self): self.__class__.display_parser.print_help() def do_display(self, line): """Displays the animation in a window or in fullscreen""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.display_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.display_parser.print_usage() return group_queue = [] if len(args.idlist) > 0: for i in set(args.idlist): if i >= len(self.cur_proj.groups) or i < -1: print 'error: group', i, 'does not exist' return for i in args.idlist: if i == -1: group_queue.append(core.CkgWaitScreen()) else: group_queue.append(self.cur_proj.groups[i]) else: group_queue = list(self.cur_proj.groups) if args.repeat != None: group_queue = list(group_queue * args.repeat) if args.priority != None: if not priority.available: print "error: setting priority not avaible on", sys.platform print "continuing..." else: if args.priority.isdigit(): args.priority = int(args.priority) try: priority.set(args.priority) except ValueError: print "error:", str(sys.exc_value) print "continuing..." if args.eyetrack and eyetracking.available: if not eyetracking.is_calibrated(): - print "subject not yet calibrated, please calibrate first" - print "path to calibration file (leave empty for GUI tool):" - calpath = raw_input().strip().strip('"\'') - if len(calpath) == 0: - calpath = None - if eyetracking.VET.VideoSourceType == 0: - # Select default source if none has been selected - eyetracking.select_source() try: - eyetracking.calibrate(calpath) + self.do_calibrate('',True) except eyetracking.EyetrackingError: print "error:", str(sys.exc_value) return if len(path) > 0: print "calibration file successfully loaded" try: self.cur_proj.display(fullscreen=args.fullscreen, logtime=args.logtime, logdur=args.logdur, sigser=args.sigser, sigpar=args.sigpar, phototest=args.phototest, eyetrack=args.eyetrack, etuser=args.etuser, etvideo=args.etvideo, group_queue=group_queue) except (IOError, NotImplementedError, eyetracking.EyetrackingError): print "error:", str(sys.exc_value) return if args.priority != None: try: priority.set('normal') except: pass export_parser = CmdParser(add_help=False, prog='export', description='''Exports animation as an image sequence (in a folder) to the specified directory.''') # export_parser.add_argument('--fmt', dest='export_fmt', # choices=core.EXPORT_FMTS, # help='image format for export') export_parser.add_argument('-n','--nofolder', dest='folder', action='store_false', help='''force images not to exported in a containing folder''') export_parser.add_argument('-r', '--repeat', metavar='N', type=int, help='''repeatedly export specified display groups N number of times''') export_parser.add_argument('duration', nargs='?', type=to_decimal, default='Infinity', help='''number of seconds of the animation that should be exported (default: as long as the entire animation)''') export_parser.add_argument('dir', nargs='?', default=os.getcwd(), help='''destination directory for export (default: current working directory)''') export_parser.add_argument('idlist', nargs='*', metavar='id', type=int, help='''list of display groups to be exported in the specified order (default: order by id, i.e. group 0 is first)''') def help_export(self): self.__class__.export_parser.print_help() def do_export(self, line): """Exports animation an image sequence to the specified directory.""" if self.cur_proj == None: print 'please create or open a project first' return try: args = self.__class__.export_parser.parse_args(shlex.split(line)) except CmdParserError: print "error:", str(sys.exc_value) self.__class__.export_parser.print_usage() return if len(args.idlist) > 0: for i in set(args.idlist): if i >= len(self.cur_proj.groups) or i < 0: print 'error: group', i, 'does not exist' return group_queue = [self.cur_proj.groups[i] for i in args.idlist] else: group_queue = list(self.cur_proj.groups) if args.repeat != None: group_queue = list(group_queue * args.repeat) try: self.cur_proj.export(export_dir=args.dir, export_duration=args.duration, group_queue=group_queue, folder=args.folder) except IOError: print "error:", str(sys.exc_value) return except core.FrameOverflowError: print "warning:", str(sys.exc_value) print "Are you sure you want to continue?" while True: try: if self.__class__.yn_parse(raw_input()): self.cur_proj.export(export_dir=args.dir, export_duration=args.duration, group_queue=group_queue, export_fmt=None, folder=args.folder, force=True) break else: return except TypeError: print str(sys.exc_value) except EOFError: return print "Export done." - def do_calibrate(self, line): + def do_calibrate(self, line, query=False): """Calibrate subject for eyetracking, or load a calibration file.""" if not eyetracking.available: print "error: eyetracking functionality not available" return - path = line.strip().strip('"\'') + if query: + print "path to calibration file (leave empty for GUI tool):" + path = raw_input().strip().strip('"\'') + else: + path = line.strip().strip('"\'') if len(path) == 0: path = None if eyetracking.VET.VideoSourceType == 0: # Select default source if none has been selected eyetracking.select_source() try: eyetracking.calibrate(path) except eyetracking.EyetrackingError: - print "error:", str(sys.exc_value) - return + if query: + raise + else: + print "error:", str(sys.exc_value) + return if len(path) > 0: print "calibration file successfully loaded" def do_quit(self, line): """Quits the program.""" if self.save_check(): return return True def do_EOF(self, line): """Typing Ctrl-D issues this command, which quits the program.""" print '\r' if self.save_check(): return return True def help_help(self): print 'Prints a list of commands.' print "Type 'help <topic>' for more details on each command." def default(self, line): command = line.split()[0] print \ "'{0}' is not a checkergen command.".format(command),\ "Type 'help' for a list of commands"
ztangent/checkergen
08b3e50081a93e9c1ce75ad05b707aae614c1c4e
display checks for calibration status and prompts for file before running
diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..3ab449c --- /dev/null +++ b/README.txt @@ -0,0 +1,26 @@ +Checkergen is a simple program which generates flashing checkerboard +patterns for use in psychophysics experiments. A CLI is provided for +quick setting of parameters, and output either to screen or file is +provided. + +Requirements: +Python 2.7 or Python 2.6 + argparse module +pyglet (version >= 1.1.4 recommended) +pySerial if you want to send trigger signals via a serial port +pyParallel if you want to send trigger signals via a parallel port +(see pyParallel webpage for other requirements) +pywin32 if you want to increase process priority on Windows + +Checkergen is free open-source software. You can redistribute and +modify it under the terms of the GNU General Public License Version 3+ +as published by the Free Software Foundation. + +Checkergen is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. A copy of it +should have been distributed with Checkergen. If not, see +http://www.gnu.org/licenses/. + +Copyright (C) 2010-2011 Tan Zong Xuan \ No newline at end of file diff --git a/checkergen.py b/checkergen.py new file mode 100755 index 0000000..81692cf --- /dev/null +++ b/checkergen.py @@ -0,0 +1,45 @@ +#! /usr/bin/env python + +""" +usage: checkergen.py [-h] [-c] [-d] [-e DUR] [-f] [--dir PATH] [project] + +Generate flashing checkerboard patterns for display or export as a series of +images, intended for use in psychophysics experiments. Enters interactive +command line mode if no options are specified. + +positional arguments: + project checkergen project file to open + +optional arguments: + -h, --help show this help message and exit + -c, --cmd enter command line mode regardless of other options + -d, --display displays the animation on the screen + -e DUR, --export DUR export DUR seconds of the project animation + -f, --fullscreen animation displayed in fullscreen mode + --dir PATH destination directory for export (default: current + working directory) +""" + +import sys +sys.path.append('src') +import core +import cli + +args = cli.PARSER.parse_args() +msg = cli.process_args(args) + +if msg != None: + print msg + +if args.export_flag: + args.proj.export(export_dir=args.export_dir, + export_duration=args.export_dur) +if args.display_flag: + args.proj.display(fullscreen=args.fullscreen) +if args.cmd_mode: + mycmd = cli.CkgCmd() + mycmd.intro = cli.CMD_INTRO + mycmd.prompt = cli.CMD_PROMPT + mycmd.cur_proj = args.proj + mycmd.cur_group = args.group + mycmd.cmdloop() diff --git a/doc/LICENSE.txt b/doc/LICENSE.txt new file mode 100644 index 0000000..7a50071 --- /dev/null +++ b/doc/LICENSE.txt @@ -0,0 +1,458 @@ +Copyright (C) 2011 Tan Zong Xuan. + +Permission is granted to copy, distribute and/or modify all checkergen +documentation under the terms of the GNU Free Documentation License, +Version 1.3 or any later version published by the Free Software +Foundation; with no Invariant Sections, no Front-Cover Texts, and no +Back-Cover Texts. A copy of the license is included below + + GNU Free Documentation License + Version 1.3, 3 November 2008 + + + Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. + <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +0. PREAMBLE + +The purpose of this License is to make a manual, textbook, or other +functional and useful document "free" in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. + +This License is a kind of "copyleft", which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + + +1. APPLICABILITY AND DEFINITIONS + +This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The "Document", below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as "you". You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. + +A "Modified Version" of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A "Secondary Section" is a named appendix or a front-matter section of +the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall +subject (or to related matters) and contains nothing that could fall +directly within that overall subject. (Thus, if the Document is in +part a textbook of mathematics, a Secondary Section may not explain +any mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The "Invariant Sections" are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. + +The "Cover Texts" are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. + +A "Transparent" copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not "Transparent" is called "Opaque". + +Examples of suitable formats for Transparent copies include plain +ASCII without markup, Texinfo input format, LaTeX input format, SGML +or XML using a publicly available DTD, and standard-conforming simple +HTML, PostScript or PDF designed for human modification. Examples of +transparent image formats include PNG, XCF and JPG. Opaque formats +include proprietary formats that can be read and edited only by +proprietary word processors, SGML or XML for which the DTD and/or +processing tools are not generally available, and the +machine-generated HTML, PostScript or PDF produced by some word +processors for output purposes only. + +The "Title Page" means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, "Title Page" means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. + +The "publisher" means any person or entity that distributes copies of +the Document to the public. + +A section "Entitled XYZ" means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as "Acknowledgements", +"Dedications", "Endorsements", or "History".) To "Preserve the Title" +of such a section when you modify the Document means that it remains a +section "Entitled XYZ" according to this definition. + +The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. + +2. VERBATIM COPYING + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no +other conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. + + +3. COPYING IN QUANTITY + +If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document's license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to +give them a chance to provide you with an updated version of the +Document. + + +4. MODIFICATIONS + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + +A. Use in the Title Page (and on the covers, if any) a title distinct + from that of the Document, and from those of previous versions + (which should, if there were any, be listed in the History section + of the Document). You may use the same title as a previous version + if the original publisher of that version gives permission. +B. List on the Title Page, as authors, one or more persons or entities + responsible for authorship of the modifications in the Modified + Version, together with at least five of the principal authors of the + Document (all of its principal authors, if it has fewer than five), + unless they release you from this requirement. +C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. +D. Preserve all the copyright notices of the Document. +E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. +F. Include, immediately after the copyright notices, a license notice + giving the public permission to use the Modified Version under the + terms of this License, in the form shown in the Addendum below. +G. Preserve in that license notice the full lists of Invariant Sections + and required Cover Texts given in the Document's license notice. +H. Include an unaltered copy of this License. +I. Preserve the section Entitled "History", Preserve its Title, and add + to it an item stating at least the title, year, new authors, and + publisher of the Modified Version as given on the Title Page. If + there is no section Entitled "History" in the Document, create one + stating the title, year, authors, and publisher of the Document as + given on its Title Page, then add an item describing the Modified + Version as stated in the previous sentence. +J. Preserve the network location, if any, given in the Document for + public access to a Transparent copy of the Document, and likewise + the network locations given in the Document for previous versions + it was based on. These may be placed in the "History" section. + You may omit a network location for a work that was published at + least four years before the Document itself, or if the original + publisher of the version it refers to gives permission. +K. For any section Entitled "Acknowledgements" or "Dedications", + Preserve the Title of the section, and preserve in the section all + the substance and tone of each of the contributor acknowledgements + and/or dedications given therein. +L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section titles. +M. Delete any section Entitled "Endorsements". Such a section + may not be included in the Modified Version. +N. Do not retitle any existing section to be Entitled "Endorsements" + or to conflict in title with any Invariant Section. +O. Preserve any Warranty Disclaimers. + +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section Entitled "Endorsements", provided it contains +nothing but endorsements of your Modified Version by various +parties--for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. + + +5. COMBINING DOCUMENTS + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice, and that you preserve all their Warranty Disclaimers. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections Entitled "History" +in the various original documents, forming one section Entitled +"History"; likewise combine any sections Entitled "Acknowledgements", +and any sections Entitled "Dedications". You must delete all sections +Entitled "Endorsements". + + +6. COLLECTIONS OF DOCUMENTS + +You may make a collection consisting of the Document and other +documents released under this License, and replace the individual +copies of this License in the various documents with a single copy +that is included in the collection, provided that you follow the rules +of this License for verbatim copying of each of the documents in all +other respects. + +You may extract a single document from such a collection, and +distribute it individually under this License, provided you insert a +copy of this License into the extracted document, and follow this +License in all other respects regarding verbatim copying of that +document. + + +7. AGGREGATION WITH INDEPENDENT WORKS + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an "aggregate" if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation's users beyond what the individual works permit. +When the Document is included in an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one half of +the entire aggregate, the Document's Cover Texts may be placed on +covers that bracket the Document within the aggregate, or the +electronic equivalent of covers if the Document is in electronic form. +Otherwise they must appear on printed covers that bracket the whole +aggregate. + + +8. TRANSLATION + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License, and all the license notices in the +Document, and any Warranty Disclaimers, provided that you also include +the original English version of this License and the original versions +of those notices and disclaimers. In case of a disagreement between +the translation and the original version of this License or a notice +or disclaimer, the original version will prevail. + +If a section in the Document is Entitled "Acknowledgements", +"Dedications", or "History", the requirement (section 4) to Preserve +its Title (section 1) will typically require changing the actual +title. + + +9. TERMINATION + +You may not copy, modify, sublicense, or distribute the Document +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense, or distribute it is void, and +will automatically terminate your rights under this License. + +However, if you cease all violation of this License, then your license +from a particular copyright holder is reinstated (a) provisionally, +unless and until the copyright holder explicitly and finally +terminates your license, and (b) permanently, if the copyright holder +fails to notify you of the violation by some reasonable means prior to +60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, receipt of a copy of some or all of the same material does +not give you any rights to use it. + + +10. FUTURE REVISIONS OF THIS LICENSE + +The Free Software Foundation may publish new, revised versions of the +GNU Free Documentation License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in +detail to address new problems or concerns. See +http://www.gnu.org/copyleft/. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License "or any later version" applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. If the Document +specifies that a proxy can decide which future versions of this +License can be used, that proxy's public statement of acceptance of a +version permanently authorizes you to choose that version for the +Document. + +11. RELICENSING + +"Massive Multiauthor Collaboration Site" (or "MMC Site") means any +World Wide Web server that publishes copyrightable works and also +provides prominent facilities for anybody to edit those works. A +public wiki that anybody can edit is an example of such a server. A +"Massive Multiauthor Collaboration" (or "MMC") contained in the site +means any set of copyrightable works thus published on the MMC site. + +"CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 +license published by Creative Commons Corporation, a not-for-profit +corporation with a principal place of business in San Francisco, +California, as well as future copyleft versions of that license +published by that same organization. + +"Incorporate" means to publish or republish a Document, in whole or in +part, as part of another Document. + +An MMC is "eligible for relicensing" if it is licensed under this +License, and if all works that were first published under this License +somewhere other than this MMC, and subsequently incorporated in whole or +in part into the MMC, (1) had no cover texts or invariant sections, and +(2) were thus incorporated prior to November 1, 2008. + +The operator of an MMC Site may republish an MMC contained in the site +under CC-BY-SA on the same site at any time before August 1, 2009, +provided the MMC is eligible for relicensing. + + +ADDENDUM: How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + + Copyright (c) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.3 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. + A copy of the license is included in the section entitled "GNU + Free Documentation License". + +If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the "with...Texts." line with this: + + with the Invariant Sections being LIST THEIR TITLES, with the + Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. + +If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. diff --git a/doc/manual.pdf b/doc/manual.pdf new file mode 100644 index 0000000..65ada8b Binary files /dev/null and b/doc/manual.pdf differ diff --git a/doc/manual.tex b/doc/manual.tex new file mode 100644 index 0000000..0920241 --- /dev/null +++ b/doc/manual.tex @@ -0,0 +1,449 @@ +\documentclass[12pt,titlepage]{article} + +%Preamble +\usepackage{a4wide} +%\usepackage{savetrees} +\usepackage{setspace} +%\usepackage{graphicx} +%\usepackage{amsmath} +%\usepackage{float} +\usepackage{listings} +\usepackage{color} +%Use Helvetica clone as font +\usepackage[T1]{fontenc} +\usepackage{tgheros} +\usepackage[colorlinks=true,linkcolor=black]{hyperref} + +%Make sans serif +\renewcommand*\familydefault{\sfdefault} +%Change default monotype font +\renewcommand*\ttdefault{txtt} +\definecolor{light-gray}{gray}{0.95} + +%Set listings language to bash +\lstset{ + language=bash, + basicstyle=\ttfamily, + keywordstyle=, + backgroundcolor=\color{light-gray}} + +\newenvironment{compactemize} +{\begin{itemize} + \setlength{\itemsep}{1.5pt} + \setlength{\parskip}{0pt} + \setlength{\parsep}{0pt}} +{\end{itemize}} + +\begin{document} + +\title{\textbf{checkergen user manual}} +\author{} +\date{published \today} + +\maketitle + +\tableofcontents +\pagebreak + +\onehalfspacing + +\section{Introduction} + +Checkergen is a simple program written in Python which generates +flashing checkerboard patterns for use in psychophysics experiments. A +command line interface (CLI) is provided for the setting of +parameters, and output either to screen or to file is provided. + +In checkergen, you can create checkerboard patterns and vary the +size, position, colors, amount of distortion along the x and y axes, +as well as the frequency and phase of flashing. + +You can then display these patterns on screen, and at the same time +send trigger signals through a serial or parallel port to a data +acquisition machine. Alternatively, you can export the patterns as a +series of image files which can then be displayed by another +stimulus-presenting program. + +\section{Requirements} + +\begin{compactemize} +\item Python 2.7 or Python 2.6 + argparse module +\item pyglet (version >= 1.1.4 recommended) +\item pySerial if you want to send trigger signals via a serial port +\item pyParallel if you want to send trigger signals via a parallel port +\begin{compactemize} +\item giveio driver required on Windows +\item see pyParallel homepage for other requirements +\end{compactemize} +\item pywin32 if you want to increase process priority on Windows +\item OpenGL installation with the \emph{GL\_EXT\_framebuffer\_object} + extension for export and scale-to-fullscreen functionality +\end{compactemize} + +\section{Running \emph{checkergen}} + +Open a command prompt or terminal and make sure you are in the same +directory as the file \texttt{checkergen.py}. Also make sure that Python +is on your system path. On a UNIX-like OS, enter: +\begin{lstlisting} +./checkergen.py +\end{lstlisting} +On Windows, enter: +\begin{lstlisting} +checkergen.py +\end{lstlisting} + +Once you run checkergen, the checkergen prompt will appear: +\begin{lstlisting} +Enter `help' for a list of commands. +Enter `quit' or Ctrl-D to exit. +(ckg) +\end{lstlisting} + +Checkergen can be supplied with the path to a project file as an +argument, such that that project will be loaded upon startup. For +other options, run checkergen with \lstinline{--help} as an option. + +\section{Projects} + +Stimuli you create in checkergen are stored as +\emph{projects}. Checkergen projects contain all your checkerboards, +as well as various other settings like framerate in frames per second +(fps) and background color. Projects are saved as XML files with +\texttt{.ckg} extension. The name of the project is always the same as +the name of the file it is saved as, excluding the extension. + +\subsection{Creating a new project} + +To create a new project, enter: +\begin{lstlisting} +(ckg) new [projectname] +\end{lstlisting} +\lstinline{projectname} is optional and defaults to `untitled'. All +project settings are initialized to reasonable defaults. + +\subsection{Saving a project} +To save the project you've just created, enter: +\begin{lstlisting} +(ckg) save [path/to/file.ckg] +\end{lstlisting} +If the path is not specified, your project will be saved to the +current working directory as \lstinline{projectname.ckg}. The path can +either be absolute or relative, but must always refer to a file with a +\texttt{.ckg} extension. The name of the saved file becomes the project +name. + +\subsection{Opening an existing project} +To open an existing project, enter: +\begin{lstlisting} +(ckg) open path/to/file.ckg +\end{lstlisting} +As with \texttt{save}, the specified file must have the \texttt{.ckg} +extension. The current working directory will be changed to the +directory containing the specified file. + +\subsection{Closing the project} +To close the project, enter: +\begin{lstlisting} +(ckg) close +\end{lstlisting} +If unsaved changes exist in the project, you will be prompted to save +the file first. + +\subsection{Project settings} + +Project settings can be edited using the \texttt{set} command. The +usage is as follows: +\begin{lstlisting} +set [--name NAME] [--fps FPS] [--res WIDTH,HEIGHT] + [--bg COLOR] [--pre SECONDS] [--post SECONDS] + [--cross_cols COLOR1,COLOR2] [--cross_times TIME1,TIME2] +\end{lstlisting} +A full description can be seen by entering \lstinline{help set} into +the checkergen prompt. + +An important point to note is to always remember to \texttt{set} the +fps of your project to the framerate of the monitor you are using, as +there is no auto-detect functionality. Otherwise, the pattern +animation will not be displayed at the correct speed. For example, if +your monitor has a 120 Hz refresh rate, do: +\begin{lstlisting} +(ckg) set --fps 120 +\end{lstlisting} + +\subsection{Listing project information} + +To get an overview of the current project, enter the \texttt{ls} +command. This will list all project settings, as well as all display +groups, checkerboards, and their properties. The following is some +sample output: + +{ +\small +\begin{lstlisting} +(ckg) ls +***************************PROJECT SETTINGS*************************** + name fps resolution bg color + 2groups 120 800,600 127,127,127 + pre-display post-display + 0 0 + cross colors cross times + 0;0;0,255;0;0 Infinity,1 + +*******************************GROUP 0******************************** + pre-display display post-display + 5 5 0 + shape id dims init_unit end_unit position + 0 5,5 40,40 50,50 380,320 + 1 5,5 40,40 50,50 420,320 + + shape id colors anchor freq phase + 0 0;0;0,255;255;255 bottomright 2 0 + 1 0;0;0,255;255;255 bottomleft 1 90 + +*******************************GROUP 1******************************** + pre-display display post-display + 5 5 0 + shape id dims init_unit end_unit position + 0 5,5 40,40 50,50 380,320 + 1 5,5 40,40 50,50 420,320 + + shape id colors anchor freq phase + 0 0;0;0,255;255;255 bottomright 1 180 + 1 0;0;0,255;255;255 bottomleft 2 270 +\end{lstlisting} +} + +\section{Display groups} + +In order to display different sets of checkerboards at different +points in time, checkerboards are organized into \emph{display} +\emph{groups}. All checkerboards in a display group are displayed +together for a certain duration, after which the next display group +takes over. + +In addition to specifying the duration of a display group, you can +also specify the duration a blank screen is shown before and +after the display group is actually displayed. + +\subsection{Creating a display group} +Display groups are created using \texttt{mkgrp}: +\begin{lstlisting} +(ckg) mkgrp [pre] [disp] [post] +\end{lstlisting} +where +\begin{compactemize} +\item \texttt{pre} is the time in seconds a blank screen is shown + before the checkerboards in a display group are displayed, +\item \texttt{disp} is the time in seconds the checkerboards are + actually displayed on-screen, +\item \texttt{post} is the time in seconds a blank screen is shown + after the checkerboards in a display group are displayed. +\end{compactemize} +\texttt{pre} and \texttt{post} default to \texttt{0}, while +\texttt{disp} defaults to \texttt{Infinity}. Creating a display group +automatically makes it the current active context for creation and +editing of checkerboards. + +\subsection{Changing the active group} +All commands that manipulate checkerboards are directed to the display +group that is currently active for editing. To change the current +active display group, do: +\begin{lstlisting} +(ckg) chgrp [group_id] +\end{lstlisting} +where \lstinline{group_id} is the ID number of the group you want to +switch to. The first group you create will have ID number 0, the next +will have ID number 1, and so on. If \lstinline{group_id} is not +specified, then checkergen prints a message telling you which is the +current active display group. + +\subsection{Editing display groups} +\texttt{edgrp} can be used to edit display groups that have already +been created. It is used as follows: +\begin{lstlisting} +edgrp [--pre SECONDS] [--disp SECONDS] [--post SECONDS] + list_of_group_ids +\end{lstlisting} +The options you can specify are the same as in \texttt{mkgrp}. Edits +will be performed on all the groups specified by the ID numbers in +\lstinline{list_of_group_ids}. At least one group id must be +specified. + +\subsection{Removing groups} +To remove display groups, simply do: +\begin{lstlisting} +(ckg) rmgrp list_of_group_ids +\end{lstlisting} +If the active display group is removed, then group 0 becomes the new +active display group (unless there are no more groups in the project). + +\section{Checkerboards} + +Checkerboards are managed using similar commands to those used for +display groups. These commands only affect the current active display +group, so \texttt{chgrp} must be used before checkerboards in another +group can be managed. + +As mentioned in the introduction, checkerboard patterns have a variety +of attributes. A full list of attributes follows: +\begin{compactemize} +\item dimensions (in number of unit cells) +\item size of the initial unit cell (in pixels) +\item size of the final unit cell (in pixels) +\item position (of the anchor, in pixels from bottom-right corner of window) +\item anchor (i.e. where the initial cell is positioned within the board + e.g. top-left) +\item colors (which alternate both in space and time) +\item frequency of flashing / color alternation (in Hz) +\item initial phase of color alternation (in degrees) +\end{compactemize} + +\subsection{Creating a checkerboard} +To create a checkerboard in the current display group, use +\texttt{mk}. The usage is as follows: +\begin{lstlisting} +mk dims init_unit end_unit position anchor cols freq [phase] +\end{lstlisting} +Except for the phase, which defaults to \texttt{0}, you have to +specify all the attributes mentioned above. For more detailed +information, enter \texttt{help mk}. + +\subsection{Editing checkerboards} +Similar to \texttt{edgrp}, you can edit checkerboards in the current +group by using \texttt{ed} and specifying a list of checkerboard +ID numbers. The usage is as follows: +\begin{lstlisting} +ed [--dims WIDTH,HEIGHT] [--init_unit WIDTH,HEIGHT] + [--end_unit WIDTH,HEIGHT] [--position X,Y] + [--anchor LOCATION] [--cols COLOR1,COLOR2] + [--freq FREQ] [--phase PHASE] + list_of_checkerboard_ids +\end{lstlisting} +For more detailed information, enter \texttt{help ed}. + +\subsection{Removing checkerboards} +Much like \texttt{rmgrp}, to remove checkerboards from the current +group, simply use \texttt{rm}: +\begin{lstlisting} +(ckg) rm list_of_checkerboard_ids +\end{lstlisting} + +\section{Display} +To display the project on-screen, use the \texttt{display} command. +To stop displaying project animation midway, press ESC. The usage is +as follows: +\begin{lstlisting} +display [-f] [-p LEVEL] [-r N] [-pt] [-lt] [-ld] [-ss] [-sp] + [list_of_group_ids] +\end{lstlisting} +With no options specified, the project will be displayed in a window, +going through each display group in order. If you want display groups +to be displayed in a specific order, just supply a list of group ids +as arguments. If you want to repeat displaying groups in that order +several times, then give the \lstinline{-r/--repeat} option and +specify how many repeats you want. For example, entering: +\begin{lstlisting} +display -r 20 2 0 1 1 +\end{lstlisting} +will result in group 2 being displayed first, then group 0, then group +1, then group 1 again, with the sequence of groups being shown 20 +times in total. + +The following subsections describe the other options in greater +detail. + +\subsection{Fullscreen display} + +The \lstinline{-f/--fullscreen} flag, when specified, causes the +project to be displayed in fullscreen. If the project's resolution is +not the same as the screen's resolution, then checkergen will try to +stretch the animation to fit the screen. This requires the use of +framebuffer objects, so your OpenGL installation must support the +\emph{GL\_EXT\_framebuffer\_object} extension. + +\subsection{Setting the process priority} + +To reduce the number of monitor refreshes that are missed, checkergen +can increase the priority of the Python process it is running in, but +thus far only on Windows. This functionality requires the pywin32 +module, and is invoked by giving the \lstinline{-p/--priority} flag +and specifying the priority level. + +There are 4 priority levels, low, normal, high and realtime, which can +be also specified by integers in the range 0 to 3 (i.e. 0 means low, 3 +means realtime). When conducting an experiment, use +\lstinline{display -p realtime} for the best performance. However, using +realtime priority might cause the computer to become less responsive +to user input in some cases. + +\subsection{Logging time information} +Specifying the \lstinline{-lt/--logtime} flag will enable logging of +each frame's timestamp, while specifying the \lstinline{-ld/--logdur} +flag will enable logging of each frame's duration. This information +will be output to a log file in the same directory as the project file +once display is done, with the filename as +\texttt{projectname.log}. If either kind of logging is enabled, and if +signalling is also enabled (\lstinline{-sp} or \lstinline{-ss} flags), +then the log file will also record the trigger signals sent at each +frame, if there were any. + +\subsection{Sending triggers} + +To send trigger signals via the parallel port to the data acquisition +machine, specify the \lstinline{-sp/--sigpar} flag. To send signals +via the serial port, specify the \lstinline{-ss/--sigser} flag. Serial +port functionality has not, as of this date, been tested. + +Unique triggers are sent upon several events: +\begin{compactemize} +\item When the checkerboards in a display group appear on-screen (42 + sent) +\item When the checkerboards in a display group disappear from the + screen (17 sent) +\item Whenever a checkerboard undergoes a color reversal (64 + board + id sent) +\end{compactemize} +Should two or more checkerboards happen to undergo a color reversal at +the same time, the trigger sent will be for the checkerboard +with the largest ID number. + +Triggers are sent immediately after the screen flip operation returns, +ensuring as far as possible that the stimulus onset is synchronized +with the sending of the trigger. For a discussion of issues regarding +synchronization of the screen with the signal-sending port, see +section \ref{sec:phototest}. + +\subsection{Photodiode testing} +\label{sec:phototest} + +To facilitate testing of stimulus onset time and refresh rates using a +photodiode, the \lstinline{-pt/--phototest} flag can be +specified. When specified, a small white test rectangle will be +displayed (for the duration of one frame) in the top-left corner of the +window/screen whenever the checkerboards in a display group appear +on-screen. Hence, this should coincide with a trigger sent by the +parallel or serial port. + +However tests have shown that on certain set-ups, the trigger is sent +by the port one frame earlier than when the photodiode signal is +detected, suggesting that the trigger is sent before the screen flip +operation has completed entirely. If this happens to you, it may be +due to vertical sync (vsync) not being properly enabled. To play safe, +it is advisable to configure OpenGL or your graphics driver to force +vsync on for all applications. After doing so, the port signal should +be synchronized with the photodiode signal. + +\section{Export} +The \texttt{export} command is similar to the \texttt{display} +command, allowing you to specify the list of group ids to exported, as +well as allowing you to specify the length of the project animation +that should be exported (in seconds). Only PNG is supported as an +export format. The usage is as follows: +\begin{lstlisting} +usage: export [-n] [-r N] [duration] [dir] [list_of_group_ids] +\end{lstlisting} +For more detailed information, enter \lstinline{help export} into the +checkergen prompt. + +\end{document} diff --git a/example.ckg b/example.ckg new file mode 100644 index 0000000..cc77e03 --- /dev/null +++ b/example.ckg @@ -0,0 +1,56 @@ +<?xml version="1.0" ?> +<project xmlns="http://github.com/ZOMGxuan/checkergen"> + <export_fmt>'png'</export_fmt> + <pre>Decimal('0')</pre> + <bg>(127, 127, 127)</bg> + <fps>Decimal('60')</fps> + <cross_cols>((0, 0, 0), (255, 0, 0))</cross_cols> + <res>(800, 600)</res> + <post>Decimal('0')</post> + <cross_times>(Decimal('Infinity'), Decimal('1'))</cross_times> + <group> + <pre>Decimal('2')</pre> + <disp>Decimal('10')</disp> + <post>Decimal('2')</post> + <shape type="board"> + <end_unit>(Decimal('50'), Decimal('50'))</end_unit> + <dims>(5, 5)</dims> + <phase>Decimal('0')</phase> + <position>(Decimal('420'), Decimal('320'))</position> + <freq>Decimal('1')</freq> + <anchor>'bottomleft'</anchor> + <init_unit>(Decimal('40'), Decimal('40'))</init_unit> + <cols>((0, 0, 0), (255, 255, 255))</cols> + </shape> + <shape type="board"> + <end_unit>(Decimal('50'), Decimal('50'))</end_unit> + <dims>(5, 5)</dims> + <phase>Decimal('90')</phase> + <position>(Decimal('380'), Decimal('320'))</position> + <freq>Decimal('2')</freq> + <anchor>'bottomright'</anchor> + <init_unit>(Decimal('40'), Decimal('40'))</init_unit> + <cols>((0, 0, 0), (255, 255, 255))</cols> + </shape> + <shape type="board"> + <end_unit>(Decimal('50'), Decimal('50'))</end_unit> + <dims>(5, 5)</dims> + <phase>Decimal('180')</phase> + <position>(Decimal('420'), Decimal('280'))</position> + <freq>Decimal('3')</freq> + <anchor>'topleft'</anchor> + <init_unit>(Decimal('40'), Decimal('40'))</init_unit> + <cols>((0, 0, 0), (255, 255, 255))</cols> + </shape> + <shape type="board"> + <end_unit>(Decimal('50'), Decimal('50'))</end_unit> + <dims>(5, 5)</dims> + <phase>Decimal('270')</phase> + <position>(Decimal('380'), Decimal('280'))</position> + <freq>Decimal('4')</freq> + <anchor>'topright'</anchor> + <init_unit>(Decimal('40'), Decimal('40'))</init_unit> + <cols>((0, 0, 0), (255, 255, 255))</cols> + </shape> + </group> +</project> diff --git a/src/cli.py b/src/cli.py new file mode 100644 index 0000000..c94615a --- /dev/null +++ b/src/cli.py @@ -0,0 +1,997 @@ +"""Defines command-line-interface for checkergen.""" + +import os +import sys +if os.name == 'posix': + import readline +import argparse +import cmd +import shlex + +import core +import priority +import eyetracking +from graphics import locations +from utils import * + +CMD_PROMPT = '(ckg) ' +CMD_EOF_STRING = 'Ctrl-D' +if sys.platform == 'win32': + CMD_EOF_STRING = 'Ctrl-Z + Enter' +CMD_INTRO = '\n'.join(["Enter 'help' for a list of commands.", + "Enter 'quit' or {0} to exit.".format(CMD_EOF_STRING)]) + +def store_tuple(nargs, sep, typecast=None, castargs=[]): + """Returns argparse action that stores a tuple.""" + class TupleAction(argparse.Action): + def __call__(self, parser, args, values, option_string=None): + vallist = values.split(sep) + if len(vallist) != nargs: + msg = ("argument '{f}' should be a list of " + + "{nargs} values separated by '{sep}'").\ + format(f=self.dest,nargs=nargs,sep=sep) + raise argparse.ArgumentError(self, msg) + if typecast != None: + for n, val in enumerate(vallist): + try: + val = typecast(*([val] + castargs)) + vallist[n] = val + except (ValueError, TypeError): + msg = ("element '{val}' of argument '{f}' " + + "is of the wrong type").\ + format(val=vallist[n],f=self.dest) + raise argparse.ArgumentError(self, msg) + setattr(args, self.dest, tuple(vallist)) + return TupleAction + +# The main parser invoked at the command-line +PARSER = argparse.ArgumentParser( + description='''Generate flashing checkerboard patterns for display + or export as a series of images, intended for use in + psychophysics experiments. Enters interactive command + line mode if no options are specified.''') + +PARSER.add_argument('-c', '--cmd', dest='cmd_mode', action='store_true', + help='enter command line mode regardless of other options') +PARSER.add_argument('-d', '--display', + dest='display_flag', action='store_true', + help='displays the animation on the screen') +PARSER.add_argument('-e', '--export', dest='export_dur', metavar='DUR', + help='export DUR seconds of the project animation') +PARSER.add_argument('-f', '--fullscreen', action='store_true', + help='animation displayed in fullscreen mode') +# PARSER.add_argument('--fmt', dest='export_fmt', choices=core.EXPORT_FMTS, +# help='image format for animation to be exported as') +PARSER.add_argument('--dir', dest='export_dir', + default=os.getcwd(), metavar='PATH', + help='''destination directory for export + (default: current working directory)''') +PARSER.add_argument('path', metavar='project', nargs='?', type=file, + help='checkergen project file to open') + +def process_args(args): + """Further processes the arguments returned by the main parser.""" + + if args.export_dur != None: + args.export_flag = True + else: + args.export_flag = False + + if not args.display_flag and not args.export_flag: + args.cmd_mode = True + + if args.path != None: + if not os.path.isfile(args.path): + msg = 'error: path specified is not a file' + return msg + args.proj = core.CkgProj(path=args.path) + os.chdir(os.path.dirname(os.path.abspath(args.path))) + try: + args.group = args.proj.groups[0] + except IndexError: + args.group = None + else: + args.proj = None + args.group = None + if args.display_flag or args.export_flag: + msg = 'error: no project file specified for display or export' + return msg + +class CmdParserError(Exception): + """To be raised when CmdParser encounters an error.""" + pass + +class CmdParser(argparse.ArgumentParser): + """Override ArgumentParser so that it doesn't exit the program.""" + def error(self, msg): + raise CmdParserError(msg) + +class CkgCmd(cmd.Cmd): + + @staticmethod + def yn_parse(s): + if s in ['y', 'Y', 'yes', 'YES', 'Yes']: + return True + elif s in ['n', 'N', 'no', 'NO', 'No']: + return False + else: + msg = "only 'y','n' or variants accepted" + raise ValueError(msg) + + def save_check(self, msg=None): + """Checks and prompts the user to save if necessary.""" + if self.cur_proj == None: + return + if not self.cur_proj.is_dirty(): + return + if msg == None: + msg = 'Would you like to save the current project first? (y/n)' + print msg + while True: + try: + if self.__class__.yn_parse(raw_input()): + self.do_save('') + break + except TypeError: + print str(sys.exc_value) + except EOFError: + return True + + def do_new(self, line): + """Creates new project with given name (can contain whitespace).""" + name = line.strip().strip('"\'') + if len(name) == 0: + name = 'untitled' + if self.save_check(): + return + self.cur_proj = core.CkgProj(name=name) + print 'project \'{0}\' created'.format(self.cur_proj.name) + + def do_open(self, line): + """Open specified project file.""" + path = line.strip().strip('"\'') + if len(path) == 0: + print 'error: no path specified' + return + if not os.path.isfile(path): + print 'error: path specified is not a file' + return + if self.save_check(): + return + try: + self.cur_proj = core.CkgProj(path=path) + except (core.FileFormatError, IOError): + print "error:", str(sys.exc_value) + return + os.chdir(os.path.dirname(os.path.abspath(path))) + try: + self.cur_group = self.cur_proj.groups[0] + except IndexError: + self.cur_group = None + print 'project \'{0}\' loaded'.format(self.cur_proj.name) + + def do_close(self, line): + """Prompts the user to save, then closes current project.""" + if self.cur_proj == None: + print 'no project to close' + return + if self.save_check(): + return + self.cur_proj = None + print 'project closed' + + def do_save(self, line): + """Saves the current project to the specified path.""" + if self.cur_proj == None: + print 'no project to save' + return + path = line.strip().strip('"\'') + if len(path) == 0: + path = os.getcwd() + path = os.path.abspath(path) + if os.path.isdir(path): + path = os.path.join(path, + '.'.join([self.cur_proj.name, core.CKG_FMT])) + elif os.path.isdir(os.path.dirname(path)): + pass + else: + print 'error: specified directory does not exist' + return + # project save will add file extension if necessary + try: + path = self.cur_proj.save(path) + except IOError: + print "error:", str(sys.exc_value) + return + print 'project saved to "{0}"'.format(path) + + set_parser = CmdParser(add_help=False, prog='set', + description='''Sets various project settings.''') + set_parser.add_argument('--name', help='''project name, always the same as + the filename without + the extension''') + set_parser.add_argument('--fps', type=to_decimal, + help='''number of animation frames + rendered per second''') + set_parser.add_argument('--res', action=store_tuple(2, ',', int), + help='animation canvas size/resolution in pixels', + metavar='WIDTH,HEIGHT') + set_parser.add_argument('--bg', metavar='COLOR', type=to_color, + help='''background color of the canvas + (color format: R,G,B, + component range from 0-255)''') + # set_parser.add_argument('--fmt', dest='export_fmt', + # choices=core.EXPORT_FMTS, + # help='''image format for animation + # to be exported as''') + set_parser.add_argument('--pre', type=to_decimal, metavar='SECONDS', + help='''time in seconds a blank screen will + be shown before any display groups''') + set_parser.add_argument('--post', type=to_decimal, metavar='SECONDS', + help='''time in seconds a blank screen will + be shown after all display groups''') + set_parser.add_argument('--cross_cols', metavar='COLOR1,COLOR2', + action=store_tuple(2, ',', to_color, [';']), + help='''fixation cross coloration + (color format: R;G;B, + component range from 0-255)''') + set_parser.add_argument('--cross_times', metavar='TIME1,TIME2', + action=store_tuple(2, ',', to_decimal), + help='''time in seconds each cross color + will be displayed''') + + def help_set(self): + self.__class__.set_parser.print_help() + + def do_set(self, line): + if self.cur_proj == None: + print 'no project open, automatically creating project...' + self.do_new('') + try: + args = self.__class__.set_parser.parse_args(shlex.split(line)) + except CmdParserError: + print "error:", str(sys.exc_value) + self.__class__.set_parser.print_usage() + return + names = public_dir(args) + noflags = True + for name in names: + val = getattr(args, name) + if val != None: + setattr(self.cur_proj, name, val) + noflags = False + if noflags: + print "no options specified, please specify at least one" + self.__class__.set_parser.print_usage() + + mkgrp_parser = CmdParser(add_help=False, prog='mkgrp', + formatter_class= + argparse.ArgumentDefaultsHelpFormatter, + description='''Makes a new display group + with the given parameters.''') + mkgrp_parser.add_argument('pre', type=to_decimal, default=0, nargs='?', + help='''time in seconds a blank screen will + be shown before shapes are displayed''') + mkgrp_parser.add_argument('disp', type=to_decimal, + nargs='?', default='Infinity', + help='''time in seconds shapes will be + displayed''') + mkgrp_parser.add_argument('post', type=to_decimal, default=0, nargs='?', + help='''time in seconds a blank screen will + be shown after shapes are displayed''') + + def help_mkgrp(self): + self.__class__.mkgrp_parser.print_help() + + def do_mkgrp(self, line): + """Makes a display group with the given parameters.""" + if self.cur_proj == None: + print 'no project open, automatically creating project...' + self.do_new('') + try: + args = self.__class__.mkgrp_parser.parse_args(shlex.split(line)) + except CmdParserError: + print "error:", str(sys.exc_value) + self.__class__.mkgrp_parser.print_usage() + return + group_dict = dict([(name, getattr(args, name)) for + name in public_dir(args)]) + new_group = core.CkgDisplayGroup(**group_dict) + new_id = self.cur_proj.add_group(new_group) + print "display group", new_id, "added" + self.cur_group = new_group + print "group", new_id, "is now the current display group" + + edgrp_parser = CmdParser(add_help=False, prog='edgrp', + description='''Edits attributes of display groups + specified by ids.''') + edgrp_parser.add_argument('idlist', nargs='+', metavar='id', type=int, + help='ids of display groups to be edited') + edgrp_parser.add_argument('--pre', type=to_decimal, metavar='SECONDS', + help='''time in seconds a blank screen will + be shown before shapes are displayed''') + edgrp_parser.add_argument('--disp', type=to_decimal, metavar='SECONDS', + help='''time in seconds shapes will be + displayed''') + edgrp_parser.add_argument('--post', type=to_decimal, metavar='SECONDS', + help='''time in seconds a blank screen will + be shown after shapes are displayed''') + def help_edgrp(self): + self.__class__.edgrp_parser.print_help() + + def do_edgrp(self, line): + """Edits attributes of checkerboards specified by ids.""" + if self.cur_proj == None: + print 'please create or open a project first' + return + try: + args = self.__class__.edgrp_parser.parse_args(shlex.split(line)) + except CmdParserError: + print "error:", str(sys.exc_value) + self.__class__.edgrp_parser.print_usage() + return + # Remove duplicates and ascending sort + args.idlist = sorted(set(args.idlist)) + for x in args.idlist[:]: + if x >= len(self.cur_proj.groups) or x < 0: + args.idlist.remove(x) + print "checkerboard", x, "does not exist" + if args.idlist == []: + return + names = public_dir(args) + names.remove('idlist') + noflags = True + for name in names: + val = getattr(args, name) + if val != None: + for x in args.idlist: + self.cur_proj.set_group_attr(x, name, val) + noflags = False + if noflags: + print "no options specified, please specify at least one" + self.__class__.edgrp_parser.print_usage() + + rmgrp_parser = CmdParser(add_help=False, prog='rmgrp', + description='''Removes display groups specified + by ids.''') + rmgrp_parser.add_argument('idlist', nargs='*', metavar='id', type=int, + help='ids of display groups to be removed') + rmgrp_parser.add_argument('-a', '--all', action='store_true', + help='remove all groups from the project') + + def help_rmgrp(self): + self.__class__.rmgrp_parser.print_help() + + def do_rmgrp(self, line): + """Removes display groups specified by ids""" + if self.cur_proj == None: + print 'please create or open a project first' + return + elif self.cur_group == None: + print 'current project has no groups to remove' + return + try: + args = self.__class__.rmgrp_parser.parse_args(shlex.split(line)) + except CmdParserError: + print "error:", str(sys.exc_value) + self.__class__.rmgrp_parser.print_usage() + return + rmlist = [] + if args.all: + for group in self.cur_proj.groups[:]: + self.cur_proj.del_group(group) + print "all display groups removed" + return + elif len(args.idlist) == 0: + print "please specify at least one id" + # Remove duplicates and ascending sort + args.idlist = sorted(set(args.idlist)) + for x in args.idlist: + if x >= len(self.cur_proj.groups) or x < 0: + print "display group", x, "does not exist" + continue + rmlist.append(self.cur_proj.groups[x]) + print "display group", x, "removed" + for group in rmlist: + self.cur_proj.del_group(group) + # Remember to point self.cur_group somewhere sane + if self.cur_group not in self.cur_proj.groups: + if len(self.cur_proj.groups) == 0: + self.cur_group = None + else: + self.cur_group = self.cur_proj.groups[0] + print "group 0 is now the current display group" + + chgrp_parser = CmdParser(add_help=False, prog='chgrp', + description='''Changes display group that is + currently active for editing. + Prints current group id if + no group id is specified''') + chgrp_parser.add_argument('gid', metavar='id', type=int, nargs='?', + help='id of display group to be made active') + + def help_chgrp(self): + self.__class__.chgrp_parser.print_help() + + def do_chgrp(self, line): + """Changes group that is currently active for editing.""" + if self.cur_proj == None: + print 'please create or open a project first' + return + elif self.cur_group == None: + print 'current project has no groups that can be made active' + return + try: + args = self.__class__.chgrp_parser.parse_args(shlex.split(line)) + except CmdParserError: + print "error:", str(sys.exc_value) + self.__class__.chgrp_parser.print_usage() + return + if args.gid == None: + print "group",\ + self.cur_proj.groups.index(self.cur_group),\ + "is the current display group" + elif args.gid >= len(self.cur_proj.groups) or args.gid < 0: + print "group", args.gid, "does not exist" + else: + self.cur_group = self.cur_proj.groups[args.gid] + print "group", args.gid, "is now the current display group" + + mk_parser = CmdParser(add_help=False, prog='mk', + description='''Makes a new checkerboard in the + current group with the given + parameters.''') + mk_parser.add_argument('dims', action=store_tuple(2, ',', to_decimal), + help='''width,height of checkerboard in no. of + unit cells''') + mk_parser.add_argument('init_unit', action=store_tuple(2, ',', to_decimal), + help='width,height of initial unit cell in pixels') + mk_parser.add_argument('end_unit', action=store_tuple(2, ',', to_decimal), + help='width,height of final unit cell in pixels') + mk_parser.add_argument('position', action=store_tuple(2, ',', to_decimal), + help='x,y position of checkerboard in pixels') + mk_parser.add_argument('anchor', choices=sorted(locations.keys()), + help='''location of anchor point of checkerboard + (choices: %(choices)s)''', + metavar='anchor') + mk_parser.add_argument('cols', action=store_tuple(2, ',', to_color, [';']), + help='''color1,color2 of the checkerboard + (color format: R;G;B, + component range from 0-255)''') + mk_parser.add_argument('freq', type=to_decimal, + help='frequency of color reversal in Hz') + mk_parser.add_argument('phase', type=to_decimal, nargs='?', default='0', + help='initial phase of animation in degrees') + + def help_mk(self): + self.__class__.mk_parser.print_help() + + def do_mk(self, line): + """Makes a checkerboard with the given parameters.""" + if self.cur_proj == None: + print 'no project open, automatically creating project...' + self.do_new('') + if self.cur_group == None: + print 'automatically adding display group...' + self.do_mkgrp('') + try: + args = self.__class__.mk_parser.parse_args(shlex.split(line)) + except CmdParserError: + print "error:", str(sys.exc_value) + self.__class__.mk_parser.print_usage() + return + shape_dict = dict([(name, getattr(args, name)) for + name in public_dir(args)]) + new_shape = core.CheckerBoard(**shape_dict) + new_id = self.cur_proj.add_shape_to_group(self.cur_group, new_shape) + print "checkerboard", new_id, "added" + + ed_parser = CmdParser(add_help=False, prog='ed', + description='''Edits attributes of checkerboards + specified by ids.''') + ed_parser.add_argument('idlist', nargs='+', metavar='id', type=int, + help='''ids of checkerboards in the current + group to be edited''') + ed_parser.add_argument('--dims', action=store_tuple(2, ',', to_decimal), + help='checkerboard dimensions in unit cells', + metavar='WIDTH,HEIGHT') + ed_parser.add_argument('--init_unit', + action=store_tuple(2, ',', to_decimal), + help='initial unit cell dimensions in pixels', + metavar='WIDTH,HEIGHT') + ed_parser.add_argument('--end_unit', + action=store_tuple(2, ',', to_decimal), + help='final unit cell dimensions in pixels', + metavar='WIDTH,HEIGHT') + ed_parser.add_argument('--position', + action=store_tuple(2, ',', to_decimal), + help='position of checkerboard in pixels', + metavar='X,Y') + ed_parser.add_argument('--anchor', choices=sorted(locations.keys()), + help='''location of anchor point of checkerboard + (choices: %(choices)s)''', + metavar='LOCATION') + ed_parser.add_argument('--cols', metavar='COLOR1,COLOR2', + action=store_tuple(2, ',', to_color, [';']), + help='''checkerboard colors (color format: + R;G;B, component range + from 0-255)''') + ed_parser.add_argument('--freq', type=to_decimal, + help='frequency of color reversal in Hz') + ed_parser.add_argument('--phase', type=to_decimal, + help='initial phase of animation in degrees') + + def help_ed(self): + self.__class__.ed_parser.print_help() + + def do_ed(self, line): + """Edits attributes of checkerboards specified by ids.""" + if self.cur_proj == None: + print 'please create or open a project first' + return + elif self.cur_group == None: + print 'current project has no groups, please create one first' + return + try: + args = self.__class__.ed_parser.parse_args(shlex.split(line)) + except CmdParserError: + print "error:", str(sys.exc_value) + self.__class__.ed_parser.print_usage() + return + # Remove duplicates and ascending sort + args.idlist = sorted(set(args.idlist)) + for x in args.idlist[:]: + if x >= len(self.cur_group.shapes) or x < 0: + args.idlist.remove(x) + print "checkerboard", x, "does not exist" + if args.idlist == []: + return + names = public_dir(args) + names.remove('idlist') + noflags = True + for name in names: + val = getattr(args, name) + if val != None: + for x in args.idlist: + self.cur_proj.set_shape_attr(self.cur_group, x, name, val) + noflags = False + if noflags: + print "no options specified, please specify at least one" + self.__class__.ed_parser.print_usage() + + rm_parser = CmdParser(add_help=False, prog='rm', + description='''Removes checkerboards specified + by ids.''') + rm_parser.add_argument('idlist', nargs='*', metavar='id', type=int, + help='''ids of checkerboards in the current group + to be removed''') + rm_parser.add_argument('-a', '--all', action='store_true', + help='''remove all checkerboards in the + current group''') + + def help_rm(self): + self.__class__.rm_parser.print_help() + + def do_rm(self, line): + """Removes checkerboards specified by ids""" + if self.cur_proj == None: + print 'please create or open a project first' + return + elif self.cur_group == None: + print 'current project has no groups, no boards to remove' + return + try: + args = self.__class__.rm_parser.parse_args(shlex.split(line)) + except CmdParserError: + print "error:", str(sys.exc_value) + self.__class__.rm_parser.print_usage() + return + rmlist = [] + if args.all: + for shape in self.cur_group.shapes: + self.cur_proj.del_shape_from_group(self.cur_group, shape) + print "all checkerboards removed" + return + elif len(args.idlist) == 0: + print "please specify at least one id" + # Remove duplicates and ascending sort + args.idlist = sorted(set(args.idlist)) + for x in args.idlist: + if x >= len(self.cur_group.shapes) or x < 0: + print "checkerboard", x, "does not exist" + continue + rmlist.append(self.cur_group.shapes[x]) + print "checkerboard", x, "removed" + for shape in rmlist: + self.cur_proj.del_shape_from_group(self.cur_group, shape) + + ls_parser = CmdParser(add_help=False, prog='ls', + description='''Lists project, display group and + checkerboard settings. If no group ids + are specified, all display groups + are listed.''') + ls_parser.add_argument('gidlist', nargs='*', metavar='gid', type=int, + help='''ids of the display groups to be listed''') + ls_group = ls_parser.add_mutually_exclusive_group() + ls_group.add_argument('-s', '--settings', action='store_true', + help='list only project settings') + ls_group.add_argument('-g', '--groups', action='store_true', + help='list only display groups') + + def help_ls(self): + self.__class__.ls_parser.print_help() + + def do_ls(self, line): + """Lists project, display group and checkerboard settings.""" + + def ls_str(s, seps=[',',';']): + """Special space-saving output formatter.""" + if type(s) in [tuple, list]: + if len(seps) > 1: + newseps = seps[1:] + else: + newseps = seps + return seps[0].join([ls_str(i, newseps) for i in s]) + else: + return str(s) + + if self.cur_proj == None: + print 'please create or open a project first' + return + try: + args = self.__class__.ls_parser.parse_args(shlex.split(line)) + except CmdParserError: + print "error:", str(sys.exc_value) + self.__class__.ls_parser.print_usage() + return + + # Remove duplicates and ascending sort + args.gidlist = sorted(set(args.gidlist)) + + if len(self.cur_proj.groups) == 0: + if len(args.gidlist) > 0: + print 'this project has no display groups that can be listed' + args.settings = True + else: + for gid in args.gidlist[:]: + if gid >= len(self.cur_proj.groups) or gid < 0: + args.gidlist.remove(gid) + print 'display group', gid, 'does not exist' + if args.gidlist == []: + args.gidlist = range(len(self.cur_proj.groups)) + else: + # If any (valid) groups are specified + # don't show project settings + args.groups = True + + if not args.groups: + print 'PROJECT SETTINGS'.center(70,'*') + print \ + 'name'.rjust(16),\ + 'fps'.rjust(7),\ + 'resolution'.rjust(14),\ + 'bg color'.rjust(18) + # 'format'.rjust(7) + print \ + ls_str(self.cur_proj.name).rjust(16),\ + ls_str(self.cur_proj.fps).rjust(7),\ + ls_str(self.cur_proj.res).rjust(14),\ + ls_str(self.cur_proj.bg).rjust(18) + # ls_str(self.cur_proj.export_fmt).rjust(7) + print \ + 'pre-display'.rjust(26),\ + 'post-display'.rjust(26) + print \ + ls_str(self.cur_proj.pre).rjust(26),\ + ls_str(self.cur_proj.post).rjust(26) + print \ + 'cross colors'.rjust(26),\ + 'cross times'.rjust(26) + print \ + ls_str(self.cur_proj.cross_cols).rjust(26),\ + ls_str(self.cur_proj.cross_times).rjust(26) + + + if not args.settings and not args.groups: + # Insert empty line if both groups and project + # settings are listed + print '' + + if not args.settings: + for i, n in enumerate(args.gidlist): + if i != 0: + # Print newline seperator between each group + print '' + group = self.cur_proj.groups[n] + print 'GROUP {n}'.format(n=n).center(70,'*') + print \ + 'pre-display'.rjust(20),\ + 'display'.rjust(20),\ + 'post-display'.rjust(20) + print \ + ls_str(group.pre).rjust(20),\ + ls_str(group.disp).rjust(20),\ + ls_str(group.post).rjust(20) + if len(group.shapes) > 0: + print \ + ''.rjust(2),\ + 'shape id'.rjust(8),\ + 'dims'.rjust(10),\ + 'init_unit'.rjust(14),\ + 'end_unit'.rjust(14),\ + 'position'.rjust(14) + for m, shape in enumerate(group.shapes): + print \ + ''.rjust(2),\ + ls_str(m).rjust(8),\ + ls_str(shape.dims).rjust(10),\ + ls_str(shape.init_unit).rjust(14),\ + ls_str(shape.end_unit).rjust(14),\ + ls_str(shape.position).rjust(14) + print '\n',\ + ''.rjust(2),\ + 'shape id'.rjust(8),\ + 'colors'.rjust(27),\ + 'anchor'.rjust(12),\ + 'freq'.rjust(6),\ + 'phase'.rjust(7) + for m, shape in enumerate(group.shapes): + print \ + ''.rjust(2),\ + ls_str(m).rjust(8),\ + ls_str(shape.cols).rjust(27),\ + ls_str(shape.anchor).rjust(12),\ + ls_str(shape.freq).rjust(6),\ + ls_str(shape.phase).rjust(7) + + display_parser = CmdParser(add_help=False, prog='display', + description='''Displays the animation in a + window or in fullscreen.''') + display_parser.add_argument('-f', '--fullscreen', action='store_true', + help='sets fullscreen mode, ESC to quit') + display_parser.add_argument('-p', '--priority', metavar='LEVEL', + help='''set priority while displaying, + higher priority results in + less dropped frames (choices: + 0-3, low, normal, high, + realtime)''') + display_parser.add_argument('-r', '--repeat', metavar='N', type=int, + help='''repeatedly display specified display + groups N number of times''') + display_parser.add_argument('-pt', '--phototest', action='store_true', + help='''draw white test rectangle in topleft + corner of screen when groups become + visible for a photodiode to detect''') + display_parser.add_argument('-lt', '--logtime', action='store_true', + help='output frame timestamps to a log file') + display_parser.add_argument('-ld', '--logdur', action='store_true', + help='output frame durations to a log file') + display_parser.add_argument('-ss', '--sigser', action='store_true', + help='''send signals through the serial port + when shapes are being displayed''') + display_parser.add_argument('-sp', '--sigpar', action='store_true', + help='''send signals through the parallel port + when shapes are being displayed''') + display_parser.add_argument('-et', '--eyetrack', action='store_true', + help='''use eyetracking to ensure that subject + fixates on the cross in the center''') + display_parser.add_argument('-eu', '--etuser', action='store_true', + help='''allow user to select eyetracking video + source from a dialog''') + display_parser.add_argument('-ev', '--etvideo', metavar='path', + help='''path (with no spaces) to eyetracking + video file to be used as the source''') + display_parser.add_argument('idlist', nargs='*', metavar='id', type=int, + help='''list of display groups to be displayed + in the specified order (default: order + by id, i.e. group 0 is first)''') + + def help_display(self): + self.__class__.display_parser.print_help() + + def do_display(self, line): + """Displays the animation in a window or in fullscreen""" + if self.cur_proj == None: + print 'please create or open a project first' + return + + try: + args = self.__class__.display_parser.parse_args(shlex.split(line)) + except CmdParserError: + print "error:", str(sys.exc_value) + self.__class__.display_parser.print_usage() + return + + group_queue = [] + if len(args.idlist) > 0: + for i in set(args.idlist): + if i >= len(self.cur_proj.groups) or i < -1: + print 'error: group', i, 'does not exist' + return + for i in args.idlist: + if i == -1: + group_queue.append(core.CkgWaitScreen()) + else: + group_queue.append(self.cur_proj.groups[i]) + else: + group_queue = list(self.cur_proj.groups) + if args.repeat != None: + group_queue = list(group_queue * args.repeat) + + if args.priority != None: + if not priority.available: + print "error: setting priority not avaible on", sys.platform + print "continuing..." + else: + if args.priority.isdigit(): + args.priority = int(args.priority) + try: + priority.set(args.priority) + except ValueError: + print "error:", str(sys.exc_value) + print "continuing..." + + if args.eyetrack and eyetracking.available: + if not eyetracking.is_calibrated(): + print "subject not yet calibrated, please calibrate first" + print "path to calibration file (leave empty for GUI tool):" + calpath = raw_input().strip().strip('"\'') + if len(calpath) == 0: + calpath = None + if eyetracking.VET.VideoSourceType == 0: + # Select default source if none has been selected + eyetracking.select_source() + try: + eyetracking.calibrate(calpath) + except eyetracking.EyetrackingError: + print "error:", str(sys.exc_value) + return + if len(path) > 0: + print "calibration file successfully loaded" + + try: + self.cur_proj.display(fullscreen=args.fullscreen, + logtime=args.logtime, + logdur=args.logdur, + sigser=args.sigser, + sigpar=args.sigpar, + phototest=args.phototest, + eyetrack=args.eyetrack, + etuser=args.etuser, + etvideo=args.etvideo, + group_queue=group_queue) + except (IOError, NotImplementedError, eyetracking.EyetrackingError): + print "error:", str(sys.exc_value) + return + + if args.priority != None: + try: + priority.set('normal') + except: + pass + + export_parser = CmdParser(add_help=False, prog='export', + description='''Exports animation as an image + sequence (in a folder) to the + specified directory.''') + # export_parser.add_argument('--fmt', dest='export_fmt', + # choices=core.EXPORT_FMTS, + # help='image format for export') + export_parser.add_argument('-n','--nofolder', + dest='folder', action='store_false', + help='''force images not to exported in + a containing folder''') + export_parser.add_argument('-r', '--repeat', metavar='N', type=int, + help='''repeatedly export specified display + groups N number of times''') + export_parser.add_argument('duration', nargs='?', + type=to_decimal, default='Infinity', + help='''number of seconds of the animation + that should be exported (default: + as long as the entire animation)''') + export_parser.add_argument('dir', nargs='?', default=os.getcwd(), + help='''destination directory for export + (default: current working directory)''') + export_parser.add_argument('idlist', nargs='*', metavar='id', type=int, + help='''list of display groups to be exported + in the specified order (default: order + by id, i.e. group 0 is first)''') + + def help_export(self): + self.__class__.export_parser.print_help() + + def do_export(self, line): + """Exports animation an image sequence to the specified directory.""" + if self.cur_proj == None: + print 'please create or open a project first' + return + + try: + args = self.__class__.export_parser.parse_args(shlex.split(line)) + except CmdParserError: + print "error:", str(sys.exc_value) + self.__class__.export_parser.print_usage() + return + + if len(args.idlist) > 0: + for i in set(args.idlist): + if i >= len(self.cur_proj.groups) or i < 0: + print 'error: group', i, 'does not exist' + return + group_queue = [self.cur_proj.groups[i] for i in args.idlist] + else: + group_queue = list(self.cur_proj.groups) + if args.repeat != None: + group_queue = list(group_queue * args.repeat) + + try: + self.cur_proj.export(export_dir=args.dir, + export_duration=args.duration, + group_queue=group_queue, + folder=args.folder) + except IOError: + print "error:", str(sys.exc_value) + return + except core.FrameOverflowError: + print "warning:", str(sys.exc_value) + print "Are you sure you want to continue?" + while True: + try: + if self.__class__.yn_parse(raw_input()): + self.cur_proj.export(export_dir=args.dir, + export_duration=args.duration, + group_queue=group_queue, + export_fmt=None, + folder=args.folder, + force=True) + break + else: + return + except TypeError: + print str(sys.exc_value) + except EOFError: + return + + print "Export done." + + def do_calibrate(self, line): + """Calibrate subject for eyetracking, or load a calibration file.""" + if not eyetracking.available: + print "error: eyetracking functionality not available" + return + path = line.strip().strip('"\'') + if len(path) == 0: + path = None + if eyetracking.VET.VideoSourceType == 0: + # Select default source if none has been selected + eyetracking.select_source() + try: + eyetracking.calibrate(path) + except eyetracking.EyetrackingError: + print "error:", str(sys.exc_value) + return + if len(path) > 0: + print "calibration file successfully loaded" + + def do_quit(self, line): + """Quits the program.""" + if self.save_check(): + return + return True + + def do_EOF(self, line): + """Typing Ctrl-D issues this command, which quits the program.""" + print '\r' + if self.save_check(): + return + return True + + def help_help(self): + print 'Prints a list of commands.' + print "Type 'help <topic>' for more details on each command." + + def default(self, line): + command = line.split()[0] + print \ + "'{0}' is not a checkergen command.".format(command),\ + "Type 'help' for a list of commands" diff --git a/src/core.py b/src/core.py new file mode 100755 index 0000000..227e5dc --- /dev/null +++ b/src/core.py @@ -0,0 +1,980 @@ +"""Contains core functionality of checkergen. + +Errors and Exceptions: +FileFormatError +FrameOverflowError + +Classes: +CkgProj -- A checkergen project, contains settings and CkgDisplayGroups. +CkgDisplayGroup -- A set of CheckerShapes to be displayed simultaneously. +CheckerShapes -- Abstract checkered shape class +CheckerBoard -- A (distorted) checkerboard pattern, can color-flip. + +""" + +import os +import sys +import re +from xml.dom import minidom + +import pyglet + +import graphics +import signals +import eyetracking +from utils import * + +CKG_FMT = 'ckg' +XML_NAMESPACE = 'http://github.com/ZOMGxuan/checkergen' +MAX_EXPORT_FRAMES = 100000 +PRERENDER_TO_TEXTURE = False +EXPORT_FMTS = ['png'] +FIX_POS = (0, 0) +FIX_RANGE = (20, 20) +SANS_SERIF = ('Helvetica', 'Arial', 'FreeSans') + +def xml_get(parent, namespace, name, index=0): + """Returns concatenated text node values inside an element.""" + element = [node for node in parent.childNodes if + node.localName == name and + node.namespaceURI == namespace][index] + strings = [] + for node in element.childNodes: + if node.nodeType == node.TEXT_NODE: + strings.append(node.data) + return ''.join(strings) + +def xml_set(document, parent, name, string): + """Stores value as a text node in a new DOM element.""" + element = document.createElement(name) + parent.appendChild(element) + text = document.createTextNode(string) + element.appendChild(text) + +def xml_pretty_print(document, indent): + """Hack to prettify minidom's not so pretty print.""" + ugly_xml = document.toprettyxml(indent=indent) + prettifier_re = re.compile('>\n\s+([^<>\s].*?)\n\s+</', + re.DOTALL) + pretty_xml = prettifier_re.sub('>\g<1></', ugly_xml) + return pretty_xml + +class FileFormatError(ValueError): + """Raised when correct file format/extension is not supplied.""" + pass + +class FrameOverflowError(Exception): + """Raised when more than MAX_EXPORT_FRAMES are going to be exported.""" + pass + +class CkgProj: + """Defines a checkergen project, with checkerboards and other settings.""" + + DEFAULTS = {'name': 'untitled', + 'fps': 60, + 'res': (800, 600), + 'bg': (127, 127, 127), + 'export_fmt': 'png', + 'pre': 0, + 'post': 0, + 'cross_cols': ((0, 0, 0), (255, 0, 0)), + 'cross_times': ('Infinity', 1)} + + def __init__(self, **keywords): + """Initializes a new project, or loads it from a path. + + path -- if specified, ignore other arguments and load project + from path + + name -- name of the project, always the same as the + filename without the extension + + fps -- frames per second of the animation to be displayed + + res -- screen resolution / window size at which project + will be displayed + + bg -- background color of the animation as a 3-tuple (R, G, B) + + export_fmt -- image format for animation to be exported as + + pre -- time in seconds a blank screen will be shown before any + display groups + + post --time in seconds a blank screen will be shown after any + display groups + + """ + if 'path' in keywords.keys(): + self.load(keywords['path']) + return + for kw in self.__class__.DEFAULTS.keys(): + if kw in keywords.keys(): + setattr(self, kw, keywords[kw]) + else: + setattr(self, kw, self.__class__.DEFAULTS[kw]) + self.groups = [] + + def __setattr__(self, name, value): + # Type conversions + if name == 'name': + value = str(value) + elif name in ['fps', 'pre', 'post']: + value = to_decimal(value) + elif name == 'res': + if len(value) != 2: + raise ValueError + value = tuple([int(v) for v in value]) + elif name == 'bg': + if len(value) != 3: + raise ValueError + value = tuple([int(v) for v in value]) + elif name == 'export_fmt': + if value not in EXPORT_FMTS: + msg = 'image format not recognized or supported' + raise FileFormatError(msg) + elif name == 'cross_cols': + if len(value) != 2: + raise ValueError + for col in value: + if len(col) != 3: + raise ValueError + value = tuple([tuple([int(c) for c in col]) for col in value]) + elif name == 'cross_times': + if len(value) != 2: + raise ValueError + value = tuple([to_decimal(x) for x in value]) + + # Store value + self.__dict__[name] = value + # Set dirty bit + if name != '_dirty': + self._dirty = True + + def add_group(self, group): + """Append group to list and set dirty bit.""" + self.groups.append(group) + self._dirty = True + return self.groups.index(group) + + def del_group(self, group): + """Remove group to list and set dirty bit.""" + self.groups.remove(group) + self._dirty = True + + def add_shape_to_group(self, group, shape): + """Add shape to group specified by id and set dirty bit.""" + if group not in self.groups: + raise ValueError + group.shapes.append(shape) + self._dirty = True + return group.shapes.index(shape) + + def del_shape_from_group(self, group, shape): + """Removes shape from group specified by id and set dirty bit.""" + if group not in self.groups: + raise ValueError + group.shapes.remove(shape) + self._dirty = True + + def set_group_attr(self, gid, name, value): + """Set attribute of a group specified by id and set dirty bit.""" + setattr(self.groups[gid], name, value) + self._dirty = True + + def set_shape_attr(self, group, sid, name, value): + """Set attribute of a shape specified by id and set dirty bit.""" + if group not in self.groups: + raise ValueError + setattr(group.shapes[sid], name, value) + self._dirty = True + + def is_dirty(self): + return self._dirty + + def load(self, path): + """Loads project from specified path.""" + + # Get project name from filename + name, ext = os.path.splitext(os.path.basename(path)) + if ext == '.{0}'.format(CKG_FMT): + self.name = name + else: + msg = "path lacks '.{0}' extension".format(CKG_FMT) + raise FileFormatError(msg) + + with open(path, 'r') as project_file: + doc = minidom.parse(project_file) + + project = doc.documentElement + vars_to_load = self.__class__.DEFAULTS.keys() + # Name is not stored in project file + vars_to_load.remove('name') + for var in vars_to_load: + try: + value = eval(xml_get(project, XML_NAMESPACE, var)) + except IndexError: + print "warning: missing attribute '{0}'".format(var) + value = self.__class__.DEFAULTS[var] + print "using default value '{0}' instead...".format(value) + setattr(self, var, value) + self.groups = [] + group_els = [node for node in project.childNodes if + node.localName == 'group' and + node.namespaceURI == XML_NAMESPACE] + for group_el in group_els: + new_group = CkgDisplayGroup() + new_group.load(group_el) + self.groups.append(new_group) + + self._dirty = False + + def save(self, path): + """Saves project to specified path as an XML document.""" + + self.name, ext = os.path.splitext(os.path.basename(path)) + if ext != '.{0}'.format(CKG_FMT): + path = '{0}.{1}'.format(path, CKG_FMT) + + impl = minidom.getDOMImplementation() + doc = impl.createDocument(XML_NAMESPACE, 'project', None) + project = doc.documentElement + # Hack below because minidom doesn't support namespaces properly + project.setAttribute('xmlns', XML_NAMESPACE) + vars_to_save = self.__class__.DEFAULTS.keys() + # Name is not stored in project file + vars_to_save.remove('name') + for var in vars_to_save: + xml_set(doc, project, var, repr(getattr(self, var))) + for group in self.groups: + group.save(doc, project) + with open(path, 'w') as project_file: + project_file.write(xml_pretty_print(doc,indent=' ')) + + self._dirty = False + + return path + + def display(self, fullscreen=False, logtime=False, logdur=False, + sigser=False, sigpar=False, phototest=False, + eyetrack=False, etuser=False, etvideo=None, group_queue=[]): + """Displays the project animation on the screen. + + fullscreen -- animation is displayed fullscreen if true, stretched + to fit if necessary + + logtime -- timestamp of each frame is saved to a logfile if true + + logdur -- duration of each frame is saved to a logfile if true + + sigser -- send signals through serial port when each group is shown + + sigpar -- send signals through parallel port when each group is shown + + phototest -- draw white rectangle in topleft corner when each group is + shown for photodiode to detect + + eyetrack -- use eyetracking to ensure subject is fixating on cross + + etuser -- if true, user gets to select eyetracking video source in GUI + + etvideo -- optional eyetracking video source file to use instead of + live feed + + group_queue -- queue of groups to be displayed, defaults to order of + groups in project (i.e. groups[0] first, etc.) + + """ + + # Create fixation crosses + fix_crosses = [graphics.Cross([r/2 for r in self.res], + (20, 20), col = cross_col) + for cross_col in self.cross_cols] + # Create test rectangle + if phototest: + test_rect = graphics.Rect((0, self.res[1]), + [r/8 for r in self.res], + anchor='topleft') + + # Set-up groups and variables that control their display + if group_queue == []: + group_queue = list(self.groups) + cur_group = None + cur_id = -1 + flipped = 0 + flip_id = -1 + groups_duration = sum([group.duration() for group in group_queue]) + groups_start = self.pre * self.fps + groups_stop = (self.pre + groups_duration) * self.fps + disp_end = (self.pre + groups_duration + self.post) * self.fps + if groups_start == 0 and groups_stop > 0: + groups_visible = True + else: + groups_visible = False + count = 0 + + # Initialize ports + if sigser: + if not signals.available['serial']: + msg = 'serial port functionality not available' + raise NotImplementedError(msg) + if sigpar: + if not signals.available['parallel']: + msg = 'parallel port functionality not available' + raise NotImplementedError(msg) + signals.init(sigser, sigpar) + + # Initialize eyetracking + if eyetrack: + if not eyetracking.available: + msg = 'eyetracking functionality not available' + raise NotImplementedError(msg) + fixating = False + old_fixating = False + eyetracking.select_source(etuser, etvideo) + eyetracking.start() + + # Stretch to fit screen only if project res does not equal screen res + scaling = False + if fullscreen: + window = pyglet.window.Window(fullscreen=True, visible=False) + if (window.width, window.height) != self.res: + scaling = True + else: + window = pyglet.window.Window(*self.res, visible=False) + + # Set up KeyStateHandler to handle keyboard input + keystates = pyglet.window.key.KeyStateHandler() + window.push_handlers(keystates) + + # Create framebuffer object for drawing unscaled scene + if scaling: + canvas = pyglet.image.Texture.create(*self.res) + fbo = graphics.Framebuffer(canvas) + fbo.start_render() + graphics.set_clear_color(self.bg) + fbo.clear() + fbo.end_render() + + # Clear window and make visible + window.switch_to() + graphics.set_clear_color(self.bg) + window.clear() + window.set_visible() + + # Initialize logging variables + if logtime and logdur: + logstring = '' + stamp = Timer() + dur = Timer() + stamp.start() + dur.start() + elif logtime or logdur: + logstring = '' + timer = Timer() + timer.start() + + # Main loop + while not window.has_exit and count < disp_end: + # Clear canvas + if scaling: + fbo.start_render() + fbo.clear() + else: + window.clear() + + # Assume no change to group visibility + flipped = 0 + + # Manage groups when they are on_screen + if groups_visible: + # Send special signal if waitscreen ends + if isinstance(cur_group, CkgWaitScreen): + if cur_group.over: + signals.set_user_start() + cur_group = None + elif cur_group != None: + # Check whether group changes in visibility + if cur_group.visible != cur_group.old_visible: + flip_id = self.groups.index(cur_group) + if cur_group.visible: + flipped = 1 + elif cur_group.old_visible: + flipped = -1 + # Check if current group is over + if cur_group.over: + cur_group = None + # Get next group from queue + if cur_group == None: + cur_id += 1 + if cur_id >= len(group_queue): + groups_visible = False + else: + cur_group = group_queue[cur_id] + cur_group.reset() + if not isinstance(cur_group, CkgWaitScreen): + if cur_group.visible: + flip_id = self.groups.index(cur_group) + flipped = 1 + # Draw and then update group + if cur_group != None: + cur_group.draw() + cur_group.update(fps=self.fps, keystates=keystates) + + # Send signals upon group visibility change + if flipped == 1: + signals.set_group_start(flip_id) + # Draw test rectangle + if phototest: + test_rect.draw() + elif flipped == -1: + signals.set_group_stop(flip_id) + else: + signals.set_null() + + # Draw normal cross color if fixating, other color if not + if eyetrack: + old_fixating = fixating + fixating = eyetracking.fixating(FIX_POS, FIX_RANGE) + if fixating: + fix_crosses[0].draw() + if not old_fixating: + signals.set_fix_start() + else: + fix_crosses[1].draw() + if old_fixating: + signals.set_fix_stop() + # Change cross color based on time if eyetracking is not enabled + elif (count % (sum(self.cross_times) * self.fps) + < self.cross_times[0] * self.fps): + fix_crosses[0].draw() + else: + fix_crosses[1].draw() + + # Increment count and set whether groups should be shown + if not isinstance(cur_group, CkgWaitScreen): + count += 1 + if groups_start <= count < groups_stop: + groups_visible = True + else: + groups_visible = False + + # Blit canvas to screen if necessary + if scaling: + fbo.end_render() + window.switch_to() + canvas.blit(0, 0) + window.dispatch_events() + window.flip() + # Make sure everything has been drawn + pyglet.gl.glFinish() + + # Append time information to log string + if logtime and logdur: + logstring = '\n'.join([logstring, str(stamp.elapsed())]) + logstring = '\t'.join([logstring, str(dur.restart())]) + elif logtime: + logstring = '\n'.join([logstring, str(timer.elapsed())]) + elif logdur: + logstring = '\n'.join([logstring, str(timer.restart())]) + + # Send signals ASAP after flip + signals.send(sigser, sigpar) + + # Log when signals are sent + if logtime or logdur: + if flipped != 0 and (sigser or sigpar): + sigmsg = '{0} sent'.format(signals.STATE) + logstring = '\t'.join([logstring, sigmsg]) + + # Clean up + if eyetrack: + eyetracking.stop() + window.close() + if scaling: + fbo.delete() + del canvas + signals.quit(sigser, sigpar) + + # Write log string to file + if logtime or logdur: + filename = '{0}.log'.format(self.name) + with open(filename, 'w') as logfile: + logfile.write(logstring) + + def export(self, export_dir, export_duration, group_queue=[], + export_fmt=None, folder=True, force=False): + if not os.path.isdir(export_dir): + msg = 'export path is not a directory' + raise IOError(msg) + if export_fmt == None: + export_fmt = self.export_fmt + + # Set-up groups and variables that control their display + if group_queue == []: + group_queue = list(self.groups) + cur_group = None + cur_id = -1 + groups_duration = sum([group.duration() for group in group_queue]) + groups_start = self.pre * self.fps + groups_stop = (self.pre + groups_duration) * self.fps + disp_end = (self.pre + groups_duration + self.post) * self.fps + if groups_start == 0 and groups_stop > 0: + groups_visible = True + else: + groups_visible = False + count = 0 + + # Limit export duration to display duration + frames = export_duration * self.fps + frames = min(frames, disp_end) + + # Warn user if a lot of frames will be exported + if frames > MAX_EXPORT_FRAMES and not force: + msg = 'very large number ({0}) of frames to be exported'.\ + format(frames) + raise FrameOverflowError(msg) + + # Create folder to store images if necessary + if folder: + export_dir = os.path.join(export_dir, self.name) + if not os.path.isdir(export_dir): + os.mkdir(export_dir) + + # Create fixation crosses + fix_crosses = [graphics.Cross([r/2 for r in self.res], + (20, 20), col = cross_col) + for cross_col in self.cross_cols] + + # Set up canvas and framebuffer object + canvas = pyglet.image.Texture.create(*self.res) + fbo = graphics.Framebuffer(canvas) + fbo.start_render() + graphics.set_clear_color(self.bg) + fbo.clear() + + # Main loop + while count < frames: + fbo.clear() + + if groups_visible: + # Check if current group is over + if cur_group != None: + if cur_group.over: + cur_group = None + # Get next group from queue + if cur_group == None: + cur_id += 1 + if cur_id >= len(group_queue): + groups_visible = False + else: + cur_group = group_queue[cur_id] + cur_group.reset() + # Draw and then update group + if cur_group != None: + cur_group.draw() + cur_group.update(fps=self.fps) + # Draw fixation cross based on current count + if (count % (sum(self.cross_times) * self.fps) + < self.cross_times[0] * self.fps): + fix_crosses[0].draw() + else: + fix_crosses[1].draw() + + # Save current frame to file + savepath = \ + os.path.join(export_dir, + '{0}{2}.{1}'. + format(self.name, export_fmt, + repr(count).zfill(numdigits(frames-1)))) + canvas.save(savepath) + + # Increment count and set whether groups should be shown + count += 1 + if groups_start <= count < groups_stop: + groups_visible = True + else: + groups_visible = False + + fbo.delete() + +class CkgDisplayGroup: + + DEFAULTS = {'pre': 0, 'disp': 'Infinity', 'post': 0} + + def __init__(self, **keywords): + """Create a new group of shapes to be displayed together. + + pre -- time in seconds a blank screen is shown before + shapes in group are displayed + + disp -- time in seconds the shapes in the group are displayed, + negative numbers result in shapes being displayed forever + + post -- time in seconds a blank screen is shown after + shapes in group are displayed + + """ + for kw in self.__class__.DEFAULTS.keys(): + if kw in keywords.keys(): + setattr(self, kw, keywords[kw]) + else: + setattr(self, kw, self.__class__.DEFAULTS[kw]) + self.shapes = [] + self.reset() + + def __setattr__(self, name, value): + if name in self.__class__.DEFAULTS: + value = to_decimal(value) + self.__dict__[name] = value + + def duration(self): + """Returns total duration of display group.""" + return self.pre + self.disp + self.post + + def reset(self): + """Resets internal count and all contained shapes.""" + self._count = 0 + self._start = self.pre + self._stop = self.pre + self.disp + self._end = self.pre + self.disp + self.post + self.over = False + self.old_visible = False + if self._start == 0 and self._stop > 0: + self.visible = True + else: + self.visible = False + if self._end == 0: + self.over = True + for shape in self.shapes: + shape.reset() + + def draw(self, lazy=False): + """Draws all contained shapes during the appropriate interval.""" + if self.visible: + for shape in self.shapes: + if lazy: + shape.lazydraw() + else: + shape.draw() + + def update(self, **keywords): + """Increments internal count, makes group visible when appropriate.""" + + fps = keywords['fps'] + + if self.visible: + # Set triggers to be sent + for n, shape in enumerate(self.shapes): + if shape.flipped: + signals.set_board_flip(n) + # Update contained shapes + for shape in self.shapes: + shape.update(fps) + + # Increment count and set flags for the next frame + self._count += 1 + self.old_visible = self.visible + if (self._start * fps) <= self._count < (self._stop * fps): + self.visible = True + else: + self.visible = False + if self._count >= (self._end * fps): + self.over = True + else: + self.over = False + + def save(self, document, parent): + """Saves group in specified XML document as child of parent.""" + group_el = document.createElement('group') + parent.appendChild(group_el) + for var in self.__class__.DEFAULTS.keys(): + xml_set(document, group_el, var, repr(getattr(self, var))) + for shape in self.shapes: + shape.save(document, group_el) + + def load(self, element): + """Loads group from XML DOM element.""" + for var in self.__class__.DEFAULTS.keys(): + try: + value = eval(xml_get(element, XML_NAMESPACE, var)) + except IndexError: + print "warning: missing attribute '{0}'".format(var) + value = self.__class__.DEFAULTS[var] + print "using default value '{0}' instead...".format(value) + setattr(self, var, value) + shape_els = [node for node in element.childNodes if + node.localName == 'shape' and + node.namespaceURI == XML_NAMESPACE] + for shape_el in shape_els: + # TODO: Make load code shape-agnostic + new_shape = CheckerBoard() + new_shape.load(shape_el) + self.shapes.append(new_shape) + +class CkgWaitScreen(CkgDisplayGroup): + """Dummy display group, waits for user input to proceed.""" + + DEFAULTS = {'g_keys': (pyglet.window.key.SPACE,), + 'r_keys': (pyglet.window.key.NUM_ENTER, + pyglet.window.key.ENTER), + 'res': CkgProj.DEFAULTS['res'], + 'g_info': "the experiment will start soon", + 'r_info': "press enter when ready", + 'font_color': (0, 0, 0, 255), + 'font_size': 16} + + def __init__(self, **keywords): + """Create an informative waitscreen that proceeds after user input.""" + for kw in self.__class__.DEFAULTS.keys(): + if kw in keywords.keys(): + setattr(self, kw, keywords[kw]) + else: + setattr(self, kw, self.__class__.DEFAULTS[kw]) + self.g_label = pyglet.text.Label(self.g_info, + font_name=SANS_SERIF, + font_size=self.font_size, + color=self.font_color, + bold=True, + x=self.res[0]//2, + y=self.res[1]//8, + anchor_x='center', + anchor_y='center') + self.r_label = pyglet.text.Label(self.r_info, + font_name=SANS_SERIF, + font_size=self.font_size, + color=self.font_color, + bold=True, + x=self.res[0]//2, + y=self.res[1]//8, + anchor_x='center', + anchor_y='center') + self.reset() + + def __setattr__(self, name, value): + self.__dict__[name] = value + + def duration(self): + """Returns zero since wait times are arbitrary.""" + return to_decimal(0) + + def reset(self): + """Resets some flags.""" + self.ready = False + self.over = False + + def draw(self): + """Draw informative text.""" + if not self.ready: + self.r_label.draw() + else: + self.g_label.draw() + + def update(self, **keywords): + """Checks for keypress, sends signal upon end.""" + + keystates = keywords['keystates'] + + if self.r_keys == None: + if max([keystates[key] for key in self.g_keys]): + self.ready = True + self.over = True + elif not self.ready: + if max([keystates[key] for key in self.r_keys]): + self.ready = True + else: + if max([keystates[key] for key in self.g_keys]): + self.over = True + +class CheckerShape: + # Abstract class, to be implemented. + pass + +class CheckerDisc(CheckerShape): + # Circular checker pattern, to be implemented + pass + +class CheckerBoard(CheckerShape): + + DEFAULTS = {'dims': (5, 5), + 'init_unit': (30, 30), 'end_unit': (50, 50), + 'position': (0, 0), 'anchor': 'bottomleft', + 'cols': ((0, 0, 0), (255, 255, 255)), + 'freq': 1, 'phase': 0} + + # TODO: Reimplement mid/center anchor functionality in cool new way + + def __init__(self, **keywords): + for kw in self.__class__.DEFAULTS.keys(): + if kw in keywords.keys(): + setattr(self, kw, keywords[kw]) + else: + setattr(self, kw, self.__class__.DEFAULTS[kw]) + self.reset() + + def __setattr__(self, name, value): + # Type conversions + if name == 'dims': + if len(value) != 2: + raise ValueError + value = tuple([int(x) for x in value]) + elif name in ['init_unit', 'end_unit', 'position']: + if len(value) != 2: + raise ValueError + value = tuple([to_decimal(x) for x in value]) + elif name == 'anchor': + if value not in graphics.locations.keys(): + raise ValueError + elif name == 'cols': + if len(value) != 2: + raise ValueError + for col in value: + if len(col) != 3: + raise ValueError + value = tuple([tuple([int(c) for c in col]) for col in value]) + elif name in ['freq', 'phase']: + value = to_decimal(value) + # Store value + self.__dict__[name] = value + # Recompute if necessary + if name in ['dims', 'init_unit', 'end_unit', + 'position', 'anchor','cols']: + self._computed = False + + def save(self, document, parent): + """Saves board in specified XML document as child of parent.""" + board_el = document.createElement('shape') + board_el.setAttribute('type', 'board') + parent.appendChild(board_el) + for var in self.__class__.DEFAULTS.keys(): + xml_set(document, board_el, var, repr(getattr(self, var))) + + def load(self, element): + """Loads group from XML DOM element.""" + for var in self.__class__.DEFAULTS.keys(): + try: + value = eval(xml_get(element, XML_NAMESPACE, var)) + except IndexError: + print "warning: missing attribute '{0}'".format(var) + value = self.__class__.DEFAULTS[var] + print "using default value '{0}' instead...".format(value) + setattr(self, var, value) + + def reset(self, new_phase=None): + """Resets checkerboard animation back to initial phase.""" + if new_phase == None: + new_phase = self.phase + self._cur_phase = new_phase + self._prev_phase = new_phase + self.flipped = False + self._first_draw = True + if not self._computed: + self.compute() + + def update(self, fps): + """Increase the current phase of the checkerboard animation.""" + self._prev_phase = self._cur_phase + if self.freq != 0: + degs_per_frame = 360 * self.freq / fps + self._cur_phase += degs_per_frame + if self._cur_phase >= 360: + self._cur_phase %= 360 + cur_n = int(self._cur_phase // 180) + prev_n = int(self._prev_phase // 180) + if cur_n != prev_n: + self.flipped = True + else: + self.flipped = False + + def compute(self): + """Computes a model of the checkerboard for drawing later.""" + # Create batches to store model + self._batches = [pyglet.graphics.Batch() for n in range(2)] + + # Calculate size of checkerboard in pixels + self._size = tuple([(y1 + y2) / 2 * n for y1, y2, n in + zip(self.init_unit, self.end_unit, self.dims)]) + + # Calculate unit size gradient + unit_grad = tuple([(2 if (flag == 0) else 1) * + (y2 - y1) / n for y1, y2, n, flag in + zip(self.init_unit, self.end_unit, self.dims, + graphics.locations[self.anchor])]) + + # Set initial values + if PRERENDER_TO_TEXTURE: + init_pos = [(1 - a)* s/to_decimal(2) for s, a in + zip(self._size, graphics.locations[self.anchor])] + else: + init_pos = list(self.position) + init_unit = [c + m/2 for c, m in zip(self.init_unit, unit_grad)] + cur_unit = list(init_unit) + cur_unit_pos = list(init_pos) + + # Add unit cells to batches in nested for loop + for j in range(self.dims[1]): + for i in range(self.dims[0]): + + cur_unit_rect = graphics.Rect(cur_unit_pos, cur_unit, + anchor=self.anchor) + cur_unit_rect.col = self.cols[(i + j) % 2] + cur_unit_rect.add_to_batch(self._batches[0]) + cur_unit_rect.col = self.cols[(i + j + 1) % 2] + cur_unit_rect.add_to_batch(self._batches[1]) + + # Increase x values + cur_unit_pos[0] += \ + graphics.locations[self.anchor][0] * cur_unit[0] + cur_unit[0] += unit_grad[0] + + # Reset x values + cur_unit_pos[0] = init_pos[0] + cur_unit[0] = init_unit[0] + + # Increase y values + cur_unit_pos[1] += \ + graphics.locations[self.anchor][1] * cur_unit[1] + cur_unit[1] += unit_grad[1] + + if PRERENDER_TO_TEXTURE: + # Create textures + int_size = [int(round(s)) for s in self._size] + self._prerenders =\ + [pyglet.image.Texture.create(*int_size) for n in range(2)] + # Set up framebuffer + fbo = graphics.Framebuffer() + for n in range(2): + fbo.attach_texture(self._prerenders[n]) + # Draw batch to texture + fbo.start_render() + self._batches[n].draw() + fbo.end_render() + # Anchor textures for correct blitting later + self._prerenders[n].anchor_x, self._prerenders[n].anchor_y =\ + [int(round((1 - a)* s/to_decimal(2))) for s, a in + zip(self._size, graphics.locations[self.anchor])] + fbo.delete() + # Delete batches since they won't be used + del self._batches + + self._computed = True + + def draw(self, always_compute=False): + """Draws appropriate prerender depending on current phase.""" + if not self._computed or always_compute: + self.compute() + self._cur_phase %= 360 + n = int(self._cur_phase // 180) + if PRERENDER_TO_TEXTURE: + self._prerenders[n].blit(*self.position) + else: + self._batches[n].draw() + + def lazydraw(self): + """Only draws on color reversal.""" + cur_n = int(self._cur_phase // 180) + prev_n = int(self._prev_phase // 180) + if (cur_n != prev_n) or self._first_draw: + self.draw() + if self._first_draw: + self._first_draw = False diff --git a/src/eyetracking.py b/src/eyetracking.py new file mode 100644 index 0000000..1ee9adc --- /dev/null +++ b/src/eyetracking.py @@ -0,0 +1,119 @@ +"""Provides support for CRS VideoEyetracker Toolbox.""" + +import os.path + +try: + import win32com.client + available = True +except ImportError: + available = False + +# COM ProgID of the Toolbox +ProgID = "crsVET.VideoEyeTracker" +# VET application object +VET = None + +class EyetrackingError(Exception): + """Raised when something goes wrong with VET.""" + pass + +if available: + # Try dispatching object, else unavailable + try: + VET = win32com.client.Dispatch(ProgID) + except: + available = False + +if available: + + # For easier access to constants and standardization with MATLAB interface + CRS = win32com.client.constants + + def select_source(user_select = False, path = None): + if user_select: + if not VET.SelectVideoSource(CRS.vsUserSelect, ''): + msg = 'could not select video source' + raise EyetrackingError(msg) + elif path != None: + # Open from file + if not VET.SelectVideoSource(CRS.vsFile, path): + msg = 'could not use path as video source' + raise EyetrackingError(msg) + else: + # Default to 250 Hz High Speed Camera + if not VET.SelectVideoSource(CRS.vsHighSpeedCamera250, ''): + msg = 'could not select video source' + raise EyetrackingError(msg) + + def show_camera(): + VET.CreateCameraScreen(0) + + def quit_camera(): + VET.DestroyCameraScreen() + + def setup(viewing_distance, screen_dims, + fixation_period = None, fixation_range = None): + """Calibrates the display and sets fixation properties.""" + if len(screen_dims) != 2: + msg = 'screen_dims must be a 2-tuple' + raise ValueError(msg) + VET.SetDeviceParameters(CRS.deUser, viewing_distance, + screen_dims[0], screen_dims[1]) + if fixation_period != None: + VET.FixationPeriod = fixation_period + if fixation_range != None: + VET.FixationRange = fixation_range + + def calibrate(path = None): + """Calibrate the subject. + Optionally supply a path with no spaces to a + calibration file to load.""" + if path == None: + if not VET.Calibrate(): + msg = 'calibration failed' + raise EyetrackingError(msg) + else: + if not os.path.isfile(path): + msg = 'specified file does not exist' + raise EyetrackingError(msg) + if not VET.LoadCalibrationFile(path): + msg = 'file could not be loaded' + raise EyetrackingError(msg) + + def is_calibrated(): + if VET.CalibrationStatus()[0] != 0: + return True + else: + return False + + def start(): + """Start tracking the eye.""" + if VET.CalibrationStatus()[0] == 0: + msg = 'subject not yet calibrated' + raise EyetrackingError(msg) + VET.ClearDataBuffer() + VET.StartTracking() + + def stop(): + """Stop tracking the eye.""" + VET.StopTracking() + + def fixating(fix_pos, fix_range): + """Checks whether subject is fixating on specificied location. + + fix_pos -- (x, y) position of desired fixation location in mm + from center of screen + + fix_range -- (width, height) of box surrounding fix_pos within + which fixation is allowed (in mm) + + """ + if VET.CalibrationStatus()[0] == 0: + msg = 'subject not yet calibrated' + raise EyetrackingError(msg) + if VET.FixationLocation.Fixation: + xdiff = abs(VET.FixationLocation.Xposition - fix_pos[0]) + ydiff = abs(VET.FixationLocation.Yposition - fix_pos[1]) + if (xdiff <= fix_range[0]/2) and (ydiff <= fix_range[1]/2): + return True + return False diff --git a/src/graphics.py b/src/graphics.py new file mode 100644 index 0000000..7ce90d9 --- /dev/null +++ b/src/graphics.py @@ -0,0 +1,251 @@ +"""Functions for drawing simple 2D shapes, both onscreen and offscreen.""" + +import ctypes + +import pyglet +from pyglet.gl import * + +if not gl_info.have_extension('GL_EXT_framebuffer_object'): + msg = 'framebuffer extension not available in this OpenGL implementation' + raise NotImplementedError(msg) + +locations = {'topleft': (1, -1), 'topright': (-1, -1), + 'bottomleft': (1, 1), 'bottomright': (-1, 1), + 'midtop': (0, -1), 'midbottom': (0, 1), + 'midleft': (1, 0), 'midright': (-1, 0), + 'center': (0, 0)} + +def set_clear_color(color=(0,)*3): + """Set the color OpenGL contexts such as windows will clear to.""" + clamped_color = [c / 255.0 for c in color if type(c) == int] + glClearColor(*(clamped_color + [1.0])) + +def get_window_texture(window): + """Returns color buffer of the specified window as a Texture.""" + window.switch_to() + Texture = \ + pyglet.image.get_buffer_manager().get_color_buffer().get_texture() + return Texture + +def get_window_image_data(window): + """Returns color buffer of the specified window as ImageData.""" + window.switch_to() + ImageData = \ + pyglet.image.get_buffer_manager().get_color_buffer().get_image_data() + return ImageData + +class FramebufferIncompleteError(Exception): + pass + +class Framebuffer: + + # Warning: not compatible with OpenGL 3.1 because of use of EXT + + def __init__(self, Texture=None): + """Creates a new framebuffer object. Attaches texture if specified.""" + self.id = GLuint() + glGenFramebuffersEXT(1, ctypes.byref(self.id)) + if Texture != None: + self.attach_texture(Texture) + self._rendering = False + + def bind(self): + """Binds framebuffer to current context.""" + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, self.id) + + def unbind(self): + """Unbinds framebuffer from current context.""" + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0) + + def delete(self): + """Deletes framebuffer, after which it cannot be used.""" + self.end_render() + self.unbind() + glDeleteFramebuffersEXT(1, ctypes.byref(self.id)) + + def attach_texture(self, Texture): + """Attaches a texture to the framebuffer as the first color buffer.""" + self.bind() + self.Texture = Texture + glBindTexture(GL_TEXTURE_2D, Texture.id) + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, + GL_COLOR_ATTACHMENT0_EXT, + GL_TEXTURE_2D, Texture.id, 0) + + def set2D(self): + """Sets up the framebuffer for 2D rendering.""" + glMatrixMode(GL_PROJECTION) + glLoadIdentity() + glOrtho(0, self.Texture.width, 0, self.Texture.height, 0, 1) + glDisable(GL_DEPTH_TEST) + glMatrixMode(GL_MODELVIEW) + glLoadIdentity() + # Exact pixelization trick + # glTranslatef(0.5, 0.5, 0) + + def start_render(self, set2D=True): + """Sets up rendering environment. To be called before any drawing.""" + if self._rendering: + return + self.bind() + status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) + if status != GL_FRAMEBUFFER_COMPLETE_EXT: + msg = 'framebuffer incomplete' + raise FramebufferIncompleteError(msg) + glPushAttrib(GL_VIEWPORT_BIT); + glViewport(0, 0, self.Texture.width, self.Texture.height); + if set2D: + self.set2D() + self._rendering = True + + def end_render(self): + """Cleans up rendering environment. To be called after drawing.""" + if not self._rendering: + return + glPopAttrib(); + self.unbind() + self._rendering = False + + def render(self, func, args=[], set2D=True, end=False): + """Calls specified function within the rendering environment.""" + self.start_render(set2D) + func(*args) + if end: + self.end_render() + + def clear(self): + """Clears the framebuffer to the current clear color.""" + glClear(gl.GL_COLOR_BUFFER_BIT) + +class Rect: + + def __init__(self, pos, dims, anchor='bottomleft', col=(255,)*3): + """Creates a rectangle with a position and dimensions. + + pos -- [x,y] position of the origin of the rectangle in its parent + context in pixels. + + dims -- [width,height] dimensions of the rectangle in pixels. + + anchor -- [x,y] relative position of the origin of the rectangle from + the bottom left corner. Common locations can be given as string + constants (e.g. topleft, midbottom, center). + + col -- Color of the rectangle as a 3-tuple. Defaults to white. + + """ + self.pos = [float(p) for p in pos] + self.dims = [float(d) for d in dims] + if type(anchor) == str: + anchor = [(1 - a)* d/2.0 for d, a in + zip(self.dims, locations[anchor])] + self.anchor = [float(a) for a in anchor] + self.col = tuple(col) + self.VertexList = None + + def x(self): + return [self.pos[0] - self.anchor[0], + self.pos[0] - self.anchor[0] + self.dims[0]] + + def y(self): + return [self.pos[1] - self.anchor[1], + self.pos[1] - self.anchor[1] + self.dims[1]] + + def verts(self): + return [(x, y) for x in self.x() for y in self.y()] + + def concat_verts(self): + concat_verts = [] + for vert in self.verts(): + concat_verts += vert + return tuple(concat_verts) + + def draw(self): + """Draws rectangle in the current context.""" + pyglet.graphics.draw_indexed(4, GL_TRIANGLES, + [0, 1, 2, 1, 2, 3], + ('v2f', self.concat_verts()), + ('c3B', self.col * 4)) + + def gl_draw(self): + """Draw using raw OpenGL functions.""" + glBegin(GL_TRIANGLES) + glColor3ub(*self.col) + for i in [0, 1, 2, 1, 2, 3]: + glVertex2f(*self.verts()[i]) + glEnd() + + def add_to_batch(self, Batch): + """Adds rectangle to specified Batch.""" + self.VertexList = Batch.add_indexed(4, GL_TRIANGLES, None, + [0, 1, 2, 1, 2, 3], + ('v2f', self.concat_verts()), + ('c3B', self.col * 4)) + +class Cross: + + def __init__(self, pos, dims, thick=2.0, col=(0,)*3): + """Creates a cross(hair) with a position, dimensions and thickness. + + pos -- [x,y] position of the center of the cross in its parent + context in pixels. + + dims -- [width,height] dimensions of the cross in pixels. + + thick -- Thickness of the cross in pixels + + col -- Color of the rectangle as a 3-tuple. Defaults to white. + + """ + self.pos = [float(p) for p in pos] + self.dims = [float(d) for d in dims] + self.thick = float(thick) + self.col = tuple(col) + self.VertexList = None + + def x(self): + return [self.pos[0] - self.dims[0]/2, + self.pos[0] + self.dims[0]/2] + + def y(self): + return [self.pos[1] - self.dims[1]/2, + self.pos[1] + self.dims[1]/2] + + def x_verts(self): + return [(x, self.pos[1]) for x in self.x()] + + def y_verts(self): + return [(self.pos[0], y) for y in self.y()] + + def verts(self): + return self.x_verts() + self.y_verts() + + def concat_verts(self): + concat_verts = [] + for vert in self.verts(): + concat_verts += vert + return tuple(concat_verts) + + def draw(self): + """Draws rectangle in the current context.""" + glLineWidth(self.thick) + pyglet.graphics.draw(4, GL_LINES, + ('v2f', self.concat_verts()), + ('c3B', self.col * 4)) + glLineWidth(1.0) + + def gl_draw(self): + """Draw using raw OpenGL functions.""" + glLineWidth(self.thick) + glBegin(GL_LINES) + glColor3ub(*self.col) + for vert in self.verts(): + glVertex2f(*vert) + glEnd() + glLineWidth(1.0) + + def add_to_batch(self, Batch): + """Adds cross to specified Batch. Line thickness not supported.""" + self.VertexList = Batch.add(4, GL_LINES, None, + ('v2f', self.concat_verts()), + ('c3B', self.col * 4)) diff --git a/src/priority.py b/src/priority.py new file mode 100644 index 0000000..18be24a --- /dev/null +++ b/src/priority.py @@ -0,0 +1,70 @@ +"""Module for setting process priority. Currently only for Windows.""" + +import os +import sys + +available = {'win32':False, 'cygwin':False, + 'linux2':False, 'darwin':False} + +if sys.platform in ['win32', 'cygwin']: + try: + import win32api + import win32process + import win32con + available[sys.platform] = True + except ImportError: + pass + +if available[sys.platform]: + + def set(level=1, pid=None): + """Sets priority of specified process. + + level -- Can be low, normal, high or realtime. Users should be wary + when using realtime and provide a reliable way to exit the process, + since it may cause input to be dropped and other programs to become + unresponsive. + + pid -- Process id. If None, current process id is used. + + """ + if level in [0,'low','idle']: + set_low(pid) + elif level in [1, 'normal']: + set_normal(pid) + elif level in [2, 'high']: + set_high(pid) + elif level in [3, 'realtime']: + set_realtime(pid) + else: + msg = '{0} is not a valid priority level'.format(level) + raise ValueError(msg) + + if sys.platform in ['win32', 'cygwin']: + + CUR_PID = win32api.GetCurrentProcessId() + + def set_low(pid): + if pid == None: + pid = CUR_PID + handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, pid) + win32process.SetPriorityClass(handle, + win32process.IDLE_PRIORITY_CLASS) + def set_normal(pid): + if pid == None: + pid = CUR_PID + handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, pid) + win32process.SetPriorityClass(handle, + win32process.NORMAL_PRIORITY_CLASS) + def set_high(pid): + if pid == None: + pid = CUR_PID + handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, pid) + win32process.SetPriorityClass(handle, + win32process.HIGH_PRIORITY_CLASS) + def set_realtime(pid): + if pid == None: + pid = CUR_PID + handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, pid) + win32process.SetPriorityClass(handle, + win32process.REALTIME_PRIORITY_CLASS) diff --git a/src/signals.py b/src/signals.py new file mode 100644 index 0000000..a2497f4 --- /dev/null +++ b/src/signals.py @@ -0,0 +1,126 @@ +"""Module for signalling upon stimuli appearance using the serial or +parallel ports.""" + +SERPORT = None +PARPORT = None +STATE = None +OLD_STATE = None +USER_START = 128 # 0b10000000 +BOARD_FLIP = 64 # 0b01000000 +GROUP_START = 32 # 0b00100000 +GROUP_STOP = 16 # 0b00010000 +FIX_START = 4 # 0b00000100 +FIX_STOP = 2 # 0b00000010 + +available = {'serial': False, 'parallel': False} + +try: + import serial + + try: + test_port = serial.Serial(0) + test_port.close() + del test_port + available['serial'] = True + except serial.serialutil.SerialException: + pass +except ImportError: + pass + +try: + import parallel + try: + test_port = parallel.Parallel() + del test_port + available['parallel'] = True + except: + pass +except ImportError: + pass + +if available['serial']: + def ser_init(): + global SERPORT + SERPORT = serial.Serial(0) + + def ser_send(): + global SERPORT + global STATE + if STATE != None: + SERPORT.write(str(STATE)) + + def ser_quit(): + global SERPORT + SERPORT.close() + SERPORT = None + +if available['parallel']: + def par_init(): + global PARPORT + PARPORT = parallel.Parallel() + PARPORT.setData(0) + + def par_send(): + global PARPORT + global STATE + if STATE != None: + PARPORT.setData(STATE) + else: + PARPORT.setData(0) + + def par_quit(): + global PARPORT + PARPORT.setData(0) + PARPORT = None + +def init(sigser, sigpar): + global STATE + global OLD_STATE + STATE = None + OLD_STATE = None + if sigser: + ser_init() + if sigpar: + par_init() + +def set_state(state): + global STATE + global OLD_STATE + OLD_STATE = STATE + STATE = state + +def set_board_flip(board_id): + set_state(BOARD_FLIP + board_id) + +def set_group_start(group_id): + set_state(GROUP_START + group_id) + +def set_group_stop(group_id): + set_state(GROUP_STOP + group_id) + +def set_user_start(): + set_state(USER_START) + +def set_fix_start(): + set_state(FIX_START) + +def set_fix_stop(): + set_state(FIX_STOP) + +def set_null(): + set_state(None) + +def send(sigser, sigpar): + if sigser: + ser_send() + if STATE != OLD_STATE: + if sigpar: + par_send() + +def quit(sigser, sigpar): + set_null() + if sigser: + ser_quit() + if sigpar: + par_quit() + diff --git a/src/utils.py b/src/utils.py new file mode 100644 index 0000000..313649c --- /dev/null +++ b/src/utils.py @@ -0,0 +1,84 @@ +"""Utility functions and classes.""" + +import os +import time +import math +from decimal import * + +def numdigits(x): + """Returns number of digits in a decimal integer.""" + if x == 0: + return 1 + elif x < 0: + x = -x + return int(math.log(x, 10)) + 1 + +def public_dir(obj): + """Returns all 'public' attributes of an object""" + names = dir(obj) + for name in names[:]: + if name[0] == '_' or name[-1] == '_': + names.remove(name) + return names + +def to_decimal(s): + """ValueError raising Decimal converter.""" + try: + return Decimal(s) + except InvalidOperation: + try: + return Decimal(str(s)) + except InvalidOperation: + raise ValueError + +def to_color(s, sep=','): + """Tries to cast a string to a color (3-tuple).""" + c = tuple([int(x) for x in s.split(sep)]) + if len(c) != 3: + raise ValueError + return c + +class Timer: + """High-res timer that should be cross-platform.""" + def __init__(self): + # Assigns appropriate clock function based on OS + if os.name == 'nt': + self.clock = time.clock + self.clock() + elif os.name == 'posix': + self.clock = time.time + self.running = False + + def start(self): + self.start_time = self.clock() + self.running = True + + def stop(self): + if not self.running: + return None + self.stop_time = self.clock() + self.running = False + return self.stop_time - self.start_time + + def elapsed(self): + if not self.running: + return None + cur_time = self.clock() + return cur_time - self.start_time + + def restart(self): + old_start_time = self.start_time + self.start_time = self.clock() + self.running = True + return self.start_time - old_start_time + + def tick(self, fps): + """Limits loop to specified fps. To be placed at start of loop.""" + fps = float(fps) + ret = self.elapsed() + if self.elapsed() != -1: + while self.elapsed() < (1.0 / fps): + pass + self.start() + if ret != -1: + return ret * 1000
quirkey/gembox
3382984bbf098cf73a16d3e94cde1b1e9406426f
Regenerate gemspec for version 0.2.3
diff --git a/gembox.gemspec b/gembox.gemspec index d0ecead..e26bf76 100644 --- a/gembox.gemspec +++ b/gembox.gemspec @@ -1,61 +1,102 @@ +# Generated by jeweler +# DO NOT EDIT THIS FILE DIRECTLY +# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{gembox} - s.version = "0.2.1" + s.version = "0.2.3" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Aaron Quint"] - s.date = %q{2009-08-30} + s.date = %q{2011-01-15} s.default_executable = %q{gembox} s.description = %q{A sinatra based interface for browsing and admiring your gems.} s.email = ["[email protected]"] s.executables = ["gembox"] - s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"] - s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "bin/gembox", "config.ru", "gembox.gemspec", "lib/gembox.rb", "lib/gembox/app.rb", "lib/gembox/extensions.rb", "lib/gembox/gem_list.rb", "lib/gembox/gems.rb", "lib/gembox/view_helpers.rb", "public/images/edit.png", "public/images/folder.png", "public/images/git.gif", "public/images/page.png", "public/images/page_white_text.png", "public/images/rubygems-125x125t.png", "public/javascripts/base.js", "public/javascripts/gembox.js", "public/javascripts/jquery.form.js", "public/javascripts/jquery.js", "public/javascripts/jquery.metadata.js", "public/javascripts/jquery.ui.js", "public/swf/clippy.swf", "views/doc.haml", "views/file_tree.haml", "views/gem.haml", "views/gembox.sass", "views/gems_columns.haml", "views/gems_header.haml", "views/gems_table.haml", "views/index.haml", "views/layout.haml", "views/no_results.haml", "test/test_gembox_app.rb", "test/test_gembox_gems.rb", "test/test_helper.rb"] + s.extra_rdoc_files = [ + "README.rdoc" + ] + s.files = [ + "History.txt", + "Manifest.txt", + "PostInstall.txt", + "README.rdoc", + "Rakefile", + "bin/gembox", + "config.ru", + "gembox.gemspec", + "lib/gembox.rb", + "lib/gembox/app.rb", + "lib/gembox/extensions.rb", + "lib/gembox/gem_list.rb", + "lib/gembox/gems.rb", + "lib/gembox/view_helpers.rb", + "public/images/edit.png", + "public/images/folder.png", + "public/images/git.gif", + "public/images/page.png", + "public/images/page_white_text.png", + "public/images/rubygems-125x125t.png", + "public/javascripts/base.js", + "public/javascripts/gembox.js", + "public/javascripts/jquery.form.js", + "public/javascripts/jquery.js", + "public/javascripts/jquery.metadata.js", + "public/javascripts/jquery.ui.js", + "public/swf/clippy.swf", + "test/.bacon", + "test/test_gembox_app.rb", + "test/test_gembox_gems.rb", + "test/test_helper.rb", + "views/doc.haml", + "views/file_tree.haml", + "views/gem.haml", + "views/gembox.sass", + "views/gems_columns.haml", + "views/gems_header.haml", + "views/gems_table.haml", + "views/index.haml", + "views/layout.haml", + "views/no_results.haml" + ] s.homepage = %q{http://code.quirkey.com/gembox} - s.post_install_message = %q{PostInstall.txt} - s.rdoc_options = ["--main", "README.rdoc"] s.require_paths = ["lib"] s.rubyforge_project = %q{quirkey} - s.rubygems_version = %q{1.3.5} + s.rubygems_version = %q{1.3.7} s.summary = %q{A sinatra based interface for browsing and admiring your gems.} - s.test_files = ["test/test_gembox_app.rb", "test/test_gembox_gems.rb", "test/test_helper.rb"] + s.test_files = [ + "test/test_gembox_app.rb", + "test/test_gembox_gems.rb", + "test/test_helper.rb" + ] if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 3 - if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then - s.add_runtime_dependency(%q<sinatra>, [">= 0.9.2"]) - s.add_runtime_dependency(%q<vegas>, [">= 0.1.0"]) - s.add_runtime_dependency(%q<haml>, [">= 2.0.9"]) + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q<sinatra>, ["~> 1.0"]) + s.add_runtime_dependency(%q<vegas>, ["~> 0.1.0"]) + s.add_runtime_dependency(%q<haml>, ["~> 2.0.9"]) s.add_runtime_dependency(%q<rdoc>, ["= 2.4.3"]) - s.add_runtime_dependency(%q<activesupport>, [">= 2.2.2"]) - s.add_runtime_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) - s.add_development_dependency(%q<newgem>, [">= 1.2.3"]) - s.add_development_dependency(%q<rack-test>, [">= 0.1.0"]) - s.add_development_dependency(%q<hoe>, [">= 1.8.0"]) + s.add_runtime_dependency(%q<activesupport>, ["~> 2.2.2"]) + s.add_runtime_dependency(%q<will_paginate>, ["~> 2.3.7"]) else - s.add_dependency(%q<sinatra>, [">= 0.9.2"]) - s.add_dependency(%q<vegas>, [">= 0.1.0"]) - s.add_dependency(%q<haml>, [">= 2.0.9"]) + s.add_dependency(%q<sinatra>, ["~> 1.0"]) + s.add_dependency(%q<vegas>, ["~> 0.1.0"]) + s.add_dependency(%q<haml>, ["~> 2.0.9"]) s.add_dependency(%q<rdoc>, ["= 2.4.3"]) - s.add_dependency(%q<activesupport>, [">= 2.2.2"]) - s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) - s.add_dependency(%q<newgem>, [">= 1.2.3"]) - s.add_dependency(%q<rack-test>, [">= 0.1.0"]) - s.add_dependency(%q<hoe>, [">= 1.8.0"]) + s.add_dependency(%q<activesupport>, ["~> 2.2.2"]) + s.add_dependency(%q<will_paginate>, ["~> 2.3.7"]) end else - s.add_dependency(%q<sinatra>, [">= 0.9.2"]) - s.add_dependency(%q<vegas>, [">= 0.1.0"]) - s.add_dependency(%q<haml>, [">= 2.0.9"]) + s.add_dependency(%q<sinatra>, ["~> 1.0"]) + s.add_dependency(%q<vegas>, ["~> 0.1.0"]) + s.add_dependency(%q<haml>, ["~> 2.0.9"]) s.add_dependency(%q<rdoc>, ["= 2.4.3"]) - s.add_dependency(%q<activesupport>, [">= 2.2.2"]) - s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) - s.add_dependency(%q<newgem>, [">= 1.2.3"]) - s.add_dependency(%q<rack-test>, [">= 0.1.0"]) - s.add_dependency(%q<hoe>, [">= 1.8.0"]) + s.add_dependency(%q<activesupport>, ["~> 2.2.2"]) + s.add_dependency(%q<will_paginate>, ["~> 2.3.7"]) end end +
quirkey/gembox
431aecc8a009ce8904252e4302cfb4de6658886d
Bump version
diff --git a/History.txt b/History.txt index 5874532..7fb2b0f 100644 --- a/History.txt +++ b/History.txt @@ -1,42 +1,46 @@ +== 0.2.3 2011-01-15 + +* Fixes incompatibility with latest version of will-paginate. + == 0.2.2 2010-04-10 * Fixed sinatra dependency, Thanks Romko Stets! == 0.2.1 2009-08-30 * Typing in an argument in the command line will launch to that specific search: e.g. $ gembox rack #=> opens gembox to the rack page. * If a search exactly matches a gem name it will open that gems info page instead of displaying search results * Updated to latest version of Vegas == 0.2.0 2009-07-06 * Updated to latest version of Vegas for Windows compatability * Links to RDoc should only display if Rdoc actually exists * Format the Gem description with RDoc * Reloads the gem list if the gem dir changes * Minor formatting updates == 0.1.5 2009-05-22 * Fixed the config.ru so gembox can run on passenger [Thanks Lenary] == 0.1.4 2009-04-13 * Using the brand new release of Vegas for the binary == 0.1.3 2009-04-06 * Support/linking to local RDoc files in Gem pages * Added JS so that clippy only loads on mouseover (fixes load issues) * Tests now rely on rack-test instead of sintra/test == 0.1.1 2009-03-04 * 1 minor fix: * Fixed paths so that the binary works correctly == 0.1.0 2009-02-27 * 1 major enhancement: * Initial release
quirkey/gembox
8e4b9ce7fec703365829186e518aeb87df746d7f
Moving to jeweler. Fixed will-paginate issue. Closes #13
diff --git a/Rakefile b/Rakefile index aa1d6d5..33dd2cb 100644 --- a/Rakefile +++ b/Rakefile @@ -1,35 +1,39 @@ -%w[rubygems rake rake/clean fileutils hoe newgem rubigen].each { |f| require f } +%w[rubygems rake rake/clean rake/testtask fileutils].each { |f| require f } require File.dirname(__FILE__) + '/lib/gembox' -# Generate all the Rake tasks -# Run 'rake -T' to see list of generated tasks (from gem root directory) +begin + require 'jeweler' +rescue LoadError + puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler" +end + +Jeweler::Tasks.new do |s| + s.name = %q{gembox} + s.version = Gembox::VERSION + s.authors = ["Aaron Quint"] + s.summary = "A sinatra based interface for browsing and admiring your gems." + s.description = "A sinatra based interface for browsing and admiring your gems." + s.email = ["[email protected]"] + s.homepage = %q{http://code.quirkey.com/gembox} + s.rubyforge_project = %q{quirkey} -$hoe = Hoe.new('gembox', Gembox::VERSION) do |p| - p.developer('Aaron Quint', '[email protected]') - p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n") - p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required - p.rubyforge_name = 'quirkey' - p.summary = p.description = "A sinatra based interface for browsing and admiring your gems." - p.url = ['http://code.quirkey.com/gembox', 'http://github.com/quirkey/gembox'] - p.extra_deps = [ - ['sinatra', '>=0.9.2'], - ['vegas', '>=0.1.0'], - ['haml', '>=2.0.9'], + [ + ['sinatra', '~>1.0'], + ['vegas', '~>0.1.0'], + ['haml', '~>2.0.9'], ['rdoc', '=2.4.3'], - ['activesupport', '>=2.2.2'], - ['will_paginate', '>=2.3.7'] - ] - - p.extra_dev_deps = [ - ['newgem', ">= #{::Newgem::VERSION}"], - ['rack-test', '>=0.1.0'] - ] - - p.clean_globs |= %w[**/.DS_Store tmp *.log] - path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}" - p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc') - p.rsync_args = '-av --delete --ignore-errors' + ['activesupport', '~>2.2.2'], + ['will_paginate', '~>2.3.7'] + ].each do |n, v| + s.add_runtime_dependency(n, v) + end +end + +Jeweler::GemcutterTasks.new + +Rake::TestTask.new do |t| + t.libs << "test" + t.test_files = FileList['test/test*.rb'] + t.verbose = true end -require 'newgem/tasks' # load /tasks/*.rake -Dir['tasks/**/*.rake'].each { |t| load t } diff --git a/lib/gembox.rb b/lib/gembox.rb index 119f220..a135242 100644 --- a/lib/gembox.rb +++ b/lib/gembox.rb @@ -1,20 +1,20 @@ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) require 'rubygems' require 'haml' require 'sass' require 'active_support' require 'rdoc/markup/to_html' -require 'will_paginate/array' +require 'will_paginate' require 'will_paginate/view_helpers' module Gembox - VERSION = '0.2.2' + VERSION = '0.2.3' end require 'gembox/extensions' require 'gembox/gem_list' require 'gembox/gems' require 'gembox/view_helpers' -require 'gembox/app' \ No newline at end of file +require 'gembox/app'
quirkey/gembox
253011e8787b35b4726747bf06c6b6f11feb19a4
New version
diff --git a/Rakefile b/Rakefile index e2c1117..aa1d6d5 100644 --- a/Rakefile +++ b/Rakefile @@ -1,35 +1,35 @@ -%w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f } +%w[rubygems rake rake/clean fileutils hoe newgem rubigen].each { |f| require f } require File.dirname(__FILE__) + '/lib/gembox' # Generate all the Rake tasks # Run 'rake -T' to see list of generated tasks (from gem root directory) $hoe = Hoe.new('gembox', Gembox::VERSION) do |p| p.developer('Aaron Quint', '[email protected]') p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n") p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required p.rubyforge_name = 'quirkey' p.summary = p.description = "A sinatra based interface for browsing and admiring your gems." p.url = ['http://code.quirkey.com/gembox', 'http://github.com/quirkey/gembox'] p.extra_deps = [ ['sinatra', '>=0.9.2'], ['vegas', '>=0.1.0'], ['haml', '>=2.0.9'], ['rdoc', '=2.4.3'], ['activesupport', '>=2.2.2'], - ['mislav-will_paginate', '>=2.3.7'] + ['will_paginate', '>=2.3.7'] ] p.extra_dev_deps = [ ['newgem', ">= #{::Newgem::VERSION}"], ['rack-test', '>=0.1.0'] ] p.clean_globs |= %w[**/.DS_Store tmp *.log] path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}" p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc') p.rsync_args = '-av --delete --ignore-errors' end require 'newgem/tasks' # load /tasks/*.rake Dir['tasks/**/*.rake'].each { |t| load t } diff --git a/lib/gembox.rb b/lib/gembox.rb index 6a322f4..119f220 100644 --- a/lib/gembox.rb +++ b/lib/gembox.rb @@ -1,20 +1,20 @@ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) require 'rubygems' require 'haml' require 'sass' require 'active_support' require 'rdoc/markup/to_html' require 'will_paginate/array' require 'will_paginate/view_helpers' module Gembox - VERSION = '0.2.1' + VERSION = '0.2.2' end require 'gembox/extensions' require 'gembox/gem_list' require 'gembox/gems' require 'gembox/view_helpers' require 'gembox/app' \ No newline at end of file
quirkey/gembox
45c2c6f80b418ce9a7b02e8d26e350baa01060c6
- fixed the 'uninitialized constant Sinatra::Default (NameError)' in 'gembox-0.2.1/lib/gembox/app.rb:4' by changing '::Sinatra::Default' to 'Sinatra::Base'
diff --git a/lib/gembox/app.rb b/lib/gembox/app.rb index b76accb..1c16fe6 100644 --- a/lib/gembox/app.rb +++ b/lib/gembox/app.rb @@ -1,96 +1,96 @@ require 'sinatra' module Gembox - class App < ::Sinatra::Default + class App < Sinatra::Base include Gembox::ViewHelpers include WillPaginate::ViewHelpers @@root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) set :root, @@root set :app_file, __FILE__ before do Gembox::Gems.load @gems = Gembox::Gems.local_gems.paginate :page => params[:page], :per_page => 30 @stats = Gembox::Gems.stats @search ||= '' @environment = options.environment end get '/stylesheets/:stylesheet.css' do sass params[:stylesheet].to_sym end get '/' do redirect '/gems' end get %r{/gems/doc/([\w\-\_]+)/?([\d\.]+)?/?(.*)?} do load_gem_by_version @rdoc_path = @gem.rdoc_path if params[:captures].length == 3 && !params[:captures][2].blank? # we have a path full_path = File.join(@rdoc_path, params[:captures].pop) content_type File.extname(full_path) File.read(full_path) else haml :doc, :layout => false end end get %r{/gems/([\w\-\_]+)/?([\d\.]+)?/?} do show_layout = params[:layout] != 'false' load_gem_by_version if params[:file] action = params[:action] || 'view' file_path = File.join(@gem.full_gem_path, params[:file]) if File.readable?(file_path) if action == 'edit' && !production? `$EDITOR #{file_path}` else content_type 'text/plain' return File.read(file_path) end end end haml :gem, :layout => show_layout end get '/gems/?' do show_layout = params[:layout] != 'false' @show_as = params[:as] || 'columns' if @search = params[:search] @gems = Gembox::Gems.search(@search).paginate :page => params[:page] if [email protected]? && gem = @gems.find {|k,v| k.strip == @search.strip } gem = gem[1][0] redirect "/gems/#{gem.name}/#{gem.version}" and return end end haml "gems_#{@show_as}".to_sym, :layout => show_layout end def self.version Gembox::VERSION end private def load_gem_by_version name, version = params[:captures] @gems = Gembox::Gems.search(name, nil, true) raise @gems.inspect if @gems.empty? @gem_versions = @gems[0][1] if version @gems = Gembox::Gems.search(name, version) @gem = @gems.shift[1].first if @gems end if !@gem @gem = @gem_versions.shift redirect "/gems/#{@gem.name}/#{@gem.version}" end end end end \ No newline at end of file
quirkey/gembox
2a4cfc2403d1cdd505249868db6e5f04c0fc66c5
Version Bump v0.2.1
diff --git a/History.txt b/History.txt index 68899f2..5a11b0e 100644 --- a/History.txt +++ b/History.txt @@ -1,31 +1,38 @@ +== 0.2.1 2009-08-30 + +* Typing in an argument in the command line will launch to that specific search: +e.g. $ gembox rack #=> opens gembox to the rack page. +* If a search exactly matches a gem name it will open that gems info page instead of displaying search results +* Updated to latest version of Vegas + == 0.2.0 2009-07-06 * Updated to latest version of Vegas for Windows compatability * Links to RDoc should only display if Rdoc actually exists * Format the Gem description with RDoc * Reloads the gem list if the gem dir changes * Minor formatting updates == 0.1.5 2009-05-22 * Fixed the config.ru so gembox can run on passenger [Thanks Lenary] == 0.1.4 2009-04-13 * Using the brand new release of Vegas for the binary == 0.1.3 2009-04-06 * Support/linking to local RDoc files in Gem pages * Added JS so that clippy only loads on mouseover (fixes load issues) * Tests now rely on rack-test instead of sintra/test == 0.1.1 2009-03-04 * 1 minor fix: * Fixed paths so that the binary works correctly == 0.1.0 2009-02-27 * 1 major enhancement: * Initial release diff --git a/Rakefile b/Rakefile index 503a940..e2c1117 100644 --- a/Rakefile +++ b/Rakefile @@ -1,35 +1,35 @@ -%w[rubygems rake rake/clean fileutils newgem rubigen jeweler].each { |f| require f } +%w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f } require File.dirname(__FILE__) + '/lib/gembox' # Generate all the Rake tasks # Run 'rake -T' to see list of generated tasks (from gem root directory) $hoe = Hoe.new('gembox', Gembox::VERSION) do |p| p.developer('Aaron Quint', '[email protected]') p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n") p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required p.rubyforge_name = 'quirkey' p.summary = p.description = "A sinatra based interface for browsing and admiring your gems." p.url = ['http://code.quirkey.com/gembox', 'http://github.com/quirkey/gembox'] p.extra_deps = [ ['sinatra', '>=0.9.2'], - ['vegas', '>=0.0.3.1'], + ['vegas', '>=0.1.0'], ['haml', '>=2.0.9'], ['rdoc', '=2.4.3'], ['activesupport', '>=2.2.2'], ['mislav-will_paginate', '>=2.3.7'] ] p.extra_dev_deps = [ ['newgem', ">= #{::Newgem::VERSION}"], ['rack-test', '>=0.1.0'] ] p.clean_globs |= %w[**/.DS_Store tmp *.log] path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}" p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc') p.rsync_args = '-av --delete --ignore-errors' end require 'newgem/tasks' # load /tasks/*.rake Dir['tasks/**/*.rake'].each { |t| load t } diff --git a/bin/gembox b/bin/gembox index 5d2b370..c28ec7a 100755 --- a/bin/gembox +++ b/bin/gembox @@ -1,9 +1,11 @@ #!/usr/bin/env ruby # # Created on 2009-2-27. # Copyright (c) 2009. All rights reserved. require File.expand_path(File.dirname(__FILE__) + "/../lib/gembox") require 'vegas' -Vegas::Runner.new(Gembox::App, 'gembox') \ No newline at end of file +Vegas::Runner.new(Gembox::App, 'gembox', { + :launch_path => lambda {|r| r.args.first ? "/gems/?search=#{r.args.first}" : '' } +}) \ No newline at end of file diff --git a/gembox.gemspec b/gembox.gemspec index d3a3f59..d0ecead 100644 --- a/gembox.gemspec +++ b/gembox.gemspec @@ -1,61 +1,61 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{gembox} - s.version = "0.2.0" + s.version = "0.2.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Aaron Quint"] - s.date = %q{2009-07-06} + s.date = %q{2009-08-30} s.default_executable = %q{gembox} s.description = %q{A sinatra based interface for browsing and admiring your gems.} s.email = ["[email protected]"] s.executables = ["gembox"] s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"] s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "bin/gembox", "config.ru", "gembox.gemspec", "lib/gembox.rb", "lib/gembox/app.rb", "lib/gembox/extensions.rb", "lib/gembox/gem_list.rb", "lib/gembox/gems.rb", "lib/gembox/view_helpers.rb", "public/images/edit.png", "public/images/folder.png", "public/images/git.gif", "public/images/page.png", "public/images/page_white_text.png", "public/images/rubygems-125x125t.png", "public/javascripts/base.js", "public/javascripts/gembox.js", "public/javascripts/jquery.form.js", "public/javascripts/jquery.js", "public/javascripts/jquery.metadata.js", "public/javascripts/jquery.ui.js", "public/swf/clippy.swf", "views/doc.haml", "views/file_tree.haml", "views/gem.haml", "views/gembox.sass", "views/gems_columns.haml", "views/gems_header.haml", "views/gems_table.haml", "views/index.haml", "views/layout.haml", "views/no_results.haml", "test/test_gembox_app.rb", "test/test_gembox_gems.rb", "test/test_helper.rb"] s.homepage = %q{http://code.quirkey.com/gembox} s.post_install_message = %q{PostInstall.txt} s.rdoc_options = ["--main", "README.rdoc"] s.require_paths = ["lib"] s.rubyforge_project = %q{quirkey} - s.rubygems_version = %q{1.3.3} + s.rubygems_version = %q{1.3.5} s.summary = %q{A sinatra based interface for browsing and admiring your gems.} s.test_files = ["test/test_gembox_app.rb", "test/test_gembox_gems.rb", "test/test_helper.rb"] if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 3 if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<sinatra>, [">= 0.9.2"]) - s.add_runtime_dependency(%q<vegas>, [">= 0.0.3.1"]) + s.add_runtime_dependency(%q<vegas>, [">= 0.1.0"]) s.add_runtime_dependency(%q<haml>, [">= 2.0.9"]) s.add_runtime_dependency(%q<rdoc>, ["= 2.4.3"]) s.add_runtime_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_runtime_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) s.add_development_dependency(%q<newgem>, [">= 1.2.3"]) s.add_development_dependency(%q<rack-test>, [">= 0.1.0"]) s.add_development_dependency(%q<hoe>, [">= 1.8.0"]) else s.add_dependency(%q<sinatra>, [">= 0.9.2"]) - s.add_dependency(%q<vegas>, [">= 0.0.3.1"]) + s.add_dependency(%q<vegas>, [">= 0.1.0"]) s.add_dependency(%q<haml>, [">= 2.0.9"]) s.add_dependency(%q<rdoc>, ["= 2.4.3"]) s.add_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) s.add_dependency(%q<newgem>, [">= 1.2.3"]) s.add_dependency(%q<rack-test>, [">= 0.1.0"]) s.add_dependency(%q<hoe>, [">= 1.8.0"]) end else s.add_dependency(%q<sinatra>, [">= 0.9.2"]) - s.add_dependency(%q<vegas>, [">= 0.0.3.1"]) + s.add_dependency(%q<vegas>, [">= 0.1.0"]) s.add_dependency(%q<haml>, [">= 2.0.9"]) s.add_dependency(%q<rdoc>, ["= 2.4.3"]) s.add_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) s.add_dependency(%q<newgem>, [">= 1.2.3"]) s.add_dependency(%q<rack-test>, [">= 0.1.0"]) s.add_dependency(%q<hoe>, [">= 1.8.0"]) end end diff --git a/lib/gembox.rb b/lib/gembox.rb index 60d4fc3..6a322f4 100644 --- a/lib/gembox.rb +++ b/lib/gembox.rb @@ -1,20 +1,20 @@ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) require 'rubygems' require 'haml' require 'sass' require 'active_support' require 'rdoc/markup/to_html' require 'will_paginate/array' require 'will_paginate/view_helpers' module Gembox - VERSION = '0.2.0' + VERSION = '0.2.1' end require 'gembox/extensions' require 'gembox/gem_list' require 'gembox/gems' require 'gembox/view_helpers' require 'gembox/app' \ No newline at end of file diff --git a/lib/gembox/app.rb b/lib/gembox/app.rb index 9860a4e..b76accb 100644 --- a/lib/gembox/app.rb +++ b/lib/gembox/app.rb @@ -1,92 +1,96 @@ require 'sinatra' module Gembox class App < ::Sinatra::Default include Gembox::ViewHelpers include WillPaginate::ViewHelpers @@root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) set :root, @@root set :app_file, __FILE__ before do Gembox::Gems.load @gems = Gembox::Gems.local_gems.paginate :page => params[:page], :per_page => 30 @stats = Gembox::Gems.stats @search ||= '' @environment = options.environment end get '/stylesheets/:stylesheet.css' do sass params[:stylesheet].to_sym end get '/' do redirect '/gems' end get %r{/gems/doc/([\w\-\_]+)/?([\d\.]+)?/?(.*)?} do load_gem_by_version @rdoc_path = @gem.rdoc_path if params[:captures].length == 3 && !params[:captures][2].blank? # we have a path full_path = File.join(@rdoc_path, params[:captures].pop) content_type File.extname(full_path) File.read(full_path) else haml :doc, :layout => false end end get %r{/gems/([\w\-\_]+)/?([\d\.]+)?/?} do show_layout = params[:layout] != 'false' load_gem_by_version if params[:file] action = params[:action] || 'view' file_path = File.join(@gem.full_gem_path, params[:file]) if File.readable?(file_path) if action == 'edit' && !production? `$EDITOR #{file_path}` else content_type 'text/plain' return File.read(file_path) end end end haml :gem, :layout => show_layout end get '/gems/?' do show_layout = params[:layout] != 'false' @show_as = params[:as] || 'columns' if @search = params[:search] - @gems = Gembox::Gems.search(@search).paginate :page => params[:page] + @gems = Gembox::Gems.search(@search).paginate :page => params[:page] + if [email protected]? && gem = @gems.find {|k,v| k.strip == @search.strip } + gem = gem[1][0] + redirect "/gems/#{gem.name}/#{gem.version}" and return + end end haml "gems_#{@show_as}".to_sym, :layout => show_layout end def self.version Gembox::VERSION end private def load_gem_by_version name, version = params[:captures] @gems = Gembox::Gems.search(name, nil, true) raise @gems.inspect if @gems.empty? @gem_versions = @gems[0][1] if version @gems = Gembox::Gems.search(name, version) @gem = @gems.shift[1].first if @gems end if !@gem @gem = @gem_versions.shift redirect "/gems/#{@gem.name}/#{@gem.version}" end end end end \ No newline at end of file diff --git a/test/test_gembox_app.rb b/test/test_gembox_app.rb index 9004e0e..1686557 100644 --- a/test/test_gembox_app.rb +++ b/test/test_gembox_app.rb @@ -1,133 +1,133 @@ require File.join(File.dirname(__FILE__), 'test_helper') describe "Gembox App" do describe 'getting index' do before do get '/' end should "redirect to /gems" do should.be.redirect end end describe 'getting gems' do before do get '/gems' end should 'load the index' do should.be.ok end should "display gem list" do body.should have_element('div#gems') end should "display list of installed gems" do body.should have_element('.gem') end should "display as 4 columns" do body.should have_element('.column') end end describe 'getting gems/ with layout = false' do before do get '/gems/?layout=false' end should "load" do should.be.ok end should "not display layout" do body.should.not have_element('html') end should "display gem list" do html_body.should have_element('#gems') end should "display as 4 columns" do html_body.should have_element('.column') end end describe 'getting gems/ with a simple search' do before do get '/gems/?search=sin' end should "load" do should.be.ok end should "display gem list" do body.should have_element('#gems') end should "display gems that match the search" do body.should have_element('.gem', /sinatra/) end should "not display gems that do not match the search" do body.should.not have_element('.gem', /rack/) end end describe 'getting gems/ with as = table' do before do get '/gems/?layout=false&as=table' end should "load" do should.be.ok end should "not display layout" do body.should.not have_element('html') end should "display as table" do html_body.should have_element('table#gems') html_body.should have_element('table#gems tr.gem') end end describe 'getting gems/:name' do before do get '/gems/sinatra' end should "redirect to most recent version" do should.be.redirect end end describe 'getting gems/name/version' do before do - get '/gems/sinatra/0.9.0.4' + get "/gems/sinatra/#{Sinatra::VERSION}" end should "display dependencies" do body.should have_element('#dependencies .gem', /rack/) end should "display link to gems website" do body.should have_element('a', 'http://sinatra.rubyforge.org') end should "load gem spec specified version" do - body.should have_element('.version', '0.9.0.4') + body.should have_element('.version', Sinatra::VERSION) end should "display links to all versions" do body.should have_element('#versions a') end end end \ No newline at end of file
quirkey/gembox
bc342caf106212621212e4b0419c3f83c89b68cb
New version (0.2.0)
diff --git a/History.txt b/History.txt index 57a74ec..68899f2 100644 --- a/History.txt +++ b/History.txt @@ -1,23 +1,31 @@ +== 0.2.0 2009-07-06 + +* Updated to latest version of Vegas for Windows compatability +* Links to RDoc should only display if Rdoc actually exists +* Format the Gem description with RDoc +* Reloads the gem list if the gem dir changes +* Minor formatting updates + == 0.1.5 2009-05-22 * Fixed the config.ru so gembox can run on passenger [Thanks Lenary] == 0.1.4 2009-04-13 * Using the brand new release of Vegas for the binary == 0.1.3 2009-04-06 * Support/linking to local RDoc files in Gem pages * Added JS so that clippy only loads on mouseover (fixes load issues) * Tests now rely on rack-test instead of sintra/test == 0.1.1 2009-03-04 * 1 minor fix: * Fixed paths so that the binary works correctly == 0.1.0 2009-02-27 * 1 major enhancement: * Initial release diff --git a/Manifest.txt b/Manifest.txt index 7f7fb3c..66164e3 100644 --- a/Manifest.txt +++ b/Manifest.txt @@ -1,39 +1,37 @@ History.txt +Manifest.txt PostInstall.txt README.rdoc Rakefile -config.ru bin/gembox -lib/extensions.rb +config.ru +gembox.gemspec lib/gembox.rb lib/gembox/app.rb +lib/gembox/extensions.rb lib/gembox/gem_list.rb lib/gembox/gems.rb lib/gembox/view_helpers.rb public/images/edit.png public/images/folder.png public/images/git.gif public/images/page.png public/images/page_white_text.png public/images/rubygems-125x125t.png public/javascripts/base.js public/javascripts/gembox.js public/javascripts/jquery.form.js public/javascripts/jquery.js public/javascripts/jquery.metadata.js public/javascripts/jquery.ui.js public/swf/clippy.swf -test/.bacon -test/test_gembox_app.rb -test/test_gembox_gems.rb -test/test_helper.rb views/doc.haml views/file_tree.haml views/gem.haml views/gembox.sass views/gems_columns.haml views/gems_header.haml views/gems_table.haml views/index.haml views/layout.haml views/no_results.haml \ No newline at end of file diff --git a/Rakefile b/Rakefile index d17939f..503a940 100644 --- a/Rakefile +++ b/Rakefile @@ -1,34 +1,35 @@ %w[rubygems rake rake/clean fileutils newgem rubigen jeweler].each { |f| require f } require File.dirname(__FILE__) + '/lib/gembox' # Generate all the Rake tasks # Run 'rake -T' to see list of generated tasks (from gem root directory) $hoe = Hoe.new('gembox', Gembox::VERSION) do |p| p.developer('Aaron Quint', '[email protected]') p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n") p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required p.rubyforge_name = 'quirkey' p.summary = p.description = "A sinatra based interface for browsing and admiring your gems." p.url = ['http://code.quirkey.com/gembox', 'http://github.com/quirkey/gembox'] p.extra_deps = [ ['sinatra', '>=0.9.2'], - ['vegas', '>=0.0.1'], + ['vegas', '>=0.0.3.1'], ['haml', '>=2.0.9'], + ['rdoc', '=2.4.3'], ['activesupport', '>=2.2.2'], ['mislav-will_paginate', '>=2.3.7'] ] p.extra_dev_deps = [ ['newgem', ">= #{::Newgem::VERSION}"], ['rack-test', '>=0.1.0'] ] p.clean_globs |= %w[**/.DS_Store tmp *.log] path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}" p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc') p.rsync_args = '-av --delete --ignore-errors' end require 'newgem/tasks' # load /tasks/*.rake Dir['tasks/**/*.rake'].each { |t| load t } diff --git a/gembox.gemspec b/gembox.gemspec index 6827db6..d3a3f59 100644 --- a/gembox.gemspec +++ b/gembox.gemspec @@ -1,58 +1,61 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{gembox} - s.version = "0.1.5" + s.version = "0.2.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Aaron Quint"] - s.date = %q{2009-05-22} + s.date = %q{2009-07-06} s.default_executable = %q{gembox} s.description = %q{A sinatra based interface for browsing and admiring your gems.} s.email = ["[email protected]"] s.executables = ["gembox"] - s.extra_rdoc_files = ["History.txt", "PostInstall.txt", "README.rdoc"] - s.files = ["History.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "config.ru", "bin/gembox", "lib/extensions.rb", "lib/gembox.rb", "lib/gembox/app.rb", "lib/gembox/gem_list.rb", "lib/gembox/gems.rb", "lib/gembox/view_helpers.rb", "public/images/edit.png", "public/images/folder.png", "public/images/git.gif", "public/images/page.png", "public/images/page_white_text.png", "public/images/rubygems-125x125t.png", "public/javascripts/base.js", "public/javascripts/gembox.js", "public/javascripts/jquery.form.js", "public/javascripts/jquery.js", "public/javascripts/jquery.metadata.js", "public/javascripts/jquery.ui.js", "public/swf/clippy.swf", "test/.bacon", "test/test_gembox_app.rb", "test/test_gembox_gems.rb", "test/test_helper.rb", "views/doc.haml", "views/file_tree.haml", "views/gem.haml", "views/gembox.sass", "views/gems_columns.haml", "views/gems_header.haml", "views/gems_table.haml", "views/index.haml", "views/layout.haml", "views/no_results.haml"] + s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"] + s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "bin/gembox", "config.ru", "gembox.gemspec", "lib/gembox.rb", "lib/gembox/app.rb", "lib/gembox/extensions.rb", "lib/gembox/gem_list.rb", "lib/gembox/gems.rb", "lib/gembox/view_helpers.rb", "public/images/edit.png", "public/images/folder.png", "public/images/git.gif", "public/images/page.png", "public/images/page_white_text.png", "public/images/rubygems-125x125t.png", "public/javascripts/base.js", "public/javascripts/gembox.js", "public/javascripts/jquery.form.js", "public/javascripts/jquery.js", "public/javascripts/jquery.metadata.js", "public/javascripts/jquery.ui.js", "public/swf/clippy.swf", "views/doc.haml", "views/file_tree.haml", "views/gem.haml", "views/gembox.sass", "views/gems_columns.haml", "views/gems_header.haml", "views/gems_table.haml", "views/index.haml", "views/layout.haml", "views/no_results.haml", "test/test_gembox_app.rb", "test/test_gembox_gems.rb", "test/test_helper.rb"] s.homepage = %q{http://code.quirkey.com/gembox} s.post_install_message = %q{PostInstall.txt} s.rdoc_options = ["--main", "README.rdoc"] s.require_paths = ["lib"] s.rubyforge_project = %q{quirkey} s.rubygems_version = %q{1.3.3} s.summary = %q{A sinatra based interface for browsing and admiring your gems.} s.test_files = ["test/test_gembox_app.rb", "test/test_gembox_gems.rb", "test/test_helper.rb"] if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 3 if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<sinatra>, [">= 0.9.2"]) - s.add_runtime_dependency(%q<vegas>, [">= 0.0.1"]) + s.add_runtime_dependency(%q<vegas>, [">= 0.0.3.1"]) s.add_runtime_dependency(%q<haml>, [">= 2.0.9"]) + s.add_runtime_dependency(%q<rdoc>, ["= 2.4.3"]) s.add_runtime_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_runtime_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) s.add_development_dependency(%q<newgem>, [">= 1.2.3"]) s.add_development_dependency(%q<rack-test>, [">= 0.1.0"]) s.add_development_dependency(%q<hoe>, [">= 1.8.0"]) else s.add_dependency(%q<sinatra>, [">= 0.9.2"]) - s.add_dependency(%q<vegas>, [">= 0.0.1"]) + s.add_dependency(%q<vegas>, [">= 0.0.3.1"]) s.add_dependency(%q<haml>, [">= 2.0.9"]) + s.add_dependency(%q<rdoc>, ["= 2.4.3"]) s.add_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) s.add_dependency(%q<newgem>, [">= 1.2.3"]) s.add_dependency(%q<rack-test>, [">= 0.1.0"]) s.add_dependency(%q<hoe>, [">= 1.8.0"]) end else s.add_dependency(%q<sinatra>, [">= 0.9.2"]) - s.add_dependency(%q<vegas>, [">= 0.0.1"]) + s.add_dependency(%q<vegas>, [">= 0.0.3.1"]) s.add_dependency(%q<haml>, [">= 2.0.9"]) + s.add_dependency(%q<rdoc>, ["= 2.4.3"]) s.add_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) s.add_dependency(%q<newgem>, [">= 1.2.3"]) s.add_dependency(%q<rack-test>, [">= 0.1.0"]) s.add_dependency(%q<hoe>, [">= 1.8.0"]) end end diff --git a/lib/gembox.rb b/lib/gembox.rb index cf7c4ec..60d4fc3 100644 --- a/lib/gembox.rb +++ b/lib/gembox.rb @@ -1,20 +1,20 @@ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) require 'rubygems' require 'haml' require 'sass' require 'active_support' require 'rdoc/markup/to_html' require 'will_paginate/array' require 'will_paginate/view_helpers' module Gembox - VERSION = '0.1.5' + VERSION = '0.2.0' end require 'gembox/extensions' require 'gembox/gem_list' require 'gembox/gems' require 'gembox/view_helpers' require 'gembox/app' \ No newline at end of file
quirkey/gembox
23f9b9aa4753b6b44ba31efe1d40f4c9a1d3b197
show newest gem instead of oldest one
diff --git a/lib/gembox/gems.rb b/lib/gembox/gems.rb index de03305..73fae6c 100644 --- a/lib/gembox/gems.rb +++ b/lib/gembox/gems.rb @@ -1,44 +1,44 @@ module Gembox class Gems class << self attr_accessor :source_index def load @source_index ||= ::Gem.source_index local_gems end def local_gems @local_gems ||= group_gems(source_index.gems) end def search(search_term, version = nil, strict = false) version = version ? Gem::Requirement.create(version) : Gem::Requirement.default escaped = Regexp.escape(search_term) regexp = strict ? /^#{escaped}$/ : /#{escaped}/ gems = source_index.search Gem::Dependency.new(regexp, version) group_gems(gems) end def stats num_versions = source_index.length num_gems = local_gems.length - oldest_gem = source_index.min {|a,b| a[1].date <=> b[1].date }.last - {:num_versions => num_versions, :num_gems => num_gems, :oldest_gem => oldest_gem} + newest_gem = source_index.max {|a,b| a[1].date <=> b[1].date }.last + {:num_versions => num_versions, :num_gems => num_gems, :newest_gem => newest_gem} end protected def group_gems(gem_collection) gem_hash = GemList.new gem_collection = gem_collection.values if gem_collection.is_a?(Hash) gem_collection.each do |spec| gem_hash[spec.name] ||= [] gem_hash[spec.name] << spec gem_hash[spec.name].sort! {|a,b| (b.version || 0) <=> (a.version || 0) } end gem_hash.sort {|a, b| a[0].downcase <=> b[0].downcase } end end end -end \ No newline at end of file +end diff --git a/views/layout.haml b/views/layout.haml index 85f4c34..94be6cd 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -1,51 +1,51 @@ %html{:xmlns=> "http://www.w3.org/1999/xhtml", 'xml:lang' => "en", :lang => "en"} %head %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"} %title Gembox %link{'href' => '/stylesheets/gembox.css', 'rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen'} -['jquery', 'jquery.ui', 'jquery.metadata', 'jquery.form', 'base', 'gembox'].each do |jslib| %script{'type' => 'text/javascript', 'src' => "/javascripts/#{jslib}.js"} %body #container #header .contained %img{:src => '/images/rubygems-125x125t.png', :alt => 'Rubygems logo', :id => 'logo'} %h1=link_to('Gembox', '/') #nav .contained .search %form{:method => 'get', :action => '/gems'} %input{:type => 'text', :name => 'search', :value => @search, :class => 'search_field', :tabindex => 1} %input{:type => 'submit', :value => 'Search'} #stats .contained %p You have =@stats[:num_versions] versions of =@stats[:num_gems] gems. - Your oldest gem is - =link_to_gem(@stats[:oldest_gem]) + Your newest gem is + =link_to_gem(@stats[:newest_gem]) from - =ts(@stats[:oldest_gem].date) + =ts(@stats[:newest_gem].date) #main.contained =yield #footer %p.copyright Gembox, developed by =link_to 'Quirkey.', 'http://code.quirkey.com' Powered by =link_to 'Sinatra.', 'http://sinatrarb.com' Running in = @environment mode. %p.copyright Hey! I'm =link_to 'open-source!', 'http://github.com/quirkey/gembox' :erb <script type="text/javascript" charset="utf-8"> jQuery('body').data('sinatra-env', '<%= options.environment %>'); - </script> \ No newline at end of file + </script>
quirkey/gembox
44673f9223b62a404334ce361e3451bffc6414d0
Rdoc only displays if there is an RDOC directory and the has_rdoc? gem spec option is checked. Closes #4
diff --git a/lib/gembox/app.rb b/lib/gembox/app.rb index 1aa35ed..9860a4e 100644 --- a/lib/gembox/app.rb +++ b/lib/gembox/app.rb @@ -1,94 +1,92 @@ require 'sinatra' module Gembox class App < ::Sinatra::Default include Gembox::ViewHelpers include WillPaginate::ViewHelpers @@root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) set :root, @@root set :app_file, __FILE__ before do Gembox::Gems.load @gems = Gembox::Gems.local_gems.paginate :page => params[:page], :per_page => 30 @stats = Gembox::Gems.stats @search ||= '' @environment = options.environment end get '/stylesheets/:stylesheet.css' do sass params[:stylesheet].to_sym end get '/' do redirect '/gems' end get %r{/gems/doc/([\w\-\_]+)/?([\d\.]+)?/?(.*)?} do + load_gem_by_version + @rdoc_path = @gem.rdoc_path if params[:captures].length == 3 && !params[:captures][2].blank? # we have a path - load_gem_by_version - @rdoc_path = File.join(@gem.installation_path, "doc", @gem.full_name, 'rdoc') full_path = File.join(@rdoc_path, params[:captures].pop) content_type File.extname(full_path) File.read(full_path) else - load_gem_by_version - @rdoc_path = File.join(@gem.installation_path, "doc", @gem.full_name, 'rdoc') haml :doc, :layout => false end end get %r{/gems/([\w\-\_]+)/?([\d\.]+)?/?} do show_layout = params[:layout] != 'false' load_gem_by_version if params[:file] action = params[:action] || 'view' file_path = File.join(@gem.full_gem_path, params[:file]) if File.readable?(file_path) if action == 'edit' && !production? `$EDITOR #{file_path}` else content_type 'text/plain' return File.read(file_path) end end end haml :gem, :layout => show_layout end get '/gems/?' do show_layout = params[:layout] != 'false' @show_as = params[:as] || 'columns' if @search = params[:search] @gems = Gembox::Gems.search(@search).paginate :page => params[:page] end haml "gems_#{@show_as}".to_sym, :layout => show_layout end def self.version Gembox::VERSION end private def load_gem_by_version name, version = params[:captures] @gems = Gembox::Gems.search(name, nil, true) raise @gems.inspect if @gems.empty? @gem_versions = @gems[0][1] if version @gems = Gembox::Gems.search(name, version) @gem = @gems.shift[1].first if @gems end if !@gem @gem = @gem_versions.shift redirect "/gems/#{@gem.name}/#{@gem.version}" end end end end \ No newline at end of file diff --git a/lib/gembox/extensions.rb b/lib/gembox/extensions.rb index 0223d15..bb58e7a 100644 --- a/lib/gembox/extensions.rb +++ b/lib/gembox/extensions.rb @@ -1,21 +1,30 @@ module Gem class Specification def files_tree tree = {} files.each do |file| split_dirs = file.split(/\//) keyed_hash = {} split_dirs.reverse.each do |key| keyed_hash = {key => keyed_hash} end tree.deep_merge!(keyed_hash) end tree end def on_github? homepage =~ /github\.com\/([\w\d\-\_]+)\/([\w\d\-\_]+)\/tree/ end + + alias :has_rdoc_checked? :has_rdoc? + def has_rdoc? + has_rdoc_checked? && File.exists?(rdoc_path) + end + + def rdoc_path + File.join(installation_path, 'doc', full_name, 'rdoc') + end end end \ No newline at end of file diff --git a/lib/gembox/gems.rb b/lib/gembox/gems.rb index de03305..0e84e74 100644 --- a/lib/gembox/gems.rb +++ b/lib/gembox/gems.rb @@ -1,44 +1,59 @@ module Gembox class Gems class << self attr_accessor :source_index def load - @source_index ||= ::Gem.source_index + if !@source_index || reload? + @source_index = ::Gem.source_index + end local_gems end def local_gems - @local_gems ||= group_gems(source_index.gems) + if !@local_gems || reload? + @local_gems = group_gems(source_index.gems) + end + @local_gems end def search(search_term, version = nil, strict = false) version = version ? Gem::Requirement.create(version) : Gem::Requirement.default escaped = Regexp.escape(search_term) regexp = strict ? /^#{escaped}$/ : /#{escaped}/ gems = source_index.search Gem::Dependency.new(regexp, version) group_gems(gems) end def stats num_versions = source_index.length num_gems = local_gems.length oldest_gem = source_index.min {|a,b| a[1].date <=> b[1].date }.last {:num_versions => num_versions, :num_gems => num_gems, :oldest_gem => oldest_gem} end protected def group_gems(gem_collection) gem_hash = GemList.new gem_collection = gem_collection.values if gem_collection.is_a?(Hash) gem_collection.each do |spec| gem_hash[spec.name] ||= [] gem_hash[spec.name] << spec gem_hash[spec.name].sort! {|a,b| (b.version || 0) <=> (a.version || 0) } end gem_hash.sort {|a, b| a[0].downcase <=> b[0].downcase } end + + def reload? + @now_mtime = File.mtime(File.join(::Gem.dir, 'gems')) + if @old_mtime != @now_mtime + @old_mtime = @now_mtime + true + else + false + end + end end end end \ No newline at end of file
quirkey/gembox
89247836db2adfeea72d780f87a500e9e20cb34f
Added RDoc formatting for gem description. Closes #6.
diff --git a/lib/gembox.rb b/lib/gembox.rb index 9619db4..cf7c4ec 100644 --- a/lib/gembox.rb +++ b/lib/gembox.rb @@ -1,19 +1,20 @@ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) require 'rubygems' require 'haml' require 'sass' require 'active_support' +require 'rdoc/markup/to_html' require 'will_paginate/array' require 'will_paginate/view_helpers' module Gembox VERSION = '0.1.5' end -require 'extensions' +require 'gembox/extensions' require 'gembox/gem_list' require 'gembox/gems' require 'gembox/view_helpers' require 'gembox/app' \ No newline at end of file diff --git a/lib/extensions.rb b/lib/gembox/extensions.rb similarity index 100% rename from lib/extensions.rb rename to lib/gembox/extensions.rb diff --git a/lib/gembox/view_helpers.rb b/lib/gembox/view_helpers.rb index 2ea04e5..a108a2c 100644 --- a/lib/gembox/view_helpers.rb +++ b/lib/gembox/view_helpers.rb @@ -1,69 +1,74 @@ module Gembox module ViewHelpers def tag_options(options, escape = true) option_string = options.collect {|k,v| %{#{k}="#{v}"}}.join(' ') option_string = " " + option_string unless option_string.blank? end def content_tag(name, content, options, escape = true) tag_options = tag_options(options, escape) if options "<#{name}#{tag_options}>#{content}</#{name}>" end def link_to(text, link = nil, options = {}) link ||= text link = url_for(link) "<a href=\"#{link}\">#{text}</a>" end def link_to_gem(gem, options = {}) text = options[:text] || gem.name version = gem.version if options[:show_version] link_to(text, "/gems/#{gem.name}/#{gem.version}") end def url_for(link_options) case link_options when Hash path = link_options.delete(:path) || request.path_info params.delete('captures') path + '?' + build_query(params.merge(link_options)) else link_options end end def ts(time) time.strftime('%b %d, %Y') if time end + def rdocify(text) + @_rdoc ||= RDoc::Markup::ToHtml.new + @_rdoc.convert(text) + end + def clippy(text, bgcolor='#FFFFFF') html = <<-EOF <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="110" height="14" id="clippy" > <param name="movie" value="/swf/clippy.swf"/> <param name="allowScriptAccess" value="always" /> <param name="quality" value="high" /> <param name="scale" value="noscale" /> <param NAME="FlashVars" value="text=#{text}"> <param name="bgcolor" value="#{bgcolor}"> <embed src="/swf/clippy.swf" width="110" height="14" name="clippy" quality="high" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" FlashVars="text=#{text}" bgcolor="#{bgcolor}" /> </object> EOF end end end \ No newline at end of file diff --git a/views/gem.haml b/views/gem.haml index 76fc267..8083951 100644 --- a/views/gem.haml +++ b/views/gem.haml @@ -1,48 +1,48 @@ #gem %h2 [email protected] %[email protected] - - .description - %[email protected] + - if @gem.description + .description + =rdocify @gem.description .meta %p.authors By [email protected](', ') ='(' + link_to(@gem.email, "mailto:#{@gem.email}") + ')' %p.url Homepage: =link_to(@gem.homepage) -if @gem.has_rdoc? %p.url Docs: =link_to("View Local RDoc", "/gems/doc/#{@gem.name}/#{@gem.version}") -unless @gem.rubyforge_project.blank? %p.url Rubyforge: =link_to("http://rubyforge.org/projects/#{@gem.rubyforge_project}") %p.released Released =ts(@gem.date) %h3.toggler Dependencies #dependencies.toggle_area [email protected] do |dependency| .gem =link_to(dependency.name, "/gems/#{dependency.name}") %span.version=dependency.version_requirements %h3.toggler Other Versions #versions.toggle_area %table %tbody -@gem_versions.each do |spec| %tr %td=link_to(spec.version, "/gems/#{spec.name}/#{spec.version}") %td=ts(spec.date) %h3.toggler Files #files.toggle_area %ul.files =haml(:file_tree, :locals => {:dir => '/', :files => {}, :parent => ''}, :layout => false) [email protected]_tree.each do |dir, files| =haml(:file_tree, :locals => {:dir => dir, :files => files, :parent => dir}, :layout => false) \ No newline at end of file
quirkey/gembox
0e83224d34734ea2f2d8337f289941902b469a7a
Fixed link to sinatrarb (whoops!) Added display of mode in footer.
diff --git a/lib/gembox/app.rb b/lib/gembox/app.rb index 792ad7c..1aa35ed 100644 --- a/lib/gembox/app.rb +++ b/lib/gembox/app.rb @@ -1,93 +1,94 @@ require 'sinatra' module Gembox class App < ::Sinatra::Default include Gembox::ViewHelpers include WillPaginate::ViewHelpers @@root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) set :root, @@root set :app_file, __FILE__ before do Gembox::Gems.load @gems = Gembox::Gems.local_gems.paginate :page => params[:page], :per_page => 30 @stats = Gembox::Gems.stats @search ||= '' + @environment = options.environment end get '/stylesheets/:stylesheet.css' do sass params[:stylesheet].to_sym end get '/' do redirect '/gems' end get %r{/gems/doc/([\w\-\_]+)/?([\d\.]+)?/?(.*)?} do if params[:captures].length == 3 && !params[:captures][2].blank? # we have a path load_gem_by_version @rdoc_path = File.join(@gem.installation_path, "doc", @gem.full_name, 'rdoc') full_path = File.join(@rdoc_path, params[:captures].pop) content_type File.extname(full_path) File.read(full_path) else load_gem_by_version @rdoc_path = File.join(@gem.installation_path, "doc", @gem.full_name, 'rdoc') haml :doc, :layout => false end end get %r{/gems/([\w\-\_]+)/?([\d\.]+)?/?} do show_layout = params[:layout] != 'false' load_gem_by_version if params[:file] action = params[:action] || 'view' file_path = File.join(@gem.full_gem_path, params[:file]) if File.readable?(file_path) if action == 'edit' && !production? `$EDITOR #{file_path}` else content_type 'text/plain' return File.read(file_path) end end end haml :gem, :layout => show_layout end get '/gems/?' do show_layout = params[:layout] != 'false' @show_as = params[:as] || 'columns' if @search = params[:search] @gems = Gembox::Gems.search(@search).paginate :page => params[:page] end haml "gems_#{@show_as}".to_sym, :layout => show_layout end def self.version Gembox::VERSION end private def load_gem_by_version name, version = params[:captures] @gems = Gembox::Gems.search(name, nil, true) raise @gems.inspect if @gems.empty? @gem_versions = @gems[0][1] if version @gems = Gembox::Gems.search(name, version) @gem = @gems.shift[1].first if @gems end if !@gem @gem = @gem_versions.shift redirect "/gems/#{@gem.name}/#{@gem.version}" end end end end \ No newline at end of file diff --git a/views/layout.haml b/views/layout.haml index bb15849..85f4c34 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -1,48 +1,51 @@ %html{:xmlns=> "http://www.w3.org/1999/xhtml", 'xml:lang' => "en", :lang => "en"} %head %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"} %title Gembox %link{'href' => '/stylesheets/gembox.css', 'rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen'} -['jquery', 'jquery.ui', 'jquery.metadata', 'jquery.form', 'base', 'gembox'].each do |jslib| %script{'type' => 'text/javascript', 'src' => "/javascripts/#{jslib}.js"} %body #container #header .contained %img{:src => '/images/rubygems-125x125t.png', :alt => 'Rubygems logo', :id => 'logo'} %h1=link_to('Gembox', '/') #nav .contained .search %form{:method => 'get', :action => '/gems'} %input{:type => 'text', :name => 'search', :value => @search, :class => 'search_field', :tabindex => 1} %input{:type => 'submit', :value => 'Search'} #stats .contained %p You have =@stats[:num_versions] versions of =@stats[:num_gems] gems. Your oldest gem is =link_to_gem(@stats[:oldest_gem]) from =ts(@stats[:oldest_gem].date) #main.contained =yield #footer %p.copyright Gembox, developed by =link_to 'Quirkey.', 'http://code.quirkey.com' Powered by - =link_to 'Sinatra.', 'http://sinatrrb.com' + =link_to 'Sinatra.', 'http://sinatrarb.com' + Running in + = @environment + mode. %p.copyright Hey! I'm =link_to 'open-source!', 'http://github.com/quirkey/gembox' :erb <script type="text/javascript" charset="utf-8"> jQuery('body').data('sinatra-env', '<%= options.environment %>'); </script> \ No newline at end of file
quirkey/gembox
ed4272aed152f7642aaaf28be983996a2e4ad59b
Version Bump after config.ru fix
diff --git a/History.txt b/History.txt index 22c334c..57a74ec 100644 --- a/History.txt +++ b/History.txt @@ -1,19 +1,23 @@ +== 0.1.5 2009-05-22 + +* Fixed the config.ru so gembox can run on passenger [Thanks Lenary] + == 0.1.4 2009-04-13 * Using the brand new release of Vegas for the binary == 0.1.3 2009-04-06 * Support/linking to local RDoc files in Gem pages * Added JS so that clippy only loads on mouseover (fixes load issues) * Tests now rely on rack-test instead of sintra/test == 0.1.1 2009-03-04 * 1 minor fix: * Fixed paths so that the binary works correctly == 0.1.0 2009-02-27 * 1 major enhancement: * Initial release diff --git a/README.rdoc b/README.rdoc index 7599b1b..476d699 100644 --- a/README.rdoc +++ b/README.rdoc @@ -1,35 +1,57 @@ = gembox == DESCRIPTION: Gembox is a little sinatra app that ties in with your local ruby gems to let you browse and learn more about them. Please see the project home page for a full description: http://code.quirkey.com/gembox +=== USAGE: + +==== BASIC: + +Install gembox: + + sudo gem install gembox + +On the command-line: + + $ gembox + +And it should launch gembox in your browser. + +==== WITH PASSENGER: + +To use Gembox with Passenger Pane there are a few simple steps you need to do: + + $ git clone git://github.com/quirkey/gembox.git + $ open ./gembox/ + +Then open up Passenger Pane and drag the open Gembox folder into the list on the left (You'll have to be authenticated). Now browse to http://gembox.local/ and you'll see gembox! I told you it was simple. == LICENSE: (The MIT License) Copyright (c) 2009 Aaron Quint, Quirkey NYC, LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Rakefile b/Rakefile index c756971..d17939f 100644 --- a/Rakefile +++ b/Rakefile @@ -1,34 +1,34 @@ %w[rubygems rake rake/clean fileutils newgem rubigen jeweler].each { |f| require f } require File.dirname(__FILE__) + '/lib/gembox' # Generate all the Rake tasks # Run 'rake -T' to see list of generated tasks (from gem root directory) $hoe = Hoe.new('gembox', Gembox::VERSION) do |p| p.developer('Aaron Quint', '[email protected]') p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n") p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required p.rubyforge_name = 'quirkey' p.summary = p.description = "A sinatra based interface for browsing and admiring your gems." p.url = ['http://code.quirkey.com/gembox', 'http://github.com/quirkey/gembox'] p.extra_deps = [ - ['sinatra', '>=0.9.1'], + ['sinatra', '>=0.9.2'], ['vegas', '>=0.0.1'], ['haml', '>=2.0.9'], ['activesupport', '>=2.2.2'], ['mislav-will_paginate', '>=2.3.7'] ] p.extra_dev_deps = [ ['newgem', ">= #{::Newgem::VERSION}"], ['rack-test', '>=0.1.0'] ] p.clean_globs |= %w[**/.DS_Store tmp *.log] path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}" p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc') p.rsync_args = '-av --delete --ignore-errors' end require 'newgem/tasks' # load /tasks/*.rake Dir['tasks/**/*.rake'].each { |t| load t } diff --git a/gembox.gemspec b/gembox.gemspec index 472f79d..6827db6 100644 --- a/gembox.gemspec +++ b/gembox.gemspec @@ -1,59 +1,58 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{gembox} - s.version = "0.1.4" + s.version = "0.1.5" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Aaron Quint"] - s.date = %q{2009-04-13} + s.date = %q{2009-05-22} s.default_executable = %q{gembox} s.description = %q{A sinatra based interface for browsing and admiring your gems.} s.email = ["[email protected]"] s.executables = ["gembox"] s.extra_rdoc_files = ["History.txt", "PostInstall.txt", "README.rdoc"] - s.files = ["History.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "bin/gembox", "lib/extensions.rb", "lib/gembox.rb", "lib/gembox/app.rb", "lib/gembox/config.ru", "lib/gembox/gem_list.rb", "lib/gembox/gems.rb", "lib/gembox/view_helpers.rb", "public/images/edit.png", "public/images/folder.png", "public/images/git.gif", "public/images/page.png", "public/images/page_white_text.png", "public/images/rubygems-125x125t.png", "public/javascripts/base.js", "public/javascripts/gembox.js", "public/javascripts/jquery.form.js", "public/javascripts/jquery.js", "public/javascripts/jquery.metadata.js", "public/javascripts/jquery.ui.js", "public/swf/clippy.swf", "test/.bacon", "test/test_gembox_app.rb", "test/test_gembox_gems.rb", "test/test_helper.rb", "views/doc.haml", "views/file_tree.haml", "views/gem.haml", "views/gembox.sass", "views/gems_columns.haml", "views/gems_header.haml", "views/gems_table.haml", "views/index.haml", "views/layout.haml", "views/no_results.haml"] - s.has_rdoc = true + s.files = ["History.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "config.ru", "bin/gembox", "lib/extensions.rb", "lib/gembox.rb", "lib/gembox/app.rb", "lib/gembox/gem_list.rb", "lib/gembox/gems.rb", "lib/gembox/view_helpers.rb", "public/images/edit.png", "public/images/folder.png", "public/images/git.gif", "public/images/page.png", "public/images/page_white_text.png", "public/images/rubygems-125x125t.png", "public/javascripts/base.js", "public/javascripts/gembox.js", "public/javascripts/jquery.form.js", "public/javascripts/jquery.js", "public/javascripts/jquery.metadata.js", "public/javascripts/jquery.ui.js", "public/swf/clippy.swf", "test/.bacon", "test/test_gembox_app.rb", "test/test_gembox_gems.rb", "test/test_helper.rb", "views/doc.haml", "views/file_tree.haml", "views/gem.haml", "views/gembox.sass", "views/gems_columns.haml", "views/gems_header.haml", "views/gems_table.haml", "views/index.haml", "views/layout.haml", "views/no_results.haml"] s.homepage = %q{http://code.quirkey.com/gembox} s.post_install_message = %q{PostInstall.txt} s.rdoc_options = ["--main", "README.rdoc"] s.require_paths = ["lib"] s.rubyforge_project = %q{quirkey} - s.rubygems_version = %q{1.3.1} + s.rubygems_version = %q{1.3.3} s.summary = %q{A sinatra based interface for browsing and admiring your gems.} s.test_files = ["test/test_gembox_app.rb", "test/test_gembox_gems.rb", "test/test_helper.rb"] if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION - s.specification_version = 2 + s.specification_version = 3 if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then - s.add_runtime_dependency(%q<sinatra>, [">= 0.9.1"]) + s.add_runtime_dependency(%q<sinatra>, [">= 0.9.2"]) s.add_runtime_dependency(%q<vegas>, [">= 0.0.1"]) s.add_runtime_dependency(%q<haml>, [">= 2.0.9"]) s.add_runtime_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_runtime_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) s.add_development_dependency(%q<newgem>, [">= 1.2.3"]) s.add_development_dependency(%q<rack-test>, [">= 0.1.0"]) s.add_development_dependency(%q<hoe>, [">= 1.8.0"]) else - s.add_dependency(%q<sinatra>, [">= 0.9.1"]) + s.add_dependency(%q<sinatra>, [">= 0.9.2"]) s.add_dependency(%q<vegas>, [">= 0.0.1"]) s.add_dependency(%q<haml>, [">= 2.0.9"]) s.add_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) s.add_dependency(%q<newgem>, [">= 1.2.3"]) s.add_dependency(%q<rack-test>, [">= 0.1.0"]) s.add_dependency(%q<hoe>, [">= 1.8.0"]) end else - s.add_dependency(%q<sinatra>, [">= 0.9.1"]) + s.add_dependency(%q<sinatra>, [">= 0.9.2"]) s.add_dependency(%q<vegas>, [">= 0.0.1"]) s.add_dependency(%q<haml>, [">= 2.0.9"]) s.add_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) s.add_dependency(%q<newgem>, [">= 1.2.3"]) s.add_dependency(%q<rack-test>, [">= 0.1.0"]) s.add_dependency(%q<hoe>, [">= 1.8.0"]) end end diff --git a/lib/gembox.rb b/lib/gembox.rb index a8540a8..9619db4 100644 --- a/lib/gembox.rb +++ b/lib/gembox.rb @@ -1,19 +1,19 @@ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) require 'rubygems' require 'haml' require 'sass' require 'active_support' require 'will_paginate/array' require 'will_paginate/view_helpers' module Gembox - VERSION = '0.1.4' + VERSION = '0.1.5' end require 'extensions' require 'gembox/gem_list' require 'gembox/gems' require 'gembox/view_helpers' require 'gembox/app' \ No newline at end of file
quirkey/gembox
eff9e887cb175eac02f5b90660edf9bf2a4c2747
Fixed/moved the config.ru so its accesible for passenger [thanks Lenary!]
diff --git a/.gitignore b/.gitignore index 5121396..cebbb9a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .DS_Store -pkg/* \ No newline at end of file +pkg/* +_site +_layouts \ No newline at end of file diff --git a/Manifest.txt b/Manifest.txt index e48a698..7f7fb3c 100644 --- a/Manifest.txt +++ b/Manifest.txt @@ -1,39 +1,39 @@ History.txt PostInstall.txt README.rdoc Rakefile +config.ru bin/gembox lib/extensions.rb lib/gembox.rb lib/gembox/app.rb -lib/gembox/config.ru lib/gembox/gem_list.rb lib/gembox/gems.rb lib/gembox/view_helpers.rb public/images/edit.png public/images/folder.png public/images/git.gif public/images/page.png public/images/page_white_text.png public/images/rubygems-125x125t.png public/javascripts/base.js public/javascripts/gembox.js public/javascripts/jquery.form.js public/javascripts/jquery.js public/javascripts/jquery.metadata.js public/javascripts/jquery.ui.js public/swf/clippy.swf test/.bacon test/test_gembox_app.rb test/test_gembox_gems.rb test/test_helper.rb views/doc.haml views/file_tree.haml views/gem.haml views/gembox.sass views/gems_columns.haml views/gems_header.haml views/gems_table.haml views/index.haml views/layout.haml views/no_results.haml \ No newline at end of file diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..6a44768 --- /dev/null +++ b/config.ru @@ -0,0 +1,9 @@ +# To use with thin +# thin start -p PORT -R config.ru +require File.join(File.dirname(__FILE__), 'lib', 'gembox') + +disable :run +Gembox::App.set({ + :environment => :production +}) +run Gembox::App \ No newline at end of file diff --git a/lib/gembox.rb b/lib/gembox.rb index 3ccd834..a8540a8 100644 --- a/lib/gembox.rb +++ b/lib/gembox.rb @@ -1,17 +1,19 @@ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) require 'rubygems' +require 'haml' +require 'sass' require 'active_support' require 'will_paginate/array' require 'will_paginate/view_helpers' module Gembox VERSION = '0.1.4' end require 'extensions' require 'gembox/gem_list' require 'gembox/gems' require 'gembox/view_helpers' require 'gembox/app' \ No newline at end of file diff --git a/lib/gembox/app.rb b/lib/gembox/app.rb index 5ac59f3..792ad7c 100644 --- a/lib/gembox/app.rb +++ b/lib/gembox/app.rb @@ -1,92 +1,93 @@ require 'sinatra' module Gembox class App < ::Sinatra::Default include Gembox::ViewHelpers include WillPaginate::ViewHelpers @@root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) set :root, @@root set :app_file, __FILE__ - + before do Gembox::Gems.load - @gems = Gembox::Gems.local_gems.paginate :page => params[:page], :per_page => 30 + @gems = Gembox::Gems.local_gems.paginate :page => params[:page], :per_page => 30 @stats = Gembox::Gems.stats + @search ||= '' end get '/stylesheets/:stylesheet.css' do sass params[:stylesheet].to_sym end get '/' do redirect '/gems' end get %r{/gems/doc/([\w\-\_]+)/?([\d\.]+)?/?(.*)?} do if params[:captures].length == 3 && !params[:captures][2].blank? # we have a path load_gem_by_version @rdoc_path = File.join(@gem.installation_path, "doc", @gem.full_name, 'rdoc') full_path = File.join(@rdoc_path, params[:captures].pop) content_type File.extname(full_path) File.read(full_path) else load_gem_by_version @rdoc_path = File.join(@gem.installation_path, "doc", @gem.full_name, 'rdoc') haml :doc, :layout => false end end get %r{/gems/([\w\-\_]+)/?([\d\.]+)?/?} do show_layout = params[:layout] != 'false' load_gem_by_version if params[:file] action = params[:action] || 'view' file_path = File.join(@gem.full_gem_path, params[:file]) if File.readable?(file_path) - if action == 'edit' + if action == 'edit' && !production? `$EDITOR #{file_path}` else content_type 'text/plain' return File.read(file_path) end end end haml :gem, :layout => show_layout end get '/gems/?' do show_layout = params[:layout] != 'false' @show_as = params[:as] || 'columns' if @search = params[:search] @gems = Gembox::Gems.search(@search).paginate :page => params[:page] end haml "gems_#{@show_as}".to_sym, :layout => show_layout end def self.version Gembox::VERSION end private def load_gem_by_version name, version = params[:captures] @gems = Gembox::Gems.search(name, nil, true) raise @gems.inspect if @gems.empty? @gem_versions = @gems[0][1] if version @gems = Gembox::Gems.search(name, version) @gem = @gems.shift[1].first if @gems end if !@gem @gem = @gem_versions.shift redirect "/gems/#{@gem.name}/#{@gem.version}" end end end end \ No newline at end of file diff --git a/lib/gembox/config.ru b/lib/gembox/config.ru deleted file mode 100644 index 4267718..0000000 --- a/lib/gembox/config.ru +++ /dev/null @@ -1,8 +0,0 @@ -# To use with thin -# thin start -p PORT -R config.ru - -require File.join(File.dirname(__FILE__), 'gembox') - -disable :run -set :env, :production -run Gembox::App \ No newline at end of file diff --git a/public/javascripts/gembox.js b/public/javascripts/gembox.js index 510bb39..6de411c 100644 --- a/public/javascripts/gembox.js +++ b/public/javascripts/gembox.js @@ -1,75 +1,77 @@ (function($) { $.metadata.setType("attr", "data"); function clippy(path, bgcolor) { return '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' + 'width="110"' + 'height="14"' + 'id="clippy" >' + '<param name="movie" value="/swf/clippy.swf"/>' + '<param name="allowScriptAccess" value="always" />' + '<param name="quality" value="high" />' + '<param name="scale" value="noscale" />' + '<param NAME="FlashVars" value="text=#{text}">' + '<param name="bgcolor" value="' + bgcolor +'">' + '<embed src="/swf/clippy.swf"' + ' width="110"' + ' height="14"' + ' name="clippy"' + ' quality="high"' + ' allowScriptAccess="always"' + ' type="application/x-shockwave-flash"' + ' pluginspage="http://www.macromedia.com/go/getflashplayer"' + ' FlashVars="text='+ path + '"' + ' bgcolor="'+ bgcolor +'"' + '/>' + '</object>'; } Gembox = { initialize: function() { this.setFileHover(); }, setFileHover: function() { $('li.dir').hover( function() { $(this).addClass('file_hover') .children('ul').show(); var $file = $(this).children('.file') var meta = $file.metadata(); if ($file.next('.controls').length > 0) { $file.next('.controls').show(); } else { // build controls var $controls = $('<span class="controls"></span>'); - $('<a><img src="/images/edit.png" alt="Edit"/></a>') - .attr('href', meta.url + '&action=edit') - .appendTo($controls); + if ($('body').data('sinatra-env') != 'production') { + $('<a><img src="/images/edit.png" alt="Edit"/></a>') + .attr('href', meta.url + '&action=edit') + .appendTo($controls); + } if (!meta.subdirs) { $('<a><img src="/images/page_white_text.png" alt="View Raw"/></a>') .attr('href', meta.url + '&action=view') .appendTo($controls); } if (meta.github) { $('<a><img src="/images/git.gif" alt="On Github"/></a>') .attr('href', meta.github) .appendTo($controls); } $(clippy(meta.filename, '#F4F6E6')).appendTo($controls); $file.after($controls); } }, function() { $(this) .children('ul').hide().end() .removeClass('file_hover') .children('.controls').hide(); } ); } }; $(function() { Gembox.initialize(); }); })(jQuery); \ No newline at end of file diff --git a/views/layout.haml b/views/layout.haml index 4fbd152..bb15849 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -1,43 +1,48 @@ %html{:xmlns=> "http://www.w3.org/1999/xhtml", 'xml:lang' => "en", :lang => "en"} %head %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"} %title Gembox %link{'href' => '/stylesheets/gembox.css', 'rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen'} -['jquery', 'jquery.ui', 'jquery.metadata', 'jquery.form', 'base', 'gembox'].each do |jslib| %script{'type' => 'text/javascript', 'src' => "/javascripts/#{jslib}.js"} %body #container #header .contained %img{:src => '/images/rubygems-125x125t.png', :alt => 'Rubygems logo', :id => 'logo'} %h1=link_to('Gembox', '/') #nav .contained .search %form{:method => 'get', :action => '/gems'} %input{:type => 'text', :name => 'search', :value => @search, :class => 'search_field', :tabindex => 1} %input{:type => 'submit', :value => 'Search'} #stats .contained %p You have =@stats[:num_versions] versions of =@stats[:num_gems] gems. Your oldest gem is =link_to_gem(@stats[:oldest_gem]) from =ts(@stats[:oldest_gem].date) #main.contained =yield #footer %p.copyright Gembox, developed by =link_to 'Quirkey.', 'http://code.quirkey.com' Powered by =link_to 'Sinatra.', 'http://sinatrrb.com' %p.copyright Hey! I'm - =link_to 'open-source!', 'http://github.com/quirkey/gembox' \ No newline at end of file + =link_to 'open-source!', 'http://github.com/quirkey/gembox' + + :erb + <script type="text/javascript" charset="utf-8"> + jQuery('body').data('sinatra-env', '<%= options.environment %>'); + </script> \ No newline at end of file
quirkey/gembox
b0ef949e05c52e93c1fcaae872ebb033bf6f473d
Version bump after making use of vegas
diff --git a/History.txt b/History.txt index 522635c..22c334c 100644 --- a/History.txt +++ b/History.txt @@ -1,15 +1,19 @@ +== 0.1.4 2009-04-13 + +* Using the brand new release of Vegas for the binary + == 0.1.3 2009-04-06 * Support/linking to local RDoc files in Gem pages * Added JS so that clippy only loads on mouseover (fixes load issues) * Tests now rely on rack-test instead of sintra/test == 0.1.1 2009-03-04 * 1 minor fix: * Fixed paths so that the binary works correctly == 0.1.0 2009-02-27 * 1 major enhancement: * Initial release diff --git a/Manifest.txt b/Manifest.txt index 283c357..e48a698 100644 --- a/Manifest.txt +++ b/Manifest.txt @@ -1,41 +1,39 @@ History.txt -Manifest.txt PostInstall.txt README.rdoc Rakefile bin/gembox -gembox.gemspec lib/extensions.rb lib/gembox.rb lib/gembox/app.rb lib/gembox/config.ru lib/gembox/gem_list.rb lib/gembox/gems.rb lib/gembox/view_helpers.rb public/images/edit.png public/images/folder.png public/images/git.gif public/images/page.png public/images/page_white_text.png public/images/rubygems-125x125t.png public/javascripts/base.js public/javascripts/gembox.js public/javascripts/jquery.form.js public/javascripts/jquery.js public/javascripts/jquery.metadata.js public/javascripts/jquery.ui.js public/swf/clippy.swf test/.bacon test/test_gembox_app.rb test/test_gembox_gems.rb test/test_helper.rb views/doc.haml views/file_tree.haml views/gem.haml views/gembox.sass views/gems_columns.haml views/gems_header.haml views/gems_table.haml views/index.haml views/layout.haml views/no_results.haml \ No newline at end of file diff --git a/gembox.gemspec b/gembox.gemspec index be2e839..472f79d 100644 --- a/gembox.gemspec +++ b/gembox.gemspec @@ -1,56 +1,59 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{gembox} - s.version = "0.1.3" + s.version = "0.1.4" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Aaron Quint"] - s.date = %q{2009-04-06} + s.date = %q{2009-04-13} s.default_executable = %q{gembox} s.description = %q{A sinatra based interface for browsing and admiring your gems.} s.email = ["[email protected]"] s.executables = ["gembox"] - s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"] - s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "bin/gembox", "gembox.gemspec", "lib/extensions.rb", "lib/gembox.rb", "lib/gembox/app.rb", "lib/gembox/config.ru", "lib/gembox/gem_list.rb", "lib/gembox/gems.rb", "lib/gembox/view_helpers.rb", "public/images/edit.png", "public/images/folder.png", "public/images/git.gif", "public/images/page.png", "public/images/page_white_text.png", "public/images/rubygems-125x125t.png", "public/javascripts/base.js", "public/javascripts/gembox.js", "public/javascripts/jquery.form.js", "public/javascripts/jquery.js", "public/javascripts/jquery.metadata.js", "public/javascripts/jquery.ui.js", "public/swf/clippy.swf", "test/.bacon", "test/test_gembox_app.rb", "test/test_gembox_gems.rb", "test/test_helper.rb", "views/doc.haml", "views/file_tree.haml", "views/gem.haml", "views/gembox.sass", "views/gems_columns.haml", "views/gems_header.haml", "views/gems_table.haml", "views/index.haml", "views/layout.haml", "views/no_results.haml"] + s.extra_rdoc_files = ["History.txt", "PostInstall.txt", "README.rdoc"] + s.files = ["History.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "bin/gembox", "lib/extensions.rb", "lib/gembox.rb", "lib/gembox/app.rb", "lib/gembox/config.ru", "lib/gembox/gem_list.rb", "lib/gembox/gems.rb", "lib/gembox/view_helpers.rb", "public/images/edit.png", "public/images/folder.png", "public/images/git.gif", "public/images/page.png", "public/images/page_white_text.png", "public/images/rubygems-125x125t.png", "public/javascripts/base.js", "public/javascripts/gembox.js", "public/javascripts/jquery.form.js", "public/javascripts/jquery.js", "public/javascripts/jquery.metadata.js", "public/javascripts/jquery.ui.js", "public/swf/clippy.swf", "test/.bacon", "test/test_gembox_app.rb", "test/test_gembox_gems.rb", "test/test_helper.rb", "views/doc.haml", "views/file_tree.haml", "views/gem.haml", "views/gembox.sass", "views/gems_columns.haml", "views/gems_header.haml", "views/gems_table.haml", "views/index.haml", "views/layout.haml", "views/no_results.haml"] s.has_rdoc = true s.homepage = %q{http://code.quirkey.com/gembox} s.post_install_message = %q{PostInstall.txt} s.rdoc_options = ["--main", "README.rdoc"] s.require_paths = ["lib"] s.rubyforge_project = %q{quirkey} s.rubygems_version = %q{1.3.1} s.summary = %q{A sinatra based interface for browsing and admiring your gems.} s.test_files = ["test/test_gembox_app.rb", "test/test_gembox_gems.rb", "test/test_helper.rb"] if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 2 if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<sinatra>, [">= 0.9.1"]) + s.add_runtime_dependency(%q<vegas>, [">= 0.0.1"]) s.add_runtime_dependency(%q<haml>, [">= 2.0.9"]) s.add_runtime_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_runtime_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) s.add_development_dependency(%q<newgem>, [">= 1.2.3"]) s.add_development_dependency(%q<rack-test>, [">= 0.1.0"]) s.add_development_dependency(%q<hoe>, [">= 1.8.0"]) else s.add_dependency(%q<sinatra>, [">= 0.9.1"]) + s.add_dependency(%q<vegas>, [">= 0.0.1"]) s.add_dependency(%q<haml>, [">= 2.0.9"]) s.add_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) s.add_dependency(%q<newgem>, [">= 1.2.3"]) s.add_dependency(%q<rack-test>, [">= 0.1.0"]) s.add_dependency(%q<hoe>, [">= 1.8.0"]) end else s.add_dependency(%q<sinatra>, [">= 0.9.1"]) + s.add_dependency(%q<vegas>, [">= 0.0.1"]) s.add_dependency(%q<haml>, [">= 2.0.9"]) s.add_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) s.add_dependency(%q<newgem>, [">= 1.2.3"]) s.add_dependency(%q<rack-test>, [">= 0.1.0"]) s.add_dependency(%q<hoe>, [">= 1.8.0"]) end end diff --git a/lib/gembox.rb b/lib/gembox.rb index f4f6c2e..3ccd834 100644 --- a/lib/gembox.rb +++ b/lib/gembox.rb @@ -1,17 +1,17 @@ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) require 'rubygems' require 'active_support' require 'will_paginate/array' require 'will_paginate/view_helpers' module Gembox - VERSION = '0.1.3' + VERSION = '0.1.4' end require 'extensions' require 'gembox/gem_list' require 'gembox/gems' require 'gembox/view_helpers' require 'gembox/app' \ No newline at end of file
quirkey/gembox
2cdf485c3af2aecf435b2d079c4f315a8c73eae3
Using Vegas::Runner to run the binary (depends on vegas now)
diff --git a/Rakefile b/Rakefile index 9e96b7c..c756971 100644 --- a/Rakefile +++ b/Rakefile @@ -1,35 +1,34 @@ %w[rubygems rake rake/clean fileutils newgem rubigen jeweler].each { |f| require f } require File.dirname(__FILE__) + '/lib/gembox' -require 'jeweler' - # Generate all the Rake tasks # Run 'rake -T' to see list of generated tasks (from gem root directory) -$hoe = Hoe.new('gembox', Jeweler::Version.new(File.expand_path(File.dirname(__FILE__))).to_s) do |p| +$hoe = Hoe.new('gembox', Gembox::VERSION) do |p| p.developer('Aaron Quint', '[email protected]') p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n") p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required p.rubyforge_name = 'quirkey' p.summary = p.description = "A sinatra based interface for browsing and admiring your gems." p.url = ['http://code.quirkey.com/gembox', 'http://github.com/quirkey/gembox'] p.extra_deps = [ ['sinatra', '>=0.9.1'], + ['vegas', '>=0.0.1'], ['haml', '>=2.0.9'], ['activesupport', '>=2.2.2'], ['mislav-will_paginate', '>=2.3.7'] ] p.extra_dev_deps = [ ['newgem', ">= #{::Newgem::VERSION}"], ['rack-test', '>=0.1.0'] ] p.clean_globs |= %w[**/.DS_Store tmp *.log] path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}" p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc') p.rsync_args = '-av --delete --ignore-errors' end require 'newgem/tasks' # load /tasks/*.rake Dir['tasks/**/*.rake'].each { |t| load t } diff --git a/VERSION.yml b/VERSION.yml deleted file mode 100644 index 2953502..0000000 --- a/VERSION.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -:patch: 3 -:major: 0 -:minor: 1 diff --git a/bin/gembox b/bin/gembox index f5e4cd8..5d2b370 100755 --- a/bin/gembox +++ b/bin/gembox @@ -1,11 +1,9 @@ #!/usr/bin/env ruby # # Created on 2009-2-27. # Copyright (c) 2009. All rights reserved. require File.expand_path(File.dirname(__FILE__) + "/../lib/gembox") +require 'vegas' -Gembox::App.set :app_file, File.expand_path(File.dirname(__FILE__) + "/../lib/gembox/app.rb") -Gembox::App.set :environment, :production -Gembox::App.set :port, 5678 -Gembox::App.run! \ No newline at end of file +Vegas::Runner.new(Gembox::App, 'gembox') \ No newline at end of file diff --git a/lib/gembox.rb b/lib/gembox.rb index 2989627..f4f6c2e 100644 --- a/lib/gembox.rb +++ b/lib/gembox.rb @@ -1,13 +1,17 @@ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) require 'rubygems' require 'active_support' require 'will_paginate/array' require 'will_paginate/view_helpers' +module Gembox + VERSION = '0.1.3' +end + require 'extensions' require 'gembox/gem_list' require 'gembox/gems' require 'gembox/view_helpers' require 'gembox/app' \ No newline at end of file diff --git a/lib/gembox/app.rb b/lib/gembox/app.rb index 696e067..5ac59f3 100644 --- a/lib/gembox/app.rb +++ b/lib/gembox/app.rb @@ -1,87 +1,92 @@ require 'sinatra' module Gembox class App < ::Sinatra::Default include Gembox::ViewHelpers include WillPaginate::ViewHelpers @@root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) set :root, @@root - + set :app_file, __FILE__ + before do Gembox::Gems.load @gems = Gembox::Gems.local_gems.paginate :page => params[:page], :per_page => 30 @stats = Gembox::Gems.stats end get '/stylesheets/:stylesheet.css' do sass params[:stylesheet].to_sym end get '/' do redirect '/gems' end get %r{/gems/doc/([\w\-\_]+)/?([\d\.]+)?/?(.*)?} do if params[:captures].length == 3 && !params[:captures][2].blank? # we have a path load_gem_by_version @rdoc_path = File.join(@gem.installation_path, "doc", @gem.full_name, 'rdoc') full_path = File.join(@rdoc_path, params[:captures].pop) content_type File.extname(full_path) File.read(full_path) else load_gem_by_version @rdoc_path = File.join(@gem.installation_path, "doc", @gem.full_name, 'rdoc') haml :doc, :layout => false end end get %r{/gems/([\w\-\_]+)/?([\d\.]+)?/?} do show_layout = params[:layout] != 'false' load_gem_by_version if params[:file] action = params[:action] || 'view' file_path = File.join(@gem.full_gem_path, params[:file]) if File.readable?(file_path) if action == 'edit' `$EDITOR #{file_path}` else content_type 'text/plain' return File.read(file_path) end end end haml :gem, :layout => show_layout end get '/gems/?' do show_layout = params[:layout] != 'false' @show_as = params[:as] || 'columns' if @search = params[:search] @gems = Gembox::Gems.search(@search).paginate :page => params[:page] end haml "gems_#{@show_as}".to_sym, :layout => show_layout end + def self.version + Gembox::VERSION + end + private def load_gem_by_version name, version = params[:captures] @gems = Gembox::Gems.search(name, nil, true) raise @gems.inspect if @gems.empty? @gem_versions = @gems[0][1] if version @gems = Gembox::Gems.search(name, version) @gem = @gems.shift[1].first if @gems end if !@gem @gem = @gem_versions.shift redirect "/gems/#{@gem.name}/#{@gem.version}" end end end end \ No newline at end of file
quirkey/gembox
ed71ce1ff09ffdc165a8f496d4bd33e42552ce9a
Added strict search option (fixes wrong version # in gem detail page)
diff --git a/lib/gembox/app.rb b/lib/gembox/app.rb index b22c97f..696e067 100644 --- a/lib/gembox/app.rb +++ b/lib/gembox/app.rb @@ -1,87 +1,87 @@ require 'sinatra' module Gembox class App < ::Sinatra::Default include Gembox::ViewHelpers include WillPaginate::ViewHelpers @@root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) set :root, @@root before do Gembox::Gems.load @gems = Gembox::Gems.local_gems.paginate :page => params[:page], :per_page => 30 @stats = Gembox::Gems.stats end get '/stylesheets/:stylesheet.css' do sass params[:stylesheet].to_sym end get '/' do redirect '/gems' end get %r{/gems/doc/([\w\-\_]+)/?([\d\.]+)?/?(.*)?} do if params[:captures].length == 3 && !params[:captures][2].blank? # we have a path load_gem_by_version @rdoc_path = File.join(@gem.installation_path, "doc", @gem.full_name, 'rdoc') full_path = File.join(@rdoc_path, params[:captures].pop) content_type File.extname(full_path) File.read(full_path) else load_gem_by_version @rdoc_path = File.join(@gem.installation_path, "doc", @gem.full_name, 'rdoc') haml :doc, :layout => false end end get %r{/gems/([\w\-\_]+)/?([\d\.]+)?/?} do show_layout = params[:layout] != 'false' load_gem_by_version if params[:file] action = params[:action] || 'view' file_path = File.join(@gem.full_gem_path, params[:file]) if File.readable?(file_path) if action == 'edit' `$EDITOR #{file_path}` else content_type 'text/plain' return File.read(file_path) end end end haml :gem, :layout => show_layout end get '/gems/?' do show_layout = params[:layout] != 'false' @show_as = params[:as] || 'columns' if @search = params[:search] @gems = Gembox::Gems.search(@search).paginate :page => params[:page] end haml "gems_#{@show_as}".to_sym, :layout => show_layout end private def load_gem_by_version name, version = params[:captures] - @gems = Gembox::Gems.search(name) + @gems = Gembox::Gems.search(name, nil, true) raise @gems.inspect if @gems.empty? @gem_versions = @gems[0][1] if version @gems = Gembox::Gems.search(name, version) @gem = @gems.shift[1].first if @gems end if !@gem @gem = @gem_versions.shift redirect "/gems/#{@gem.name}/#{@gem.version}" end end end end \ No newline at end of file
quirkey/gembox
b62e1b0011bff821c212bbea9e72f8088f5a550a
Fixed gemspec
diff --git a/Rakefile b/Rakefile index d2e764b..9e96b7c 100644 --- a/Rakefile +++ b/Rakefile @@ -1,35 +1,35 @@ %w[rubygems rake rake/clean fileutils newgem rubigen jeweler].each { |f| require f } require File.dirname(__FILE__) + '/lib/gembox' require 'jeweler' # Generate all the Rake tasks # Run 'rake -T' to see list of generated tasks (from gem root directory) $hoe = Hoe.new('gembox', Jeweler::Version.new(File.expand_path(File.dirname(__FILE__))).to_s) do |p| p.developer('Aaron Quint', '[email protected]') p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n") p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required p.rubyforge_name = 'quirkey' p.summary = p.description = "A sinatra based interface for browsing and admiring your gems." - p.homepage = 'http://code.quirkey.com/gembox' + p.url = ['http://code.quirkey.com/gembox', 'http://github.com/quirkey/gembox'] p.extra_deps = [ ['sinatra', '>=0.9.1'], ['haml', '>=2.0.9'], ['activesupport', '>=2.2.2'], ['mislav-will_paginate', '>=2.3.7'] ] p.extra_dev_deps = [ ['newgem', ">= #{::Newgem::VERSION}"], ['rack-test', '>=0.1.0'] ] p.clean_globs |= %w[**/.DS_Store tmp *.log] path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}" p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc') p.rsync_args = '-av --delete --ignore-errors' end require 'newgem/tasks' # load /tasks/*.rake Dir['tasks/**/*.rake'].each { |t| load t } diff --git a/gembox.gemspec b/gembox.gemspec index 8f78a10..be2e839 100644 --- a/gembox.gemspec +++ b/gembox.gemspec @@ -1,56 +1,56 @@ -(in /Users/aaronquint/Sites/__active/gembox) # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{gembox} s.version = "0.1.3" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Aaron Quint"] s.date = %q{2009-04-06} s.default_executable = %q{gembox} - s.description = %q{Gembox is a little sinatra app that ties in with your local ruby gems to let you browse and learn more about them. Please see the project home page for a full description: http://code.quirkey.com/gembox} + s.description = %q{A sinatra based interface for browsing and admiring your gems.} s.email = ["[email protected]"] s.executables = ["gembox"] s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"] s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "bin/gembox", "gembox.gemspec", "lib/extensions.rb", "lib/gembox.rb", "lib/gembox/app.rb", "lib/gembox/config.ru", "lib/gembox/gem_list.rb", "lib/gembox/gems.rb", "lib/gembox/view_helpers.rb", "public/images/edit.png", "public/images/folder.png", "public/images/git.gif", "public/images/page.png", "public/images/page_white_text.png", "public/images/rubygems-125x125t.png", "public/javascripts/base.js", "public/javascripts/gembox.js", "public/javascripts/jquery.form.js", "public/javascripts/jquery.js", "public/javascripts/jquery.metadata.js", "public/javascripts/jquery.ui.js", "public/swf/clippy.swf", "test/.bacon", "test/test_gembox_app.rb", "test/test_gembox_gems.rb", "test/test_helper.rb", "views/doc.haml", "views/file_tree.haml", "views/gem.haml", "views/gembox.sass", "views/gems_columns.haml", "views/gems_header.haml", "views/gems_table.haml", "views/index.haml", "views/layout.haml", "views/no_results.haml"] s.has_rdoc = true + s.homepage = %q{http://code.quirkey.com/gembox} s.post_install_message = %q{PostInstall.txt} s.rdoc_options = ["--main", "README.rdoc"] s.require_paths = ["lib"] s.rubyforge_project = %q{quirkey} s.rubygems_version = %q{1.3.1} - s.summary = %q{Gembox is a little sinatra app that ties in with your local ruby gems to let you browse and learn more about them} + s.summary = %q{A sinatra based interface for browsing and admiring your gems.} s.test_files = ["test/test_gembox_app.rb", "test/test_gembox_gems.rb", "test/test_helper.rb"] if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 2 if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<sinatra>, [">= 0.9.1"]) s.add_runtime_dependency(%q<haml>, [">= 2.0.9"]) s.add_runtime_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_runtime_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) s.add_development_dependency(%q<newgem>, [">= 1.2.3"]) s.add_development_dependency(%q<rack-test>, [">= 0.1.0"]) s.add_development_dependency(%q<hoe>, [">= 1.8.0"]) else s.add_dependency(%q<sinatra>, [">= 0.9.1"]) s.add_dependency(%q<haml>, [">= 2.0.9"]) s.add_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) s.add_dependency(%q<newgem>, [">= 1.2.3"]) s.add_dependency(%q<rack-test>, [">= 0.1.0"]) s.add_dependency(%q<hoe>, [">= 1.8.0"]) end else s.add_dependency(%q<sinatra>, [">= 0.9.1"]) s.add_dependency(%q<haml>, [">= 2.0.9"]) s.add_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) s.add_dependency(%q<newgem>, [">= 1.2.3"]) s.add_dependency(%q<rack-test>, [">= 0.1.0"]) s.add_dependency(%q<hoe>, [">= 1.8.0"]) end end diff --git a/lib/gembox/gems.rb b/lib/gembox/gems.rb index 6d221cf..de03305 100644 --- a/lib/gembox/gems.rb +++ b/lib/gembox/gems.rb @@ -1,42 +1,44 @@ module Gembox class Gems class << self attr_accessor :source_index def load @source_index ||= ::Gem.source_index local_gems end def local_gems @local_gems ||= group_gems(source_index.gems) end - def search(search_term, version = nil) + def search(search_term, version = nil, strict = false) version = version ? Gem::Requirement.create(version) : Gem::Requirement.default - gems = source_index.search Gem::Dependency.new(/#{Regexp.escape(search_term)}/, version) + escaped = Regexp.escape(search_term) + regexp = strict ? /^#{escaped}$/ : /#{escaped}/ + gems = source_index.search Gem::Dependency.new(regexp, version) group_gems(gems) end def stats num_versions = source_index.length num_gems = local_gems.length oldest_gem = source_index.min {|a,b| a[1].date <=> b[1].date }.last {:num_versions => num_versions, :num_gems => num_gems, :oldest_gem => oldest_gem} end protected def group_gems(gem_collection) gem_hash = GemList.new gem_collection = gem_collection.values if gem_collection.is_a?(Hash) gem_collection.each do |spec| gem_hash[spec.name] ||= [] gem_hash[spec.name] << spec gem_hash[spec.name].sort! {|a,b| (b.version || 0) <=> (a.version || 0) } end gem_hash.sort {|a, b| a[0].downcase <=> b[0].downcase } end end end end \ No newline at end of file
quirkey/gembox
29aee27266b8a10f709e77d70402336b40624be8
Version bump to 0.1.3
diff --git a/VERSION.yml b/VERSION.yml index e118f7a..2953502 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,4 +1,4 @@ --- +:patch: 3 :major: 0 :minor: 1 -:patch: 2 \ No newline at end of file
quirkey/gembox
336e0130068d4d81057f1b20be06b4663d9caa9d
Fixed display/css for rdoc
diff --git a/views/doc.haml b/views/doc.haml index 5219d12..8376be8 100644 --- a/views/doc.haml +++ b/views/doc.haml @@ -1,16 +1,17 @@ %html{:xmlns=> "http://www.w3.org/1999/xhtml", 'xml:lang' => "en", :lang => "en"} %head %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"} %title Gembox %link{'href' => '/stylesheets/gembox.css', 'rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen'} -['jquery', 'jquery.ui', 'jquery.metadata', 'jquery.form', 'base', 'gembox'].each do |jslib| %script{'type' => 'text/javascript', 'src' => "/javascripts/#{jslib}.js"} %body - #smallnav - .back_link=link_to_gem(@gem, :text => '&laquo Back to Gembox') - .viewing - Viewing RDoc for - [email protected] - &nbsp; - [email protected] - %iframe#docframe{:width => '100%', :height => '100%', :src => "#{request.path_info}/index.html"} \ No newline at end of file + #container + #smallnav + .back_link=link_to_gem(@gem, :text => '&laquo Back to Gembox') + .viewing + Viewing RDoc for + [email protected] + &nbsp; + [email protected] + %iframe#docframe{:src => "#{request.path_info}/index.html"} \ No newline at end of file diff --git a/views/gem.haml b/views/gem.haml index bc66b35..76fc267 100644 --- a/views/gem.haml +++ b/views/gem.haml @@ -1,47 +1,48 @@ #gem %h2 [email protected] %[email protected] .description %[email protected] .meta %p.authors By [email protected](', ') ='(' + link_to(@gem.email, "mailto:#{@gem.email}") + ')' %p.url Homepage: =link_to(@gem.homepage) -if @gem.has_rdoc? %p.url - =link_to("Open RDoc", "/gems/doc/#{@gem.name}/#{@gem.version}") + Docs: + =link_to("View Local RDoc", "/gems/doc/#{@gem.name}/#{@gem.version}") -unless @gem.rubyforge_project.blank? %p.url Rubyforge: =link_to("http://rubyforge.org/projects/#{@gem.rubyforge_project}") %p.released Released =ts(@gem.date) %h3.toggler Dependencies #dependencies.toggle_area [email protected] do |dependency| .gem =link_to(dependency.name, "/gems/#{dependency.name}") %span.version=dependency.version_requirements %h3.toggler Other Versions #versions.toggle_area %table %tbody -@gem_versions.each do |spec| %tr %td=link_to(spec.version, "/gems/#{spec.name}/#{spec.version}") %td=ts(spec.date) %h3.toggler Files #files.toggle_area %ul.files =haml(:file_tree, :locals => {:dir => '/', :files => {}, :parent => ''}, :layout => false) [email protected]_tree.each do |dir, files| =haml(:file_tree, :locals => {:dir => dir, :files => files, :parent => dir}, :layout => false) \ No newline at end of file diff --git a/views/gembox.sass b/views/gembox.sass index cd5a18e..1da6e8f 100644 --- a/views/gembox.sass +++ b/views/gembox.sass @@ -1,171 +1,188 @@ !red = #BA2818 !light_red = #EB9281 !dark_red = #871D1A !light_grey = #CCCCCC !light_grey_bg = #EFEFEF !grey = #666 !highlight = #F4F6E6 !fonts = "'Franklin Gothic', 'Franklin Gothic Medium', Helvetica, sans-serif" // body :font-family = !fonts :background #FFFFFF :margin 0px :padding 0px :text-align center a:link, a:visited :color = !red :text-decoration none a:hover :color = !light_red :text-decoration underline a img :border none .contained :width 960px :margin 0px auto :text-align left :position relative #header .contained :width 250px #logo :position absolute :top -20px :left -135px h1 :color = !dark_red :font-size 50px :margin 20px 0px 0px 0px a :color = !dark_red a:hover :text-decoration none #nav :background = !dark_red :padding 15px .search :margin-top 20px :width 100% :text-align center input :font-family = !fonts :font-size 18px :padding 4px .search_field :width 400px #stats :background = !light_grey_bg :margin 0px 0px 10px 0px :padding 2px p :text-align center :color = !grey #main h2 :position relative span.view_options :font-size 14px :font-weight normal :color = !grey :position absolute :top 5px :right 20px strong :color #333 :font-weight normal .num :color = !light_grey .column :width 460px :float left .gem :font-size 14px :margin 5px 0px :padding 5px 0px .name :font-size 16px :margin 0px :padding 0px 0px 2px 0px .description :font-size 12px :padding 2px 0px :color #999 .versions :color = !light_grey a :color = !grey table#gems :border-collapse collapse :font-size 14px :width 100% th :color = !grey :text-align left :font-size 12px :font-weight normal :border-bottom 1px solid #CCC td :padding 4px 4px 4px 0px :vertical-align top tr.summary td :padding-top 0px #gem .description :font-size 18px :color = #333 .meta :color = !grey ul.files, ul.files li ul :list-style none :font-size 14px :font-weight normal :margin 0px :padding 4px 0px 0px ul.files li :padding 4px 0px li ul li :padding-left 10px img :vertical-align top .controls a :padding 0px 4px 0px 0px .file_hover :background = !highlight .pagination :font-size 12px :color = !grey :width 100% :background = !light_grey_bg :padding 4px :text-align right a :color = !dark_red a, span :padding 0px 4px #footer :margin 20px :padding 10px :border-top = 1px solid !light_grey .copyright :font-size 12px +#smallnav + :background = !dark_red + :text-align center + :width auto + :padding 5px + a + :color #FFF + .back_link + :float left + .viewing + :color = !light_grey +#docframe + :border none + :padding none + :margin none + :width 100% + :height 95% .clear :clear both :line-height 0px :height 0px \ No newline at end of file
quirkey/gembox
8f3247573b2204859b2de0f92622752232c64c97
Fixed Rdoc display - had to do with content type
diff --git a/lib/gembox/app.rb b/lib/gembox/app.rb index b70481d..773b8d2 100644 --- a/lib/gembox/app.rb +++ b/lib/gembox/app.rb @@ -1,87 +1,88 @@ require 'sinatra' module Gembox class App < ::Sinatra::Default include Gembox::ViewHelpers include WillPaginate::ViewHelpers @@root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) set :public, File.join(@@root,'public') set :views, File.join(@@root,'views') before do Gembox::Gems.load @gems = Gembox::Gems.local_gems.paginate :page => params[:page], :per_page => 30 @stats = Gembox::Gems.stats end get '/stylesheets/:stylesheet.css' do sass params[:stylesheet].to_sym end get '/' do redirect '/gems' end get %r{/gems/doc/([\w\-\_]+)/?([\d\.]+)?/?(.*)?} do if params[:captures].length == 3 && !params[:captures][2].blank? # we have a path - @path = params[:captures].pop load_gem_by_version @rdoc_path = File.join(@gem.installation_path, "doc", @gem.full_name, 'rdoc') - File.read(File.join(@rdoc_path, @path)) + full_path = File.join(@rdoc_path, params[:captures].pop) + content_type File.extname(full_path) + File.read(full_path) else load_gem_by_version @rdoc_path = File.join(@gem.installation_path, "doc", @gem.full_name, 'rdoc') haml :doc, :layout => false end end get %r{/gems/([\w\-\_]+)/?([\d\.]+)?/?} do show_layout = params[:layout] != 'false' load_gem_by_version if params[:file] action = params[:action] || 'view' file_path = File.join(@gem.full_gem_path, params[:file]) if File.readable?(file_path) if action == 'edit' `$EDITOR #{file_path}` else - response.headers['Content-type'] = 'text/plain' + content_type 'text/plain' return File.read(file_path) end end end haml :gem, :layout => show_layout end get '/gems/?' do show_layout = params[:layout] != 'false' @show_as = params[:as] || 'columns' if @search = params[:search] @gems = Gembox::Gems.search(@search).paginate :page => params[:page] end haml "gems_#{@show_as}".to_sym, :layout => show_layout end private def load_gem_by_version name, version = params[:captures] @gems = Gembox::Gems.search(name) raise @gems.inspect if @gems.empty? @gem_versions = @gems[0][1] if version @gems = Gembox::Gems.search(name, version) @gem = @gems.shift[1].first if @gems end if !@gem @gem = @gem_versions.shift redirect "/gems/#{@gem.name}/#{@gem.version}" end end end end \ No newline at end of file
quirkey/gembox
1f207f65f550d1cde3e69a22800d8e825fc879d9
Have rdoc displaying, but CSS is wonky
diff --git a/lib/gembox/app.rb b/lib/gembox/app.rb index e3fde76..b70481d 100644 --- a/lib/gembox/app.rb +++ b/lib/gembox/app.rb @@ -1,87 +1,87 @@ require 'sinatra' module Gembox class App < ::Sinatra::Default include Gembox::ViewHelpers include WillPaginate::ViewHelpers @@root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) set :public, File.join(@@root,'public') set :views, File.join(@@root,'views') before do Gembox::Gems.load @gems = Gembox::Gems.local_gems.paginate :page => params[:page], :per_page => 30 @stats = Gembox::Gems.stats end get '/stylesheets/:stylesheet.css' do sass params[:stylesheet].to_sym end get '/' do redirect '/gems' end get %r{/gems/doc/([\w\-\_]+)/?([\d\.]+)?/?(.*)?} do - if params[:captures].length == 3 + if params[:captures].length == 3 && !params[:captures][2].blank? # we have a path @path = params[:captures].pop load_gem_by_version @rdoc_path = File.join(@gem.installation_path, "doc", @gem.full_name, 'rdoc') - File.open(File.join(@rdoc_path, @path)) + File.read(File.join(@rdoc_path, @path)) else load_gem_by_version @rdoc_path = File.join(@gem.installation_path, "doc", @gem.full_name, 'rdoc') haml :doc, :layout => false end end get %r{/gems/([\w\-\_]+)/?([\d\.]+)?/?} do show_layout = params[:layout] != 'false' load_gem_by_version if params[:file] action = params[:action] || 'view' file_path = File.join(@gem.full_gem_path, params[:file]) if File.readable?(file_path) if action == 'edit' `$EDITOR #{file_path}` else response.headers['Content-type'] = 'text/plain' return File.read(file_path) end end end haml :gem, :layout => show_layout end get '/gems/?' do show_layout = params[:layout] != 'false' @show_as = params[:as] || 'columns' if @search = params[:search] @gems = Gembox::Gems.search(@search).paginate :page => params[:page] end haml "gems_#{@show_as}".to_sym, :layout => show_layout end private def load_gem_by_version name, version = params[:captures] @gems = Gembox::Gems.search(name) raise @gems.inspect if @gems.empty? @gem_versions = @gems[0][1] if version @gems = Gembox::Gems.search(name, version) @gem = @gems.shift[1].first if @gems end if !@gem @gem = @gem_versions.shift redirect "/gems/#{@gem.name}/#{@gem.version}" end end end end \ No newline at end of file diff --git a/views/doc.haml b/views/doc.haml index 49dccd7..5219d12 100644 --- a/views/doc.haml +++ b/views/doc.haml @@ -1,16 +1,16 @@ %html{:xmlns=> "http://www.w3.org/1999/xhtml", 'xml:lang' => "en", :lang => "en"} %head %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"} %title Gembox %link{'href' => '/stylesheets/gembox.css', 'rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen'} -['jquery', 'jquery.ui', 'jquery.metadata', 'jquery.form', 'base', 'gembox'].each do |jslib| %script{'type' => 'text/javascript', 'src' => "/javascripts/#{jslib}.js"} %body #smallnav .back_link=link_to_gem(@gem, :text => '&laquo Back to Gembox') .viewing Viewing RDoc for [email protected] &nbsp; [email protected] - %iframe#docframe{:width => '100%', :height => '100%', :src => "#{@rdoc_path}"} \ No newline at end of file + %iframe#docframe{:width => '100%', :height => '100%', :src => "#{request.path_info}/index.html"} \ No newline at end of file
quirkey/gembox
1119e3bae4802f3134b35ccfa19b1f5c640ad33b
Having trouble with wrapping files in a frame
diff --git a/views/doc.haml b/views/doc.haml index efba9d7..49dccd7 100644 --- a/views/doc.haml +++ b/views/doc.haml @@ -1,16 +1,16 @@ %html{:xmlns=> "http://www.w3.org/1999/xhtml", 'xml:lang' => "en", :lang => "en"} %head %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"} %title Gembox %link{'href' => '/stylesheets/gembox.css', 'rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen'} -['jquery', 'jquery.ui', 'jquery.metadata', 'jquery.form', 'base', 'gembox'].each do |jslib| %script{'type' => 'text/javascript', 'src' => "/javascripts/#{jslib}.js"} %body #smallnav .back_link=link_to_gem(@gem, :text => '&laquo Back to Gembox') .viewing Viewing RDoc for [email protected] &nbsp; [email protected] - %iframe#docframe{:width => '100%', :height => '100%', :src => "file://#{@rdoc_path}"} \ No newline at end of file + %iframe#docframe{:width => '100%', :height => '100%', :src => "#{@rdoc_path}"} \ No newline at end of file
quirkey/gembox
c6f8d11b9f7b0c3dad6e5fe99e6afc9232137bf0
Trying to wrap rdoc in a back to gembox thingie
diff --git a/lib/gembox/app.rb b/lib/gembox/app.rb index c62c0fc..e3fde76 100644 --- a/lib/gembox/app.rb +++ b/lib/gembox/app.rb @@ -1,66 +1,87 @@ require 'sinatra' module Gembox class App < ::Sinatra::Default include Gembox::ViewHelpers include WillPaginate::ViewHelpers @@root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) - + set :public, File.join(@@root,'public') set :views, File.join(@@root,'views') before do Gembox::Gems.load @gems = Gembox::Gems.local_gems.paginate :page => params[:page], :per_page => 30 @stats = Gembox::Gems.stats end get '/stylesheets/:stylesheet.css' do sass params[:stylesheet].to_sym end get '/' do redirect '/gems' end - + + get %r{/gems/doc/([\w\-\_]+)/?([\d\.]+)?/?(.*)?} do + if params[:captures].length == 3 + # we have a path + @path = params[:captures].pop + load_gem_by_version + @rdoc_path = File.join(@gem.installation_path, "doc", @gem.full_name, 'rdoc') + File.open(File.join(@rdoc_path, @path)) + else + load_gem_by_version + @rdoc_path = File.join(@gem.installation_path, "doc", @gem.full_name, 'rdoc') + haml :doc, :layout => false + end + end + get %r{/gems/([\w\-\_]+)/?([\d\.]+)?/?} do show_layout = params[:layout] != 'false' - name, version = params[:captures] - @gems = Gembox::Gems.search(name) - raise Sinatra::NotFound if @gems.empty? - @gem_versions = @gems[0][1] - if version - @gems = Gembox::Gems.search(name, version) - @gem = @gems.shift[1].first if @gems - end - if !@gem - @gem = @gem_versions.shift - redirect "/gems/#{@gem.name}/#{@gem.version}" - end + load_gem_by_version if params[:file] - action = params[:action] || view + action = params[:action] || 'view' file_path = File.join(@gem.full_gem_path, params[:file]) if File.readable?(file_path) if action == 'edit' `$EDITOR #{file_path}` else response.headers['Content-type'] = 'text/plain' return File.read(file_path) end end end haml :gem, :layout => show_layout end - + get '/gems/?' do show_layout = params[:layout] != 'false' @show_as = params[:as] || 'columns' if @search = params[:search] @gems = Gembox::Gems.search(@search).paginate :page => params[:page] end haml "gems_#{@show_as}".to_sym, :layout => show_layout end + + private + + def load_gem_by_version + name, version = params[:captures] + @gems = Gembox::Gems.search(name) + raise @gems.inspect if @gems.empty? + @gem_versions = @gems[0][1] + if version + @gems = Gembox::Gems.search(name, version) + @gem = @gems.shift[1].first if @gems + end + if !@gem + @gem = @gem_versions.shift + redirect "/gems/#{@gem.name}/#{@gem.version}" + end + end + end end \ No newline at end of file diff --git a/views/doc.haml b/views/doc.haml new file mode 100644 index 0000000..efba9d7 --- /dev/null +++ b/views/doc.haml @@ -0,0 +1,16 @@ +%html{:xmlns=> "http://www.w3.org/1999/xhtml", 'xml:lang' => "en", :lang => "en"} + %head + %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"} + %title Gembox + %link{'href' => '/stylesheets/gembox.css', 'rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen'} + -['jquery', 'jquery.ui', 'jquery.metadata', 'jquery.form', 'base', 'gembox'].each do |jslib| + %script{'type' => 'text/javascript', 'src' => "/javascripts/#{jslib}.js"} + %body + #smallnav + .back_link=link_to_gem(@gem, :text => '&laquo Back to Gembox') + .viewing + Viewing RDoc for + [email protected] + &nbsp; + [email protected] + %iframe#docframe{:width => '100%', :height => '100%', :src => "file://#{@rdoc_path}"} \ No newline at end of file diff --git a/views/gem.haml b/views/gem.haml index 960e357..bc66b35 100644 --- a/views/gem.haml +++ b/views/gem.haml @@ -1,44 +1,47 @@ #gem %h2 [email protected] %[email protected] .description %[email protected] .meta %p.authors By [email protected](', ') ='(' + link_to(@gem.email, "mailto:#{@gem.email}") + ')' %p.url Homepage: =link_to(@gem.homepage) + -if @gem.has_rdoc? + %p.url + =link_to("Open RDoc", "/gems/doc/#{@gem.name}/#{@gem.version}") -unless @gem.rubyforge_project.blank? %p.url Rubyforge: =link_to("http://rubyforge.org/projects/#{@gem.rubyforge_project}") %p.released Released =ts(@gem.date) %h3.toggler Dependencies #dependencies.toggle_area [email protected] do |dependency| .gem =link_to(dependency.name, "/gems/#{dependency.name}") %span.version=dependency.version_requirements %h3.toggler Other Versions #versions.toggle_area %table %tbody -@gem_versions.each do |spec| %tr %td=link_to(spec.version, "/gems/#{spec.name}/#{spec.version}") %td=ts(spec.date) %h3.toggler Files #files.toggle_area %ul.files =haml(:file_tree, :locals => {:dir => '/', :files => {}, :parent => ''}, :layout => false) [email protected]_tree.each do |dir, files| =haml(:file_tree, :locals => {:dir => dir, :files => files, :parent => dir}, :layout => false) \ No newline at end of file
quirkey/gembox
bb476b3b2edc1b86f3bd05c9c7498904efc86ecb
Fixed paths for action/edit
diff --git a/public/javascripts/gembox.js b/public/javascripts/gembox.js index 06a21a9..510bb39 100644 --- a/public/javascripts/gembox.js +++ b/public/javascripts/gembox.js @@ -1,75 +1,75 @@ (function($) { $.metadata.setType("attr", "data"); function clippy(path, bgcolor) { return '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' + 'width="110"' + 'height="14"' + 'id="clippy" >' + '<param name="movie" value="/swf/clippy.swf"/>' + '<param name="allowScriptAccess" value="always" />' + '<param name="quality" value="high" />' + '<param name="scale" value="noscale" />' + '<param NAME="FlashVars" value="text=#{text}">' + '<param name="bgcolor" value="' + bgcolor +'">' + '<embed src="/swf/clippy.swf"' + ' width="110"' + ' height="14"' + ' name="clippy"' + ' quality="high"' + ' allowScriptAccess="always"' + ' type="application/x-shockwave-flash"' + ' pluginspage="http://www.macromedia.com/go/getflashplayer"' + ' FlashVars="text='+ path + '"' + ' bgcolor="'+ bgcolor +'"' + '/>' + '</object>'; } Gembox = { initialize: function() { this.setFileHover(); }, setFileHover: function() { $('li.dir').hover( function() { $(this).addClass('file_hover') .children('ul').show(); var $file = $(this).children('.file') var meta = $file.metadata(); if ($file.next('.controls').length > 0) { $file.next('.controls').show(); } else { // build controls var $controls = $('<span class="controls"></span>'); $('<a><img src="/images/edit.png" alt="Edit"/></a>') - .attr('href', meta.url + '/edit') + .attr('href', meta.url + '&action=edit') .appendTo($controls); if (!meta.subdirs) { $('<a><img src="/images/page_white_text.png" alt="View Raw"/></a>') - .attr('href', meta.url + '/view') + .attr('href', meta.url + '&action=view') .appendTo($controls); } if (meta.github) { $('<a><img src="/images/git.gif" alt="On Github"/></a>') .attr('href', meta.github) .appendTo($controls); } $(clippy(meta.filename, '#F4F6E6')).appendTo($controls); $file.after($controls); } }, function() { $(this) .children('ul').hide().end() .removeClass('file_hover') .children('.controls').hide(); } ); } }; $(function() { Gembox.initialize(); }); })(jQuery); \ No newline at end of file
quirkey/gembox
13f5dab0a9baa77ff2f56bcd9eb9ac406d130c72
Very much improved file tree - controls load on demand with JS
diff --git a/VERSION.yml b/VERSION.yml index 20ba869..e118f7a 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,4 +1,4 @@ --- -:patch: 2 :major: 0 :minor: 1 +:patch: 2 \ No newline at end of file diff --git a/public/javascripts/gembox.js b/public/javascripts/gembox.js new file mode 100644 index 0000000..06a21a9 --- /dev/null +++ b/public/javascripts/gembox.js @@ -0,0 +1,75 @@ +(function($) { + $.metadata.setType("attr", "data"); + + function clippy(path, bgcolor) { + return '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' + + 'width="110"' + + 'height="14"' + + 'id="clippy" >' + + '<param name="movie" value="/swf/clippy.swf"/>' + + '<param name="allowScriptAccess" value="always" />' + + '<param name="quality" value="high" />' + + '<param name="scale" value="noscale" />' + + '<param NAME="FlashVars" value="text=#{text}">' + + '<param name="bgcolor" value="' + bgcolor +'">' + + '<embed src="/swf/clippy.swf"' + + ' width="110"' + + ' height="14"' + + ' name="clippy"' + + ' quality="high"' + + ' allowScriptAccess="always"' + + ' type="application/x-shockwave-flash"' + + ' pluginspage="http://www.macromedia.com/go/getflashplayer"' + + ' FlashVars="text='+ path + '"' + + ' bgcolor="'+ bgcolor +'"' + + '/>' + + '</object>'; + } + + Gembox = { + initialize: function() { + this.setFileHover(); + }, + setFileHover: function() { + $('li.dir').hover( + function() { + $(this).addClass('file_hover') + .children('ul').show(); + var $file = $(this).children('.file') + var meta = $file.metadata(); + if ($file.next('.controls').length > 0) { + $file.next('.controls').show(); + } else { + // build controls + var $controls = $('<span class="controls"></span>'); + $('<a><img src="/images/edit.png" alt="Edit"/></a>') + .attr('href', meta.url + '/edit') + .appendTo($controls); + if (!meta.subdirs) { + $('<a><img src="/images/page_white_text.png" alt="View Raw"/></a>') + .attr('href', meta.url + '/view') + .appendTo($controls); + } + if (meta.github) { + $('<a><img src="/images/git.gif" alt="On Github"/></a>') + .attr('href', meta.github) + .appendTo($controls); + } + $(clippy(meta.filename, '#F4F6E6')).appendTo($controls); + $file.after($controls); + } + }, + function() { + $(this) + .children('ul').hide().end() + .removeClass('file_hover') + .children('.controls').hide(); + } + ); + } + }; + + $(function() { + Gembox.initialize(); + }); +})(jQuery); \ No newline at end of file diff --git a/views/file_tree.haml b/views/file_tree.haml index acae7d4..ccb338c 100644 --- a/views/file_tree.haml +++ b/views/file_tree.haml @@ -1,12 +1,9 @@ -subdirs = (files && !files.empty?) -%li +%li.dir %img{'src' => "/images/#{(subdirs ? 'folder.png' : 'page.png')}"} - =dir - =link_to('<img src="/images/edit.png" alt="Edit"/>', url_for(:file => parent, :action => 'edit')) - =link_to('<img src="/images/page_white_text.png" alt="View Raw"/>', url_for(:file => parent, :action => 'view')) unless subdirs - =link_to('<img src="/images/git.gif" alt="On Github"/>', "#{@gem.homepage}/blob/master/#{parent}") if @gem.on_github? - =clippy(File.join(@gem.full_gem_path, parent)) + %span.file{'data' => "{subdirs: #{!!subdirs}, filename:\'#{parent}\', url: \'#{url_for(:file => parent)}\', github: #{@gem.on_github? ? "\'" + @gem.homepage + "/blob/master/#{parent}\'" : false}}"} + =dir -if subdirs - %ul + %ul{'style' => 'display:none'} -files.each do |dir, files| =haml(:file_tree, :locals => {:dir => dir, :files => files, :parent => File.join(parent, dir)}, :layout => false) \ No newline at end of file diff --git a/views/gembox.sass b/views/gembox.sass index 51f665c..cd5a18e 100644 --- a/views/gembox.sass +++ b/views/gembox.sass @@ -1,166 +1,171 @@ !red = #BA2818 !light_red = #EB9281 !dark_red = #871D1A !light_grey = #CCCCCC !light_grey_bg = #EFEFEF !grey = #666 +!highlight = #F4F6E6 !fonts = "'Franklin Gothic', 'Franklin Gothic Medium', Helvetica, sans-serif" // body :font-family = !fonts :background #FFFFFF :margin 0px :padding 0px :text-align center a:link, a:visited :color = !red :text-decoration none a:hover :color = !light_red :text-decoration underline a img :border none .contained :width 960px :margin 0px auto :text-align left :position relative #header .contained :width 250px #logo :position absolute :top -20px :left -135px h1 :color = !dark_red :font-size 50px :margin 20px 0px 0px 0px a :color = !dark_red a:hover :text-decoration none #nav :background = !dark_red :padding 15px .search :margin-top 20px :width 100% :text-align center input :font-family = !fonts :font-size 18px :padding 4px .search_field :width 400px #stats :background = !light_grey_bg :margin 0px 0px 10px 0px :padding 2px p :text-align center :color = !grey #main h2 :position relative span.view_options :font-size 14px :font-weight normal :color = !grey :position absolute :top 5px :right 20px strong :color #333 :font-weight normal .num :color = !light_grey .column :width 460px :float left .gem :font-size 14px :margin 5px 0px :padding 5px 0px .name :font-size 16px :margin 0px :padding 0px 0px 2px 0px .description :font-size 12px :padding 2px 0px :color #999 .versions :color = !light_grey a :color = !grey table#gems :border-collapse collapse :font-size 14px :width 100% th :color = !grey :text-align left :font-size 12px :font-weight normal :border-bottom 1px solid #CCC td :padding 4px 4px 4px 0px :vertical-align top tr.summary td :padding-top 0px #gem .description :font-size 18px :color = #333 .meta :color = !grey ul.files, ul.files li ul :list-style none :font-size 14px :font-weight normal :margin 0px :padding 4px 0px 0px ul.files li :padding 4px 0px li ul li :padding-left 10px img :vertical-align top + .controls a + :padding 0px 4px 0px 0px + .file_hover + :background = !highlight .pagination :font-size 12px :color = !grey :width 100% :background = !light_grey_bg :padding 4px :text-align right a :color = !dark_red a, span :padding 0px 4px #footer :margin 20px :padding 10px :border-top = 1px solid !light_grey .copyright :font-size 12px .clear :clear both :line-height 0px :height 0px \ No newline at end of file
quirkey/gembox
30f741f6a7e7f92e643cc0f53e66de5a06102c59
Regenerated gemspec for version 0.1.2
diff --git a/gembox.gemspec b/gembox.gemspec index c0f368a..fb82394 100644 --- a/gembox.gemspec +++ b/gembox.gemspec @@ -1,40 +1,43 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{gembox} - s.version = "0.1.1" + s.version = "0.1.2" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Aaron Quint"] s.date = %q{2009-03-04} s.default_executable = %q{gembox} s.description = %q{A sinatra based interface for browsing and admiring your gems} s.email = %q{[email protected]} s.executables = ["gembox"] s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "VERSION.yml", "bin/gembox", "gembox.gemspec", "lib/extensions.rb", "lib/gembox.rb", "lib/gembox/app.rb", "lib/gembox/config.ru", "lib/gembox/gem_list.rb", "lib/gembox/gems.rb", "lib/gembox/view_helpers.rb", "public/images/edit.png", "public/images/folder.png", "public/images/git.gif", "public/images/page.png", "public/images/page_white_text.png", "public/images/rubygems-125x125t.png", "public/javascripts/base.js", "public/javascripts/jquery.form.js", "public/javascripts/jquery.js", "public/javascripts/jquery.metadata.js", "public/javascripts/jquery.ui.js", "public/swf/clippy.swf", "test/.bacon", "test/test_gembox_app.rb", "test/test_gembox_gems.rb", "test/test_helper.rb", "views/file_tree.haml", "views/gem.haml", "views/gembox.sass", "views/gems_columns.haml", "views/gems_header.haml", "views/gems_table.haml", "views/index.haml", "views/layout.haml", "views/no_results.haml"] s.has_rdoc = true s.homepage = %q{http://github.com/quirkey/gembox} s.rdoc_options = ["--inline-source", "--charset=UTF-8"] s.require_paths = ["lib"] s.rubygems_version = %q{1.3.1} s.summary = %q{A sinatra based interface for browsing and admiring your gems.} if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 2 if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<sinatra>, [">= 0.9.1"]) + s.add_runtime_dependency(%q<haml>, [">= 2.0.9"]) s.add_runtime_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_runtime_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) else s.add_dependency(%q<sinatra>, [">= 0.9.1"]) + s.add_dependency(%q<haml>, [">= 2.0.9"]) s.add_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) end else s.add_dependency(%q<sinatra>, [">= 0.9.1"]) + s.add_dependency(%q<haml>, [">= 2.0.9"]) s.add_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) end end
quirkey/gembox
0423cbbf3138d0dd919005b4f0ef91be9d834a91
Added haml as dependency
diff --git a/Rakefile b/Rakefile index ea32585..a649444 100644 --- a/Rakefile +++ b/Rakefile @@ -1,40 +1,41 @@ %w[rubygems rake rake/clean fileutils newgem rubigen jeweler].each { |f| require f } require File.dirname(__FILE__) + '/lib/gembox' require 'jeweler' Jeweler::Tasks.new do |s| s.name = "gembox" s.summary = "A sinatra based interface for browsing and admiring your gems." s.email = "[email protected]" s.homepage = "http://github.com/quirkey/gembox" s.description = "A sinatra based interface for browsing and admiring your gems" s.authors = ["Aaron Quint"] s.files = File.read('Manifest.txt').split("\n") s.add_dependency 'sinatra', '>=0.9.1' + s.add_dependency 'haml', '>=2.0.9' s.add_dependency 'activesupport', '>=2.2.2' s.add_dependency 'mislav-will_paginate', '>=2.3.7' end # Generate all the Rake tasks # Run 'rake -T' to see list of generated tasks (from gem root directory) # $hoe = Hoe.new('gembox', Jeweler::Version.new(File.expand_path(File.dirname(__FILE__))).to_s) do |p| # p.developer('FIXME full name', 'FIXME email') # p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n") # p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required # p.rubyforge_name = p.name # TODO this is default value # # p.extra_deps = [ # # ['activesupport','>= 2.0.2'], # # ] # p.extra_dev_deps = [ # ['newgem', ">= #{::Newgem::VERSION}"] # ] # # p.clean_globs |= %w[**/.DS_Store tmp *.log] # path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}" # p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc') # p.rsync_args = '-av --delete --ignore-errors' # end # # require 'newgem/tasks' # load /tasks/*.rake # Dir['tasks/**/*.rake'].each { |t| load t } diff --git a/VERSION.yml b/VERSION.yml index 648d417..20ba869 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,4 +1,4 @@ --- -:patch: 1 +:patch: 2 :major: 0 :minor: 1
quirkey/gembox
5374e6ad48579bbcb713945dd66e0ff67fcc84cf
Regenerated gemspec for version 0.1.1
diff --git a/gembox.gemspec b/gembox.gemspec index b725e98..c0f368a 100644 --- a/gembox.gemspec +++ b/gembox.gemspec @@ -1,40 +1,40 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{gembox} s.version = "0.1.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= - s.authors = ["FIXME full name"] + s.authors = ["Aaron Quint"] s.date = %q{2009-03-04} s.default_executable = %q{gembox} - s.description = %q{Gembox is a little sinatra app that ties in with your local ruby gems to let you browse and learn more about them. Please see the project home page for a full description: http://code.quirkey.com/gembox} - s.email = ["FIXME email"] + s.description = %q{A sinatra based interface for browsing and admiring your gems} + s.email = %q{[email protected]} s.executables = ["gembox"] - s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"] s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "VERSION.yml", "bin/gembox", "gembox.gemspec", "lib/extensions.rb", "lib/gembox.rb", "lib/gembox/app.rb", "lib/gembox/config.ru", "lib/gembox/gem_list.rb", "lib/gembox/gems.rb", "lib/gembox/view_helpers.rb", "public/images/edit.png", "public/images/folder.png", "public/images/git.gif", "public/images/page.png", "public/images/page_white_text.png", "public/images/rubygems-125x125t.png", "public/javascripts/base.js", "public/javascripts/jquery.form.js", "public/javascripts/jquery.js", "public/javascripts/jquery.metadata.js", "public/javascripts/jquery.ui.js", "public/swf/clippy.swf", "test/.bacon", "test/test_gembox_app.rb", "test/test_gembox_gems.rb", "test/test_helper.rb", "views/file_tree.haml", "views/gem.haml", "views/gembox.sass", "views/gems_columns.haml", "views/gems_header.haml", "views/gems_table.haml", "views/index.haml", "views/layout.haml", "views/no_results.haml"] s.has_rdoc = true - s.post_install_message = %q{PostInstall.txt} - s.rdoc_options = ["--main", "README.rdoc"] + s.homepage = %q{http://github.com/quirkey/gembox} + s.rdoc_options = ["--inline-source", "--charset=UTF-8"] s.require_paths = ["lib"] - s.rubyforge_project = %q{gembox} s.rubygems_version = %q{1.3.1} - s.summary = %q{Gembox is a little sinatra app that ties in with your local ruby gems to let you browse and learn more about them} - s.test_files = ["test/test_gembox_app.rb", "test/test_gembox_gems.rb", "test/test_helper.rb"] + s.summary = %q{A sinatra based interface for browsing and admiring your gems.} if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 2 if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then - s.add_development_dependency(%q<newgem>, [">= 1.2.3"]) - s.add_development_dependency(%q<hoe>, [">= 1.8.0"]) + s.add_runtime_dependency(%q<sinatra>, [">= 0.9.1"]) + s.add_runtime_dependency(%q<activesupport>, [">= 2.2.2"]) + s.add_runtime_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) else - s.add_dependency(%q<newgem>, [">= 1.2.3"]) - s.add_dependency(%q<hoe>, [">= 1.8.0"]) + s.add_dependency(%q<sinatra>, [">= 0.9.1"]) + s.add_dependency(%q<activesupport>, [">= 2.2.2"]) + s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) end else - s.add_dependency(%q<newgem>, [">= 1.2.3"]) - s.add_dependency(%q<hoe>, [">= 1.8.0"]) + s.add_dependency(%q<sinatra>, [">= 0.9.1"]) + s.add_dependency(%q<activesupport>, [">= 2.2.2"]) + s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) end end
quirkey/gembox
d29f472fc7ea1dcb19ca4c5e2127923c1ee2737a
Hoe and Jeweler are sitting side by side Reorganizing files
diff --git a/Manifest.txt b/Manifest.txt index 8935f98..d02d546 100644 --- a/Manifest.txt +++ b/Manifest.txt @@ -1,41 +1,40 @@ History.txt Manifest.txt PostInstall.txt README.rdoc Rakefile +VERSION.yml bin/gembox -config.ru -gembox.rb +gembox.gemspec lib/extensions.rb lib/gembox.rb -lib/gembox/cli.rb -lib/gembox_.rb +lib/gembox/app.rb +lib/gembox/config.ru +lib/gembox/gem_list.rb +lib/gembox/gems.rb +lib/gembox/view_helpers.rb public/images/edit.png public/images/folder.png public/images/git.gif public/images/page.png public/images/page_white_text.png public/images/rubygems-125x125t.png public/javascripts/base.js public/javascripts/jquery.form.js public/javascripts/jquery.js public/javascripts/jquery.metadata.js public/javascripts/jquery.ui.js public/swf/clippy.swf -script/console -script/destroy -script/generate -test/test_gembox.rb +test/.bacon test/test_gembox_app.rb -test/test_gembox_cli.rb test/test_gembox_gems.rb test/test_helper.rb views/file_tree.haml views/gem.haml views/gembox.sass views/gems_columns.haml views/gems_header.haml views/gems_table.haml views/index.haml views/layout.haml views/no_results.haml diff --git a/PostInstall.txt b/PostInstall.txt index 430d389..43e5f0a 100644 --- a/PostInstall.txt +++ b/PostInstall.txt @@ -1,7 +1,4 @@ +For more information on gembox, see http://code.quirkey.com/gembox -For more information on gembox, see http://gembox.rubyforge.org - -NOTE: Change this information in PostInstall.txt -You can also delete it if you don't want it. diff --git a/Rakefile b/Rakefile index 6322851..90bb07a 100644 --- a/Rakefile +++ b/Rakefile @@ -1,39 +1,39 @@ -# %w[rubygems rake rake/clean fileutils newgem rubigen jeweler].each { |f| require f } +%w[rubygems rake rake/clean fileutils newgem rubigen jeweler].each { |f| require f } require File.dirname(__FILE__) + '/lib/gembox' require 'jeweler' Jeweler::Tasks.new do |s| s.name = "gembox" s.summary = "A sinatra based interface for browsing and admiring your gems." s.email = "[email protected]" s.homepage = "http://github.com/quirkey/gembox" s.description = "A sinatra based interface for browsing and admiring your gems" s.authors = ["Aaron Quint"] - s.add_dependency 'rubygems', '>=1.3.1' + s.files = File.read('Manifest.txt').split("\n") s.add_dependency 'sinatra', '>=0.9.1' s.add_dependency 'activesupport', '>=2.2.2' s.add_dependency 'mislav-will_paginate', '>=2.3.7' end -# # Generate all the Rake tasks -# # Run 'rake -T' to see list of generated tasks (from gem root directory) -# $hoe = Hoe.new('gembox', Jewler::Version.new.to_s) do |p| -# p.developer('FIXME full name', 'FIXME email') -# p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n") -# p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required -# p.rubyforge_name = p.name # TODO this is default value -# # p.extra_deps = [ -# # ['activesupport','>= 2.0.2'], -# # ] -# p.extra_dev_deps = [ -# ['newgem', ">= #{::Newgem::VERSION}"] -# ] -# -# p.clean_globs |= %w[**/.DS_Store tmp *.log] -# path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}" -# p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc') -# p.rsync_args = '-av --delete --ignore-errors' -# end -# -# require 'newgem/tasks' # load /tasks/*.rake -# Dir['tasks/**/*.rake'].each { |t| load t } +# Generate all the Rake tasks +# Run 'rake -T' to see list of generated tasks (from gem root directory) +$hoe = Hoe.new('gembox', Jeweler::Version.new(File.expand_path(File.dirname(__FILE__))).to_s) do |p| + p.developer('FIXME full name', 'FIXME email') + p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n") + p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required + p.rubyforge_name = p.name # TODO this is default value + # p.extra_deps = [ + # ['activesupport','>= 2.0.2'], + # ] + p.extra_dev_deps = [ + ['newgem', ">= #{::Newgem::VERSION}"] + ] + + p.clean_globs |= %w[**/.DS_Store tmp *.log] + path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}" + p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc') + p.rsync_args = '-av --delete --ignore-errors' +end + +require 'newgem/tasks' # load /tasks/*.rake +Dir['tasks/**/*.rake'].each { |t| load t } diff --git a/gembox.gemspec b/gembox.gemspec index 9c54995..e48652a 100644 --- a/gembox.gemspec +++ b/gembox.gemspec @@ -1,40 +1,40 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{gembox} - s.version = "0.1.0" + s.version = "0.1.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Aaron Quint"] - s.date = %q{2009-02-27} + s.date = %q{2009-03-04} s.default_executable = %q{gembox} s.description = %q{A sinatra based interface for browsing and admiring your gems} s.email = %q{[email protected]} s.executables = ["gembox"] - s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "VERSION.yml", "bin/gembox", "lib/extensions.rb", "lib/gembox", "lib/gembox/app.rb", "lib/gembox/gem_list.rb", "lib/gembox/gems.rb", "lib/gembox/view_helpers.rb", "lib/gembox.rb", "test/test_gembox_app.rb", "test/test_gembox_gems.rb", "test/test_helper.rb"] + s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "bin/gembox", "config.ru", "gembox.rb", "lib/extensions.rb", "lib/gembox.rb", "lib/gembox/cli.rb", "lib/gembox_.rb", "public/images/edit.png", "public/images/folder.png", "public/images/git.gif", "public/images/page.png", "public/images/page_white_text.png", "public/images/rubygems-125x125t.png", "public/javascripts/base.js", "public/javascripts/jquery.form.js", "public/javascripts/jquery.js", "public/javascripts/jquery.metadata.js", "public/javascripts/jquery.ui.js", "public/swf/clippy.swf", "script/console", "script/destroy", "script/generate", "test/test_gembox.rb", "test/test_gembox_app.rb", "test/test_gembox_cli.rb", "test/test_gembox_gems.rb", "test/test_helper.rb", "views/file_tree.haml", "views/gem.haml", "views/gembox.sass", "views/gems_columns.haml", "views/gems_header.haml", "views/gems_table.haml", "views/index.haml", "views/layout.haml", "views/no_results.haml"] s.has_rdoc = true s.homepage = %q{http://github.com/quirkey/gembox} s.rdoc_options = ["--inline-source", "--charset=UTF-8"] s.require_paths = ["lib"] s.rubygems_version = %q{1.3.1} s.summary = %q{A sinatra based interface for browsing and admiring your gems.} if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 2 if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then - s.add_runtime_dependency(%q<rubygems>, [">= 1.3.1"]) + s.add_runtime_dependency(%q<sinatra>, [">= 0.9.1"]) s.add_runtime_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_runtime_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) else - s.add_dependency(%q<rubygems>, [">= 1.3.1"]) + s.add_dependency(%q<sinatra>, [">= 0.9.1"]) s.add_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) end else - s.add_dependency(%q<rubygems>, [">= 1.3.1"]) + s.add_dependency(%q<sinatra>, [">= 0.9.1"]) s.add_dependency(%q<activesupport>, [">= 2.2.2"]) s.add_dependency(%q<mislav-will_paginate>, [">= 2.3.7"]) end end diff --git a/lib/gembox/app.rb b/lib/gembox/app.rb index 990ec40..c62c0fc 100644 --- a/lib/gembox/app.rb +++ b/lib/gembox/app.rb @@ -1,65 +1,66 @@ require 'sinatra' module Gembox class App < ::Sinatra::Default include Gembox::ViewHelpers include WillPaginate::ViewHelpers + + @@root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) - - set :public, 'public' - set :views, 'views' + set :public, File.join(@@root,'public') + set :views, File.join(@@root,'views') before do Gembox::Gems.load @gems = Gembox::Gems.local_gems.paginate :page => params[:page], :per_page => 30 @stats = Gembox::Gems.stats end get '/stylesheets/:stylesheet.css' do sass params[:stylesheet].to_sym end get '/' do redirect '/gems' end get %r{/gems/([\w\-\_]+)/?([\d\.]+)?/?} do show_layout = params[:layout] != 'false' name, version = params[:captures] @gems = Gembox::Gems.search(name) raise Sinatra::NotFound if @gems.empty? @gem_versions = @gems[0][1] if version @gems = Gembox::Gems.search(name, version) @gem = @gems.shift[1].first if @gems end if !@gem @gem = @gem_versions.shift redirect "/gems/#{@gem.name}/#{@gem.version}" end if params[:file] action = params[:action] || view file_path = File.join(@gem.full_gem_path, params[:file]) if File.readable?(file_path) if action == 'edit' `$EDITOR #{file_path}` else response.headers['Content-type'] = 'text/plain' return File.read(file_path) end end end haml :gem, :layout => show_layout end get '/gems/?' do show_layout = params[:layout] != 'false' @show_as = params[:as] || 'columns' if @search = params[:search] @gems = Gembox::Gems.search(@search).paginate :page => params[:page] end haml "gems_#{@show_as}".to_sym, :layout => show_layout end end end \ No newline at end of file diff --git a/config.ru b/lib/gembox/config.ru similarity index 100% rename from config.ru rename to lib/gembox/config.ru diff --git a/script/console b/script/console deleted file mode 100755 index 4aaf463..0000000 --- a/script/console +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env ruby -# File: script/console -irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb' - -libs = " -r irb/completion" -# Perhaps use a console_lib to store any extra methods I may want available in the cosole -# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}" -libs << " -r #{File.dirname(__FILE__) + '/../lib/gembox.rb'}" -puts "Loading gembox gem" -exec "#{irb} #{libs} --simple-prompt" \ No newline at end of file diff --git a/script/destroy b/script/destroy deleted file mode 100755 index e48464d..0000000 --- a/script/destroy +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env ruby -APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) - -begin - require 'rubigen' -rescue LoadError - require 'rubygems' - require 'rubigen' -end -require 'rubigen/scripts/destroy' - -ARGV.shift if ['--help', '-h'].include?(ARGV[0]) -RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit] -RubiGen::Scripts::Destroy.new.run(ARGV) diff --git a/script/generate b/script/generate deleted file mode 100755 index c27f655..0000000 --- a/script/generate +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env ruby -APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) - -begin - require 'rubigen' -rescue LoadError - require 'rubygems' - require 'rubigen' -end -require 'rubigen/scripts/generate' - -ARGV.shift if ['--help', '-h'].include?(ARGV[0]) -RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit] -RubiGen::Scripts::Generate.new.run(ARGV)
quirkey/gembox
d872ffaa8712bb37eb9f9720e854341b5caf6380
Version bump to 0.1.1
diff --git a/VERSION.yml b/VERSION.yml index 02314bb..648d417 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,4 +1,4 @@ --- -:minor: 1 -:patch: 0 +:patch: 1 :major: 0 +:minor: 1
quirkey/gembox
acfcecf22738e2a28e24e29c47107f972bd818be
Depend on sinatra
diff --git a/Rakefile b/Rakefile index cd47a65..6322851 100644 --- a/Rakefile +++ b/Rakefile @@ -1,38 +1,39 @@ # %w[rubygems rake rake/clean fileutils newgem rubigen jeweler].each { |f| require f } require File.dirname(__FILE__) + '/lib/gembox' require 'jeweler' Jeweler::Tasks.new do |s| s.name = "gembox" s.summary = "A sinatra based interface for browsing and admiring your gems." s.email = "[email protected]" s.homepage = "http://github.com/quirkey/gembox" s.description = "A sinatra based interface for browsing and admiring your gems" s.authors = ["Aaron Quint"] s.add_dependency 'rubygems', '>=1.3.1' + s.add_dependency 'sinatra', '>=0.9.1' s.add_dependency 'activesupport', '>=2.2.2' s.add_dependency 'mislav-will_paginate', '>=2.3.7' end # # Generate all the Rake tasks # # Run 'rake -T' to see list of generated tasks (from gem root directory) # $hoe = Hoe.new('gembox', Jewler::Version.new.to_s) do |p| # p.developer('FIXME full name', 'FIXME email') # p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n") # p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required # p.rubyforge_name = p.name # TODO this is default value # # p.extra_deps = [ # # ['activesupport','>= 2.0.2'], # # ] # p.extra_dev_deps = [ # ['newgem', ">= #{::Newgem::VERSION}"] # ] # # p.clean_globs |= %w[**/.DS_Store tmp *.log] # path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}" # p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc') # p.rsync_args = '-av --delete --ignore-errors' # end # # require 'newgem/tasks' # load /tasks/*.rake # Dir['tasks/**/*.rake'].each { |t| load t }
quirkey/gembox
89e5431da7d68c1325e6462b1d5cc5c81ff012e8
Version bump to 0.1.0
diff --git a/VERSION.yml b/VERSION.yml index 44cd0bc..02314bb 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,4 +1,4 @@ --- +:minor: 1 :patch: 0 :major: 0 -:minor: 0
quirkey/gembox
1a44ba5f60262644d6eba8d36e4285f2c261732c
Working towards gemification
diff --git a/Rakefile b/Rakefile index b43302a..01fe054 100644 --- a/Rakefile +++ b/Rakefile @@ -1,28 +1,40 @@ %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f } require File.dirname(__FILE__) + '/lib/gembox' +begin + require 'jeweler' + Jeweler::Tasks.new do |s| + s.name = "the-perfect-gem" + s.summary = "TODO" + s.email = "[email protected]" + s.homepage = "http://github.com/technicalpickles/the-perfect-gem" + s.description = "TODO" + s.authors = ["Josh Nichols"] + end +rescue LoadError + puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com" +end + + # Generate all the Rake tasks # Run 'rake -T' to see list of generated tasks (from gem root directory) $hoe = Hoe.new('gembox', Gembox::VERSION) do |p| p.developer('FIXME full name', 'FIXME email') p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n") p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required p.rubyforge_name = p.name # TODO this is default value # p.extra_deps = [ # ['activesupport','>= 2.0.2'], # ] p.extra_dev_deps = [ ['newgem', ">= #{::Newgem::VERSION}"] ] p.clean_globs |= %w[**/.DS_Store tmp *.log] path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}" p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc') p.rsync_args = '-av --delete --ignore-errors' end require 'newgem/tasks' # load /tasks/*.rake Dir['tasks/**/*.rake'].each { |t| load t } - -# TODO - want other tests/tasks run by default? Add them to the list -# task :default => [:spec, :features] diff --git a/VERSION.yml b/VERSION.yml new file mode 100644 index 0000000..44cd0bc --- /dev/null +++ b/VERSION.yml @@ -0,0 +1,4 @@ +--- +:patch: 0 +:major: 0 +:minor: 0 diff --git a/bin/gembox b/bin/gembox old mode 100644 new mode 100755 index 33cb069..3993be6 --- a/bin/gembox +++ b/bin/gembox @@ -1,10 +1,10 @@ #!/usr/bin/env ruby # # Created on 2009-2-27. # Copyright (c) 2009. All rights reserved. require File.expand_path(File.dirname(__FILE__) + "/../lib/gembox") -require "gembox/cli" - -Gembox::CLI.execute(STDOUT, ARGV) +Gembox::App.set :environment, :production +Gembox::App.set :port, 5678 +Gembox::App.run! \ No newline at end of file diff --git a/config.ru b/config.ru index 0b16a35..4267718 100644 --- a/config.ru +++ b/config.ru @@ -1,8 +1,8 @@ # To use with thin # thin start -p PORT -R config.ru -require File.join(File.dirname(__FILE__), 'gembox.rb') +require File.join(File.dirname(__FILE__), 'gembox') disable :run set :env, :production -run Sinatra.application \ No newline at end of file +run Gembox::App \ No newline at end of file diff --git a/lib/gembox.rb b/lib/gembox.rb index 1de2d57..8d55ba7 100644 --- a/lib/gembox.rb +++ b/lib/gembox.rb @@ -1,14 +1,17 @@ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) module Gembox VERSION = '0.0.1' end +require 'rubygems' require 'active_support' require 'will_paginate/array' require 'will_paginate/view_helpers' require 'extensions' require 'gembox/gem_list' -require 'gembox/gems' \ No newline at end of file +require 'gembox/gems' +require 'gembox/view_helpers' +require 'gembox/app' \ No newline at end of file diff --git a/lib/gembox/cli.rb b/lib/gembox/cli.rb deleted file mode 100644 index 91b2022..0000000 --- a/lib/gembox/cli.rb +++ /dev/null @@ -1,42 +0,0 @@ -require 'optparse' - -module Gembox - class CLI - def self.execute(stdout, arguments=[]) - - # NOTE: the option -p/--path= is given as an example, and should be replaced in your application. - - options = { - :path => '~' - } - mandatory_options = %w( ) - - parser = OptionParser.new do |opts| - opts.banner = <<-BANNER.gsub(/^ /,'') - This application is wonderful because... - - Usage: #{File.basename($0)} [options] - - Options are: - BANNER - opts.separator "" - opts.on("-p", "--path=PATH", String, - "This is a sample message.", - "For multiple lines, add more strings.", - "Default: ~") { |arg| options[:path] = arg } - opts.on("-h", "--help", - "Show this help message.") { stdout.puts opts; exit } - opts.parse!(arguments) - - if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? } - stdout.puts opts; exit - end - end - - path = options[:path] - - # do stuff - puts "To update this executable, look in lib/gembox/cli.rb" - end - end -end \ No newline at end of file diff --git a/lib/gembox/gems.rb b/lib/gembox/gems.rb index 72890ef..6d221cf 100644 --- a/lib/gembox/gems.rb +++ b/lib/gembox/gems.rb @@ -1,42 +1,42 @@ module Gembox class Gems class << self attr_accessor :source_index def load @source_index ||= ::Gem.source_index local_gems end def local_gems @local_gems ||= group_gems(source_index.gems) end def search(search_term, version = nil) version = version ? Gem::Requirement.create(version) : Gem::Requirement.default - gems = source_index.search Gem::Dependency.new(/^#{Regexp.escape(search_term)}/, version) + gems = source_index.search Gem::Dependency.new(/#{Regexp.escape(search_term)}/, version) group_gems(gems) end def stats num_versions = source_index.length num_gems = local_gems.length oldest_gem = source_index.min {|a,b| a[1].date <=> b[1].date }.last {:num_versions => num_versions, :num_gems => num_gems, :oldest_gem => oldest_gem} end protected def group_gems(gem_collection) gem_hash = GemList.new gem_collection = gem_collection.values if gem_collection.is_a?(Hash) gem_collection.each do |spec| gem_hash[spec.name] ||= [] gem_hash[spec.name] << spec gem_hash[spec.name].sort! {|a,b| (b.version || 0) <=> (a.version || 0) } end gem_hash.sort {|a, b| a[0].downcase <=> b[0].downcase } end end end end \ No newline at end of file diff --git a/test/test_gembox_cli.rb b/test/test_gembox_cli.rb deleted file mode 100644 index b286743..0000000 --- a/test/test_gembox_cli.rb +++ /dev/null @@ -1,14 +0,0 @@ -require File.join(File.dirname(__FILE__), "test_helper.rb") -require 'gembox/cli' - -class TestGemboxCli < Test::Unit::TestCase - def setup - Gembox::CLI.execute(@stdout_io = StringIO.new, []) - @stdout_io.rewind - @stdout = @stdout_io.read - end - - def test_not_print_default_output - assert_no_match(/To update this executable/, @stdout) - end -end \ No newline at end of file
quirkey/gembox
7364a56b4b36939fd1735d805395f355c20a4223
Major reorganization and cleanup
diff --git a/Manifest.txt b/Manifest.txt index 9a6bc5e..8935f98 100644 --- a/Manifest.txt +++ b/Manifest.txt @@ -1,38 +1,41 @@ History.txt Manifest.txt PostInstall.txt README.rdoc Rakefile +bin/gembox config.ru -config.yml gembox.rb lib/extensions.rb lib/gembox.rb +lib/gembox/cli.rb +lib/gembox_.rb public/images/edit.png public/images/folder.png public/images/git.gif public/images/page.png public/images/page_white_text.png public/images/rubygems-125x125t.png public/javascripts/base.js public/javascripts/jquery.form.js public/javascripts/jquery.js public/javascripts/jquery.metadata.js public/javascripts/jquery.ui.js public/swf/clippy.swf script/console script/destroy script/generate test/test_gembox.rb test/test_gembox_app.rb +test/test_gembox_cli.rb test/test_gembox_gems.rb test/test_helper.rb views/file_tree.haml views/gem.haml views/gembox.sass views/gems_columns.haml views/gems_header.haml views/gems_table.haml views/index.haml views/layout.haml views/no_results.haml diff --git a/PostInstall.txt b/PostInstall.txt new file mode 100644 index 0000000..430d389 --- /dev/null +++ b/PostInstall.txt @@ -0,0 +1,7 @@ + +For more information on gembox, see http://gembox.rubyforge.org + +NOTE: Change this information in PostInstall.txt +You can also delete it if you don't want it. + + diff --git a/bin/gembox b/bin/gembox new file mode 100644 index 0000000..33cb069 --- /dev/null +++ b/bin/gembox @@ -0,0 +1,10 @@ +#!/usr/bin/env ruby +# +# Created on 2009-2-27. +# Copyright (c) 2009. All rights reserved. + +require File.expand_path(File.dirname(__FILE__) + "/../lib/gembox") + +require "gembox/cli" + +Gembox::CLI.execute(STDOUT, ARGV) diff --git a/gembox.rb b/gembox.rb deleted file mode 100644 index 053b7ca..0000000 --- a/gembox.rb +++ /dev/null @@ -1,131 +0,0 @@ -require 'rubygems' -require 'sinatra' -require 'active_support' -require 'will_paginate/array' -require 'will_paginate/view_helpers' - -require File.join(File.dirname(__FILE__), 'lib', 'gembox') - -Gembox::Gems.load - -helpers do - def tag_options(options, escape = true) - option_string = options.collect {|k,v| %{#{k}="#{v}"}}.join(' ') - option_string = " " + option_string unless option_string.blank? - end - - def content_tag(name, content, options, escape = true) - tag_options = tag_options(options, escape) if options - "<#{name}#{tag_options}>#{content}</#{name}>" - end - - def link_to(text, link = nil, options = {}) - link ||= text - link = url_for(link) - "<a href=\"#{link}\">#{text}</a>" - end - - def link_to_gem(gem, options = {}) - text = options[:text] || gem.name - version = gem.version if options[:show_version] - link_to(text, "/gems/#{gem.name}/#{gem.version}") - end - - def url_for(link_options) - case link_options - when Hash - path = link_options.delete(:path) || request.path_info - params.delete('captures') - path + '?' + build_query(params.merge(link_options)) - else - link_options - end - end - - def ts(time) - time.strftime('%b %d, %Y') if time - end - - def clippy(text, bgcolor='#FFFFFF') - html = <<-EOF - <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" - width="110" - height="14" - id="clippy" > - <param name="movie" value="/swf/clippy.swf"/> - <param name="allowScriptAccess" value="always" /> - <param name="quality" value="high" /> - <param name="scale" value="noscale" /> - <param NAME="FlashVars" value="text=#{text}"> - <param name="bgcolor" value="#{bgcolor}"> - <embed src="/swf/clippy.swf" - width="110" - height="14" - name="clippy" - quality="high" - allowScriptAccess="always" - type="application/x-shockwave-flash" - pluginspage="http://www.macromedia.com/go/getflashplayer" - FlashVars="text=#{text}" - bgcolor="#{bgcolor}" - /> - </object> - EOF - end - - include WillPaginate::ViewHelpers -end - -set :public, 'public' -set :views, 'views' - -before do - @gems = Gembox::Gems.local_gems.paginate :page => params[:page], :per_page => 30 - @stats = Gembox::Gems.stats -end - -get '/stylesheets/:stylesheet.css' do - sass params[:stylesheet].to_sym -end - -get '/' do - redirect '/gems' -end - -get %r{/gems/([\w\-\_]+)/?([\d\.]+)?/?} do - show_layout = params[:layout] != 'false' - name, version = params[:captures] - @gems = Gembox::Gems.search(name) - raise Sinatra::NotFound if @gems.empty? - @gem_versions = @gems[0][1] - if version - @gems = Gembox::Gems.search(name, version) - @gem = @gems.shift[1].first if @gems - end - if !@gem - @gem = @gem_versions.shift - redirect "/gems/#{@gem.name}/#{@gem.version}" - end - if params[:file] - action = params[:action] || view - file_path = File.join(@gem.full_gem_path, params[:file]) - if File.readable?(file_path) - if action == 'edit' - `$EDITOR #{file_path}` - else - response.headers['Content-type'] = 'text/plain' - return File.read(file_path) - end - end - end - haml :gem, :layout => show_layout -end - -get '/gems/?' do - show_layout = params[:layout] != 'false' - @show_as = params[:as] || 'columns' - if @search = params[:search] - @gems = Gembox::Gems.search(@search).paginate :page => params[:page] - end - haml "gems_#{@show_as}".to_sym, :layout => show_layout -end \ No newline at end of file diff --git a/lib/gembox.rb b/lib/gembox.rb index b01f209..1de2d57 100644 --- a/lib/gembox.rb +++ b/lib/gembox.rb @@ -1,83 +1,14 @@ -require File.join(File.dirname(__FILE__), 'extensions') +$:.unshift(File.dirname(__FILE__)) unless + $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) module Gembox - class GemList < Array - - def [](*args) - if args.first.is_a?(String) - search(args.first) - else - super - end - end - - def []=(key, value) - if key.is_a?(String) - if versions = search(key) - versions.replace([key, value]) - else - self << [key, value] - end - else - super - end - end - - def search(key) - i = find {|v| - if v.is_a?(Array) - v[0] == key - else - v == key - end - } - i.is_a?(Array) ? i[1] : i - end - - def has_key?(key) - !search(key).nil? - end - end - - class Gems - - class << self - attr_accessor :source_index - - def load - @source_index ||= ::Gem.source_index - local_gems - end - - def local_gems - @local_gems ||= group_gems(source_index.gems) - end - - def search(search_term, version = nil) - version = version ? Gem::Requirement.create(version) : Gem::Requirement.default - gems = source_index.search Gem::Dependency.new(/^#{Regexp.escape(search_term)}/, version) - group_gems(gems) - end - - def stats - num_versions = source_index.length - num_gems = local_gems.length - oldest_gem = source_index.min {|a,b| a[1].date <=> b[1].date }.last - {:num_versions => num_versions, :num_gems => num_gems, :oldest_gem => oldest_gem} - end - - protected - def group_gems(gem_collection) - gem_hash = GemList.new - gem_collection = gem_collection.values if gem_collection.is_a?(Hash) - gem_collection.each do |spec| - gem_hash[spec.name] ||= [] - gem_hash[spec.name] << spec - gem_hash[spec.name].sort! {|a,b| (b.version || 0) <=> (a.version || 0) } - end - gem_hash.sort {|a, b| a[0].downcase <=> b[0].downcase } - end - end - - end -end \ No newline at end of file + VERSION = '0.0.1' +end + +require 'active_support' +require 'will_paginate/array' +require 'will_paginate/view_helpers' + +require 'extensions' +require 'gembox/gem_list' +require 'gembox/gems' \ No newline at end of file diff --git a/lib/gembox/app.rb b/lib/gembox/app.rb new file mode 100644 index 0000000..990ec40 --- /dev/null +++ b/lib/gembox/app.rb @@ -0,0 +1,65 @@ +require 'sinatra' + +module Gembox + class App < ::Sinatra::Default + include Gembox::ViewHelpers + include WillPaginate::ViewHelpers + + + set :public, 'public' + set :views, 'views' + + before do + Gembox::Gems.load + @gems = Gembox::Gems.local_gems.paginate :page => params[:page], :per_page => 30 + @stats = Gembox::Gems.stats + end + + get '/stylesheets/:stylesheet.css' do + sass params[:stylesheet].to_sym + end + + get '/' do + redirect '/gems' + end + + get %r{/gems/([\w\-\_]+)/?([\d\.]+)?/?} do + show_layout = params[:layout] != 'false' + name, version = params[:captures] + @gems = Gembox::Gems.search(name) + raise Sinatra::NotFound if @gems.empty? + @gem_versions = @gems[0][1] + if version + @gems = Gembox::Gems.search(name, version) + @gem = @gems.shift[1].first if @gems + end + if !@gem + @gem = @gem_versions.shift + redirect "/gems/#{@gem.name}/#{@gem.version}" + end + if params[:file] + action = params[:action] || view + file_path = File.join(@gem.full_gem_path, params[:file]) + if File.readable?(file_path) + if action == 'edit' + `$EDITOR #{file_path}` + else + response.headers['Content-type'] = 'text/plain' + return File.read(file_path) + end + end + end + haml :gem, :layout => show_layout + end + + get '/gems/?' do + show_layout = params[:layout] != 'false' + @show_as = params[:as] || 'columns' + if @search = params[:search] + @gems = Gembox::Gems.search(@search).paginate :page => params[:page] + end + haml "gems_#{@show_as}".to_sym, :layout => show_layout + end + + end +end \ No newline at end of file diff --git a/lib/gembox/cli.rb b/lib/gembox/cli.rb new file mode 100644 index 0000000..91b2022 --- /dev/null +++ b/lib/gembox/cli.rb @@ -0,0 +1,42 @@ +require 'optparse' + +module Gembox + class CLI + def self.execute(stdout, arguments=[]) + + # NOTE: the option -p/--path= is given as an example, and should be replaced in your application. + + options = { + :path => '~' + } + mandatory_options = %w( ) + + parser = OptionParser.new do |opts| + opts.banner = <<-BANNER.gsub(/^ /,'') + This application is wonderful because... + + Usage: #{File.basename($0)} [options] + + Options are: + BANNER + opts.separator "" + opts.on("-p", "--path=PATH", String, + "This is a sample message.", + "For multiple lines, add more strings.", + "Default: ~") { |arg| options[:path] = arg } + opts.on("-h", "--help", + "Show this help message.") { stdout.puts opts; exit } + opts.parse!(arguments) + + if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? } + stdout.puts opts; exit + end + end + + path = options[:path] + + # do stuff + puts "To update this executable, look in lib/gembox/cli.rb" + end + end +end \ No newline at end of file diff --git a/lib/gembox/gem_list.rb b/lib/gembox/gem_list.rb new file mode 100644 index 0000000..3f2198e --- /dev/null +++ b/lib/gembox/gem_list.rb @@ -0,0 +1,41 @@ +module Gembox + + class GemList < Array + + def [](*args) + if args.first.is_a?(String) + search(args.first) + else + super + end + end + + def []=(key, value) + if key.is_a?(String) + if versions = search(key) + versions.replace([key, value]) + else + self << [key, value] + end + else + super + end + end + + def search(key) + i = find {|v| + if v.is_a?(Array) + v[0] == key + else + v == key + end + } + i.is_a?(Array) ? i[1] : i + end + + def has_key?(key) + !search(key).nil? + end + end + +end \ No newline at end of file diff --git a/lib/gembox/gems.rb b/lib/gembox/gems.rb new file mode 100644 index 0000000..72890ef --- /dev/null +++ b/lib/gembox/gems.rb @@ -0,0 +1,42 @@ +module Gembox + class Gems + class << self + attr_accessor :source_index + + def load + @source_index ||= ::Gem.source_index + local_gems + end + + def local_gems + @local_gems ||= group_gems(source_index.gems) + end + + def search(search_term, version = nil) + version = version ? Gem::Requirement.create(version) : Gem::Requirement.default + gems = source_index.search Gem::Dependency.new(/^#{Regexp.escape(search_term)}/, version) + group_gems(gems) + end + + def stats + num_versions = source_index.length + num_gems = local_gems.length + oldest_gem = source_index.min {|a,b| a[1].date <=> b[1].date }.last + {:num_versions => num_versions, :num_gems => num_gems, :oldest_gem => oldest_gem} + end + + protected + def group_gems(gem_collection) + gem_hash = GemList.new + gem_collection = gem_collection.values if gem_collection.is_a?(Hash) + gem_collection.each do |spec| + gem_hash[spec.name] ||= [] + gem_hash[spec.name] << spec + gem_hash[spec.name].sort! {|a,b| (b.version || 0) <=> (a.version || 0) } + end + gem_hash.sort {|a, b| a[0].downcase <=> b[0].downcase } + end + end + + end +end \ No newline at end of file diff --git a/lib/gembox/view_helpers.rb b/lib/gembox/view_helpers.rb new file mode 100644 index 0000000..2ea04e5 --- /dev/null +++ b/lib/gembox/view_helpers.rb @@ -0,0 +1,69 @@ +module Gembox + module ViewHelpers + + def tag_options(options, escape = true) + option_string = options.collect {|k,v| %{#{k}="#{v}"}}.join(' ') + option_string = " " + option_string unless option_string.blank? + end + + def content_tag(name, content, options, escape = true) + tag_options = tag_options(options, escape) if options + "<#{name}#{tag_options}>#{content}</#{name}>" + end + + def link_to(text, link = nil, options = {}) + link ||= text + link = url_for(link) + "<a href=\"#{link}\">#{text}</a>" + end + + def link_to_gem(gem, options = {}) + text = options[:text] || gem.name + version = gem.version if options[:show_version] + link_to(text, "/gems/#{gem.name}/#{gem.version}") + end + + def url_for(link_options) + case link_options + when Hash + path = link_options.delete(:path) || request.path_info + params.delete('captures') + path + '?' + build_query(params.merge(link_options)) + else + link_options + end + end + + def ts(time) + time.strftime('%b %d, %Y') if time + end + + def clippy(text, bgcolor='#FFFFFF') + html = <<-EOF + <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" + width="110" + height="14" + id="clippy" > + <param name="movie" value="/swf/clippy.swf"/> + <param name="allowScriptAccess" value="always" /> + <param name="quality" value="high" /> + <param name="scale" value="noscale" /> + <param NAME="FlashVars" value="text=#{text}"> + <param name="bgcolor" value="#{bgcolor}"> + <embed src="/swf/clippy.swf" + width="110" + height="14" + name="clippy" + quality="high" + allowScriptAccess="always" + type="application/x-shockwave-flash" + pluginspage="http://www.macromedia.com/go/getflashplayer" + FlashVars="text=#{text}" + bgcolor="#{bgcolor}" + /> + </object> + EOF + end + + end +end \ No newline at end of file diff --git a/script/console b/script/console new file mode 100755 index 0000000..4aaf463 --- /dev/null +++ b/script/console @@ -0,0 +1,10 @@ +#!/usr/bin/env ruby +# File: script/console +irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb' + +libs = " -r irb/completion" +# Perhaps use a console_lib to store any extra methods I may want available in the cosole +# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}" +libs << " -r #{File.dirname(__FILE__) + '/../lib/gembox.rb'}" +puts "Loading gembox gem" +exec "#{irb} #{libs} --simple-prompt" \ No newline at end of file diff --git a/script/destroy b/script/destroy new file mode 100755 index 0000000..e48464d --- /dev/null +++ b/script/destroy @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby +APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) + +begin + require 'rubigen' +rescue LoadError + require 'rubygems' + require 'rubigen' +end +require 'rubigen/scripts/destroy' + +ARGV.shift if ['--help', '-h'].include?(ARGV[0]) +RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit] +RubiGen::Scripts::Destroy.new.run(ARGV) diff --git a/script/generate b/script/generate new file mode 100755 index 0000000..c27f655 --- /dev/null +++ b/script/generate @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby +APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) + +begin + require 'rubigen' +rescue LoadError + require 'rubygems' + require 'rubigen' +end +require 'rubigen/scripts/generate' + +ARGV.shift if ['--help', '-h'].include?(ARGV[0]) +RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit] +RubiGen::Scripts::Generate.new.run(ARGV) diff --git a/test/test_gembox_cli.rb b/test/test_gembox_cli.rb new file mode 100644 index 0000000..b286743 --- /dev/null +++ b/test/test_gembox_cli.rb @@ -0,0 +1,14 @@ +require File.join(File.dirname(__FILE__), "test_helper.rb") +require 'gembox/cli' + +class TestGemboxCli < Test::Unit::TestCase + def setup + Gembox::CLI.execute(@stdout_io = StringIO.new, []) + @stdout_io.rewind + @stdout = @stdout_io.read + end + + def test_not_print_default_output + assert_no_match(/To update this executable/, @stdout) + end +end \ No newline at end of file
quirkey/gembox
19985ce16cb133f9ad7013b386149008c4337d71
Added newgem files (Rakefile mainly)
diff --git a/History.txt b/History.txt new file mode 100644 index 0000000..566739e --- /dev/null +++ b/History.txt @@ -0,0 +1,4 @@ +== 0.0.1 2009-02-27 + +* 1 major enhancement: + * Initial release diff --git a/Manifest.txt b/Manifest.txt new file mode 100644 index 0000000..9a6bc5e --- /dev/null +++ b/Manifest.txt @@ -0,0 +1,38 @@ +History.txt +Manifest.txt +PostInstall.txt +README.rdoc +Rakefile +config.ru +config.yml +gembox.rb +lib/extensions.rb +lib/gembox.rb +public/images/edit.png +public/images/folder.png +public/images/git.gif +public/images/page.png +public/images/page_white_text.png +public/images/rubygems-125x125t.png +public/javascripts/base.js +public/javascripts/jquery.form.js +public/javascripts/jquery.js +public/javascripts/jquery.metadata.js +public/javascripts/jquery.ui.js +public/swf/clippy.swf +script/console +script/destroy +script/generate +test/test_gembox.rb +test/test_gembox_app.rb +test/test_gembox_gems.rb +test/test_helper.rb +views/file_tree.haml +views/gem.haml +views/gembox.sass +views/gems_columns.haml +views/gems_header.haml +views/gems_table.haml +views/index.haml +views/layout.haml +views/no_results.haml diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 0000000..5363602 --- /dev/null +++ b/README.rdoc @@ -0,0 +1,48 @@ += gembox + +* FIX (url) + +== DESCRIPTION: + +FIX (describe your package) + +== FEATURES/PROBLEMS: + +* FIX (list of features or problems) + +== SYNOPSIS: + + FIX (code sample of usage) + +== REQUIREMENTS: + +* FIX (list of requirements) + +== INSTALL: + +* FIX (sudo gem install, anything else) + +== LICENSE: + +(The MIT License) + +Copyright (c) 2009 FIXME full name + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Rakefile b/Rakefile index ce46579..b43302a 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,28 @@ -namespace :gembox do - - -end \ No newline at end of file +%w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f } +require File.dirname(__FILE__) + '/lib/gembox' + +# Generate all the Rake tasks +# Run 'rake -T' to see list of generated tasks (from gem root directory) +$hoe = Hoe.new('gembox', Gembox::VERSION) do |p| + p.developer('FIXME full name', 'FIXME email') + p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n") + p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required + p.rubyforge_name = p.name # TODO this is default value + # p.extra_deps = [ + # ['activesupport','>= 2.0.2'], + # ] + p.extra_dev_deps = [ + ['newgem', ">= #{::Newgem::VERSION}"] + ] + + p.clean_globs |= %w[**/.DS_Store tmp *.log] + path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}" + p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc') + p.rsync_args = '-av --delete --ignore-errors' +end + +require 'newgem/tasks' # load /tasks/*.rake +Dir['tasks/**/*.rake'].each { |t| load t } + +# TODO - want other tests/tasks run by default? Add them to the list +# task :default => [:spec, :features] diff --git a/config.yml b/config.yml deleted file mode 100644 index 73b314f..0000000 --- a/config.yml +++ /dev/null @@ -1 +0,0 @@ ---- \ No newline at end of file
quirkey/gembox
0b7c1712e397ed7d0fdac05df07d3ff8b84ab9d8
Temporarily disabling summaries link
diff --git a/views/gems_header.haml b/views/gems_header.haml index df95228..c4eb94f 100644 --- a/views/gems_header.haml +++ b/views/gems_header.haml @@ -1,17 +1,17 @@ %h2 -if @search Gems matching %em=@search %span.num="(#{@gems.length})" -else Installed Gems %span.num="(#{@gems.total_entries})" %span.view_options View as =(@show_as == 'columns') ? '<strong>Columns</strong>' : link_to('Columns', {'as' => 'columns'}) =' / ' =(@show_as == 'table') ? '<strong>Table</strong>' : link_to('Table', {'as' => 'table'}) - | - =link_to('Summaries', {'summaries' => 'false'}) + / | + /=link_to('Summaries', {'summaries' => 'false'}) =will_paginate(@gems) \ No newline at end of file
quirkey/gembox
82aa4f08b1c5acd2096a6837cf3697cf7ab1afab
Fixed up test suite
diff --git a/test/test_gembox_app.rb b/test/test_gembox_app.rb index c903351..03451c7 100644 --- a/test/test_gembox_app.rb +++ b/test/test_gembox_app.rb @@ -1,126 +1,133 @@ require File.join(File.dirname(__FILE__), 'test_helper') describe "Gembox App" do - - describe 'getting /' do + + describe 'getting index' do before do get '/' end + + should "redirect to /gems" do + should.be.redirect + end + + end + + describe 'getting gems' do + before do + get '/gems' + end should 'load the index' do should.be.ok end should "display gem list" do - body.should have_element('#gems') + body.should have_element('div#gems') end should "display list of installed gems" do - body.should have_element('.gem', /sinatra/) + body.should have_element('.gem') end should "display as 4 columns" do body.should have_element('.column') end end describe 'getting gems/ with layout = false' do before do get '/gems/?layout=false' end should "load" do should.be.ok end should "not display layout" do body.should.not have_element('html') end should "display gem list" do - body.should have_element('#gems') + html_body.should have_element('#gems') end should "display as 4 columns" do - body.should have_element('.column') + html_body.should have_element('.column') end end describe 'getting gems/ with a simple search' do before do get '/gems/?search=s' end should "load" do should.be.ok end should "display gem list" do body.should have_element('#gems') end should "display gems that match the search" do body.should have_element('.gem', /sinatra/) end should "not display gems that do not match the search" do body.should.not have_element('.gem', /rack/) end end describe 'getting gems/ with as = table' do before do get '/gems/?layout=false&as=table' end should "load" do should.be.ok end should "not display layout" do body.should.not have_element('html') end - should "display gem list" do - body.should have_element('#gems') - end - should "display as table" do - body.should have_element('table#gems') - body.should have_element('table#gems tr.gem') + html_body.should have_element('table#gems') + html_body.should have_element('table#gems tr.gem') end end describe 'getting gems/:name' do before do get '/gems/sinatra' end should "redirect to most recent version" do status.should.be.equal 302 end end describe 'getting gems/name/version' do before do get '/gems/sinatra/0.9.0.4' end - should "display only specific gem" do - body.should.not have_element('.gem', /rack/) + should "display dependencies" do + body.should have_element('#dependencies .gem', /rack/) end should "display link to gems website" do body.should have_element('a', 'http://sinatra.rubyforge.org') end should "load gem spec specified version" do body.should have_element('.version', '0.9.0.4') end should "display links to all versions" do - body.should have_element('.other_versions a[href="/gems/sinatra/"]') + body.should have_element('#versions a') end end end \ No newline at end of file diff --git a/test/test_helper.rb b/test/test_helper.rb index ec4a2bf..49e36a6 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,52 +1,56 @@ require 'rubygems' require 'sinatra' require 'sinatra/test/bacon' require 'mocha' require File.join(File.dirname(__FILE__), '..', 'gembox.rb') require 'nokogiri' module TestHelper def instance_of(klass) lambda {|obj| obj.is_a?(klass) } end # HTML matcher for bacon # # it 'should display document' do # body.should have_element('#document') # end # # With content matching: # # it 'should display loaded document' do # body.should have_element('#document .title', /My Document/) # end def have_element(search, content = nil) lambda do |obj| doc = Nokogiri.parse(obj.to_s) node_set = doc.search(search) if node_set.empty? false else collected_content = node_set.collect {|t| t.content }.join(' ') case content when Regexp collected_content =~ content when String collected_content.include?(content) when nil true end end end end + + def html_body + body =~ /^\<html/ ? body : "<html><body>#{body}</body></html>" + end end Bacon::Context.send(:include, TestHelper) diff --git a/views/gem.haml b/views/gem.haml index 41ec973..960e357 100644 --- a/views/gem.haml +++ b/views/gem.haml @@ -1,45 +1,44 @@ #gem %h2 [email protected] %[email protected] .description %[email protected] .meta %p.authors By [email protected](', ') ='(' + link_to(@gem.email, "mailto:#{@gem.email}") + ')' %p.url Homepage: =link_to(@gem.homepage) -unless @gem.rubyforge_project.blank? %p.url Rubyforge: =link_to("http://rubyforge.org/projects/#{@gem.rubyforge_project}") %p.released Released =ts(@gem.date) %h3.toggler Dependencies #dependencies.toggle_area [email protected] do |dependency| .gem =link_to(dependency.name, "/gems/#{dependency.name}") %span.version=dependency.version_requirements %h3.toggler Other Versions #versions.toggle_area %table %tbody -@gem_versions.each do |spec| %tr %td=link_to(spec.version, "/gems/#{spec.name}/#{spec.version}") %td=ts(spec.date) %h3.toggler Files #files.toggle_area %ul.files =haml(:file_tree, :locals => {:dir => '/', :files => {}, :parent => ''}, :layout => false) [email protected]_tree.each do |dir, files| =haml(:file_tree, :locals => {:dir => dir, :files => files, :parent => dir}, :layout => false) - -/ %[email protected]_yaml \ No newline at end of file + \ No newline at end of file
quirkey/gembox
093c4b30957d61d758f6c61d71db4e89150d14fe
Working search, more visual updates
diff --git a/gembox.rb b/gembox.rb index 125d51a..053b7ca 100644 --- a/gembox.rb +++ b/gembox.rb @@ -1,127 +1,131 @@ require 'rubygems' require 'sinatra' +require 'active_support' require 'will_paginate/array' require 'will_paginate/view_helpers' require File.join(File.dirname(__FILE__), 'lib', 'gembox') Gembox::Gems.load helpers do def tag_options(options, escape = true) option_string = options.collect {|k,v| %{#{k}="#{v}"}}.join(' ') option_string = " " + option_string unless option_string.blank? end def content_tag(name, content, options, escape = true) tag_options = tag_options(options, escape) if options "<#{name}#{tag_options}>#{content}</#{name}>" end def link_to(text, link = nil, options = {}) link ||= text link = url_for(link) "<a href=\"#{link}\">#{text}</a>" end def link_to_gem(gem, options = {}) text = options[:text] || gem.name version = gem.version if options[:show_version] link_to(text, "/gems/#{gem.name}/#{gem.version}") end def url_for(link_options) case link_options when Hash path = link_options.delete(:path) || request.path_info params.delete('captures') path + '?' + build_query(params.merge(link_options)) else link_options end end def ts(time) time.strftime('%b %d, %Y') if time end def clippy(text, bgcolor='#FFFFFF') html = <<-EOF <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="110" height="14" id="clippy" > <param name="movie" value="/swf/clippy.swf"/> <param name="allowScriptAccess" value="always" /> <param name="quality" value="high" /> <param name="scale" value="noscale" /> <param NAME="FlashVars" value="text=#{text}"> <param name="bgcolor" value="#{bgcolor}"> <embed src="/swf/clippy.swf" width="110" height="14" name="clippy" quality="high" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" FlashVars="text=#{text}" bgcolor="#{bgcolor}" /> </object> EOF end include WillPaginate::ViewHelpers end set :public, 'public' set :views, 'views' before do @gems = Gembox::Gems.local_gems.paginate :page => params[:page], :per_page => 30 @stats = Gembox::Gems.stats end get '/stylesheets/:stylesheet.css' do sass params[:stylesheet].to_sym end get '/' do redirect '/gems' end get %r{/gems/([\w\-\_]+)/?([\d\.]+)?/?} do show_layout = params[:layout] != 'false' name, version = params[:captures] @gems = Gembox::Gems.search(name) raise Sinatra::NotFound if @gems.empty? @gem_versions = @gems[0][1] if version @gems = Gembox::Gems.search(name, version) @gem = @gems.shift[1].first if @gems end if !@gem @gem = @gem_versions.shift redirect "/gems/#{@gem.name}/#{@gem.version}" end if params[:file] action = params[:action] || view file_path = File.join(@gem.full_gem_path, params[:file]) if File.readable?(file_path) if action == 'edit' `$EDITOR #{file_path}` else response.headers['Content-type'] = 'text/plain' return File.read(file_path) end end end haml :gem, :layout => show_layout end get '/gems/?' do show_layout = params[:layout] != 'false' - show_as = params[:as] || 'columns' - haml "gems_#{show_as}".to_sym, :layout => show_layout + @show_as = params[:as] || 'columns' + if @search = params[:search] + @gems = Gembox::Gems.search(@search).paginate :page => params[:page] + end + haml "gems_#{@show_as}".to_sym, :layout => show_layout end \ No newline at end of file diff --git a/lib/extensions.rb b/lib/extensions.rb index 104bc64..0223d15 100644 --- a/lib/extensions.rb +++ b/lib/extensions.rb @@ -1,21 +1,21 @@ module Gem class Specification def files_tree tree = {} files.each do |file| split_dirs = file.split(/\//) keyed_hash = {} split_dirs.reverse.each do |key| keyed_hash = {key => keyed_hash} end tree.deep_merge!(keyed_hash) end tree end def on_github? - homepage =~ /github\.com/ + homepage =~ /github\.com\/([\w\d\-\_]+)\/([\w\d\-\_]+)\/tree/ end end end \ No newline at end of file diff --git a/lib/gembox.rb b/lib/gembox.rb index 084746c..b01f209 100644 --- a/lib/gembox.rb +++ b/lib/gembox.rb @@ -1,84 +1,83 @@ -require 'active_support' require File.join(File.dirname(__FILE__), 'extensions') module Gembox class GemList < Array def [](*args) if args.first.is_a?(String) search(args.first) else super end end def []=(key, value) if key.is_a?(String) if versions = search(key) versions.replace([key, value]) else self << [key, value] end else super end end def search(key) i = find {|v| if v.is_a?(Array) v[0] == key else v == key end } i.is_a?(Array) ? i[1] : i end def has_key?(key) !search(key).nil? end end class Gems class << self attr_accessor :source_index def load @source_index ||= ::Gem.source_index local_gems end def local_gems @local_gems ||= group_gems(source_index.gems) end def search(search_term, version = nil) version = version ? Gem::Requirement.create(version) : Gem::Requirement.default gems = source_index.search Gem::Dependency.new(/^#{Regexp.escape(search_term)}/, version) group_gems(gems) end def stats num_versions = source_index.length num_gems = local_gems.length oldest_gem = source_index.min {|a,b| a[1].date <=> b[1].date }.last {:num_versions => num_versions, :num_gems => num_gems, :oldest_gem => oldest_gem} end protected def group_gems(gem_collection) gem_hash = GemList.new gem_collection = gem_collection.values if gem_collection.is_a?(Hash) gem_collection.each do |spec| gem_hash[spec.name] ||= [] gem_hash[spec.name] << spec gem_hash[spec.name].sort! {|a,b| (b.version || 0) <=> (a.version || 0) } end gem_hash.sort {|a, b| a[0].downcase <=> b[0].downcase } end end end end \ No newline at end of file diff --git a/views/gembox.sass b/views/gembox.sass index 4f56e5c..51f665c 100644 --- a/views/gembox.sass +++ b/views/gembox.sass @@ -1,151 +1,166 @@ !red = #BA2818 !light_red = #EB9281 !dark_red = #871D1A !light_grey = #CCCCCC !light_grey_bg = #EFEFEF !grey = #666 - +!fonts = "'Franklin Gothic', 'Franklin Gothic Medium', Helvetica, sans-serif" // body - :font-family 'Franklin Gothic', 'Franklin Gothic Medium', Helvetica, sans-serif + :font-family = !fonts :background #FFFFFF :margin 0px :padding 0px :text-align center a:link, a:visited :color = !red :text-decoration none a:hover :color = !light_red :text-decoration underline a img :border none .contained :width 960px :margin 0px auto :text-align left :position relative #header .contained :width 250px #logo :position absolute :top -20px :left -135px h1 :color = !dark_red :font-size 50px :margin 20px 0px 0px 0px a :color = !dark_red a:hover :text-decoration none #nav :background = !dark_red :padding 15px .search + :margin-top 20px + :width 100% + :text-align center + input + :font-family = !fonts + :font-size 18px + :padding 4px + .search_field + :width 400px + #stats :background = !light_grey_bg :margin 0px 0px 10px 0px :padding 2px p :text-align center :color = !grey #main h2 :position relative span.view_options :font-size 14px :font-weight normal :color = !grey :position absolute :top 5px :right 20px + strong + :color #333 + :font-weight normal + .num + :color = !light_grey .column :width 460px :float left .gem :font-size 14px :margin 5px 0px :padding 5px 0px .name :font-size 16px :margin 0px :padding 0px 0px 2px 0px .description :font-size 12px :padding 2px 0px :color #999 .versions :color = !light_grey a :color = !grey table#gems :border-collapse collapse :font-size 14px :width 100% th :color = !grey :text-align left :font-size 12px :font-weight normal :border-bottom 1px solid #CCC td :padding 4px 4px 4px 0px :vertical-align top tr.summary td :padding-top 0px #gem .description :font-size 18px :color = #333 .meta :color = !grey ul.files, ul.files li ul :list-style none :font-size 14px :font-weight normal :margin 0px :padding 4px 0px 0px ul.files li :padding 4px 0px li ul li :padding-left 10px img :vertical-align top .pagination :font-size 12px :color = !grey :width 100% :background = !light_grey_bg :padding 4px :text-align right a :color = !dark_red a, span :padding 0px 4px #footer :margin 20px :padding 10px :border-top = 1px solid !light_grey .copyright :font-size 12px .clear :clear both :line-height 0px :height 0px \ No newline at end of file diff --git a/views/gems_columns.haml b/views/gems_columns.haml index 51cd01c..a60e716 100644 --- a/views/gems_columns.haml +++ b/views/gems_columns.haml @@ -1,13 +1,16 @@ =haml(:gems_header, :layout => false) -#gems - [email protected]_groups_of((@gems.length + 1)/ 2).each do |gems| - .column - -gems.compact.each do |gem_name, specs| - .gem - %h4.name=link_to_gem(specs.first) - .description=specs.first.summary - .versions - %span - =specs.collect {|spec| link_to_gem(spec, :text => spec.version) }.join(', ') - .clear -=will_paginate(@gems) \ No newline at end of file +- unless @gems.empty? + #gems + [email protected]_groups_of((@gems.length + 1)/ 2).each do |gems| + .column + -gems.compact.each do |gem_name, specs| + .gem + %h4.name=link_to_gem(specs.first) + .description=specs.first.summary + .versions + %span + =specs.collect {|spec| link_to_gem(spec, :text => spec.version) }.join(', ') + .clear + =will_paginate(@gems) +- else + =haml(:no_results, :layout => false) \ No newline at end of file diff --git a/views/gems_header.haml b/views/gems_header.haml index c703183..df95228 100644 --- a/views/gems_header.haml +++ b/views/gems_header.haml @@ -1,11 +1,17 @@ %h2 - = @search || 'Installed Gems' + -if @search + Gems matching + %em=@search + %span.num="(#{@gems.length})" + -else + Installed Gems + %span.num="(#{@gems.total_entries})" %span.view_options View as - =link_to('Columns', {'as' => 'columns'}) + =(@show_as == 'columns') ? '<strong>Columns</strong>' : link_to('Columns', {'as' => 'columns'}) =' / ' - =link_to('Table', {'as' => 'table'}) + =(@show_as == 'table') ? '<strong>Table</strong>' : link_to('Table', {'as' => 'table'}) | =link_to('Summaries', {'summaries' => 'false'}) =will_paginate(@gems) \ No newline at end of file diff --git a/views/gems_table.haml b/views/gems_table.haml index 294c7c9..f5f9acf 100644 --- a/views/gems_table.haml +++ b/views/gems_table.haml @@ -1,16 +1,19 @@ =haml(:gems_header, :layout => false) -%table#gems - %thead - %th Name - %th Versions - %th Homepage - %tbody - [email protected] do |gem_name, specs| - %tr.gem - %td.name=link_to_gem(specs.first) - %td.versions=specs.collect {|spec| link_to_gem(spec, :text => spec.version) }.join(', ') - %td=link_to(specs.first.homepage) - %tr.gem.summary - %td/ - %td.description{:colspan => 2}=specs.first.summary - \ No newline at end of file +- unless @gems.empty? + %table#gems + %thead + %th Name + %th Versions + %th Homepage + %tbody + [email protected] do |gem_name, specs| + %tr.gem + %td.name=link_to_gem(specs.first) + %td.versions=specs.collect {|spec| link_to_gem(spec, :text => spec.version) }.join(', ') + %td=link_to(specs.first.homepage) + %tr.gem.summary + %td/ + %td.description{:colspan => 2}=specs.first.summary + =will_paginate(@gems) +- else + =haml(:no_results, :layout => false) \ No newline at end of file diff --git a/views/layout.haml b/views/layout.haml index 0a44557..4fbd152 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -1,43 +1,43 @@ %html{:xmlns=> "http://www.w3.org/1999/xhtml", 'xml:lang' => "en", :lang => "en"} %head %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"} %title Gembox %link{'href' => '/stylesheets/gembox.css', 'rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen'} -['jquery', 'jquery.ui', 'jquery.metadata', 'jquery.form', 'base', 'gembox'].each do |jslib| %script{'type' => 'text/javascript', 'src' => "/javascripts/#{jslib}.js"} %body #container #header .contained %img{:src => '/images/rubygems-125x125t.png', :alt => 'Rubygems logo', :id => 'logo'} %h1=link_to('Gembox', '/') #nav .contained .search %form{:method => 'get', :action => '/gems'} - %input{:type => 'text', :name => 'search'} + %input{:type => 'text', :name => 'search', :value => @search, :class => 'search_field', :tabindex => 1} %input{:type => 'submit', :value => 'Search'} #stats .contained %p You have =@stats[:num_versions] versions of =@stats[:num_gems] gems. Your oldest gem is =link_to_gem(@stats[:oldest_gem]) from =ts(@stats[:oldest_gem].date) #main.contained =yield #footer %p.copyright Gembox, developed by =link_to 'Quirkey.', 'http://code.quirkey.com' Powered by =link_to 'Sinatra.', 'http://sinatrrb.com' %p.copyright Hey! I'm =link_to 'open-source!', 'http://github.com/quirkey/gembox' \ No newline at end of file diff --git a/views/no_results.haml b/views/no_results.haml new file mode 100644 index 0000000..d0dac19 --- /dev/null +++ b/views/no_results.haml @@ -0,0 +1,3 @@ +.no_results + %p + Sorry, your search returned no results. \ No newline at end of file
quirkey/gembox
71ce37b98dbe718cda39bc882429a6a302b5e671
Cleaned up stats
diff --git a/gembox.rb b/gembox.rb index c5b5a0c..125d51a 100644 --- a/gembox.rb +++ b/gembox.rb @@ -1,126 +1,127 @@ require 'rubygems' require 'sinatra' require 'will_paginate/array' require 'will_paginate/view_helpers' require File.join(File.dirname(__FILE__), 'lib', 'gembox') Gembox::Gems.load helpers do def tag_options(options, escape = true) - options.collect {|k,v| %{#{k}="#{v}"}}.join(' ') + option_string = options.collect {|k,v| %{#{k}="#{v}"}}.join(' ') + option_string = " " + option_string unless option_string.blank? end def content_tag(name, content, options, escape = true) tag_options = tag_options(options, escape) if options "<#{name}#{tag_options}>#{content}</#{name}>" end def link_to(text, link = nil, options = {}) link ||= text link = url_for(link) "<a href=\"#{link}\">#{text}</a>" end def link_to_gem(gem, options = {}) text = options[:text] || gem.name version = gem.version if options[:show_version] link_to(text, "/gems/#{gem.name}/#{gem.version}") end def url_for(link_options) case link_options when Hash path = link_options.delete(:path) || request.path_info params.delete('captures') path + '?' + build_query(params.merge(link_options)) else link_options end end def ts(time) time.strftime('%b %d, %Y') if time end def clippy(text, bgcolor='#FFFFFF') html = <<-EOF <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="110" height="14" id="clippy" > <param name="movie" value="/swf/clippy.swf"/> <param name="allowScriptAccess" value="always" /> <param name="quality" value="high" /> <param name="scale" value="noscale" /> <param NAME="FlashVars" value="text=#{text}"> <param name="bgcolor" value="#{bgcolor}"> <embed src="/swf/clippy.swf" width="110" height="14" name="clippy" quality="high" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" FlashVars="text=#{text}" bgcolor="#{bgcolor}" /> </object> EOF end include WillPaginate::ViewHelpers end set :public, 'public' set :views, 'views' before do @gems = Gembox::Gems.local_gems.paginate :page => params[:page], :per_page => 30 @stats = Gembox::Gems.stats end get '/stylesheets/:stylesheet.css' do sass params[:stylesheet].to_sym end get '/' do redirect '/gems' end get %r{/gems/([\w\-\_]+)/?([\d\.]+)?/?} do show_layout = params[:layout] != 'false' name, version = params[:captures] @gems = Gembox::Gems.search(name) raise Sinatra::NotFound if @gems.empty? @gem_versions = @gems[0][1] if version @gems = Gembox::Gems.search(name, version) @gem = @gems.shift[1].first if @gems end if !@gem @gem = @gem_versions.shift redirect "/gems/#{@gem.name}/#{@gem.version}" end if params[:file] action = params[:action] || view file_path = File.join(@gem.full_gem_path, params[:file]) if File.readable?(file_path) if action == 'edit' `$EDITOR #{file_path}` else response.headers['Content-type'] = 'text/plain' return File.read(file_path) end end end haml :gem, :layout => show_layout end get '/gems/?' do show_layout = params[:layout] != 'false' show_as = params[:as] || 'columns' haml "gems_#{show_as}".to_sym, :layout => show_layout end \ No newline at end of file diff --git a/views/gembox.sass b/views/gembox.sass index 1125caa..4f56e5c 100644 --- a/views/gembox.sass +++ b/views/gembox.sass @@ -1,129 +1,151 @@ !red = #BA2818 !light_red = #EB9281 !dark_red = #871D1A !light_grey = #CCCCCC +!light_grey_bg = #EFEFEF !grey = #666 + +// + body :font-family 'Franklin Gothic', 'Franklin Gothic Medium', Helvetica, sans-serif :background #FFFFFF :margin 0px :padding 0px :text-align center a:link, a:visited :color = !red :text-decoration none a:hover :color = !light_red :text-decoration underline a img :border none .contained :width 960px :margin 0px auto :text-align left :position relative #header .contained - :width 400px + :width 250px #logo :position absolute :top -20px :left -135px h1 :color = !dark_red :font-size 50px :margin 20px 0px 0px 0px a :color = !dark_red a:hover :text-decoration none #nav :background = !dark_red :padding 15px .search - - +#stats + :background = !light_grey_bg + :margin 0px 0px 10px 0px + :padding 2px + p + :text-align center + :color = !grey + #main h2 :position relative - span.view_options :font-size 14px :font-weight normal :color = !grey :position absolute :top 5px :right 20px .column :width 460px :float left .gem :font-size 14px :margin 5px 0px :padding 5px 0px .name :font-size 16px :margin 0px :padding 0px 0px 2px 0px .description :font-size 12px :padding 2px 0px :color #999 .versions :color = !light_grey a :color = !grey table#gems :border-collapse collapse :font-size 14px :width 100% th :color = !grey :text-align left :font-size 12px :font-weight normal :border-bottom 1px solid #CCC td :padding 4px 4px 4px 0px :vertical-align top tr.summary td :padding-top 0px #gem .description :font-size 18px :color = #333 .meta :color = !grey ul.files, ul.files li ul :list-style none :font-size 14px :font-weight normal :margin 0px :padding 4px 0px 0px ul.files li :padding 4px 0px li ul li :padding-left 10px img :vertical-align top - + +.pagination + :font-size 12px + :color = !grey + :width 100% + :background = !light_grey_bg + :padding 4px + :text-align right + a + :color = !dark_red + a, + span + :padding 0px 4px + #footer :margin 20px :padding 10px :border-top = 1px solid !light_grey .copyright :font-size 12px .clear :clear both :line-height 0px :height 0px \ No newline at end of file diff --git a/views/gems_header.haml b/views/gems_header.haml index 0c85e44..c703183 100644 --- a/views/gems_header.haml +++ b/views/gems_header.haml @@ -1,10 +1,11 @@ %h2 = @search || 'Installed Gems' %span.view_options View as =link_to('Columns', {'as' => 'columns'}) =' / ' =link_to('Table', {'as' => 'table'}) | =link_to('Summaries', {'summaries' => 'false'}) - \ No newline at end of file + +=will_paginate(@gems) \ No newline at end of file diff --git a/views/layout.haml b/views/layout.haml index ebfadf1..0a44557 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -1,43 +1,43 @@ %html{:xmlns=> "http://www.w3.org/1999/xhtml", 'xml:lang' => "en", :lang => "en"} %head %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"} %title Gembox %link{'href' => '/stylesheets/gembox.css', 'rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen'} -['jquery', 'jquery.ui', 'jquery.metadata', 'jquery.form', 'base', 'gembox'].each do |jslib| %script{'type' => 'text/javascript', 'src' => "/javascripts/#{jslib}.js"} %body #container #header .contained %img{:src => '/images/rubygems-125x125t.png', :alt => 'Rubygems logo', :id => 'logo'} %h1=link_to('Gembox', '/') #nav .contained - .stats - %p - You have - =@stats[:num_versions] - versions of - =@stats[:num_gems] - gems. - Your oldest gem is - =link_to_gem(@stats[:oldest_gem]) - from - =ts(@stats[:oldest_gem].date) - .search %form{:method => 'get', :action => '/gems'} %input{:type => 'text', :name => 'search'} %input{:type => 'submit', :value => 'Search'} - + #stats + .contained + %p + You have + =@stats[:num_versions] + versions of + =@stats[:num_gems] + gems. + Your oldest gem is + =link_to_gem(@stats[:oldest_gem]) + from + =ts(@stats[:oldest_gem].date) + #main.contained =yield #footer %p.copyright Gembox, developed by =link_to 'Quirkey.', 'http://code.quirkey.com' Powered by =link_to 'Sinatra.', 'http://sinatrrb.com' %p.copyright Hey! I'm =link_to 'open-source!', 'http://github.com/quirkey/gembox' \ No newline at end of file
quirkey/gembox
2868a2b73244a4c6261b7fe9b41d899c2f5f539a
Got pagination working
diff --git a/gembox.rb b/gembox.rb index e40909b..c5b5a0c 100644 --- a/gembox.rb +++ b/gembox.rb @@ -1,112 +1,126 @@ require 'rubygems' require 'sinatra' +require 'will_paginate/array' +require 'will_paginate/view_helpers' require File.join(File.dirname(__FILE__), 'lib', 'gembox') Gembox::Gems.load helpers do - def link_to(text, link = nil) + def tag_options(options, escape = true) + options.collect {|k,v| %{#{k}="#{v}"}}.join(' ') + end + + def content_tag(name, content, options, escape = true) + tag_options = tag_options(options, escape) if options + "<#{name}#{tag_options}>#{content}</#{name}>" + end + + def link_to(text, link = nil, options = {}) link ||= text link = url_for(link) "<a href=\"#{link}\">#{text}</a>" end def link_to_gem(gem, options = {}) text = options[:text] || gem.name version = gem.version if options[:show_version] link_to(text, "/gems/#{gem.name}/#{gem.version}") end def url_for(link_options) case link_options when Hash path = link_options.delete(:path) || request.path_info params.delete('captures') path + '?' + build_query(params.merge(link_options)) else link_options end end def ts(time) time.strftime('%b %d, %Y') if time end def clippy(text, bgcolor='#FFFFFF') html = <<-EOF <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="110" height="14" id="clippy" > <param name="movie" value="/swf/clippy.swf"/> <param name="allowScriptAccess" value="always" /> <param name="quality" value="high" /> <param name="scale" value="noscale" /> <param NAME="FlashVars" value="text=#{text}"> <param name="bgcolor" value="#{bgcolor}"> <embed src="/swf/clippy.swf" width="110" height="14" name="clippy" quality="high" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" FlashVars="text=#{text}" bgcolor="#{bgcolor}" /> </object> EOF end + + include WillPaginate::ViewHelpers end set :public, 'public' set :views, 'views' before do - @gems = Gembox::Gems.local_gems + @gems = Gembox::Gems.local_gems.paginate :page => params[:page], :per_page => 30 @stats = Gembox::Gems.stats end get '/stylesheets/:stylesheet.css' do sass params[:stylesheet].to_sym end get '/' do redirect '/gems' end get %r{/gems/([\w\-\_]+)/?([\d\.]+)?/?} do show_layout = params[:layout] != 'false' name, version = params[:captures] @gems = Gembox::Gems.search(name) raise Sinatra::NotFound if @gems.empty? @gem_versions = @gems[0][1] if version @gems = Gembox::Gems.search(name, version) @gem = @gems.shift[1].first if @gems end if !@gem @gem = @gem_versions.shift redirect "/gems/#{@gem.name}/#{@gem.version}" end if params[:file] action = params[:action] || view file_path = File.join(@gem.full_gem_path, params[:file]) - if action == 'edit' - `$EDITOR #{file_path}` - else - headers['Content-type'] = 'text/plain' - File.read(file_path) - return + if File.readable?(file_path) + if action == 'edit' + `$EDITOR #{file_path}` + else + response.headers['Content-type'] = 'text/plain' + return File.read(file_path) + end end end haml :gem, :layout => show_layout end get '/gems/?' do show_layout = params[:layout] != 'false' show_as = params[:as] || 'columns' haml "gems_#{show_as}".to_sym, :layout => show_layout end \ No newline at end of file diff --git a/lib/gembox.rb b/lib/gembox.rb index ad2463d..084746c 100644 --- a/lib/gembox.rb +++ b/lib/gembox.rb @@ -1,84 +1,84 @@ require 'active_support' require File.join(File.dirname(__FILE__), 'extensions') module Gembox class GemList < Array - def [](key) - if key.is_a?(String) - search(key) + def [](*args) + if args.first.is_a?(String) + search(args.first) else super end end def []=(key, value) if key.is_a?(String) if versions = search(key) versions.replace([key, value]) else self << [key, value] end else super end end def search(key) i = find {|v| if v.is_a?(Array) v[0] == key else v == key end } i.is_a?(Array) ? i[1] : i end def has_key?(key) !search(key).nil? end end class Gems class << self attr_accessor :source_index def load @source_index ||= ::Gem.source_index local_gems end def local_gems @local_gems ||= group_gems(source_index.gems) end def search(search_term, version = nil) version = version ? Gem::Requirement.create(version) : Gem::Requirement.default gems = source_index.search Gem::Dependency.new(/^#{Regexp.escape(search_term)}/, version) group_gems(gems) end def stats num_versions = source_index.length num_gems = local_gems.length oldest_gem = source_index.min {|a,b| a[1].date <=> b[1].date }.last {:num_versions => num_versions, :num_gems => num_gems, :oldest_gem => oldest_gem} end protected def group_gems(gem_collection) gem_hash = GemList.new gem_collection = gem_collection.values if gem_collection.is_a?(Hash) gem_collection.each do |spec| gem_hash[spec.name] ||= [] gem_hash[spec.name] << spec gem_hash[spec.name].sort! {|a,b| (b.version || 0) <=> (a.version || 0) } end gem_hash.sort {|a, b| a[0].downcase <=> b[0].downcase } end end end end \ No newline at end of file diff --git a/views/gems_columns.haml b/views/gems_columns.haml index f5f76d6..51cd01c 100644 --- a/views/gems_columns.haml +++ b/views/gems_columns.haml @@ -1,12 +1,13 @@ =haml(:gems_header, :layout => false) #gems [email protected]_groups_of((@gems.length + 1)/ 2).each do |gems| .column -gems.compact.each do |gem_name, specs| .gem %h4.name=link_to_gem(specs.first) .description=specs.first.summary .versions %span =specs.collect {|spec| link_to_gem(spec, :text => spec.version) }.join(', ') - .clear \ No newline at end of file + .clear +=will_paginate(@gems) \ No newline at end of file
quirkey/gembox
943608bd323cc261dbee949c023b0c3f24e1bd7f
Fixed up gem view Added table view for gems
diff --git a/gembox.rb b/gembox.rb index c5e8e1f..e40909b 100644 --- a/gembox.rb +++ b/gembox.rb @@ -1,64 +1,112 @@ require 'rubygems' require 'sinatra' require File.join(File.dirname(__FILE__), 'lib', 'gembox') Gembox::Gems.load helpers do def link_to(text, link = nil) link ||= text link = url_for(link) "<a href=\"#{link}\">#{text}</a>" end + def link_to_gem(gem, options = {}) + text = options[:text] || gem.name + version = gem.version if options[:show_version] + link_to(text, "/gems/#{gem.name}/#{gem.version}") + end + def url_for(link_options) case link_options when Hash path = link_options.delete(:path) || request.path_info + params.delete('captures') path + '?' + build_query(params.merge(link_options)) else link_options end end + + def ts(time) + time.strftime('%b %d, %Y') if time + end + + def clippy(text, bgcolor='#FFFFFF') + html = <<-EOF + <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" + width="110" + height="14" + id="clippy" > + <param name="movie" value="/swf/clippy.swf"/> + <param name="allowScriptAccess" value="always" /> + <param name="quality" value="high" /> + <param name="scale" value="noscale" /> + <param NAME="FlashVars" value="text=#{text}"> + <param name="bgcolor" value="#{bgcolor}"> + <embed src="/swf/clippy.swf" + width="110" + height="14" + name="clippy" + quality="high" + allowScriptAccess="always" + type="application/x-shockwave-flash" + pluginspage="http://www.macromedia.com/go/getflashplayer" + FlashVars="text=#{text}" + bgcolor="#{bgcolor}" + /> + </object> + EOF + end end set :public, 'public' set :views, 'views' before do @gems = Gembox::Gems.local_gems @stats = Gembox::Gems.stats end get '/stylesheets/:stylesheet.css' do sass params[:stylesheet].to_sym end get '/' do - haml :index + redirect '/gems' end get %r{/gems/([\w\-\_]+)/?([\d\.]+)?/?} do show_layout = params[:layout] != 'false' name, version = params[:captures] @gems = Gembox::Gems.search(name) raise Sinatra::NotFound if @gems.empty? @gem_versions = @gems[0][1] if version @gems = Gembox::Gems.search(name, version) @gem = @gems.shift[1].first if @gems end if !@gem @gem = @gem_versions.shift redirect "/gems/#{@gem.name}/#{@gem.version}" end + if params[:file] + action = params[:action] || view + file_path = File.join(@gem.full_gem_path, params[:file]) + if action == 'edit' + `$EDITOR #{file_path}` + else + headers['Content-type'] = 'text/plain' + File.read(file_path) + return + end + end haml :gem, :layout => show_layout end get '/gems/?' do show_layout = params[:layout] != 'false' show_as = params[:as] || 'columns' haml "gems_#{show_as}".to_sym, :layout => show_layout -end - +end \ No newline at end of file diff --git a/lib/extensions.rb b/lib/extensions.rb new file mode 100644 index 0000000..104bc64 --- /dev/null +++ b/lib/extensions.rb @@ -0,0 +1,21 @@ +module Gem + class Specification + + def files_tree + tree = {} + files.each do |file| + split_dirs = file.split(/\//) + keyed_hash = {} + split_dirs.reverse.each do |key| + keyed_hash = {key => keyed_hash} + end + tree.deep_merge!(keyed_hash) + end + tree + end + + def on_github? + homepage =~ /github\.com/ + end + end +end \ No newline at end of file diff --git a/lib/gembox.rb b/lib/gembox.rb index db0fafa..ad2463d 100644 --- a/lib/gembox.rb +++ b/lib/gembox.rb @@ -1,84 +1,84 @@ require 'active_support' - +require File.join(File.dirname(__FILE__), 'extensions') module Gembox class GemList < Array def [](key) if key.is_a?(String) search(key) else super end end def []=(key, value) if key.is_a?(String) if versions = search(key) versions.replace([key, value]) else self << [key, value] end else super end end def search(key) i = find {|v| if v.is_a?(Array) v[0] == key else v == key end } i.is_a?(Array) ? i[1] : i end def has_key?(key) !search(key).nil? end end class Gems class << self attr_accessor :source_index def load @source_index ||= ::Gem.source_index local_gems end def local_gems @local_gems ||= group_gems(source_index.gems) end def search(search_term, version = nil) version = version ? Gem::Requirement.create(version) : Gem::Requirement.default gems = source_index.search Gem::Dependency.new(/^#{Regexp.escape(search_term)}/, version) group_gems(gems) end def stats num_versions = source_index.length num_gems = local_gems.length oldest_gem = source_index.min {|a,b| a[1].date <=> b[1].date }.last {:num_versions => num_versions, :num_gems => num_gems, :oldest_gem => oldest_gem} end protected def group_gems(gem_collection) gem_hash = GemList.new gem_collection = gem_collection.values if gem_collection.is_a?(Hash) gem_collection.each do |spec| gem_hash[spec.name] ||= [] gem_hash[spec.name] << spec gem_hash[spec.name].sort! {|a,b| (b.version || 0) <=> (a.version || 0) } end gem_hash.sort {|a, b| a[0].downcase <=> b[0].downcase } end end end end \ No newline at end of file diff --git a/public/images/edit.png b/public/images/edit.png new file mode 100755 index 0000000..0bfecd5 Binary files /dev/null and b/public/images/edit.png differ diff --git a/public/images/folder.png b/public/images/folder.png new file mode 100755 index 0000000..784e8fa Binary files /dev/null and b/public/images/folder.png differ diff --git a/public/images/git.gif b/public/images/git.gif new file mode 100644 index 0000000..ff5af0c Binary files /dev/null and b/public/images/git.gif differ diff --git a/public/images/page.png b/public/images/page.png new file mode 100755 index 0000000..03ddd79 Binary files /dev/null and b/public/images/page.png differ diff --git a/public/images/page_white_text.png b/public/images/page_white_text.png new file mode 100755 index 0000000..813f712 Binary files /dev/null and b/public/images/page_white_text.png differ diff --git a/public/swf/clippy.swf b/public/swf/clippy.swf new file mode 100755 index 0000000..e46886c Binary files /dev/null and b/public/swf/clippy.swf differ diff --git a/test/test_gembox_app.rb b/test/test_gembox_app.rb index 2991015..c903351 100644 --- a/test/test_gembox_app.rb +++ b/test/test_gembox_app.rb @@ -1,126 +1,126 @@ require File.join(File.dirname(__FILE__), 'test_helper') describe "Gembox App" do describe 'getting /' do before do get '/' end should 'load the index' do should.be.ok end should "display gem list" do body.should have_element('#gems') end should "display list of installed gems" do body.should have_element('.gem', /sinatra/) end should "display as 4 columns" do body.should have_element('.column') end end describe 'getting gems/ with layout = false' do before do get '/gems/?layout=false' end should "load" do should.be.ok end should "not display layout" do body.should.not have_element('html') end should "display gem list" do body.should have_element('#gems') end should "display as 4 columns" do body.should have_element('.column') end end describe 'getting gems/ with a simple search' do before do get '/gems/?search=s' end should "load" do should.be.ok end should "display gem list" do body.should have_element('#gems') end should "display gems that match the search" do body.should have_element('.gem', /sinatra/) end should "not display gems that do not match the search" do body.should.not have_element('.gem', /rack/) end end describe 'getting gems/ with as = table' do before do get '/gems/?layout=false&as=table' end should "load" do should.be.ok end should "not display layout" do body.should.not have_element('html') end should "display gem list" do body.should have_element('#gems') end should "display as table" do body.should have_element('table#gems') body.should have_element('table#gems tr.gem') end end describe 'getting gems/:name' do before do get '/gems/sinatra' end should "redirect to most recent version" do - status.should.be 302 + status.should.be.equal 302 end end describe 'getting gems/name/version' do before do get '/gems/sinatra/0.9.0.4' end should "display only specific gem" do body.should.not have_element('.gem', /rack/) end should "display link to gems website" do body.should have_element('a', 'http://sinatra.rubyforge.org') end should "load gem spec specified version" do body.should have_element('.version', '0.9.0.4') end should "display links to all versions" do body.should have_element('.other_versions a[href="/gems/sinatra/"]') end end end \ No newline at end of file diff --git a/views/file_tree.haml b/views/file_tree.haml new file mode 100644 index 0000000..acae7d4 --- /dev/null +++ b/views/file_tree.haml @@ -0,0 +1,12 @@ +-subdirs = (files && !files.empty?) +%li + %img{'src' => "/images/#{(subdirs ? 'folder.png' : 'page.png')}"} + =dir + =link_to('<img src="/images/edit.png" alt="Edit"/>', url_for(:file => parent, :action => 'edit')) + =link_to('<img src="/images/page_white_text.png" alt="View Raw"/>', url_for(:file => parent, :action => 'view')) unless subdirs + =link_to('<img src="/images/git.gif" alt="On Github"/>', "#{@gem.homepage}/blob/master/#{parent}") if @gem.on_github? + =clippy(File.join(@gem.full_gem_path, parent)) + -if subdirs + %ul + -files.each do |dir, files| + =haml(:file_tree, :locals => {:dir => dir, :files => files, :parent => File.join(parent, dir)}, :layout => false) \ No newline at end of file diff --git a/views/gem.haml b/views/gem.haml index 9622b8a..41ec973 100644 --- a/views/gem.haml +++ b/views/gem.haml @@ -1,21 +1,45 @@ #gem %h2 [email protected] %[email protected] .description %[email protected] + .meta %p.authors By [email protected](', ') ='(' + link_to(@gem.email, "mailto:#{@gem.email}") + ')' - %p.url=link_to(@gem.homepage) - .dependencies - %h3 Dependencies + %p.url + Homepage: + =link_to(@gem.homepage) + -unless @gem.rubyforge_project.blank? + %p.url + Rubyforge: + =link_to("http://rubyforge.org/projects/#{@gem.rubyforge_project}") + %p.released + Released + =ts(@gem.date) + %h3.toggler Dependencies + #dependencies.toggle_area [email protected] do |dependency| .gem =link_to(dependency.name, "/gems/#{dependency.name}") %span.version=dependency.version_requirements - - -%[email protected]_yaml \ No newline at end of file + %h3.toggler Other Versions + #versions.toggle_area + %table + %tbody + -@gem_versions.each do |spec| + %tr + %td=link_to(spec.version, "/gems/#{spec.name}/#{spec.version}") + %td=ts(spec.date) + + %h3.toggler Files + #files.toggle_area + %ul.files + =haml(:file_tree, :locals => {:dir => '/', :files => {}, :parent => ''}, :layout => false) + [email protected]_tree.each do |dir, files| + =haml(:file_tree, :locals => {:dir => dir, :files => files, :parent => dir}, :layout => false) + +/ %[email protected]_yaml \ No newline at end of file diff --git a/views/gembox.sass b/views/gembox.sass index 7d42ef7..1125caa 100644 --- a/views/gembox.sass +++ b/views/gembox.sass @@ -1,70 +1,129 @@ !red = #BA2818 !light_red = #EB9281 !dark_red = #871D1A !light_grey = #CCCCCC !grey = #666 body :font-family 'Franklin Gothic', 'Franklin Gothic Medium', Helvetica, sans-serif :background #FFFFFF :margin 0px :padding 0px :text-align center a:link, a:visited :color = !red :text-decoration none a:hover :color = !light_red :text-decoration underline +a img + :border none + .contained :width 960px :margin 0px auto :text-align left :position relative #header .contained :width 400px #logo :position absolute :top -20px :left -135px h1 :color = !dark_red :font-size 50px :margin 20px 0px 0px 0px + a + :color = !dark_red + a:hover + :text-decoration none #nav :background = !dark_red :padding 15px .search #main + h2 + :position relative + + span.view_options + :font-size 14px + :font-weight normal + :color = !grey + :position absolute + :top 5px + :right 20px .column :width 460px :float left - .gem - :font-size 14px - :margin 5px 0px - :padding 5px 0px - h4 - :font-size 16px - :margin 0px - :padding 0px 0px 5px 0px - .versions a + .gem + :font-size 14px + :margin 5px 0px + :padding 5px 0px + .name + :font-size 16px + :margin 0px + :padding 0px 0px 2px 0px + .description + :font-size 12px + :padding 2px 0px + :color #999 + .versions + :color = !light_grey + a :color = !grey - + table#gems + :border-collapse collapse + :font-size 14px + :width 100% + th + :color = !grey + :text-align left + :font-size 12px + :font-weight normal + :border-bottom 1px solid #CCC + td + :padding 4px 4px 4px 0px + :vertical-align top + tr.summary td + :padding-top 0px + +#gem + .description + :font-size 18px + :color = #333 + .meta + :color = !grey + ul.files, + ul.files li ul + :list-style none + :font-size 14px + :font-weight normal + :margin 0px + :padding 4px 0px 0px + ul.files + li + :padding 4px 0px + li ul li + :padding-left 10px + img + :vertical-align top + #footer :margin 20px :padding 10px :border-top = 1px solid !light_grey .copyright :font-size 12px .clear :clear both :line-height 0px :height 0px \ No newline at end of file diff --git a/views/gems_columns.haml b/views/gems_columns.haml index 7cdc5e5..f5f76d6 100644 --- a/views/gems_columns.haml +++ b/views/gems_columns.haml @@ -1,10 +1,12 @@ +=haml(:gems_header, :layout => false) #gems [email protected]_groups_of((@gems.length + 1)/ 2).each do |gems| .column -gems.compact.each do |gem_name, specs| .gem - %h4=link_to(gem_name, "/gems/#{gem_name}") + %h4.name=link_to_gem(specs.first) + .description=specs.first.summary .versions %span - =specs.collect {|spec| link_to(spec.version, "/gems/#{gem_name}/#{spec.version}") }.join(', ') + =specs.collect {|spec| link_to_gem(spec, :text => spec.version) }.join(', ') .clear \ No newline at end of file diff --git a/views/gems_header.haml b/views/gems_header.haml new file mode 100644 index 0000000..0c85e44 --- /dev/null +++ b/views/gems_header.haml @@ -0,0 +1,10 @@ +%h2 + = @search || 'Installed Gems' + %span.view_options + View as + =link_to('Columns', {'as' => 'columns'}) + =' / ' + =link_to('Table', {'as' => 'table'}) + | + =link_to('Summaries', {'summaries' => 'false'}) + \ No newline at end of file diff --git a/views/gems_table.haml b/views/gems_table.haml index e69de29..294c7c9 100644 --- a/views/gems_table.haml +++ b/views/gems_table.haml @@ -0,0 +1,16 @@ +=haml(:gems_header, :layout => false) +%table#gems + %thead + %th Name + %th Versions + %th Homepage + %tbody + [email protected] do |gem_name, specs| + %tr.gem + %td.name=link_to_gem(specs.first) + %td.versions=specs.collect {|spec| link_to_gem(spec, :text => spec.version) }.join(', ') + %td=link_to(specs.first.homepage) + %tr.gem.summary + %td/ + %td.description{:colspan => 2}=specs.first.summary + \ No newline at end of file diff --git a/views/index.haml b/views/index.haml index b00e720..0c03d5e 100644 --- a/views/index.haml +++ b/views/index.haml @@ -1,2 +1 @@ -%h2 Installed Gems =haml :gems_columns, :locals => {:gems => @gems}, :layout => false \ No newline at end of file diff --git a/views/layout.haml b/views/layout.haml index 52d0b3d..ebfadf1 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -1,48 +1,43 @@ %html{:xmlns=> "http://www.w3.org/1999/xhtml", 'xml:lang' => "en", :lang => "en"} %head %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"} %title Gembox %link{'href' => '/stylesheets/gembox.css', 'rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen'} -['jquery', 'jquery.ui', 'jquery.metadata', 'jquery.form', 'base', 'gembox'].each do |jslib| %script{'type' => 'text/javascript', 'src' => "/javascripts/#{jslib}.js"} %body #container #header .contained %img{:src => '/images/rubygems-125x125t.png', :alt => 'Rubygems logo', :id => 'logo'} - %h1 Gembox + %h1=link_to('Gembox', '/') #nav .contained .stats %p You have =@stats[:num_versions] versions of =@stats[:num_gems] gems. - %p Your oldest gem is - =@stats[:oldest_gem].name + =link_to_gem(@stats[:oldest_gem]) from - =@stats[:oldest_gem].date + =ts(@stats[:oldest_gem].date) .search %form{:method => 'get', :action => '/gems'} %input{:type => 'text', :name => 'search'} %input{:type => 'submit', :value => 'Search'} - .view_options - View as - =link_to('Columns', {:as => 'columns'}) - =' / ' - =link_to('Table', {:as => 'table'}) + #main.contained =yield #footer %p.copyright Gembox, developed by =link_to 'Quirkey.', 'http://code.quirkey.com' Powered by =link_to 'Sinatra.', 'http://sinatrrb.com' %p.copyright Hey! I'm =link_to 'open-source!', 'http://github.com/quirkey/gembox' \ No newline at end of file
quirkey/gembox
96ff40920a2eed1ac2ba516b6be49adde1bfa4cb
Fixing gembox_gems test failures
diff --git a/gembox.rb b/gembox.rb index a62926e..c5e8e1f 100644 --- a/gembox.rb +++ b/gembox.rb @@ -1,57 +1,64 @@ require 'rubygems' require 'sinatra' require File.join(File.dirname(__FILE__), 'lib', 'gembox') Gembox::Gems.load helpers do def link_to(text, link = nil) link ||= text link = url_for(link) "<a href=\"#{link}\">#{text}</a>" end def url_for(link_options) case link_options when Hash path = link_options.delete(:path) || request.path_info path + '?' + build_query(params.merge(link_options)) else link_options end end end set :public, 'public' set :views, 'views' before do @gems = Gembox::Gems.local_gems @stats = Gembox::Gems.stats end get '/stylesheets/:stylesheet.css' do sass params[:stylesheet].to_sym end get '/' do haml :index end get %r{/gems/([\w\-\_]+)/?([\d\.]+)?/?} do show_layout = params[:layout] != 'false' name, version = params[:captures] - @gems = Gembox::Gems.search(name, version) + @gems = Gembox::Gems.search(name) raise Sinatra::NotFound if @gems.empty? - @gem_versions = @gems.shift[1] - @gem = @gem_versions.shift + @gem_versions = @gems[0][1] + if version + @gems = Gembox::Gems.search(name, version) + @gem = @gems.shift[1].first if @gems + end + if !@gem + @gem = @gem_versions.shift + redirect "/gems/#{@gem.name}/#{@gem.version}" + end haml :gem, :layout => show_layout end get '/gems/?' do show_layout = params[:layout] != 'false' show_as = params[:as] || 'columns' haml "gems_#{show_as}".to_sym, :layout => show_layout end diff --git a/test/test_gembox_app.rb b/test/test_gembox_app.rb index 2647a7c..2991015 100644 --- a/test/test_gembox_app.rb +++ b/test/test_gembox_app.rb @@ -1,138 +1,126 @@ require File.join(File.dirname(__FILE__), 'test_helper') describe "Gembox App" do describe 'getting /' do before do get '/' end should 'load the index' do should.be.ok end should "display gem list" do body.should have_element('#gems') end should "display list of installed gems" do body.should have_element('.gem', /sinatra/) end should "display as 4 columns" do body.should have_element('.column') end end describe 'getting gems/ with layout = false' do before do get '/gems/?layout=false' end should "load" do should.be.ok end should "not display layout" do body.should.not have_element('html') end should "display gem list" do body.should have_element('#gems') end should "display as 4 columns" do body.should have_element('.column') end end describe 'getting gems/ with a simple search' do before do get '/gems/?search=s' end should "load" do should.be.ok end should "display gem list" do body.should have_element('#gems') end should "display gems that match the search" do body.should have_element('.gem', /sinatra/) end should "not display gems that do not match the search" do body.should.not have_element('.gem', /rack/) end end describe 'getting gems/ with as = table' do before do get '/gems/?layout=false&as=table' end should "load" do should.be.ok end should "not display layout" do body.should.not have_element('html') end should "display gem list" do body.should have_element('#gems') end should "display as table" do body.should have_element('table#gems') body.should have_element('table#gems tr.gem') end end describe 'getting gems/:name' do before do get '/gems/sinatra' end - - should "display only specific gem" do - body.should.not have_element('.gem', /rack/) - end - - should "display link to gems website" do - body.should have_element('a', 'http://sinatra.rubyforge.org') - end - - should "load gem spec for latest version" do - body.should have_element('.version', '0.9.0.5') - end - - should "display links to all versions" do - body.should have_element('.other_versions a[href="/gems/sinatra/0.9.0.2"]') + + should "redirect to most recent version" do + status.should.be 302 end end describe 'getting gems/name/version' do before do - get '/gems/sinatra/0.9.0.2' + get '/gems/sinatra/0.9.0.4' end should "display only specific gem" do body.should.not have_element('.gem', /rack/) end should "display link to gems website" do body.should have_element('a', 'http://sinatra.rubyforge.org') end should "load gem spec specified version" do - body.should have_element('.version', '0.9.0.2') + body.should have_element('.version', '0.9.0.4') end should "display links to all versions" do - body.should have_element('.other_versions a[href="/gems/sinatra/0.9.0.5"]') + body.should have_element('.other_versions a[href="/gems/sinatra/"]') end end end \ No newline at end of file diff --git a/test/test_gembox_gems.rb b/test/test_gembox_gems.rb index 7f106be..9877e2d 100644 --- a/test/test_gembox_gems.rb +++ b/test/test_gembox_gems.rb @@ -1,61 +1,61 @@ require File.join(File.dirname(__FILE__), 'test_helper') describe 'Gembox::Gems' do describe '#load' do before do Gembox::Gems.load end should "load local gems" do Gembox::Gems.local_gems.should.be.an instance_of(Array) end should "load source index into source_index" do Gembox::Gems.source_index.should.be.an instance_of(Gem::SourceIndex) end end describe "#local_gems" do before do Gembox::Gems.load @gems = Gembox::Gems.local_gems end should "return array of array of gems" do @gems.should.be.an instance_of(Gembox::GemList) end should "only have one entry per gem" do @gems.should.has_key? 'sinatra' @gems.should.not.has_key? 'sinatra-0.9.0.5' end should "have an array of spec versions per gem name" do - @gems['sinatra'].should.be.an instance_of(Gembox::GemList) + @gems['sinatra'].should.be.an instance_of(Array) @gems['sinatra'].first.should.be.an instance_of(Gem::Specification) end end describe '#search' do before do Gembox::Gems.load @gems = Gembox::Gems.search 'sin' end should "return a list of gem specs" do @gems.should.be.an instance_of(Gembox::GemList) end should "only have one entry per gem" do @gems.should.has_key? 'sinatra' @gems.should.not.has_key? 'sinatra-0.9.0.5' end should "return gems that match the specname" do @gems.should.not.has_key? 'rack' end end end \ No newline at end of file diff --git a/test/test_helper.rb b/test/test_helper.rb index bd45bea..ec4a2bf 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,51 +1,52 @@ require 'rubygems' require 'sinatra' require 'sinatra/test/bacon' +require 'mocha' require File.join(File.dirname(__FILE__), '..', 'gembox.rb') require 'nokogiri' module TestHelper def instance_of(klass) lambda {|obj| obj.is_a?(klass) } end # HTML matcher for bacon # # it 'should display document' do # body.should have_element('#document') # end # # With content matching: # # it 'should display loaded document' do # body.should have_element('#document .title', /My Document/) # end def have_element(search, content = nil) lambda do |obj| doc = Nokogiri.parse(obj.to_s) node_set = doc.search(search) if node_set.empty? false else collected_content = node_set.collect {|t| t.content }.join(' ') case content when Regexp collected_content =~ content when String collected_content.include?(content) when nil true end end end end end Bacon::Context.send(:include, TestHelper)
quirkey/gembox
540a52c78becf9d5ce803e44fb1cfdb09885f5c2
Added stats to nav Using complex route pattern to find gem + version
diff --git a/gembox.rb b/gembox.rb index 98b404d..a62926e 100644 --- a/gembox.rb +++ b/gembox.rb @@ -1,53 +1,57 @@ require 'rubygems' require 'sinatra' + require File.join(File.dirname(__FILE__), 'lib', 'gembox') Gembox::Gems.load helpers do def link_to(text, link = nil) link ||= text link = url_for(link) "<a href=\"#{link}\">#{text}</a>" end def url_for(link_options) case link_options when Hash path = link_options.delete(:path) || request.path_info path + '?' + build_query(params.merge(link_options)) else link_options end end end set :public, 'public' set :views, 'views' before do @gems = Gembox::Gems.local_gems + @stats = Gembox::Gems.stats end get '/stylesheets/:stylesheet.css' do sass params[:stylesheet].to_sym end get '/' do haml :index end +get %r{/gems/([\w\-\_]+)/?([\d\.]+)?/?} do + show_layout = params[:layout] != 'false' + name, version = params[:captures] + @gems = Gembox::Gems.search(name, version) + raise Sinatra::NotFound if @gems.empty? + @gem_versions = @gems.shift[1] + @gem = @gem_versions.shift + haml :gem, :layout => show_layout +end + get '/gems/?' do show_layout = params[:layout] != 'false' show_as = params[:as] || 'columns' haml "gems_#{show_as}".to_sym, :layout => show_layout end -get '/gems/:name/?' do - show_layout = params[:layout] != 'false' - @gems = Gembox::Gems.search(params[:name]) - not_found if @gems.empty? - @gem_versions = @gems.shift[1] - @gem = @gem_versions.shift - haml :gem, :layout => show_layout -end \ No newline at end of file diff --git a/lib/gembox.rb b/lib/gembox.rb index 2854ece..db0fafa 100644 --- a/lib/gembox.rb +++ b/lib/gembox.rb @@ -1,48 +1,84 @@ require 'active_support' -class ActiveSupport::OrderedHash - def to_a - a = [] - @keys.each do |key| - a << [key, self[key]] - end - a - end -end module Gembox + class GemList < Array + + def [](key) + if key.is_a?(String) + search(key) + else + super + end + end + + def []=(key, value) + if key.is_a?(String) + if versions = search(key) + versions.replace([key, value]) + else + self << [key, value] + end + else + super + end + end + + def search(key) + i = find {|v| + if v.is_a?(Array) + v[0] == key + else + v == key + end + } + i.is_a?(Array) ? i[1] : i + end + + def has_key?(key) + !search(key).nil? + end + end + class Gems class << self attr_accessor :source_index def load @source_index ||= ::Gem.source_index local_gems end def local_gems @local_gems ||= group_gems(source_index.gems) end def search(search_term, version = nil) version = version ? Gem::Requirement.create(version) : Gem::Requirement.default gems = source_index.search Gem::Dependency.new(/^#{Regexp.escape(search_term)}/, version) group_gems(gems) end + def stats + num_versions = source_index.length + num_gems = local_gems.length + oldest_gem = source_index.min {|a,b| a[1].date <=> b[1].date }.last + {:num_versions => num_versions, :num_gems => num_gems, :oldest_gem => oldest_gem} + end + protected def group_gems(gem_collection) - gem_hash = ActiveSupport::OrderedHash.new {|h,k| h[k] = [] } + gem_hash = GemList.new gem_collection = gem_collection.values if gem_collection.is_a?(Hash) gem_collection.each do |spec| + gem_hash[spec.name] ||= [] gem_hash[spec.name] << spec gem_hash[spec.name].sort! {|a,b| (b.version || 0) <=> (a.version || 0) } end - gem_hash.keys.sort! {|a,b| a.downcase <=> b.downcase} - gem_hash + gem_hash.sort {|a, b| a[0].downcase <=> b[0].downcase } end end end end \ No newline at end of file diff --git a/test/test_gembox_gems.rb b/test/test_gembox_gems.rb index 594e597..7f106be 100644 --- a/test/test_gembox_gems.rb +++ b/test/test_gembox_gems.rb @@ -1,61 +1,61 @@ require File.join(File.dirname(__FILE__), 'test_helper') describe 'Gembox::Gems' do describe '#load' do before do Gembox::Gems.load end should "load local gems" do - Gembox::Gems.local_gems.should.be.an instance_of(ActiveSupport::OrderedHash) + Gembox::Gems.local_gems.should.be.an instance_of(Array) end should "load source index into source_index" do Gembox::Gems.source_index.should.be.an instance_of(Gem::SourceIndex) end end describe "#local_gems" do before do Gembox::Gems.load @gems = Gembox::Gems.local_gems end - should "return ActiveSupport::OrderedHash of gems" do - @gems.should.be.an instance_of(ActiveSupport::OrderedHash) + should "return array of array of gems" do + @gems.should.be.an instance_of(Gembox::GemList) end should "only have one entry per gem" do @gems.should.has_key? 'sinatra' @gems.should.not.has_key? 'sinatra-0.9.0.5' end should "have an array of spec versions per gem name" do - @gems['sinatra'].should.be.an instance_of(Array) + @gems['sinatra'].should.be.an instance_of(Gembox::GemList) @gems['sinatra'].first.should.be.an instance_of(Gem::Specification) end end describe '#search' do before do Gembox::Gems.load @gems = Gembox::Gems.search 'sin' end - should "return a hash of gem specs" do - @gems.should.be.an instance_of(ActiveSupport::OrderedHash) + should "return a list of gem specs" do + @gems.should.be.an instance_of(Gembox::GemList) end should "only have one entry per gem" do @gems.should.has_key? 'sinatra' @gems.should.not.has_key? 'sinatra-0.9.0.5' end should "return gems that match the specname" do @gems.should.not.has_key? 'rack' end end end \ No newline at end of file diff --git a/views/gems_columns.haml b/views/gems_columns.haml index 67de934..7cdc5e5 100644 --- a/views/gems_columns.haml +++ b/views/gems_columns.haml @@ -1,10 +1,10 @@ #gems - [email protected]_a.in_groups_of(@gems.length / 2).each do |gems| + [email protected]_groups_of((@gems.length + 1)/ 2).each do |gems| .column -gems.compact.each do |gem_name, specs| .gem %h4=link_to(gem_name, "/gems/#{gem_name}") .versions %span =specs.collect {|spec| link_to(spec.version, "/gems/#{gem_name}/#{spec.version}") }.join(', ') .clear \ No newline at end of file diff --git a/views/layout.haml b/views/layout.haml index 2bfa6fb..52d0b3d 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -1,35 +1,48 @@ %html{:xmlns=> "http://www.w3.org/1999/xhtml", 'xml:lang' => "en", :lang => "en"} %head %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"} %title Gembox %link{'href' => '/stylesheets/gembox.css', 'rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen'} -['jquery', 'jquery.ui', 'jquery.metadata', 'jquery.form', 'base', 'gembox'].each do |jslib| %script{'type' => 'text/javascript', 'src' => "/javascripts/#{jslib}.js"} %body #container #header .contained %img{:src => '/images/rubygems-125x125t.png', :alt => 'Rubygems logo', :id => 'logo'} %h1 Gembox #nav .contained + .stats + %p + You have + =@stats[:num_versions] + versions of + =@stats[:num_gems] + gems. + %p + Your oldest gem is + =@stats[:oldest_gem].name + from + =@stats[:oldest_gem].date + .search %form{:method => 'get', :action => '/gems'} %input{:type => 'text', :name => 'search'} %input{:type => 'submit', :value => 'Search'} .view_options View as =link_to('Columns', {:as => 'columns'}) =' / ' =link_to('Table', {:as => 'table'}) #main.contained =yield #footer %p.copyright Gembox, developed by =link_to 'Quirkey.', 'http://code.quirkey.com' Powered by =link_to 'Sinatra.', 'http://sinatrrb.com' %p.copyright Hey! I'm =link_to 'open-source!', 'http://github.com/quirkey/gembox' \ No newline at end of file
quirkey/gembox
f75cdf8abe305ca40cacfe29ecd20469e0f78a36
More display in /gems/name
diff --git a/gembox.rb b/gembox.rb index a2a8b0e..98b404d 100644 --- a/gembox.rb +++ b/gembox.rb @@ -1,52 +1,53 @@ require 'rubygems' require 'sinatra' require File.join(File.dirname(__FILE__), 'lib', 'gembox') Gembox::Gems.load helpers do def link_to(text, link = nil) link ||= text link = url_for(link) "<a href=\"#{link}\">#{text}</a>" end def url_for(link_options) case link_options when Hash path = link_options.delete(:path) || request.path_info path + '?' + build_query(params.merge(link_options)) else link_options end end end set :public, 'public' set :views, 'views' before do @gems = Gembox::Gems.local_gems end get '/stylesheets/:stylesheet.css' do sass params[:stylesheet].to_sym end get '/' do haml :index end get '/gems/?' do show_layout = params[:layout] != 'false' show_as = params[:as] || 'columns' haml "gems_#{show_as}".to_sym, :layout => show_layout end get '/gems/:name/?' do show_layout = params[:layout] != 'false' - @gem = Gembox::Gems.search(params[:name]) - not_found if @gem.empty? - @gem = @gem.shift[1] + @gems = Gembox::Gems.search(params[:name]) + not_found if @gems.empty? + @gem_versions = @gems.shift[1] + @gem = @gem_versions.shift haml :gem, :layout => show_layout end \ No newline at end of file diff --git a/views/gem.haml b/views/gem.haml index 6293355..9622b8a 100644 --- a/views/gem.haml +++ b/views/gem.haml @@ -1 +1,21 @@ [email protected] \ No newline at end of file +#gem + %h2 + [email protected] + %[email protected] + + .description + %[email protected] + %p.authors + By + [email protected](', ') + ='(' + link_to(@gem.email, "mailto:#{@gem.email}") + ')' + %p.url=link_to(@gem.homepage) + .dependencies + %h3 Dependencies + [email protected] do |dependency| + .gem + =link_to(dependency.name, "/gems/#{dependency.name}") + %span.version=dependency.version_requirements + + +%[email protected]_yaml \ No newline at end of file diff --git a/views/gembox.sass b/views/gembox.sass index d70d3f9..7d42ef7 100644 --- a/views/gembox.sass +++ b/views/gembox.sass @@ -1,60 +1,70 @@ !red = #BA2818 !light_red = #EB9281 !dark_red = #871D1A !light_grey = #CCCCCC - +!grey = #666 body :font-family 'Franklin Gothic', 'Franklin Gothic Medium', Helvetica, sans-serif :background #FFFFFF :margin 0px :padding 0px :text-align center a:link, a:visited :color = !red :text-decoration none a:hover :color = !light_red :text-decoration underline .contained :width 960px :margin 0px auto :text-align left :position relative #header .contained :width 400px #logo :position absolute :top -20px :left -135px h1 :color = !dark_red :font-size 50px :margin 20px 0px 0px 0px #nav :background = !dark_red :padding 15px .search #main .column :width 460px :float left + .gem + :font-size 14px + :margin 5px 0px + :padding 5px 0px + h4 + :font-size 16px + :margin 0px + :padding 0px 0px 5px 0px + .versions a + :color = !grey #footer :margin 20px :padding 10px :border-top = 1px solid !light_grey .copyright :font-size 12px .clear :clear both :line-height 0px :height 0px \ No newline at end of file diff --git a/views/gems_columns.haml b/views/gems_columns.haml index 1e0bb36..67de934 100644 --- a/views/gems_columns.haml +++ b/views/gems_columns.haml @@ -1,11 +1,10 @@ #gems [email protected]_a.in_groups_of(@gems.length / 2).each do |gems| .column -gems.compact.each do |gem_name, specs| .gem - =link_to(gem_name, "/gems/#{gem_name}") + %h4=link_to(gem_name, "/gems/#{gem_name}") .versions %span - Versions - =specs.collect {|spec| spec.version }.join(', ') + =specs.collect {|spec| link_to(spec.version, "/gems/#{gem_name}/#{spec.version}") }.join(', ') .clear \ No newline at end of file
quirkey/gembox
7c4b30fe55ea48fd741b069e9f855e7ea7b200fb
Working columns
diff --git a/lib/gembox.rb b/lib/gembox.rb index 4a16558..2854ece 100644 --- a/lib/gembox.rb +++ b/lib/gembox.rb @@ -1,38 +1,48 @@ -require 'active_support/ordered_hash' +require 'active_support' + +class ActiveSupport::OrderedHash + def to_a + a = [] + @keys.each do |key| + a << [key, self[key]] + end + a + end +end module Gembox class Gems class << self attr_accessor :source_index def load @source_index ||= ::Gem.source_index local_gems end def local_gems @local_gems ||= group_gems(source_index.gems) end def search(search_term, version = nil) version = version ? Gem::Requirement.create(version) : Gem::Requirement.default gems = source_index.search Gem::Dependency.new(/^#{Regexp.escape(search_term)}/, version) group_gems(gems) end protected def group_gems(gem_collection) gem_hash = ActiveSupport::OrderedHash.new {|h,k| h[k] = [] } gem_collection = gem_collection.values if gem_collection.is_a?(Hash) gem_collection.each do |spec| gem_hash[spec.name] << spec gem_hash[spec.name].sort! {|a,b| (b.version || 0) <=> (a.version || 0) } end gem_hash.keys.sort! {|a,b| a.downcase <=> b.downcase} gem_hash end end end end \ No newline at end of file diff --git a/views/gembox.sass b/views/gembox.sass index dfb8202..d70d3f9 100644 --- a/views/gembox.sass +++ b/views/gembox.sass @@ -1,43 +1,60 @@ !red = #BA2818 !light_red = #EB9281 !dark_red = #871D1A !light_grey = #CCCCCC body :font-family 'Franklin Gothic', 'Franklin Gothic Medium', Helvetica, sans-serif :background #FFFFFF :margin 0px :padding 0px :text-align center a:link, a:visited :color = !red :text-decoration none a:hover :color = !light_red :text-decoration underline .contained :width 960px :margin 0px auto :text-align left :position relative #header .contained :width 400px #logo :position absolute :top -20px :left -135px h1 :color = !dark_red :font-size 50px :margin 20px 0px 0px 0px #nav :background = !dark_red :padding 15px .search - \ No newline at end of file + + +#main + .column + :width 460px + :float left + +#footer + :margin 20px + :padding 10px + :border-top = 1px solid !light_grey + .copyright + :font-size 12px + +.clear + :clear both + :line-height 0px + :height 0px \ No newline at end of file diff --git a/views/gems_columns.haml b/views/gems_columns.haml index 609a6e6..1e0bb36 100644 --- a/views/gems_columns.haml +++ b/views/gems_columns.haml @@ -1,8 +1,11 @@ #gems - [email protected] do |gem_name, specs| - .gem - =link_to(gem_name, "/gems/#{gem_name}") - .versions - %span - Versions - =specs.collect {|spec| spec.version }.join(', ') \ No newline at end of file + [email protected]_a.in_groups_of(@gems.length / 2).each do |gems| + .column + -gems.compact.each do |gem_name, specs| + .gem + =link_to(gem_name, "/gems/#{gem_name}") + .versions + %span + Versions + =specs.collect {|spec| spec.version }.join(', ') + .clear \ No newline at end of file
quirkey/gembox
d278d826afbfbf0f8a14d1a451eadad7e67b2fca
Using ActiveSupport::OrderedHash to sort gems properly
diff --git a/gembox.rb b/gembox.rb index 19c3e22..a2a8b0e 100644 --- a/gembox.rb +++ b/gembox.rb @@ -1,44 +1,52 @@ require 'rubygems' require 'sinatra' require File.join(File.dirname(__FILE__), 'lib', 'gembox') Gembox::Gems.load helpers do def link_to(text, link = nil) link ||= text link = url_for(link) "<a href=\"#{link}\">#{text}</a>" end def url_for(link_options) case link_options when Hash path = link_options.delete(:path) || request.path_info path + '?' + build_query(params.merge(link_options)) else link_options end end end set :public, 'public' set :views, 'views' before do @gems = Gembox::Gems.local_gems end get '/stylesheets/:stylesheet.css' do sass params[:stylesheet].to_sym end get '/' do haml :index end get '/gems/?' do show_layout = params[:layout] != 'false' - @show_as = params[:as] || 'columns' - haml :gems, :layout => show_layout + show_as = params[:as] || 'columns' + haml "gems_#{show_as}".to_sym, :layout => show_layout end + +get '/gems/:name/?' do + show_layout = params[:layout] != 'false' + @gem = Gembox::Gems.search(params[:name]) + not_found if @gem.empty? + @gem = @gem.shift[1] + haml :gem, :layout => show_layout +end \ No newline at end of file diff --git a/lib/gembox.rb b/lib/gembox.rb index cb03b1f..4a16558 100644 --- a/lib/gembox.rb +++ b/lib/gembox.rb @@ -1,34 +1,38 @@ +require 'active_support/ordered_hash' + module Gembox class Gems class << self attr_accessor :source_index def load @source_index ||= ::Gem.source_index local_gems end def local_gems @local_gems ||= group_gems(source_index.gems) end def search(search_term, version = nil) version = version ? Gem::Requirement.create(version) : Gem::Requirement.default gems = source_index.search Gem::Dependency.new(/^#{Regexp.escape(search_term)}/, version) group_gems(gems) end protected def group_gems(gem_collection) - gem_hash = Hash.new {|h,k| h[k] = [] } + gem_hash = ActiveSupport::OrderedHash.new {|h,k| h[k] = [] } gem_collection = gem_collection.values if gem_collection.is_a?(Hash) gem_collection.each do |spec| gem_hash[spec.name] << spec + gem_hash[spec.name].sort! {|a,b| (b.version || 0) <=> (a.version || 0) } end + gem_hash.keys.sort! {|a,b| a.downcase <=> b.downcase} gem_hash end end end end \ No newline at end of file diff --git a/test/test_gembox_gems.rb b/test/test_gembox_gems.rb index 8fc4075..594e597 100644 --- a/test/test_gembox_gems.rb +++ b/test/test_gembox_gems.rb @@ -1,61 +1,61 @@ require File.join(File.dirname(__FILE__), 'test_helper') describe 'Gembox::Gems' do describe '#load' do before do Gembox::Gems.load end should "load local gems" do - Gembox::Gems.local_gems.should.be.an instance_of(Hash) + Gembox::Gems.local_gems.should.be.an instance_of(ActiveSupport::OrderedHash) end should "load source index into source_index" do Gembox::Gems.source_index.should.be.an instance_of(Gem::SourceIndex) end end describe "#local_gems" do before do Gembox::Gems.load @gems = Gembox::Gems.local_gems end - should "return hash of gems" do - @gems.should.be.an instance_of(Hash) + should "return ActiveSupport::OrderedHash of gems" do + @gems.should.be.an instance_of(ActiveSupport::OrderedHash) end should "only have one entry per gem" do @gems.should.has_key? 'sinatra' @gems.should.not.has_key? 'sinatra-0.9.0.5' end should "have an array of spec versions per gem name" do @gems['sinatra'].should.be.an instance_of(Array) @gems['sinatra'].first.should.be.an instance_of(Gem::Specification) end end describe '#search' do before do Gembox::Gems.load @gems = Gembox::Gems.search 'sin' end should "return a hash of gem specs" do - @gems.should.be.an instance_of(Hash) + @gems.should.be.an instance_of(ActiveSupport::OrderedHash) end should "only have one entry per gem" do @gems.should.has_key? 'sinatra' @gems.should.not.has_key? 'sinatra-0.9.0.5' end should "return gems that match the specname" do @gems.should.not.has_key? 'rack' end end end \ No newline at end of file diff --git a/views/gem.haml b/views/gem.haml new file mode 100644 index 0000000..6293355 --- /dev/null +++ b/views/gem.haml @@ -0,0 +1 @@ [email protected] \ No newline at end of file diff --git a/views/gems.haml b/views/gems_columns.haml similarity index 53% rename from views/gems.haml rename to views/gems_columns.haml index d1c5cfc..609a6e6 100644 --- a/views/gems.haml +++ b/views/gems_columns.haml @@ -1,8 +1,8 @@ #gems - [email protected] do |gem_name, specs| + [email protected] do |gem_name, specs| .gem =link_to(gem_name, "/gems/#{gem_name}") .versions %span Versions =specs.collect {|spec| spec.version }.join(', ') \ No newline at end of file diff --git a/views/gems_table.haml b/views/gems_table.haml new file mode 100644 index 0000000..e69de29 diff --git a/views/index.haml b/views/index.haml index 421a29e..b00e720 100644 --- a/views/index.haml +++ b/views/index.haml @@ -1,2 +1,2 @@ %h2 Installed Gems -=haml :gems, :locals => {:gems => @gems}, :layout => false \ No newline at end of file +=haml :gems_columns, :locals => {:gems => @gems}, :layout => false \ No newline at end of file diff --git a/views/layout.haml b/views/layout.haml index c8a87b6..2bfa6fb 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -1,35 +1,35 @@ %html{:xmlns=> "http://www.w3.org/1999/xhtml", 'xml:lang' => "en", :lang => "en"} %head %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"} %title Gembox %link{'href' => '/stylesheets/gembox.css', 'rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen'} -['jquery', 'jquery.ui', 'jquery.metadata', 'jquery.form', 'base', 'gembox'].each do |jslib| %script{'type' => 'text/javascript', 'src' => "/javascripts/#{jslib}.js"} %body #container #header .contained %img{:src => '/images/rubygems-125x125t.png', :alt => 'Rubygems logo', :id => 'logo'} %h1 Gembox #nav .contained .search %form{:method => 'get', :action => '/gems'} - %input{:type => 'text'} + %input{:type => 'text', :name => 'search'} %input{:type => 'submit', :value => 'Search'} .view_options View as =link_to('Columns', {:as => 'columns'}) =' / ' =link_to('Table', {:as => 'table'}) #main.contained =yield #footer %p.copyright Gembox, developed by =link_to 'Quirkey.', 'http://code.quirkey.com' Powered by =link_to 'Sinatra.', 'http://sinatrrb.com' %p.copyright Hey! I'm =link_to 'open-source!', 'http://github.com/quirkey/gembox' \ No newline at end of file
quirkey/gembox
0c905dfea3b49ff313af1cfbe7f173e545c09714
A lot more styling Added Gembox::Gems.search
diff --git a/gembox.rb b/gembox.rb index 82e496d..19c3e22 100644 --- a/gembox.rb +++ b/gembox.rb @@ -1,39 +1,44 @@ require 'rubygems' require 'sinatra' require File.join(File.dirname(__FILE__), 'lib', 'gembox') Gembox::Gems.load helpers do - def link_to(text, link = nil) + def link_to(text, link = nil) link ||= text + link = url_for(link) "<a href=\"#{link}\">#{text}</a>" end - def escape(text) - CGI.escapeHTML(text) + def url_for(link_options) + case link_options + when Hash + path = link_options.delete(:path) || request.path_info + path + '?' + build_query(params.merge(link_options)) + else + link_options + end end end set :public, 'public' set :views, 'views' before do @gems = Gembox::Gems.local_gems end get '/stylesheets/:stylesheet.css' do sass params[:stylesheet].to_sym end get '/' do haml :index end get '/gems/?' do - -end - -get '/gems/:name' do - + show_layout = params[:layout] != 'false' + @show_as = params[:as] || 'columns' + haml :gems, :layout => show_layout end diff --git a/lib/gembox.rb b/lib/gembox.rb index a97cf0a..cb03b1f 100644 --- a/lib/gembox.rb +++ b/lib/gembox.rb @@ -1,27 +1,34 @@ module Gembox class Gems class << self attr_accessor :source_index def load @source_index ||= ::Gem.source_index local_gems end def local_gems - @local_gems ||= group_gems + @local_gems ||= group_gems(source_index.gems) + end + + def search(search_term, version = nil) + version = version ? Gem::Requirement.create(version) : Gem::Requirement.default + gems = source_index.search Gem::Dependency.new(/^#{Regexp.escape(search_term)}/, version) + group_gems(gems) end protected - def group_gems + def group_gems(gem_collection) gem_hash = Hash.new {|h,k| h[k] = [] } - source_index.gems.each do |gem_with_version, spec| + gem_collection = gem_collection.values if gem_collection.is_a?(Hash) + gem_collection.each do |spec| gem_hash[spec.name] << spec end gem_hash end end end end \ No newline at end of file diff --git a/public/images/rubygems-125x125t.png b/public/images/rubygems-125x125t.png new file mode 100644 index 0000000..8454755 Binary files /dev/null and b/public/images/rubygems-125x125t.png differ diff --git a/test/test_gembox_gems.rb b/test/test_gembox_gems.rb index 891f524..8fc4075 100644 --- a/test/test_gembox_gems.rb +++ b/test/test_gembox_gems.rb @@ -1,40 +1,61 @@ require File.join(File.dirname(__FILE__), 'test_helper') describe 'Gembox::Gems' do describe '#load' do before do Gembox::Gems.load end should "load local gems" do Gembox::Gems.local_gems.should.be.an instance_of(Hash) end should "load source index into source_index" do Gembox::Gems.source_index.should.be.an instance_of(Gem::SourceIndex) end end describe "#local_gems" do before do Gembox::Gems.load @gems = Gembox::Gems.local_gems end should "return hash of gems" do @gems.should.be.an instance_of(Hash) end should "only have one entry per gem" do @gems.should.has_key? 'sinatra' @gems.should.not.has_key? 'sinatra-0.9.0.5' end should "have an array of spec versions per gem name" do @gems['sinatra'].should.be.an instance_of(Array) @gems['sinatra'].first.should.be.an instance_of(Gem::Specification) end end + + describe '#search' do + before do + Gembox::Gems.load + @gems = Gembox::Gems.search 'sin' + end + + should "return a hash of gem specs" do + @gems.should.be.an instance_of(Hash) + end + + should "only have one entry per gem" do + @gems.should.has_key? 'sinatra' + @gems.should.not.has_key? 'sinatra-0.9.0.5' + end + + should "return gems that match the specname" do + @gems.should.not.has_key? 'rack' + end + + end end \ No newline at end of file diff --git a/views/gembox.sass b/views/gembox.sass index 6d0867e..dfb8202 100644 --- a/views/gembox.sass +++ b/views/gembox.sass @@ -1,15 +1,43 @@ !red = #BA2818 !light_red = #EB9281 +!dark_red = #871D1A !light_grey = #CCCCCC body :font-family 'Franklin Gothic', 'Franklin Gothic Medium', Helvetica, sans-serif :background #FFFFFF + :margin 0px + :padding 0px + :text-align center -a:link +a:link, +a:visited :color = !red :text-decoration none -a:visited - :color = !light_red a:hover - :text-decoration underline \ No newline at end of file + :color = !light_red + :text-decoration underline + +.contained + :width 960px + :margin 0px auto + :text-align left + :position relative + +#header + .contained + :width 400px + #logo + :position absolute + :top -20px + :left -135px + h1 + :color = !dark_red + :font-size 50px + :margin 20px 0px 0px 0px + +#nav + :background = !dark_red + :padding 15px + .search + \ No newline at end of file diff --git a/views/layout.haml b/views/layout.haml index 5c77936..c8a87b6 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -1,22 +1,35 @@ %html{:xmlns=> "http://www.w3.org/1999/xhtml", 'xml:lang' => "en", :lang => "en"} %head %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"} %title Gembox %link{'href' => '/stylesheets/gembox.css', 'rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen'} -['jquery', 'jquery.ui', 'jquery.metadata', 'jquery.form', 'base', 'gembox'].each do |jslib| %script{'type' => 'text/javascript', 'src' => "/javascripts/#{jslib}.js"} %body #container #header - %h1 Gembox - #main + .contained + %img{:src => '/images/rubygems-125x125t.png', :alt => 'Rubygems logo', :id => 'logo'} + %h1 Gembox + #nav + .contained + .search + %form{:method => 'get', :action => '/gems'} + %input{:type => 'text'} + %input{:type => 'submit', :value => 'Search'} + .view_options + View as + =link_to('Columns', {:as => 'columns'}) + =' / ' + =link_to('Table', {:as => 'table'}) + #main.contained =yield #footer %p.copyright Gembox, developed by =link_to 'Quirkey.', 'http://code.quirkey.com' Powered by =link_to 'Sinatra.', 'http://sinatrrb.com' %p.copyright Hey! I'm =link_to 'open-source!', 'http://github.com/quirkey/gembox' \ No newline at end of file
quirkey/gembox
7cd1e4fead09fa0ec272a44289d5310a5f014527
Really simple stylin'
diff --git a/gembox.rb b/gembox.rb index 1b13448..82e496d 100644 --- a/gembox.rb +++ b/gembox.rb @@ -1,35 +1,39 @@ require 'rubygems' require 'sinatra' require File.join(File.dirname(__FILE__), 'lib', 'gembox') Gembox::Gems.load helpers do def link_to(text, link = nil) link ||= text "<a href=\"#{link}\">#{text}</a>" end def escape(text) CGI.escapeHTML(text) end end set :public, 'public' set :views, 'views' before do @gems = Gembox::Gems.local_gems end +get '/stylesheets/:stylesheet.css' do + sass params[:stylesheet].to_sym +end + get '/' do haml :index end get '/gems/?' do end get '/gems/:name' do end diff --git a/views/gembox.sass b/views/gembox.sass new file mode 100644 index 0000000..6d0867e --- /dev/null +++ b/views/gembox.sass @@ -0,0 +1,15 @@ +!red = #BA2818 +!light_red = #EB9281 +!light_grey = #CCCCCC + +body + :font-family 'Franklin Gothic', 'Franklin Gothic Medium', Helvetica, sans-serif + :background #FFFFFF + +a:link + :color = !red + :text-decoration none +a:visited + :color = !light_red +a:hover + :text-decoration underline \ No newline at end of file diff --git a/views/gems.haml b/views/gems.haml index 05d864b..d1c5cfc 100644 --- a/views/gems.haml +++ b/views/gems.haml @@ -1,6 +1,8 @@ #gems - [email protected] do |gem_name, spec| + [email protected] do |gem_name, specs| .gem =link_to(gem_name, "/gems/#{gem_name}") .versions - %span Versions \ No newline at end of file + %span + Versions + =specs.collect {|spec| spec.version }.join(', ') \ No newline at end of file diff --git a/views/layout.haml b/views/layout.haml index cabf54a..5c77936 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -1,21 +1,22 @@ %html{:xmlns=> "http://www.w3.org/1999/xhtml", 'xml:lang' => "en", :lang => "en"} %head %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"} %title Gembox + %link{'href' => '/stylesheets/gembox.css', 'rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen'} -['jquery', 'jquery.ui', 'jquery.metadata', 'jquery.form', 'base', 'gembox'].each do |jslib| - %script{'type' => 'text/javascript', 'src' => jslib} + %script{'type' => 'text/javascript', 'src' => "/javascripts/#{jslib}.js"} %body #container #header %h1 Gembox #main =yield #footer %p.copyright Gembox, developed by =link_to 'Quirkey.', 'http://code.quirkey.com' Powered by =link_to 'Sinatra.', 'http://sinatrrb.com' %p.copyright Hey! I'm =link_to 'open-source!', 'http://github.com/quirkey/gembox' \ No newline at end of file
quirkey/gembox
de1720ea1f42bfa1db151474f4c28d84b2695966
Fixing test failures
diff --git a/test/test_gembox_app.rb b/test/test_gembox_app.rb index 0f8b028..2647a7c 100644 --- a/test/test_gembox_app.rb +++ b/test/test_gembox_app.rb @@ -1,138 +1,138 @@ require File.join(File.dirname(__FILE__), 'test_helper') describe "Gembox App" do - + describe 'getting /' do before do get '/' end - + should 'load the index' do should.be.ok end - + should "display gem list" do body.should have_element('#gems') end - + should "display list of installed gems" do body.should have_element('.gem', /sinatra/) end - + should "display as 4 columns" do body.should have_element('.column') end end - + describe 'getting gems/ with layout = false' do before do get '/gems/?layout=false' end - + should "load" do should.be.ok end - + should "not display layout" do body.should.not have_element('html') end - + should "display gem list" do body.should have_element('#gems') end - + should "display as 4 columns" do body.should have_element('.column') end end - + describe 'getting gems/ with a simple search' do before do get '/gems/?search=s' end - + should "load" do should.be.ok end - + should "display gem list" do body.should have_element('#gems') end - + should "display gems that match the search" do body.should have_element('.gem', /sinatra/) end - + should "not display gems that do not match the search" do body.should.not have_element('.gem', /rack/) end end describe 'getting gems/ with as = table' do before do get '/gems/?layout=false&as=table' end - + should "load" do should.be.ok end - + should "not display layout" do body.should.not have_element('html') end - + should "display gem list" do body.should have_element('#gems') end - - should "display as table" + + should "display as table" do body.should have_element('table#gems') body.should have_element('table#gems tr.gem') end end - + describe 'getting gems/:name' do before do get '/gems/sinatra' end - + should "display only specific gem" do body.should.not have_element('.gem', /rack/) end should "display link to gems website" do body.should have_element('a', 'http://sinatra.rubyforge.org') end - + should "load gem spec for latest version" do body.should have_element('.version', '0.9.0.5') end - + should "display links to all versions" do body.should have_element('.other_versions a[href="/gems/sinatra/0.9.0.2"]') end end - + describe 'getting gems/name/version' do before do get '/gems/sinatra/0.9.0.2' end - + should "display only specific gem" do body.should.not have_element('.gem', /rack/) end should "display link to gems website" do body.should have_element('a', 'http://sinatra.rubyforge.org') end - + should "load gem spec specified version" do body.should have_element('.version', '0.9.0.2') end - + should "display links to all versions" do body.should have_element('.other_versions a[href="/gems/sinatra/0.9.0.5"]') end end - + end \ No newline at end of file diff --git a/views/layout.haml b/views/layout.haml index 6b825d6..cabf54a 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -1,19 +1,21 @@ %html{:xmlns=> "http://www.w3.org/1999/xhtml", 'xml:lang' => "en", :lang => "en"} %head %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"} %title Gembox -['jquery', 'jquery.ui', 'jquery.metadata', 'jquery.form', 'base', 'gembox'].each do |jslib| %script{'type' => 'text/javascript', 'src' => jslib} %body #container #header %h1 Gembox #main - = yield + =yield #footer - %p.copyright Gembox, developed by - =link_to 'Quirkey', 'http://code.quirkey.com' - . Powered by + %p.copyright + Gembox, developed by + =link_to 'Quirkey.', 'http://code.quirkey.com' + Powered by =link_to 'Sinatra.', 'http://sinatrrb.com' - %p.copyright Hey! I'm + %p.copyright + Hey! I'm =link_to 'open-source!', 'http://github.com/quirkey/gembox' \ No newline at end of file
quirkey/gembox
6c13202e3e87e7c73b87cba926403ffc78b18c02
More specs for the actual app
diff --git a/gembox.rb b/gembox.rb index e106a5c..1b13448 100644 --- a/gembox.rb +++ b/gembox.rb @@ -1,32 +1,35 @@ require 'rubygems' require 'sinatra' require File.join(File.dirname(__FILE__), 'lib', 'gembox') Gembox::Gems.load helpers do def link_to(text, link = nil) link ||= text "<a href=\"#{link}\">#{text}</a>" end def escape(text) CGI.escapeHTML(text) end end set :public, 'public' set :views, 'views' -get '/' do +before do @gems = Gembox::Gems.local_gems +end + +get '/' do haml :index end get '/gems/?' do end get '/gems/:name' do end diff --git a/test/test_gembox_app.rb b/test/test_gembox_app.rb index e4d2428..0f8b028 100644 --- a/test/test_gembox_app.rb +++ b/test/test_gembox_app.rb @@ -1,56 +1,138 @@ require File.join(File.dirname(__FILE__), 'test_helper') describe "Gembox App" do describe 'getting /' do before do get '/' end should 'load the index' do should.be.ok end should "display gem list" do body.should have_element('#gems') end should "display list of installed gems" do body.should have_element('.gem', /sinatra/) end + + should "display as 4 columns" do + body.should have_element('.column') + end end describe 'getting gems/ with layout = false' do before do get '/gems/?layout=false' end should "load" do should.be.ok end should "not display layout" do body.should.not have_element('html') end should "display gem list" do body.should have_element('#gems') end + + should "display as 4 columns" do + body.should have_element('.column') + end + end + + describe 'getting gems/ with a simple search' do + before do + get '/gems/?search=s' + end + + should "load" do + should.be.ok + end + + should "display gem list" do + body.should have_element('#gems') + end + + should "display gems that match the search" do + body.should have_element('.gem', /sinatra/) + end + + should "not display gems that do not match the search" do + body.should.not have_element('.gem', /rack/) + end + end + + describe 'getting gems/ with as = table' do + before do + get '/gems/?layout=false&as=table' + end + + should "load" do + should.be.ok + end + + should "not display layout" do + body.should.not have_element('html') + end + + should "display gem list" do + body.should have_element('#gems') + end + + should "display as table" + body.should have_element('table#gems') + body.should have_element('table#gems tr.gem') + end end describe 'getting gems/:name' do before do get '/gems/sinatra' end should "display only specific gem" do body.should.not have_element('.gem', /rack/) end should "display link to gems website" do body.should have_element('a', 'http://sinatra.rubyforge.org') end + should "load gem spec for latest version" do + body.should have_element('.version', '0.9.0.5') + end + + should "display links to all versions" do + body.should have_element('.other_versions a[href="/gems/sinatra/0.9.0.2"]') + end + end + + describe 'getting gems/name/version' do + before do + get '/gems/sinatra/0.9.0.2' + end + + should "display only specific gem" do + body.should.not have_element('.gem', /rack/) + end + + should "display link to gems website" do + body.should have_element('a', 'http://sinatra.rubyforge.org') + end + + should "load gem spec specified version" do + body.should have_element('.version', '0.9.0.2') + end + + should "display links to all versions" do + body.should have_element('.other_versions a[href="/gems/sinatra/0.9.0.5"]') + end end end \ No newline at end of file
quirkey/gembox
67581f1299a718968ec4d1690e4d15fc3d9ceb4b
Moved gem list into its own view Added autotest support
diff --git a/test/.bacon b/test/.bacon new file mode 100644 index 0000000..e69de29 diff --git a/test/test_gembox_app.rb b/test/test_gembox_app.rb index 5e13ecf..e4d2428 100644 --- a/test/test_gembox_app.rb +++ b/test/test_gembox_app.rb @@ -1,56 +1,56 @@ -require 'test_helper' +require File.join(File.dirname(__FILE__), 'test_helper') describe "Gembox App" do describe 'getting /' do before do get '/' end should 'load the index' do should.be.ok end should "display gem list" do body.should have_element('#gems') end should "display list of installed gems" do body.should have_element('.gem', /sinatra/) end end describe 'getting gems/ with layout = false' do before do get '/gems/?layout=false' end should "load" do should.be.ok end should "not display layout" do body.should.not have_element('html') end should "display gem list" do body.should have_element('#gems') end end describe 'getting gems/:name' do before do get '/gems/sinatra' end should "display only specific gem" do body.should.not have_element('.gem', /rack/) end should "display link to gems website" do body.should have_element('a', 'http://sinatra.rubyforge.org') end end end \ No newline at end of file diff --git a/test/test_gembox_gems.rb b/test/test_gembox_gems.rb index 20ad08f..891f524 100644 --- a/test/test_gembox_gems.rb +++ b/test/test_gembox_gems.rb @@ -1,40 +1,40 @@ -require 'test_helper' +require File.join(File.dirname(__FILE__), 'test_helper') describe 'Gembox::Gems' do describe '#load' do before do Gembox::Gems.load end should "load local gems" do Gembox::Gems.local_gems.should.be.an instance_of(Hash) end should "load source index into source_index" do Gembox::Gems.source_index.should.be.an instance_of(Gem::SourceIndex) end end describe "#local_gems" do before do Gembox::Gems.load @gems = Gembox::Gems.local_gems end should "return hash of gems" do @gems.should.be.an instance_of(Hash) end should "only have one entry per gem" do @gems.should.has_key? 'sinatra' @gems.should.not.has_key? 'sinatra-0.9.0.5' end should "have an array of spec versions per gem name" do @gems['sinatra'].should.be.an instance_of(Array) @gems['sinatra'].first.should.be.an instance_of(Gem::Specification) end end end \ No newline at end of file diff --git a/views/gems.haml b/views/gems.haml new file mode 100644 index 0000000..05d864b --- /dev/null +++ b/views/gems.haml @@ -0,0 +1,6 @@ +#gems + [email protected] do |gem_name, spec| + .gem + =link_to(gem_name, "/gems/#{gem_name}") + .versions + %span Versions \ No newline at end of file diff --git a/views/index.haml b/views/index.haml index 9b5d7aa..421a29e 100644 --- a/views/index.haml +++ b/views/index.haml @@ -1,7 +1,2 @@ %h2 Installed Gems -#gems - [email protected] do |gem_name, spec| - .gem - =link_to(gem_name, "/gems/#{gem_name}") - .versions - %span Versions \ No newline at end of file +=haml :gems, :locals => {:gems => @gems}, :layout => false \ No newline at end of file
recurly/recurly-client-php
3daa8f2ac1e98ee97002375ccff17d49ca434c39
4.61.0
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 08504db..8de998f 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 4.60.0 +current_version = 4.61.0 parse = (?P<major>\d+) \.(?P<minor>\d+) \.(?P<patch>\d+) serialize = {major}.{minor}.{patch} [bumpversion:file:composer.json] [bumpversion:file:lib/recurly/version.php] diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d86c20..c502aeb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,514 +1,526 @@ # Changelog +## [4.61.0](https://github.com/recurly/recurly-client-php/tree/4.61.0) (2025-06-11) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.60.0...4.61.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 [#841](https://github.com/recurly/recurly-client-php/pull/841) ([recurly-integrations](https://github.com/recurly-integrations)) +- Generated Latest Changes for v2021-02-25 [#840](https://github.com/recurly/recurly-client-php/pull/840) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.60.0](https://github.com/recurly/recurly-client-php/tree/4.60.0) (2025-04-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.59.0...4.60.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#839](https://github.com/recurly/recurly-client-php/pull/839) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.59.0](https://github.com/recurly/recurly-client-php/tree/4.59.0) (2025-04-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.58.0...4.59.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25: Create External Invoices [#838](https://github.com/recurly/recurly-client-php/pull/838) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#836](https://github.com/recurly/recurly-client-php/pull/836) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.58.0](https://github.com/recurly/recurly-client-php/tree/4.58.0) (2025-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.57.0...4.58.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#835](https://github.com/recurly/recurly-client-php/pull/835) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.57.0](https://github.com/recurly/recurly-client-php/tree/4.57.0) (2025-02-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.56.0...4.57.0) **Merged Pull Requests** - Add `funding_source` to `BillingInfo` and `Transaction` [#834](https://github.com/recurly/recurly-client-php/pull/834) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#831](https://github.com/recurly/recurly-client-php/pull/831) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.56.0](https://github.com/recurly/recurly-client-php/tree/4.56.0) (2024-12-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.55.0...4.56.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#830](https://github.com/recurly/recurly-client-php/pull/830) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.55.0](https://github.com/recurly/recurly-client-php/tree/4.55.0) (2024-12-02) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.54.0...4.55.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#829](https://github.com/recurly/recurly-client-php/pull/829) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#826](https://github.com/recurly/recurly-client-php/pull/826) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.54.0](https://github.com/recurly/recurly-client-php/tree/4.54.0) (2024-08-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.53.0...4.54.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (add UUID to external subscriptions) [#823](https://github.com/recurly/recurly-client-php/pull/823) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.53.0](https://github.com/recurly/recurly-client-php/tree/4.53.0) (2024-08-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.52.0...4.53.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#821](https://github.com/recurly/recurly-client-php/pull/821) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.52.0](https://github.com/recurly/recurly-client-php/tree/4.52.0) (2024-07-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.51.0...4.52.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Taxable Address Control, RevRec) [#817](https://github.com/recurly/recurly-client-php/pull/817) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.51.0](https://github.com/recurly/recurly-client-php/tree/4.51.0) (2024-05-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.50.0...4.51.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#814](https://github.com/recurly/recurly-client-php/pull/814) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.50.0](https://github.com/recurly/recurly-client-php/tree/4.50.0) (2024-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.49.0...4.50.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entity Use Code) [#812](https://github.com/recurly/recurly-client-php/pull/812) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.49.0](https://github.com/recurly/recurly-client-php/tree/4.49.0) (2024-05-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.48.0...4.49.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Proration Settings) [#810](https://github.com/recurly/recurly-client-php/pull/810) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.48.0](https://github.com/recurly/recurly-client-php/tree/4.48.0) (2024-05-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.47.0...4.48.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Auth & Capture) [#808](https://github.com/recurly/recurly-client-php/pull/808) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.47.0](https://github.com/recurly/recurly-client-php/tree/4.47.0) (2024-03-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.46.0...4.47.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#803](https://github.com/recurly/recurly-client-php/pull/803) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.46.0](https://github.com/recurly/recurly-client-php/tree/4.46.0) (2024-02-20) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.45.0...4.46.0) **Merged Pull Requests** - Add invoice state param for v2021-02-25 [#799](https://github.com/recurly/recurly-client-php/pull/799) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.45.0](https://github.com/recurly/recurly-client-php/tree/4.45.0) (2024-01-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.44.0...4.45.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#789](https://github.com/recurly/recurly-client-php/pull/789) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.44.0](https://github.com/recurly/recurly-client-php/tree/4.44.0) (2024-01-18) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.43.0...4.44.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#788](https://github.com/recurly/recurly-client-php/pull/788) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.43.0](https://github.com/recurly/recurly-client-php/tree/4.43.0) (2023-12-06) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.42.0...4.43.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Payment Phases) [#785](https://github.com/recurly/recurly-client-php/pull/785) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.42.0](https://github.com/recurly/recurly-client-php/tree/4.42.0) (2023-11-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.41.0...4.42.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#783](https://github.com/recurly/recurly-client-php/pull/783) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.41.0](https://github.com/recurly/recurly-client-php/tree/4.41.0) (2023-08-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.40.0...4.41.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (`VATNumber`, `LifecycleDecline`) [#782](https://github.com/recurly/recurly-client-php/pull/782) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.40.0](https://github.com/recurly/recurly-client-php/tree/4.40.0) (2023-08-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.39.0...4.40.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (action_result) [#781](https://github.com/recurly/recurly-client-php/pull/781) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.39.0](https://github.com/recurly/recurly-client-php/tree/4.39.0) (2023-07-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.37.0...4.39.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Ramp Dates, Net Terms, Invoice Business Entity) [#779](https://github.com/recurly/recurly-client-php/pull/779) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (App Management - External Subscriptions) [#777](https://github.com/recurly/recurly-client-php/pull/777) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.37.0](https://github.com/recurly/recurly-client-php/tree/4.37.0) (2023-06-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.36.0...4.37.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Multiple Business Entities) [#769](https://github.com/recurly/recurly-client-php/pull/769) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.36.0](https://github.com/recurly/recurly-client-php/tree/4.36.0) (2023-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.35.0...4.36.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Products & References) [#766](https://github.com/recurly/recurly-client-php/pull/766) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.35.0](https://github.com/recurly/recurly-client-php/tree/4.35.0) (2023-05-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.34.0...4.35.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (gateway_attributes on PaymentMethod) [#764](https://github.com/recurly/recurly-client-php/pull/764) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#747](https://github.com/recurly/recurly-client-php/pull/747) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.28.0](https://github.com/recurly/recurly-client-php/tree/4.28.0) (2023-02-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.27.0...4.28.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (GiftCard endpoints and new transaction error support) [#745](https://github.com/recurly/recurly-client-php/pull/745) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.27.0](https://github.com/recurly/recurly-client-php/tree/4.27.0) (2023-01-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.26.0...4.27.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Custom Fields on Line Items) [#738](https://github.com/recurly/recurly-client-php/pull/738) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.26.0](https://github.com/recurly/recurly-client-php/tree/4.26.0) (2023-01-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.25.0...4.26.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Account Preferred Time Zone) [#736](https://github.com/recurly/recurly-client-php/pull/736) ([douglasmiller](https://github.com/douglasmiller)) ## [4.25.0](https://github.com/recurly/recurly-client-php/tree/4.25.0) (2022-11-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.24.0...4.25.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Apply Credit Balance feature) [#732](https://github.com/recurly/recurly-client-php/pull/732) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.24.0](https://github.com/recurly/recurly-client-php/tree/4.24.0) (2022-11-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.23.0...4.24.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Subscriptions feature) [#729](https://github.com/recurly/recurly-client-php/pull/729) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#728](https://github.com/recurly/recurly-client-php/pull/728) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.23.0](https://github.com/recurly/recurly-client-php/tree/4.23.0) (2022-10-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.22.0...4.23.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entitlements feature) [#725](https://github.com/recurly/recurly-client-php/pull/725) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.22.0](https://github.com/recurly/recurly-client-php/tree/4.22.0) (2022-10-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.2...4.22.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25(Decimal Usage and Quantities and DunningEvent new fields) [#722](https://github.com/recurly/recurly-client-php/pull/722) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.2](https://github.com/recurly/recurly-client-php/tree/4.21.2) (2022-09-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.1...4.21.2) **Merged Pull Requests** - feat: allow for psr/log ^2/3 [#716](https://github.com/recurly/recurly-client-php/pull/716) ([trickeyone](https://github.com/trickeyone)) ## [4.21.1](https://github.com/recurly/recurly-client-php/tree/4.21.1) (2022-09-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.0...4.21.1) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#714](https://github.com/recurly/recurly-client-php/pull/714) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.0](https://github.com/recurly/recurly-client-php/tree/4.21.0) (2022-09-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.20.0...4.21.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#713](https://github.com/recurly/recurly-client-php/pull/713) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixes bug with putDunningCampaignBulkUpdate [#706](https://github.com/recurly/recurly-client-php/pull/706) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.20.0](https://github.com/recurly/recurly-client-php/tree/4.20.0) (2022-08-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.19.0...4.20.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#701](https://github.com/recurly/recurly-client-php/pull/701) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.19.0](https://github.com/recurly/recurly-client-php/tree/4.19.0) (2022-07-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.18.0...4.19.0) **Merged Pull Requests** - Fixing deprecation warnings in client [#697](https://github.com/recurly/recurly-client-php/pull/697) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#695](https://github.com/recurly/recurly-client-php/pull/695) ([recurly-integrations](https://github.com/recurly-integrations)) **Closed Issues** - Recurly\Pager and \Iterator return type mismatch (PHP 8.1 deprecation) [#677](https://github.com/recurly/recurly-client-php/issues/677) ## [4.18.0](https://github.com/recurly/recurly-client-php/tree/4.18.0) (2022-06-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.17.0...4.18.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#693](https://github.com/recurly/recurly-client-php/pull/693) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.17.0](https://github.com/recurly/recurly-client-php/tree/4.17.0) (2022-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.16.0...4.17.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#679](https://github.com/recurly/recurly-client-php/pull/679) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.16.0](https://github.com/recurly/recurly-client-php/tree/4.16.0) (2022-03-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.15.0...4.16.0) **Merged Pull Requests** diff --git a/composer.json b/composer.json index 0002e25..0850617 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,38 @@ { "name": "recurly/recurly-client", - "version": "4.60.0", + "version": "4.61.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], "homepage": "https://github.com/recurly/recurly-client-php", "license": "MIT", "authors": [], "require": { "php": ">= 7.2.0", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "phpcompatibility/php-compatibility": "^9.3", "phpdocumentor/phpdocumentor": "~3.0.0", "phpstan/phpstan": "^0.12.11", "phpunit/phpunit": "^8", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "classmap": ["lib"], "files": ["lib/recurly.php"] }, "autoload-dev": { "classmap": ["tests"] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/lib/recurly/version.php b/lib/recurly/version.php index 9371739..02de66f 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -1,8 +1,8 @@ <?php namespace Recurly; class Version { - public const CURRENT = '4.60.0'; + public const CURRENT = '4.61.0'; }
recurly/recurly-client-php
f2d5f7dbadb615ef8e2d2f561a6010ccb17fc3d8
Generated Latest Changes for v2021-02-25
diff --git a/lib/recurly/resources/transaction.php b/lib/recurly/resources/transaction.php index 5e2c9be..5e640ce 100644 --- a/lib/recurly/resources/transaction.php +++ b/lib/recurly/resources/transaction.php @@ -1,1071 +1,1071 @@ <?php /** * This file is automatically created by Recurly's OpenAPI generation process * and thus any edits you make by hand will be lost. If you wish to make a * change to this file, please create a Github issue explaining the changes you * need and we will usher them to the appropriate places. */ namespace Recurly\Resources; use Recurly\RecurlyResource; // phpcs:disable class Transaction extends RecurlyResource { private $_account; private $_action_result; private $_amount; private $_avs_check; private $_backup_payment_method_used; private $_billing_address; private $_collected_at; private $_collection_method; private $_created_at; private $_currency; private $_customer_message; private $_customer_message_locale; private $_cvv_check; private $_fraud_info; private $_gateway_approval_code; private $_gateway_message; private $_gateway_reference; private $_gateway_response_code; private $_gateway_response_time; private $_gateway_response_values; private $_id; - private $_indicator; + private $_initiator; private $_invoice; private $_ip_address_country; private $_ip_address_v4; private $_merchant_reason_code; private $_object; private $_origin; private $_original_transaction_id; private $_payment_gateway; private $_payment_method; private $_refunded; private $_status; private $_status_code; private $_status_message; private $_subscription_ids; private $_success; private $_type; private $_updated_at; private $_uuid; private $_vat_number; private $_voided_at; private $_voided_by_invoice; protected static $array_hints = [ 'setSubscriptionIds' => 'string', ]; /** * Getter method for the account attribute. * Account mini details * * @return ?\Recurly\Resources\AccountMini */ public function getAccount(): ?\Recurly\Resources\AccountMini { return $this->_account; } /** * Setter method for the account attribute. * * @param \Recurly\Resources\AccountMini $account * * @return void */ public function setAccount(\Recurly\Resources\AccountMini $account): void { $this->_account = $account; } /** * Getter method for the action_result attribute. * Action result params to be used in Recurly-JS to complete a payment when using asynchronous payment methods, e.g., Boleto, iDEAL and Sofort. * * @return ?object */ public function getActionResult(): ?object { return $this->_action_result; } /** * Setter method for the action_result attribute. * * @param object $action_result * * @return void */ public function setActionResult(object $action_result): void { $this->_action_result = $action_result; } /** * Getter method for the amount attribute. * Total transaction amount sent to the payment gateway. * * @return ?float */ public function getAmount(): ?float { return $this->_amount; } /** * Setter method for the amount attribute. * * @param float $amount * * @return void */ public function setAmount(float $amount): void { $this->_amount = $amount; } /** * Getter method for the avs_check attribute. * When processed, result from checking the overall AVS on the transaction. * * @return ?string */ public function getAvsCheck(): ?string { return $this->_avs_check; } /** * Setter method for the avs_check attribute. * * @param string $avs_check * * @return void */ public function setAvsCheck(string $avs_check): void { $this->_avs_check = $avs_check; } /** * Getter method for the backup_payment_method_used attribute. * Indicates if the transaction was completed using a backup payment * * @return ?bool */ public function getBackupPaymentMethodUsed(): ?bool { return $this->_backup_payment_method_used; } /** * Setter method for the backup_payment_method_used attribute. * * @param bool $backup_payment_method_used * * @return void */ public function setBackupPaymentMethodUsed(bool $backup_payment_method_used): void { $this->_backup_payment_method_used = $backup_payment_method_used; } /** * Getter method for the billing_address attribute. * * * @return ?\Recurly\Resources\AddressWithName */ public function getBillingAddress(): ?\Recurly\Resources\AddressWithName { return $this->_billing_address; } /** * Setter method for the billing_address attribute. * * @param \Recurly\Resources\AddressWithName $billing_address * * @return void */ public function setBillingAddress(\Recurly\Resources\AddressWithName $billing_address): void { $this->_billing_address = $billing_address; } /** * Getter method for the collected_at attribute. * Collected at, or if not collected yet, the time the transaction was created. * * @return ?string */ public function getCollectedAt(): ?string { return $this->_collected_at; } /** * Setter method for the collected_at attribute. * * @param string $collected_at * * @return void */ public function setCollectedAt(string $collected_at): void { $this->_collected_at = $collected_at; } /** * Getter method for the collection_method attribute. * The method by which the payment was collected. * * @return ?string */ public function getCollectionMethod(): ?string { return $this->_collection_method; } /** * Setter method for the collection_method attribute. * * @param string $collection_method * * @return void */ public function setCollectionMethod(string $collection_method): void { $this->_collection_method = $collection_method; } /** * Getter method for the created_at attribute. * Created at * * @return ?string */ public function getCreatedAt(): ?string { return $this->_created_at; } /** * Setter method for the created_at attribute. * * @param string $created_at * * @return void */ public function setCreatedAt(string $created_at): void { $this->_created_at = $created_at; } /** * Getter method for the currency attribute. * 3-letter ISO 4217 currency code. * * @return ?string */ public function getCurrency(): ?string { return $this->_currency; } /** * Setter method for the currency attribute. * * @param string $currency * * @return void */ public function setCurrency(string $currency): void { $this->_currency = $currency; } /** * Getter method for the customer_message attribute. * For declined (`success=false`) transactions, the message displayed to the customer. * * @return ?string */ public function getCustomerMessage(): ?string { return $this->_customer_message; } /** * Setter method for the customer_message attribute. * * @param string $customer_message * * @return void */ public function setCustomerMessage(string $customer_message): void { $this->_customer_message = $customer_message; } /** * Getter method for the customer_message_locale attribute. * Language code for the message * * @return ?string */ public function getCustomerMessageLocale(): ?string { return $this->_customer_message_locale; } /** * Setter method for the customer_message_locale attribute. * * @param string $customer_message_locale * * @return void */ public function setCustomerMessageLocale(string $customer_message_locale): void { $this->_customer_message_locale = $customer_message_locale; } /** * Getter method for the cvv_check attribute. * When processed, result from checking the CVV/CVC value on the transaction. * * @return ?string */ public function getCvvCheck(): ?string { return $this->_cvv_check; } /** * Setter method for the cvv_check attribute. * * @param string $cvv_check * * @return void */ public function setCvvCheck(string $cvv_check): void { $this->_cvv_check = $cvv_check; } /** * Getter method for the fraud_info attribute. * Fraud information * * @return ?\Recurly\Resources\TransactionFraudInfo */ public function getFraudInfo(): ?\Recurly\Resources\TransactionFraudInfo { return $this->_fraud_info; } /** * Setter method for the fraud_info attribute. * * @param \Recurly\Resources\TransactionFraudInfo $fraud_info * * @return void */ public function setFraudInfo(\Recurly\Resources\TransactionFraudInfo $fraud_info): void { $this->_fraud_info = $fraud_info; } /** * Getter method for the gateway_approval_code attribute. * Transaction approval code from the payment gateway. * * @return ?string */ public function getGatewayApprovalCode(): ?string { return $this->_gateway_approval_code; } /** * Setter method for the gateway_approval_code attribute. * * @param string $gateway_approval_code * * @return void */ public function setGatewayApprovalCode(string $gateway_approval_code): void { $this->_gateway_approval_code = $gateway_approval_code; } /** * Getter method for the gateway_message attribute. * Transaction message from the payment gateway. * * @return ?string */ public function getGatewayMessage(): ?string { return $this->_gateway_message; } /** * Setter method for the gateway_message attribute. * * @param string $gateway_message * * @return void */ public function setGatewayMessage(string $gateway_message): void { $this->_gateway_message = $gateway_message; } /** * Getter method for the gateway_reference attribute. * Transaction reference number from the payment gateway. * * @return ?string */ public function getGatewayReference(): ?string { return $this->_gateway_reference; } /** * Setter method for the gateway_reference attribute. * * @param string $gateway_reference * * @return void */ public function setGatewayReference(string $gateway_reference): void { $this->_gateway_reference = $gateway_reference; } /** * Getter method for the gateway_response_code attribute. * For declined transactions (`success=false`), this field lists the gateway error code. * * @return ?string */ public function getGatewayResponseCode(): ?string { return $this->_gateway_response_code; } /** * Setter method for the gateway_response_code attribute. * * @param string $gateway_response_code * * @return void */ public function setGatewayResponseCode(string $gateway_response_code): void { $this->_gateway_response_code = $gateway_response_code; } /** * Getter method for the gateway_response_time attribute. * Time, in seconds, for gateway to process the transaction. * * @return ?float */ public function getGatewayResponseTime(): ?float { return $this->_gateway_response_time; } /** * Setter method for the gateway_response_time attribute. * * @param float $gateway_response_time * * @return void */ public function setGatewayResponseTime(float $gateway_response_time): void { $this->_gateway_response_time = $gateway_response_time; } /** * Getter method for the gateway_response_values attribute. * The values in this field will vary from gateway to gateway. * * @return ?object */ public function getGatewayResponseValues(): ?object { return $this->_gateway_response_values; } /** * Setter method for the gateway_response_values attribute. * * @param object $gateway_response_values * * @return void */ public function setGatewayResponseValues(object $gateway_response_values): void { $this->_gateway_response_values = $gateway_response_values; } /** * Getter method for the id attribute. * Transaction ID * * @return ?string */ public function getId(): ?string { return $this->_id; } /** * Setter method for the id attribute. * * @param string $id * * @return void */ public function setId(string $id): void { $this->_id = $id; } /** - * Getter method for the indicator attribute. + * Getter method for the initiator attribute. * Must be sent for one-time transactions in order to provide context on which entity is submitting the transaction to ensure proper fraud checks are observed, such as 3DS. If the customer is in session, send `customer`. If this is a merchant initiated one-time transaction, send `merchant`. * * @return ?string */ - public function getIndicator(): ?string + public function getInitiator(): ?string { - return $this->_indicator; + return $this->_initiator; } /** - * Setter method for the indicator attribute. + * Setter method for the initiator attribute. * - * @param string $indicator + * @param string $initiator * * @return void */ - public function setIndicator(string $indicator): void + public function setInitiator(string $initiator): void { - $this->_indicator = $indicator; + $this->_initiator = $initiator; } /** * Getter method for the invoice attribute. * Invoice mini details * * @return ?\Recurly\Resources\InvoiceMini */ public function getInvoice(): ?\Recurly\Resources\InvoiceMini { return $this->_invoice; } /** * Setter method for the invoice attribute. * * @param \Recurly\Resources\InvoiceMini $invoice * * @return void */ public function setInvoice(\Recurly\Resources\InvoiceMini $invoice): void { $this->_invoice = $invoice; } /** * Getter method for the ip_address_country attribute. * Origin IP address country, 2-letter ISO 3166-1 alpha-2 code, if known by Recurly. * * @return ?string */ public function getIpAddressCountry(): ?string { return $this->_ip_address_country; } /** * Setter method for the ip_address_country attribute. * * @param string $ip_address_country * * @return void */ public function setIpAddressCountry(string $ip_address_country): void { $this->_ip_address_country = $ip_address_country; } /** * Getter method for the ip_address_v4 attribute. * IP address provided when the billing information was collected: - When the customer enters billing information into the Recurly.js or Hosted Payment Pages, Recurly records the IP address. - When the merchant enters billing information using the API, the merchant may provide an IP address. - When the merchant enters billing information using the UI, no IP address is recorded. * * @return ?string */ public function getIpAddressV4(): ?string { return $this->_ip_address_v4; } /** * Setter method for the ip_address_v4 attribute. * * @param string $ip_address_v4 * * @return void */ public function setIpAddressV4(string $ip_address_v4): void { $this->_ip_address_v4 = $ip_address_v4; } /** * Getter method for the merchant_reason_code attribute. * This conditional parameter is useful for merchants in specific industries who need to submit one-time Merchant Initiated transactions in specific cases. Not all gateways support these methods, but will support a generic one-time Merchant Initiated transaction. Only use this if the initiator value is "merchant". Otherwise, it will be ignored. - Incremental: Send `incremental` with an additional purchase if the original authorization amount is not sufficient to cover the costs of your service or product. For example, if the customer adds goods or services or there are additional expenses. - No Show: Send `no_show` if you charge customers a fee due to an agreed-upon cancellation policy in your industry. - Resubmission: Send `resubmission` if you need to attempt collection on a declined transaction. You may also use the force collection behavior which has the same effect. - Service Extension: Send `service_extension` if you are in a service industry and the customer has increased/extended their service in some way. For example: adding a day onto a car rental agreement. - Split Shipment: Send `split_shipment` if you sell physical product and need to split up a shipment into multiple transactions when the customer is no longer in session. - Top Up: Send `top_up` if you process one-time transactions based on a pre-arranged agreement with your customer where there is a pre-arranged account balance that needs maintaining. For example, if the customer has agreed to maintain an account balance of 30.00 and their current balance is 20.00, the MIT amount would be at least 10.00 to meet that 30.00 threshold. * * @return ?string */ public function getMerchantReasonCode(): ?string { return $this->_merchant_reason_code; } /** * Setter method for the merchant_reason_code attribute. * * @param string $merchant_reason_code * * @return void */ public function setMerchantReasonCode(string $merchant_reason_code): void { $this->_merchant_reason_code = $merchant_reason_code; } /** * Getter method for the object attribute. * Object type * * @return ?string */ public function getObject(): ?string { return $this->_object; } /** * Setter method for the object attribute. * * @param string $object * * @return void */ public function setObject(string $object): void { $this->_object = $object; } /** * Getter method for the origin attribute. * Describes how the transaction was triggered. * * @return ?string */ public function getOrigin(): ?string { return $this->_origin; } /** * Setter method for the origin attribute. * * @param string $origin * * @return void */ public function setOrigin(string $origin): void { $this->_origin = $origin; } /** * Getter method for the original_transaction_id attribute. * If this transaction is a refund (`type=refund`), this will be the ID of the original transaction on the invoice being refunded. * * @return ?string */ public function getOriginalTransactionId(): ?string { return $this->_original_transaction_id; } /** * Setter method for the original_transaction_id attribute. * * @param string $original_transaction_id * * @return void */ public function setOriginalTransactionId(string $original_transaction_id): void { $this->_original_transaction_id = $original_transaction_id; } /** * Getter method for the payment_gateway attribute. * * * @return ?\Recurly\Resources\TransactionPaymentGateway */ public function getPaymentGateway(): ?\Recurly\Resources\TransactionPaymentGateway { return $this->_payment_gateway; } /** * Setter method for the payment_gateway attribute. * * @param \Recurly\Resources\TransactionPaymentGateway $payment_gateway * * @return void */ public function setPaymentGateway(\Recurly\Resources\TransactionPaymentGateway $payment_gateway): void { $this->_payment_gateway = $payment_gateway; } /** * Getter method for the payment_method attribute. * * * @return ?\Recurly\Resources\PaymentMethod */ public function getPaymentMethod(): ?\Recurly\Resources\PaymentMethod { return $this->_payment_method; } /** * Setter method for the payment_method attribute. * * @param \Recurly\Resources\PaymentMethod $payment_method * * @return void */ public function setPaymentMethod(\Recurly\Resources\PaymentMethod $payment_method): void { $this->_payment_method = $payment_method; } /** * Getter method for the refunded attribute. * Indicates if part or all of this transaction was refunded. * * @return ?bool */ public function getRefunded(): ?bool { return $this->_refunded; } /** * Setter method for the refunded attribute. * * @param bool $refunded * * @return void */ public function setRefunded(bool $refunded): void { $this->_refunded = $refunded; } /** * Getter method for the status attribute. * The current transaction status. Note that the status may change, e.g. a `pending` transaction may become `declined` or `success` may later become `void`. * * @return ?string */ public function getStatus(): ?string { return $this->_status; } /** * Setter method for the status attribute. * * @param string $status * * @return void */ public function setStatus(string $status): void { $this->_status = $status; } /** * Getter method for the status_code attribute. * Status code * * @return ?string */ public function getStatusCode(): ?string { return $this->_status_code; } /** * Setter method for the status_code attribute. * * @param string $status_code * * @return void */ public function setStatusCode(string $status_code): void { $this->_status_code = $status_code; } /** * Getter method for the status_message attribute. * For declined (`success=false`) transactions, the message displayed to the merchant. * * @return ?string */ public function getStatusMessage(): ?string { return $this->_status_message; } /** * Setter method for the status_message attribute. * * @param string $status_message * * @return void */ public function setStatusMessage(string $status_message): void { $this->_status_message = $status_message; } /** * Getter method for the subscription_ids attribute. * If the transaction is charging or refunding for one or more subscriptions, these are their IDs. * * @return array */ public function getSubscriptionIds(): array { return $this->_subscription_ids ?? [] ; } /** * Setter method for the subscription_ids attribute. * * @param array $subscription_ids * * @return void */ public function setSubscriptionIds(array $subscription_ids): void { $this->_subscription_ids = $subscription_ids; } /** * Getter method for the success attribute. * Did this transaction complete successfully? * * @return ?bool */ public function getSuccess(): ?bool { return $this->_success; } /** * Setter method for the success attribute. * * @param bool $success * * @return void */ public function setSuccess(bool $success): void { $this->_success = $success; } /** * Getter method for the type attribute. * - `authorization` – verifies billing information and places a hold on money in the customer's account. - `capture` – captures funds held by an authorization and completes a purchase. - `purchase` – combines the authorization and capture in one transaction. - `refund` – returns all or a portion of the money collected in a previous transaction to the customer. - `verify` – a $0 or $1 transaction used to verify billing information which is immediately voided. * * @return ?string */ public function getType(): ?string { return $this->_type; } /** * Setter method for the type attribute. * * @param string $type * * @return void */ public function setType(string $type): void { $this->_type = $type; } /** * Getter method for the updated_at attribute. * Updated at * * @return ?string */ public function getUpdatedAt(): ?string { return $this->_updated_at; } /** * Setter method for the updated_at attribute. * * @param string $updated_at * * @return void */ public function setUpdatedAt(string $updated_at): void { $this->_updated_at = $updated_at; } /** * Getter method for the uuid attribute. * The UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI. * * @return ?string */ public function getUuid(): ?string { return $this->_uuid; } /** * Setter method for the uuid attribute. * * @param string $uuid * * @return void */ public function setUuid(string $uuid): void { $this->_uuid = $uuid; } /** * Getter method for the vat_number attribute. * VAT number for the customer on this transaction. If the customer's Billing Info country is BR or AR, then this will be their Tax Identifier. For all other countries this will come from the VAT Number field in the Billing Info. * * @return ?string */ public function getVatNumber(): ?string { return $this->_vat_number; } /** * Setter method for the vat_number attribute. * * @param string $vat_number * * @return void */ public function setVatNumber(string $vat_number): void { $this->_vat_number = $vat_number; } /** * Getter method for the voided_at attribute. * Voided at * * @return ?string */ public function getVoidedAt(): ?string { return $this->_voided_at; } /** * Setter method for the voided_at attribute. * * @param string $voided_at * * @return void */ public function setVoidedAt(string $voided_at): void { $this->_voided_at = $voided_at; } /** * Getter method for the voided_by_invoice attribute. * Invoice mini details * * @return ?\Recurly\Resources\InvoiceMini */ public function getVoidedByInvoice(): ?\Recurly\Resources\InvoiceMini { return $this->_voided_by_invoice; } /** * Setter method for the voided_by_invoice attribute. * * @param \Recurly\Resources\InvoiceMini $voided_by_invoice * * @return void */ public function setVoidedByInvoice(\Recurly\Resources\InvoiceMini $voided_by_invoice): void { $this->_voided_by_invoice = $voided_by_invoice; } } \ No newline at end of file diff --git a/openapi/api.yaml b/openapi/api.yaml index 0e1b62a..2523e0b 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -23770,1584 +23770,1584 @@ components: "$ref": "#/components/schemas/RevenueScheduleTypeEnum" terms_and_conditions: type: string title: Terms and conditions description: This will default to the Terms and Conditions text specified on the Invoice Settings page in your Recurly admin. Specify custom notes to add or override Terms and Conditions. Custom notes will stay with a subscription on all renewals. customer_notes: type: string title: Customer notes description: This will default to the Customer Notes text specified on the Invoice Settings. Specify custom notes to add or override Customer Notes. Custom notes will stay with a subscription on all renewals. credit_customer_notes: type: string title: Credit customer notes description: If there are pending credits on the account that will be invoiced during the subscription creation, these will be used as the Customer Notes on the credit invoice. po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Net terms description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" gateway_code: type: string title: Gateway Code description: If present, this subscription's transactions will use the payment gateway with this code. maxLength: 13 transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" gift_card_redemption_code: type: string title: Gift card Redemption Code description: A gift card redemption code to be redeemed on the purchase invoice. bulk: type: boolean description: Optional field to be used only when needing to bypass the 60 second limit on creating subscriptions. Should only be used when creating subscriptions in bulk from the API. default: false required: - plan_code - currency - account SubscriptionPurchase: type: object properties: plan_code: type: string title: Plan code plan_id: type: string title: Plan ID maxLength: 13 unit_amount: type: number format: float title: Custom subscription pricing description: Override the unit amount of the subscription plan by setting this value. If not provided, the subscription will inherit the price from the subscription plan for the provided currency. minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to use this flag. quantity: type: integer title: Quantity description: Optionally override the default quantity of 1. default: 1 minimum: 0 add_ons: type: array title: Add-ons items: "$ref": "#/components/schemas/SubscriptionAddOnCreate" custom_fields: "$ref": "#/components/schemas/CustomFields" shipping: title: Shipping address description: Create a shipping address on the account and assign it to the subscription. "$ref": "#/components/schemas/SubscriptionShippingPurchase" trial_ends_at: type: string format: date-time title: Trial ends at description: If set, overrides the default trial behavior for the subscription. When the current date time or a past date time is provided the subscription will begin with no trial phase (overriding any plan default trial). When a future date time is provided the subscription will begin with a trial phase ending at the specified date time. starts_at: type: string format: date-time title: Start date description: If set, the subscription will begin on this specified date. The subscription will apply the setup fee and trial period, unless the plan has no trial. Omit this field if the subscription should be started immediately. next_bill_date: type: string format: date-time title: Next bill date description: If present, this sets the date the subscription's next billing period will start (`current_period_ends_at`). This can be used to align the subscription’s billing to a specific day of the month. The initial invoice will be prorated for the period between the subscription's activation date and the billing period end date. Subsequent periods will be based off the plan interval. For a subscription with a trial period, this will change when the trial expires. total_billing_cycles: type: integer title: Total billing cycles description: The number of cycles/billing periods in a term. When `remaining_billing_cycles=0`, if `auto_renew=true` the subscription will renew and a new term will begin, otherwise the subscription will expire. minimum: 1 renewal_billing_cycles: type: integer title: Renewal billing cycles description: If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. auto_renew: type: boolean default: true title: Auto renew description: Whether the subscription renews at the end of its term. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" ramp_intervals: type: array title: Ramp Intervals description: The new set of ramp intervals for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampInterval" bulk: type: boolean description: Optional field to be used only when needing to bypass the 60 second limit on creating subscriptions. Should only be used when creating subscriptions in bulk from the API. default: false required: - plan_code SubscriptionUpdate: type: object properties: collection_method: title: Change collection method "$ref": "#/components/schemas/CollectionMethodEnum" custom_fields: "$ref": "#/components/schemas/CustomFields" remaining_billing_cycles: type: integer title: Remaining billing cycles description: The remaining billing cycles in the current term. renewal_billing_cycles: type: integer title: Renewal billing cycles description: If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. auto_renew: type: boolean default: true title: Auto renew description: Whether the subscription renews at the end of its term. next_bill_date: type: string format: date-time title: Next bill date description: If present, this sets the date the subscription's next billing period will start (`current_period_ends_at`). This can be used to align the subscription’s billing to a specific day of the month. For a subscription in a trial period, this will change when the trial expires. This parameter is useful for postponement of a subscription to change its billing date without proration. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" terms_and_conditions: type: string title: Terms and conditions description: Specify custom notes to add or override Terms and Conditions. Custom notes will stay with a subscription on all renewals. customer_notes: type: string title: Customer notes description: Specify custom notes to add or override Customer Notes. Custom notes will stay with a subscription on all renewals. po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Terms that the subscription is due on description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" gateway_code: type: string title: Gateway Code description: If present, this subscription's transactions will use the payment gateway with this code. maxLength: 13 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true shipping: "$ref": "#/components/schemas/SubscriptionShippingUpdate" billing_info_id: type: string title: Billing Info ID description: The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. SubscriptionPause: type: object properties: remaining_pause_cycles: type: integer title: Remaining pause cycles description: Number of billing cycles to pause the subscriptions. A value of 0 will cancel any pending pauses on the subscription. required: - remaining_pause_cycles SubscriptionShipping: type: object title: Subscription shipping details properties: object: type: string title: Object type address: "$ref": "#/components/schemas/ShippingAddress" method: "$ref": "#/components/schemas/ShippingMethodMini" amount: type: number format: float title: Subscription's shipping cost SubscriptionShippingCreate: type: object title: Subscription shipping details properties: address: "$ref": "#/components/schemas/ShippingAddressCreate" address_id: type: string title: Shipping address ID description: Assign a shipping address from the account's existing shipping addresses. If `address_id` and `address` are both present, `address` will be used. maxLength: 13 method_id: type: string title: Service ID description: The id of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 13 method_code: type: string title: Service Code description: The code of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 50 amount: type: number format: float title: Assigns the subscription's shipping cost. If this is greater than zero then a `method_id` or `method_code` is required. SubscriptionShippingUpdate: type: object title: Subscription shipping details properties: object: type: string title: Object type address: "$ref": "#/components/schemas/ShippingAddressCreate" address_id: type: string title: Shipping Address ID description: Assign a shipping address from the account's existing shipping addresses. maxLength: 13 SubscriptionShippingPurchase: type: object title: Subscription shipping details properties: method_id: type: string title: Service ID description: The id of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 13 method_code: type: string title: Service Code description: The code of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 50 amount: type: number format: float title: Assigns the subscription's shipping cost. If this is greater than zero then a `method_id` or `method_code` is required. SubscriptionRampInterval: type: object title: Subscription Ramp Interval properties: starting_billing_cycle: type: integer description: Represents the billing cycle where a ramp interval starts. default: 1 unit_amount: type: integer description: Represents the price for the ramp interval. SubscriptionRampIntervalResponse: type: object title: Subscription Ramp Interval properties: starting_billing_cycle: type: integer description: Represents the billing cycle where a ramp interval starts. remaining_billing_cycles: type: integer description: Represents how many billing cycles are left in a ramp interval. starting_on: type: string format: date-time title: Date the ramp interval starts ending_on: type: string format: date-time title: Date the ramp interval ends unit_amount: type: number format: float title: Unit price description: Represents the price for the ramp interval. TaxInfo: type: object title: Tax info description: Only for merchants using Recurly's In-The-Box taxes. properties: type: type: string title: Type description: Provides the tax type as "vat" for EU VAT, "usst" for U.S. Sales Tax, or the 2 letter country code for country level tax types like Canada, Australia, New Zealand, Israel, and all non-EU European countries. Not present when Avalara for Communications is enabled. region: type: string title: Region description: Provides the tax region applied on an invoice. For U.S. Sales Tax, this will be the 2 letter state code. For EU VAT this will be the 2 letter country code. For all country level tax types, this will display the regional tax, like VAT, GST, or PST. Not present when Avalara for Communications is enabled. rate: type: number format: float title: Rate description: The combined tax rate. Not present when Avalara for Communications is enabled. tax_details: type: array description: Provides additional tax details for Communications taxes when Avalara for Communications is enabled or Canadian Sales Tax when there is tax applied at both the country and province levels. This will only be populated for the Invoice response when fetching a single invoice and not for the InvoiceList or LineItemList. Only populated for a single LineItem fetch when Avalara for Communications is enabled. items: "$ref": "#/components/schemas/TaxDetail" TaxDetail: type: object title: Tax detail properties: type: type: string title: Type description: Provides the tax type for the region or type of Comminications tax when Avalara for Communications is enabled. For Canadian Sales Tax, this will be GST, HST, QST or PST. region: type: string title: Region description: Provides the tax region applied on an invoice. For Canadian Sales Tax, this will be either the 2 letter province code or country code. Not present when Avalara for Communications is enabled. rate: type: number format: float title: Rate description: Provides the tax rate for the region. tax: type: number format: float title: Tax description: The total tax applied for this tax type. name: type: string title: Name description: Provides the name of the Communications tax applied. Present only when Avalara for Communications is enabled. level: type: string title: Level description: Provides the jurisdiction level for the Communications tax applied. Example values include city, state and federal. Present only when Avalara for Communications is enabled. billable: type: boolean title: Billable description: Whether or not the line item is taxable. Only populated for a single LineItem fetch when Avalara for Communications is enabled. Transaction: type: object properties: id: type: string title: Transaction ID maxLength: 13 object: type: string title: Object type uuid: type: string title: Recurly UUID description: The UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI. maxLength: 32 original_transaction_id: type: string title: Original Transaction ID description: If this transaction is a refund (`type=refund`), this will be the ID of the original transaction on the invoice being refunded. maxLength: 13 account: "$ref": "#/components/schemas/AccountMini" - indicator: - "$ref": "#/components/schemas/TransactionIndicatorEnum" + initiator: + "$ref": "#/components/schemas/TransactionInitiatorEnum" invoice: "$ref": "#/components/schemas/InvoiceMini" merchant_reason_code: "$ref": "#/components/schemas/TransactionMerchantReasonCodeEnum" voided_by_invoice: "$ref": "#/components/schemas/InvoiceMini" subscription_ids: type: array title: Subscription IDs description: If the transaction is charging or refunding for one or more subscriptions, these are their IDs. items: type: string title: Subscription ID maxLength: 13 type: title: Transaction type description: | - `authorization` – verifies billing information and places a hold on money in the customer's account. - `capture` – captures funds held by an authorization and completes a purchase. - `purchase` – combines the authorization and capture in one transaction. - `refund` – returns all or a portion of the money collected in a previous transaction to the customer. - `verify` – a $0 or $1 transaction used to verify billing information which is immediately voided. "$ref": "#/components/schemas/TransactionTypeEnum" origin: title: Origin of transaction description: Describes how the transaction was triggered. "$ref": "#/components/schemas/TransactionOriginEnum" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 amount: type: number format: float title: Amount description: Total transaction amount sent to the payment gateway. status: title: Transaction status description: The current transaction status. Note that the status may change, e.g. a `pending` transaction may become `declined` or `success` may later become `void`. "$ref": "#/components/schemas/TransactionStatusEnum" success: type: boolean title: Success? description: Did this transaction complete successfully? backup_payment_method_used: type: boolean title: Backup Payment Method Used? description: Indicates if the transaction was completed using a backup payment refunded: type: boolean title: Refunded? description: Indicates if part or all of this transaction was refunded. billing_address: "$ref": "#/components/schemas/AddressWithName" collection_method: description: The method by which the payment was collected. "$ref": "#/components/schemas/CollectionMethodEnum" payment_method: "$ref": "#/components/schemas/PaymentMethod" ip_address_v4: type: string title: IP address description: | IP address provided when the billing information was collected: - When the customer enters billing information into the Recurly.js or Hosted Payment Pages, Recurly records the IP address. - When the merchant enters billing information using the API, the merchant may provide an IP address. - When the merchant enters billing information using the UI, no IP address is recorded. ip_address_country: type: string title: Origin IP address country, 2-letter ISO 3166-1 alpha-2 code, if known by Recurly. status_code: type: string title: Status code status_message: type: string title: Status message description: For declined (`success=false`) transactions, the message displayed to the merchant. customer_message: type: string title: Customer message description: For declined (`success=false`) transactions, the message displayed to the customer. customer_message_locale: type: string title: Language code for the message payment_gateway: type: object x-class-name: TransactionPaymentGateway properties: id: type: string object: type: string title: Object type type: type: string name: type: string gateway_message: type: string title: Gateway message description: Transaction message from the payment gateway. gateway_reference: type: string title: Gateway reference description: Transaction reference number from the payment gateway. gateway_approval_code: type: string title: Transaction approval code from the payment gateway. gateway_response_code: type: string title: For declined transactions (`success=false`), this field lists the gateway error code. gateway_response_time: type: number format: float title: Gateway response time description: Time, in seconds, for gateway to process the transaction. gateway_response_values: type: object title: Gateway response values description: The values in this field will vary from gateway to gateway. cvv_check: title: CVV check description: When processed, result from checking the CVV/CVC value on the transaction. "$ref": "#/components/schemas/CvvCheckEnum" avs_check: title: AVS check description: When processed, result from checking the overall AVS on the transaction. "$ref": "#/components/schemas/AvsCheckEnum" created_at: type: string format: date-time title: Created at updated_at: type: string format: date-time title: Updated at voided_at: type: string format: date-time title: Voided at collected_at: type: string format: date-time title: Collected at, or if not collected yet, the time the transaction was created. action_result: type: object description: Action result params to be used in Recurly-JS to complete a payment when using asynchronous payment methods, e.g., Boleto, iDEAL and Sofort. title: Action result vat_number: type: string description: VAT number for the customer on this transaction. If the customer's Billing Info country is BR or AR, then this will be their Tax Identifier. For all other countries this will come from the VAT Number field in the Billing Info. title: VAT Number fraud_info: "$ref": "#/components/schemas/TransactionFraudInfo" TransactionFraudInfo: type: object title: Fraud information readOnly: true properties: object: type: string title: Object type readOnly: true score: type: integer title: Kount score minimum: 1 maximum: 99 decision: title: Kount decision maxLength: 10 "$ref": "#/components/schemas/KountDecisionEnum" reference: type: string title: Kount transaction reference ID risk_rules_triggered: type: array title: Risk Rules Triggered description: A list of fraud risk rules that were triggered for the transaction. items: "$ref": "#/components/schemas/FraudRiskRule" FraudRiskRule: type: object properties: code: type: string title: The Kount rule number. message: type: string title: Description of why the rule was triggered ExternalTransaction: type: object properties: payment_method: type: string title: Payment Method description: Payment method used for external transaction. "$ref": "#/components/schemas/ExternalPaymentMethodEnum" description: type: string title: Description description: Used as the transaction's description. maxLength: 50 amount: type: number format: float title: Amount description: The total amount of the transcaction. Cannot excceed the invoice total. collected_at: type: string format: date-time title: Collected At description: Datetime that the external payment was collected. Defaults to current datetime. UniqueCouponCode: type: object description: A unique coupon code for a bulk coupon. properties: id: type: string title: Unique Coupon Code ID readOnly: true object: type: string title: Object type readOnly: true code: type: string title: Coupon code description: The code the customer enters to redeem the coupon. state: title: State description: Indicates if the unique coupon code is redeemable or why not. "$ref": "#/components/schemas/CouponCodeStateEnum" bulk_coupon_id: type: string title: Bulk Coupon ID description: The Coupon ID of the parent Bulk Coupon readOnly: true bulk_coupon_code: type: string title: Bulk Coupon code description: The Coupon code of the parent Bulk Coupon created_at: type: string title: Created at format: date-time readOnly: true updated_at: type: string title: Updated at format: date-time readOnly: true redeemed_at: type: string title: Redeemed at description: The date and time the unique coupon code was redeemed. format: date-time readOnly: true expired_at: type: string title: Expired at description: The date and time the coupon was expired early or reached its `max_redemptions`. format: date-time UniqueCouponCodeList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/UniqueCouponCode" UniqueCouponCodeParams: type: object description: Parameters to be passed to the `list_unique_coupon_codes` endpoint to obtain the newly generated codes. properties: limit: type: integer title: The number of UniqueCouponCodes that will be generated order: type: string title: Sort order to list newly generated UniqueCouponCodes (should always be `asc`) sort: type: string title: Sort field to list newly generated UniqueCouponCodes (should always be `created_at`) begin_time: type: string title: Begin time query parameter description: The date-time to be included when listing UniqueCouponCodes format: date-time Usage: type: object properties: id: type: string object: type: string title: Object type merchant_tag: type: string description: Custom field for recording the id in your own system associated with the usage, so you can provide auditable usage displays to your customers using a GET on this endpoint. amount: type: number format: float description: The amount of usage. Can be positive, negative, or 0. If the Decimal Quantity feature is enabled, this value will be rounded to nine decimal places. Otherwise, all digits after the decimal will be stripped. If the usage-based add-on is billed with a percentage, your usage should be a monetary amount formatted in cents (e.g., $5.00 is "500"). usage_type: "$ref": "#/components/schemas/UsageTypeEnum" tier_type: "$ref": "#/components/schemas/TierTypeEnum" tiers: type: array title: Tiers items: "$ref": "#/components/schemas/SubscriptionAddOnTier" description: The tiers and prices of the subscription based on the usage_timestamp. If tier_type = flat, tiers = [] percentage_tiers: type: array title: Percentage Tiers items: "$ref": "#/components/schemas/SubscriptionAddOnPercentageTier" description: The percentage tiers of the subscription based on the usage_timestamp. If tier_type = flat, percentage_tiers = []. This feature is currently in development and requires approval and enablement, please contact support. measured_unit_id: type: string description: The ID of the measured unit associated with the add-on the usage record is for. recording_timestamp: type: string format: date-time description: When the usage was recorded in your system. usage_timestamp: type: string format: date-time description: When the usage actually happened. This will define the line item dates this usage is billed under and is important for revenue recognition. usage_percentage: type: number format: float title: Usage Percentage description: The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. unit_amount: type: number format: float title: Unit price unit_amount_decimal: type: string title: Unit Amount Decimal minimum: 0 maximum: 1000000 description: Unit price that can optionally support a sub-cent value. billed_at: type: string format: date-time description: When the usage record was billed on an invoice. created_at: type: string format: date-time description: When the usage record was created in Recurly. updated_at: type: string format: date-time description: When the usage record was billed on an invoice. UsageCreate: type: object properties: merchant_tag: type: string description: Custom field for recording the id in your own system associated with the usage, so you can provide auditable usage displays to your customers using a GET on this endpoint. amount: type: number format: float description: The amount of usage. Can be positive, negative, or 0. If the Decimal Quantity feature is enabled, this value will be rounded to nine decimal places. Otherwise, all digits after the decimal will be stripped. If the usage-based add-on is billed with a percentage, your usage should be a monetary amount formatted in cents (e.g., $5.00 is "500"). recording_timestamp: type: string format: date-time description: When the usage was recorded in your system. usage_timestamp: type: string format: date-time description: When the usage actually happened. This will define the line item dates this usage is billed under and is important for revenue recognition. UsageList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/Usage" User: type: object properties: id: type: string readOnly: true object: type: string title: Object type readOnly: true email: type: string format: email first_name: type: string last_name: type: string time_zone: type: string created_at: type: string format: date-time readOnly: true deleted_at: type: string format: date-time readOnly: true PurchaseCreate: type: object description: A purchase is only a request data type and is not persistent in Recurly, an InvoiceCollection will be the returned type. properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 account: "$ref": "#/components/schemas/AccountPurchase" billing_info_id: type: string description: The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. business_entity_id: type: string title: Business Entity ID description: The `business_entity_id` is the value that represents a specific business entity for an end customer. When `business_entity_id` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. business_entity_code: type: string title: Business Entity Code description: The `business_entity_code` is the value that represents a specific business entity for an end customer. When `business_entity_code` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. collection_method: title: Collection method description: Must be set to manual in order to preview a purchase for an Account that does not have payment information associated with the Billing Info. default: automatic "$ref": "#/components/schemas/CollectionMethodEnum" po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Net terms description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" terms_and_conditions: type: string title: Terms and conditions description: Terms and conditions to be put on the purchase invoice. transaction: type: object description: "(Transaction Data, Card on File) - Options for flagging transactions as Customer or Merchant Initiated Unscheduled." allOf: - type: object properties: - indicator: - "$ref": "#/components/schemas/Transaction/properties/indicator" + initiator: + "$ref": "#/components/schemas/Transaction/properties/initiator" merchant_reason_code: "$ref": "#/components/schemas/Transaction/properties/merchant_reason_code" customer_notes: type: string title: Customer notes vat_reverse_charge_notes: type: string title: VAT reverse charge notes description: VAT reverse charge notes for cross border European tax settlement. credit_customer_notes: type: string title: Credit customer notes description: Notes to be put on the credit invoice resulting from credits in the purchase, if any. gateway_code: type: string title: Gateway Code description: The default payment gateway identifier to be used for the purchase transaction. This will also be applied as the default for any subscriptions included in the purchase request. maxLength: 13 shipping: type: object x-class-name: ShippingPurchase properties: address_id: type: string title: Shipping address ID description: Assign a shipping address from the account's existing shipping addresses. If this and `address` are both present, `address` will take precedence. maxLength: 13 address: "$ref": "#/components/schemas/ShippingAddressCreate" fees: type: array title: Shipping fees description: A list of shipping fees to be created as charges with the purchase. items: "$ref": "#/components/schemas/ShippingFeeCreate" line_items: type: array title: Line items description: A list of one time charges or credits to be created with the purchase. items: "$ref": "#/components/schemas/LineItemCreate" subscriptions: type: array title: Subscriptions description: A list of subscriptions to be created with the purchase. items: "$ref": "#/components/schemas/SubscriptionPurchase" coupon_codes: type: array title: Coupon codes description: A list of coupon_codes to be redeemed on the subscription or account during the purchase. items: type: string gift_card_redemption_code: type: string title: Gift card redemption code description: A gift card redemption code to be redeemed on the purchase invoice. transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" required: - currency - account DunningCampaign: type: object description: Settings for a dunning campaign. properties: id: type: string object: type: string title: Object type code: type: string description: Campaign code. name: type: string description: Campaign name. description: type: string description: Campaign description. default_campaign: type: boolean description: Whether or not this is the default campaign for accounts or plans without an assigned dunning campaign. dunning_cycles: type: array description: Dunning Cycle settings. items: "$ref": "#/components/schemas/DunningCycle" created_at: type: string format: date-time description: When the current campaign was created in Recurly. updated_at: type: string format: date-time description: When the current campaign was updated in Recurly. deleted_at: type: string format: date-time description: When the current campaign was deleted in Recurly. DunningCampaignList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/DunningCampaign" DunningCycle: type: object properties: type: "$ref": "#/components/schemas/DunningCycleTypeEnum" applies_to_manual_trial: type: boolean description: Whether the dunning settings will be applied to manual trials. Only applies to trial cycles. first_communication_interval: type: integer description: The number of days after a transaction failure before the first dunning email is sent. send_immediately_on_hard_decline: type: boolean description: Whether or not to send an extra email immediately to customers whose initial payment attempt fails with either a hard decline or invalid billing info. intervals: type: array description: Dunning intervals. items: "$ref": "#/components/schemas/DunningInterval" expire_subscription: type: boolean description: Whether the subscription(s) should be cancelled at the end of the dunning cycle. fail_invoice: type: boolean description: Whether the invoice should be failed at the end of the dunning cycle. total_dunning_days: type: integer description: The number of days between the first dunning email being sent and the end of the dunning cycle. total_recycling_days: type: integer description: The number of days between a transaction failure and the end of the dunning cycle. version: type: integer description: Current campaign version. created_at: type: string format: date-time description: When the current settings were created in Recurly. updated_at: type: string format: date-time description: When the current settings were updated in Recurly. DunningInterval: properties: days: type: integer description: Number of days before sending the next email. email_template: type: string description: Email template being used. DunningCampaignsBulkUpdate: properties: plan_codes: type: array maxItems: 200 description: List of `plan_codes` associated with the Plans for which the dunning campaign should be updated. Required unless `plan_ids` is present. items: type: string plan_ids: type: array maxItems: 200 description: List of `plan_ids` associated with the Plans for which the dunning campaign should be updated. Required unless `plan_codes` is present. items: type: string DunningCampaignsBulkUpdateResponse: properties: object: type: string title: Object type readOnly: true plans: type: array title: Plans description: An array containing all of the `Plan` resources that have been updated. maxItems: 200 items: "$ref": "#/components/schemas/Plan" Entitlements: type: object description: A list of privileges granted to a customer through the purchase of a plan or item. properties: object: type: string title: Object Type has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/Entitlement" Entitlement: type: object properties: object: type: string description: Entitlement customer_permission: "$ref": "#/components/schemas/CustomerPermission" granted_by: type: array description: Subscription or item that granted the customer permission. items: "$ref": "#/components/schemas/GrantedBy" created_at: type: string format: date-time description: Time object was created. updated_at: type: string format: date-time description: Time the object was last updated ExternalChargeCreate: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 unit_amount: type: string format: decimal quantity: type: integer description: type: string external_product_reference: "$ref": "#/components/schemas/ExternalProductReferenceCreate" required: - quantity - currency - unit_amount AccountExternalSubscription: allOf: - type: object properties: account_code: type: string description: The account code of a new or existing account to be used when creating the external subscription. maxLength: 50 required: - account_code ExternalPaymentPhase: type: object description: Details of payments in the lifecycle of a subscription from an external resource that is not managed by the Recurly platform, e.g. App Store or Google Play Store. properties: id: type: string title: External payment phase ID description: System-generated unique identifier for an external payment phase ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type started_at: type: string format: date-time title: Started At ends_at: type: string format: date-time title: Ends At starting_billing_period_index: type: integer title: Starting Billing Period Index ending_billing_period_index: type: integer title: Ending Billing Period Index offer_type: type: string title: Offer Type description: Type of discount offer given, e.g. "FREE_TRIAL" offer_name: type: string title: Offer Name description: Name of the discount offer given, e.g. "introductory" period_count: type: integer title: Period Count description: Number of billing periods period_length: type: string title: Period Length description: Billing cycle length amount: type: string format: decimal title: Amount minimum: 0 description: Allows up to 9 decimal places currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 created_at: type: string format: date-time title: Created at description: When the external subscription was created in Recurly. updated_at: type: string format: date-time title: Updated at description: When the external subscription was updated in Recurly. ExternalPaymentPhaseList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalPaymentPhase" ExternalProduct: type: object description: Product from an external resource such as Apple App Store or Google Play Store. properties: id: type: string title: External product ID. description: System-generated unique identifier for an external product ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type name: type: string title: Name description: Name to identify the external product in Recurly. plan: "$ref": "#/components/schemas/PlanMini" created_at: type: string format: date-time description: When the external product was created in Recurly. updated_at: type: string format: date-time description: When the external product was updated in Recurly. external_product_references: type: array title: External Product References description: List of external product references of the external product. items: "$ref": "#/components/schemas/ExternalProductReferenceMini" ExternalProductList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalProduct" ExternalProductCreate: type: object properties: name: type: string description: External product name. plan_id: type: string description: Recurly plan UUID. external_product_references: type: array title: External Product References description: List of external product references of the external product. items: "$ref": "#/components/schemas/ExternalProductReferenceBase" required: - name ExternalProductUpdate: type: object properties: plan_id: type: string description: Recurly plan UUID. required: - plan_id ExternalProductReferenceBase: type: object properties: reference_code: type: string description: A code which associates the external product to a corresponding object or resource in an external platform like the Apple App Store or Google Play Store. maxLength: 255 external_connection_type: "$ref": "#/components/schemas/ExternalProductReferenceConnectionType" ExternalProductReferenceCollection: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalProductReferenceMini" ExternalProductReferenceCreate: allOf: - "$ref": "#/components/schemas/ExternalProductReferenceBase" required: - reference_code - external_connection_type ExternalProductReferenceUpdate: allOf: - "$ref": "#/components/schemas/ExternalProductReferenceBase" ExternalProductReferenceConnectionType: type: string description: Represents the connection type. One of the connection types of your enabled App Connectors ExternalAccountList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalAccount" ExternalAccountCreate: type: object properties: external_account_code: type: string description: Represents the account code for the external account. external_connection_type: type: string @@ -26104,1372 +26104,1376 @@ components: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/GiftCard" GiftCard: type: object description: Gift card details properties: id: title: Gift card ID type: string maxLength: 13 readOnly: true object: title: Object type type: string readOnly: true gifter_account_id: title: Gifter account ID type: string maxLength: 13 description: The ID of the account that purchased the gift card. recipient_account_id: title: Recipient account ID type: string maxLength: 13 description: The ID of the account that redeemed the gift card redemption code. Does not have a value until gift card is redeemed. purchase_invoice_id: title: Purchase invoice ID type: string maxLength: 13 description: The ID of the invoice for the gift card purchase made by the gifter. redemption_invoice_id: title: Redemption invoice ID type: string maxLength: 13 description: The ID of the invoice for the gift card redemption made by the recipient. Does not have a value until gift card is redeemed. redemption_code: title: Redemption code type: string description: The unique redemption code for the gift card, generated by Recurly. Will be 16 characters, alphanumeric, displayed uppercase, but accepted in any case at redemption. Used by the recipient account to create a credit in the amount of the `unit_amount` on their account. balance: title: Remaining balance type: number format: float description: The remaining credit on the recipient account associated with this gift card. Only has a value once the gift card has been redeemed. Can be used to create gift card balance displays for your customers. product_code: title: Product code type: string description: The product code or SKU of the gift card product. unit_amount: title: Purchase unit amount type: number format: float description: The amount of the gift card, which is the amount of the charge to the gifter account and the amount of credit that is applied to the recipient account upon successful redemption. currency: title: Currency type: string description: 3-letter ISO 4217 currency code. maxLength: 3 delivery: title: Delivery details description: The delivery details for the gift card. readOnly: true "$ref": "#/components/schemas/GiftCardDelivery" performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true delivered_at: type: string format: date-time title: Delivered at readOnly: true description: When the gift card was sent to the recipient by Recurly via email, if method was email and the "Gift Card Delivery" email template was enabled. This will be empty for post delivery or email delivery where the email template was disabled. redeemed_at: type: string format: date-time title: Redeemed at readOnly: true description: When the gift card was redeemed by the recipient. canceled_at: type: string format: date-time title: Canceled at readOnly: true description: When the gift card was canceled. GiftCardCreate: type: object description: Gift card details properties: product_code: title: Product code type: string description: The product code or SKU of the gift card product. unit_amount: title: Purchase unit amount type: number format: float description: The amount of the gift card, which is the amount of the charge to the gifter account and the amount of credit that is applied to the recipient account upon successful redemption. currency: title: Currency type: string description: 3-letter ISO 4217 currency code. maxLength: 3 delivery: title: Delivery details description: The delivery details for the gift card. readOnly: true "$ref": "#/components/schemas/GiftCardDeliveryCreate" gifter_account: title: Gifter account details description: Block of account details for the gifter. This references an existing account_code. readOnly: true "$ref": "#/components/schemas/AccountPurchase" required: - product_code - unit_amount - currency - delivery - gifter_account GiftCardDeliveryCreate: type: object description: Gift card delivery details properties: method: title: Delivery method description: Whether the delivery method is email or postal service. "$ref": "#/components/schemas/DeliveryMethodEnum" email_address: title: Recipient email address type: string description: The email address of the recipient. Required if `method` is `email`. deliver_at: type: string format: date-time title: Deliver at readOnly: true description: When the gift card should be delivered to the recipient. If null, the gift card will be delivered immediately. If a datetime is provided, the delivery will be in an hourly window, rounding down. For example, 6:23 pm will be in the 6:00 pm hourly batch. first_name: title: Recipient first name type: string description: The first name of the recipient. last_name: title: Recipient last name type: string description: The last name of the recipient. recipient_address: title: Recipient address description: Address information for the recipient. Required if `method` is `post`. "$ref": "#/components/schemas/Address" gifter_name: title: Gifter name type: string description: The name of the gifter for the purpose of a message displayed to the recipient. personal_message: title: Personal message type: string maxLength: 255 description: The personal message from the gifter to the recipient. required: - method GiftCardDelivery: type: object description: Gift card delivery details properties: method: title: Delivery method description: Whether the delivery method is email or postal service. "$ref": "#/components/schemas/DeliveryMethodEnum" email_address: title: Recipient email address type: string description: The email address of the recipient. deliver_at: type: string format: date-time title: Deliver at readOnly: true description: When the gift card should be delivered to the recipient. If null, the gift card will be delivered immediately. If a datetime is provided, the delivery will be in an hourly window, rounding down. For example, 6:23 pm will be in the 6:00 pm hourly batch. first_name: title: Recipient first name type: string description: The first name of the recipient. last_name: title: Recipient last name type: string description: The last name of the recipient. recipient_address: title: Recipient address description: Address information for the recipient. "$ref": "#/components/schemas/Address" gifter_name: title: Gifter name type: string description: The name of the gifter for the purpose of a message displayed to the recipient. personal_message: title: Personal message type: string maxLength: 255 description: The personal message from the gifter to the recipient. GiftCardRedeem: type: object description: The information necessary to redeem a gift card. properties: recipient_account: title: Recipient account description: The account for the recipient of the gift card. "$ref": "#/components/schemas/AccountReference" required: - recipient_account Error: type: object properties: type: title: Type "$ref": "#/components/schemas/ErrorTypeEnum" message: type: string title: Message params: type: array title: Parameter specific errors items: type: object properties: param: type: string ErrorMayHaveTransaction: allOf: - "$ref": "#/components/schemas/Error" - type: object properties: transaction_error: type: object x-class-name: TransactionError title: Transaction error details description: This is only included on errors with `type=transaction`. properties: object: type: string title: Object type transaction_id: type: string title: Transaction ID maxLength: 13 category: title: Category "$ref": "#/components/schemas/ErrorCategoryEnum" code: title: Code "$ref": "#/components/schemas/ErrorCodeEnum" decline_code: title: Decline code "$ref": "#/components/schemas/DeclineCodeEnum" message: type: string title: Customer message merchant_advice: type: string title: Merchant message three_d_secure_action_token_id: type: string title: 3-D Secure action token id description: Returned when 3-D Secure authentication is required for a transaction. Pass this value to Recurly.js so it can continue the challenge flow. maxLength: 22 fraud_info: "$ref": "#/components/schemas/TransactionFraudInfo" RelatedTypeEnum: type: string enum: - account - item - plan - subscription - charge RefundTypeEnum: type: string enum: - full - none - partial AlphanumericSortEnum: type: string enum: - asc - desc UsageSortEnum: type: string default: usage_timestamp enum: - recorded_timestamp - usage_timestamp UsageTypeEnum: type: string enum: - price - percentage title: Usage Type description: Type of usage, returns usage type if `add_on_type` is `usage`. UsageCalculationTypeEnum: type: string description: The type of calculation to be employed for an add-on. Cumulative billing will sum all usage records created in the current billing cycle. Last-in-period billing will apply only the most recent usage record in the billing period. If no value is specified, cumulative billing will be used. enum: - cumulative - last_in_period BillingStatusEnum: type: string default: unbilled enum: - unbilled - billed - all TimestampSortEnum: type: string enum: - created_at - updated_at ActiveStateEnum: type: string enum: - active - inactive FilterSubscriptionStateEnum: type: string enum: - active - canceled - expired - future - in_trial - live FilterLimitedSubscriptionStateEnum: type: string enum: - active - canceled - expired - future TrueEnum: type: string enum: - true LineItemStateEnum: type: string enum: - invoiced - pending LineItemTypeEnum: type: string enum: - charge - credit FilterTransactionTypeEnum: type: string enum: - authorization - capture - payment - purchase - refund - verify FilterInvoiceTypeEnum: type: string enum: - charge - credit - legacy - non-legacy FilterRedeemedEnum: type: string enum: - true - false ChannelEnum: type: string enum: - advertising - blog - direct_traffic - email - events - marketing_content - organic_search - other - outbound_sales - paid_search - public_relations - referral - social_media PreferredLocaleEnum: type: string enum: - da-DK - de-CH - de-DE - en-AU - en-CA - en-GB - en-IE - en-NZ - en-US - es-ES - es-MX - es-US - fi-FI - fr-BE - fr-CA - fr-CH - fr-FR - hi-IN - it-IT - ja-JP - ko-KR - nl-BE - nl-NL - pl-PL - pt-BR - pt-PT - ro-RO - ru-RU - sk-SK - sv-SE - tr-TR - zh-CN BillToEnum: type: string enum: - parent - self DeliveryMethodEnum: type: string enum: - email - post PaymentGatewayReferencesEnum: type: string description: The type of reference token. Required if token is passed in for Stripe Gateway or Ebanx UPI. enum: - stripe_confirmation_token - - stripe_customer - - stripe_payment_method - upi_vpa GatewayTransactionTypeEnum: type: string enum: - moto KountDecisionEnum: type: string enum: - approve - decline - escalate - review CouponStateEnum: type: string enum: - expired - maxed_out - redeemable CouponDurationEnum: type: string enum: - forever - single_use - temporal TemporalUnitEnum: type: string enum: - day - month - week - year FreeTrialUnitEnum: type: string enum: - day - month - week RedemptionResourceEnum: type: string enum: - account - subscription CouponTypeEnum: type: string enum: - bulk - single_code DiscountTypeEnum: type: string enum: - fixed - free_trial - percent AddOnSourceEnum: type: string title: Add-on source description: | Used to determine where the associated add-on data is pulled from. If this value is set to `plan_add_on` or left blank, then add-on data will be pulled from the plan's add-ons. If the associated `plan` has `allow_any_item_on_subscriptions` set to `true` and this field is set to `item`, then the associated add-on data will be pulled from the site's item catalog. default: plan_add_on enum: - plan_add_on - item AddOnTypeEnum: type: string enum: - fixed - usage title: Add-on Type description: Whether the add-on type is fixed, or usage-based. AddOnTypeCreateEnum: type: string enum: - fixed - usage title: Add-on Type description: Whether the add-on type is fixed, or usage-based. default: fixed UsageTypeCreateEnum: type: string enum: - price - percentage title: Usage Type description: | Type of usage, required if `add_on_type` is `usage`. See our [Guide](https://recurly.com/developers/guides/usage-based-billing-guide.html) for an overview of how to configure usage add-ons. TierTypeEnum: type: string title: Tier type description: | The pricing model for the add-on. For more information, [click here](https://docs.recurly.com/docs/billing-models#section-quantity-based). See our [Guide](https://recurly.com/developers/guides/item-addon-guide.html) for an overview of how to configure quantity-based pricing models. default: flat enum: - flat - tiered - stairstep - volume UsageTimeframeEnum: type: string title: Usage Timeframe description: The time at which usage totals are reset for billing purposes. enum: - billing_period - subscription_term default: billing_period UsageTimeframeCreateEnum: type: string title: Usage Timeframe description: | The time at which usage totals are reset for billing purposes. Allows for `tiered` add-ons to accumulate usage over the course of multiple billing periods. enum: - billing_period - subscription_term default: billing_period CreditPaymentActionEnum: type: string enum: - payment - reduction - refund - write_off UserAccessEnum: type: string enum: - api_only - read_only - write - set_only PricingModelTypeEnum: type: string enum: - fixed - ramp default: fixed description: | A fixed pricing model has the same price for each billing period. A ramp pricing model defines a set of Ramp Intervals, where a subscription changes price on a specified cadence of billing periods. The price change could be an increase or decrease. RevenueScheduleTypeEnum: type: string enum: - at_range_end - at_range_start - evenly - never NetTermsTypeEnum: type: string title: Net Terms Type description: | Optionally supplied string that may be either `net` or `eom` (end-of-month). When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date. When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month. enum: - net - eom default: net InvoiceTypeEnum: type: string enum: - charge - credit - legacy OriginEnum: type: string enum: - carryforward_credit - carryforward_gift_credit - credit - external_refund - gift_card - immediate_change - import - line_item_refund - open_amount_refund - prepayment - purchase - refund - renewal - termination - usage_correction - write_off InvoiceStateEnum: type: string default: all enum: - open - pending - processing - past_due - paid - closed - failed - voided InvoiceStateQueryParamEnum: type: string default: all enum: - pending - past_due - paid - failed CollectionMethodEnum: type: string enum: - automatic - manual InvoiceRefundTypeEnum: type: string enum: - amount - percentage - line_items RefundMethodEnum: type: string enum: - all_credit - all_transaction - credit_first - transaction_first ExternalPaymentMethodEnum: type: string enum: - bacs - ach - amazon - apple_pay - braintree_apple_pay - check - credit_card - eft - google_pay - money_order - other - paypal - roku - sepadirectdebit - wire_transfer LineItemRevenueScheduleTypeEnum: type: string enum: - at_invoice - at_range_end - at_range_start - evenly - never LegacyCategoryEnum: type: string enum: - applied_credit - carryforward - charge - credit LineItemOriginEnum: type: string enum: - add_on - add_on_trial - carryforward - coupon - credit - debit - one_time - plan - plan_trial - setup_fee - prepayment FullCreditReasonCodeEnum: type: string enum: - general - gift_card - promotional - refund - service - write_off PartialCreditReasonCodeEnum: type: string enum: - general - promotional - service LineItemCreateOriginEnum: type: string enum: - external_gift_card - prepayment IntervalUnitEnum: type: string enum: - days - months AddressRequirementEnum: type: string enum: - full - none - streetzip - zip SiteModeEnum: type: string enum: - development - production - sandbox FeaturesEnum: type: string enum: - credit_memos - manual_invoicing - only_bill_what_changed - subscription_terms SubscriptionStateEnum: type: string enum: - active - canceled - expired - failed - future - paused TimeframeEnum: type: string enum: - bill_date - term_end ChangeTimeframeEnum: type: string enum: - bill_date - now - renewal - term_end TransactionTypeEnum: type: string enum: - authorization - capture - purchase - refund - verify TransactionOriginEnum: type: string enum: - api - chargeback - external_recovery - force_collect - hpp - merchant - recurly_admin - recurlyjs - recurring - refunded_externally - transparent + - token_api + - api_force_collect + - api_sub_change + - api_verify_card + - refund_balance + - amazon_v2_ipn TransactionStatusEnum: type: string enum: - chargeback - declined - error - pending - processing - scheduled - success - void CvvCheckEnum: type: string enum: - D - I - M - N - P - S - U - X AvsCheckEnum: type: string enum: - A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z CouponCodeStateEnum: type: string enum: - expired - inactive - maxed_out - redeemable PaymentMethodEnum: type: string enum: - bacs - amazon - amazon_billing_agreement - apple_pay - bank_account_info - braintree_apple_pay - check - credit_card - eft - gateway_token - google_pay - iban_bank_account - money_order - other - paypal - paypal_billing_agreement - roku - sepadirectdebit - venmo - wire_transfer - braintree_v_zero - boleto - cash_app - upi_autopay CardTypeEnum: type: string enum: - American Express - Dankort - Diners Club - Discover - ELO - Forbrugsforeningen - Hipercard - JCB - Laser - Maestro - MasterCard - Test Card - Union Pay - Unknown - Visa - Tarjeta Naranja CardNetworkEnum: type: string enum: - Bancontact - CartesBancaires - Dankort - MasterCard - Visa CardFundingSourceEnum: type: string enum: - credit - debit - charge - prepaid - deferred_debit AccountTypeEnum: type: string enum: - checking - savings ErrorTypeEnum: type: string enum: - bad_request - immutable_subscription - internal_server_error - invalid_api_key - invalid_api_version - invalid_content_type - invalid_permissions - invalid_token - missing_feature - not_found - rate_limited - service_not_available - simultaneous_request - tax_service_error - transaction - unauthorized - unavailable_in_api_version - unknown_api_version - validation ErrorCategoryEnum: type: string enum: - three_d_secure_required - three_d_secure_action_required - amazon - api_error - approved - communication - configuration - duplicate - fraud - hard - invalid - not_enabled - not_supported - recurly - referral - skles - soft - unknown ErrorCodeEnum: type: string enum: - ach_cancel - ach_chargeback - ach_credit_return - ach_exception - ach_return - ach_transactions_not_supported - ach_validation_exception - amazon_amount_exceeded - amazon_declined_review - amazon_invalid_authorization_status - amazon_invalid_close_attempt - amazon_invalid_create_order_reference - amazon_invalid_order_status - amazon_not_authorized - amazon_order_not_modifiable - amazon_transaction_count_exceeded - api_error - approved - approved_fraud_review - authorization_already_captured - authorization_amount_depleted - authorization_expired - batch_processing_error - billing_agreement_already_accepted - billing_agreement_not_accepted - billing_agreement_not_found - billing_agreement_replaced - call_issuer - call_issuer_update_cardholder_data - cancelled - cannot_refund_unsettled_transactions - card_not_activated - card_type_not_accepted - cardholder_requested_stop - contact_gateway - contract_not_found - currency_not_supported - customer_canceled_transaction - cvv_required - declined - declined_card_number - declined_exception - declined_expiration_date - declined_missing_data - declined_saveable - declined_security_code - deposit_referenced_chargeback - direct_debit_type_not_accepted - duplicate_transaction - exceeds_daily_limit - exceeds_max_amount - expired_card - finbot_disconnect - finbot_unavailable - fraud_address - fraud_address_recurly - fraud_advanced_verification - fraud_gateway - fraud_generic - fraud_ip_address - fraud_manual_decision - fraud_risk_check - fraud_security_code - fraud_stolen_card - fraud_too_many_attempts - fraud_velocity - gateway_account_setup_incomplete - gateway_error - gateway_rate_limited - gateway_timeout - gateway_token_not_found - gateway_unavailable - gateway_validation_exception - insufficient_funds - invalid_account_number - invalid_amount - invalid_billing_agreement_status - invalid_card_number - invalid_data - invalid_email - invalid_gateway_access_token - invalid_gateway_configuration - invalid_issuer - invalid_login - invalid_merchant_type - invalid_name - invalid_payment_method - invalid_payment_method_hard - invalid_transaction - issuer_unavailable - lifecycle_decline - merch_max_transaction_limit_exceeded - moneybot_disconnect - moneybot_unavailable - no_billing_information - no_gateway - no_gateway_found_for_transaction_amount - partial_approval - partial_credits_not_supported - payer_authentication_rejected - payment_cannot_void_authorization - payment_not_accepted - paypal_account_issue - paypal_cannot_pay_self - paypal_declined_use_alternate - paypal_expired_reference_id - paypal_hard_decline - paypal_invalid_billing_agreement - paypal_primary_declined - processor_not_available - processor_unavailable - recurly_credentials_not_found - recurly_error - recurly_failed_to_get_token - recurly_token_mismatch - recurly_token_not_found - reference_transactions_not_enabled - restricted_card - restricted_card_chargeback - rjs_token_expired - roku_invalid_card_number - roku_invalid_cib - roku_invalid_payment_method - roku_zip_code_mismatch - simultaneous - ssl_error - temporary_hold - three_d_secure_action_required - three_d_secure_action_result_token_mismatch - three_d_secure_authentication - three_d_secure_connection_error - three_d_secure_credential_error - three_d_secure_not_supported - too_busy - too_many_attempts - total_credit_exceeds_capture - transaction_already_refunded - transaction_already_voided - transaction_cannot_be_authorized - transaction_cannot_be_refunded - transaction_cannot_be_refunded_currently - transaction_cannot_be_voided - transaction_failed_to_settle - transaction_not_found - transaction_service_v2_disconnect - transaction_service_v2_unavailable - transaction_settled - transaction_stale_at_gateway - try_again - unknown - unmapped_partner_error - vaultly_service_unavailable - zero_dollar_auth_not_supported DeclineCodeEnum: type: string enum: - account_closed - call_issuer - card_not_activated - card_not_supported - cardholder_requested_stop - do_not_honor - do_not_try_again - exceeds_daily_limit - generic_decline - expired_card - fraudulent - insufficient_funds - incorrect_address - incorrect_security_code - invalid_amount - invalid_number - invalid_transaction - issuer_unavailable - lifecycle_decline - lost_card - pickup_card - policy_decline - restricted_card - restricted_card_chargeback - security_decline - stolen_card - try_again - update_cardholder_data - requires_3d_secure ExportDates: type: object properties: object: type: string title: Object type readOnly: true dates: type: array items: type: string title: An array of dates that have available exports. ExportFiles: type: object properties: object: type: string title: Object type readOnly: true files: type: array items: "$ref": "#/components/schemas/ExportFile" ExportFile: type: object properties: name: type: string title: Filename description: Name of the export file. md5sum: type: string title: MD5 hash of the export file description: MD5 hash of the export file. href: type: string title: A link to the export file description: A presigned link to download the export file. TaxIdentifierTypeEnum: type: string enum: - cpf - cnpj - cuit DunningCycleTypeEnum: type: string description: The type of invoice this cycle applies to. enum: - automatic - manual - trial AchTypeEnum: type: string description: The payment method type for a non-credit card based billing info. `bacs` and `becs` are the only accepted values. enum: - bacs - becs AchAccountTypeEnum: type: string description: The bank account type. (ACH only) enum: - checking - savings ExternalHppTypeEnum: type: string description: Use for Adyen HPP billing info. This should only be used as part of a pending purchase request, when the billing info is nested inside an account object. enum: - adyen OnlineBankingPaymentTypeEnum: type: string description: Use for Online Banking billing info. This should only be used as part of a pending purchase request, when the billing info is nested inside an account object. enum: - ideal - sofort ExternalInvoiceStateEnum: type: string enum: - paid GeneralLedgerAccountTypeEnum: type: string enum: - liability - revenue OriginTaxAddressSourceEnum: type: string title: Origin tax address source description: The source of the address that will be used as the origin in determining taxes. Available only when the site is on an Elite plan. A value of "origin" refers to the "Business entity tax address". A value of "destination" refers to the "Customer tax address". default: origin enum: - origin - destination DestinationTaxAddressSourceEnum: type: string title: Destination tax address source description: The source of the address that will be used as the destinaion in determining taxes. Available only when the site is on an Elite plan. A value of "destination" refers to the "Customer tax address". A value of "origin" refers to the "Business entity tax address". default: destination enum: - destination - origin TransactionMerchantReasonCodeEnum: type: string default: none description: | This conditional parameter is useful for merchants in specific industries who need to submit one-time Merchant Initiated transactions in specific cases. Not all gateways support these methods, but will support a generic one-time Merchant Initiated transaction. Only use this if the initiator value is "merchant". Otherwise, it will be ignored. - Incremental: Send `incremental` with an additional purchase if the original authorization amount is not sufficient to cover the costs of your service or product. For example, if the customer adds goods or services or there are additional expenses. - No Show: Send `no_show` if you charge customers a fee due to an agreed-upon cancellation policy in your industry. - Resubmission: Send `resubmission` if you need to attempt collection on a declined transaction. You may also use the force collection behavior which has the same effect. - Service Extension: Send `service_extension` if you are in a service industry and the customer has increased/extended their service in some way. For example: adding a day onto a car rental agreement. - Split Shipment: Send `split_shipment` if you sell physical product and need to split up a shipment into multiple transactions when the customer is no longer in session. - Top Up: Send `top_up` if you process one-time transactions based on a pre-arranged agreement with your customer where there is a pre-arranged account balance that needs maintaining. For example, if the customer has agreed to maintain an account balance of 30.00 and their current balance is 20.00, the MIT amount would be at least 10.00 to meet that 30.00 threshold. enum: - incremental - no_show - resubmission - service_extension - split_shipment - top_up - TransactionIndicatorEnum: + TransactionInitiatorEnum: type: string description: Must be sent for one-time transactions in order to provide context on which entity is submitting the transaction to ensure proper fraud checks are observed, such as 3DS. If the customer is in session, send `customer`. If this is a merchant initiated one-time transaction, send `merchant`. enum: - customer - merchant
recurly/recurly-client-php
2cce5c959d5389d0c29f03f71300fdcaf5146cbd
4.60.0
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index b0062f9..08504db 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 4.59.0 +current_version = 4.60.0 parse = (?P<major>\d+) \.(?P<minor>\d+) \.(?P<patch>\d+) serialize = {major}.{minor}.{patch} [bumpversion:file:composer.json] [bumpversion:file:lib/recurly/version.php] diff --git a/CHANGELOG.md b/CHANGELOG.md index 22fd129..9d86c20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,514 +1,525 @@ # Changelog +## [4.60.0](https://github.com/recurly/recurly-client-php/tree/4.60.0) (2025-04-16) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.59.0...4.60.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 [#839](https://github.com/recurly/recurly-client-php/pull/839) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.59.0](https://github.com/recurly/recurly-client-php/tree/4.59.0) (2025-04-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.58.0...4.59.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25: Create External Invoices [#838](https://github.com/recurly/recurly-client-php/pull/838) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#836](https://github.com/recurly/recurly-client-php/pull/836) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.58.0](https://github.com/recurly/recurly-client-php/tree/4.58.0) (2025-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.57.0...4.58.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#835](https://github.com/recurly/recurly-client-php/pull/835) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.57.0](https://github.com/recurly/recurly-client-php/tree/4.57.0) (2025-02-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.56.0...4.57.0) **Merged Pull Requests** - Add `funding_source` to `BillingInfo` and `Transaction` [#834](https://github.com/recurly/recurly-client-php/pull/834) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#831](https://github.com/recurly/recurly-client-php/pull/831) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.56.0](https://github.com/recurly/recurly-client-php/tree/4.56.0) (2024-12-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.55.0...4.56.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#830](https://github.com/recurly/recurly-client-php/pull/830) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.55.0](https://github.com/recurly/recurly-client-php/tree/4.55.0) (2024-12-02) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.54.0...4.55.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#829](https://github.com/recurly/recurly-client-php/pull/829) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#826](https://github.com/recurly/recurly-client-php/pull/826) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.54.0](https://github.com/recurly/recurly-client-php/tree/4.54.0) (2024-08-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.53.0...4.54.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (add UUID to external subscriptions) [#823](https://github.com/recurly/recurly-client-php/pull/823) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.53.0](https://github.com/recurly/recurly-client-php/tree/4.53.0) (2024-08-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.52.0...4.53.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#821](https://github.com/recurly/recurly-client-php/pull/821) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.52.0](https://github.com/recurly/recurly-client-php/tree/4.52.0) (2024-07-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.51.0...4.52.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Taxable Address Control, RevRec) [#817](https://github.com/recurly/recurly-client-php/pull/817) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.51.0](https://github.com/recurly/recurly-client-php/tree/4.51.0) (2024-05-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.50.0...4.51.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#814](https://github.com/recurly/recurly-client-php/pull/814) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.50.0](https://github.com/recurly/recurly-client-php/tree/4.50.0) (2024-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.49.0...4.50.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entity Use Code) [#812](https://github.com/recurly/recurly-client-php/pull/812) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.49.0](https://github.com/recurly/recurly-client-php/tree/4.49.0) (2024-05-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.48.0...4.49.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Proration Settings) [#810](https://github.com/recurly/recurly-client-php/pull/810) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.48.0](https://github.com/recurly/recurly-client-php/tree/4.48.0) (2024-05-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.47.0...4.48.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Auth & Capture) [#808](https://github.com/recurly/recurly-client-php/pull/808) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.47.0](https://github.com/recurly/recurly-client-php/tree/4.47.0) (2024-03-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.46.0...4.47.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#803](https://github.com/recurly/recurly-client-php/pull/803) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.46.0](https://github.com/recurly/recurly-client-php/tree/4.46.0) (2024-02-20) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.45.0...4.46.0) **Merged Pull Requests** - Add invoice state param for v2021-02-25 [#799](https://github.com/recurly/recurly-client-php/pull/799) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.45.0](https://github.com/recurly/recurly-client-php/tree/4.45.0) (2024-01-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.44.0...4.45.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#789](https://github.com/recurly/recurly-client-php/pull/789) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.44.0](https://github.com/recurly/recurly-client-php/tree/4.44.0) (2024-01-18) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.43.0...4.44.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#788](https://github.com/recurly/recurly-client-php/pull/788) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.43.0](https://github.com/recurly/recurly-client-php/tree/4.43.0) (2023-12-06) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.42.0...4.43.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Payment Phases) [#785](https://github.com/recurly/recurly-client-php/pull/785) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.42.0](https://github.com/recurly/recurly-client-php/tree/4.42.0) (2023-11-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.41.0...4.42.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#783](https://github.com/recurly/recurly-client-php/pull/783) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.41.0](https://github.com/recurly/recurly-client-php/tree/4.41.0) (2023-08-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.40.0...4.41.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (`VATNumber`, `LifecycleDecline`) [#782](https://github.com/recurly/recurly-client-php/pull/782) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.40.0](https://github.com/recurly/recurly-client-php/tree/4.40.0) (2023-08-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.39.0...4.40.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (action_result) [#781](https://github.com/recurly/recurly-client-php/pull/781) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.39.0](https://github.com/recurly/recurly-client-php/tree/4.39.0) (2023-07-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.37.0...4.39.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Ramp Dates, Net Terms, Invoice Business Entity) [#779](https://github.com/recurly/recurly-client-php/pull/779) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (App Management - External Subscriptions) [#777](https://github.com/recurly/recurly-client-php/pull/777) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.37.0](https://github.com/recurly/recurly-client-php/tree/4.37.0) (2023-06-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.36.0...4.37.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Multiple Business Entities) [#769](https://github.com/recurly/recurly-client-php/pull/769) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.36.0](https://github.com/recurly/recurly-client-php/tree/4.36.0) (2023-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.35.0...4.36.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Products & References) [#766](https://github.com/recurly/recurly-client-php/pull/766) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.35.0](https://github.com/recurly/recurly-client-php/tree/4.35.0) (2023-05-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.34.0...4.35.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (gateway_attributes on PaymentMethod) [#764](https://github.com/recurly/recurly-client-php/pull/764) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#747](https://github.com/recurly/recurly-client-php/pull/747) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.28.0](https://github.com/recurly/recurly-client-php/tree/4.28.0) (2023-02-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.27.0...4.28.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (GiftCard endpoints and new transaction error support) [#745](https://github.com/recurly/recurly-client-php/pull/745) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.27.0](https://github.com/recurly/recurly-client-php/tree/4.27.0) (2023-01-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.26.0...4.27.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Custom Fields on Line Items) [#738](https://github.com/recurly/recurly-client-php/pull/738) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.26.0](https://github.com/recurly/recurly-client-php/tree/4.26.0) (2023-01-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.25.0...4.26.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Account Preferred Time Zone) [#736](https://github.com/recurly/recurly-client-php/pull/736) ([douglasmiller](https://github.com/douglasmiller)) ## [4.25.0](https://github.com/recurly/recurly-client-php/tree/4.25.0) (2022-11-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.24.0...4.25.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Apply Credit Balance feature) [#732](https://github.com/recurly/recurly-client-php/pull/732) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.24.0](https://github.com/recurly/recurly-client-php/tree/4.24.0) (2022-11-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.23.0...4.24.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Subscriptions feature) [#729](https://github.com/recurly/recurly-client-php/pull/729) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#728](https://github.com/recurly/recurly-client-php/pull/728) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.23.0](https://github.com/recurly/recurly-client-php/tree/4.23.0) (2022-10-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.22.0...4.23.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entitlements feature) [#725](https://github.com/recurly/recurly-client-php/pull/725) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.22.0](https://github.com/recurly/recurly-client-php/tree/4.22.0) (2022-10-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.2...4.22.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25(Decimal Usage and Quantities and DunningEvent new fields) [#722](https://github.com/recurly/recurly-client-php/pull/722) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.2](https://github.com/recurly/recurly-client-php/tree/4.21.2) (2022-09-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.1...4.21.2) **Merged Pull Requests** - feat: allow for psr/log ^2/3 [#716](https://github.com/recurly/recurly-client-php/pull/716) ([trickeyone](https://github.com/trickeyone)) ## [4.21.1](https://github.com/recurly/recurly-client-php/tree/4.21.1) (2022-09-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.0...4.21.1) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#714](https://github.com/recurly/recurly-client-php/pull/714) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.0](https://github.com/recurly/recurly-client-php/tree/4.21.0) (2022-09-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.20.0...4.21.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#713](https://github.com/recurly/recurly-client-php/pull/713) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixes bug with putDunningCampaignBulkUpdate [#706](https://github.com/recurly/recurly-client-php/pull/706) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.20.0](https://github.com/recurly/recurly-client-php/tree/4.20.0) (2022-08-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.19.0...4.20.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#701](https://github.com/recurly/recurly-client-php/pull/701) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.19.0](https://github.com/recurly/recurly-client-php/tree/4.19.0) (2022-07-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.18.0...4.19.0) **Merged Pull Requests** - Fixing deprecation warnings in client [#697](https://github.com/recurly/recurly-client-php/pull/697) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#695](https://github.com/recurly/recurly-client-php/pull/695) ([recurly-integrations](https://github.com/recurly-integrations)) **Closed Issues** - Recurly\Pager and \Iterator return type mismatch (PHP 8.1 deprecation) [#677](https://github.com/recurly/recurly-client-php/issues/677) ## [4.18.0](https://github.com/recurly/recurly-client-php/tree/4.18.0) (2022-06-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.17.0...4.18.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#693](https://github.com/recurly/recurly-client-php/pull/693) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.17.0](https://github.com/recurly/recurly-client-php/tree/4.17.0) (2022-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.16.0...4.17.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#679](https://github.com/recurly/recurly-client-php/pull/679) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.16.0](https://github.com/recurly/recurly-client-php/tree/4.16.0) (2022-03-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.15.0...4.16.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#676](https://github.com/recurly/recurly-client-php/pull/676) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.15.0](https://github.com/recurly/recurly-client-php/tree/4.15.0) (2022-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.14.0...4.15.0) **Merged Pull Requests** diff --git a/composer.json b/composer.json index 42c23dc..0002e25 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,38 @@ { "name": "recurly/recurly-client", - "version": "4.59.0", + "version": "4.60.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], "homepage": "https://github.com/recurly/recurly-client-php", "license": "MIT", "authors": [], "require": { "php": ">= 7.2.0", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "phpcompatibility/php-compatibility": "^9.3", "phpdocumentor/phpdocumentor": "~3.0.0", "phpstan/phpstan": "^0.12.11", "phpunit/phpunit": "^8", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "classmap": ["lib"], "files": ["lib/recurly.php"] }, "autoload-dev": { "classmap": ["tests"] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/lib/recurly/version.php b/lib/recurly/version.php index 04550d5..9371739 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -1,8 +1,8 @@ <?php namespace Recurly; class Version { - public const CURRENT = '4.59.0'; + public const CURRENT = '4.60.0'; }
recurly/recurly-client-php
7d2f5efcd86805379fd20d11df301fbf374c5a6f
Generated Latest Changes for v2021-02-25
diff --git a/openapi/api.yaml b/openapi/api.yaml index 2b48470..0e1b62a 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -23219,1198 +23219,1200 @@ components: When an id is provided, the existing subscription add-on attributes will persist unless overridden in the request. maxLength: 13 code: type: string title: Add-on code maxLength: 50 description: | If a code is provided without an id, the subscription add-on attributes will be set to the current value for those attributes on the plan add-on unless provided in the request. If `add_on_source` is set to `plan_add_on` or left blank, then plan's add-on `code` should be used. If `add_on_source` is set to `item`, then the `code` from the associated item should be used. add_on_source: "$ref": "#/components/schemas/AddOnSourceEnum" quantity: type: integer title: Quantity minimum: 0 unit_amount: type: number format: float title: Unit amount description: | Allows up to 2 decimal places. Optionally, override the add-on's default unit amount. If the plan add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `unit_amount` cannot be provided. minimum: 0 maximum: 1000000 unit_amount_decimal: type: string title: Unit amount decimal description: | Allows up to 9 decimal places. Optionally, override the add-on's default unit amount. If the plan add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `unit_amount_decimal` cannot be provided. Only supported when the plan add-on's `add_on_type` = `usage`. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided. tiers: type: array title: Tiers items: "$ref": "#/components/schemas/SubscriptionAddOnTier" minItems: 1 description: | If the plan add-on's `tier_type` is `flat`, then `tiers` must be absent. The `tiers` object must include one to many tiers with `ending_quantity` and `unit_amount`. There must be one tier without an `ending_quantity` value which represents the final tier. percentage_tiers: type: array title: Percentage Tiers items: "$ref": "#/components/schemas/SubscriptionAddOnPercentageTier" minItems: 1 description: | If percentage tiers are provided in the request, all existing percentage tiers on the Subscription Add-on will be removed and replaced by the percentage tiers in the request. Use only if add_on.tier_type is tiered or volume and add_on.usage_type is percentage. There must be one tier without an `ending_amount` value which represents the final tier. This feature is currently in development and requires approval and enablement, please contact support. usage_percentage: type: number format: float title: Usage Percentage description: The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. Required if add_on_type is usage and usage_type is percentage. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" SubscriptionAddOnTier: type: object properties: ending_quantity: type: integer title: Ending quantity minimum: 1 maximum: 999999999 description: Ending quantity for the tier. This represents a unit amount for unit-priced add ons. Must be left empty if it is the final tier. unit_amount: type: number format: float title: Unit amount minimum: 0 maximum: 1000000 description: Allows up to 2 decimal places. Optionally, override the tiers' default unit amount. If add-on's `add_on_type` is `usage` and `usage_type` is `percentage`, cannot be provided. unit_amount_decimal: type: string title: Unit amount decimal description: | Allows up to 9 decimal places. Optionally, override tiers' default unit amount. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided. If add-on's `add_on_type` is `usage` and `usage_type` is `percentage`, cannot be provided. usage_percentage: type: string title: Usage Percentage description: "(deprecated) -- Use the percentage_tiers object instead." deprecated: true SubscriptionAddOnPercentageTier: type: object properties: ending_amount: type: number format: float title: Ending amount minimum: 1 maximum: 9999999999999.99 description: Ending amount for the tier. Allows up to 2 decimal places. Must be left empty if it is the final tier. usage_percentage: type: string title: Usage Percentage minimum: 0 maximum: 100 description: | The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places represented as a string. SubscriptionCancel: type: object properties: timeframe: title: Timeframe description: The timeframe parameter controls when the expiration takes place. The `bill_date` timeframe causes the subscription to expire when the subscription is scheduled to bill next. The `term_end` timeframe causes the subscription to continue to bill until the end of the subscription term, then expire. default: term_end "$ref": "#/components/schemas/TimeframeEnum" SubscriptionChange: type: object title: Subscription Change properties: id: type: string title: Subscription Change ID description: The ID of the Subscription Change. object: type: string title: Object type subscription_id: type: string title: Subscription ID description: The ID of the subscription that is going to be changed. maxLength: 13 plan: "$ref": "#/components/schemas/PlanMini" add_ons: type: array title: Add-ons description: These add-ons will be used when the subscription renews. items: "$ref": "#/components/schemas/SubscriptionAddOn" unit_amount: type: number format: float title: Unit amount tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true quantity: type: integer title: Subscription quantity shipping: "$ref": "#/components/schemas/SubscriptionShipping" activate_at: type: string format: date-time title: Activated at readOnly: true activated: type: boolean title: Activated? description: Returns `true` if the subscription change is activated. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" invoice_collection: title: Invoice Collection "$ref": "#/components/schemas/InvoiceCollection" business_entity: title: Business Entity "$ref": "#/components/schemas/BusinessEntityMini" custom_fields: "$ref": "#/components/schemas/CustomFields" created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at readOnly: true billing_info: "$ref": "#/components/schemas/SubscriptionChangeBillingInfo" ramp_intervals: type: array title: Ramp Intervals description: The ramp intervals representing the pricing schedule for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampIntervalResponse" SubscriptionChangeBillingInfo: type: object description: Accept nested attributes for three_d_secure_action_result_token_id properties: three_d_secure_action_result_token_id: type: string title: 3-D Secure action result token ID description: A token generated by Recurly.js after completing a 3-D Secure device fingerprinting or authentication challenge. maxLength: 22 SubscriptionChangeBillingInfoCreate: allOf: - "$ref": "#/components/schemas/SubscriptionChangeBillingInfo" SubscriptionChangeCreate: type: object properties: timeframe: title: Timeframe description: The timeframe parameter controls when the upgrade or downgrade takes place. The subscription change can occur now, when the subscription is next billed, or when the subscription term ends. Generally, if you're performing an upgrade, you will want the change to occur immediately (now). If you're performing a downgrade, you should set the timeframe to `term_end` or `bill_date` so the change takes effect at a scheduled billing date. The `renewal` timeframe option is accepted as an alias for `term_end`. default: now "$ref": "#/components/schemas/ChangeTimeframeEnum" plan_id: type: string title: Plan ID maxLength: 13 description: If you want to change to a new plan, you can provide the plan's code or id. If both are provided the `plan_id` will be used. plan_code: type: string title: New plan code maxLength: 50 description: If you want to change to a new plan, you can provide the plan's code or id. If both are provided the `plan_id` will be used. business_entity_id: type: string title: Business Entity ID description: The `business_entity_id` is the value that represents a specific business entity for an end customer. When `business_entity_id` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. Only allowed if the `timeframe` is not `now`. business_entity_code: type: string title: Business Entity Code description: The `business_entity_code` is the value that represents a specific business entity for an end customer. When `business_entity_code` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. Only allowed if the `timeframe` is not `now`. unit_amount: type: number format: float title: Custom subscription price description: Optionally, sets custom pricing for the subscription, overriding the plan's default unit amount. The subscription's current currency will be used. minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true quantity: type: integer title: Quantity description: Optionally override the default quantity of 1. default: 1 minimum: 0 shipping: "$ref": "#/components/schemas/SubscriptionChangeShippingCreate" coupon_codes: type: array title: Coupon codes description: A list of coupon_codes to be redeemed on the subscription during the change. Only allowed if timeframe is now and you change something about the subscription that creates an invoice. items: type: string add_ons: type: array title: Add-ons description: | If you provide a value for this field it will replace any existing add-ons. So, when adding or modifying an add-on, you need to include the existing subscription add-ons. Unchanged add-ons can be included just using the subscription add-on''s ID: `{"id": "abc123"}`. If this value is omitted your existing add-ons will be unaffected. To remove all existing add-ons, this value should be an empty array.' If a subscription add-on's `code` is supplied without the `id`, `{"code": "def456"}`, the subscription add-on attributes will be set to the current values of the plan add-on unless provided in the request. - If an `id` is passed, any attributes not passed in will pull from the existing subscription add-on - If a `code` is passed, any attributes not passed in will pull from the current values of the plan add-on - Attributes passed in as part of the request will override either of the above scenarios items: "$ref": "#/components/schemas/SubscriptionAddOnUpdate" collection_method: title: Collection method default: automatic "$ref": "#/components/schemas/CollectionMethodEnum" revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" custom_fields: "$ref": "#/components/schemas/CustomFields" po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Net terms description: |- Integer normally paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. During a subscription change, it's not necessary to provide both the `Net Terms Type` and `Net Terms` parameters. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" billing_info: "$ref": "#/components/schemas/SubscriptionChangeBillingInfoCreate" ramp_intervals: type: array title: Ramp Intervals description: The new set of ramp intervals for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampInterval" proration_settings: "$ref": "#/components/schemas/ProrationSettings" SubscriptionChangeShippingCreate: type: object title: Shipping details that will be changed on a subscription description: Shipping addresses are tied to a customer's account. Each account can have up to 20 different shipping addresses, and if you have enabled multiple subscriptions per account, you can associate different shipping addresses to each subscription. properties: method_id: type: string title: Method ID description: The id of the shipping method used to deliver the subscription. To remove shipping set this to `null` and the `amount=0`. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 13 method_code: type: string title: Method Code description: The code of the shipping method used to deliver the subscription. To remove shipping set this to `null` and the `amount=0`. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 50 amount: type: number format: float title: Assigns the subscription's shipping cost. If this is greater than zero then a `method_id` or `method_code` is required. address_id: type: string title: Shipping address ID description: Assign a shipping address from the account's existing shipping addresses. If this and address are both present, address will take precedence. address: "$ref": "#/components/schemas/ShippingAddressCreate" SubscriptionCreate: type: object properties: plan_code: type: string title: Plan code maxLength: 50 description: You must provide either a `plan_code` or `plan_id`. If both are provided the `plan_id` will be used. plan_id: type: string title: Plan ID maxLength: 13 description: You must provide either a `plan_code` or `plan_id`. If both are provided the `plan_id` will be used. business_entity_id: type: string title: Business Entity ID description: The `business_entity_id` is the value that represents a specific business entity for an end customer. When `business_entity_id` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. business_entity_code: type: string title: Business Entity Code description: The `business_entity_code` is the value that represents a specific business entity for an end customer. When `business_entity_code` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. account: "$ref": "#/components/schemas/AccountCreate" billing_info_id: type: string title: Billing Info ID description: The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. shipping: title: Shipping address description: Create a shipping address on the account and assign it to the subscription. "$ref": "#/components/schemas/SubscriptionShippingCreate" collection_method: title: Collection method default: automatic "$ref": "#/components/schemas/CollectionMethodEnum" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 unit_amount: type: number format: float title: Custom subscription pricing description: Override the unit amount of the subscription plan by setting this value. If not provided, the subscription will inherit the price from the subscription plan for the provided currency. minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to use this flag. quantity: type: integer title: Quantity description: Optionally override the default quantity of 1. default: 1 minimum: 0 add_ons: type: array title: Add-ons items: "$ref": "#/components/schemas/SubscriptionAddOnCreate" coupon_codes: type: array title: Coupon codes description: A list of coupon_codes to be redeemed on the subscription or account during the purchase. items: type: string custom_fields: "$ref": "#/components/schemas/CustomFields" trial_ends_at: type: string format: date-time title: Trial ends at description: If set, overrides the default trial behavior for the subscription. When the current date time or a past date time is provided the subscription will begin with no trial phase (overriding any plan default trial). When a future date time is provided the subscription will begin with a trial phase ending at the specified date time. starts_at: type: string format: date-time title: Start date description: If set, the subscription will begin on this specified date. The subscription will apply the setup fee and trial period, unless the - plan has no trial. + plan has no trial. Omit this field if the subscription should be started + immediately. next_bill_date: type: string format: date-time title: Next bill date description: If present, this sets the date the subscription's next billing period will start (`current_period_ends_at`). This can be used to align the subscription’s billing to a specific day of the month. The initial invoice will be prorated for the period between the subscription's activation date and the billing period end date. Subsequent periods will be based off the plan interval. For a subscription with a trial period, this will change when the trial expires. total_billing_cycles: type: integer title: Total billing cycles description: The number of cycles/billing periods in a term. When `remaining_billing_cycles=0`, if `auto_renew=true` the subscription will renew and a new term will begin, otherwise the subscription will expire. minimum: 1 renewal_billing_cycles: type: integer title: Renewal billing cycles description: If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. auto_renew: type: boolean default: true title: Auto renew description: Whether the subscription renews at the end of its term. ramp_intervals: type: array title: Ramp Intervals description: The new set of ramp intervals for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampInterval" revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" terms_and_conditions: type: string title: Terms and conditions description: This will default to the Terms and Conditions text specified on the Invoice Settings page in your Recurly admin. Specify custom notes to add or override Terms and Conditions. Custom notes will stay with a subscription on all renewals. customer_notes: type: string title: Customer notes description: This will default to the Customer Notes text specified on the Invoice Settings. Specify custom notes to add or override Customer Notes. Custom notes will stay with a subscription on all renewals. credit_customer_notes: type: string title: Credit customer notes description: If there are pending credits on the account that will be invoiced during the subscription creation, these will be used as the Customer Notes on the credit invoice. po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Net terms description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" gateway_code: type: string title: Gateway Code description: If present, this subscription's transactions will use the payment gateway with this code. maxLength: 13 transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" gift_card_redemption_code: type: string title: Gift card Redemption Code description: A gift card redemption code to be redeemed on the purchase invoice. bulk: type: boolean description: Optional field to be used only when needing to bypass the 60 second limit on creating subscriptions. Should only be used when creating subscriptions in bulk from the API. default: false required: - plan_code - currency - account SubscriptionPurchase: type: object properties: plan_code: type: string title: Plan code plan_id: type: string title: Plan ID maxLength: 13 unit_amount: type: number format: float title: Custom subscription pricing description: Override the unit amount of the subscription plan by setting this value. If not provided, the subscription will inherit the price from the subscription plan for the provided currency. minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to use this flag. quantity: type: integer title: Quantity description: Optionally override the default quantity of 1. default: 1 minimum: 0 add_ons: type: array title: Add-ons items: "$ref": "#/components/schemas/SubscriptionAddOnCreate" custom_fields: "$ref": "#/components/schemas/CustomFields" shipping: title: Shipping address description: Create a shipping address on the account and assign it to the subscription. "$ref": "#/components/schemas/SubscriptionShippingPurchase" trial_ends_at: type: string format: date-time title: Trial ends at description: If set, overrides the default trial behavior for the subscription. When the current date time or a past date time is provided the subscription will begin with no trial phase (overriding any plan default trial). When a future date time is provided the subscription will begin with a trial phase ending at the specified date time. starts_at: type: string format: date-time title: Start date description: If set, the subscription will begin on this specified date. The subscription will apply the setup fee and trial period, unless the - plan has no trial. + plan has no trial. Omit this field if the subscription should be started + immediately. next_bill_date: type: string format: date-time title: Next bill date description: If present, this sets the date the subscription's next billing period will start (`current_period_ends_at`). This can be used to align the subscription’s billing to a specific day of the month. The initial invoice will be prorated for the period between the subscription's activation date and the billing period end date. Subsequent periods will be based off the plan interval. For a subscription with a trial period, this will change when the trial expires. total_billing_cycles: type: integer title: Total billing cycles description: The number of cycles/billing periods in a term. When `remaining_billing_cycles=0`, if `auto_renew=true` the subscription will renew and a new term will begin, otherwise the subscription will expire. minimum: 1 renewal_billing_cycles: type: integer title: Renewal billing cycles description: If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. auto_renew: type: boolean default: true title: Auto renew description: Whether the subscription renews at the end of its term. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" ramp_intervals: type: array title: Ramp Intervals description: The new set of ramp intervals for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampInterval" bulk: type: boolean description: Optional field to be used only when needing to bypass the 60 second limit on creating subscriptions. Should only be used when creating subscriptions in bulk from the API. default: false required: - plan_code SubscriptionUpdate: type: object properties: collection_method: title: Change collection method "$ref": "#/components/schemas/CollectionMethodEnum" custom_fields: "$ref": "#/components/schemas/CustomFields" remaining_billing_cycles: type: integer title: Remaining billing cycles description: The remaining billing cycles in the current term. renewal_billing_cycles: type: integer title: Renewal billing cycles description: If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. auto_renew: type: boolean default: true title: Auto renew description: Whether the subscription renews at the end of its term. next_bill_date: type: string format: date-time title: Next bill date description: If present, this sets the date the subscription's next billing period will start (`current_period_ends_at`). This can be used to align the subscription’s billing to a specific day of the month. For a subscription in a trial period, this will change when the trial expires. This parameter is useful for postponement of a subscription to change its billing date without proration. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" terms_and_conditions: type: string title: Terms and conditions description: Specify custom notes to add or override Terms and Conditions. Custom notes will stay with a subscription on all renewals. customer_notes: type: string title: Customer notes description: Specify custom notes to add or override Customer Notes. Custom notes will stay with a subscription on all renewals. po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Terms that the subscription is due on description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" gateway_code: type: string title: Gateway Code description: If present, this subscription's transactions will use the payment gateway with this code. maxLength: 13 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true shipping: "$ref": "#/components/schemas/SubscriptionShippingUpdate" billing_info_id: type: string title: Billing Info ID description: The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. SubscriptionPause: type: object properties: remaining_pause_cycles: type: integer title: Remaining pause cycles description: Number of billing cycles to pause the subscriptions. A value of 0 will cancel any pending pauses on the subscription. required: - remaining_pause_cycles SubscriptionShipping: type: object title: Subscription shipping details properties: object: type: string title: Object type address: "$ref": "#/components/schemas/ShippingAddress" method: "$ref": "#/components/schemas/ShippingMethodMini" amount: type: number format: float title: Subscription's shipping cost SubscriptionShippingCreate: type: object title: Subscription shipping details properties: address: "$ref": "#/components/schemas/ShippingAddressCreate" address_id: type: string title: Shipping address ID description: Assign a shipping address from the account's existing shipping addresses. If `address_id` and `address` are both present, `address` will be used. maxLength: 13 method_id: type: string title: Service ID description: The id of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 13 method_code: type: string title: Service Code description: The code of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 50 amount: type: number format: float title: Assigns the subscription's shipping cost. If this is greater than zero then a `method_id` or `method_code` is required. SubscriptionShippingUpdate: type: object title: Subscription shipping details properties: object: type: string title: Object type address: "$ref": "#/components/schemas/ShippingAddressCreate" address_id: type: string title: Shipping Address ID description: Assign a shipping address from the account's existing shipping addresses. maxLength: 13 SubscriptionShippingPurchase: type: object title: Subscription shipping details properties: method_id: type: string title: Service ID description: The id of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 13 method_code: type: string title: Service Code description: The code of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 50 amount: type: number format: float title: Assigns the subscription's shipping cost. If this is greater than zero then a `method_id` or `method_code` is required. SubscriptionRampInterval: type: object title: Subscription Ramp Interval properties: starting_billing_cycle: type: integer description: Represents the billing cycle where a ramp interval starts. default: 1 unit_amount: type: integer description: Represents the price for the ramp interval. SubscriptionRampIntervalResponse: type: object title: Subscription Ramp Interval properties: starting_billing_cycle: type: integer description: Represents the billing cycle where a ramp interval starts. remaining_billing_cycles: type: integer description: Represents how many billing cycles are left in a ramp interval. starting_on: type: string format: date-time title: Date the ramp interval starts ending_on: type: string format: date-time title: Date the ramp interval ends unit_amount: type: number format: float title: Unit price description: Represents the price for the ramp interval. TaxInfo: type: object title: Tax info description: Only for merchants using Recurly's In-The-Box taxes. properties: type: type: string title: Type description: Provides the tax type as "vat" for EU VAT, "usst" for U.S. Sales Tax, or the 2 letter country code for country level tax types like Canada, Australia, New Zealand, Israel, and all non-EU European countries. Not present when Avalara for Communications is enabled. region: type: string title: Region description: Provides the tax region applied on an invoice. For U.S. Sales Tax, this will be the 2 letter state code. For EU VAT this will be the 2 letter country code. For all country level tax types, this will display the regional tax, like VAT, GST, or PST. Not present when Avalara for Communications is enabled. rate: type: number format: float title: Rate description: The combined tax rate. Not present when Avalara for Communications is enabled. tax_details: type: array description: Provides additional tax details for Communications taxes when Avalara for Communications is enabled or Canadian Sales Tax when there is tax applied at both the country and province levels. This will only be populated for the Invoice response when fetching a single invoice and not for the InvoiceList or LineItemList. Only populated for a single LineItem fetch when Avalara for Communications is enabled. items: "$ref": "#/components/schemas/TaxDetail" TaxDetail: type: object title: Tax detail properties: type: type: string title: Type description: Provides the tax type for the region or type of Comminications tax when Avalara for Communications is enabled. For Canadian Sales Tax, this will be GST, HST, QST or PST. region: type: string title: Region description: Provides the tax region applied on an invoice. For Canadian Sales Tax, this will be either the 2 letter province code or country code. Not present when Avalara for Communications is enabled. rate: type: number format: float title: Rate description: Provides the tax rate for the region. tax: type: number format: float title: Tax description: The total tax applied for this tax type. name: type: string title: Name description: Provides the name of the Communications tax applied. Present only when Avalara for Communications is enabled. level: type: string title: Level description: Provides the jurisdiction level for the Communications tax applied. Example values include city, state and federal. Present only when Avalara for Communications is enabled. billable: type: boolean title: Billable description: Whether or not the line item is taxable. Only populated for a single LineItem fetch when Avalara for Communications is enabled. Transaction: type: object properties: id: type: string title: Transaction ID maxLength: 13 object: type: string title: Object type uuid: type: string title: Recurly UUID description: The UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI. maxLength: 32 original_transaction_id: type: string title: Original Transaction ID description: If this transaction is a refund (`type=refund`), this will be the ID of the original transaction on the invoice being refunded. maxLength: 13 account: "$ref": "#/components/schemas/AccountMini" indicator: "$ref": "#/components/schemas/TransactionIndicatorEnum" invoice: "$ref": "#/components/schemas/InvoiceMini" merchant_reason_code: "$ref": "#/components/schemas/TransactionMerchantReasonCodeEnum" voided_by_invoice: "$ref": "#/components/schemas/InvoiceMini" subscription_ids: type: array title: Subscription IDs description: If the transaction is charging or refunding for one or more subscriptions, these are their IDs. items: type: string title: Subscription ID maxLength: 13 type: title: Transaction type description: | - `authorization` – verifies billing information and places a hold on money in the customer's account. - `capture` – captures funds held by an authorization and completes a purchase. - `purchase` – combines the authorization and capture in one transaction. - `refund` – returns all or a portion of the money collected in a previous transaction to the customer. - `verify` – a $0 or $1 transaction used to verify billing information which is immediately voided. "$ref": "#/components/schemas/TransactionTypeEnum" origin: title: Origin of transaction description: Describes how the transaction was triggered. "$ref": "#/components/schemas/TransactionOriginEnum" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 amount: type: number format: float title: Amount description: Total transaction amount sent to the payment gateway. status: title: Transaction status description: The current transaction status. Note that the status may change, e.g. a `pending` transaction may become `declined` or `success` may later become `void`. "$ref": "#/components/schemas/TransactionStatusEnum" success: type: boolean title: Success? description: Did this transaction complete successfully? backup_payment_method_used: type: boolean title: Backup Payment Method Used? description: Indicates if the transaction was completed using a backup payment refunded: type: boolean title: Refunded? description: Indicates if part or all of this transaction was refunded. billing_address: "$ref": "#/components/schemas/AddressWithName" collection_method: description: The method by which the payment was collected. "$ref": "#/components/schemas/CollectionMethodEnum" payment_method: "$ref": "#/components/schemas/PaymentMethod" ip_address_v4: type: string title: IP address description: | IP address provided when the billing information was collected: - When the customer enters billing information into the Recurly.js or Hosted Payment Pages, Recurly records the IP address. - When the merchant enters billing information using the API, the merchant may provide an IP address. - When the merchant enters billing information using the UI, no IP address is recorded. ip_address_country: type: string title: Origin IP address country, 2-letter ISO 3166-1 alpha-2 code, if known by Recurly. status_code: type: string title: Status code status_message: type: string title: Status message description: For declined (`success=false`) transactions, the message displayed to the merchant. customer_message: type: string title: Customer message description: For declined (`success=false`) transactions, the message displayed to the customer. customer_message_locale: type: string title: Language code for the message payment_gateway: type: object x-class-name: TransactionPaymentGateway properties: id: type: string object: type: string title: Object type type: type: string name: type: string gateway_message: type: string title: Gateway message description: Transaction message from the payment gateway. gateway_reference: type: string title: Gateway reference description: Transaction reference number from the payment gateway. gateway_approval_code: type: string title: Transaction approval code from the payment gateway. gateway_response_code: type: string title: For declined transactions (`success=false`), this field lists the gateway error code. gateway_response_time: type: number format: float title: Gateway response time description: Time, in seconds, for gateway to process the transaction. gateway_response_values: type: object title: Gateway response values description: The values in this field will vary from gateway to gateway. cvv_check: title: CVV check description: When processed, result from checking the CVV/CVC value on the transaction. "$ref": "#/components/schemas/CvvCheckEnum" avs_check: @@ -26551,922 +26553,923 @@ components: - blog - direct_traffic - email - events - marketing_content - organic_search - other - outbound_sales - paid_search - public_relations - referral - social_media PreferredLocaleEnum: type: string enum: - da-DK - de-CH - de-DE - en-AU - en-CA - en-GB - en-IE - en-NZ - en-US - es-ES - es-MX - es-US - fi-FI - fr-BE - fr-CA - fr-CH - fr-FR - hi-IN - it-IT - ja-JP - ko-KR - nl-BE - nl-NL - pl-PL - pt-BR - pt-PT - ro-RO - ru-RU - sk-SK - sv-SE - tr-TR - zh-CN BillToEnum: type: string enum: - parent - self DeliveryMethodEnum: type: string enum: - email - post PaymentGatewayReferencesEnum: type: string description: The type of reference token. Required if token is passed in for Stripe Gateway or Ebanx UPI. enum: - stripe_confirmation_token - stripe_customer - stripe_payment_method - upi_vpa GatewayTransactionTypeEnum: type: string enum: - moto KountDecisionEnum: type: string enum: - approve - decline - escalate - review CouponStateEnum: type: string enum: - expired - maxed_out - redeemable CouponDurationEnum: type: string enum: - forever - single_use - temporal TemporalUnitEnum: type: string enum: - day - month - week - year FreeTrialUnitEnum: type: string enum: - day - month - week RedemptionResourceEnum: type: string enum: - account - subscription CouponTypeEnum: type: string enum: - bulk - single_code DiscountTypeEnum: type: string enum: - fixed - free_trial - percent AddOnSourceEnum: type: string title: Add-on source description: | Used to determine where the associated add-on data is pulled from. If this value is set to `plan_add_on` or left blank, then add-on data will be pulled from the plan's add-ons. If the associated `plan` has `allow_any_item_on_subscriptions` set to `true` and this field is set to `item`, then the associated add-on data will be pulled from the site's item catalog. default: plan_add_on enum: - plan_add_on - item AddOnTypeEnum: type: string enum: - fixed - usage title: Add-on Type description: Whether the add-on type is fixed, or usage-based. AddOnTypeCreateEnum: type: string enum: - fixed - usage title: Add-on Type description: Whether the add-on type is fixed, or usage-based. default: fixed UsageTypeCreateEnum: type: string enum: - price - percentage title: Usage Type description: | Type of usage, required if `add_on_type` is `usage`. See our [Guide](https://recurly.com/developers/guides/usage-based-billing-guide.html) for an overview of how to configure usage add-ons. TierTypeEnum: type: string title: Tier type description: | The pricing model for the add-on. For more information, [click here](https://docs.recurly.com/docs/billing-models#section-quantity-based). See our [Guide](https://recurly.com/developers/guides/item-addon-guide.html) for an overview of how to configure quantity-based pricing models. default: flat enum: - flat - tiered - stairstep - volume UsageTimeframeEnum: type: string title: Usage Timeframe description: The time at which usage totals are reset for billing purposes. enum: - billing_period - subscription_term default: billing_period UsageTimeframeCreateEnum: type: string title: Usage Timeframe description: | The time at which usage totals are reset for billing purposes. Allows for `tiered` add-ons to accumulate usage over the course of multiple billing periods. enum: - billing_period - subscription_term default: billing_period CreditPaymentActionEnum: type: string enum: - payment - reduction - refund - write_off UserAccessEnum: type: string enum: - api_only - read_only - write - set_only PricingModelTypeEnum: type: string enum: - fixed - ramp default: fixed description: | A fixed pricing model has the same price for each billing period. A ramp pricing model defines a set of Ramp Intervals, where a subscription changes price on a specified cadence of billing periods. The price change could be an increase or decrease. RevenueScheduleTypeEnum: type: string enum: - at_range_end - at_range_start - evenly - never NetTermsTypeEnum: type: string title: Net Terms Type description: | Optionally supplied string that may be either `net` or `eom` (end-of-month). When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date. When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month. enum: - net - eom default: net InvoiceTypeEnum: type: string enum: - charge - credit - legacy OriginEnum: type: string enum: - carryforward_credit - carryforward_gift_credit - credit - external_refund - gift_card - immediate_change - import - line_item_refund - open_amount_refund - prepayment - purchase - refund - renewal - termination - usage_correction - write_off InvoiceStateEnum: type: string default: all enum: - open - pending - processing - past_due - paid - closed - failed - voided InvoiceStateQueryParamEnum: type: string default: all enum: - pending - past_due - paid - failed CollectionMethodEnum: type: string enum: - automatic - manual InvoiceRefundTypeEnum: type: string enum: - amount - percentage - line_items RefundMethodEnum: type: string enum: - all_credit - all_transaction - credit_first - transaction_first ExternalPaymentMethodEnum: type: string enum: - bacs - ach - amazon - apple_pay - braintree_apple_pay - check - credit_card - eft - google_pay - money_order - other - paypal - roku - sepadirectdebit - wire_transfer LineItemRevenueScheduleTypeEnum: type: string enum: - at_invoice - at_range_end - at_range_start - evenly - never LegacyCategoryEnum: type: string enum: - applied_credit - carryforward - charge - credit LineItemOriginEnum: type: string enum: - add_on - add_on_trial - carryforward - coupon - credit - debit - one_time - plan - plan_trial - setup_fee - prepayment FullCreditReasonCodeEnum: type: string enum: - general - gift_card - promotional - refund - service - write_off PartialCreditReasonCodeEnum: type: string enum: - general - promotional - service LineItemCreateOriginEnum: type: string enum: - external_gift_card - prepayment IntervalUnitEnum: type: string enum: - days - months AddressRequirementEnum: type: string enum: - full - none - streetzip - zip SiteModeEnum: type: string enum: - development - production - sandbox FeaturesEnum: type: string enum: - credit_memos - manual_invoicing - only_bill_what_changed - subscription_terms SubscriptionStateEnum: type: string enum: - active - canceled - expired - failed - future - paused TimeframeEnum: type: string enum: - bill_date - term_end ChangeTimeframeEnum: type: string enum: - bill_date - now - renewal - term_end TransactionTypeEnum: type: string enum: - authorization - capture - purchase - refund - verify TransactionOriginEnum: type: string enum: - api - chargeback - external_recovery - force_collect - hpp - merchant - recurly_admin - recurlyjs - recurring - refunded_externally - transparent TransactionStatusEnum: type: string enum: - chargeback - declined - error - pending - processing - scheduled - success - void CvvCheckEnum: type: string enum: - D - I - M - N - P - S - U - X AvsCheckEnum: type: string enum: - A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z CouponCodeStateEnum: type: string enum: - expired - inactive - maxed_out - redeemable PaymentMethodEnum: type: string enum: - bacs - amazon - amazon_billing_agreement - apple_pay - bank_account_info - braintree_apple_pay - check - credit_card - eft - gateway_token - google_pay - iban_bank_account - money_order - other - paypal - paypal_billing_agreement - roku - sepadirectdebit - venmo - wire_transfer - braintree_v_zero - boleto - cash_app + - upi_autopay CardTypeEnum: type: string enum: - American Express - Dankort - Diners Club - Discover - ELO - Forbrugsforeningen - Hipercard - JCB - Laser - Maestro - MasterCard - Test Card - Union Pay - Unknown - Visa - Tarjeta Naranja CardNetworkEnum: type: string enum: - Bancontact - CartesBancaires - Dankort - MasterCard - Visa CardFundingSourceEnum: type: string enum: - credit - debit - charge - prepaid - deferred_debit AccountTypeEnum: type: string enum: - checking - savings ErrorTypeEnum: type: string enum: - bad_request - immutable_subscription - internal_server_error - invalid_api_key - invalid_api_version - invalid_content_type - invalid_permissions - invalid_token - missing_feature - not_found - rate_limited - service_not_available - simultaneous_request - tax_service_error - transaction - unauthorized - unavailable_in_api_version - unknown_api_version - validation ErrorCategoryEnum: type: string enum: - three_d_secure_required - three_d_secure_action_required - amazon - api_error - approved - communication - configuration - duplicate - fraud - hard - invalid - not_enabled - not_supported - recurly - referral - skles - soft - unknown ErrorCodeEnum: type: string enum: - ach_cancel - ach_chargeback - ach_credit_return - ach_exception - ach_return - ach_transactions_not_supported - ach_validation_exception - amazon_amount_exceeded - amazon_declined_review - amazon_invalid_authorization_status - amazon_invalid_close_attempt - amazon_invalid_create_order_reference - amazon_invalid_order_status - amazon_not_authorized - amazon_order_not_modifiable - amazon_transaction_count_exceeded - api_error - approved - approved_fraud_review - authorization_already_captured - authorization_amount_depleted - authorization_expired - batch_processing_error - billing_agreement_already_accepted - billing_agreement_not_accepted - billing_agreement_not_found - billing_agreement_replaced - call_issuer - call_issuer_update_cardholder_data - cancelled - cannot_refund_unsettled_transactions - card_not_activated - card_type_not_accepted - cardholder_requested_stop - contact_gateway - contract_not_found - currency_not_supported - customer_canceled_transaction - cvv_required - declined - declined_card_number - declined_exception - declined_expiration_date - declined_missing_data - declined_saveable - declined_security_code - deposit_referenced_chargeback - direct_debit_type_not_accepted - duplicate_transaction - exceeds_daily_limit - exceeds_max_amount - expired_card - finbot_disconnect - finbot_unavailable - fraud_address - fraud_address_recurly - fraud_advanced_verification - fraud_gateway - fraud_generic - fraud_ip_address - fraud_manual_decision - fraud_risk_check - fraud_security_code - fraud_stolen_card - fraud_too_many_attempts - fraud_velocity - gateway_account_setup_incomplete - gateway_error - gateway_rate_limited - gateway_timeout - gateway_token_not_found - gateway_unavailable - gateway_validation_exception - insufficient_funds - invalid_account_number - invalid_amount - invalid_billing_agreement_status - invalid_card_number - invalid_data - invalid_email - invalid_gateway_access_token - invalid_gateway_configuration - invalid_issuer - invalid_login - invalid_merchant_type - invalid_name - invalid_payment_method - invalid_payment_method_hard - invalid_transaction - issuer_unavailable - lifecycle_decline - merch_max_transaction_limit_exceeded - moneybot_disconnect - moneybot_unavailable - no_billing_information - no_gateway - no_gateway_found_for_transaction_amount - partial_approval - partial_credits_not_supported - payer_authentication_rejected - payment_cannot_void_authorization - payment_not_accepted - paypal_account_issue - paypal_cannot_pay_self - paypal_declined_use_alternate - paypal_expired_reference_id - paypal_hard_decline - paypal_invalid_billing_agreement - paypal_primary_declined - processor_not_available - processor_unavailable - recurly_credentials_not_found - recurly_error - recurly_failed_to_get_token - recurly_token_mismatch - recurly_token_not_found - reference_transactions_not_enabled - restricted_card - restricted_card_chargeback - rjs_token_expired - roku_invalid_card_number - roku_invalid_cib - roku_invalid_payment_method - roku_zip_code_mismatch - simultaneous - ssl_error - temporary_hold - three_d_secure_action_required - three_d_secure_action_result_token_mismatch - three_d_secure_authentication - three_d_secure_connection_error - three_d_secure_credential_error - three_d_secure_not_supported - too_busy - too_many_attempts - total_credit_exceeds_capture - transaction_already_refunded - transaction_already_voided - transaction_cannot_be_authorized - transaction_cannot_be_refunded - transaction_cannot_be_refunded_currently - transaction_cannot_be_voided - transaction_failed_to_settle - transaction_not_found - transaction_service_v2_disconnect - transaction_service_v2_unavailable - transaction_settled - transaction_stale_at_gateway - try_again - unknown - unmapped_partner_error - vaultly_service_unavailable - zero_dollar_auth_not_supported DeclineCodeEnum: type: string enum: - account_closed - call_issuer - card_not_activated - card_not_supported - cardholder_requested_stop - do_not_honor - do_not_try_again - exceeds_daily_limit - generic_decline - expired_card - fraudulent - insufficient_funds - incorrect_address - incorrect_security_code - invalid_amount - invalid_number - invalid_transaction - issuer_unavailable - lifecycle_decline - lost_card - pickup_card - policy_decline - restricted_card - restricted_card_chargeback - security_decline - stolen_card - try_again - update_cardholder_data - requires_3d_secure ExportDates: type: object properties: object: type: string title: Object type readOnly: true dates: type: array items: type: string title: An array of dates that have available exports. ExportFiles: type: object properties: object: type: string title: Object type readOnly: true files: type: array items: "$ref": "#/components/schemas/ExportFile" ExportFile: type: object properties: name: type: string title: Filename description: Name of the export file. md5sum: type: string title: MD5 hash of the export file description: MD5 hash of the export file. href: type: string title: A link to the export file description: A presigned link to download the export file. TaxIdentifierTypeEnum: type: string enum: - cpf - cnpj - cuit DunningCycleTypeEnum: type: string description: The type of invoice this cycle applies to. enum: - automatic - manual - trial AchTypeEnum: type: string description: The payment method type for a non-credit card based billing info. `bacs` and `becs` are the only accepted values. enum: - bacs - becs AchAccountTypeEnum: type: string description: The bank account type. (ACH only) enum: - checking - savings ExternalHppTypeEnum: type: string description: Use for Adyen HPP billing info. This should only be used as part of a pending purchase request, when the billing info is nested inside an account object. enum: - adyen OnlineBankingPaymentTypeEnum: type: string description: Use for Online Banking billing info. This should only be used as part of a pending purchase request, when the billing info is nested inside an account object. enum: - ideal - sofort ExternalInvoiceStateEnum: type: string enum: - paid GeneralLedgerAccountTypeEnum: type: string enum: - liability - revenue OriginTaxAddressSourceEnum: type: string title: Origin tax address source description: The source of the address that will be used as the origin in determining taxes. Available only when the site is on an Elite plan. A value of "origin" refers to the "Business entity tax address". A value of "destination" refers to the "Customer tax address". default: origin enum: - origin - destination DestinationTaxAddressSourceEnum: type: string title: Destination tax address source description: The source of the address that will be used as the destinaion in determining taxes. Available only when the site is on an Elite plan. A value of "destination" refers to the "Customer tax address". A value of "origin" refers to the "Business entity tax address". default: destination enum: - destination - origin TransactionMerchantReasonCodeEnum: type: string default: none description: | This conditional parameter is useful for merchants in specific industries who need to submit one-time Merchant Initiated transactions in specific cases. Not all gateways support these methods, but will support a generic one-time Merchant Initiated transaction. Only use this if the initiator value is "merchant". Otherwise, it will be ignored. - Incremental: Send `incremental` with an additional purchase if the original authorization amount is not sufficient to cover the costs of your service or product. For example, if the customer adds goods or services or there are additional expenses. - No Show: Send `no_show` if you charge customers a fee due to an agreed-upon cancellation policy in your industry. - Resubmission: Send `resubmission` if you need to attempt collection on a declined transaction. You may also use the force collection behavior which has the same effect. - Service Extension: Send `service_extension` if you are in a service industry and the customer has increased/extended their service in some way. For example: adding a day onto a car rental agreement. - Split Shipment: Send `split_shipment` if you sell physical product and need to split up a shipment into multiple transactions when the customer is no longer in session. - Top Up: Send `top_up` if you process one-time transactions based on a pre-arranged agreement with your customer where there is a pre-arranged account balance that needs maintaining. For example, if the customer has agreed to maintain an account balance of 30.00 and their current balance is 20.00, the MIT amount would be at least 10.00 to meet that 30.00 threshold. enum: - incremental - no_show - resubmission - service_extension - split_shipment - top_up TransactionIndicatorEnum: type: string description: Must be sent for one-time transactions in order to provide context on which entity is submitting the transaction to ensure proper fraud checks are observed, such as 3DS. If the customer is in session, send `customer`. If this is a merchant initiated one-time transaction, send `merchant`. enum: - customer - merchant
recurly/recurly-client-php
51f5889bea29548ee33561e5c7ec56a836957121
4.59.0
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 075e0aa..b0062f9 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 4.58.0 +current_version = 4.59.0 parse = (?P<major>\d+) \.(?P<minor>\d+) \.(?P<patch>\d+) serialize = {major}.{minor}.{patch} [bumpversion:file:composer.json] [bumpversion:file:lib/recurly/version.php] diff --git a/CHANGELOG.md b/CHANGELOG.md index 62d110e..22fd129 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,514 +1,526 @@ # Changelog +## [4.59.0](https://github.com/recurly/recurly-client-php/tree/4.59.0) (2025-04-10) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.58.0...4.59.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25: Create External Invoices [#838](https://github.com/recurly/recurly-client-php/pull/838) ([recurly-integrations](https://github.com/recurly-integrations)) +- Generated Latest Changes for v2021-02-25 [#836](https://github.com/recurly/recurly-client-php/pull/836) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.58.0](https://github.com/recurly/recurly-client-php/tree/4.58.0) (2025-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.57.0...4.58.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#835](https://github.com/recurly/recurly-client-php/pull/835) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.57.0](https://github.com/recurly/recurly-client-php/tree/4.57.0) (2025-02-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.56.0...4.57.0) **Merged Pull Requests** - Add `funding_source` to `BillingInfo` and `Transaction` [#834](https://github.com/recurly/recurly-client-php/pull/834) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#831](https://github.com/recurly/recurly-client-php/pull/831) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.56.0](https://github.com/recurly/recurly-client-php/tree/4.56.0) (2024-12-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.55.0...4.56.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#830](https://github.com/recurly/recurly-client-php/pull/830) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.55.0](https://github.com/recurly/recurly-client-php/tree/4.55.0) (2024-12-02) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.54.0...4.55.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#829](https://github.com/recurly/recurly-client-php/pull/829) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#826](https://github.com/recurly/recurly-client-php/pull/826) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.54.0](https://github.com/recurly/recurly-client-php/tree/4.54.0) (2024-08-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.53.0...4.54.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (add UUID to external subscriptions) [#823](https://github.com/recurly/recurly-client-php/pull/823) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.53.0](https://github.com/recurly/recurly-client-php/tree/4.53.0) (2024-08-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.52.0...4.53.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#821](https://github.com/recurly/recurly-client-php/pull/821) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.52.0](https://github.com/recurly/recurly-client-php/tree/4.52.0) (2024-07-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.51.0...4.52.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Taxable Address Control, RevRec) [#817](https://github.com/recurly/recurly-client-php/pull/817) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.51.0](https://github.com/recurly/recurly-client-php/tree/4.51.0) (2024-05-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.50.0...4.51.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#814](https://github.com/recurly/recurly-client-php/pull/814) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.50.0](https://github.com/recurly/recurly-client-php/tree/4.50.0) (2024-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.49.0...4.50.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entity Use Code) [#812](https://github.com/recurly/recurly-client-php/pull/812) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.49.0](https://github.com/recurly/recurly-client-php/tree/4.49.0) (2024-05-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.48.0...4.49.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Proration Settings) [#810](https://github.com/recurly/recurly-client-php/pull/810) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.48.0](https://github.com/recurly/recurly-client-php/tree/4.48.0) (2024-05-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.47.0...4.48.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Auth & Capture) [#808](https://github.com/recurly/recurly-client-php/pull/808) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.47.0](https://github.com/recurly/recurly-client-php/tree/4.47.0) (2024-03-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.46.0...4.47.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#803](https://github.com/recurly/recurly-client-php/pull/803) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.46.0](https://github.com/recurly/recurly-client-php/tree/4.46.0) (2024-02-20) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.45.0...4.46.0) **Merged Pull Requests** - Add invoice state param for v2021-02-25 [#799](https://github.com/recurly/recurly-client-php/pull/799) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.45.0](https://github.com/recurly/recurly-client-php/tree/4.45.0) (2024-01-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.44.0...4.45.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#789](https://github.com/recurly/recurly-client-php/pull/789) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.44.0](https://github.com/recurly/recurly-client-php/tree/4.44.0) (2024-01-18) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.43.0...4.44.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#788](https://github.com/recurly/recurly-client-php/pull/788) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.43.0](https://github.com/recurly/recurly-client-php/tree/4.43.0) (2023-12-06) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.42.0...4.43.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Payment Phases) [#785](https://github.com/recurly/recurly-client-php/pull/785) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.42.0](https://github.com/recurly/recurly-client-php/tree/4.42.0) (2023-11-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.41.0...4.42.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#783](https://github.com/recurly/recurly-client-php/pull/783) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.41.0](https://github.com/recurly/recurly-client-php/tree/4.41.0) (2023-08-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.40.0...4.41.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (`VATNumber`, `LifecycleDecline`) [#782](https://github.com/recurly/recurly-client-php/pull/782) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.40.0](https://github.com/recurly/recurly-client-php/tree/4.40.0) (2023-08-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.39.0...4.40.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (action_result) [#781](https://github.com/recurly/recurly-client-php/pull/781) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.39.0](https://github.com/recurly/recurly-client-php/tree/4.39.0) (2023-07-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.37.0...4.39.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Ramp Dates, Net Terms, Invoice Business Entity) [#779](https://github.com/recurly/recurly-client-php/pull/779) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (App Management - External Subscriptions) [#777](https://github.com/recurly/recurly-client-php/pull/777) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.37.0](https://github.com/recurly/recurly-client-php/tree/4.37.0) (2023-06-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.36.0...4.37.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Multiple Business Entities) [#769](https://github.com/recurly/recurly-client-php/pull/769) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.36.0](https://github.com/recurly/recurly-client-php/tree/4.36.0) (2023-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.35.0...4.36.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Products & References) [#766](https://github.com/recurly/recurly-client-php/pull/766) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.35.0](https://github.com/recurly/recurly-client-php/tree/4.35.0) (2023-05-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.34.0...4.35.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (gateway_attributes on PaymentMethod) [#764](https://github.com/recurly/recurly-client-php/pull/764) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#747](https://github.com/recurly/recurly-client-php/pull/747) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.28.0](https://github.com/recurly/recurly-client-php/tree/4.28.0) (2023-02-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.27.0...4.28.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (GiftCard endpoints and new transaction error support) [#745](https://github.com/recurly/recurly-client-php/pull/745) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.27.0](https://github.com/recurly/recurly-client-php/tree/4.27.0) (2023-01-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.26.0...4.27.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Custom Fields on Line Items) [#738](https://github.com/recurly/recurly-client-php/pull/738) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.26.0](https://github.com/recurly/recurly-client-php/tree/4.26.0) (2023-01-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.25.0...4.26.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Account Preferred Time Zone) [#736](https://github.com/recurly/recurly-client-php/pull/736) ([douglasmiller](https://github.com/douglasmiller)) ## [4.25.0](https://github.com/recurly/recurly-client-php/tree/4.25.0) (2022-11-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.24.0...4.25.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Apply Credit Balance feature) [#732](https://github.com/recurly/recurly-client-php/pull/732) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.24.0](https://github.com/recurly/recurly-client-php/tree/4.24.0) (2022-11-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.23.0...4.24.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Subscriptions feature) [#729](https://github.com/recurly/recurly-client-php/pull/729) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#728](https://github.com/recurly/recurly-client-php/pull/728) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.23.0](https://github.com/recurly/recurly-client-php/tree/4.23.0) (2022-10-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.22.0...4.23.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entitlements feature) [#725](https://github.com/recurly/recurly-client-php/pull/725) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.22.0](https://github.com/recurly/recurly-client-php/tree/4.22.0) (2022-10-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.2...4.22.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25(Decimal Usage and Quantities and DunningEvent new fields) [#722](https://github.com/recurly/recurly-client-php/pull/722) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.2](https://github.com/recurly/recurly-client-php/tree/4.21.2) (2022-09-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.1...4.21.2) **Merged Pull Requests** - feat: allow for psr/log ^2/3 [#716](https://github.com/recurly/recurly-client-php/pull/716) ([trickeyone](https://github.com/trickeyone)) ## [4.21.1](https://github.com/recurly/recurly-client-php/tree/4.21.1) (2022-09-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.0...4.21.1) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#714](https://github.com/recurly/recurly-client-php/pull/714) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.0](https://github.com/recurly/recurly-client-php/tree/4.21.0) (2022-09-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.20.0...4.21.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#713](https://github.com/recurly/recurly-client-php/pull/713) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixes bug with putDunningCampaignBulkUpdate [#706](https://github.com/recurly/recurly-client-php/pull/706) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.20.0](https://github.com/recurly/recurly-client-php/tree/4.20.0) (2022-08-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.19.0...4.20.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#701](https://github.com/recurly/recurly-client-php/pull/701) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.19.0](https://github.com/recurly/recurly-client-php/tree/4.19.0) (2022-07-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.18.0...4.19.0) **Merged Pull Requests** - Fixing deprecation warnings in client [#697](https://github.com/recurly/recurly-client-php/pull/697) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#695](https://github.com/recurly/recurly-client-php/pull/695) ([recurly-integrations](https://github.com/recurly-integrations)) **Closed Issues** - Recurly\Pager and \Iterator return type mismatch (PHP 8.1 deprecation) [#677](https://github.com/recurly/recurly-client-php/issues/677) ## [4.18.0](https://github.com/recurly/recurly-client-php/tree/4.18.0) (2022-06-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.17.0...4.18.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#693](https://github.com/recurly/recurly-client-php/pull/693) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.17.0](https://github.com/recurly/recurly-client-php/tree/4.17.0) (2022-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.16.0...4.17.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#679](https://github.com/recurly/recurly-client-php/pull/679) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.16.0](https://github.com/recurly/recurly-client-php/tree/4.16.0) (2022-03-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.15.0...4.16.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#676](https://github.com/recurly/recurly-client-php/pull/676) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.15.0](https://github.com/recurly/recurly-client-php/tree/4.15.0) (2022-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.14.0...4.15.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#668](https://github.com/recurly/recurly-client-php/pull/668) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.14.0](https://github.com/recurly/recurly-client-php/tree/4.14.0) (2022-03-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.13.0...4.14.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#664](https://github.com/recurly/recurly-client-php/pull/664) ([recurly-integrations](https://github.com/recurly-integrations)) diff --git a/composer.json b/composer.json index 2c47132..42c23dc 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,38 @@ { "name": "recurly/recurly-client", - "version": "4.58.0", + "version": "4.59.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], "homepage": "https://github.com/recurly/recurly-client-php", "license": "MIT", "authors": [], "require": { "php": ">= 7.2.0", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "phpcompatibility/php-compatibility": "^9.3", "phpdocumentor/phpdocumentor": "~3.0.0", "phpstan/phpstan": "^0.12.11", "phpunit/phpunit": "^8", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "classmap": ["lib"], "files": ["lib/recurly.php"] }, "autoload-dev": { "classmap": ["tests"] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/lib/recurly/version.php b/lib/recurly/version.php index dc4461c..04550d5 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -1,8 +1,8 @@ <?php namespace Recurly; class Version { - public const CURRENT = '4.58.0'; + public const CURRENT = '4.59.0'; }
recurly/recurly-client-php
e4ebdc31ecc74e437b41b26a470d2a7b6fd577fa
Generated Latest Changes for v2021-02-25
diff --git a/lib/recurly/client.php b/lib/recurly/client.php index 3b2d825..5d6ce65 100644 --- a/lib/recurly/client.php +++ b/lib/recurly/client.php @@ -1441,1024 +1441,1040 @@ endpoint to obtain only the newly generated `UniqueCouponCodes`. $path = $this->interpolatePath("/performance_obligations/{performance_obligation_id}", ['performance_obligation_id' => $performance_obligation_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Get a site's Performance Obligations * * @param array $options Associative array of optional parameters * * @return \Recurly\Pager A list of Performance Obligations. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_performance_obligations */ public function getPerformanceObligations(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/performance_obligations", []); return new \Recurly\Pager($this, $path, $options); } /** * List an invoice template's associated accounts * * @param string $invoice_template_id Invoice template ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-bob`. * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['email'] (string): Filter for accounts with this exact email address. A blank value will return accounts with both `null` and `""` email addresses. Note that multiple accounts can share one email address. * - $options['params']['subscriber'] (bool): Filter for accounts with or without a subscription in the `active`, * `canceled`, or `future` state. * - $options['params']['past_due'] (string): Filter for accounts with an invoice in the `past_due` state. * * @return \Recurly\Pager A list of an invoice template's associated accounts. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_invoice_template_accounts */ public function listInvoiceTemplateAccounts(string $invoice_template_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/invoice_templates/{invoice_template_id}/accounts", ['invoice_template_id' => $invoice_template_id]); return new \Recurly\Pager($this, $path, $options); } /** * List a site's items * * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['state'] (string): Filter by state. * * @return \Recurly\Pager A list of the site's items. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_items */ public function listItems(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/items", []); return new \Recurly\Pager($this, $path, $options); } /** * Create a new item * * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Item A new item. * @link https://developers.recurly.com/api/v2021-02-25#operation/create_item */ public function createItem(array $body, array $options = []): \Recurly\Resources\Item { $path = $this->interpolatePath("/items", []); return $this->makeRequest('POST', $path, $body, $options); } /** * Fetch an item * * @param string $item_id Item ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-red`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Item An item. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_item */ public function getItem(string $item_id, array $options = []): \Recurly\Resources\Item { $path = $this->interpolatePath("/items/{item_id}", ['item_id' => $item_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Update an active item * * @param string $item_id Item ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-red`. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Item The updated item. * @link https://developers.recurly.com/api/v2021-02-25#operation/update_item */ public function updateItem(string $item_id, array $body, array $options = []): \Recurly\Resources\Item { $path = $this->interpolatePath("/items/{item_id}", ['item_id' => $item_id]); return $this->makeRequest('PUT', $path, $body, $options); } /** * Deactivate an item * * @param string $item_id Item ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-red`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Item An item. * @link https://developers.recurly.com/api/v2021-02-25#operation/deactivate_item */ public function deactivateItem(string $item_id, array $options = []): \Recurly\Resources\Item { $path = $this->interpolatePath("/items/{item_id}", ['item_id' => $item_id]); return $this->makeRequest('DELETE', $path, [], $options); } /** * Reactivate an inactive item * * @param string $item_id Item ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-red`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Item An item. * @link https://developers.recurly.com/api/v2021-02-25#operation/reactivate_item */ public function reactivateItem(string $item_id, array $options = []): \Recurly\Resources\Item { $path = $this->interpolatePath("/items/{item_id}/reactivate", ['item_id' => $item_id]); return $this->makeRequest('PUT', $path, [], $options); } /** * List a site's measured units * * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['state'] (string): Filter by state. * * @return \Recurly\Pager A list of the site's measured units. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_measured_unit */ public function listMeasuredUnit(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/measured_units", []); return new \Recurly\Pager($this, $path, $options); } /** * Create a new measured unit * * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\MeasuredUnit A new measured unit. * @link https://developers.recurly.com/api/v2021-02-25#operation/create_measured_unit */ public function createMeasuredUnit(array $body, array $options = []): \Recurly\Resources\MeasuredUnit { $path = $this->interpolatePath("/measured_units", []); return $this->makeRequest('POST', $path, $body, $options); } /** * Fetch a measured unit * * @param string $measured_unit_id Measured unit ID or name. For ID no prefix is used e.g. `e28zov4fw0v2`. For name use prefix `name-`, e.g. `name-Storage`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\MeasuredUnit An item. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_measured_unit */ public function getMeasuredUnit(string $measured_unit_id, array $options = []): \Recurly\Resources\MeasuredUnit { $path = $this->interpolatePath("/measured_units/{measured_unit_id}", ['measured_unit_id' => $measured_unit_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Update a measured unit * * @param string $measured_unit_id Measured unit ID or name. For ID no prefix is used e.g. `e28zov4fw0v2`. For name use prefix `name-`, e.g. `name-Storage`. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\MeasuredUnit The updated measured_unit. * @link https://developers.recurly.com/api/v2021-02-25#operation/update_measured_unit */ public function updateMeasuredUnit(string $measured_unit_id, array $body, array $options = []): \Recurly\Resources\MeasuredUnit { $path = $this->interpolatePath("/measured_units/{measured_unit_id}", ['measured_unit_id' => $measured_unit_id]); return $this->makeRequest('PUT', $path, $body, $options); } /** * Remove a measured unit * * @param string $measured_unit_id Measured unit ID or name. For ID no prefix is used e.g. `e28zov4fw0v2`. For name use prefix `name-`, e.g. `name-Storage`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\MeasuredUnit A measured unit. * @link https://developers.recurly.com/api/v2021-02-25#operation/remove_measured_unit */ public function removeMeasuredUnit(string $measured_unit_id, array $options = []): \Recurly\Resources\MeasuredUnit { $path = $this->interpolatePath("/measured_units/{measured_unit_id}", ['measured_unit_id' => $measured_unit_id]); return $this->makeRequest('DELETE', $path, [], $options); } /** * List a site's external products * * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * * @return \Recurly\Pager A list of the the external_products on a site. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_external_products */ public function listExternalProducts(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/external_products", []); return new \Recurly\Pager($this, $path, $options); } /** * Create an external product * * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExternalProduct Returns the external product * @link https://developers.recurly.com/api/v2021-02-25#operation/create_external_product */ public function createExternalProduct(array $body, array $options = []): \Recurly\Resources\ExternalProduct { $path = $this->interpolatePath("/external_products", []); return $this->makeRequest('POST', $path, $body, $options); } /** * Fetch an external product * * @param string $external_product_id External product id * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExternalProduct Settings for an external product. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_external_product */ public function getExternalProduct(string $external_product_id, array $options = []): \Recurly\Resources\ExternalProduct { $path = $this->interpolatePath("/external_products/{external_product_id}", ['external_product_id' => $external_product_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Update an external product * * @param string $external_product_id External product id * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExternalProduct Settings for an external product. * @link https://developers.recurly.com/api/v2021-02-25#operation/update_external_product */ public function updateExternalProduct(string $external_product_id, array $body, array $options = []): \Recurly\Resources\ExternalProduct { $path = $this->interpolatePath("/external_products/{external_product_id}", ['external_product_id' => $external_product_id]); return $this->makeRequest('PUT', $path, $body, $options); } /** * Deactivate an external product * * @param string $external_product_id External product id * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExternalProduct Deactivated external product. * @link https://developers.recurly.com/api/v2021-02-25#operation/deactivate_external_products */ public function deactivateExternalProducts(string $external_product_id, array $options = []): \Recurly\Resources\ExternalProduct { $path = $this->interpolatePath("/external_products/{external_product_id}", ['external_product_id' => $external_product_id]); return $this->makeRequest('DELETE', $path, [], $options); } /** * List the external product references for an external product * * @param string $external_product_id External product id * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * * @return \Recurly\Pager A list of the the external product references for an external product. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_external_product_external_product_references */ public function listExternalProductExternalProductReferences(string $external_product_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/external_products/{external_product_id}/external_product_references", ['external_product_id' => $external_product_id]); return new \Recurly\Pager($this, $path, $options); } /** * Create an external product reference on an external product * * @param string $external_product_id External product id * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExternalProductReferenceMini Details for the external product reference. * @link https://developers.recurly.com/api/v2021-02-25#operation/create_external_product_external_product_reference */ public function createExternalProductExternalProductReference(string $external_product_id, array $body, array $options = []): \Recurly\Resources\ExternalProductReferenceMini { $path = $this->interpolatePath("/external_products/{external_product_id}/external_product_references", ['external_product_id' => $external_product_id]); return $this->makeRequest('POST', $path, $body, $options); } /** * Fetch an external product reference * * @param string $external_product_id External product id * @param string $external_product_reference_id External product reference ID, e.g. `d39iun2fw1v4`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExternalProductReferenceMini Details for an external product reference. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_external_product_external_product_reference */ public function getExternalProductExternalProductReference(string $external_product_id, string $external_product_reference_id, array $options = []): \Recurly\Resources\ExternalProductReferenceMini { $path = $this->interpolatePath("/external_products/{external_product_id}/external_product_references/{external_product_reference_id}", ['external_product_id' => $external_product_id, 'external_product_reference_id' => $external_product_reference_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Deactivate an external product reference * * @param string $external_product_id External product id * @param string $external_product_reference_id External product reference ID, e.g. `d39iun2fw1v4`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExternalProductReferenceMini Details for an external product reference. * @link https://developers.recurly.com/api/v2021-02-25#operation/deactivate_external_product_external_product_reference */ public function deactivateExternalProductExternalProductReference(string $external_product_id, string $external_product_reference_id, array $options = []): \Recurly\Resources\ExternalProductReferenceMini { $path = $this->interpolatePath("/external_products/{external_product_id}/external_product_references/{external_product_reference_id}", ['external_product_id' => $external_product_id, 'external_product_reference_id' => $external_product_reference_id]); return $this->makeRequest('DELETE', $path, [], $options); } /** * Create an external subscription * * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExternalSubscription Returns the external subscription * @link https://developers.recurly.com/api/v2021-02-25#operation/create_external_subscription */ public function createExternalSubscription(array $body, array $options = []): \Recurly\Resources\ExternalSubscription { $path = $this->interpolatePath("/external_subscriptions", []); return $this->makeRequest('POST', $path, $body, $options); } /** * List the external subscriptions on a site * * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * * @return \Recurly\Pager A list of the the external_subscriptions on a site. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_external_subscriptions */ public function listExternalSubscriptions(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/external_subscriptions", []); return new \Recurly\Pager($this, $path, $options); } /** * Fetch an external subscription * * @param string $external_subscription_id External subscription ID, external_id or uuid. For ID no prefix is used e.g. `e28zov4fw0v2`. For external_id use prefix `external-id-`, e.g. `external-id-123456` and for uuid use prefix `uuid-` e.g. `uuid-7293239bae62777d8c1ae044a9843633`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExternalSubscription Settings for an external subscription. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_external_subscription */ public function getExternalSubscription(string $external_subscription_id, array $options = []): \Recurly\Resources\ExternalSubscription { $path = $this->interpolatePath("/external_subscriptions/{external_subscription_id}", ['external_subscription_id' => $external_subscription_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Update an external subscription * * @param string $external_subscription_id External subscription id * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExternalSubscription Settings for an external subscription. * @link https://developers.recurly.com/api/v2021-02-25#operation/put_external_subscription */ public function putExternalSubscription(string $external_subscription_id, array $body = [], array $options = []): \Recurly\Resources\ExternalSubscription { $path = $this->interpolatePath("/external_subscriptions/{external_subscription_id}", ['external_subscription_id' => $external_subscription_id]); return $this->makeRequest('PUT', $path, $body, $options); } /** * List the external invoices on an external subscription * * @param string $external_subscription_id External subscription id * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * * @return \Recurly\Pager A list of the the external_invoices on a site. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_external_subscription_external_invoices */ public function listExternalSubscriptionExternalInvoices(string $external_subscription_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/external_subscriptions/{external_subscription_id}/external_invoices", ['external_subscription_id' => $external_subscription_id]); return new \Recurly\Pager($this, $path, $options); } + /** + * Create an external invoice + * + * @param string $external_subscription_id External subscription id + * @param array $body The body of the request. + * @param array $options Associative array of optional parameters + * + * @return \Recurly\Resources\ExternalInvoice Returns the external invoice + * @link https://developers.recurly.com/api/v2021-02-25#operation/create_external_invoice + */ + public function createExternalInvoice(string $external_subscription_id, array $body, array $options = []): \Recurly\Resources\ExternalInvoice + { + $path = $this->interpolatePath("/external_subscriptions/{external_subscription_id}/external_invoices", ['external_subscription_id' => $external_subscription_id]); + return $this->makeRequest('POST', $path, $body, $options); + } + /** * List a site's invoices * * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['state'] (string): Invoice state. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['type'] (string): Filter by type when: * - `type=charge`, only charge invoices will be returned. * - `type=credit`, only credit invoices will be returned. * - `type=non-legacy`, only charge and credit invoices will be returned. * - `type=legacy`, only legacy invoices will be returned. * * @return \Recurly\Pager A list of the site's invoices. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_invoices */ public function listInvoices(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/invoices", []); return new \Recurly\Pager($this, $path, $options); } /** * Fetch an invoice * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Invoice An invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_invoice */ public function getInvoice(string $invoice_id, array $options = []): \Recurly\Resources\Invoice { $path = $this->interpolatePath("/invoices/{invoice_id}", ['invoice_id' => $invoice_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Update an invoice * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Invoice An invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/update_invoice */ public function updateInvoice(string $invoice_id, array $body, array $options = []): \Recurly\Resources\Invoice { $path = $this->interpolatePath("/invoices/{invoice_id}", ['invoice_id' => $invoice_id]); return $this->makeRequest('PUT', $path, $body, $options); } /** * Fetch an invoice as a PDF * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\BinaryFile An invoice as a PDF. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_invoice_pdf */ public function getInvoicePdf(string $invoice_id, array $options = []): \Recurly\Resources\BinaryFile { $path = $this->interpolatePath("/invoices/{invoice_id}.pdf", ['invoice_id' => $invoice_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Apply available credit to a pending or past due charge invoice * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Invoice The updated invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/apply_credit_balance */ public function applyCreditBalance(string $invoice_id, array $options = []): \Recurly\Resources\Invoice { $path = $this->interpolatePath("/invoices/{invoice_id}/apply_credit_balance", ['invoice_id' => $invoice_id]); return $this->makeRequest('PUT', $path, [], $options); } /** * Collect a pending or past due, automatic invoice * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Invoice The updated invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/collect_invoice */ public function collectInvoice(string $invoice_id, array $body = [], array $options = []): \Recurly\Resources\Invoice { $path = $this->interpolatePath("/invoices/{invoice_id}/collect", ['invoice_id' => $invoice_id]); return $this->makeRequest('PUT', $path, $body, $options); } /** * Mark an open invoice as failed * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Invoice The updated invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/mark_invoice_failed */ public function markInvoiceFailed(string $invoice_id, array $options = []): \Recurly\Resources\Invoice { $path = $this->interpolatePath("/invoices/{invoice_id}/mark_failed", ['invoice_id' => $invoice_id]); return $this->makeRequest('PUT', $path, [], $options); } /** * Mark an open invoice as successful * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Invoice The updated invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/mark_invoice_successful */ public function markInvoiceSuccessful(string $invoice_id, array $options = []): \Recurly\Resources\Invoice { $path = $this->interpolatePath("/invoices/{invoice_id}/mark_successful", ['invoice_id' => $invoice_id]); return $this->makeRequest('PUT', $path, [], $options); } /** * Reopen a closed, manual invoice * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Invoice The updated invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/reopen_invoice */ public function reopenInvoice(string $invoice_id, array $options = []): \Recurly\Resources\Invoice { $path = $this->interpolatePath("/invoices/{invoice_id}/reopen", ['invoice_id' => $invoice_id]); return $this->makeRequest('PUT', $path, [], $options); } /** * Void a credit invoice. * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Invoice The updated invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/void_invoice */ public function voidInvoice(string $invoice_id, array $options = []): \Recurly\Resources\Invoice { $path = $this->interpolatePath("/invoices/{invoice_id}/void", ['invoice_id' => $invoice_id]); return $this->makeRequest('PUT', $path, [], $options); } /** * Record an external payment for a manual invoices. * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Transaction The recorded transaction. * @link https://developers.recurly.com/api/v2021-02-25#operation/record_external_transaction */ public function recordExternalTransaction(string $invoice_id, array $body, array $options = []): \Recurly\Resources\Transaction { $path = $this->interpolatePath("/invoices/{invoice_id}/transactions", ['invoice_id' => $invoice_id]); return $this->makeRequest('POST', $path, $body, $options); } /** * List an invoice's line items * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['original'] (string): Filter by original field. * - $options['params']['state'] (string): Filter by state field. * - $options['params']['type'] (string): Filter by type field. * * @return \Recurly\Pager A list of the invoice's line items. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_invoice_line_items */ public function listInvoiceLineItems(string $invoice_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/invoices/{invoice_id}/line_items", ['invoice_id' => $invoice_id]); return new \Recurly\Pager($this, $path, $options); } /** * List the coupon redemptions applied to an invoice * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * * @return \Recurly\Pager A list of the the coupon redemptions associated with the invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_invoice_coupon_redemptions */ public function listInvoiceCouponRedemptions(string $invoice_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/invoices/{invoice_id}/coupon_redemptions", ['invoice_id' => $invoice_id]); return new \Recurly\Pager($this, $path, $options); } /** * List an invoice's related credit or charge invoices * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $options Associative array of optional parameters * * @return \Recurly\Pager A list of the credit or charge invoices associated with the invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_related_invoices */ public function listRelatedInvoices(string $invoice_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/invoices/{invoice_id}/related_invoices", ['invoice_id' => $invoice_id]); return new \Recurly\Pager($this, $path, $options); } /** * Refund an invoice * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Invoice Returns the new credit invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/refund_invoice */ public function refundInvoice(string $invoice_id, array $body, array $options = []): \Recurly\Resources\Invoice { $path = $this->interpolatePath("/invoices/{invoice_id}/refund", ['invoice_id' => $invoice_id]); return $this->makeRequest('POST', $path, $body, $options); } /** * List a site's line items * * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['original'] (string): Filter by original field. * - $options['params']['state'] (string): Filter by state field. * - $options['params']['type'] (string): Filter by type field. * * @return \Recurly\Pager A list of the site's line items. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_line_items */ public function listLineItems(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/line_items", []); return new \Recurly\Pager($this, $path, $options); } /** * Fetch a line item * * @param string $line_item_id Line Item ID. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\LineItem A line item. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_line_item */ public function getLineItem(string $line_item_id, array $options = []): \Recurly\Resources\LineItem { $path = $this->interpolatePath("/line_items/{line_item_id}", ['line_item_id' => $line_item_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Delete an uninvoiced line item * * @param string $line_item_id Line Item ID. * @param array $options Associative array of optional parameters * * @return \Recurly\EmptyResource Line item deleted. * @link https://developers.recurly.com/api/v2021-02-25#operation/remove_line_item */ public function removeLineItem(string $line_item_id, array $options = []): \Recurly\EmptyResource { $path = $this->interpolatePath("/line_items/{line_item_id}", ['line_item_id' => $line_item_id]); return $this->makeRequest('DELETE', $path, [], $options); } /** * List a site's plans * * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['state'] (string): Filter by state. * * @return \Recurly\Pager A list of plans. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_plans */ public function listPlans(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/plans", []); return new \Recurly\Pager($this, $path, $options); } /** * Create a plan * * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Plan A plan. * @link https://developers.recurly.com/api/v2021-02-25#operation/create_plan */ public function createPlan(array $body, array $options = []): \Recurly\Resources\Plan { $path = $this->interpolatePath("/plans", []); return $this->makeRequest('POST', $path, $body, $options); } /** * Fetch a plan * * @param string $plan_id Plan ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-gold`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Plan A plan. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_plan */ public function getPlan(string $plan_id, array $options = []): \Recurly\Resources\Plan { $path = $this->interpolatePath("/plans/{plan_id}", ['plan_id' => $plan_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Update a plan * * @param string $plan_id Plan ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-gold`. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Plan A plan. * @link https://developers.recurly.com/api/v2021-02-25#operation/update_plan */ public function updatePlan(string $plan_id, array $body, array $options = []): \Recurly\Resources\Plan { $path = $this->interpolatePath("/plans/{plan_id}", ['plan_id' => $plan_id]); return $this->makeRequest('PUT', $path, $body, $options); } /** * Remove a plan * * @param string $plan_id Plan ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-gold`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Plan Plan deleted * @link https://developers.recurly.com/api/v2021-02-25#operation/remove_plan */ public function removePlan(string $plan_id, array $options = []): \Recurly\Resources\Plan { $path = $this->interpolatePath("/plans/{plan_id}", ['plan_id' => $plan_id]); return $this->makeRequest('DELETE', $path, [], $options); } /** * List a plan's add-ons * * @param string $plan_id Plan ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-gold`. * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['state'] (string): Filter by state. * * @return \Recurly\Pager A list of add-ons. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_plan_add_ons */ public function listPlanAddOns(string $plan_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/plans/{plan_id}/add_ons", ['plan_id' => $plan_id]); return new \Recurly\Pager($this, $path, $options); } diff --git a/openapi/api.yaml b/openapi/api.yaml index 63e138e..2b48470 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -7871,1024 +7871,1062 @@ paths: '200': description: The updated measured_unit. content: application/json: schema: "$ref": "#/components/schemas/MeasuredUnit" '400': description: Bad request, perhaps invalid JSON? content: application/json: schema: "$ref": "#/components/schemas/Error" '404': description: Incorrect site or measured unit ID. content: application/json: schema: "$ref": "#/components/schemas/Error" '422': description: Invalid request parameters content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] delete: tags: - measured_unit operationId: remove_measured_unit summary: Remove a measured unit description: A mesured unit cannot be deleted if it is used by an active plan. parameters: - "$ref": "#/components/parameters/measured_unit_id" responses: '200': description: A measured unit. content: application/json: schema: "$ref": "#/components/schemas/MeasuredUnit" '422': description: Measured unit may already be inactive. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/external_products": get: tags: - external_products operationId: list_external_products summary: List a site's external products description: See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: - "$ref": "#/components/parameters/sort_dates" responses: '200': description: A list of the the external_products on a site. content: application/json: schema: "$ref": "#/components/schemas/ExternalProductList" '404': description: Incorrect site. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] post: tags: - external_products operationId: create_external_product summary: Create an external product requestBody: content: application/json: schema: "$ref": "#/components/schemas/ExternalProductCreate" required: true responses: '201': description: Returns the external product content: application/json: schema: "$ref": "#/components/schemas/ExternalProduct" '400': description: Bad request; perhaps missing or invalid parameters. content: application/json: schema: "$ref": "#/components/schemas/Error" '404': description: External product cannot be created for the specified reason. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/external_products/{external_product_id}": parameters: - "$ref": "#/components/parameters/external_product_id" get: tags: - external_products operationId: get_external_product summary: Fetch an external product responses: '200': description: Settings for an external product. content: application/json: schema: "$ref": "#/components/schemas/ExternalProduct" '404': description: Incorrect site or external product ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] put: tags: - external_products operationId: update_external_product summary: Update an external product requestBody: content: application/json: schema: "$ref": "#/components/schemas/ExternalProductUpdate" required: true responses: '200': description: Settings for an external product. content: application/json: schema: "$ref": "#/components/schemas/ExternalProduct" '404': description: Bad request; perhaps missing or invalid parameters. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] delete: tags: - external_products operationId: deactivate_external_products summary: Deactivate an external product description: Deactivate an external product. responses: '200': description: Deactivated external product. content: application/json: schema: "$ref": "#/components/schemas/ExternalProduct" '404': description: Bad request; perhaps missing or invalid parameters. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/external_products/{external_product_id}/external_product_references": parameters: - "$ref": "#/components/parameters/external_product_id" get: tags: - external_product_references operationId: list_external_product_external_product_references summary: List the external product references for an external product description: See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: - "$ref": "#/components/parameters/sort_dates" responses: '200': description: A list of the the external product references for an external product. content: application/json: schema: "$ref": "#/components/schemas/ExternalProductReferenceCollection" '404': description: Incorrect site or external product ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] post: tags: - external_product_references operationId: create_external_product_external_product_reference summary: Create an external product reference on an external product requestBody: content: application/json: schema: "$ref": "#/components/schemas/ExternalProductReferenceCreate" required: true responses: '201': description: Details for the external product reference. content: application/json: schema: "$ref": "#/components/schemas/ExternalProductReferenceMini" '404': description: Incorrect site. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/external_products/{external_product_id}/external_product_references/{external_product_reference_id}": parameters: - "$ref": "#/components/parameters/external_product_id" - "$ref": "#/components/parameters/external_product_reference_id" get: tags: - external_product_references operationId: get_external_product_external_product_reference summary: Fetch an external product reference responses: '200': description: Details for an external product reference. content: application/json: schema: "$ref": "#/components/schemas/ExternalProductReferenceMini" '404': description: Incorrect site or external product ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] delete: tags: - external_product_references operationId: deactivate_external_product_external_product_reference summary: Deactivate an external product reference responses: '200': description: Details for an external product reference. content: application/json: schema: "$ref": "#/components/schemas/ExternalProductReferenceMini" '404': description: Incorrect site or external product reference ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/external_subscriptions": post: tags: - external_subscriptions operationId: create_external_subscription summary: Create an external subscription requestBody: content: application/json: schema: "$ref": "#/components/schemas/ExternalSubscriptionCreate" required: true responses: '201': description: Returns the external subscription content: application/json: schema: "$ref": "#/components/schemas/ExternalSubscription" '400': description: Bad request; perhaps missing or invalid parameters. content: application/json: schema: "$ref": "#/components/schemas/Error" '404': description: External subscription cannot be completed for the specified reason. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] get: tags: - external_subscriptions operationId: list_external_subscriptions summary: List the external subscriptions on a site description: See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: - "$ref": "#/components/parameters/sort_dates" responses: '200': description: A list of the the external_subscriptions on a site. content: application/json: schema: "$ref": "#/components/schemas/ExternalSubscriptionList" '404': description: Incorrect site. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/external_subscriptions/{external_subscription_id}": get: parameters: - "$ref": "#/components/parameters/external_subscription_id_fetch" tags: - external_subscriptions operationId: get_external_subscription summary: Fetch an external subscription responses: '200': description: Settings for an external subscription. content: application/json: schema: "$ref": "#/components/schemas/ExternalSubscription" '404': description: Incorrect site or external subscription ID. content: application/json: schema: "$ref": "#/components/schemas/Error" '422': description: Validation error with external resource connection or feature flag. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] put: parameters: - "$ref": "#/components/parameters/external_subscription_id" tags: - external_subscriptions operationId: put_external_subscription summary: Update an external subscription requestBody: content: application/json: schema: "$ref": "#/components/schemas/ExternalSubscriptionUpdate" required: false responses: '200': description: Settings for an external subscription. content: application/json: schema: "$ref": "#/components/schemas/ExternalSubscription" '400': description: Bad request; perhaps missing or invalid parameters. content: application/json: schema: "$ref": "#/components/schemas/Error" '404': description: Incorrect site or external subscription ID. content: application/json: schema: "$ref": "#/components/schemas/Error" '422': description: Validation error with external resource connection or feature flag. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/external_subscriptions/{external_subscription_id}/external_invoices": parameters: - "$ref": "#/components/parameters/external_subscription_id" get: tags: - external_subscriptions operationId: list_external_subscription_external_invoices summary: List the external invoices on an external subscription description: See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: - "$ref": "#/components/parameters/sort_dates" - "$ref": "#/components/parameters/limit" - "$ref": "#/components/parameters/order" responses: '200': description: A list of the the external_invoices on a site. content: application/json: schema: "$ref": "#/components/schemas/ExternalInvoiceList" '404': description: Incorrect site. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] + post: + tags: + - external_invoices + operationId: create_external_invoice + summary: Create an external invoice + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalInvoiceCreate" + required: true + responses: + '201': + description: Returns the external invoice + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalInvoice" + '400': + description: Bad request; perhaps missing or invalid parameters. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '404': + description: External subscription cannot be completed for the specified + reason. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] "/invoices": get: tags: - invoice operationId: list_invoices summary: List a site's invoices description: See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: - "$ref": "#/components/parameters/ids" - "$ref": "#/components/parameters/invoice_state" - "$ref": "#/components/parameters/limit" - "$ref": "#/components/parameters/order" - "$ref": "#/components/parameters/sort_dates" - "$ref": "#/components/parameters/filter_begin_time" - "$ref": "#/components/parameters/filter_end_time" - "$ref": "#/components/parameters/filter_invoice_type" responses: '200': description: A list of the site's invoices. content: application/json: schema: "$ref": "#/components/schemas/InvoiceList" '400': description: Invalid or unpermitted parameter. content: application/json: schema: "$ref": "#/components/schemas/Error" '404': description: Incorrect site ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | const invoices = client.listInvoices({ params: { limit: 200 } }) for await (const invoice of invoices.each()) { console.log(invoice.number) } - lang: Python source: | params = {"limit": 200} invoices = client.list_invoices(params=params).items() for invoice in invoices: print(invoice.number) - lang: ".NET" source: | var optionalParams = new ListInvoicesParams() { Limit = 200 }; var invoices = client.ListInvoices(optionalParams); foreach(Invoice invoice in invoices) { Console.WriteLine(invoice.Number); } - lang: Ruby source: | params = { limit: 200 } invoices = @client.list_invoices(params: params) invoices.each do |invoice| puts "Invoice: #{invoice.number}" end - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<Invoice> invoices = client.listInvoices(params); for (Invoice invoice : invoices) { System.out.println(invoice.getNumber()); } - lang: PHP source: | $options = [ 'params' => [ 'limit' => 200 ] ]; $invoices = $client->listInvoices($options); foreach($invoices as $invoice) { echo 'Invoice: ' . $invoice->getNumber() . PHP_EOL; } - lang: Go source: "listParams := &recurly.ListInvoicesParams{\n\tSort: recurly.String(\"created_at\"),\n\tOrder: recurly.String(\"desc\"),\n\tLimit: recurly.Int(200),\n}\ninvoices, err := client.ListInvoices(listParams)\nif err != nil {\n\tfmt.Println(\"Unexpected error: %v\", err)\n\treturn\n}\n\nfor invoices.HasMore() {\n\terr := invoices.Fetch()\n\tif e, ok := err.(*recurly.Error); ok {\n\t\tfmt.Printf(\"Failed to retrieve next page: %v\", e)\n\t\tbreak\n\t}\n\tfor i, invoice := range invoices.Data() {\n\t\tfmt.Printf(\"Invoice %3d: %s, %s\\n\",\n\t\t\ti,\n\t\t\tinvoice.Id,\n\t\t\tinvoice.Number,\n\t\t)\n\t}\n}" "/invoices/{invoice_id}": get: tags: - invoice operationId: get_invoice summary: Fetch an invoice parameters: - "$ref": "#/components/parameters/invoice_id" responses: '200': description: An invoice. content: application/json: schema: "$ref": "#/components/schemas/Invoice" '404': description: Incorrect site or invoice ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const invoice = await client.getInvoice(invoiceId) console.log('Fetched Invoice: ', invoice.number) } catch (err) { if (err instanceof recurly.errors.NotFoundError) { // If the request was not found, you may want to alert the user or // just return null console.log('Resource Not Found') } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: invoice = client.get_invoice(invoice_id) print("Got Invoice %s" % invoice) except recurly.errors.NotFoundError: # If the resource was not found, you may want to alert the user or # just return nil print("Resource Not Found") - lang: ".NET" source: | try { Invoice invoice = client.GetInvoice(invoiceId); Console.WriteLine($"Fetched invoice #{invoice.Number}"); } catch (Recurly.Errors.NotFound ex) { // If the resource was not found // we may want to alert the user or just return null Console.WriteLine($"Resource Not Found: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin invoice = @client.get_invoice(invoice_id: invoice_id) puts "Got invoice #{invoice}" rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end - lang: Java source: | try { final Invoice invoice = client.getInvoice(invoiceId); System.out.println("Fetched invoice " + invoice.getNumber()); } catch (NotFoundException e) { // If the resource was not found // we may want to alert the user or just return null System.out.println("Resource Not Found: " + e.getError().getMessage()); } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $invoice = $client->getInvoice($invoice_id); echo 'Got Invoice:' . PHP_EOL; var_dump($invoice); } catch (\Recurly\Errors\NotFound $e) { // Could not find the resource, you may want to inform the user // or just return a NULL echo 'Could not find resource.' . PHP_EOL; var_dump($e); } catch (\Recurly\RecurlyError $e) { // Something bad happened... tell the user so that they can fix it? echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL; } - lang: Go source: "invoice, err := client.GetInvoice(invoiceID)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeNotFound {\n\t\tfmt.Printf(\"Resource not found: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\n\nfmt.Printf(\"Fetched Invoice: %v\", invoice)" put: tags: - invoice operationId: update_invoice summary: Update an invoice parameters: - "$ref": "#/components/parameters/invoice_id" requestBody: content: application/json: schema: "$ref": "#/components/schemas/InvoiceUpdate" required: true responses: '200': description: An invoice. content: application/json: schema: "$ref": "#/components/schemas/Invoice" '404': description: Incorrect site or invoice ID. content: application/json: schema: "$ref": "#/components/schemas/Error" '422': description: A validation error content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const invoiceUpdate = { customerNotes: "New notes", termsAndConditions: "New terms and conditions" } const invoice = await client.updateInvoice(invoiceId, invoiceUpdate) console.log('Edited invoice: ', invoice.number) } catch(err) { if (err instanceof recurly.errors.ValidationError) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params console.log('Failed validation', err.params) } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: invoice_update = { "customer_notes": "New Notes", "terms_and_conditions": "New Terms and Conditions", } invoice = client.update_invoice(invoice_id, invoice_update) print("Updated Invoice %s" % invoice.id) except recurly.errors.NotFoundError: # If the resource was not found, you may want to alert the user or # just return nil print("Resource Not Found") - lang: ".NET" source: | try { var invoiceReq = new InvoiceUpdate() { CustomerNotes = "New Notes", TermsAndConditions = "New Terms and Conditions" }; Invoice invoice = client.UpdateInvoice(invoiceId, invoiceReq); Console.WriteLine($"Edited invoice #{invoice.Number}"); } catch (Recurly.Errors.Validation ex) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in ex.Error.Params Console.WriteLine($"Failed validation: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin invoice_update = { customer_notes: "New Notes", terms_and_conditions: "New Terms and Conditions" } invoice = @client.update_invoice(invoice_id: invoice_id, body: invoice_update) puts "Updated invoice #{invoice}" rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end - lang: Java source: | try { final InvoiceUpdate invoiceUpdate = new InvoiceUpdate(); invoiceUpdate.setCustomerNotes("New notes"); invoiceUpdate.setTermsAndConditions("New terms and conditions"); final Invoice invoice = client.updateInvoice(invoiceId, invoiceUpdate); System.out.println("Edited invoice " + invoice.getNumber()); } catch (ValidationException e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in e.getError().getParams() System.out.println("Failed validation: " + e.getError().getMessage()); } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $invoice_update = [ "customer_notes" => "New Notes", "terms_and_conditions" => "New terms and conditions", ]; $invoice = $client->updateInvoice($invoice_id, $invoice_update); echo 'Updated Invoice:' . PHP_EOL; var_dump($invoice); } catch (\Recurly\Errors\Validation $e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params var_dump($e); } catch (\Recurly\RecurlyError $e) { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it var_dump($e); } - lang: Go source: "updateReq := &recurly.InvoiceUpdate{\n\tCustomerNotes: recurly.String(\"New Notes\"),\n\tTermsAndConditions: recurly.String(\"New Terms and Conditions\"),\n}\ninvoice, err := client.UpdateInvoice(invoiceID, updateReq)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeValidation {\n\t\tfmt.Printf(\"Failed validation: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\nfmt.Printf(\"Updated Invoice: %s\", invoice.Id)" "/invoices/{invoice_id}.pdf": get: tags: - invoice operationId: get_invoice_pdf summary: Fetch an invoice as a PDF parameters: - "$ref": "#/components/parameters/invoice_id" responses: '200': description: An invoice as a PDF. content: application/pdf: schema: "$ref": "#/components/schemas/BinaryFile" '404': description: Incorrect site or invoice ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const invoice = await client.getInvoicePdf(invoiceId) console.log('Fetched Invoice: ', invoice) const filename = `${downloadDirectory}/nodeinvoice-${invoiceId}.pdf` await fs.writeFile(filename, invoice.data, 'binary', (err) => { // throws an error, you could also catch it here if (err) throw err; // success case, the file was saved console.log('Saved Invoice PDF to', filename) }) } catch (err) { if (err instanceof recurly.errors.NotFoundError) { // If the request was not found, you may want to alert the user or // just return null console.log('Resource Not Found') } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: invoice = client.get_invoice_pdf(invoice_id) print("Got Invoice %s" % invoice) filename = "%s/pythoninvoice-%s.pdf" % (download_directory, invoice_id) with open(filename, 'wb') as file: file.write(invoice.data) print("Saved Invoice PDF to %s" % filename) except recurly.errors.NotFoundError: # If the resource was not found, you may want to alert the user or # just return nil print("Resource Not Found") - lang: ".NET" source: | try { BinaryFile invoice = client.GetInvoicePdf(invoiceId); string filename = $"{downloadDirectory}/dotnetinvoice-{invoiceId}.pdf"; System.IO.File.WriteAllBytes(filename, invoice.Data); Console.WriteLine($"Saved Invoice PDF to {filename}"); } catch (Recurly.Errors.NotFound ex) { // If the resource was not found // we may want to alert the user or just return null Console.WriteLine($"Resource Not Found: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin invoice = @client.get_invoice_pdf(invoice_id: invoice_id) puts "Got invoice #{invoice}" filename = "#{download_directory}/rubyinvoice-#{invoice_id}.pdf" IO.write(filename, invoice.data) puts "Saved Invoice PDF to #{filename}" rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end - lang: Java source: | try { final BinaryFile invoice = client.getInvoicePdf(invoiceId); //System.out.println("Fetched invoice " + invoice.getData()); String filename = downloadDirectory + "/javainvoice-" + invoiceId + ".pdf"; FileOutputStream fos = new FileOutputStream(filename); fos.write(invoice.getData()); fos.close(); System.out.println("Saved Invoice PDF to " + filename); } catch (NotFoundException e) { // If the resource was not found // we may want to alert the user or just return null System.out.println("Resource Not Found: " + e.getError().getMessage()); } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } catch (java.io.IOException e) { System.out.println("Unexpected File Writing Error: " + e.toString()); } - lang: PHP source: | try { $invoice = $client->getInvoicePdf($invoice_id); echo 'Got Invoice PDF:' . PHP_EOL; var_dump($invoice); $invoice_fp = fopen("php-invoice-" . $invoice_id . ".pdf", "w"); fwrite($invoice_fp, $invoice->getData()); fclose($invoice_fp); } catch (\Recurly\Errors\NotFound $e) { // Could not find the resource, you may want to inform the user // or just return a NULL echo 'Could not find resource.' . PHP_EOL; var_dump($e); } catch (\Recurly\RecurlyError $e) { // Something bad happened... tell the user so that they can fix it? echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL; } "/invoices/{invoice_id}/apply_credit_balance": put: tags: - invoice @@ -18439,1024 +18477,1030 @@ components: type: boolean title: Optional description: Whether the add-on is optional for the customer to include in their purchase on the hosted payment page. If false, the add-on will be included when a subscription is created through the Recurly UI. However, the add-on will not be included when a subscription is created through the API. avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `AddOn`, then the `avalara_transaction_type` must be absent. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `AddOn`, then the `avalara_service_type` must be absent. minimum: 0 tax_code: type: string maxLength: 50 title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes. If `item_code`/`item_id` is part of the request then `tax_code` must be absent. currencies: type: array title: Add-on pricing items: "$ref": "#/components/schemas/AddOnPricing" minItems: 1 description: | * If `item_code`/`item_id` is part of the request and the item has a default currency, then `currencies` is optional. If the item does not have a default currency, then `currencies` is required. If `item_code`/`item_id` is not present `currencies` is required. * If the add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `currencies` must be absent. * Must be absent if `add_on_type` is `usage` and `usage_type` is `percentage`. tier_type: "$ref": "#/components/schemas/TierTypeEnum" usage_timeframe: "$ref": "#/components/schemas/UsageTimeframeCreateEnum" tiers: type: array title: Tiers items: "$ref": "#/components/schemas/Tier" description: | If the tier_type is `flat`, then `tiers` must be absent. The `tiers` object must include one to many tiers with `ending_quantity` and `unit_amount` for the desired `currencies`. There must be one tier without an `ending_quantity` value which represents the final tier. percentage_tiers: type: array title: Percentage Tiers By Currency items: "$ref": "#/components/schemas/PercentageTiersByCurrency" description: | Array of objects which must have at least one set of tiers per currency and the currency code. The tier_type must be `volume` or `tiered`, if not, it must be absent. There must be one tier without an `ending_amount` value which represents the final tier. This feature is currently in development and requires approval and enablement, please contact support. required: - code - name AddOnUpdate: type: object title: Add-on description: Full add-on details. properties: id: type: string title: Add-on ID maxLength: 13 readOnly: true code: type: string title: Add-on code description: The unique identifier for the add-on within its plan. If an `Item` is associated to the `AddOn` then `code` must be absent. maxLength: 50 name: type: string title: Name description: Describes your add-on and will appear in subscribers' invoices. If an `Item` is associated to the `AddOn` then `name` must be absent. maxLength: 255 usage_percentage: type: number format: float title: Usage Percentage description: The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. Required if `add_on_type` is usage, `tier_type` is `flat` and `usage_type` is percentage. Must be omitted otherwise. usage_calculation_type: "$ref": "#/components/schemas/UsageCalculationTypeEnum" measured_unit_id: type: string title: Measured Unit ID description: System-generated unique identifier for a measured unit to be associated with the add-on. Either `measured_unit_id` or `measured_unit_name` are required when `add_on_type` is `usage`. If `measured_unit_id` and `measured_unit_name` are both present, `measured_unit_id` will be used. maxLength: 13 measured_unit_name: type: string title: Measured Unit Name description: Name of a measured unit to be associated with the add-on. Either `measured_unit_id` or `measured_unit_name` are required when `add_on_type` is `usage`. If `measured_unit_id` and `measured_unit_name` are both present, `measured_unit_id` will be used. accounting_code: type: string title: Accounting code description: Accounting code for invoice line items for this add-on. If no value is provided, it defaults to add-on's code. If an `Item` is associated to the `AddOn` then `accounting code` must be absent. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_schedule_type: title: Revenue schedule type description: When this add-on is invoiced, the line item will use this revenue schedule. If `item_code`/`item_id` is part of the request then `revenue_schedule_type` must be absent in the request as the value will be set from the item. "$ref": "#/components/schemas/RevenueScheduleTypeEnum" avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `AddOn`, then the `avalara_transaction_type` must be absent. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `AddOn`, then the `avalara_service_type` must be absent. minimum: 0 tax_code: type: string maxLength: 50 title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes. If an `Item` is associated to the `AddOn` then `tax_code` must be absent. display_quantity: type: boolean title: Display quantity? description: Determines if the quantity field is displayed on the hosted pages for the add-on. default: false default_quantity: type: integer title: Default quantity description: Default quantity for the hosted pages. default: 1 optional: type: boolean title: Optional description: Whether the add-on is optional for the customer to include in their purchase on the hosted payment page. If false, the add-on will be included when a subscription is created through the Recurly UI. However, the add-on will not be included when a subscription is created through the API. currencies: type: array title: Add-on pricing items: "$ref": "#/components/schemas/AddOnPricing" minItems: 1 description: | If the add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then currencies must be absent. Must also be absent if `add_on_type` is `usage` and `usage_type` is `percentage`. tiers: type: array title: Tiers items: "$ref": "#/components/schemas/Tier" description: | If the tier_type is `flat`, then `tiers` must be absent. The `tiers` object must include one to many tiers with `ending_quantity` and `unit_amount` for the desired `currencies`. There must be one tier without an `ending_quantity` value which represents the final tier. percentage_tiers: type: array title: Percentage Tiers By Currency items: "$ref": "#/components/schemas/PercentageTiersByCurrency" description: | `percentage_tiers` is an array of objects, which must have the set of tiers per currency and the currency code. The tier_type must be `volume` or `tiered`, if not, it must be absent. There must be one tier without an `ending_amount` value which represents the final tier. This feature is currently in development and requires approval and enablement, please contact support. BillingInfo: type: object properties: id: type: string maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true account_id: type: string maxLength: 13 readOnly: true first_name: type: string maxLength: 50 last_name: type: string maxLength: 50 company: type: string maxLength: 100 address: "$ref": "#/components/schemas/Address" vat_number: type: string description: Customer's VAT number (to avoid having the VAT applied). This is only used for automatically collected invoices. valid: type: boolean readOnly: true payment_method: "$ref": "#/components/schemas/PaymentMethod" fraud: type: object x-class-name: FraudInfo title: Fraud information description: Most recent fraud result. readOnly: true properties: score: type: integer title: Kount score minimum: 1 maximum: 99 decision: title: Kount decision maxLength: 10 "$ref": "#/components/schemas/KountDecisionEnum" risk_rules_triggered: type: object title: Kount rules primary_payment_method: type: boolean description: The `primary_payment_method` field is used to indicate the primary billing info on the account. The first billing info created on an account will always become primary. This payment method will be used backup_payment_method: type: boolean description: The `backup_payment_method` field is used to indicate a billing info as a backup on the account that will be tried if the initial billing info used for an invoice is declined. payment_gateway_references: type: array description: Array of Payment Gateway References, each a reference to a third-party gateway object of varying types. items: "$ref": "#/components/schemas/PaymentGatewayReferences" created_at: type: string format: date-time description: When the billing information was created. readOnly: true updated_at: type: string format: date-time description: When the billing information was last changed. readOnly: true updated_by: type: object x-class-name: BillingInfoUpdatedBy readOnly: true properties: ip: type: string description: Customer's IP address when updating their billing information. maxLength: 20 country: type: string description: Country, 2-letter ISO 3166-1 alpha-2 code matching the origin IP address, if known by Recurly. maxLength: 2 BillingInfoCreate: type: object properties: token_id: type: string title: Token ID description: A token [generated by Recurly.js](https://recurly.com/developers/reference/recurly-js/#getting-a-token). maxLength: 22 first_name: type: string title: First name maxLength: 50 last_name: type: string title: Last name maxLength: 50 company: type: string title: Company name maxLength: 100 address: "$ref": "#/components/schemas/Address" number: type: string title: Credit card number description: Credit card number, spaces and dashes are accepted. month: type: string title: Expiration month maxLength: 2 year: type: string title: Expiration year maxLength: 4 cvv: type: string title: Security code or CVV description: "*STRONGLY RECOMMENDED*" maxLength: 4 currency: type: string description: 3-letter ISO 4217 currency code. vat_number: type: string title: VAT number ip_address: type: string title: IP address description: "*STRONGLY RECOMMENDED* Customer's IP address when updating their billing information." maxLength: 20 gateway_token: type: string title: A token used in place of a credit card in order to perform transactions. Must be used in conjunction with `gateway_code`. maxLength: 50 gateway_code: type: string title: An identifier for a specific payment gateway. maxLength: 12 payment_gateway_references: type: array description: Array of Payment Gateway References, each a reference to a third-party gateway object of varying types. items: "$ref": "#/components/schemas/PaymentGatewayReferences" properties: token: type: string maxLength: 50 reference_type: type: string "$ref": "#/components/schemas/PaymentGatewayReferencesEnum" gateway_attributes: type: object description: Additional attributes to send to the gateway. x-class-name: GatewayAttributes properties: account_reference: type: string description: Used by Adyen and Braintree gateways. For Adyen the Shopper Reference value used when the external token was created. Must be used in conjunction with gateway_token and gateway_code. For Braintree the PayPal PayerID is populated in the response. maxLength: 264 amazon_billing_agreement_id: type: string title: Amazon billing agreement ID paypal_billing_agreement_id: type: string title: PayPal billing agreement ID roku_billing_agreement_id: type: string title: Roku's CIB if billing through Roku fraud_session_id: type: string title: Fraud Session ID transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" three_d_secure_action_result_token_id: type: string title: 3-D Secure action result token ID description: A token generated by Recurly.js after completing a 3-D Secure device fingerprinting or authentication challenge. maxLength: 22 iban: type: string maxLength: 34 description: The International Bank Account Number, up to 34 alphanumeric characters comprising a country code; two check digits; and a number that includes the domestic bank account number, branch identifier, and potential routing information name_on_account: type: string maxLength: 255 description: The name associated with the bank account (ACH, SEPA, Bacs only) account_number: type: string maxLength: 255 description: The bank account number. (ACH, Bacs only) routing_number: type: string maxLength: 15 description: The bank's rounting number. (ACH only) sort_code: type: string maxLength: 15 description: Bank identifier code for UK based banks. Required for Bacs based billing infos. (Bacs only) type: "$ref": "#/components/schemas/AchTypeEnum" account_type: "$ref": "#/components/schemas/AchAccountTypeEnum" tax_identifier: type: string description: Tax identifier is required if adding a billing info that is a consumer card in Brazil or in Argentina. This would be the customer's CPF/CNPJ (Brazil) and CUIT (Argentina). CPF, CNPJ and CUIT are tax identifiers for all residents who pay taxes in Brazil and Argentina respectively. tax_identifier_type: description: This field and a value of `cpf`, `cnpj` or `cuit` are required if adding a billing info that is an elo or hipercard type in Brazil or in Argentina. "$ref": "#/components/schemas/TaxIdentifierTypeEnum" primary_payment_method: type: boolean title: Primary Payment Method description: The `primary_payment_method` field is used to designate the primary billing info on the account. The first billing info created on an account will always become primary. Adding additional billing infos provides the flexibility to mark another billing info as primary, or adding additional non-primary billing infos. This can be accomplished by passing the `primary_payment_method` with a value of `true`. When adding billing infos via the billing_info and /accounts endpoints, this value is not permitted, and will return an error if provided. backup_payment_method: type: boolean description: The `backup_payment_method` field is used to designate a billing info as a backup on the account that will be tried if the initial billing info used for an invoice is declined. All payment methods, including the billing info marked `primary_payment_method` can be set as a backup. An account can have a maximum of 1 backup, if a user sets a different payment method as a backup, the existing backup will no longer be marked as such. external_hpp_type: "$ref": "#/components/schemas/ExternalHppTypeEnum" online_banking_payment_type: "$ref": "#/components/schemas/OnlineBankingPaymentTypeEnum" deprecated: true card_type: "$ref": "#/components/schemas/CardTypeEnum" card_network_preference: description: Represents the card network preference associated with the billing info for dual badged cards. Must be a supported card network. "$ref": "#/components/schemas/CardNetworkEnum" + return_url: + type: string + title: Return URL + description: Specifies a URL to which a consumer will be redirected upon + completion of a redirect payment flow. Only redirect payment flows operating + through Adyen Components will utilize this return URL. BillingInfoVerify: type: object properties: gateway_code: type: string description: An identifier for a specific payment gateway. maxLength: 13 BillingInfoVerifyCVV: type: object properties: verification_value: type: string description: Unique security code for a credit card. Coupon: type: object properties: id: type: string title: Coupon ID readOnly: true object: type: string title: Object type readOnly: true code: type: string title: Coupon code description: The code the customer enters to redeem the coupon. name: type: string title: Name description: The internal name for the coupon. state: title: State description: Indicates if the coupon is redeemable, and if it is not, why. "$ref": "#/components/schemas/CouponStateEnum" max_redemptions: type: integer title: Max redemptions description: A maximum number of redemptions for the coupon. The coupon will expire when it hits its maximum redemptions. max_redemptions_per_account: type: integer title: Max redemptions per account description: Redemptions per account is the number of times a specific account can redeem the coupon. Set redemptions per account to `1` if you want to keep customers from gaming the system and getting more than one discount from the coupon campaign. unique_coupon_codes_count: type: integer title: Unique coupon codes count description: When this number reaches `max_redemptions` the coupon will no longer be redeemable. readOnly: true unique_code_template: type: string title: Unique code template description: On a bulk coupon, the template from which unique coupon codes are generated. unique_coupon_code: allOf: - "$ref": "#/components/schemas/UniqueCouponCode" type: object description: Will be populated when the Coupon being returned is a `UniqueCouponCode`. duration: title: Duration description: | - "single_use" coupons applies to the first invoice only. - "temporal" coupons will apply to invoices for the duration determined by the `temporal_unit` and `temporal_amount` attributes. "$ref": "#/components/schemas/CouponDurationEnum" temporal_amount: type: integer title: Temporal amount description: If `duration` is "temporal" than `temporal_amount` is an integer which is multiplied by `temporal_unit` to define the duration that the coupon will be applied to invoices for. temporal_unit: title: Temporal unit description: If `duration` is "temporal" than `temporal_unit` is multiplied by `temporal_amount` to define the duration that the coupon will be applied to invoices for. "$ref": "#/components/schemas/TemporalUnitEnum" free_trial_unit: title: Free trial unit description: Description of the unit of time the coupon is for. Used with `free_trial_amount` to determine the duration of time the coupon is for. "$ref": "#/components/schemas/FreeTrialUnitEnum" free_trial_amount: type: integer title: Free trial amount description: Sets the duration of time the `free_trial_unit` is for. minimum: 1 maximum: 9999 applies_to_all_plans: type: boolean title: Applies to all plans? description: The coupon is valid for all plans if true. If false then `plans` will list the applicable plans. default: true applies_to_all_items: type: boolean title: Applies to all items? description: | The coupon is valid for all items if true. If false then `items` will list the applicable items. default: false applies_to_non_plan_charges: type: boolean title: Applied to all non-plan charges? description: The coupon is valid for one-time, non-plan charges if true. default: false plans: type: array title: Plans description: A list of plans for which this coupon applies. This will be `null` if `applies_to_all_plans=true`. items: "$ref": "#/components/schemas/PlanMini" items: type: array title: Items description: | A list of items for which this coupon applies. This will be `null` if `applies_to_all_items=true`. items: "$ref": "#/components/schemas/ItemMini" redemption_resource: title: Redemption resource description: Whether the discount is for all eligible charges on the account, or only a specific subscription. default: account "$ref": "#/components/schemas/RedemptionResourceEnum" discount: "$ref": "#/components/schemas/CouponDiscount" coupon_type: title: 'Coupon type (TODO: implement coupon generation)' description: Whether the coupon is "single_code" or "bulk". Bulk coupons will require a `unique_code_template` and will generate unique codes through the `/generate` endpoint. "$ref": "#/components/schemas/CouponTypeEnum" hosted_page_description: type: string title: Hosted Payment Pages description description: This description will show up when a customer redeems a coupon on your Hosted Payment Pages, or if you choose to show the description on your own checkout page. invoice_description: type: string title: Invoice description description: Description of the coupon on the invoice. maxLength: 255 redeem_by: type: string title: Redeem by description: The date and time the coupon will expire and can no longer be redeemed. Time is always 11:59:59, the end-of-day Pacific time. format: date-time created_at: type: string title: Created at format: date-time readOnly: true updated_at: type: string title: Last updated at format: date-time readOnly: true expired_at: type: string title: Expired at description: The date and time the coupon was expired early or reached its `max_redemptions`. format: date-time CouponCreate: allOf: - "$ref": "#/components/schemas/CouponUpdate" - type: object properties: code: type: string title: Coupon code description: The code the customer enters to redeem the coupon. discount_type: title: Discount type description: The type of discount provided by the coupon (how the amount discounted is calculated) "$ref": "#/components/schemas/DiscountTypeEnum" discount_percent: type: integer title: Discount percent description: The percent of the price discounted by the coupon. Required if `discount_type` is `percent`. free_trial_unit: title: Free trial unit description: Description of the unit of time the coupon is for. Used with `free_trial_amount` to determine the duration of time the coupon is for. Required if `discount_type` is `free_trial`. "$ref": "#/components/schemas/FreeTrialUnitEnum" free_trial_amount: type: integer title: Free trial amount description: Sets the duration of time the `free_trial_unit` is for. Required if `discount_type` is `free_trial`. minimum: 1 maximum: 9999 currencies: title: Currencies description: Fixed discount currencies by currency. Required if the coupon type is `fixed`. This parameter should contain the coupon discount values type: array items: "$ref": "#/components/schemas/CouponPricing" applies_to_non_plan_charges: type: boolean title: Applied to all non-plan charges? description: The coupon is valid for one-time, non-plan charges if true. default: false applies_to_all_plans: type: boolean title: Applies to all plans? description: The coupon is valid for all plans if true. If false then `plans` will list the applicable plans. default: true applies_to_all_items: type: boolean title: Applies to all items? description: | To apply coupon to Items in your Catalog, include a list of `item_codes` in the request that the coupon will apply to. Or set value to true to apply to all Items in your Catalog. The following values are not permitted when `applies_to_all_items` is included: `free_trial_amount` and `free_trial_unit`. default: false plan_codes: type: array title: Plan codes description: | List of plan codes to which this coupon applies. Required if `applies_to_all_plans` is false. Overrides `applies_to_all_plans` when `applies_to_all_plans` is true. items: type: string item_codes: type: array title: Item codes description: | List of item codes to which this coupon applies. Sending `item_codes` is only permitted when `applies_to_all_items` is set to false. The following values are not permitted when `item_codes` is included: `free_trial_amount` and `free_trial_unit`. items: type: string duration: title: Duration description: | This field does not apply when the discount_type is `free_trial`. - "single_use" coupons applies to the first invoice only. - "temporal" coupons will apply to invoices for the duration determined by the `temporal_unit` and `temporal_amount` attributes. - "forever" coupons will apply to invoices forever. default: forever "$ref": "#/components/schemas/CouponDurationEnum" temporal_amount: type: integer title: Temporal amount description: If `duration` is "temporal" than `temporal_amount` is an integer which is multiplied by `temporal_unit` to define the duration that the coupon will be applied to invoices for. temporal_unit: title: Temporal unit description: If `duration` is "temporal" than `temporal_unit` is multiplied by `temporal_amount` to define the duration that the coupon will be applied to invoices for. "$ref": "#/components/schemas/TemporalUnitEnum" coupon_type: title: Coupon type description: Whether the coupon is "single_code" or "bulk". Bulk coupons will require a `unique_code_template` and will generate unique codes through the `/generate` endpoint. "$ref": "#/components/schemas/CouponTypeEnum" unique_code_template: type: string title: Unique code template description: | On a bulk coupon, the template from which unique coupon codes are generated. - You must start the template with your coupon_code wrapped in single quotes. - Outside of single quotes, use a 9 for a character that you want to be a random number. - Outside of single quotes, use an "x" for a character that you want to be a random letter. - Outside of single quotes, use an * for a character that you want to be a random number or letter. - Use single quotes ' ' for characters that you want to remain static. These strings can be alphanumeric and may contain a - _ or +. For example: "'abc-'****'-def'" redemption_resource: title: Redemption resource description: Whether the discount is for all eligible charges on the account, or only a specific subscription. default: account "$ref": "#/components/schemas/RedemptionResourceEnum" required: - code - discount_type - name CouponPricing: type: object properties: currency: type: string description: 3-letter ISO 4217 currency code. discount: type: number format: float description: The fixed discount (in dollars) for the corresponding currency. CouponDiscount: type: object description: | Details of the discount a coupon applies. Will contain a `type` property and one of the following properties: `percent`, `fixed`, `trial`. properties: type: "$ref": "#/components/schemas/DiscountTypeEnum" percent: description: This is only present when `type=percent`. type: integer currencies: type: array description: This is only present when `type=fixed`. items: "$ref": "#/components/schemas/CouponDiscountPricing" trial: type: object x-class-name: CouponDiscountTrial description: This is only present when `type=free_trial`. properties: unit: title: Trial unit description: Temporal unit of the free trial "$ref": "#/components/schemas/FreeTrialUnitEnum" length: type: integer title: Trial length description: Trial length measured in the units specified by the sibling `unit` property CouponDiscountPricing: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 amount: type: number format: float title: Discount Amount description: Value of the fixed discount that this coupon applies. CouponBulkCreate: type: object properties: number_of_unique_codes: type: integer title: Number of unique codes description: The quantity of unique coupon codes to generate. A bulk coupon can have up to 100,000 unique codes (or your site's configured limit). minimum: 1 CouponMini: type: object properties: id: type: string title: Coupon ID readOnly: true object: type: string title: Object type readOnly: true code: type: string title: Coupon code description: The code the customer enters to redeem the coupon. name: type: string title: Name description: The internal name for the coupon. state: title: State description: Indicates if the coupon is redeemable, and if it is not, why. "$ref": "#/components/schemas/CouponStateEnum" discount: "$ref": "#/components/schemas/CouponDiscount" coupon_type: title: 'Coupon type (TODO: implement coupon generation)' description: Whether the coupon is "single_code" or "bulk". Bulk coupons will require a `unique_code_template` and will generate unique codes through the `/generate` endpoint. "$ref": "#/components/schemas/CouponTypeEnum" expired_at: type: string title: Expired at description: The date and time the coupon was expired early or reached its `max_redemptions`. format: date-time CouponRedemption: type: object properties: id: type: string title: Coupon Redemption ID readOnly: true object: type: string title: Object type description: Will always be `coupon`. readOnly: true account: type: object title: Account description: The Account on which the coupon was applied. readOnly: true "$ref": "#/components/schemas/AccountMini" subscription_id: type: string title: Subscription ID readOnly: true coupon: "$ref": "#/components/schemas/Coupon" state: title: Coupon Redemption state default: active "$ref": "#/components/schemas/ActiveStateEnum" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 discounted: type: number format: float title: Amount Discounted description: The amount that was discounted upon the application of the coupon, formatted with the currency. created_at: type: string title: Created at format: date-time readOnly: true updated_at: type: string title: Last updated at format: date-time readOnly: true removed_at: type: string title: Removed at description: The date and time the redemption was removed from the account (un-redeemed). format: date-time CouponRedemptionCreate: type: object properties: coupon_id: type: string title: Coupon ID currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 subscription_id: type: string title: Subscription ID required: - coupon_id CouponRedemptionMini: type: object properties: id: type: string title: Coupon Redemption ID readOnly: true object: type: string title: Object type description: Will always be `coupon`. readOnly: true coupon: "$ref": "#/components/schemas/CouponMini" state: title: Invoice state "$ref": "#/components/schemas/ActiveStateEnum" discounted: type: number format: float title: Amount Discounted description: The amount that was discounted upon the application of the coupon, formatted with the currency. created_at: type: string title: Created at format: date-time readOnly: true CouponUpdate: type: object properties: name: type: string title: Name description: The internal name for the coupon. max_redemptions: type: integer title: Max redemptions description: A maximum number of redemptions for the coupon. The coupon will expire when it hits its maximum redemptions. max_redemptions_per_account: type: integer
recurly/recurly-client-php
b39b98101a139c3fdf2a101af9ec256adc31e60d
Generated Latest Changes for v2021-02-25
diff --git a/lib/recurly/resources/payment_gateway_references.php b/lib/recurly/resources/payment_gateway_references.php index 7660737..4a3ada4 100644 --- a/lib/recurly/resources/payment_gateway_references.php +++ b/lib/recurly/resources/payment_gateway_references.php @@ -1,67 +1,67 @@ <?php /** * This file is automatically created by Recurly's OpenAPI generation process * and thus any edits you make by hand will be lost. If you wish to make a * change to this file, please create a Github issue explaining the changes you * need and we will usher them to the appropriate places. */ namespace Recurly\Resources; use Recurly\RecurlyResource; // phpcs:disable class PaymentGatewayReferences extends RecurlyResource { private $_reference_type; private $_token; protected static $array_hints = [ ]; /** * Getter method for the reference_type attribute. - * The type of reference token. Required if token is passed in for Stripe Gateway. + * The type of reference token. Required if token is passed in for Stripe Gateway or Ebanx UPI. * * @return ?string */ public function getReferenceType(): ?string { return $this->_reference_type; } /** * Setter method for the reference_type attribute. * * @param string $reference_type * * @return void */ public function setReferenceType(string $reference_type): void { $this->_reference_type = $reference_type; } /** * Getter method for the token attribute. - * Reference value used when the external token was created. If Stripe gateway is used, this value will need to be accompanied by its reference_type. + * Reference value used when the external token was created. If a Stripe gateway or Ebanx gateway is used, this value will need to be accompanied by its reference_type. * * @return ?string */ public function getToken(): ?string { return $this->_token; } /** * Setter method for the token attribute. * * @param string $token * * @return void */ public function setToken(string $token): void { $this->_token = $token; } } \ No newline at end of file diff --git a/openapi/api.yaml b/openapi/api.yaml index 28a59b3..63e138e 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -20813,1026 +20813,1026 @@ components: - "credits" refers to refund or proration credits. This portion of the invoice can be considered a credit memo. - "applied_credits" refers to previous credits applied to this invoice. See their original_line_item_id to determine where the credit first originated. - "carryforwards" can be ignored. They exist to consume any remaining credit balance. A new credit with the same amount will be created and placed back on the account. "$ref": "#/components/schemas/LegacyCategoryEnum" account: "$ref": "#/components/schemas/AccountMini" bill_for_account_id: type: string title: Bill For Account ID maxLength: 13 description: The UUID of the account responsible for originating the line item. subscription_id: type: string title: Subscription ID description: If the line item is a charge or credit for a subscription, this is its ID. maxLength: 13 plan_id: type: string title: Plan ID description: If the line item is a charge or credit for a plan or add-on, this is the plan's ID. maxLength: 13 plan_code: type: string title: Plan code description: If the line item is a charge or credit for a plan or add-on, this is the plan's code. maxLength: 50 add_on_id: type: string title: Add-on ID description: If the line item is a charge or credit for an add-on this is its ID. maxLength: 13 add_on_code: type: string title: Add-on code description: If the line item is a charge or credit for an add-on, this is its code. maxLength: 50 invoice_id: type: string title: Invoice ID description: Once the line item has been invoiced this will be the invoice's ID. maxLength: 13 invoice_number: type: string title: Invoice number description: 'Once the line item has been invoiced this will be the invoice''s number. If VAT taxation and the Country Invoice Sequencing feature are enabled, invoices will have country-specific invoice numbers for invoices billed to EU countries (ex: FR1001). Non-EU invoices will continue to use the site-level invoice number sequence.' previous_line_item_id: type: string title: Previous line item ID description: Will only have a value if the line item is a credit created from a previous credit, or if the credit was created from a charge refund. maxLength: 13 original_line_item_invoice_id: type: string title: Original line item's invoice ID description: The invoice where the credit originated. Will only have a value if the line item is a credit created from a previous credit, or if the credit was created from a charge refund. maxLength: 13 origin: title: Origin of line item description: A credit created from an original charge will have the value of the charge's origin. "$ref": "#/components/schemas/LineItemOriginEnum" accounting_code: type: string title: Accounting code description: Internal accounting code to help you reconcile your revenue to the correct ledger. Line items created as part of a subscription invoice will use the plan or add-on's accounting code, otherwise the value will only be present if you define an accounting code when creating the line item. maxLength: 20 product_code: type: string title: Product code description: For plan-related line items this will be the plan's code, for add-on related line items it will be the add-on's code. For item-related line items it will be the item's `external_sku`. maxLength: 50 credit_reason_code: title: Credit reason code description: The reason the credit was given when line item is `type=credit`. default: general "$ref": "#/components/schemas/FullCreditReasonCodeEnum" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 amount: type: number format: float title: Total after discounts and taxes description: "`(quantity * unit_amount) - (discount + tax)`" description: type: string title: Description description: Description that appears on the invoice. For subscription related items this will be filled in automatically. maxLength: 255 quantity: type: integer title: Quantity description: This number will be multiplied by the unit amount to compute the subtotal before any discounts or taxes. default: 1 quantity_decimal: type: string title: Quantity Decimal description: A floating-point alternative to Quantity. If this value is present, it will be used in place of Quantity for calculations, and Quantity will be the rounded integer value of this number. This field supports up to 9 decimal places. The Decimal Quantity feature must be enabled to utilize this field. unit_amount: type: number format: float title: Unit amount description: Positive amount for a charge, negative amount for a credit. unit_amount_decimal: type: string title: Unit amount decimal description: Positive amount for a charge, negative amount for a credit. tax_inclusive: type: boolean title: Tax Inclusive? description: Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to utilize this flag. subtotal: type: number format: float title: Total before discounts and taxes description: "`quantity * unit_amount`" discount: type: number format: float title: Discount description: The discount applied to the line item. liability_gl_account_code: type: string title: Accounting code for the ledger account. description: | Unique code to identify the ledger account. Each code must start with a letter or number. The following special characters are allowed: `-_.,:` pattern: "/^[A-Za-z0-9](( *)?[\\-A-Za-z0-9_.,:])*$/" maxLength: 255 revenue_gl_account_code: type: string title: Accounting code for the ledger account. description: | Unique code to identify the ledger account. Each code must start with a letter or number. The following special characters are allowed: `-_.,:` pattern: "/^[A-Za-z0-9](( *)?[\\-A-Za-z0-9_.,:])*$/" maxLength: 255 performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 tax: type: number format: float title: Tax description: The tax amount for the line item. taxable: type: boolean title: Taxable? description: "`true` if the line item is taxable, `false` if it is not." tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on charges, `false` applies tax on charges. If not defined, then defaults to the Plan and Site settings. This attribute does not work for credits (negative line items). Credits are always applied post-tax. Pre-tax discounts should use the Coupons feature." avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the line item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the line item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 tax_code: type: string maxLength: 50 title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes. tax_info: "$ref": "#/components/schemas/TaxInfo" origin_tax_address_source: "$ref": "#/components/schemas/OriginTaxAddressSourceEnum" destination_tax_address_source: "$ref": "#/components/schemas/DestinationTaxAddressSourceEnum" proration_rate: type: number format: float title: Proration rate description: When a line item has been prorated, this is the rate of the proration. Proration rates were made available for line items created after March 30, 2017. For line items created prior to that date, the proration rate will be `null`, even if the line item was prorated. minimum: 0 maximum: 1 refund: type: boolean title: Refund? refunded_quantity: type: integer title: Refunded Quantity description: For refund charges, the quantity being refunded. For non-refund charges, the total quantity refunded (possibly over multiple refunds). refunded_quantity_decimal: type: string title: Refunded Quantity Decimal description: A floating-point alternative to Refunded Quantity. For refund charges, the quantity being refunded. For non-refund charges, the total quantity refunded (possibly over multiple refunds). The Decimal Quantity feature must be enabled to utilize this field. credit_applied: type: number format: float title: Credit Applied description: The amount of credit from this line item that was applied to the invoice. shipping_address: "$ref": "#/components/schemas/ShippingAddress" start_date: type: string format: date-time title: Start date description: If an end date is present, this is value indicates the beginning of a billing time range. If no end date is present it indicates billing for a specific date. end_date: type: string format: date-time title: End date description: If this date is provided, it indicates the end of a time range. custom_fields: "$ref": "#/components/schemas/CustomFields" created_at: type: string format: date-time title: Created at description: When the line item was created. updated_at: type: string format: date-time title: Last updated at description: When the line item was last changed. LineItemRefund: type: object properties: id: type: string title: Line item ID maxLength: 13 quantity: type: integer title: Quantity description: Line item quantity to be refunded. Must be less than or equal to the `quantity_remaining`. If `quantity_decimal`, `amount`, and `percentage` are not present, `quantity` is required. If `amount` or `percentage` is present, `quantity` must be absent. quantity_decimal: type: string title: Quantity Decimal description: Decimal quantity to refund. The `quantity_decimal` will be used to refund charges that has a NOT null quantity decimal. Must be less than or equal to the `quantity_decimal_remaining`. If `quantity`, `amount`, and `percentage` are not present, `quantity_decimal` is required. If `amount` or `percentage` is present, `quantity_decimal` must be absent. The Decimal Quantity feature must be enabled to utilize this field. amount: type: number format: float description: The specific amount to be refunded from the adjustment. Must be less than or equal to the adjustment's remaining balance. If `quantity`, `quantity_decimal` and `percentage` are not present, `amount` is required. If `quantity`, `quantity_decimal`, or `percentage` is present, `amount` must be absent. percentage: type: integer description: The percentage of the adjustment's remaining balance to refund. If `quantity`, `quantity_decimal` and `amount_in_cents` are not present, `percentage` is required. If `quantity`, `quantity_decimal` or `amount_in_cents` is present, `percentage` must be absent. minimum: 1 maximum: 100 prorate: type: boolean title: Prorate description: | Set to `true` if the line item should be prorated; set to `false` if not. This can only be used on line items that have a start and end date. default: false LineItemCreate: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. If `item_code`/`item_id` is part of the request then `currency` is optional, if the site has a single default currency. `currency` is required if `item_code`/`item_id` is present, and there are multiple currencies defined on the site. If `item_code`/`item_id` is not present `currency` is required. maxLength: 3 unit_amount: type: number format: float title: Unit amount description: | A positive or negative amount with `type=charge` will result in a positive `unit_amount`. A positive or negative amount with `type=credit` will result in a negative `unit_amount`. If `item_code`/`item_id` is present, `unit_amount` can be passed in, to override the `Item`'s `unit_amount`. If `item_code`/`item_id` is not present then `unit_amount` is required. tax_inclusive: type: boolean title: Tax Inclusive? default: false description: Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to use this flag. quantity: type: integer title: Quantity description: This number will be multiplied by the unit amount to compute the subtotal before any discounts or taxes. default: 1 description: type: string title: Description description: Description that appears on the invoice. If `item_code`/`item_id` is part of the request then `description` must be absent. maxLength: 255 item_code: type: string title: Item Code description: Unique code to identify an item. Available when the Credit Invoices feature is enabled. pattern: "/^[a-z0-9_+-]+$/" maxLength: 50 item_id: type: string title: Item ID description: System-generated unique identifier for an item. Available when the Credit Invoices feature is enabled. maxLength: 13 revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/LineItemRevenueScheduleTypeEnum" type: title: Type description: Line item type. If `item_code`/`item_id` is present then `type` should not be present. If `item_code`/`item_id` is not present then `type` is required. "$ref": "#/components/schemas/LineItemTypeEnum" credit_reason_code: title: Credit reason code description: The reason the credit was given when line item is `type=credit`. When the Credit Invoices feature is enabled, the value can be set and will default to `general`. When the Credit Invoices feature is not enabled, the value will always be `null`. default: general "$ref": "#/components/schemas/PartialCreditReasonCodeEnum" accounting_code: type: string title: Accounting Code description: Accounting Code for the `LineItem`. If `item_code`/`item_id` is part of the request then `accounting_code` must be absent. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on charges, `false` applies tax on charges. If not defined, then defaults to the Plan and Site settings. This attribute does not work for credits (negative line items). Credits are always applied post-tax. Pre-tax discounts should use the Coupons feature." avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the line item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `LineItem`, then the `avalara_transaction_type` must be absent. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the line item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `LineItem`, then the `avalara_service_type` must be absent. minimum: 0 tax_code: type: string maxLength: 50 title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes. product_code: type: string title: Product code description: Optional field to track a product code or SKU for the line item. This can be used to later reporting on product purchases. For Vertex tax calculations, this field will be used as the Vertex `product` field. If `item_code`/`item_id` is part of the request then `product_code` must be absent. maxLength: 50 origin: title: Origin description: Origin `external_gift_card` is allowed if the Gift Cards feature is enabled on your site and `type` is `credit`. Set this value in order to track gift card credits from external gift cards (like InComm). It also skips billing information requirements. Origin `prepayment` is only allowed if `type` is `charge` and `tax_exempt` is left blank or set to true. This origin creates a charge and opposite credit on the account to be used for future invoices. "$ref": "#/components/schemas/LineItemCreateOriginEnum" custom_fields: "$ref": "#/components/schemas/CustomFields" start_date: type: string format: date-time title: Start date description: If an end date is present, this is value indicates the beginning of a billing time range. If no end date is present it indicates billing for a specific date. Defaults to the current date-time. end_date: type: string format: date-time title: End date description: If this date is provided, it indicates the end of a time range. origin_tax_address_source: "$ref": "#/components/schemas/OriginTaxAddressSourceEnum" destination_tax_address_source: "$ref": "#/components/schemas/DestinationTaxAddressSourceEnum" required: - currency - unit_amount - type PaymentGatewayReferences: type: object title: Payment Gateway References Object description: Array of Payment Gateway References, each a reference to a third-party gateway object of varying types. properties: token: type: string title: Token description: Reference value used when the external token was created. If - Stripe gateway is used, this value will need to be accompanied by its - reference_type. + a Stripe gateway or Ebanx gateway is used, this value will need to be + accompanied by its reference_type. reference_type: type: string title: Reference Type "$ref": "#/components/schemas/PaymentGatewayReferencesEnum" PlanMini: type: object title: Plan mini details description: Just the important parts. properties: id: type: string title: Plan ID maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true code: type: string title: Plan code description: Unique code to identify the plan. This is used in Hosted Payment Page URLs and in the invoice exports. pattern: "/^[a-z0-9_+-]+$/i" maxLength: 50 name: type: string title: Name description: This name describes your plan and will appear on the Hosted Payment Page and the subscriber's invoice. maxLength: 255 Plan: type: object description: Full plan details. properties: id: type: string title: Plan ID maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true code: type: string title: Plan code description: Unique code to identify the plan. This is used in Hosted Payment Page URLs and in the invoice exports. pattern: "/^[a-z0-9_+-]+$/i" maxLength: 50 state: title: State description: The current state of the plan. readOnly: true "$ref": "#/components/schemas/ActiveStateEnum" name: type: string title: Name description: This name describes your plan and will appear on the Hosted Payment Page and the subscriber's invoice. maxLength: 255 description: type: string title: Description description: Optional description, not displayed. interval_unit: title: Interval unit description: Unit for the plan's billing interval. default: months "$ref": "#/components/schemas/IntervalUnitEnum" interval_length: type: integer title: Interval length description: Length of the plan's billing interval in `interval_unit`. default: 1 minimum: 1 trial_unit: title: Trial unit description: Units for the plan's trial period. default: months "$ref": "#/components/schemas/IntervalUnitEnum" trial_length: type: integer title: Trial length description: Length of plan's trial period in `trial_units`. `0` means `no trial`. default: 0 minimum: 0 trial_requires_billing_info: type: boolean title: Trial Requires BillingInfo description: Allow free trial subscriptions to be created without billing info. Should not be used if billing info is needed for initial invoice due to existing uninvoiced charges or setup fee. default: true total_billing_cycles: type: integer title: Total billing cycles description: Automatically terminate subscriptions after a defined number of billing cycles. Number of billing cycles before the plan automatically stops renewing, defaults to `null` for continuous, automatic renewal. minimum: 0 auto_renew: type: boolean title: Auto renew default: true description: Subscriptions will automatically inherit this value once they are active. If `auto_renew` is `true`, then a subscription will automatically renew its term at renewal. If `auto_renew` is `false`, then a subscription will expire at the end of its term. `auto_renew` can be overridden on the subscription record itself. pricing_model: title: Pricing Model "$ref": "#/components/schemas/PricingModelTypeEnum" ramp_intervals: type: array title: Ramp Intervals items: "$ref": "#/components/schemas/PlanRampInterval" custom_fields: "$ref": "#/components/schemas/CustomFields" revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" setup_fee_revenue_schedule_type: title: Setup fee revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" accounting_code: type: string title: Plan accounting code description: Accounting code for invoice line items for the plan. If no value is provided, it defaults to plan's code. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 setup_fee_accounting_code: type: string title: Setup fee accounting code description: Accounting code for invoice line items for the plan's setup fee. If no value is provided, it defaults to plan's accounting code. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 tax_code: type: string maxLength: 50 title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes. tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on the plan, `false` applies tax on the plan." vertex_transaction_type: type: string title: Vertex Transaction Type description: Used by Vertex for tax calculations. Possible values are `sale`, `rental`, `lease`. currencies: type: array title: Pricing items: "$ref": "#/components/schemas/PlanPricing" minItems: 1 hosted_pages: type: object title: Hosted pages settings "$ref": "#/components/schemas/PlanHostedPages" allow_any_item_on_subscriptions: type: boolean title: Allow any item on subscriptions description: | Used to determine whether items can be assigned as add-ons to individual subscriptions. If `true`, items can be assigned as add-ons to individual subscription add-ons. If `false`, only plan add-ons can be used. dunning_campaign_id: type: string title: Dunning Campaign ID description: Unique ID to identify a dunning campaign. Used to specify if a non-default dunning campaign should be assigned to this plan. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at readOnly: true required: - code - name PlanCreate: type: object properties: code: type: string title: Plan code description: Unique code to identify the plan. This is used in Hosted Payment Page URLs and in the invoice exports. pattern: "/^[a-z0-9_+-]+$/i" maxLength: 50 name: type: string title: Name description: This name describes your plan and will appear on the Hosted Payment Page and the subscriber's invoice. maxLength: 255 description: type: string title: Description description: Optional description, not displayed. accounting_code: type: string title: Plan accounting code description: Accounting code for invoice line items for the plan. If no value is provided, it defaults to plan's code. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 interval_unit: title: Interval unit description: Unit for the plan's billing interval. default: months "$ref": "#/components/schemas/IntervalUnitEnum" interval_length: type: integer title: Interval length description: Length of the plan's billing interval in `interval_unit`. default: 1 minimum: 1 trial_unit: title: Trial unit description: Units for the plan's trial period. default: months "$ref": "#/components/schemas/IntervalUnitEnum" trial_length: type: integer title: Trial length description: Length of plan's trial period in `trial_units`. `0` means `no trial`. default: 0 minimum: 0 trial_requires_billing_info: type: boolean title: Trial Requires BillingInfo description: Allow free trial subscriptions to be created without billing info. Should not be used if billing info is needed for initial invoice due to existing uninvoiced charges or setup fee. default: true total_billing_cycles: type: integer title: Total billing cycles description: Automatically terminate plans after a defined number of billing cycles. minimum: 0 auto_renew: type: boolean title: Auto renew default: true description: Subscriptions will automatically inherit this value once they are active. If `auto_renew` is `true`, then a subscription will automatically renew its term at renewal. If `auto_renew` is `false`, then a subscription will expire at the end of its term. `auto_renew` can be overridden on the subscription record itself. pricing_model: title: Pricing Model "$ref": "#/components/schemas/PricingModelTypeEnum" ramp_intervals: type: array title: Ramp Intervals items: "$ref": "#/components/schemas/PlanRampInterval" custom_fields: "$ref": "#/components/schemas/CustomFields" revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 setup_fee_liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 setup_fee_revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 setup_fee_performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 setup_fee_revenue_schedule_type: title: Setup fee revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" setup_fee_accounting_code: type: string title: Setup fee accounting code description: Accounting code for invoice line items for the plan's setup fee. If no value is provided, it defaults to plan's accounting code. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 tax_code: type: string maxLength: 50 title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes. tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on the plan, `false` applies tax on the plan." vertex_transaction_type: type: string title: Vertex Transaction Type description: Used by Vertex for tax calculations. Possible values are `sale`, `rental`, `lease`. currencies: type: array title: Pricing items: "$ref": "#/components/schemas/PlanPricing" minItems: 1 hosted_pages: type: object title: Hosted pages settings "$ref": "#/components/schemas/PlanHostedPages" add_ons: type: array title: Add Ons items: "$ref": "#/components/schemas/AddOnCreate" allow_any_item_on_subscriptions: type: boolean title: Allow any item on subscriptions default: false description: | Used to determine whether items can be assigned as add-ons to individual subscriptions. If `true`, items can be assigned as add-ons to individual subscription add-ons. If `false`, only plan add-ons can be used. dunning_campaign_id: type: string title: Dunning Campaign ID description: Unique ID to identify a dunning campaign. Used to specify if a non-default dunning campaign should be assigned to this plan. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. required: - code - name - currencies PlanHostedPages: type: object properties: success_url: type: string title: Success redirect URL description: URL to redirect to after signup on the hosted payment pages. cancel_url: type: string title: Cancel redirect URL (deprecated) description: URL to redirect to on canceled signup on the hosted payment pages. bypass_confirmation: type: boolean title: Bypass confirmation page? description: If `true`, the customer will be sent directly to your `success_url` after a successful signup, bypassing Recurly's hosted confirmation page. display_quantity: type: boolean title: Display quantity? description: Determines if the quantity field is displayed on the hosted pages for the plan. PlanPricing: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 setup_fee: type: number format: float title: Setup fee description: Amount of one-time setup fee automatically charged at the beginning of a subscription billing cycle. For subscription plans with a trial, the setup fee will be charged at the time of signup. Setup fees do not increase with the quantity of a subscription plan. minimum: 0 maximum: 1000000 unit_amount: type: number format: float title: Unit price description: This field should not be sent when the pricing model is 'ramp'. minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true PlanRampInterval: type: object title: Plan Ramp Interval properties: starting_billing_cycle: type: integer description: Represents the billing cycle where a ramp interval starts. default: 1 currencies: type: array description: Represents the price for the ramp interval. items: "$ref": "#/components/schemas/PlanRampPricing" PlanUpdate: type: object properties: id: type: string title: Plan ID maxLength: 13 readOnly: true code: type: string title: Plan code description: Unique code to identify the plan. This is used in Hosted Payment Page URLs and in the invoice exports. pattern: "/^[a-z0-9_+-]+$/i" maxLength: 50 @@ -23173,1198 +23173,1198 @@ components: title: Subscription Add-on ID. description: | When an id is provided, the existing subscription add-on attributes will persist unless overridden in the request. maxLength: 13 code: type: string title: Add-on code maxLength: 50 description: | If a code is provided without an id, the subscription add-on attributes will be set to the current value for those attributes on the plan add-on unless provided in the request. If `add_on_source` is set to `plan_add_on` or left blank, then plan's add-on `code` should be used. If `add_on_source` is set to `item`, then the `code` from the associated item should be used. add_on_source: "$ref": "#/components/schemas/AddOnSourceEnum" quantity: type: integer title: Quantity minimum: 0 unit_amount: type: number format: float title: Unit amount description: | Allows up to 2 decimal places. Optionally, override the add-on's default unit amount. If the plan add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `unit_amount` cannot be provided. minimum: 0 maximum: 1000000 unit_amount_decimal: type: string title: Unit amount decimal description: | Allows up to 9 decimal places. Optionally, override the add-on's default unit amount. If the plan add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `unit_amount_decimal` cannot be provided. Only supported when the plan add-on's `add_on_type` = `usage`. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided. tiers: type: array title: Tiers items: "$ref": "#/components/schemas/SubscriptionAddOnTier" minItems: 1 description: | If the plan add-on's `tier_type` is `flat`, then `tiers` must be absent. The `tiers` object must include one to many tiers with `ending_quantity` and `unit_amount`. There must be one tier without an `ending_quantity` value which represents the final tier. percentage_tiers: type: array title: Percentage Tiers items: "$ref": "#/components/schemas/SubscriptionAddOnPercentageTier" minItems: 1 description: | If percentage tiers are provided in the request, all existing percentage tiers on the Subscription Add-on will be removed and replaced by the percentage tiers in the request. Use only if add_on.tier_type is tiered or volume and add_on.usage_type is percentage. There must be one tier without an `ending_amount` value which represents the final tier. This feature is currently in development and requires approval and enablement, please contact support. usage_percentage: type: number format: float title: Usage Percentage description: The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. Required if add_on_type is usage and usage_type is percentage. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" SubscriptionAddOnTier: type: object properties: ending_quantity: type: integer title: Ending quantity minimum: 1 maximum: 999999999 description: Ending quantity for the tier. This represents a unit amount for unit-priced add ons. Must be left empty if it is the final tier. unit_amount: type: number format: float title: Unit amount minimum: 0 maximum: 1000000 description: Allows up to 2 decimal places. Optionally, override the tiers' default unit amount. If add-on's `add_on_type` is `usage` and `usage_type` is `percentage`, cannot be provided. unit_amount_decimal: type: string title: Unit amount decimal description: | Allows up to 9 decimal places. Optionally, override tiers' default unit amount. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided. If add-on's `add_on_type` is `usage` and `usage_type` is `percentage`, cannot be provided. usage_percentage: type: string title: Usage Percentage description: "(deprecated) -- Use the percentage_tiers object instead." deprecated: true SubscriptionAddOnPercentageTier: type: object properties: ending_amount: type: number format: float title: Ending amount minimum: 1 maximum: 9999999999999.99 description: Ending amount for the tier. Allows up to 2 decimal places. Must be left empty if it is the final tier. usage_percentage: type: string title: Usage Percentage minimum: 0 maximum: 100 description: | The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places represented as a string. SubscriptionCancel: type: object properties: timeframe: title: Timeframe description: The timeframe parameter controls when the expiration takes place. The `bill_date` timeframe causes the subscription to expire when the subscription is scheduled to bill next. The `term_end` timeframe causes the subscription to continue to bill until the end of the subscription term, then expire. default: term_end "$ref": "#/components/schemas/TimeframeEnum" SubscriptionChange: type: object title: Subscription Change properties: id: type: string title: Subscription Change ID description: The ID of the Subscription Change. object: type: string title: Object type subscription_id: type: string title: Subscription ID description: The ID of the subscription that is going to be changed. maxLength: 13 plan: "$ref": "#/components/schemas/PlanMini" add_ons: type: array title: Add-ons description: These add-ons will be used when the subscription renews. items: "$ref": "#/components/schemas/SubscriptionAddOn" unit_amount: type: number format: float title: Unit amount tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true quantity: type: integer title: Subscription quantity shipping: "$ref": "#/components/schemas/SubscriptionShipping" activate_at: type: string format: date-time title: Activated at readOnly: true activated: type: boolean title: Activated? description: Returns `true` if the subscription change is activated. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" invoice_collection: title: Invoice Collection "$ref": "#/components/schemas/InvoiceCollection" business_entity: title: Business Entity "$ref": "#/components/schemas/BusinessEntityMini" custom_fields: "$ref": "#/components/schemas/CustomFields" created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at readOnly: true billing_info: "$ref": "#/components/schemas/SubscriptionChangeBillingInfo" ramp_intervals: type: array title: Ramp Intervals description: The ramp intervals representing the pricing schedule for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampIntervalResponse" SubscriptionChangeBillingInfo: type: object description: Accept nested attributes for three_d_secure_action_result_token_id properties: three_d_secure_action_result_token_id: type: string title: 3-D Secure action result token ID description: A token generated by Recurly.js after completing a 3-D Secure device fingerprinting or authentication challenge. maxLength: 22 SubscriptionChangeBillingInfoCreate: allOf: - "$ref": "#/components/schemas/SubscriptionChangeBillingInfo" SubscriptionChangeCreate: type: object properties: timeframe: title: Timeframe description: The timeframe parameter controls when the upgrade or downgrade takes place. The subscription change can occur now, when the subscription is next billed, or when the subscription term ends. Generally, if you're performing an upgrade, you will want the change to occur immediately (now). If you're performing a downgrade, you should set the timeframe to `term_end` or `bill_date` so the change takes effect at a scheduled billing date. The `renewal` timeframe option is accepted as an alias for `term_end`. default: now "$ref": "#/components/schemas/ChangeTimeframeEnum" plan_id: type: string title: Plan ID maxLength: 13 description: If you want to change to a new plan, you can provide the plan's code or id. If both are provided the `plan_id` will be used. plan_code: type: string title: New plan code maxLength: 50 description: If you want to change to a new plan, you can provide the plan's code or id. If both are provided the `plan_id` will be used. business_entity_id: type: string title: Business Entity ID description: The `business_entity_id` is the value that represents a specific business entity for an end customer. When `business_entity_id` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. Only allowed if the `timeframe` is not `now`. business_entity_code: type: string title: Business Entity Code description: The `business_entity_code` is the value that represents a specific business entity for an end customer. When `business_entity_code` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. Only allowed if the `timeframe` is not `now`. unit_amount: type: number format: float title: Custom subscription price description: Optionally, sets custom pricing for the subscription, overriding the plan's default unit amount. The subscription's current currency will be used. minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true quantity: type: integer title: Quantity description: Optionally override the default quantity of 1. default: 1 minimum: 0 shipping: "$ref": "#/components/schemas/SubscriptionChangeShippingCreate" coupon_codes: type: array title: Coupon codes description: A list of coupon_codes to be redeemed on the subscription during the change. Only allowed if timeframe is now and you change something about the subscription that creates an invoice. items: type: string add_ons: type: array title: Add-ons description: | If you provide a value for this field it will replace any existing add-ons. So, when adding or modifying an add-on, you need to include the existing subscription add-ons. Unchanged add-ons can be included just using the subscription add-on''s ID: `{"id": "abc123"}`. If this value is omitted your existing add-ons will be unaffected. To remove all existing add-ons, this value should be an empty array.' If a subscription add-on's `code` is supplied without the `id`, `{"code": "def456"}`, the subscription add-on attributes will be set to the current values of the plan add-on unless provided in the request. - If an `id` is passed, any attributes not passed in will pull from the existing subscription add-on - If a `code` is passed, any attributes not passed in will pull from the current values of the plan add-on - Attributes passed in as part of the request will override either of the above scenarios items: "$ref": "#/components/schemas/SubscriptionAddOnUpdate" collection_method: title: Collection method default: automatic "$ref": "#/components/schemas/CollectionMethodEnum" revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" custom_fields: "$ref": "#/components/schemas/CustomFields" po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Net terms description: |- Integer normally paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. During a subscription change, it's not necessary to provide both the `Net Terms Type` and `Net Terms` parameters. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" billing_info: "$ref": "#/components/schemas/SubscriptionChangeBillingInfoCreate" ramp_intervals: type: array title: Ramp Intervals description: The new set of ramp intervals for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampInterval" proration_settings: "$ref": "#/components/schemas/ProrationSettings" SubscriptionChangeShippingCreate: type: object title: Shipping details that will be changed on a subscription description: Shipping addresses are tied to a customer's account. Each account can have up to 20 different shipping addresses, and if you have enabled multiple subscriptions per account, you can associate different shipping addresses to each subscription. properties: method_id: type: string title: Method ID description: The id of the shipping method used to deliver the subscription. To remove shipping set this to `null` and the `amount=0`. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 13 method_code: type: string title: Method Code description: The code of the shipping method used to deliver the subscription. To remove shipping set this to `null` and the `amount=0`. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 50 amount: type: number format: float title: Assigns the subscription's shipping cost. If this is greater than zero then a `method_id` or `method_code` is required. address_id: type: string title: Shipping address ID description: Assign a shipping address from the account's existing shipping addresses. If this and address are both present, address will take precedence. address: "$ref": "#/components/schemas/ShippingAddressCreate" SubscriptionCreate: type: object properties: plan_code: type: string title: Plan code maxLength: 50 description: You must provide either a `plan_code` or `plan_id`. If both are provided the `plan_id` will be used. plan_id: type: string title: Plan ID maxLength: 13 description: You must provide either a `plan_code` or `plan_id`. If both are provided the `plan_id` will be used. business_entity_id: type: string title: Business Entity ID description: The `business_entity_id` is the value that represents a specific business entity for an end customer. When `business_entity_id` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. business_entity_code: type: string title: Business Entity Code description: The `business_entity_code` is the value that represents a specific business entity for an end customer. When `business_entity_code` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. account: "$ref": "#/components/schemas/AccountCreate" billing_info_id: type: string title: Billing Info ID description: The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. shipping: title: Shipping address description: Create a shipping address on the account and assign it to the subscription. "$ref": "#/components/schemas/SubscriptionShippingCreate" collection_method: title: Collection method default: automatic "$ref": "#/components/schemas/CollectionMethodEnum" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 unit_amount: type: number format: float title: Custom subscription pricing description: Override the unit amount of the subscription plan by setting this value. If not provided, the subscription will inherit the price from the subscription plan for the provided currency. minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to use this flag. quantity: type: integer title: Quantity description: Optionally override the default quantity of 1. default: 1 minimum: 0 add_ons: type: array title: Add-ons items: "$ref": "#/components/schemas/SubscriptionAddOnCreate" coupon_codes: type: array title: Coupon codes description: A list of coupon_codes to be redeemed on the subscription or account during the purchase. items: type: string custom_fields: "$ref": "#/components/schemas/CustomFields" trial_ends_at: type: string format: date-time title: Trial ends at description: If set, overrides the default trial behavior for the subscription. When the current date time or a past date time is provided the subscription will begin with no trial phase (overriding any plan default trial). When a future date time is provided the subscription will begin with a trial phase ending at the specified date time. starts_at: type: string format: date-time title: Start date - description: If set, the subscription will begin in the future on this date. + description: If set, the subscription will begin on this specified date. The subscription will apply the setup fee and trial period, unless the plan has no trial. next_bill_date: type: string format: date-time title: Next bill date description: If present, this sets the date the subscription's next billing period will start (`current_period_ends_at`). This can be used to align the subscription’s billing to a specific day of the month. The initial invoice will be prorated for the period between the subscription's activation date and the billing period end date. Subsequent periods will be based off the plan interval. For a subscription with a trial period, this will change when the trial expires. total_billing_cycles: type: integer title: Total billing cycles description: The number of cycles/billing periods in a term. When `remaining_billing_cycles=0`, if `auto_renew=true` the subscription will renew and a new term will begin, otherwise the subscription will expire. minimum: 1 renewal_billing_cycles: type: integer title: Renewal billing cycles description: If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. auto_renew: type: boolean default: true title: Auto renew description: Whether the subscription renews at the end of its term. ramp_intervals: type: array title: Ramp Intervals description: The new set of ramp intervals for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampInterval" revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" terms_and_conditions: type: string title: Terms and conditions description: This will default to the Terms and Conditions text specified on the Invoice Settings page in your Recurly admin. Specify custom notes to add or override Terms and Conditions. Custom notes will stay with a subscription on all renewals. customer_notes: type: string title: Customer notes description: This will default to the Customer Notes text specified on the Invoice Settings. Specify custom notes to add or override Customer Notes. Custom notes will stay with a subscription on all renewals. credit_customer_notes: type: string title: Credit customer notes description: If there are pending credits on the account that will be invoiced during the subscription creation, these will be used as the Customer Notes on the credit invoice. po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Net terms description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" gateway_code: type: string title: Gateway Code description: If present, this subscription's transactions will use the payment gateway with this code. maxLength: 13 transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" gift_card_redemption_code: type: string title: Gift card Redemption Code description: A gift card redemption code to be redeemed on the purchase invoice. bulk: type: boolean description: Optional field to be used only when needing to bypass the 60 second limit on creating subscriptions. Should only be used when creating subscriptions in bulk from the API. default: false required: - plan_code - currency - account SubscriptionPurchase: type: object properties: plan_code: type: string title: Plan code plan_id: type: string title: Plan ID maxLength: 13 unit_amount: type: number format: float title: Custom subscription pricing description: Override the unit amount of the subscription plan by setting this value. If not provided, the subscription will inherit the price from the subscription plan for the provided currency. minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to use this flag. quantity: type: integer title: Quantity description: Optionally override the default quantity of 1. default: 1 minimum: 0 add_ons: type: array title: Add-ons items: "$ref": "#/components/schemas/SubscriptionAddOnCreate" custom_fields: "$ref": "#/components/schemas/CustomFields" shipping: title: Shipping address description: Create a shipping address on the account and assign it to the subscription. "$ref": "#/components/schemas/SubscriptionShippingPurchase" trial_ends_at: type: string format: date-time title: Trial ends at description: If set, overrides the default trial behavior for the subscription. When the current date time or a past date time is provided the subscription will begin with no trial phase (overriding any plan default trial). When a future date time is provided the subscription will begin with a trial phase ending at the specified date time. starts_at: type: string format: date-time title: Start date - description: If set, the subscription will begin in the future on this date. + description: If set, the subscription will begin on this specified date. The subscription will apply the setup fee and trial period, unless the plan has no trial. next_bill_date: type: string format: date-time title: Next bill date description: If present, this sets the date the subscription's next billing period will start (`current_period_ends_at`). This can be used to align the subscription’s billing to a specific day of the month. The initial invoice will be prorated for the period between the subscription's activation date and the billing period end date. Subsequent periods will be based off the plan interval. For a subscription with a trial period, this will change when the trial expires. total_billing_cycles: type: integer title: Total billing cycles description: The number of cycles/billing periods in a term. When `remaining_billing_cycles=0`, if `auto_renew=true` the subscription will renew and a new term will begin, otherwise the subscription will expire. minimum: 1 renewal_billing_cycles: type: integer title: Renewal billing cycles description: If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. auto_renew: type: boolean default: true title: Auto renew description: Whether the subscription renews at the end of its term. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" ramp_intervals: type: array title: Ramp Intervals description: The new set of ramp intervals for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampInterval" bulk: type: boolean description: Optional field to be used only when needing to bypass the 60 second limit on creating subscriptions. Should only be used when creating subscriptions in bulk from the API. default: false required: - plan_code SubscriptionUpdate: type: object properties: collection_method: title: Change collection method "$ref": "#/components/schemas/CollectionMethodEnum" custom_fields: "$ref": "#/components/schemas/CustomFields" remaining_billing_cycles: type: integer title: Remaining billing cycles description: The remaining billing cycles in the current term. renewal_billing_cycles: type: integer title: Renewal billing cycles description: If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. auto_renew: type: boolean default: true title: Auto renew description: Whether the subscription renews at the end of its term. next_bill_date: type: string format: date-time title: Next bill date description: If present, this sets the date the subscription's next billing period will start (`current_period_ends_at`). This can be used to align the subscription’s billing to a specific day of the month. For a subscription in a trial period, this will change when the trial expires. This parameter is useful for postponement of a subscription to change its billing date without proration. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" terms_and_conditions: type: string title: Terms and conditions description: Specify custom notes to add or override Terms and Conditions. Custom notes will stay with a subscription on all renewals. customer_notes: type: string title: Customer notes description: Specify custom notes to add or override Customer Notes. Custom notes will stay with a subscription on all renewals. po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Terms that the subscription is due on description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" gateway_code: type: string title: Gateway Code description: If present, this subscription's transactions will use the payment gateway with this code. maxLength: 13 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true shipping: "$ref": "#/components/schemas/SubscriptionShippingUpdate" billing_info_id: type: string title: Billing Info ID description: The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. SubscriptionPause: type: object properties: remaining_pause_cycles: type: integer title: Remaining pause cycles description: Number of billing cycles to pause the subscriptions. A value of 0 will cancel any pending pauses on the subscription. required: - remaining_pause_cycles SubscriptionShipping: type: object title: Subscription shipping details properties: object: type: string title: Object type address: "$ref": "#/components/schemas/ShippingAddress" method: "$ref": "#/components/schemas/ShippingMethodMini" amount: type: number format: float title: Subscription's shipping cost SubscriptionShippingCreate: type: object title: Subscription shipping details properties: address: "$ref": "#/components/schemas/ShippingAddressCreate" address_id: type: string title: Shipping address ID description: Assign a shipping address from the account's existing shipping addresses. If `address_id` and `address` are both present, `address` will be used. maxLength: 13 method_id: type: string title: Service ID description: The id of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 13 method_code: type: string title: Service Code description: The code of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 50 amount: type: number format: float title: Assigns the subscription's shipping cost. If this is greater than zero then a `method_id` or `method_code` is required. SubscriptionShippingUpdate: type: object title: Subscription shipping details properties: object: type: string title: Object type address: "$ref": "#/components/schemas/ShippingAddressCreate" address_id: type: string title: Shipping Address ID description: Assign a shipping address from the account's existing shipping addresses. maxLength: 13 SubscriptionShippingPurchase: type: object title: Subscription shipping details properties: method_id: type: string title: Service ID description: The id of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 13 method_code: type: string title: Service Code description: The code of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 50 amount: type: number format: float title: Assigns the subscription's shipping cost. If this is greater than zero then a `method_id` or `method_code` is required. SubscriptionRampInterval: type: object title: Subscription Ramp Interval properties: starting_billing_cycle: type: integer description: Represents the billing cycle where a ramp interval starts. default: 1 unit_amount: type: integer description: Represents the price for the ramp interval. SubscriptionRampIntervalResponse: type: object title: Subscription Ramp Interval properties: starting_billing_cycle: type: integer description: Represents the billing cycle where a ramp interval starts. remaining_billing_cycles: type: integer description: Represents how many billing cycles are left in a ramp interval. starting_on: type: string format: date-time title: Date the ramp interval starts ending_on: type: string format: date-time title: Date the ramp interval ends unit_amount: type: number format: float title: Unit price description: Represents the price for the ramp interval. TaxInfo: type: object title: Tax info description: Only for merchants using Recurly's In-The-Box taxes. properties: type: type: string title: Type description: Provides the tax type as "vat" for EU VAT, "usst" for U.S. Sales Tax, or the 2 letter country code for country level tax types like Canada, Australia, New Zealand, Israel, and all non-EU European countries. Not present when Avalara for Communications is enabled. region: type: string title: Region description: Provides the tax region applied on an invoice. For U.S. Sales Tax, this will be the 2 letter state code. For EU VAT this will be the 2 letter country code. For all country level tax types, this will display the regional tax, like VAT, GST, or PST. Not present when Avalara for Communications is enabled. rate: type: number format: float title: Rate description: The combined tax rate. Not present when Avalara for Communications is enabled. tax_details: type: array description: Provides additional tax details for Communications taxes when Avalara for Communications is enabled or Canadian Sales Tax when there is tax applied at both the country and province levels. This will only be populated for the Invoice response when fetching a single invoice and not for the InvoiceList or LineItemList. Only populated for a single LineItem fetch when Avalara for Communications is enabled. items: "$ref": "#/components/schemas/TaxDetail" TaxDetail: type: object title: Tax detail properties: type: type: string title: Type description: Provides the tax type for the region or type of Comminications tax when Avalara for Communications is enabled. For Canadian Sales Tax, this will be GST, HST, QST or PST. region: type: string title: Region description: Provides the tax region applied on an invoice. For Canadian Sales Tax, this will be either the 2 letter province code or country code. Not present when Avalara for Communications is enabled. rate: type: number format: float title: Rate description: Provides the tax rate for the region. tax: type: number format: float title: Tax description: The total tax applied for this tax type. name: type: string title: Name description: Provides the name of the Communications tax applied. Present only when Avalara for Communications is enabled. level: type: string title: Level description: Provides the jurisdiction level for the Communications tax applied. Example values include city, state and federal. Present only when Avalara for Communications is enabled. billable: type: boolean title: Billable description: Whether or not the line item is taxable. Only populated for a single LineItem fetch when Avalara for Communications is enabled. Transaction: type: object properties: id: type: string title: Transaction ID maxLength: 13 object: type: string title: Object type uuid: type: string title: Recurly UUID description: The UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI. maxLength: 32 original_transaction_id: type: string title: Original Transaction ID description: If this transaction is a refund (`type=refund`), this will be the ID of the original transaction on the invoice being refunded. maxLength: 13 account: "$ref": "#/components/schemas/AccountMini" indicator: "$ref": "#/components/schemas/TransactionIndicatorEnum" invoice: "$ref": "#/components/schemas/InvoiceMini" merchant_reason_code: "$ref": "#/components/schemas/TransactionMerchantReasonCodeEnum" voided_by_invoice: "$ref": "#/components/schemas/InvoiceMini" subscription_ids: type: array title: Subscription IDs description: If the transaction is charging or refunding for one or more subscriptions, these are their IDs. items: type: string title: Subscription ID maxLength: 13 type: title: Transaction type description: | - `authorization` – verifies billing information and places a hold on money in the customer's account. - `capture` – captures funds held by an authorization and completes a purchase. - `purchase` – combines the authorization and capture in one transaction. - `refund` – returns all or a portion of the money collected in a previous transaction to the customer. - `verify` – a $0 or $1 transaction used to verify billing information which is immediately voided. "$ref": "#/components/schemas/TransactionTypeEnum" origin: title: Origin of transaction description: Describes how the transaction was triggered. "$ref": "#/components/schemas/TransactionOriginEnum" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 amount: type: number format: float title: Amount description: Total transaction amount sent to the payment gateway. status: title: Transaction status description: The current transaction status. Note that the status may change, e.g. a `pending` transaction may become `declined` or `success` may later become `void`. "$ref": "#/components/schemas/TransactionStatusEnum" success: type: boolean title: Success? description: Did this transaction complete successfully? backup_payment_method_used: type: boolean title: Backup Payment Method Used? description: Indicates if the transaction was completed using a backup payment refunded: type: boolean title: Refunded? description: Indicates if part or all of this transaction was refunded. billing_address: "$ref": "#/components/schemas/AddressWithName" collection_method: description: The method by which the payment was collected. "$ref": "#/components/schemas/CollectionMethodEnum" payment_method: "$ref": "#/components/schemas/PaymentMethod" ip_address_v4: type: string title: IP address description: | IP address provided when the billing information was collected: - When the customer enters billing information into the Recurly.js or Hosted Payment Pages, Recurly records the IP address. - When the merchant enters billing information using the API, the merchant may provide an IP address. - When the merchant enters billing information using the UI, no IP address is recorded. ip_address_country: type: string title: Origin IP address country, 2-letter ISO 3166-1 alpha-2 code, if known by Recurly. status_code: type: string title: Status code status_message: type: string title: Status message description: For declined (`success=false`) transactions, the message displayed to the merchant. customer_message: type: string title: Customer message description: For declined (`success=false`) transactions, the message displayed to the customer. customer_message_locale: type: string title: Language code for the message payment_gateway: type: object x-class-name: TransactionPaymentGateway properties: id: type: string object: type: string title: Object type type: type: string name: type: string gateway_message: type: string title: Gateway message description: Transaction message from the payment gateway. gateway_reference: type: string title: Gateway reference description: Transaction reference number from the payment gateway. gateway_approval_code: type: string title: Transaction approval code from the payment gateway. gateway_response_code: type: string title: For declined transactions (`success=false`), this field lists the gateway error code. gateway_response_time: type: number format: float title: Gateway response time description: Time, in seconds, for gateway to process the transaction. gateway_response_values: type: object title: Gateway response values description: The values in this field will vary from gateway to gateway. cvv_check: title: CVV check description: When processed, result from checking the CVV/CVC value on the transaction. @@ -26055,1029 +26055,1030 @@ components: GiftCardList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/GiftCard" GiftCard: type: object description: Gift card details properties: id: title: Gift card ID type: string maxLength: 13 readOnly: true object: title: Object type type: string readOnly: true gifter_account_id: title: Gifter account ID type: string maxLength: 13 description: The ID of the account that purchased the gift card. recipient_account_id: title: Recipient account ID type: string maxLength: 13 description: The ID of the account that redeemed the gift card redemption code. Does not have a value until gift card is redeemed. purchase_invoice_id: title: Purchase invoice ID type: string maxLength: 13 description: The ID of the invoice for the gift card purchase made by the gifter. redemption_invoice_id: title: Redemption invoice ID type: string maxLength: 13 description: The ID of the invoice for the gift card redemption made by the recipient. Does not have a value until gift card is redeemed. redemption_code: title: Redemption code type: string description: The unique redemption code for the gift card, generated by Recurly. Will be 16 characters, alphanumeric, displayed uppercase, but accepted in any case at redemption. Used by the recipient account to create a credit in the amount of the `unit_amount` on their account. balance: title: Remaining balance type: number format: float description: The remaining credit on the recipient account associated with this gift card. Only has a value once the gift card has been redeemed. Can be used to create gift card balance displays for your customers. product_code: title: Product code type: string description: The product code or SKU of the gift card product. unit_amount: title: Purchase unit amount type: number format: float description: The amount of the gift card, which is the amount of the charge to the gifter account and the amount of credit that is applied to the recipient account upon successful redemption. currency: title: Currency type: string description: 3-letter ISO 4217 currency code. maxLength: 3 delivery: title: Delivery details description: The delivery details for the gift card. readOnly: true "$ref": "#/components/schemas/GiftCardDelivery" performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true delivered_at: type: string format: date-time title: Delivered at readOnly: true description: When the gift card was sent to the recipient by Recurly via email, if method was email and the "Gift Card Delivery" email template was enabled. This will be empty for post delivery or email delivery where the email template was disabled. redeemed_at: type: string format: date-time title: Redeemed at readOnly: true description: When the gift card was redeemed by the recipient. canceled_at: type: string format: date-time title: Canceled at readOnly: true description: When the gift card was canceled. GiftCardCreate: type: object description: Gift card details properties: product_code: title: Product code type: string description: The product code or SKU of the gift card product. unit_amount: title: Purchase unit amount type: number format: float description: The amount of the gift card, which is the amount of the charge to the gifter account and the amount of credit that is applied to the recipient account upon successful redemption. currency: title: Currency type: string description: 3-letter ISO 4217 currency code. maxLength: 3 delivery: title: Delivery details description: The delivery details for the gift card. readOnly: true "$ref": "#/components/schemas/GiftCardDeliveryCreate" gifter_account: title: Gifter account details description: Block of account details for the gifter. This references an existing account_code. readOnly: true "$ref": "#/components/schemas/AccountPurchase" required: - product_code - unit_amount - currency - delivery - gifter_account GiftCardDeliveryCreate: type: object description: Gift card delivery details properties: method: title: Delivery method description: Whether the delivery method is email or postal service. "$ref": "#/components/schemas/DeliveryMethodEnum" email_address: title: Recipient email address type: string description: The email address of the recipient. Required if `method` is `email`. deliver_at: type: string format: date-time title: Deliver at readOnly: true description: When the gift card should be delivered to the recipient. If null, the gift card will be delivered immediately. If a datetime is provided, the delivery will be in an hourly window, rounding down. For example, 6:23 pm will be in the 6:00 pm hourly batch. first_name: title: Recipient first name type: string description: The first name of the recipient. last_name: title: Recipient last name type: string description: The last name of the recipient. recipient_address: title: Recipient address description: Address information for the recipient. Required if `method` is `post`. "$ref": "#/components/schemas/Address" gifter_name: title: Gifter name type: string description: The name of the gifter for the purpose of a message displayed to the recipient. personal_message: title: Personal message type: string maxLength: 255 description: The personal message from the gifter to the recipient. required: - method GiftCardDelivery: type: object description: Gift card delivery details properties: method: title: Delivery method description: Whether the delivery method is email or postal service. "$ref": "#/components/schemas/DeliveryMethodEnum" email_address: title: Recipient email address type: string description: The email address of the recipient. deliver_at: type: string format: date-time title: Deliver at readOnly: true description: When the gift card should be delivered to the recipient. If null, the gift card will be delivered immediately. If a datetime is provided, the delivery will be in an hourly window, rounding down. For example, 6:23 pm will be in the 6:00 pm hourly batch. first_name: title: Recipient first name type: string description: The first name of the recipient. last_name: title: Recipient last name type: string description: The last name of the recipient. recipient_address: title: Recipient address description: Address information for the recipient. "$ref": "#/components/schemas/Address" gifter_name: title: Gifter name type: string description: The name of the gifter for the purpose of a message displayed to the recipient. personal_message: title: Personal message type: string maxLength: 255 description: The personal message from the gifter to the recipient. GiftCardRedeem: type: object description: The information necessary to redeem a gift card. properties: recipient_account: title: Recipient account description: The account for the recipient of the gift card. "$ref": "#/components/schemas/AccountReference" required: - recipient_account Error: type: object properties: type: title: Type "$ref": "#/components/schemas/ErrorTypeEnum" message: type: string title: Message params: type: array title: Parameter specific errors items: type: object properties: param: type: string ErrorMayHaveTransaction: allOf: - "$ref": "#/components/schemas/Error" - type: object properties: transaction_error: type: object x-class-name: TransactionError title: Transaction error details description: This is only included on errors with `type=transaction`. properties: object: type: string title: Object type transaction_id: type: string title: Transaction ID maxLength: 13 category: title: Category "$ref": "#/components/schemas/ErrorCategoryEnum" code: title: Code "$ref": "#/components/schemas/ErrorCodeEnum" decline_code: title: Decline code "$ref": "#/components/schemas/DeclineCodeEnum" message: type: string title: Customer message merchant_advice: type: string title: Merchant message three_d_secure_action_token_id: type: string title: 3-D Secure action token id description: Returned when 3-D Secure authentication is required for a transaction. Pass this value to Recurly.js so it can continue the challenge flow. maxLength: 22 fraud_info: "$ref": "#/components/schemas/TransactionFraudInfo" RelatedTypeEnum: type: string enum: - account - item - plan - subscription - charge RefundTypeEnum: type: string enum: - full - none - partial AlphanumericSortEnum: type: string enum: - asc - desc UsageSortEnum: type: string default: usage_timestamp enum: - recorded_timestamp - usage_timestamp UsageTypeEnum: type: string enum: - price - percentage title: Usage Type description: Type of usage, returns usage type if `add_on_type` is `usage`. UsageCalculationTypeEnum: type: string description: The type of calculation to be employed for an add-on. Cumulative billing will sum all usage records created in the current billing cycle. Last-in-period billing will apply only the most recent usage record in the billing period. If no value is specified, cumulative billing will be used. enum: - cumulative - last_in_period BillingStatusEnum: type: string default: unbilled enum: - unbilled - billed - all TimestampSortEnum: type: string enum: - created_at - updated_at ActiveStateEnum: type: string enum: - active - inactive FilterSubscriptionStateEnum: type: string enum: - active - canceled - expired - future - in_trial - live FilterLimitedSubscriptionStateEnum: type: string enum: - active - canceled - expired - future TrueEnum: type: string enum: - true LineItemStateEnum: type: string enum: - invoiced - pending LineItemTypeEnum: type: string enum: - charge - credit FilterTransactionTypeEnum: type: string enum: - authorization - capture - payment - purchase - refund - verify FilterInvoiceTypeEnum: type: string enum: - charge - credit - legacy - non-legacy FilterRedeemedEnum: type: string enum: - true - false ChannelEnum: type: string enum: - advertising - blog - direct_traffic - email - events - marketing_content - organic_search - other - outbound_sales - paid_search - public_relations - referral - social_media PreferredLocaleEnum: type: string enum: - da-DK - de-CH - de-DE - en-AU - en-CA - en-GB - en-IE - en-NZ - en-US - es-ES - es-MX - es-US - fi-FI - fr-BE - fr-CA - fr-CH - fr-FR - hi-IN - it-IT - ja-JP - ko-KR - nl-BE - nl-NL - pl-PL - pt-BR - pt-PT - ro-RO - ru-RU - sk-SK - sv-SE - tr-TR - zh-CN BillToEnum: type: string enum: - parent - self DeliveryMethodEnum: type: string enum: - email - post PaymentGatewayReferencesEnum: type: string description: The type of reference token. Required if token is passed in for - Stripe Gateway. + Stripe Gateway or Ebanx UPI. enum: - stripe_confirmation_token - stripe_customer - stripe_payment_method + - upi_vpa GatewayTransactionTypeEnum: type: string enum: - moto KountDecisionEnum: type: string enum: - approve - decline - escalate - review CouponStateEnum: type: string enum: - expired - maxed_out - redeemable CouponDurationEnum: type: string enum: - forever - single_use - temporal TemporalUnitEnum: type: string enum: - day - month - week - year FreeTrialUnitEnum: type: string enum: - day - month - week RedemptionResourceEnum: type: string enum: - account - subscription CouponTypeEnum: type: string enum: - bulk - single_code DiscountTypeEnum: type: string enum: - fixed - free_trial - percent AddOnSourceEnum: type: string title: Add-on source description: | Used to determine where the associated add-on data is pulled from. If this value is set to `plan_add_on` or left blank, then add-on data will be pulled from the plan's add-ons. If the associated `plan` has `allow_any_item_on_subscriptions` set to `true` and this field is set to `item`, then the associated add-on data will be pulled from the site's item catalog. default: plan_add_on enum: - plan_add_on - item AddOnTypeEnum: type: string enum: - fixed - usage title: Add-on Type description: Whether the add-on type is fixed, or usage-based. AddOnTypeCreateEnum: type: string enum: - fixed - usage title: Add-on Type description: Whether the add-on type is fixed, or usage-based. default: fixed UsageTypeCreateEnum: type: string enum: - price - percentage title: Usage Type description: | Type of usage, required if `add_on_type` is `usage`. See our [Guide](https://recurly.com/developers/guides/usage-based-billing-guide.html) for an overview of how to configure usage add-ons. TierTypeEnum: type: string title: Tier type description: | The pricing model for the add-on. For more information, [click here](https://docs.recurly.com/docs/billing-models#section-quantity-based). See our [Guide](https://recurly.com/developers/guides/item-addon-guide.html) for an overview of how to configure quantity-based pricing models. default: flat enum: - flat - tiered - stairstep - volume UsageTimeframeEnum: type: string title: Usage Timeframe description: The time at which usage totals are reset for billing purposes. enum: - billing_period - subscription_term default: billing_period UsageTimeframeCreateEnum: type: string title: Usage Timeframe description: | The time at which usage totals are reset for billing purposes. Allows for `tiered` add-ons to accumulate usage over the course of multiple billing periods. enum: - billing_period - subscription_term default: billing_period CreditPaymentActionEnum: type: string enum: - payment - reduction - refund - write_off UserAccessEnum: type: string enum: - api_only - read_only - write - set_only PricingModelTypeEnum: type: string enum: - fixed - ramp default: fixed description: | A fixed pricing model has the same price for each billing period. A ramp pricing model defines a set of Ramp Intervals, where a subscription changes price on a specified cadence of billing periods. The price change could be an increase or decrease. RevenueScheduleTypeEnum: type: string enum: - at_range_end - at_range_start - evenly - never NetTermsTypeEnum: type: string title: Net Terms Type description: | Optionally supplied string that may be either `net` or `eom` (end-of-month). When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date. When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month. enum: - net - eom default: net InvoiceTypeEnum: type: string enum: - charge - credit - legacy OriginEnum: type: string enum: - carryforward_credit - carryforward_gift_credit - credit - external_refund - gift_card - immediate_change - import - line_item_refund - open_amount_refund - prepayment - purchase - refund - renewal - termination - usage_correction - write_off InvoiceStateEnum: type: string default: all enum: - open - pending - processing - past_due - paid - closed - failed - voided InvoiceStateQueryParamEnum: type: string default: all enum: - pending - past_due - paid - failed CollectionMethodEnum: type: string enum: - automatic - manual InvoiceRefundTypeEnum: type: string enum: - amount - percentage - line_items RefundMethodEnum: type: string enum: - all_credit - all_transaction - credit_first - transaction_first ExternalPaymentMethodEnum: type: string enum: - bacs - ach - amazon - apple_pay - braintree_apple_pay - check - credit_card - eft - google_pay - money_order - other - paypal - roku - sepadirectdebit - wire_transfer LineItemRevenueScheduleTypeEnum: type: string enum: - at_invoice - at_range_end - at_range_start - evenly - never LegacyCategoryEnum: type: string enum: - applied_credit - carryforward - charge - credit LineItemOriginEnum: type: string enum: - add_on - add_on_trial - carryforward - coupon - credit - debit - one_time - plan - plan_trial - setup_fee - prepayment FullCreditReasonCodeEnum: type: string enum: - general - gift_card - promotional - refund - service - write_off PartialCreditReasonCodeEnum: type: string enum: - general - promotional - service LineItemCreateOriginEnum: type: string enum: - external_gift_card - prepayment IntervalUnitEnum: type: string enum: - days - months AddressRequirementEnum: type: string enum: - full - none - streetzip - zip SiteModeEnum: type: string enum: - development - production - sandbox FeaturesEnum: type: string enum: - credit_memos - manual_invoicing - only_bill_what_changed - subscription_terms SubscriptionStateEnum: type: string enum: - active - canceled - expired - failed - future - paused TimeframeEnum: type: string enum: - bill_date - term_end ChangeTimeframeEnum: type: string enum: - bill_date - now - renewal - term_end TransactionTypeEnum: type: string enum: - authorization - capture - purchase - refund - verify TransactionOriginEnum: type: string enum: - api - chargeback - external_recovery - force_collect - hpp - merchant - recurly_admin - recurlyjs - recurring - refunded_externally - transparent TransactionStatusEnum: type: string enum: - chargeback - declined - error - pending - processing - scheduled - success - void CvvCheckEnum: type: string enum: - D - I - M - N - P - S - U - X AvsCheckEnum: type: string enum: - A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z CouponCodeStateEnum: type: string enum: - expired - inactive - maxed_out - redeemable PaymentMethodEnum: type: string enum: - bacs - amazon - amazon_billing_agreement - apple_pay - bank_account_info - braintree_apple_pay - check - credit_card - eft - gateway_token - google_pay - iban_bank_account - money_order - other - paypal - paypal_billing_agreement - roku - sepadirectdebit - venmo - wire_transfer - braintree_v_zero - boleto - cash_app CardTypeEnum: type: string enum: - American Express - Dankort - Diners Club - Discover - ELO - Forbrugsforeningen - Hipercard - JCB - Laser - Maestro - MasterCard - Test Card - Union Pay - Unknown - Visa - Tarjeta Naranja CardNetworkEnum: type: string enum: - Bancontact - CartesBancaires - Dankort - MasterCard - Visa CardFundingSourceEnum: type: string enum: - credit - debit - charge - prepaid - deferred_debit AccountTypeEnum: type: string enum: - checking - savings ErrorTypeEnum: type: string enum: - bad_request - immutable_subscription - internal_server_error - invalid_api_key - invalid_api_version - invalid_content_type - invalid_permissions - invalid_token - missing_feature - not_found - rate_limited - service_not_available - simultaneous_request - tax_service_error - transaction - unauthorized - unavailable_in_api_version - unknown_api_version - validation ErrorCategoryEnum: type: string enum: - three_d_secure_required
recurly/recurly-client-php
c7e69705070b5de4524e7ce61097f5386d4d4e09
4.58.0
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index fce6da8..075e0aa 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 4.57.0 +current_version = 4.58.0 parse = (?P<major>\d+) \.(?P<minor>\d+) \.(?P<patch>\d+) serialize = {major}.{minor}.{patch} [bumpversion:file:composer.json] [bumpversion:file:lib/recurly/version.php] diff --git a/CHANGELOG.md b/CHANGELOG.md index 1602397..62d110e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,514 +1,525 @@ # Changelog +## [4.58.0](https://github.com/recurly/recurly-client-php/tree/4.58.0) (2025-03-14) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.57.0...4.58.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 [#835](https://github.com/recurly/recurly-client-php/pull/835) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.57.0](https://github.com/recurly/recurly-client-php/tree/4.57.0) (2025-02-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.56.0...4.57.0) **Merged Pull Requests** - Add `funding_source` to `BillingInfo` and `Transaction` [#834](https://github.com/recurly/recurly-client-php/pull/834) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#831](https://github.com/recurly/recurly-client-php/pull/831) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.56.0](https://github.com/recurly/recurly-client-php/tree/4.56.0) (2024-12-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.55.0...4.56.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#830](https://github.com/recurly/recurly-client-php/pull/830) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.55.0](https://github.com/recurly/recurly-client-php/tree/4.55.0) (2024-12-02) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.54.0...4.55.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#829](https://github.com/recurly/recurly-client-php/pull/829) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#826](https://github.com/recurly/recurly-client-php/pull/826) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.54.0](https://github.com/recurly/recurly-client-php/tree/4.54.0) (2024-08-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.53.0...4.54.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (add UUID to external subscriptions) [#823](https://github.com/recurly/recurly-client-php/pull/823) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.53.0](https://github.com/recurly/recurly-client-php/tree/4.53.0) (2024-08-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.52.0...4.53.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#821](https://github.com/recurly/recurly-client-php/pull/821) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.52.0](https://github.com/recurly/recurly-client-php/tree/4.52.0) (2024-07-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.51.0...4.52.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Taxable Address Control, RevRec) [#817](https://github.com/recurly/recurly-client-php/pull/817) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.51.0](https://github.com/recurly/recurly-client-php/tree/4.51.0) (2024-05-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.50.0...4.51.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#814](https://github.com/recurly/recurly-client-php/pull/814) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.50.0](https://github.com/recurly/recurly-client-php/tree/4.50.0) (2024-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.49.0...4.50.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entity Use Code) [#812](https://github.com/recurly/recurly-client-php/pull/812) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.49.0](https://github.com/recurly/recurly-client-php/tree/4.49.0) (2024-05-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.48.0...4.49.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Proration Settings) [#810](https://github.com/recurly/recurly-client-php/pull/810) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.48.0](https://github.com/recurly/recurly-client-php/tree/4.48.0) (2024-05-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.47.0...4.48.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Auth & Capture) [#808](https://github.com/recurly/recurly-client-php/pull/808) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.47.0](https://github.com/recurly/recurly-client-php/tree/4.47.0) (2024-03-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.46.0...4.47.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#803](https://github.com/recurly/recurly-client-php/pull/803) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.46.0](https://github.com/recurly/recurly-client-php/tree/4.46.0) (2024-02-20) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.45.0...4.46.0) **Merged Pull Requests** - Add invoice state param for v2021-02-25 [#799](https://github.com/recurly/recurly-client-php/pull/799) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.45.0](https://github.com/recurly/recurly-client-php/tree/4.45.0) (2024-01-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.44.0...4.45.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#789](https://github.com/recurly/recurly-client-php/pull/789) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.44.0](https://github.com/recurly/recurly-client-php/tree/4.44.0) (2024-01-18) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.43.0...4.44.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#788](https://github.com/recurly/recurly-client-php/pull/788) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.43.0](https://github.com/recurly/recurly-client-php/tree/4.43.0) (2023-12-06) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.42.0...4.43.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Payment Phases) [#785](https://github.com/recurly/recurly-client-php/pull/785) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.42.0](https://github.com/recurly/recurly-client-php/tree/4.42.0) (2023-11-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.41.0...4.42.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#783](https://github.com/recurly/recurly-client-php/pull/783) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.41.0](https://github.com/recurly/recurly-client-php/tree/4.41.0) (2023-08-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.40.0...4.41.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (`VATNumber`, `LifecycleDecline`) [#782](https://github.com/recurly/recurly-client-php/pull/782) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.40.0](https://github.com/recurly/recurly-client-php/tree/4.40.0) (2023-08-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.39.0...4.40.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (action_result) [#781](https://github.com/recurly/recurly-client-php/pull/781) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.39.0](https://github.com/recurly/recurly-client-php/tree/4.39.0) (2023-07-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.37.0...4.39.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Ramp Dates, Net Terms, Invoice Business Entity) [#779](https://github.com/recurly/recurly-client-php/pull/779) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (App Management - External Subscriptions) [#777](https://github.com/recurly/recurly-client-php/pull/777) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.37.0](https://github.com/recurly/recurly-client-php/tree/4.37.0) (2023-06-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.36.0...4.37.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Multiple Business Entities) [#769](https://github.com/recurly/recurly-client-php/pull/769) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.36.0](https://github.com/recurly/recurly-client-php/tree/4.36.0) (2023-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.35.0...4.36.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Products & References) [#766](https://github.com/recurly/recurly-client-php/pull/766) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.35.0](https://github.com/recurly/recurly-client-php/tree/4.35.0) (2023-05-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.34.0...4.35.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (gateway_attributes on PaymentMethod) [#764](https://github.com/recurly/recurly-client-php/pull/764) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#747](https://github.com/recurly/recurly-client-php/pull/747) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.28.0](https://github.com/recurly/recurly-client-php/tree/4.28.0) (2023-02-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.27.0...4.28.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (GiftCard endpoints and new transaction error support) [#745](https://github.com/recurly/recurly-client-php/pull/745) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.27.0](https://github.com/recurly/recurly-client-php/tree/4.27.0) (2023-01-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.26.0...4.27.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Custom Fields on Line Items) [#738](https://github.com/recurly/recurly-client-php/pull/738) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.26.0](https://github.com/recurly/recurly-client-php/tree/4.26.0) (2023-01-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.25.0...4.26.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Account Preferred Time Zone) [#736](https://github.com/recurly/recurly-client-php/pull/736) ([douglasmiller](https://github.com/douglasmiller)) ## [4.25.0](https://github.com/recurly/recurly-client-php/tree/4.25.0) (2022-11-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.24.0...4.25.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Apply Credit Balance feature) [#732](https://github.com/recurly/recurly-client-php/pull/732) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.24.0](https://github.com/recurly/recurly-client-php/tree/4.24.0) (2022-11-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.23.0...4.24.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Subscriptions feature) [#729](https://github.com/recurly/recurly-client-php/pull/729) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#728](https://github.com/recurly/recurly-client-php/pull/728) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.23.0](https://github.com/recurly/recurly-client-php/tree/4.23.0) (2022-10-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.22.0...4.23.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entitlements feature) [#725](https://github.com/recurly/recurly-client-php/pull/725) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.22.0](https://github.com/recurly/recurly-client-php/tree/4.22.0) (2022-10-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.2...4.22.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25(Decimal Usage and Quantities and DunningEvent new fields) [#722](https://github.com/recurly/recurly-client-php/pull/722) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.2](https://github.com/recurly/recurly-client-php/tree/4.21.2) (2022-09-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.1...4.21.2) **Merged Pull Requests** - feat: allow for psr/log ^2/3 [#716](https://github.com/recurly/recurly-client-php/pull/716) ([trickeyone](https://github.com/trickeyone)) ## [4.21.1](https://github.com/recurly/recurly-client-php/tree/4.21.1) (2022-09-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.0...4.21.1) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#714](https://github.com/recurly/recurly-client-php/pull/714) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.0](https://github.com/recurly/recurly-client-php/tree/4.21.0) (2022-09-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.20.0...4.21.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#713](https://github.com/recurly/recurly-client-php/pull/713) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixes bug with putDunningCampaignBulkUpdate [#706](https://github.com/recurly/recurly-client-php/pull/706) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.20.0](https://github.com/recurly/recurly-client-php/tree/4.20.0) (2022-08-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.19.0...4.20.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#701](https://github.com/recurly/recurly-client-php/pull/701) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.19.0](https://github.com/recurly/recurly-client-php/tree/4.19.0) (2022-07-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.18.0...4.19.0) **Merged Pull Requests** - Fixing deprecation warnings in client [#697](https://github.com/recurly/recurly-client-php/pull/697) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#695](https://github.com/recurly/recurly-client-php/pull/695) ([recurly-integrations](https://github.com/recurly-integrations)) **Closed Issues** - Recurly\Pager and \Iterator return type mismatch (PHP 8.1 deprecation) [#677](https://github.com/recurly/recurly-client-php/issues/677) ## [4.18.0](https://github.com/recurly/recurly-client-php/tree/4.18.0) (2022-06-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.17.0...4.18.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#693](https://github.com/recurly/recurly-client-php/pull/693) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.17.0](https://github.com/recurly/recurly-client-php/tree/4.17.0) (2022-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.16.0...4.17.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#679](https://github.com/recurly/recurly-client-php/pull/679) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.16.0](https://github.com/recurly/recurly-client-php/tree/4.16.0) (2022-03-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.15.0...4.16.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#676](https://github.com/recurly/recurly-client-php/pull/676) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.15.0](https://github.com/recurly/recurly-client-php/tree/4.15.0) (2022-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.14.0...4.15.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#668](https://github.com/recurly/recurly-client-php/pull/668) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.14.0](https://github.com/recurly/recurly-client-php/tree/4.14.0) (2022-03-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.13.0...4.14.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#664](https://github.com/recurly/recurly-client-php/pull/664) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.13.0](https://github.com/recurly/recurly-client-php/tree/4.13.0) (2022-01-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.12.0...4.13.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#655](https://github.com/recurly/recurly-client-php/pull/655) ([recurly-integrations](https://github.com/recurly-integrations)) diff --git a/composer.json b/composer.json index 9acb363..2c47132 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,38 @@ { "name": "recurly/recurly-client", - "version": "4.57.0", + "version": "4.58.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], "homepage": "https://github.com/recurly/recurly-client-php", "license": "MIT", "authors": [], "require": { "php": ">= 7.2.0", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "phpcompatibility/php-compatibility": "^9.3", "phpdocumentor/phpdocumentor": "~3.0.0", "phpstan/phpstan": "^0.12.11", "phpunit/phpunit": "^8", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "classmap": ["lib"], "files": ["lib/recurly.php"] }, "autoload-dev": { "classmap": ["tests"] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/lib/recurly/version.php b/lib/recurly/version.php index 1da7b6d..dc4461c 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -1,8 +1,8 @@ <?php namespace Recurly; class Version { - public const CURRENT = '4.57.0'; + public const CURRENT = '4.58.0'; }
recurly/recurly-client-php
73fc8c2766c7eee939cba0cef561c911b2df2236
Generated Latest Changes for v2021-02-25
diff --git a/lib/recurly/resources/invoice.php b/lib/recurly/resources/invoice.php index 8f92bbd..23a02ac 100644 --- a/lib/recurly/resources/invoice.php +++ b/lib/recurly/resources/invoice.php @@ -1,1073 +1,1097 @@ <?php /** * This file is automatically created by Recurly's OpenAPI generation process * and thus any edits you make by hand will be lost. If you wish to make a * change to this file, please create a Github issue explaining the changes you * need and we will usher them to the appropriate places. */ namespace Recurly\Resources; use Recurly\RecurlyResource; // phpcs:disable class Invoice extends RecurlyResource { private $_account; private $_address; private $_balance; private $_billing_info_id; private $_business_entity_id; private $_closed_at; private $_collection_method; private $_created_at; private $_credit_payments; private $_currency; private $_customer_notes; private $_discount; private $_due_at; private $_dunning_campaign_id; private $_dunning_events_sent; private $_final_dunning_event; private $_has_more_line_items; private $_id; private $_line_items; private $_net_terms; private $_net_terms_type; private $_number; private $_object; private $_origin; private $_paid; private $_po_number; private $_previous_invoice_id; + private $_reference_only_currency_conversion; private $_refundable_amount; private $_shipping_address; private $_state; private $_subscription_ids; private $_subtotal; private $_tax; private $_tax_info; private $_terms_and_conditions; private $_total; private $_transactions; private $_type; private $_updated_at; private $_used_tax_service; private $_uuid; private $_vat_number; private $_vat_reverse_charge_notes; protected static $array_hints = [ 'setCreditPayments' => '\Recurly\Resources\CreditPayment', 'setLineItems' => '\Recurly\Resources\LineItem', 'setSubscriptionIds' => 'string', 'setTransactions' => '\Recurly\Resources\Transaction', ]; /** * Getter method for the account attribute. * Account mini details * * @return ?\Recurly\Resources\AccountMini */ public function getAccount(): ?\Recurly\Resources\AccountMini { return $this->_account; } /** * Setter method for the account attribute. * * @param \Recurly\Resources\AccountMini $account * * @return void */ public function setAccount(\Recurly\Resources\AccountMini $account): void { $this->_account = $account; } /** * Getter method for the address attribute. * * * @return ?\Recurly\Resources\InvoiceAddress */ public function getAddress(): ?\Recurly\Resources\InvoiceAddress { return $this->_address; } /** * Setter method for the address attribute. * * @param \Recurly\Resources\InvoiceAddress $address * * @return void */ public function setAddress(\Recurly\Resources\InvoiceAddress $address): void { $this->_address = $address; } /** * Getter method for the balance attribute. * The outstanding balance remaining on this invoice. * * @return ?float */ public function getBalance(): ?float { return $this->_balance; } /** * Setter method for the balance attribute. * * @param float $balance * * @return void */ public function setBalance(float $balance): void { $this->_balance = $balance; } /** * Getter method for the billing_info_id attribute. * The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. * * @return ?string */ public function getBillingInfoId(): ?string { return $this->_billing_info_id; } /** * Setter method for the billing_info_id attribute. * * @param string $billing_info_id * * @return void */ public function setBillingInfoId(string $billing_info_id): void { $this->_billing_info_id = $billing_info_id; } /** * Getter method for the business_entity_id attribute. * Unique ID to identify the business entity assigned to the invoice. Available when the `Multiple Business Entities` feature is enabled. * * @return ?string */ public function getBusinessEntityId(): ?string { return $this->_business_entity_id; } /** * Setter method for the business_entity_id attribute. * * @param string $business_entity_id * * @return void */ public function setBusinessEntityId(string $business_entity_id): void { $this->_business_entity_id = $business_entity_id; } /** * Getter method for the closed_at attribute. * Date invoice was marked paid or failed. * * @return ?string */ public function getClosedAt(): ?string { return $this->_closed_at; } /** * Setter method for the closed_at attribute. * * @param string $closed_at * * @return void */ public function setClosedAt(string $closed_at): void { $this->_closed_at = $closed_at; } /** * Getter method for the collection_method attribute. * An automatic invoice means a corresponding transaction is run using the account's billing information at the same time the invoice is created. Manual invoices are created without a corresponding transaction. The merchant must enter a manual payment transaction or have the customer pay the invoice with an automatic method, like credit card, PayPal, Amazon, or ACH bank payment. * * @return ?string */ public function getCollectionMethod(): ?string { return $this->_collection_method; } /** * Setter method for the collection_method attribute. * * @param string $collection_method * * @return void */ public function setCollectionMethod(string $collection_method): void { $this->_collection_method = $collection_method; } /** * Getter method for the created_at attribute. * Created at * * @return ?string */ public function getCreatedAt(): ?string { return $this->_created_at; } /** * Setter method for the created_at attribute. * * @param string $created_at * * @return void */ public function setCreatedAt(string $created_at): void { $this->_created_at = $created_at; } /** * Getter method for the credit_payments attribute. * Credit payments * * @return array */ public function getCreditPayments(): array { return $this->_credit_payments ?? [] ; } /** * Setter method for the credit_payments attribute. * * @param array $credit_payments * * @return void */ public function setCreditPayments(array $credit_payments): void { $this->_credit_payments = $credit_payments; } /** * Getter method for the currency attribute. * 3-letter ISO 4217 currency code. * * @return ?string */ public function getCurrency(): ?string { return $this->_currency; } /** * Setter method for the currency attribute. * * @param string $currency * * @return void */ public function setCurrency(string $currency): void { $this->_currency = $currency; } /** * Getter method for the customer_notes attribute. * This will default to the Customer Notes text specified on the Invoice Settings. Specify custom notes to add or override Customer Notes. * * @return ?string */ public function getCustomerNotes(): ?string { return $this->_customer_notes; } /** * Setter method for the customer_notes attribute. * * @param string $customer_notes * * @return void */ public function setCustomerNotes(string $customer_notes): void { $this->_customer_notes = $customer_notes; } /** * Getter method for the discount attribute. * Total discounts applied to this invoice. * * @return ?float */ public function getDiscount(): ?float { return $this->_discount; } /** * Setter method for the discount attribute. * * @param float $discount * * @return void */ public function setDiscount(float $discount): void { $this->_discount = $discount; } /** * Getter method for the due_at attribute. * Date invoice is due. This is the date the net terms are reached. * * @return ?string */ public function getDueAt(): ?string { return $this->_due_at; } /** * Setter method for the due_at attribute. * * @param string $due_at * * @return void */ public function setDueAt(string $due_at): void { $this->_due_at = $due_at; } /** * Getter method for the dunning_campaign_id attribute. * Unique ID to identify the dunning campaign used when dunning the invoice. For sites without multiple dunning campaigns enabled, this will always be the default dunning campaign. * * @return ?string */ public function getDunningCampaignId(): ?string { return $this->_dunning_campaign_id; } /** * Setter method for the dunning_campaign_id attribute. * * @param string $dunning_campaign_id * * @return void */ public function setDunningCampaignId(string $dunning_campaign_id): void { $this->_dunning_campaign_id = $dunning_campaign_id; } /** * Getter method for the dunning_events_sent attribute. * Number of times the event was sent. * * @return ?int */ public function getDunningEventsSent(): ?int { return $this->_dunning_events_sent; } /** * Setter method for the dunning_events_sent attribute. * * @param int $dunning_events_sent * * @return void */ public function setDunningEventsSent(int $dunning_events_sent): void { $this->_dunning_events_sent = $dunning_events_sent; } /** * Getter method for the final_dunning_event attribute. * Last communication attempt. * * @return ?bool */ public function getFinalDunningEvent(): ?bool { return $this->_final_dunning_event; } /** * Setter method for the final_dunning_event attribute. * * @param bool $final_dunning_event * * @return void */ public function setFinalDunningEvent(bool $final_dunning_event): void { $this->_final_dunning_event = $final_dunning_event; } /** * Getter method for the has_more_line_items attribute. * Identifies if the invoice has more line items than are returned in `line_items`. If `has_more_line_items` is `true`, then a request needs to be made to the `list_invoice_line_items` endpoint. * * @return ?bool */ public function getHasMoreLineItems(): ?bool { return $this->_has_more_line_items; } /** * Setter method for the has_more_line_items attribute. * * @param bool $has_more_line_items * * @return void */ public function setHasMoreLineItems(bool $has_more_line_items): void { $this->_has_more_line_items = $has_more_line_items; } /** * Getter method for the id attribute. * Invoice ID * * @return ?string */ public function getId(): ?string { return $this->_id; } /** * Setter method for the id attribute. * * @param string $id * * @return void */ public function setId(string $id): void { $this->_id = $id; } /** * Getter method for the line_items attribute. * Line Items * * @return array */ public function getLineItems(): array { return $this->_line_items ?? [] ; } /** * Setter method for the line_items attribute. * * @param array $line_items * * @return void */ public function setLineItems(array $line_items): void { $this->_line_items = $line_items; } /** * Getter method for the net_terms attribute. * Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. * * @return ?int */ public function getNetTerms(): ?int { return $this->_net_terms; } /** * Setter method for the net_terms attribute. * * @param int $net_terms * * @return void */ public function setNetTerms(int $net_terms): void { $this->_net_terms = $net_terms; } /** * Getter method for the net_terms_type attribute. * Optionally supplied string that may be either `net` or `eom` (end-of-month). When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date. When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month. * * @return ?string */ public function getNetTermsType(): ?string { return $this->_net_terms_type; } /** * Setter method for the net_terms_type attribute. * * @param string $net_terms_type * * @return void */ public function setNetTermsType(string $net_terms_type): void { $this->_net_terms_type = $net_terms_type; } /** * Getter method for the number attribute. * If VAT taxation and the Country Invoice Sequencing feature are enabled, invoices will have country-specific invoice numbers for invoices billed to EU countries (ex: FR1001). Non-EU invoices will continue to use the site-level invoice number sequence. * * @return ?string */ public function getNumber(): ?string { return $this->_number; } /** * Setter method for the number attribute. * * @param string $number * * @return void */ public function setNumber(string $number): void { $this->_number = $number; } /** * Getter method for the object attribute. * Object type * * @return ?string */ public function getObject(): ?string { return $this->_object; } /** * Setter method for the object attribute. * * @param string $object * * @return void */ public function setObject(string $object): void { $this->_object = $object; } /** * Getter method for the origin attribute. * The event that created the invoice. * * @return ?string */ public function getOrigin(): ?string { return $this->_origin; } /** * Setter method for the origin attribute. * * @param string $origin * * @return void */ public function setOrigin(string $origin): void { $this->_origin = $origin; } /** * Getter method for the paid attribute. * The total amount of successful payments transaction on this invoice. * * @return ?float */ public function getPaid(): ?float { return $this->_paid; } /** * Setter method for the paid attribute. * * @param float $paid * * @return void */ public function setPaid(float $paid): void { $this->_paid = $paid; } /** * Getter method for the po_number attribute. * For manual invoicing, this identifies the PO number associated with the subscription. * * @return ?string */ public function getPoNumber(): ?string { return $this->_po_number; } /** * Setter method for the po_number attribute. * * @param string $po_number * * @return void */ public function setPoNumber(string $po_number): void { $this->_po_number = $po_number; } /** * Getter method for the previous_invoice_id attribute. * On refund invoices, this value will exist and show the invoice ID of the purchase invoice the refund was created from. This field is only populated for sites without the [Only Bill What Changed](https://docs.recurly.com/docs/only-bill-what-changed) feature enabled. Sites with Only Bill What Changed enabled should use the [related_invoices endpoint](https://recurly.com/developers/api/v2021-02-25/index.html#operation/list_related_invoices) to see purchase invoices refunded by this invoice. * * @return ?string */ public function getPreviousInvoiceId(): ?string { return $this->_previous_invoice_id; } /** * Setter method for the previous_invoice_id attribute. * * @param string $previous_invoice_id * * @return void */ public function setPreviousInvoiceId(string $previous_invoice_id): void { $this->_previous_invoice_id = $previous_invoice_id; } + /** + * Getter method for the reference_only_currency_conversion attribute. + * Reference Only Currency Conversion + * + * @return ?\Recurly\Resources\ReferenceOnlyCurrencyConversion + */ + public function getReferenceOnlyCurrencyConversion(): ?\Recurly\Resources\ReferenceOnlyCurrencyConversion + { + return $this->_reference_only_currency_conversion; + } + + /** + * Setter method for the reference_only_currency_conversion attribute. + * + * @param \Recurly\Resources\ReferenceOnlyCurrencyConversion $reference_only_currency_conversion + * + * @return void + */ + public function setReferenceOnlyCurrencyConversion(\Recurly\Resources\ReferenceOnlyCurrencyConversion $reference_only_currency_conversion): void + { + $this->_reference_only_currency_conversion = $reference_only_currency_conversion; + } + /** * Getter method for the refundable_amount attribute. * The refundable amount on a charge invoice. It will be null for all other invoices. * * @return ?float */ public function getRefundableAmount(): ?float { return $this->_refundable_amount; } /** * Setter method for the refundable_amount attribute. * * @param float $refundable_amount * * @return void */ public function setRefundableAmount(float $refundable_amount): void { $this->_refundable_amount = $refundable_amount; } /** * Getter method for the shipping_address attribute. * * * @return ?\Recurly\Resources\ShippingAddress */ public function getShippingAddress(): ?\Recurly\Resources\ShippingAddress { return $this->_shipping_address; } /** * Setter method for the shipping_address attribute. * * @param \Recurly\Resources\ShippingAddress $shipping_address * * @return void */ public function setShippingAddress(\Recurly\Resources\ShippingAddress $shipping_address): void { $this->_shipping_address = $shipping_address; } /** * Getter method for the state attribute. * Invoice state * * @return ?string */ public function getState(): ?string { return $this->_state; } /** * Setter method for the state attribute. * * @param string $state * * @return void */ public function setState(string $state): void { $this->_state = $state; } /** * Getter method for the subscription_ids attribute. * If the invoice is charging or refunding for one or more subscriptions, these are their IDs. * * @return array */ public function getSubscriptionIds(): array { return $this->_subscription_ids ?? [] ; } /** * Setter method for the subscription_ids attribute. * * @param array $subscription_ids * * @return void */ public function setSubscriptionIds(array $subscription_ids): void { $this->_subscription_ids = $subscription_ids; } /** * Getter method for the subtotal attribute. * The summation of charges and credits, before discounts and taxes. * * @return ?float */ public function getSubtotal(): ?float { return $this->_subtotal; } /** * Setter method for the subtotal attribute. * * @param float $subtotal * * @return void */ public function setSubtotal(float $subtotal): void { $this->_subtotal = $subtotal; } /** * Getter method for the tax attribute. * The total tax on this invoice. * * @return ?float */ public function getTax(): ?float { return $this->_tax; } /** * Setter method for the tax attribute. * * @param float $tax * * @return void */ public function setTax(float $tax): void { $this->_tax = $tax; } /** * Getter method for the tax_info attribute. * Only for merchants using Recurly's In-The-Box taxes. * * @return ?\Recurly\Resources\TaxInfo */ public function getTaxInfo(): ?\Recurly\Resources\TaxInfo { return $this->_tax_info; } /** * Setter method for the tax_info attribute. * * @param \Recurly\Resources\TaxInfo $tax_info * * @return void */ public function setTaxInfo(\Recurly\Resources\TaxInfo $tax_info): void { $this->_tax_info = $tax_info; } /** * Getter method for the terms_and_conditions attribute. * This will default to the Terms and Conditions text specified on the Invoice Settings page in your Recurly admin. Specify custom notes to add or override Terms and Conditions. * * @return ?string */ public function getTermsAndConditions(): ?string { return $this->_terms_and_conditions; } /** * Setter method for the terms_and_conditions attribute. * * @param string $terms_and_conditions * * @return void */ public function setTermsAndConditions(string $terms_and_conditions): void { $this->_terms_and_conditions = $terms_and_conditions; } /** * Getter method for the total attribute. * The final total on this invoice. The summation of invoice charges, discounts, credits, and tax. * * @return ?float */ public function getTotal(): ?float { return $this->_total; } /** * Setter method for the total attribute. * * @param float $total * * @return void */ public function setTotal(float $total): void { $this->_total = $total; } /** * Getter method for the transactions attribute. * Transactions * * @return array */ public function getTransactions(): array { return $this->_transactions ?? [] ; } /** * Setter method for the transactions attribute. * * @param array $transactions * * @return void */ public function setTransactions(array $transactions): void { $this->_transactions = $transactions; } /** * Getter method for the type attribute. * Invoices are either charge, credit, or legacy invoices. * * @return ?string */ public function getType(): ?string { return $this->_type; } /** * Setter method for the type attribute. * * @param string $type * * @return void */ public function setType(string $type): void { $this->_type = $type; } /** * Getter method for the updated_at attribute. * Last updated at * * @return ?string */ public function getUpdatedAt(): ?string { return $this->_updated_at; } /** * Setter method for the updated_at attribute. * * @param string $updated_at * * @return void */ public function setUpdatedAt(string $updated_at): void { $this->_updated_at = $updated_at; } /** * Getter method for the used_tax_service attribute. * Will be `true` when the invoice had a successful response from the tax service and `false` when the invoice was not sent to tax service due to a lack of address or enabled jurisdiction or was processed without tax due to a non-blocking error returned from the tax service. * * @return ?bool */ public function getUsedTaxService(): ?bool { return $this->_used_tax_service; } /** * Setter method for the used_tax_service attribute. * * @param bool $used_tax_service * * @return void */ public function setUsedTaxService(bool $used_tax_service): void { $this->_used_tax_service = $used_tax_service; } /** * Getter method for the uuid attribute. * Invoice UUID * * @return ?string */ public function getUuid(): ?string { return $this->_uuid; } /** * Setter method for the uuid attribute. * * @param string $uuid * * @return void */ public function setUuid(string $uuid): void { $this->_uuid = $uuid; } /** * Getter method for the vat_number attribute. * VAT registration number for the customer on this invoice. This will come from the VAT Number field in the Billing Info or the Account Info depending on your tax settings and the invoice collection method. * * @return ?string */ public function getVatNumber(): ?string { return $this->_vat_number; } /** * Setter method for the vat_number attribute. * * @param string $vat_number * * @return void */ public function setVatNumber(string $vat_number): void { $this->_vat_number = $vat_number; } /** * Getter method for the vat_reverse_charge_notes attribute. * VAT Reverse Charge Notes only appear if you have EU VAT enabled or are using your own Avalara AvaTax account and the customer is in the EU, has a VAT number, and is in a different country than your own. This will default to the VAT Reverse Charge Notes text specified on the Tax Settings page in your Recurly admin, unless custom notes were created with the original subscription. * * @return ?string */ public function getVatReverseChargeNotes(): ?string { return $this->_vat_reverse_charge_notes; } /** * Setter method for the vat_reverse_charge_notes attribute. * * @param string $vat_reverse_charge_notes * * @return void */ public function setVatReverseChargeNotes(string $vat_reverse_charge_notes): void { $this->_vat_reverse_charge_notes = $vat_reverse_charge_notes; } } \ No newline at end of file diff --git a/lib/recurly/resources/reference_only_currency_conversion.php b/lib/recurly/resources/reference_only_currency_conversion.php new file mode 100644 index 0000000..fee244c --- /dev/null +++ b/lib/recurly/resources/reference_only_currency_conversion.php @@ -0,0 +1,91 @@ +<?php +/** + * This file is automatically created by Recurly's OpenAPI generation process + * and thus any edits you make by hand will be lost. If you wish to make a + * change to this file, please create a Github issue explaining the changes you + * need and we will usher them to the appropriate places. + */ +namespace Recurly\Resources; + +use Recurly\RecurlyResource; + +// phpcs:disable +class ReferenceOnlyCurrencyConversion extends RecurlyResource +{ + private $_currency; + private $_subtotal_in_cents; + private $_tax_in_cents; + + protected static $array_hints = [ + ]; + + + /** + * Getter method for the currency attribute. + * 3-letter ISO 4217 currency code. + * + * @return ?string + */ + public function getCurrency(): ?string + { + return $this->_currency; + } + + /** + * Setter method for the currency attribute. + * + * @param string $currency + * + * @return void + */ + public function setCurrency(string $currency): void + { + $this->_currency = $currency; + } + + /** + * Getter method for the subtotal_in_cents attribute. + * The subtotal converted to the currency. + * + * @return ?float + */ + public function getSubtotalInCents(): ?float + { + return $this->_subtotal_in_cents; + } + + /** + * Setter method for the subtotal_in_cents attribute. + * + * @param float $subtotal_in_cents + * + * @return void + */ + public function setSubtotalInCents(float $subtotal_in_cents): void + { + $this->_subtotal_in_cents = $subtotal_in_cents; + } + + /** + * Getter method for the tax_in_cents attribute. + * The tax converted to the currency. + * + * @return ?float + */ + public function getTaxInCents(): ?float + { + return $this->_tax_in_cents; + } + + /** + * Setter method for the tax_in_cents attribute. + * + * @param float $tax_in_cents + * + * @return void + */ + public function setTaxInCents(float $tax_in_cents): void + { + $this->_tax_in_cents = $tax_in_cents; + } +} \ No newline at end of file diff --git a/openapi/api.yaml b/openapi/api.yaml index f9c6768..28a59b3 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -19767,1024 +19767,1026 @@ components: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 name: title: Performance Obligation Name type: string created_at: title: Created At type: string readOnly: true format: date-time updated_at: title: Last updated at type: string readOnly: true format: date-time PerformanceObligationList: type: object description: List of Performance Obligations properties: object: title: Object type type: string data: title: Performance Obligation type: array items: "$ref": "#/components/schemas/PerformanceObligation" ItemMini: type: object title: Item mini details description: Just the important parts. properties: id: type: string title: Item ID maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true code: type: string title: Item code description: Unique code to identify the item. pattern: "/^[a-z0-9_+-]+$/" maxLength: 50 state: title: State description: The current state of the item. readOnly: true "$ref": "#/components/schemas/ActiveStateEnum" name: type: string title: Name description: This name describes your item and will appear on the invoice when it's purchased on a one time basis. maxLength: 255 description: type: string title: Description description: Optional, description. Item: type: object description: Full item details. properties: id: type: string title: Item ID maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true code: type: string title: Item code description: Unique code to identify the item. pattern: "/^[a-z0-9_+-]+$/" maxLength: 50 state: title: State description: The current state of the item. readOnly: true "$ref": "#/components/schemas/ActiveStateEnum" name: type: string title: Name description: This name describes your item and will appear on the invoice when it's purchased on a one time basis. maxLength: 255 description: type: string title: Description description: Optional, description. external_sku: type: string title: External SKU description: Optional, stock keeping unit to link the item to other inventory systems. maxLength: 50 accounting_code: type: string title: Item accounting code description: Accounting code for invoice line items. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 tax_code: type: string maxLength: 50 title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes. tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on the item, `false` applies tax on the item." custom_fields: "$ref": "#/components/schemas/CustomFields" currencies: type: array title: Item Pricing items: "$ref": "#/components/schemas/Pricing" created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at readOnly: true ItemCreate: type: object properties: code: type: string title: Item code description: Unique code to identify the item. pattern: "/^[a-z0-9_+-]+$/" maxLength: 50 name: type: string title: Name description: This name describes your item and will appear on the invoice when it's purchased on a one time basis. maxLength: 255 description: type: string title: Description description: Optional, description. external_sku: type: string title: External SKU description: Optional, stock keeping unit to link the item to other inventory systems. maxLength: 50 accounting_code: type: string title: Item accounting code description: Accounting code for invoice line items. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 tax_code: type: string maxLength: 50 title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes. tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on the item, `false` applies tax on the item." custom_fields: "$ref": "#/components/schemas/CustomFields" currencies: type: array title: Item Pricing items: "$ref": "#/components/schemas/Pricing" required: - code - name ItemUpdate: type: object properties: code: type: string title: Item code description: Unique code to identify the item. pattern: "/^[a-z0-9_+-]+$/" maxLength: 50 name: type: string title: Name description: This name describes your item and will appear on the invoice when it's purchased on a one time basis. maxLength: 255 description: type: string title: Description description: Optional, description. external_sku: type: string title: External SKU description: Optional, stock keeping unit to link the item to other inventory systems. maxLength: 50 accounting_code: type: string title: Item accounting code description: Accounting code for invoice line items. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 tax_code: type: string maxLength: 50 title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes. tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on the item, `false` applies tax on the item." custom_fields: "$ref": "#/components/schemas/CustomFields" currencies: type: array title: Item Pricing items: "$ref": "#/components/schemas/Pricing" Invoice: type: object properties: id: type: string title: Invoice ID readOnly: true uuid: type: string title: Invoice UUID readOnly: true object: type: string title: Object type readOnly: true type: title: Invoice type description: Invoices are either charge, credit, or legacy invoices. "$ref": "#/components/schemas/InvoiceTypeEnum" origin: title: Origin description: The event that created the invoice. "$ref": "#/components/schemas/OriginEnum" state: title: Invoice state "$ref": "#/components/schemas/InvoiceStateEnum" account: "$ref": "#/components/schemas/AccountMini" billing_info_id: type: string title: Billing info ID description: The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. subscription_ids: type: array title: Subscription IDs description: If the invoice is charging or refunding for one or more subscriptions, these are their IDs. items: type: string title: Subscription ID maxLength: 13 previous_invoice_id: type: string title: Previous invoice ID description: On refund invoices, this value will exist and show the invoice ID of the purchase invoice the refund was created from. This field is only populated for sites without the [Only Bill What Changed](https://docs.recurly.com/docs/only-bill-what-changed) feature enabled. Sites with Only Bill What Changed enabled should use the [related_invoices endpoint](https://recurly.com/developers/api/v2021-02-25/index.html#operation/list_related_invoices) to see purchase invoices refunded by this invoice. maxLength: 13 number: type: string title: Invoice number description: 'If VAT taxation and the Country Invoice Sequencing feature are enabled, invoices will have country-specific invoice numbers for invoices billed to EU countries (ex: FR1001). Non-EU invoices will continue to use the site-level invoice number sequence.' collection_method: title: Collection method description: An automatic invoice means a corresponding transaction is run using the account's billing information at the same time the invoice is created. Manual invoices are created without a corresponding transaction. The merchant must enter a manual payment transaction or have the customer pay the invoice with an automatic method, like credit card, PayPal, Amazon, or ACH bank payment. default: automatic "$ref": "#/components/schemas/CollectionMethodEnum" po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Net terms description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" address: "$ref": "#/components/schemas/InvoiceAddress" shipping_address: "$ref": "#/components/schemas/ShippingAddress" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 discount: type: number format: float title: Discount description: Total discounts applied to this invoice. subtotal: type: number format: float title: Subtotal description: The summation of charges and credits, before discounts and taxes. tax: type: number format: float title: Tax description: The total tax on this invoice. + reference_only_currency_conversion: + "$ref": "#/components/schemas/ReferenceOnlyCurrencyConversion" total: type: number format: float title: Total description: The final total on this invoice. The summation of invoice charges, discounts, credits, and tax. refundable_amount: type: number format: float title: Refundable amount description: The refundable amount on a charge invoice. It will be null for all other invoices. paid: type: number format: float title: Paid description: The total amount of successful payments transaction on this invoice. balance: type: number format: float title: Balance description: The outstanding balance remaining on this invoice. tax_info: "$ref": "#/components/schemas/TaxInfo" used_tax_service: type: boolean title: Used Tax Service? description: Will be `true` when the invoice had a successful response from the tax service and `false` when the invoice was not sent to tax service due to a lack of address or enabled jurisdiction or was processed without tax due to a non-blocking error returned from the tax service. vat_number: type: string title: VAT number description: VAT registration number for the customer on this invoice. This will come from the VAT Number field in the Billing Info or the Account Info depending on your tax settings and the invoice collection method. maxLength: 20 vat_reverse_charge_notes: type: string title: VAT reverse charge notes description: VAT Reverse Charge Notes only appear if you have EU VAT enabled or are using your own Avalara AvaTax account and the customer is in the EU, has a VAT number, and is in a different country than your own. This will default to the VAT Reverse Charge Notes text specified on the Tax Settings page in your Recurly admin, unless custom notes were created with the original subscription. terms_and_conditions: type: string title: Terms and conditions description: This will default to the Terms and Conditions text specified on the Invoice Settings page in your Recurly admin. Specify custom notes to add or override Terms and Conditions. customer_notes: type: string title: Customer notes description: This will default to the Customer Notes text specified on the Invoice Settings. Specify custom notes to add or override Customer Notes. line_items: type: array title: Line Items items: "$ref": "#/components/schemas/LineItem" has_more_line_items: type: boolean title: Has more Line Items description: Identifies if the invoice has more line items than are returned in `line_items`. If `has_more_line_items` is `true`, then a request needs to be made to the `list_invoice_line_items` endpoint. transactions: type: array title: Transactions items: "$ref": "#/components/schemas/Transaction" credit_payments: type: array title: Credit payments items: "$ref": "#/components/schemas/CreditPayment" created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true due_at: type: string format: date-time title: Due at description: Date invoice is due. This is the date the net terms are reached. closed_at: type: string format: date-time title: Closed at description: Date invoice was marked paid or failed. dunning_campaign_id: type: string title: Dunning Campaign ID description: Unique ID to identify the dunning campaign used when dunning the invoice. For sites without multiple dunning campaigns enabled, this will always be the default dunning campaign. dunning_events_sent: type: integer title: Dunning Event Sent description: Number of times the event was sent. final_dunning_event: type: boolean title: Final Dunning Event description: Last communication attempt. business_entity_id: type: string title: Business Entity ID description: Unique ID to identify the business entity assigned to the invoice. Available when the `Multiple Business Entities` feature is enabled. InvoiceCreate: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 business_entity_id: type: string title: Business Entity ID description: The `business_entity_id` is the value that represents a specific business entity for an end customer which will be assigned to the invoice. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. business_entity_code: type: string title: Business Entity Code description: The `business_entity_code` is the value that represents a specific business entity for an end customer which will be assigned to the invoice. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. collection_method: title: Collection method description: An automatic invoice means a corresponding transaction is run using the account's billing information at the same time the invoice is created. Manual invoices are created without a corresponding transaction. The merchant must enter a manual payment transaction or have the customer pay the invoice with an automatic method, like credit card, PayPal, Amazon, or ACH bank payment. default: automatic "$ref": "#/components/schemas/CollectionMethodEnum" charge_customer_notes: type: string title: Charge customer notes description: This will default to the Customer Notes text specified on the Invoice Settings for charge invoices. Specify custom notes to add or override Customer Notes on charge invoices. credit_customer_notes: type: string title: Credit customer notes description: This will default to the Customer Notes text specified on the Invoice Settings for credit invoices. Specify customer notes to add or override Customer Notes on credit invoices. net_terms: type: integer title: Net terms description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 terms_and_conditions: type: string title: Terms and conditions description: This will default to the Terms and Conditions text specified on the Invoice Settings page in your Recurly admin. Specify custom notes to add or override Terms and Conditions. vat_reverse_charge_notes: type: string title: VAT reverse charge notes description: VAT Reverse Charge Notes only appear if you have EU VAT enabled or are using your own Avalara AvaTax account and the customer is in the EU, has a VAT number, and is in a different country than your own. This will default to the VAT Reverse Charge Notes text specified on the Tax Settings page in your Recurly admin, unless custom notes were created with the original subscription. required: - currency InvoiceCollect: type: object properties: three_d_secure_action_result_token_id: type: string title: 3-D Secure action result token ID description: A token generated by Recurly.js after completing a 3-D Secure device fingerprinting or authentication challenge. maxLength: 22 transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" billing_info_id: type: string title: Billing Info ID description: The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. InvoiceCollection: type: object title: Invoice collection properties: object: type: string title: Object type charge_invoice: "$ref": "#/components/schemas/Invoice" credit_invoices: type: array title: Credit invoices items: "$ref": "#/components/schemas/Invoice" InvoiceUpdate: type: object properties: po_number: type: string title: Purchase order number description: This identifies the PO number associated with the invoice. Not editable for credit invoices. maxLength: 50 vat_reverse_charge_notes: type: string title: VAT reverse charge notes description: VAT Reverse Charge Notes are editable only if there was a VAT reverse charge applied to the invoice. terms_and_conditions: type: string title: Terms and conditions description: Terms and conditions are an optional note field. Not editable for credit invoices. customer_notes: type: string title: Customer notes description: Customer notes are an optional note field. net_terms: type: integer title: Net terms description: Integer representing the number of days after an invoice's creation that the invoice will become past due. Changing Net terms changes due_on, and the invoice could move between past due and pending. minimum: 0 maximum: 999 address: "$ref": "#/components/schemas/InvoiceAddress" gateway_code: type: string description: An alphanumeric code shown per gateway on your site's payment gateways page. Set this code to ensure that a given invoice targets a given gateway. InvoiceMini: type: object title: Invoice mini details properties: id: type: string title: Invoice ID maxLength: 13 object: type: string title: Object type number: type: string title: Invoice number business_entity_id: type: string title: Business Entity ID description: Unique ID to identify the business entity assigned to the invoice. Available when the `Multiple Business Entities` feature is enabled. type: title: Invoice type "$ref": "#/components/schemas/InvoiceTypeEnum" state: title: Invoice state "$ref": "#/components/schemas/InvoiceStateEnum" InvoiceRefund: type: object title: Invoice refund properties: type: title: Type description: The type of refund. Amount and line items cannot both be specified in the request. "$ref": "#/components/schemas/InvoiceRefundTypeEnum" amount: type: number format: float title: Amount description: | The amount to be refunded. The amount will be split between the line items. If `type` is "amount" and no amount is specified, it will default to refunding the total refundable amount on the invoice. Can only be present if `type` is "amount". percentage: type: integer title: Percentage description: The percentage of the remaining balance to be refunded. The percentage will be split between the line items. If `type` is "percentage" and no percentage is specified, it will default to refunding 100% of the refundable amount on the invoice. Can only be present if `type` is "percentage". minimum: 1 maximum: 100 line_items: type: array title: Line items description: The line items to be refunded. This is required when `type=line_items`. items: "$ref": "#/components/schemas/LineItemRefund" refund_method: title: Refund method description: | Indicates how the invoice should be refunded when both a credit and transaction are present on the invoice: - `transaction_first` – Refunds the transaction first, then any amount is issued as credit back to the account. Default value when Credit Invoices feature is enabled. - `credit_first` – Issues credit back to the account first, then refunds any remaining amount back to the transaction. Default value when Credit Invoices feature is not enabled. - `all_credit` – Issues credit to the account for the entire amount of the refund. Only available when the Credit Invoices feature is enabled. - `all_transaction` – Refunds the entire amount back to transactions, using transactions from previous invoices if necessary. Only available when the Credit Invoices feature is enabled. default: credit_first "$ref": "#/components/schemas/RefundMethodEnum" credit_customer_notes: type: string title: Credit customer notes description: | Used as the Customer Notes on the credit invoice. This field can only be include when the Credit Invoices feature is enabled. external_refund: type: object x-class-name: ExternalRefund description: | Indicates that the refund was settled outside of Recurly, and a manual transaction should be created to track it in Recurly. Required when: - refunding a manually collected charge invoice, and `refund_method` is not `all_credit` - refunding a credit invoice that refunded manually collecting invoices - refunding a credit invoice for a partial amount This field can only be included when the Credit Invoices feature is enabled. properties: payment_method: title: Payment Method description: Payment method used for external refund transaction. "$ref": "#/components/schemas/ExternalPaymentMethodEnum" description: type: string title: Description description: Used as the refund transactions' description. maxLength: 50 refunded_at: type: string format: date-time title: Refunded At description: Date the external refund payment was made. Defaults to the current date-time. required: - payment_method required: - type MeasuredUnit: type: object title: Measured unit properties: id: type: string title: Item ID maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true name: type: string title: Name description: Unique internal name of the measured unit on your site. display_name: type: string title: Display name description: Display name for the measured unit. Can only contain spaces, underscores and must be alphanumeric. maxLength: 50 state: title: State description: The current state of the measured unit. readOnly: true "$ref": "#/components/schemas/ActiveStateEnum" description: type: string title: Description description: Optional internal description. created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at readOnly: true MeasuredUnitCreate: type: object properties: name: type: string title: Name description: Unique internal name of the measured unit on your site. maxLength: 255 display_name: type: string title: Display name description: Display name for the measured unit. pattern: "/^[\\w ]+$/" maxLength: 50 description: type: string title: Description description: Optional internal description. required: - name - display_name MeasuredUnitUpdate: type: object properties: name: type: string title: Name description: Unique internal name of the measured unit on your site. maxLength: 255 display_name: type: string title: Display name description: Display name for the measured unit. pattern: "/^[\\w ]+$/" maxLength: 50 description: type: string title: Description description: Optional internal description. LineItem: type: object title: Line item properties: id: type: string title: Line item ID maxLength: 13 object: type: string title: Object type uuid: type: string title: UUID description: The UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI. maxLength: 32 type: title: Line item type description: Charges are positive line items that debit the account. Credits are negative line items that credit the account. "$ref": "#/components/schemas/LineItemTypeEnum" item_code: type: string title: Item Code description: Unique code to identify an item. Available when the Credit Invoices feature is enabled. pattern: "/^[a-z0-9_+-]+$/" maxLength: 50 item_id: type: string title: Item ID description: System-generated unique identifier for an item. Available when the Credit Invoices feature is enabled. maxLength: 13 @@ -21780,1024 +21782,1043 @@ components: properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 setup_fee: type: number format: float title: Setup fee description: Amount of one-time setup fee automatically charged at the beginning of a subscription billing cycle. For subscription plans with a trial, the setup fee will be charged at the time of signup. Setup fees do not increase with the quantity of a subscription plan. minimum: 0 maximum: 1000000 unit_amount: type: number format: float title: Unit price description: This field should not be sent when the pricing model is 'ramp'. minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true PlanRampInterval: type: object title: Plan Ramp Interval properties: starting_billing_cycle: type: integer description: Represents the billing cycle where a ramp interval starts. default: 1 currencies: type: array description: Represents the price for the ramp interval. items: "$ref": "#/components/schemas/PlanRampPricing" PlanUpdate: type: object properties: id: type: string title: Plan ID maxLength: 13 readOnly: true code: type: string title: Plan code description: Unique code to identify the plan. This is used in Hosted Payment Page URLs and in the invoice exports. pattern: "/^[a-z0-9_+-]+$/i" maxLength: 50 name: type: string title: Name description: This name describes your plan and will appear on the Hosted Payment Page and the subscriber's invoice. maxLength: 255 description: type: string title: Description description: Optional description, not displayed. accounting_code: type: string title: Plan accounting code description: Accounting code for invoice line items for the plan. If no value is provided, it defaults to plan's code. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 trial_unit: title: Trial unit description: Units for the plan's trial period. default: months "$ref": "#/components/schemas/IntervalUnitEnum" trial_length: type: integer title: Trial length description: Length of plan's trial period in `trial_units`. `0` means `no trial`. default: 0 minimum: 0 trial_requires_billing_info: type: boolean title: Trial Requires BillingInfo description: Allow free trial subscriptions to be created without billing info. Should not be used if billing info is needed for initial invoice due to existing uninvoiced charges or setup fee. default: true total_billing_cycles: type: integer title: Total billing cycles description: Automatically terminate plans after a defined number of billing cycles. minimum: 0 auto_renew: type: boolean title: Auto renew default: true description: Subscriptions will automatically inherit this value once they are active. If `auto_renew` is `true`, then a subscription will automatically renew its term at renewal. If `auto_renew` is `false`, then a subscription will expire at the end of its term. `auto_renew` can be overridden on the subscription record itself. ramp_intervals: type: array title: Ramp Intervals items: "$ref": "#/components/schemas/PlanRampInterval" custom_fields: "$ref": "#/components/schemas/CustomFields" revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 setup_fee_liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 setup_fee_revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 setup_fee_performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 setup_fee_revenue_schedule_type: title: Setup fee revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" setup_fee_accounting_code: type: string title: Setup fee accounting code description: Accounting code for invoice line items for the plan's setup fee. If no value is provided, it defaults to plan's accounting code. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 tax_code: type: string maxLength: 50 title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes. tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on the plan, `false` applies tax on the plan." vertex_transaction_type: type: string title: Vertex Transaction Type description: Used by Vertex for tax calculations. Possible values are `sale`, `rental`, `lease`. currencies: type: array title: Pricing description: Optional when the pricing model is 'ramp'. items: "$ref": "#/components/schemas/PlanPricing" minItems: 1 hosted_pages: type: object title: Hosted pages settings "$ref": "#/components/schemas/PlanHostedPages" allow_any_item_on_subscriptions: type: boolean title: Allow any item on subscriptions description: | Used to determine whether items can be assigned as add-ons to individual subscriptions. If `true`, items can be assigned as add-ons to individual subscription add-ons. If `false`, only plan add-ons can be used. dunning_campaign_id: type: string title: Dunning Campaign ID description: Unique ID to identify a dunning campaign. Used to specify if a non-default dunning campaign should be assigned to this plan. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. AddOnPricing: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 unit_amount: type: number format: float title: Unit price minimum: 0 maximum: 1000000 description: Allows up to 2 decimal places. Required unless `unit_amount_decimal` is provided. unit_amount_decimal: type: string title: Unit Amount Decimal minimum: 0 maximum: 1000000 description: | Allows up to 9 decimal places. Only supported when `add_on_type` = `usage`. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided. tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true required: - currency TierPricing: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 unit_amount: type: number format: float title: Unit price minimum: 0 maximum: 1000000 description: Allows up to 2 decimal places. Required unless `unit_amount_decimal` is provided. unit_amount_decimal: type: string title: Unit Amount Decimal minimum: 0 maximum: 1000000 description: | Allows up to 9 decimal places. Only supported when `add_on_type` = `usage`. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided. required: - currency PlanRampPricing: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 unit_amount: type: number format: float title: Unit price description: Represents the price for the Ramp Interval. minimum: 0 maximum: 1000000 required: - currency - unit_amount Pricing: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 unit_amount: type: number format: float title: Unit price minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true required: - currency - unit_amount Tier: type: object properties: ending_quantity: type: integer title: Ending quantity minimum: 1 maximum: 999999999 description: Ending quantity for the tier. This represents a unit amount for unit-priced add ons. Must be left empty if it is the final tier. usage_percentage: type: string title: Usage Percentage description: "(deprecated) -- Use the percentage_tiers object instead." deprecated: true currencies: type: array title: Tier pricing items: "$ref": "#/components/schemas/TierPricing" minItems: 1 PercentageTiersByCurrency: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 tiers: type: array title: Tiers items: "$ref": "#/components/schemas/PercentageTier" minItems: 1 PercentageTier: type: object properties: ending_amount: type: number format: float title: Ending amount minimum: 0.01 maximum: 9999999999999.99 description: Ending amount for the tier. Allows up to 2 decimal places. Must be left empty if it is the final tier. usage_percentage: type: string title: Usage Percentage minimum: 0 maximum: 100 description: | The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places represented as a string. ProrationSettings: type: object title: Proration Settings description: Allows you to control how any resulting charges and credits will be calculated and prorated. properties: charge: "$ref": "#/components/schemas/ProrationSettingsChargeEnum" credit: "$ref": "#/components/schemas/ProrationSettingsCreditEnum" ProrationSettingsChargeEnum: type: string title: Charge description: Determines how the amount charged is determined for this change default: prorated_amount enum: - full_amount - prorated_amount - none ProrationSettingsCreditEnum: type: string title: Credit description: Determines how the amount credited is determined for this change default: prorated_amount enum: - full_amount - prorated_amount - none Settings: type: object properties: billing_address_requirement: description: | - full: Full Address (Street, City, State, Postal Code and Country) - streetzip: Street and Postal Code only - zip: Postal Code only - none: No Address readOnly: true "$ref": "#/components/schemas/AddressRequirementEnum" accepted_currencies: type: array items: type: string description: 3-letter ISO 4217 currency code. readOnly: true default_currency: type: string description: The default 3-letter ISO 4217 currency code. readOnly: true ShippingAddress: type: object properties: id: type: string title: Shipping Address ID maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true account_id: type: string title: Account ID maxLength: 13 readOnly: true nickname: type: string maxLength: 255 first_name: type: string maxLength: 255 last_name: type: string maxLength: 255 company: type: string maxLength: 255 email: type: string maxLength: 255 vat_number: type: string maxLength: 20 phone: type: string maxLength: 30 street1: type: string maxLength: 255 street2: type: string maxLength: 255 city: type: string maxLength: 255 region: type: string maxLength: 255 description: State or province. postal_code: type: string maxLength: 20 description: Zip or postal code. country: type: string maxLength: 50 description: Country, 2-letter ISO 3166-1 alpha-2 code. geo_code: type: string maxLength: 20 description: Code that represents a geographic entity (location or object). Only returned for Sling Vertex Integration created_at: type: string title: Created at format: date-time readOnly: true updated_at: type: string title: Updated at format: date-time readOnly: true + ReferenceOnlyCurrencyConversion: + type: object + title: Reference Only Currency Conversion + properties: + currency: + type: string + title: Currency + description: 3-letter ISO 4217 currency code. + maxLength: 3 + subtotal_in_cents: + type: number + format: float + title: Subtotal In Cents + description: The subtotal converted to the currency. + tax_in_cents: + type: number + format: float + title: Tax In Cents + description: The tax converted to the currency. ShippingAddressCreate: type: object properties: nickname: type: string maxLength: 255 first_name: type: string maxLength: 255 last_name: type: string maxLength: 255 company: type: string maxLength: 255 email: type: string maxLength: 255 vat_number: type: string maxLength: 20 phone: type: string maxLength: 30 street1: type: string maxLength: 255 street2: type: string maxLength: 255 city: type: string maxLength: 255 region: type: string maxLength: 255 description: State or province. postal_code: type: string maxLength: 20 description: Zip or postal code. geo_code: type: string maxLength: 20 description: Code that represents a geographic entity (location or object). Only returned for Sling Vertex Integration country: type: string maxLength: 50 description: Country, 2-letter ISO 3166-1 alpha-2 code. required: - first_name - last_name - street1 - city - postal_code - country ShippingAddressList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ShippingAddress" ShippingMethod: type: object properties: id: type: string title: Shipping Method ID readOnly: true maxLength: 13 object: type: string title: Object type readOnly: true code: type: string title: Code description: The internal name used identify the shipping method. maxLength: 50 name: type: string title: Name description: The name of the shipping method displayed to customers. maxLength: 100 accounting_code: type: string title: Accounting Code description: Accounting code for shipping method. maxLength: 20 tax_code: type: string title: Tax code description: | Used by Avalara, Vertex, and Recurly’s built-in tax feature. The tax code values are specific to each tax system. If you are using Recurly’s built-in taxes the values are: - `FR` – Common Carrier FOB Destination - `FR022000` – Common Carrier FOB Origin - `FR020400` – Non Common Carrier FOB Destination - `FR020500` – Non Common Carrier FOB Origin - `FR010100` – Delivery by Company Vehicle Before Passage of Title - `FR010200` – Delivery by Company Vehicle After Passage of Title - `NT` – Non-Taxable maxLength: 50 liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at readOnly: true ShippingMethodMini: type: object properties: id: type: string title: Shipping Method ID readOnly: true maxLength: 13 object: type: string title: Object type readOnly: true code: type: string title: Code description: The internal name used identify the shipping method. maxLength: 50 name: type: string title: Name description: The name of the shipping method displayed to customers. maxLength: 100 ShippingMethodCreate: type: object properties: code: type: string title: Code description: The internal name used identify the shipping method. pattern: "/^[a-z0-9_+-]+$/i" maxLength: 50 name: type: string title: Name description: The name of the shipping method displayed to customers. maxLength: 100 accounting_code: type: string title: Accounting Code description: Accounting code for shipping method. maxLength: 20 tax_code: type: string title: Tax code description: | Used by Avalara, Vertex, and Recurly’s built-in tax feature. The tax code values are specific to each tax system. If you are using Recurly’s built-in taxes the values are: - `FR` – Common Carrier FOB Destination - `FR022000` – Common Carrier FOB Origin - `FR020400` – Non Common Carrier FOB Destination - `FR020500` – Non Common Carrier FOB Origin - `FR010100` – Delivery by Company Vehicle Before Passage of Title - `FR010200` – Delivery by Company Vehicle After Passage of Title - `NT` – Non-Taxable maxLength: 50 liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 required: - code - name ShippingMethodUpdate: type: object properties: code: type: string title: Code description: The internal name used identify the shipping method. pattern: "/^[a-z0-9_+-]+$/i" maxLength: 50 name: type: string title: Name description: The name of the shipping method displayed to customers. maxLength: 100 accounting_code: type: string title: Accounting Code description: Accounting code for shipping method. maxLength: 20 tax_code: type: string title: Tax code description: | Used by Avalara, Vertex, and Recurly’s built-in tax feature. The tax code values are specific to each tax system. If you are using Recurly’s built-in taxes the values are: - `FR` – Common Carrier FOB Destination - `FR022000` – Common Carrier FOB Origin - `FR020400` – Non Common Carrier FOB Destination - `FR020500` – Non Common Carrier FOB Origin - `FR010100` – Delivery by Company Vehicle Before Passage of Title - `FR010200` – Delivery by Company Vehicle After Passage of Title - `NT` – Non-Taxable maxLength: 50 liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 ShippingFeeCreate: type: object properties: method_id: type: string title: Method ID description: The id of the shipping method used to deliver the purchase. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 13 method_code: type: string title: Method Code description: The code of the shipping method used to deliver the purchase. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 50 amount: type: number format: float title: Amount description: This is priced in the purchase's currency. minimum: 0 ShippingAddressUpdate: type: object properties: id: type: string title: Shipping Address ID maxLength: 13 readOnly: true nickname: type: string maxLength: 255 first_name: type: string maxLength: 255 last_name: type: string maxLength: 255 company: type: string maxLength: 255 email: type: string maxLength: 255 vat_number: type: string maxLength: 20 phone: type: string maxLength: 30 street1: type: string maxLength: 255 street2: type: string maxLength: 255 city: type: string maxLength: 255 region: type: string maxLength: 255 description: State or province. postal_code: type: string maxLength: 20 description: Zip or postal code. country: type: string maxLength: 50 description: Country, 2-letter ISO 3166-1 alpha-2 code. geo_code: type: string maxLength: 20 description: Code that represents a geographic entity (location or object). Only returned for Sling Vertex Integration Site: type: object properties: id: type: string title: Site ID readOnly: true maxLength: 13 object: type: string title: Object type readOnly: true subdomain: type: string readOnly: true maxLength: 100 public_api_key: type: string title: Public API Key readOnly: true maxLength: 50 description: This value is used to configure RecurlyJS to submit tokenized billing information. mode: title: Mode maxLength: 15 readOnly: true "$ref": "#/components/schemas/SiteModeEnum" address: "$ref": "#/components/schemas/Address" settings: "$ref": "#/components/schemas/Settings" features: type: array title: Features description: A list of features enabled for the site. items: readOnly: true "$ref": "#/components/schemas/FeaturesEnum" created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at readOnly: true Subscription: type: object properties: id: type: string title: Subscription ID maxLength: 13 object: type: string title: Object type uuid: type: string title: UUID description: The UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI. maxLength: 32 account: "$ref": "#/components/schemas/AccountMini" plan: "$ref": "#/components/schemas/PlanMini" state: title: State "$ref": "#/components/schemas/SubscriptionStateEnum" shipping: "$ref": "#/components/schemas/SubscriptionShipping" coupon_redemptions: type: array title: Coupon redemptions description: Returns subscription level coupon redemptions that are tied to this subscription. items: "$ref": "#/components/schemas/CouponRedemptionMini" pending_change: "$ref": "#/components/schemas/SubscriptionChange" current_period_started_at: type: string format: date-time title: Current billing period started at current_period_ends_at: type: string format: date-time title: Current billing period ends at current_term_started_at: type: string format: date-time title: Current term started at description: The start date of the term when the first billing period starts. The subscription term is the length of time that a customer will be committed to a subscription. A term can span multiple billing periods. current_term_ends_at: type: string format: date-time title: Current term ends at description: When the term ends. This is calculated by a plan's interval and `total_billing_cycles` in a term. Subscription changes with a `timeframe=renewal` will be applied on this date. trial_started_at: type: string format: date-time title: Trial period started at trial_ends_at: type: string format: date-time title: Trial period ends at remaining_billing_cycles: type: integer title: Remaining billing cycles description: The remaining billing cycles in the current term. total_billing_cycles: type: integer title: Total billing cycles description: The number of cycles/billing periods in a term. When `remaining_billing_cycles=0`, if `auto_renew=true` the subscription will renew and a new term will begin, otherwise the subscription will expire. renewal_billing_cycles: type: integer title: Renewal billing cycles description: If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. auto_renew:
recurly/recurly-client-php
0f0cb238550a675ab3bdf42d9b503fbe9262940e
4.57.0
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index b020895..fce6da8 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 4.56.0 +current_version = 4.57.0 parse = (?P<major>\d+) \.(?P<minor>\d+) \.(?P<patch>\d+) serialize = {major}.{minor}.{patch} [bumpversion:file:composer.json] [bumpversion:file:lib/recurly/version.php] diff --git a/CHANGELOG.md b/CHANGELOG.md index 5353cfc..1602397 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,514 +1,526 @@ # Changelog +## [4.57.0](https://github.com/recurly/recurly-client-php/tree/4.57.0) (2025-02-26) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.56.0...4.57.0) + + +**Merged Pull Requests** + +- Add `funding_source` to `BillingInfo` and `Transaction` [#834](https://github.com/recurly/recurly-client-php/pull/834) ([recurly-integrations](https://github.com/recurly-integrations)) +- Generated Latest Changes for v2021-02-25 [#831](https://github.com/recurly/recurly-client-php/pull/831) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.56.0](https://github.com/recurly/recurly-client-php/tree/4.56.0) (2024-12-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.55.0...4.56.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#830](https://github.com/recurly/recurly-client-php/pull/830) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.55.0](https://github.com/recurly/recurly-client-php/tree/4.55.0) (2024-12-02) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.54.0...4.55.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#829](https://github.com/recurly/recurly-client-php/pull/829) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#826](https://github.com/recurly/recurly-client-php/pull/826) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.54.0](https://github.com/recurly/recurly-client-php/tree/4.54.0) (2024-08-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.53.0...4.54.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (add UUID to external subscriptions) [#823](https://github.com/recurly/recurly-client-php/pull/823) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.53.0](https://github.com/recurly/recurly-client-php/tree/4.53.0) (2024-08-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.52.0...4.53.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#821](https://github.com/recurly/recurly-client-php/pull/821) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.52.0](https://github.com/recurly/recurly-client-php/tree/4.52.0) (2024-07-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.51.0...4.52.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Taxable Address Control, RevRec) [#817](https://github.com/recurly/recurly-client-php/pull/817) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.51.0](https://github.com/recurly/recurly-client-php/tree/4.51.0) (2024-05-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.50.0...4.51.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#814](https://github.com/recurly/recurly-client-php/pull/814) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.50.0](https://github.com/recurly/recurly-client-php/tree/4.50.0) (2024-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.49.0...4.50.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entity Use Code) [#812](https://github.com/recurly/recurly-client-php/pull/812) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.49.0](https://github.com/recurly/recurly-client-php/tree/4.49.0) (2024-05-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.48.0...4.49.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Proration Settings) [#810](https://github.com/recurly/recurly-client-php/pull/810) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.48.0](https://github.com/recurly/recurly-client-php/tree/4.48.0) (2024-05-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.47.0...4.48.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Auth & Capture) [#808](https://github.com/recurly/recurly-client-php/pull/808) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.47.0](https://github.com/recurly/recurly-client-php/tree/4.47.0) (2024-03-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.46.0...4.47.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#803](https://github.com/recurly/recurly-client-php/pull/803) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.46.0](https://github.com/recurly/recurly-client-php/tree/4.46.0) (2024-02-20) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.45.0...4.46.0) **Merged Pull Requests** - Add invoice state param for v2021-02-25 [#799](https://github.com/recurly/recurly-client-php/pull/799) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.45.0](https://github.com/recurly/recurly-client-php/tree/4.45.0) (2024-01-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.44.0...4.45.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#789](https://github.com/recurly/recurly-client-php/pull/789) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.44.0](https://github.com/recurly/recurly-client-php/tree/4.44.0) (2024-01-18) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.43.0...4.44.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#788](https://github.com/recurly/recurly-client-php/pull/788) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.43.0](https://github.com/recurly/recurly-client-php/tree/4.43.0) (2023-12-06) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.42.0...4.43.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Payment Phases) [#785](https://github.com/recurly/recurly-client-php/pull/785) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.42.0](https://github.com/recurly/recurly-client-php/tree/4.42.0) (2023-11-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.41.0...4.42.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#783](https://github.com/recurly/recurly-client-php/pull/783) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.41.0](https://github.com/recurly/recurly-client-php/tree/4.41.0) (2023-08-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.40.0...4.41.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (`VATNumber`, `LifecycleDecline`) [#782](https://github.com/recurly/recurly-client-php/pull/782) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.40.0](https://github.com/recurly/recurly-client-php/tree/4.40.0) (2023-08-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.39.0...4.40.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (action_result) [#781](https://github.com/recurly/recurly-client-php/pull/781) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.39.0](https://github.com/recurly/recurly-client-php/tree/4.39.0) (2023-07-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.37.0...4.39.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Ramp Dates, Net Terms, Invoice Business Entity) [#779](https://github.com/recurly/recurly-client-php/pull/779) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (App Management - External Subscriptions) [#777](https://github.com/recurly/recurly-client-php/pull/777) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.37.0](https://github.com/recurly/recurly-client-php/tree/4.37.0) (2023-06-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.36.0...4.37.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Multiple Business Entities) [#769](https://github.com/recurly/recurly-client-php/pull/769) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.36.0](https://github.com/recurly/recurly-client-php/tree/4.36.0) (2023-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.35.0...4.36.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Products & References) [#766](https://github.com/recurly/recurly-client-php/pull/766) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.35.0](https://github.com/recurly/recurly-client-php/tree/4.35.0) (2023-05-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.34.0...4.35.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (gateway_attributes on PaymentMethod) [#764](https://github.com/recurly/recurly-client-php/pull/764) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#747](https://github.com/recurly/recurly-client-php/pull/747) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.28.0](https://github.com/recurly/recurly-client-php/tree/4.28.0) (2023-02-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.27.0...4.28.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (GiftCard endpoints and new transaction error support) [#745](https://github.com/recurly/recurly-client-php/pull/745) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.27.0](https://github.com/recurly/recurly-client-php/tree/4.27.0) (2023-01-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.26.0...4.27.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Custom Fields on Line Items) [#738](https://github.com/recurly/recurly-client-php/pull/738) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.26.0](https://github.com/recurly/recurly-client-php/tree/4.26.0) (2023-01-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.25.0...4.26.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Account Preferred Time Zone) [#736](https://github.com/recurly/recurly-client-php/pull/736) ([douglasmiller](https://github.com/douglasmiller)) ## [4.25.0](https://github.com/recurly/recurly-client-php/tree/4.25.0) (2022-11-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.24.0...4.25.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Apply Credit Balance feature) [#732](https://github.com/recurly/recurly-client-php/pull/732) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.24.0](https://github.com/recurly/recurly-client-php/tree/4.24.0) (2022-11-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.23.0...4.24.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Subscriptions feature) [#729](https://github.com/recurly/recurly-client-php/pull/729) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#728](https://github.com/recurly/recurly-client-php/pull/728) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.23.0](https://github.com/recurly/recurly-client-php/tree/4.23.0) (2022-10-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.22.0...4.23.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entitlements feature) [#725](https://github.com/recurly/recurly-client-php/pull/725) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.22.0](https://github.com/recurly/recurly-client-php/tree/4.22.0) (2022-10-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.2...4.22.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25(Decimal Usage and Quantities and DunningEvent new fields) [#722](https://github.com/recurly/recurly-client-php/pull/722) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.2](https://github.com/recurly/recurly-client-php/tree/4.21.2) (2022-09-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.1...4.21.2) **Merged Pull Requests** - feat: allow for psr/log ^2/3 [#716](https://github.com/recurly/recurly-client-php/pull/716) ([trickeyone](https://github.com/trickeyone)) ## [4.21.1](https://github.com/recurly/recurly-client-php/tree/4.21.1) (2022-09-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.0...4.21.1) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#714](https://github.com/recurly/recurly-client-php/pull/714) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.0](https://github.com/recurly/recurly-client-php/tree/4.21.0) (2022-09-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.20.0...4.21.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#713](https://github.com/recurly/recurly-client-php/pull/713) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixes bug with putDunningCampaignBulkUpdate [#706](https://github.com/recurly/recurly-client-php/pull/706) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.20.0](https://github.com/recurly/recurly-client-php/tree/4.20.0) (2022-08-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.19.0...4.20.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#701](https://github.com/recurly/recurly-client-php/pull/701) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.19.0](https://github.com/recurly/recurly-client-php/tree/4.19.0) (2022-07-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.18.0...4.19.0) **Merged Pull Requests** - Fixing deprecation warnings in client [#697](https://github.com/recurly/recurly-client-php/pull/697) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#695](https://github.com/recurly/recurly-client-php/pull/695) ([recurly-integrations](https://github.com/recurly-integrations)) **Closed Issues** - Recurly\Pager and \Iterator return type mismatch (PHP 8.1 deprecation) [#677](https://github.com/recurly/recurly-client-php/issues/677) ## [4.18.0](https://github.com/recurly/recurly-client-php/tree/4.18.0) (2022-06-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.17.0...4.18.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#693](https://github.com/recurly/recurly-client-php/pull/693) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.17.0](https://github.com/recurly/recurly-client-php/tree/4.17.0) (2022-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.16.0...4.17.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#679](https://github.com/recurly/recurly-client-php/pull/679) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.16.0](https://github.com/recurly/recurly-client-php/tree/4.16.0) (2022-03-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.15.0...4.16.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#676](https://github.com/recurly/recurly-client-php/pull/676) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.15.0](https://github.com/recurly/recurly-client-php/tree/4.15.0) (2022-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.14.0...4.15.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#668](https://github.com/recurly/recurly-client-php/pull/668) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.14.0](https://github.com/recurly/recurly-client-php/tree/4.14.0) (2022-03-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.13.0...4.14.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#664](https://github.com/recurly/recurly-client-php/pull/664) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.13.0](https://github.com/recurly/recurly-client-php/tree/4.13.0) (2022-01-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.12.0...4.13.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#655](https://github.com/recurly/recurly-client-php/pull/655) ([recurly-integrations](https://github.com/recurly-integrations)) - Add region argument to client to connect in EU data center [#653](https://github.com/recurly/recurly-client-php/pull/653) ([FabricioCoutinho](https://github.com/FabricioCoutinho)) ## [4.12.0](https://github.com/recurly/recurly-client-php/tree/4.12.0) (2022-01-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.11.0...4.12.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Invoice Customization) [#654](https://github.com/recurly/recurly-client-php/pull/654) ([recurly-integrations](https://github.com/recurly-integrations)) diff --git a/composer.json b/composer.json index 3669d04..9acb363 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,38 @@ { "name": "recurly/recurly-client", - "version": "4.56.0", + "version": "4.57.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], "homepage": "https://github.com/recurly/recurly-client-php", "license": "MIT", "authors": [], "require": { "php": ">= 7.2.0", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "phpcompatibility/php-compatibility": "^9.3", "phpdocumentor/phpdocumentor": "~3.0.0", "phpstan/phpstan": "^0.12.11", "phpunit/phpunit": "^8", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "classmap": ["lib"], "files": ["lib/recurly.php"] }, "autoload-dev": { "classmap": ["tests"] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/lib/recurly/version.php b/lib/recurly/version.php index eaa8209..1da7b6d 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -1,8 +1,8 @@ <?php namespace Recurly; class Version { - public const CURRENT = '4.56.0'; + public const CURRENT = '4.57.0'; }
recurly/recurly-client-php
a387b68e60555546724a3705abd00a981fd08aba
Generated Latest Changes for v2021-02-25
diff --git a/lib/recurly/resources/external_account.php b/lib/recurly/resources/external_account.php index 259409d..ce3f5dd 100644 --- a/lib/recurly/resources/external_account.php +++ b/lib/recurly/resources/external_account.php @@ -1,163 +1,163 @@ <?php /** * This file is automatically created by Recurly's OpenAPI generation process * and thus any edits you make by hand will be lost. If you wish to make a * change to this file, please create a Github issue explaining the changes you * need and we will usher them to the appropriate places. */ namespace Recurly\Resources; use Recurly\RecurlyResource; // phpcs:disable class ExternalAccount extends RecurlyResource { private $_created_at; private $_external_account_code; private $_external_connection_type; private $_id; private $_object; private $_updated_at; protected static $array_hints = [ ]; /** * Getter method for the created_at attribute. * Created at * * @return ?string */ public function getCreatedAt(): ?string { return $this->_created_at; } /** * Setter method for the created_at attribute. * * @param string $created_at * * @return void */ public function setCreatedAt(string $created_at): void { $this->_created_at = $created_at; } /** * Getter method for the external_account_code attribute. * Represents the account code for the external account. * * @return ?string */ public function getExternalAccountCode(): ?string { return $this->_external_account_code; } /** * Setter method for the external_account_code attribute. * * @param string $external_account_code * * @return void */ public function setExternalAccountCode(string $external_account_code): void { $this->_external_account_code = $external_account_code; } /** * Getter method for the external_connection_type attribute. - * Represents the connection type. `AppleAppStore` or `GooglePlayStore` + * Represents the connection type. One of the connection types of your enabled App Connectors * * @return ?string */ public function getExternalConnectionType(): ?string { return $this->_external_connection_type; } /** * Setter method for the external_connection_type attribute. * * @param string $external_connection_type * * @return void */ public function setExternalConnectionType(string $external_connection_type): void { $this->_external_connection_type = $external_connection_type; } /** * Getter method for the id attribute. * UUID of the external_account . * * @return ?string */ public function getId(): ?string { return $this->_id; } /** * Setter method for the id attribute. * * @param string $id * * @return void */ public function setId(string $id): void { $this->_id = $id; } /** * Getter method for the object attribute. * * * @return ?string */ public function getObject(): ?string { return $this->_object; } /** * Setter method for the object attribute. * * @param string $object * * @return void */ public function setObject(string $object): void { $this->_object = $object; } /** * Getter method for the updated_at attribute. * Last updated at * * @return ?string */ public function getUpdatedAt(): ?string { return $this->_updated_at; } /** * Setter method for the updated_at attribute. * * @param string $updated_at * * @return void */ public function setUpdatedAt(string $updated_at): void { $this->_updated_at = $updated_at; } } \ No newline at end of file diff --git a/lib/recurly/resources/payment_method.php b/lib/recurly/resources/payment_method.php index dc20037..9b35d88 100644 --- a/lib/recurly/resources/payment_method.php +++ b/lib/recurly/resources/payment_method.php @@ -1,451 +1,475 @@ <?php /** * This file is automatically created by Recurly's OpenAPI generation process * and thus any edits you make by hand will be lost. If you wish to make a * change to this file, please create a Github issue explaining the changes you * need and we will usher them to the appropriate places. */ namespace Recurly\Resources; use Recurly\RecurlyResource; // phpcs:disable class PaymentMethod extends RecurlyResource { private $_account_type; private $_billing_agreement_id; private $_card_network_preference; private $_card_type; private $_cc_bin_country; private $_exp_month; private $_exp_year; private $_first_six; + private $_funding_source; private $_gateway_attributes; private $_gateway_code; private $_gateway_token; private $_last_four; private $_last_two; private $_name_on_account; private $_object; private $_routing_number; private $_routing_number_bank; private $_username; protected static $array_hints = [ ]; /** * Getter method for the account_type attribute. * The bank account type. Only present for ACH payment methods. * * @return ?string */ public function getAccountType(): ?string { return $this->_account_type; } /** * Setter method for the account_type attribute. * * @param string $account_type * * @return void */ public function setAccountType(string $account_type): void { $this->_account_type = $account_type; } /** * Getter method for the billing_agreement_id attribute. * Billing Agreement identifier. Only present for Amazon or Paypal payment methods. * * @return ?string */ public function getBillingAgreementId(): ?string { return $this->_billing_agreement_id; } /** * Setter method for the billing_agreement_id attribute. * * @param string $billing_agreement_id * * @return void */ public function setBillingAgreementId(string $billing_agreement_id): void { $this->_billing_agreement_id = $billing_agreement_id; } /** * Getter method for the card_network_preference attribute. * Represents the card network preference associated with the billing info for dual badged cards. Must be a supported card network. * * @return ?string */ public function getCardNetworkPreference(): ?string { return $this->_card_network_preference; } /** * Setter method for the card_network_preference attribute. * * @param string $card_network_preference * * @return void */ public function setCardNetworkPreference(string $card_network_preference): void { $this->_card_network_preference = $card_network_preference; } /** * Getter method for the card_type attribute. * Visa, MasterCard, American Express, Discover, JCB, etc. * * @return ?string */ public function getCardType(): ?string { return $this->_card_type; } /** * Setter method for the card_type attribute. * * @param string $card_type * * @return void */ public function setCardType(string $card_type): void { $this->_card_type = $card_type; } /** * Getter method for the cc_bin_country attribute. - * The 2-letter ISO 3166-1 alpha-2 country code associated with the credit card BIN, if known by Recurly. Available on the BillingInfo object only. Available when the BIN country lookup feature is enabled. + * The 2-letter ISO 3166-1 alpha-2 country code associated with the card's issuer, if known. * * @return ?string */ public function getCcBinCountry(): ?string { return $this->_cc_bin_country; } /** * Setter method for the cc_bin_country attribute. * * @param string $cc_bin_country * * @return void */ public function setCcBinCountry(string $cc_bin_country): void { $this->_cc_bin_country = $cc_bin_country; } /** * Getter method for the exp_month attribute. * Expiration month. * * @return ?int */ public function getExpMonth(): ?int { return $this->_exp_month; } /** * Setter method for the exp_month attribute. * * @param int $exp_month * * @return void */ public function setExpMonth(int $exp_month): void { $this->_exp_month = $exp_month; } /** * Getter method for the exp_year attribute. * Expiration year. * * @return ?int */ public function getExpYear(): ?int { return $this->_exp_year; } /** * Setter method for the exp_year attribute. * * @param int $exp_year * * @return void */ public function setExpYear(int $exp_year): void { $this->_exp_year = $exp_year; } /** * Getter method for the first_six attribute. * Credit card number's first six digits. * * @return ?string */ public function getFirstSix(): ?string { return $this->_first_six; } /** * Setter method for the first_six attribute. * * @param string $first_six * * @return void */ public function setFirstSix(string $first_six): void { $this->_first_six = $first_six; } + /** + * Getter method for the funding_source attribute. + * The funding source of the card, if known. + * + * @return ?string + */ + public function getFundingSource(): ?string + { + return $this->_funding_source; + } + + /** + * Setter method for the funding_source attribute. + * + * @param string $funding_source + * + * @return void + */ + public function setFundingSource(string $funding_source): void + { + $this->_funding_source = $funding_source; + } + /** * Getter method for the gateway_attributes attribute. * Gateway specific attributes associated with this PaymentMethod * * @return ?\Recurly\Resources\GatewayAttributes */ public function getGatewayAttributes(): ?\Recurly\Resources\GatewayAttributes { return $this->_gateway_attributes; } /** * Setter method for the gateway_attributes attribute. * * @param \Recurly\Resources\GatewayAttributes $gateway_attributes * * @return void */ public function setGatewayAttributes(\Recurly\Resources\GatewayAttributes $gateway_attributes): void { $this->_gateway_attributes = $gateway_attributes; } /** * Getter method for the gateway_code attribute. * An identifier for a specific payment gateway. * * @return ?string */ public function getGatewayCode(): ?string { return $this->_gateway_code; } /** * Setter method for the gateway_code attribute. * * @param string $gateway_code * * @return void */ public function setGatewayCode(string $gateway_code): void { $this->_gateway_code = $gateway_code; } /** * Getter method for the gateway_token attribute. * A token used in place of a credit card in order to perform transactions. * * @return ?string */ public function getGatewayToken(): ?string { return $this->_gateway_token; } /** * Setter method for the gateway_token attribute. * * @param string $gateway_token * * @return void */ public function setGatewayToken(string $gateway_token): void { $this->_gateway_token = $gateway_token; } /** * Getter method for the last_four attribute. * Credit card number's last four digits. Will refer to bank account if payment method is ACH. * * @return ?string */ public function getLastFour(): ?string { return $this->_last_four; } /** * Setter method for the last_four attribute. * * @param string $last_four * * @return void */ public function setLastFour(string $last_four): void { $this->_last_four = $last_four; } /** * Getter method for the last_two attribute. * The IBAN bank account's last two digits. * * @return ?string */ public function getLastTwo(): ?string { return $this->_last_two; } /** * Setter method for the last_two attribute. * * @param string $last_two * * @return void */ public function setLastTwo(string $last_two): void { $this->_last_two = $last_two; } /** * Getter method for the name_on_account attribute. * The name associated with the bank account. * * @return ?string */ public function getNameOnAccount(): ?string { return $this->_name_on_account; } /** * Setter method for the name_on_account attribute. * * @param string $name_on_account * * @return void */ public function setNameOnAccount(string $name_on_account): void { $this->_name_on_account = $name_on_account; } /** * Getter method for the object attribute. * * * @return ?string */ public function getObject(): ?string { return $this->_object; } /** * Setter method for the object attribute. * * @param string $object * * @return void */ public function setObject(string $object): void { $this->_object = $object; } /** * Getter method for the routing_number attribute. * The bank account's routing number. Only present for ACH payment methods. * * @return ?string */ public function getRoutingNumber(): ?string { return $this->_routing_number; } /** * Setter method for the routing_number attribute. * * @param string $routing_number * * @return void */ public function setRoutingNumber(string $routing_number): void { $this->_routing_number = $routing_number; } /** * Getter method for the routing_number_bank attribute. * The bank name of this routing number. * * @return ?string */ public function getRoutingNumberBank(): ?string { return $this->_routing_number_bank; } /** * Setter method for the routing_number_bank attribute. * * @param string $routing_number_bank * * @return void */ public function setRoutingNumberBank(string $routing_number_bank): void { $this->_routing_number_bank = $routing_number_bank; } /** * Getter method for the username attribute. * Username of the associated payment method. Currently only associated with Venmo. * * @return ?string */ public function getUsername(): ?string { return $this->_username; } /** * Setter method for the username attribute. * * @param string $username * * @return void */ public function setUsername(string $username): void { $this->_username = $username; } } \ No newline at end of file diff --git a/openapi/api.yaml b/openapi/api.yaml index ea3982f..f9c6768 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -18329,1025 +18329,1025 @@ components: description: Unique code to identify an item. Available when the `Credit Invoices` feature is enabled. If `item_id` and `item_code` are both present, `item_id` will be used. pattern: "/^[a-z0-9_+-]+$/" maxLength: 50 item_id: type: string title: Item ID description: System-generated unique identifier for an item. Available when the `Credit Invoices` feature is enabled. If `item_id` and `item_code` are both present, `item_id` will be used. maxLength: 13 code: type: string title: Add-on code description: The unique identifier for the add-on within its plan. If `item_code`/`item_id` is part of the request then `code` must be absent. If `item_code`/`item_id` is not present `code` is required. maxLength: 50 name: type: string title: Name description: Describes your add-on and will appear in subscribers' invoices. If `item_code`/`item_id` is part of the request then `name` must be absent. If `item_code`/`item_id` is not present `name` is required. maxLength: 255 add_on_type: "$ref": "#/components/schemas/AddOnTypeCreateEnum" usage_type: "$ref": "#/components/schemas/UsageTypeCreateEnum" usage_calculation_type: "$ref": "#/components/schemas/UsageCalculationTypeEnum" usage_percentage: type: number format: float title: Usage Percentage description: The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. Required if `add_on_type` is usage, `tier_type` is `flat` and `usage_type` is percentage. Must be omitted otherwise. measured_unit_id: type: string title: Measured Unit ID description: System-generated unique identifier for a measured unit to be associated with the add-on. Either `measured_unit_id` or `measured_unit_name` are required when `add_on_type` is `usage`. If `measured_unit_id` and `measured_unit_name` are both present, `measured_unit_id` will be used. maxLength: 13 measured_unit_name: type: string title: Measured Unit Name description: Name of a measured unit to be associated with the add-on. Either `measured_unit_id` or `measured_unit_name` are required when `add_on_type` is `usage`. If `measured_unit_id` and `measured_unit_name` are both present, `measured_unit_id` will be used. plan_id: type: string title: Plan ID maxLength: 13 readOnly: true liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 accounting_code: type: string title: Accounting code description: Accounting code for invoice line items for this add-on. If no value is provided, it defaults to add-on's code. If `item_code`/`item_id` is part of the request then `accounting_code` must be absent. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 revenue_schedule_type: title: Revenue schedule type description: When this add-on is invoiced, the line item will use this revenue schedule. If `item_code`/`item_id` is part of the request then `revenue_schedule_type` must be absent in the request as the value will be set from the item. "$ref": "#/components/schemas/RevenueScheduleTypeEnum" display_quantity: type: boolean title: Display quantity? description: Determines if the quantity field is displayed on the hosted pages for the add-on. default: false default_quantity: type: integer title: Default quantity description: Default quantity for the hosted pages. default: 1 optional: type: boolean title: Optional description: Whether the add-on is optional for the customer to include in their purchase on the hosted payment page. If false, the add-on will be included when a subscription is created through the Recurly UI. However, the add-on will not be included when a subscription is created through the API. avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `AddOn`, then the `avalara_transaction_type` must be absent. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `AddOn`, then the `avalara_service_type` must be absent. minimum: 0 tax_code: type: string maxLength: 50 title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes. If `item_code`/`item_id` is part of the request then `tax_code` must be absent. currencies: type: array title: Add-on pricing items: "$ref": "#/components/schemas/AddOnPricing" minItems: 1 description: | * If `item_code`/`item_id` is part of the request and the item has a default currency, then `currencies` is optional. If the item does not have a default currency, then `currencies` is required. If `item_code`/`item_id` is not present `currencies` is required. * If the add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `currencies` must be absent. * Must be absent if `add_on_type` is `usage` and `usage_type` is `percentage`. tier_type: "$ref": "#/components/schemas/TierTypeEnum" usage_timeframe: "$ref": "#/components/schemas/UsageTimeframeCreateEnum" tiers: type: array title: Tiers items: "$ref": "#/components/schemas/Tier" description: | If the tier_type is `flat`, then `tiers` must be absent. The `tiers` object must include one to many tiers with `ending_quantity` and `unit_amount` for the desired `currencies`. There must be one tier without an `ending_quantity` value which represents the final tier. percentage_tiers: type: array title: Percentage Tiers By Currency items: "$ref": "#/components/schemas/PercentageTiersByCurrency" description: | Array of objects which must have at least one set of tiers per currency and the currency code. The tier_type must be `volume` or `tiered`, if not, it must be absent. There must be one tier without an `ending_amount` value which represents the final tier. This feature is currently in development and requires approval and enablement, please contact support. required: - code - name AddOnUpdate: type: object title: Add-on description: Full add-on details. properties: id: type: string title: Add-on ID maxLength: 13 readOnly: true code: type: string title: Add-on code description: The unique identifier for the add-on within its plan. If an `Item` is associated to the `AddOn` then `code` must be absent. maxLength: 50 name: type: string title: Name description: Describes your add-on and will appear in subscribers' invoices. If an `Item` is associated to the `AddOn` then `name` must be absent. maxLength: 255 usage_percentage: type: number format: float title: Usage Percentage description: The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. Required if `add_on_type` is usage, `tier_type` is `flat` and `usage_type` is percentage. Must be omitted otherwise. usage_calculation_type: "$ref": "#/components/schemas/UsageCalculationTypeEnum" measured_unit_id: type: string title: Measured Unit ID description: System-generated unique identifier for a measured unit to be associated with the add-on. Either `measured_unit_id` or `measured_unit_name` are required when `add_on_type` is `usage`. If `measured_unit_id` and `measured_unit_name` are both present, `measured_unit_id` will be used. maxLength: 13 measured_unit_name: type: string title: Measured Unit Name description: Name of a measured unit to be associated with the add-on. Either `measured_unit_id` or `measured_unit_name` are required when `add_on_type` is `usage`. If `measured_unit_id` and `measured_unit_name` are both present, `measured_unit_id` will be used. accounting_code: type: string title: Accounting code description: Accounting code for invoice line items for this add-on. If no value is provided, it defaults to add-on's code. If an `Item` is associated to the `AddOn` then `accounting code` must be absent. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_schedule_type: title: Revenue schedule type description: When this add-on is invoiced, the line item will use this revenue schedule. If `item_code`/`item_id` is part of the request then `revenue_schedule_type` must be absent in the request as the value will be set from the item. "$ref": "#/components/schemas/RevenueScheduleTypeEnum" avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `AddOn`, then the `avalara_transaction_type` must be absent. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `AddOn`, then the `avalara_service_type` must be absent. minimum: 0 tax_code: type: string maxLength: 50 title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes. If an `Item` is associated to the `AddOn` then `tax_code` must be absent. display_quantity: type: boolean title: Display quantity? description: Determines if the quantity field is displayed on the hosted pages for the add-on. default: false default_quantity: type: integer title: Default quantity description: Default quantity for the hosted pages. default: 1 optional: type: boolean title: Optional description: Whether the add-on is optional for the customer to include in their purchase on the hosted payment page. If false, the add-on will be included when a subscription is created through the Recurly UI. However, the add-on will not be included when a subscription is created through the API. currencies: type: array title: Add-on pricing items: "$ref": "#/components/schemas/AddOnPricing" minItems: 1 description: | If the add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then currencies must be absent. Must also be absent if `add_on_type` is `usage` and `usage_type` is `percentage`. tiers: type: array title: Tiers items: "$ref": "#/components/schemas/Tier" description: | If the tier_type is `flat`, then `tiers` must be absent. The `tiers` object must include one to many tiers with `ending_quantity` and `unit_amount` for the desired `currencies`. There must be one tier without an `ending_quantity` value which represents the final tier. percentage_tiers: type: array title: Percentage Tiers By Currency items: "$ref": "#/components/schemas/PercentageTiersByCurrency" description: | `percentage_tiers` is an array of objects, which must have the set of tiers per currency and the currency code. The tier_type must be `volume` or `tiered`, if not, it must be absent. There must be one tier without an `ending_amount` value which represents the final tier. This feature is currently in development and requires approval and enablement, please contact support. BillingInfo: type: object properties: id: type: string maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true account_id: type: string maxLength: 13 readOnly: true first_name: type: string maxLength: 50 last_name: type: string maxLength: 50 company: type: string maxLength: 100 address: "$ref": "#/components/schemas/Address" vat_number: type: string description: Customer's VAT number (to avoid having the VAT applied). This is only used for automatically collected invoices. valid: type: boolean readOnly: true payment_method: "$ref": "#/components/schemas/PaymentMethod" fraud: type: object x-class-name: FraudInfo title: Fraud information description: Most recent fraud result. readOnly: true properties: score: type: integer title: Kount score minimum: 1 maximum: 99 decision: title: Kount decision maxLength: 10 "$ref": "#/components/schemas/KountDecisionEnum" risk_rules_triggered: type: object title: Kount rules primary_payment_method: type: boolean description: The `primary_payment_method` field is used to indicate the primary billing info on the account. The first billing info created on an account will always become primary. This payment method will be used backup_payment_method: type: boolean description: The `backup_payment_method` field is used to indicate a billing info as a backup on the account that will be tried if the initial billing info used for an invoice is declined. payment_gateway_references: type: array description: Array of Payment Gateway References, each a reference to a third-party gateway object of varying types. items: "$ref": "#/components/schemas/PaymentGatewayReferences" created_at: type: string format: date-time description: When the billing information was created. readOnly: true updated_at: type: string format: date-time description: When the billing information was last changed. readOnly: true updated_by: type: object x-class-name: BillingInfoUpdatedBy readOnly: true properties: ip: type: string description: Customer's IP address when updating their billing information. maxLength: 20 country: type: string description: Country, 2-letter ISO 3166-1 alpha-2 code matching the origin IP address, if known by Recurly. maxLength: 2 BillingInfoCreate: type: object properties: token_id: type: string title: Token ID description: A token [generated by Recurly.js](https://recurly.com/developers/reference/recurly-js/#getting-a-token). maxLength: 22 first_name: type: string title: First name maxLength: 50 last_name: type: string title: Last name maxLength: 50 company: type: string title: Company name maxLength: 100 address: "$ref": "#/components/schemas/Address" number: type: string title: Credit card number description: Credit card number, spaces and dashes are accepted. month: type: string title: Expiration month maxLength: 2 year: type: string title: Expiration year maxLength: 4 cvv: type: string title: Security code or CVV description: "*STRONGLY RECOMMENDED*" maxLength: 4 currency: type: string description: 3-letter ISO 4217 currency code. vat_number: type: string title: VAT number ip_address: type: string title: IP address description: "*STRONGLY RECOMMENDED* Customer's IP address when updating their billing information." maxLength: 20 gateway_token: type: string title: A token used in place of a credit card in order to perform transactions. Must be used in conjunction with `gateway_code`. maxLength: 50 gateway_code: type: string title: An identifier for a specific payment gateway. maxLength: 12 payment_gateway_references: type: array description: Array of Payment Gateway References, each a reference to a third-party gateway object of varying types. items: "$ref": "#/components/schemas/PaymentGatewayReferences" properties: token: - type: strings + type: string maxLength: 50 reference_type: type: string "$ref": "#/components/schemas/PaymentGatewayReferencesEnum" gateway_attributes: type: object description: Additional attributes to send to the gateway. x-class-name: GatewayAttributes properties: account_reference: type: string description: Used by Adyen and Braintree gateways. For Adyen the Shopper Reference value used when the external token was created. Must be used in conjunction with gateway_token and gateway_code. For Braintree the PayPal PayerID is populated in the response. maxLength: 264 amazon_billing_agreement_id: type: string title: Amazon billing agreement ID paypal_billing_agreement_id: type: string title: PayPal billing agreement ID roku_billing_agreement_id: type: string title: Roku's CIB if billing through Roku fraud_session_id: type: string title: Fraud Session ID transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" three_d_secure_action_result_token_id: type: string title: 3-D Secure action result token ID description: A token generated by Recurly.js after completing a 3-D Secure device fingerprinting or authentication challenge. maxLength: 22 iban: type: string maxLength: 34 description: The International Bank Account Number, up to 34 alphanumeric characters comprising a country code; two check digits; and a number that includes the domestic bank account number, branch identifier, and potential routing information name_on_account: type: string maxLength: 255 description: The name associated with the bank account (ACH, SEPA, Bacs only) account_number: type: string maxLength: 255 description: The bank account number. (ACH, Bacs only) routing_number: type: string maxLength: 15 description: The bank's rounting number. (ACH only) sort_code: type: string maxLength: 15 description: Bank identifier code for UK based banks. Required for Bacs based billing infos. (Bacs only) type: "$ref": "#/components/schemas/AchTypeEnum" account_type: "$ref": "#/components/schemas/AchAccountTypeEnum" tax_identifier: type: string description: Tax identifier is required if adding a billing info that is a consumer card in Brazil or in Argentina. This would be the customer's CPF/CNPJ (Brazil) and CUIT (Argentina). CPF, CNPJ and CUIT are tax identifiers for all residents who pay taxes in Brazil and Argentina respectively. tax_identifier_type: description: This field and a value of `cpf`, `cnpj` or `cuit` are required if adding a billing info that is an elo or hipercard type in Brazil or in Argentina. "$ref": "#/components/schemas/TaxIdentifierTypeEnum" primary_payment_method: type: boolean title: Primary Payment Method description: The `primary_payment_method` field is used to designate the primary billing info on the account. The first billing info created on an account will always become primary. Adding additional billing infos provides the flexibility to mark another billing info as primary, or adding additional non-primary billing infos. This can be accomplished by passing the `primary_payment_method` with a value of `true`. When adding billing infos via the billing_info and /accounts endpoints, this value is not permitted, and will return an error if provided. backup_payment_method: type: boolean description: The `backup_payment_method` field is used to designate a billing info as a backup on the account that will be tried if the initial billing info used for an invoice is declined. All payment methods, including the billing info marked `primary_payment_method` can be set as a backup. An account can have a maximum of 1 backup, if a user sets a different payment method as a backup, the existing backup will no longer be marked as such. external_hpp_type: "$ref": "#/components/schemas/ExternalHppTypeEnum" online_banking_payment_type: "$ref": "#/components/schemas/OnlineBankingPaymentTypeEnum" deprecated: true card_type: "$ref": "#/components/schemas/CardTypeEnum" card_network_preference: description: Represents the card network preference associated with the billing info for dual badged cards. Must be a supported card network. "$ref": "#/components/schemas/CardNetworkEnum" BillingInfoVerify: type: object properties: gateway_code: type: string description: An identifier for a specific payment gateway. maxLength: 13 BillingInfoVerifyCVV: type: object properties: verification_value: type: string description: Unique security code for a credit card. Coupon: type: object properties: id: type: string title: Coupon ID readOnly: true object: type: string title: Object type readOnly: true code: type: string title: Coupon code description: The code the customer enters to redeem the coupon. name: type: string title: Name description: The internal name for the coupon. state: title: State description: Indicates if the coupon is redeemable, and if it is not, why. "$ref": "#/components/schemas/CouponStateEnum" max_redemptions: type: integer title: Max redemptions description: A maximum number of redemptions for the coupon. The coupon will expire when it hits its maximum redemptions. max_redemptions_per_account: type: integer title: Max redemptions per account description: Redemptions per account is the number of times a specific account can redeem the coupon. Set redemptions per account to `1` if you want to keep customers from gaming the system and getting more than one discount from the coupon campaign. unique_coupon_codes_count: type: integer title: Unique coupon codes count description: When this number reaches `max_redemptions` the coupon will no longer be redeemable. readOnly: true unique_code_template: type: string title: Unique code template description: On a bulk coupon, the template from which unique coupon codes are generated. unique_coupon_code: allOf: - "$ref": "#/components/schemas/UniqueCouponCode" type: object description: Will be populated when the Coupon being returned is a `UniqueCouponCode`. duration: title: Duration description: | - "single_use" coupons applies to the first invoice only. - "temporal" coupons will apply to invoices for the duration determined by the `temporal_unit` and `temporal_amount` attributes. "$ref": "#/components/schemas/CouponDurationEnum" temporal_amount: type: integer title: Temporal amount description: If `duration` is "temporal" than `temporal_amount` is an integer which is multiplied by `temporal_unit` to define the duration that the coupon will be applied to invoices for. temporal_unit: title: Temporal unit description: If `duration` is "temporal" than `temporal_unit` is multiplied by `temporal_amount` to define the duration that the coupon will be applied to invoices for. "$ref": "#/components/schemas/TemporalUnitEnum" free_trial_unit: title: Free trial unit description: Description of the unit of time the coupon is for. Used with `free_trial_amount` to determine the duration of time the coupon is for. "$ref": "#/components/schemas/FreeTrialUnitEnum" free_trial_amount: type: integer title: Free trial amount description: Sets the duration of time the `free_trial_unit` is for. minimum: 1 maximum: 9999 applies_to_all_plans: type: boolean title: Applies to all plans? description: The coupon is valid for all plans if true. If false then `plans` will list the applicable plans. default: true applies_to_all_items: type: boolean title: Applies to all items? description: | The coupon is valid for all items if true. If false then `items` will list the applicable items. default: false applies_to_non_plan_charges: type: boolean title: Applied to all non-plan charges? description: The coupon is valid for one-time, non-plan charges if true. default: false plans: type: array title: Plans description: A list of plans for which this coupon applies. This will be `null` if `applies_to_all_plans=true`. items: "$ref": "#/components/schemas/PlanMini" items: type: array title: Items description: | A list of items for which this coupon applies. This will be `null` if `applies_to_all_items=true`. items: "$ref": "#/components/schemas/ItemMini" redemption_resource: title: Redemption resource description: Whether the discount is for all eligible charges on the account, or only a specific subscription. default: account "$ref": "#/components/schemas/RedemptionResourceEnum" discount: "$ref": "#/components/schemas/CouponDiscount" coupon_type: title: 'Coupon type (TODO: implement coupon generation)' description: Whether the coupon is "single_code" or "bulk". Bulk coupons will require a `unique_code_template` and will generate unique codes through the `/generate` endpoint. "$ref": "#/components/schemas/CouponTypeEnum" hosted_page_description: type: string title: Hosted Payment Pages description description: This description will show up when a customer redeems a coupon on your Hosted Payment Pages, or if you choose to show the description on your own checkout page. invoice_description: type: string title: Invoice description description: Description of the coupon on the invoice. maxLength: 255 redeem_by: type: string title: Redeem by description: The date and time the coupon will expire and can no longer be redeemed. Time is always 11:59:59, the end-of-day Pacific time. format: date-time created_at: type: string title: Created at format: date-time readOnly: true updated_at: type: string title: Last updated at format: date-time readOnly: true expired_at: type: string title: Expired at description: The date and time the coupon was expired early or reached its `max_redemptions`. format: date-time CouponCreate: allOf: - "$ref": "#/components/schemas/CouponUpdate" - type: object properties: code: type: string title: Coupon code description: The code the customer enters to redeem the coupon. discount_type: title: Discount type description: The type of discount provided by the coupon (how the amount discounted is calculated) "$ref": "#/components/schemas/DiscountTypeEnum" discount_percent: type: integer title: Discount percent description: The percent of the price discounted by the coupon. Required if `discount_type` is `percent`. free_trial_unit: title: Free trial unit description: Description of the unit of time the coupon is for. Used with `free_trial_amount` to determine the duration of time the coupon is for. Required if `discount_type` is `free_trial`. "$ref": "#/components/schemas/FreeTrialUnitEnum" free_trial_amount: type: integer title: Free trial amount description: Sets the duration of time the `free_trial_unit` is for. Required if `discount_type` is `free_trial`. minimum: 1 maximum: 9999 currencies: title: Currencies description: Fixed discount currencies by currency. Required if the coupon type is `fixed`. This parameter should contain the coupon discount values type: array items: "$ref": "#/components/schemas/CouponPricing" applies_to_non_plan_charges: type: boolean title: Applied to all non-plan charges? description: The coupon is valid for one-time, non-plan charges if true. default: false applies_to_all_plans: type: boolean title: Applies to all plans? description: The coupon is valid for all plans if true. If false then `plans` will list the applicable plans. default: true applies_to_all_items: type: boolean title: Applies to all items? description: | To apply coupon to Items in your Catalog, include a list of `item_codes` in the request that the coupon will apply to. Or set value to true to apply to all Items in your Catalog. The following values are not permitted when `applies_to_all_items` is included: `free_trial_amount` and `free_trial_unit`. default: false plan_codes: type: array title: Plan codes description: | List of plan codes to which this coupon applies. Required if `applies_to_all_plans` is false. Overrides `applies_to_all_plans` when `applies_to_all_plans` is true. items: type: string item_codes: type: array title: Item codes description: | List of item codes to which this coupon applies. Sending `item_codes` is only permitted when `applies_to_all_items` is set to false. The following values are not permitted when `item_codes` is included: `free_trial_amount` and `free_trial_unit`. items: type: string duration: title: Duration description: | This field does not apply when the discount_type is `free_trial`. - "single_use" coupons applies to the first invoice only. - "temporal" coupons will apply to invoices for the duration determined by the `temporal_unit` and `temporal_amount` attributes. - "forever" coupons will apply to invoices forever. default: forever "$ref": "#/components/schemas/CouponDurationEnum" temporal_amount: type: integer title: Temporal amount description: If `duration` is "temporal" than `temporal_amount` is an integer which is multiplied by `temporal_unit` to define the duration that the coupon will be applied to invoices for. temporal_unit: title: Temporal unit description: If `duration` is "temporal" than `temporal_unit` is multiplied by `temporal_amount` to define the duration that the coupon will be applied to invoices for. "$ref": "#/components/schemas/TemporalUnitEnum" coupon_type: title: Coupon type description: Whether the coupon is "single_code" or "bulk". Bulk coupons will require a `unique_code_template` and will generate unique codes through the `/generate` endpoint. "$ref": "#/components/schemas/CouponTypeEnum" unique_code_template: type: string title: Unique code template description: | On a bulk coupon, the template from which unique coupon codes are generated. - You must start the template with your coupon_code wrapped in single quotes. - Outside of single quotes, use a 9 for a character that you want to be a random number. - Outside of single quotes, use an "x" for a character that you want to be a random letter. - Outside of single quotes, use an * for a character that you want to be a random number or letter. - Use single quotes ' ' for characters that you want to remain static. These strings can be alphanumeric and may contain a - _ or +. For example: "'abc-'****'-def'" redemption_resource: title: Redemption resource description: Whether the discount is for all eligible charges on the account, or only a specific subscription. default: account "$ref": "#/components/schemas/RedemptionResourceEnum" required: - code - discount_type - name CouponPricing: type: object properties: currency: type: string description: 3-letter ISO 4217 currency code. discount: type: number format: float description: The fixed discount (in dollars) for the corresponding currency. CouponDiscount: type: object description: | Details of the discount a coupon applies. Will contain a `type` property and one of the following properties: `percent`, `fixed`, `trial`. properties: type: "$ref": "#/components/schemas/DiscountTypeEnum" percent: description: This is only present when `type=percent`. type: integer currencies: type: array description: This is only present when `type=fixed`. items: "$ref": "#/components/schemas/CouponDiscountPricing" trial: type: object x-class-name: CouponDiscountTrial description: This is only present when `type=free_trial`. properties: unit: title: Trial unit description: Temporal unit of the free trial "$ref": "#/components/schemas/FreeTrialUnitEnum" length: type: integer title: Trial length description: Trial length measured in the units specified by the sibling `unit` property CouponDiscountPricing: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 amount: type: number format: float title: Discount Amount description: Value of the fixed discount that this coupon applies. CouponBulkCreate: type: object properties: number_of_unique_codes: type: integer title: Number of unique codes description: The quantity of unique coupon codes to generate. A bulk coupon can have up to 100,000 unique codes (or your site's configured limit). minimum: 1 CouponMini: type: object properties: id: type: string title: Coupon ID readOnly: true object: type: string title: Object type readOnly: true code: type: string title: Coupon code description: The code the customer enters to redeem the coupon. name: type: string title: Name description: The internal name for the coupon. state: title: State description: Indicates if the coupon is redeemable, and if it is not, why. "$ref": "#/components/schemas/CouponStateEnum" discount: "$ref": "#/components/schemas/CouponDiscount" coupon_type: title: 'Coupon type (TODO: implement coupon generation)' description: Whether the coupon is "single_code" or "bulk". Bulk coupons will require a `unique_code_template` and will generate unique codes through the `/generate` endpoint. "$ref": "#/components/schemas/CouponTypeEnum" expired_at: type: string title: Expired at description: The date and time the coupon was expired early or reached its `max_redemptions`. format: date-time CouponRedemption: type: object properties: id: @@ -24805,1576 +24805,1579 @@ components: take precedence. maxLength: 13 address: "$ref": "#/components/schemas/ShippingAddressCreate" fees: type: array title: Shipping fees description: A list of shipping fees to be created as charges with the purchase. items: "$ref": "#/components/schemas/ShippingFeeCreate" line_items: type: array title: Line items description: A list of one time charges or credits to be created with the purchase. items: "$ref": "#/components/schemas/LineItemCreate" subscriptions: type: array title: Subscriptions description: A list of subscriptions to be created with the purchase. items: "$ref": "#/components/schemas/SubscriptionPurchase" coupon_codes: type: array title: Coupon codes description: A list of coupon_codes to be redeemed on the subscription or account during the purchase. items: type: string gift_card_redemption_code: type: string title: Gift card redemption code description: A gift card redemption code to be redeemed on the purchase invoice. transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" required: - currency - account DunningCampaign: type: object description: Settings for a dunning campaign. properties: id: type: string object: type: string title: Object type code: type: string description: Campaign code. name: type: string description: Campaign name. description: type: string description: Campaign description. default_campaign: type: boolean description: Whether or not this is the default campaign for accounts or plans without an assigned dunning campaign. dunning_cycles: type: array description: Dunning Cycle settings. items: "$ref": "#/components/schemas/DunningCycle" created_at: type: string format: date-time description: When the current campaign was created in Recurly. updated_at: type: string format: date-time description: When the current campaign was updated in Recurly. deleted_at: type: string format: date-time description: When the current campaign was deleted in Recurly. DunningCampaignList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/DunningCampaign" DunningCycle: type: object properties: type: "$ref": "#/components/schemas/DunningCycleTypeEnum" applies_to_manual_trial: type: boolean description: Whether the dunning settings will be applied to manual trials. Only applies to trial cycles. first_communication_interval: type: integer description: The number of days after a transaction failure before the first dunning email is sent. send_immediately_on_hard_decline: type: boolean description: Whether or not to send an extra email immediately to customers whose initial payment attempt fails with either a hard decline or invalid billing info. intervals: type: array description: Dunning intervals. items: "$ref": "#/components/schemas/DunningInterval" expire_subscription: type: boolean description: Whether the subscription(s) should be cancelled at the end of the dunning cycle. fail_invoice: type: boolean description: Whether the invoice should be failed at the end of the dunning cycle. total_dunning_days: type: integer description: The number of days between the first dunning email being sent and the end of the dunning cycle. total_recycling_days: type: integer description: The number of days between a transaction failure and the end of the dunning cycle. version: type: integer description: Current campaign version. created_at: type: string format: date-time description: When the current settings were created in Recurly. updated_at: type: string format: date-time description: When the current settings were updated in Recurly. DunningInterval: properties: days: type: integer description: Number of days before sending the next email. email_template: type: string description: Email template being used. DunningCampaignsBulkUpdate: properties: plan_codes: type: array maxItems: 200 description: List of `plan_codes` associated with the Plans for which the dunning campaign should be updated. Required unless `plan_ids` is present. items: type: string plan_ids: type: array maxItems: 200 description: List of `plan_ids` associated with the Plans for which the dunning campaign should be updated. Required unless `plan_codes` is present. items: type: string DunningCampaignsBulkUpdateResponse: properties: object: type: string title: Object type readOnly: true plans: type: array title: Plans description: An array containing all of the `Plan` resources that have been updated. maxItems: 200 items: "$ref": "#/components/schemas/Plan" Entitlements: type: object description: A list of privileges granted to a customer through the purchase of a plan or item. properties: object: type: string title: Object Type has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/Entitlement" Entitlement: type: object properties: object: type: string description: Entitlement customer_permission: "$ref": "#/components/schemas/CustomerPermission" granted_by: type: array description: Subscription or item that granted the customer permission. items: "$ref": "#/components/schemas/GrantedBy" created_at: type: string format: date-time description: Time object was created. updated_at: type: string format: date-time description: Time the object was last updated ExternalChargeCreate: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 unit_amount: type: string format: decimal quantity: type: integer description: type: string external_product_reference: "$ref": "#/components/schemas/ExternalProductReferenceCreate" required: - quantity - currency - unit_amount AccountExternalSubscription: allOf: - type: object properties: account_code: type: string description: The account code of a new or existing account to be used when creating the external subscription. maxLength: 50 required: - account_code ExternalPaymentPhase: type: object description: Details of payments in the lifecycle of a subscription from an external resource that is not managed by the Recurly platform, e.g. App Store or Google Play Store. properties: id: type: string title: External payment phase ID description: System-generated unique identifier for an external payment phase ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type started_at: type: string format: date-time title: Started At ends_at: type: string format: date-time title: Ends At starting_billing_period_index: type: integer title: Starting Billing Period Index ending_billing_period_index: type: integer title: Ending Billing Period Index offer_type: type: string title: Offer Type description: Type of discount offer given, e.g. "FREE_TRIAL" offer_name: type: string title: Offer Name description: Name of the discount offer given, e.g. "introductory" period_count: type: integer title: Period Count description: Number of billing periods period_length: type: string title: Period Length description: Billing cycle length amount: type: string format: decimal title: Amount minimum: 0 description: Allows up to 9 decimal places currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 created_at: type: string format: date-time title: Created at description: When the external subscription was created in Recurly. updated_at: type: string format: date-time title: Updated at description: When the external subscription was updated in Recurly. ExternalPaymentPhaseList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalPaymentPhase" ExternalProduct: type: object description: Product from an external resource such as Apple App Store or Google Play Store. properties: id: type: string title: External product ID. description: System-generated unique identifier for an external product ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type name: type: string title: Name description: Name to identify the external product in Recurly. plan: "$ref": "#/components/schemas/PlanMini" created_at: type: string format: date-time description: When the external product was created in Recurly. updated_at: type: string format: date-time description: When the external product was updated in Recurly. external_product_references: type: array title: External Product References description: List of external product references of the external product. items: "$ref": "#/components/schemas/ExternalProductReferenceMini" ExternalProductList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalProduct" ExternalProductCreate: type: object properties: name: type: string description: External product name. plan_id: type: string description: Recurly plan UUID. external_product_references: type: array title: External Product References description: List of external product references of the external product. items: "$ref": "#/components/schemas/ExternalProductReferenceBase" required: - name ExternalProductUpdate: type: object properties: plan_id: type: string description: Recurly plan UUID. required: - plan_id ExternalProductReferenceBase: type: object properties: reference_code: type: string description: A code which associates the external product to a corresponding object or resource in an external platform like the Apple App Store or Google Play Store. maxLength: 255 external_connection_type: "$ref": "#/components/schemas/ExternalProductReferenceConnectionType" ExternalProductReferenceCollection: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalProductReferenceMini" ExternalProductReferenceCreate: allOf: - "$ref": "#/components/schemas/ExternalProductReferenceBase" required: - reference_code - external_connection_type ExternalProductReferenceUpdate: allOf: - "$ref": "#/components/schemas/ExternalProductReferenceBase" ExternalProductReferenceConnectionType: type: string description: Represents the connection type. One of the connection types of your enabled App Connectors ExternalAccountList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalAccount" ExternalAccountCreate: type: object properties: external_account_code: type: string description: Represents the account code for the external account. external_connection_type: type: string description: Represents the connection type. One of the connection types of your enabled App Connectors required: - external_account_code - external_connection_type ExternalAccountUpdate: type: object properties: external_account_code: type: string description: Represents the account code for the external account. external_connection_type: type: string description: Represents the connection type. One of the connection types of your enabled App Connectors ExternalAccount: type: object title: External Account properties: object: type: string default: external_account id: type: string description: UUID of the external_account . external_account_code: type: string description: Represents the account code for the external account. external_connection_type: type: string - description: Represents the connection type. `AppleAppStore` or `GooglePlayStore` + description: Represents the connection type. One of the connection types + of your enabled App Connectors created_at: type: string format: date-time description: Created at readOnly: true updated_at: type: string format: date-time description: Last updated at readOnly: true ExternalProductReferenceMini: type: object title: External Product Reference details description: External Product Reference details properties: id: type: string title: External Product ID description: System-generated unique identifier for an external product ID, e.g. `e28zov4fw0v2`. object: type: string title: object reference_code: type: string title: reference_code description: A code which associates the external product to a corresponding object or resource in an external platform like the Apple App Store or Google Play Store. external_connection_type: type: string title: external_connection_type description: Source connection platform. created_at: type: string format: date-time description: When the external product was created in Recurly. updated_at: type: string format: date-time description: When the external product was updated in Recurly. ExternalSubscription: type: object description: Subscription from an external resource such as Apple App Store or Google Play Store. properties: id: type: string title: External subscription ID description: System-generated unique identifier for an external subscription ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type account: "$ref": "#/components/schemas/AccountMini" external_product_reference: "$ref": "#/components/schemas/ExternalProductReferenceMini" external_payment_phases: type: array title: External payment phases description: The phases of the external subscription payment lifecycle. items: "$ref": "#/components/schemas/ExternalPaymentPhase" external_id: type: string title: External Id description: The id of the subscription in the external systems., I.e. Apple App Store or Google Play Store. uuid: type: string title: Uuid description: Universally Unique Identifier created automatically. last_purchased: type: string format: date-time title: Last purchased description: When a new billing event occurred on the external subscription in conjunction with a recent billing period, reactivation or upgrade/downgrade. auto_renew: type: boolean title: Auto-renew description: An indication of whether or not the external subscription will auto-renew at the expiration date. default: false in_grace_period: type: boolean title: In grace period description: An indication of whether or not the external subscription is in a grace period. default: false app_identifier: type: string title: App identifier description: Identifier of the app that generated the external subscription. quantity: type: integer title: Quantity description: An indication of the quantity of a subscribed item's quantity. default: 1 minimum: 0 state: type: string description: External subscriptions can be active, canceled, expired, past_due, voided, revoked, or paused. default: active activated_at: type: string format: date-time title: Activated at description: When the external subscription was activated in the external platform. canceled_at: type: string format: date-time title: Canceled at description: When the external subscription was canceled in the external platform. expires_at: type: string format: date-time title: Expires at description: When the external subscription expires in the external platform. trial_started_at: type: string format: date-time title: Trial started at description: When the external subscription trial period started in the external platform. trial_ends_at: type: string format: date-time title: Trial ends at description: When the external subscription trial period ends in the external platform. test: type: boolean title: Test description: An indication of whether or not the external subscription was purchased in a sandbox environment. default: false imported: type: boolean title: Imported description: An indication of whether or not the external subscription was created by a historical data import. default: false created_at: type: string format: date-time title: Created at description: When the external subscription was created in Recurly. updated_at: type: string format: date-time title: Updated at description: When the external subscription was updated in Recurly. ExternalSubscriptionBase: type: object properties: external_id: type: string title: External Id description: Id of the subscription in the external system, i.e. Apple App Store or Google Play Store. last_purchased: type: string format: date-time title: Last purchased description: When a new billing event occurred on the external subscription in conjunction with a recent billing period, reactivation or upgrade/downgrade. auto_renew: type: boolean title: Auto-renew description: An indication of whether or not the external subscription will auto-renew at the expiration date. default: false state: type: string description: External subscriptions can be active, canceled, expired, past_due, voided, revoked, or paused. default: active app_identifier: type: string title: App identifier description: Identifier of the app that generated the external subscription. quantity: type: integer title: Quantity description: An indication of the quantity of a subscribed item's quantity. default: 1 minimum: 0 activated_at: type: string format: date-time title: Activated at description: When the external subscription was activated in the external platform. expires_at: type: string format: date-time title: Expires at description: When the external subscription expires in the external platform. trial_started_at: type: string format: date-time title: Trial started at description: When the external subscription trial period started in the external platform. trial_ends_at: type: string format: date-time title: Trial ends at description: When the external subscription trial period ends in the external platform. imported: type: boolean title: Import description: An indication of whether or not the external subscription was being created by a historical data import. default: false ExternalSubscriptionCreate: allOf: - type: object properties: account: "$ref": "#/components/schemas/AccountExternalSubscription" external_product_reference: "$ref": "#/components/schemas/ExternalProductReferenceCreate" - "$ref": "#/components/schemas/ExternalSubscriptionBase" required: - external_id - quantity - activated_at - expires_at ExternalSubscriptionUpdate: allOf: - type: object properties: external_product_reference: "$ref": "#/components/schemas/ExternalProductReferenceUpdate" - "$ref": "#/components/schemas/ExternalSubscriptionBase" ExternalSubscriptionList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalSubscription" ExternalInvoice: type: object description: Invoice from an external resource such as Apple App Store or Google Play Store. properties: id: type: string title: External invoice ID description: System-generated unique identifier for an external invoice ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type account: "$ref": "#/components/schemas/AccountMini" external_subscription: "$ref": "#/components/schemas/ExternalSubscription" external_id: type: string description: An identifier which associates the external invoice to a corresponding object in an external platform. state: "$ref": "#/components/schemas/ExternalInvoiceStateEnum" total: type: string format: decimal title: Total currency: type: string title: Currency description: 3-letter ISO 4217 currency code. line_items: type: array items: "$ref": "#/components/schemas/ExternalCharge" purchased_at: type: string format: date-time description: When the invoice was created in the external platform. created_at: type: string format: date-time description: When the external invoice was created in Recurly. updated_at: type: string format: date-time title: Updated at description: When the external invoice was updated in Recurly. ExternalPaymentPhaseBase: type: object properties: started_at: type: string format: date-time title: Started At ends_at: type: string format: date-time title: Ends At starting_billing_period_index: type: integer title: Starting Billing Period Index ending_billing_period_index: type: integer title: Ending Billing Period Index offer_type: type: string title: Offer Type description: Type of discount offer given, e.g. "FREE_TRIAL" offer_name: type: string title: Offer Name description: Name of the discount offer given, e.g. "introductory" period_count: type: integer title: Period Count description: Number of billing periods period_length: type: string title: Period Length description: Billing cycle length amount: type: string format: decimal title: Amount minimum: 0 description: Allows up to 9 decimal places currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 ExternalInvoiceCreate: type: object properties: external_id: type: string description: An identifier which associates the external invoice to a corresponding object in an external platform. state: "$ref": "#/components/schemas/ExternalInvoiceStateEnum" total: type: string format: decimal currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 purchased_at: type: string format: date-time description: When the invoice was created in the external platform. line_items: type: array items: "$ref": "#/components/schemas/ExternalChargeCreate" external_payment_phase: "$ref": "#/components/schemas/ExternalPaymentPhaseBase" external_payment_phase_id: type: string description: External payment phase ID, e.g. `a34ypb2ef9w1`. required: - external_id - state - total - currency - purchased_at ExternalInvoiceList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalInvoice" ExternalCharge: type: object description: Charge from an external resource such as Apple App Store or Google Play Store. properties: id: type: string title: External invoice ID description: System-generated unique identifier for an external charge ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type account: "$ref": "#/components/schemas/AccountMini" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. unit_amount: type: string format: decimal title: Unit Amount quantity: type: integer description: type: string external_product_reference: "$ref": "#/components/schemas/ExternalProductReferenceMini" created_at: type: string format: date-time title: Created at description: When the external charge was created in Recurly. updated_at: type: string format: date-time title: Updated at description: When the external charge was updated in Recurly. CustomerPermission: type: object properties: id: type: string description: Customer permission ID. code: type: string description: Customer permission code. name: type: string description: Customer permission name. description: type: string description: Description of customer permission. object: type: string description: It will always be "customer_permission". GrantedBy: type: object description: The subscription or external subscription that grants customer permissions. properties: object: type: string title: Object Type id: type: string description: The ID of the subscription or external subscription that grants the permission to the account. InvoiceTemplateList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/InvoiceTemplate" InvoiceTemplate: type: object description: Settings for an invoice template. properties: id: type: string code: type: string description: Invoice template code. name: type: string description: Invoice template name. description: type: string description: Invoice template description. created_at: type: string format: date-time description: When the invoice template was created in Recurly. updated_at: type: string format: date-time description: When the invoice template was updated in Recurly. PaymentMethod: properties: object: "$ref": "#/components/schemas/PaymentMethodEnum" card_type: description: Visa, MasterCard, American Express, Discover, JCB, etc. "$ref": "#/components/schemas/CardTypeEnum" first_six: type: string description: Credit card number's first six digits. maxLength: 6 last_four: type: string description: Credit card number's last four digits. Will refer to bank account if payment method is ACH. maxLength: 4 last_two: type: string description: The IBAN bank account's last two digits. maxLength: 2 exp_month: type: integer description: Expiration month. maxLength: 2 exp_year: type: integer description: Expiration year. maxLength: 4 gateway_token: type: string description: A token used in place of a credit card in order to perform transactions. maxLength: 50 cc_bin_country: type: string description: The 2-letter ISO 3166-1 alpha-2 country code associated with - the credit card BIN, if known by Recurly. Available on the BillingInfo - object only. Available when the BIN country lookup feature is enabled. + the card's issuer, if known. + funding_source: + "$ref": "#/components/schemas/CardFundingSourceEnum" + description: The funding source of the card, if known. gateway_code: type: string description: An identifier for a specific payment gateway. maxLength: 13 gateway_attributes: type: object description: Gateway specific attributes associated with this PaymentMethod x-class-name: GatewayAttributes properties: account_reference: type: string description: Used by Adyen and Braintree gateways. For Adyen the Shopper Reference value used when the external token was created. For Braintree the PayPal PayerID is populated in the response. maxLength: 264 card_network_preference: description: Represents the card network preference associated with the billing info for dual badged cards. Must be a supported card network. "$ref": "#/components/schemas/CardNetworkEnum" billing_agreement_id: type: string description: Billing Agreement identifier. Only present for Amazon or Paypal payment methods. name_on_account: type: string description: The name associated with the bank account. account_type: description: The bank account type. Only present for ACH payment methods. "$ref": "#/components/schemas/AccountTypeEnum" routing_number: type: string description: The bank account's routing number. Only present for ACH payment methods. routing_number_bank: type: string description: The bank name of this routing number. username: type: string description: Username of the associated payment method. Currently only associated with Venmo. BusinessEntityList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/BusinessEntity" BusinessEntity: type: object description: Business entity details properties: id: title: Business entity ID type: string maxLength: 13 readOnly: true object: title: Object type type: string readOnly: true code: title: Business entity code type: string maxLength: 50 description: The entity code of the business entity. name: type: string title: Name description: This name describes your business entity and will appear on the invoice. maxLength: 255 invoice_display_address: title: Invoice display address description: Address information for the business entity that will appear on the invoice. "$ref": "#/components/schemas/Address" tax_address: title: Tax address description: Address information for the business entity that will be used for calculating taxes. "$ref": "#/components/schemas/Address" origin_tax_address_source: "$ref": "#/components/schemas/OriginTaxAddressSourceEnum" destination_tax_address_source: "$ref": "#/components/schemas/DestinationTaxAddressSourceEnum" default_vat_number: type: string title: Default VAT number description: VAT number for the customer used on the invoice. maxLength: 20 default_registration_number: type: string title: Default registration number description: Registration number for the customer used on the invoice. maxLength: 30 subscriber_location_countries: type: array title: Subscriber location countries description: List of countries for which the business entity will be used. items: type: string title: Country code default_liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 default_revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true BusinessEntityMini: type: object description: Business entity details properties: id: title: Business entity ID type: string maxLength: 13 readOnly: true object: title: Object type type: string readOnly: true code: title: Business entity code type: string maxLength: 50 description: The entity code of the business entity. name: type: string title: Name description: This name describes your business entity and will appear on the invoice. maxLength: 255 GiftCardList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/GiftCard" GiftCard: type: object description: Gift card details properties: id: title: Gift card ID type: string maxLength: 13 readOnly: true object: title: Object type type: string readOnly: true gifter_account_id: title: Gifter account ID type: string maxLength: 13 description: The ID of the account that purchased the gift card. recipient_account_id: title: Recipient account ID type: string maxLength: 13 description: The ID of the account that redeemed the gift card redemption code. Does not have a value until gift card is redeemed. purchase_invoice_id: title: Purchase invoice ID type: string maxLength: 13 description: The ID of the invoice for the gift card purchase made by the gifter. redemption_invoice_id: title: Redemption invoice ID type: string maxLength: 13 description: The ID of the invoice for the gift card redemption made by the recipient. Does not have a value until gift card is redeemed. redemption_code: title: Redemption code type: string description: The unique redemption code for the gift card, generated by Recurly. Will be 16 characters, alphanumeric, displayed uppercase, but accepted in any case at redemption. Used by the recipient account to create a credit in the amount of the `unit_amount` on their account. balance: title: Remaining balance type: number format: float description: The remaining credit on the recipient account associated with this gift card. Only has a value once the gift card has been redeemed. Can be used to create gift card balance displays for your customers. product_code: title: Product code type: string description: The product code or SKU of the gift card product. unit_amount: title: Purchase unit amount type: number format: float description: The amount of the gift card, which is the amount of the charge to the gifter account and the amount of credit that is applied to the recipient account upon successful redemption. currency: title: Currency type: string description: 3-letter ISO 4217 currency code. maxLength: 3 delivery: title: Delivery details description: The delivery details for the gift card. readOnly: true "$ref": "#/components/schemas/GiftCardDelivery" performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true delivered_at: type: string format: date-time title: Delivered at readOnly: true description: When the gift card was sent to the recipient by Recurly via email, if method was email and the "Gift Card Delivery" email template was enabled. This will be empty for post delivery or email delivery where the email template was disabled. redeemed_at: type: string format: date-time title: Redeemed at readOnly: true description: When the gift card was redeemed by the recipient. canceled_at: type: string format: date-time title: Canceled at readOnly: true description: When the gift card was canceled. GiftCardCreate: type: object description: Gift card details properties: product_code: title: Product code type: string description: The product code or SKU of the gift card product. unit_amount: title: Purchase unit amount type: number format: float description: The amount of the gift card, which is the amount of the charge to the gifter account and the amount of credit that is applied to the recipient account upon successful redemption. currency: title: Currency type: string description: 3-letter ISO 4217 currency code. maxLength: 3 delivery: title: Delivery details description: The delivery details for the gift card. readOnly: true "$ref": "#/components/schemas/GiftCardDeliveryCreate" gifter_account: title: Gifter account details description: Block of account details for the gifter. This references an existing account_code. readOnly: true "$ref": "#/components/schemas/AccountPurchase" required: - product_code - unit_amount - currency - delivery - gifter_account GiftCardDeliveryCreate: type: object description: Gift card delivery details properties: method: title: Delivery method description: Whether the delivery method is email or postal service. "$ref": "#/components/schemas/DeliveryMethodEnum" email_address: title: Recipient email address type: string description: The email address of the recipient. Required if `method` is `email`. deliver_at: type: string format: date-time title: Deliver at readOnly: true description: When the gift card should be delivered to the recipient. If null, the gift card will be delivered immediately. If a datetime is provided, the delivery will be in an hourly window, rounding down. For example, 6:23 pm will be in the 6:00 pm hourly batch. first_name: title: Recipient first name type: string description: The first name of the recipient. last_name: title: Recipient last name type: string description: The last name of the recipient. recipient_address: title: Recipient address description: Address information for the recipient. Required if `method` is `post`. "$ref": "#/components/schemas/Address" gifter_name: title: Gifter name type: string description: The name of the gifter for the purpose of a message displayed to the recipient. personal_message: title: Personal message type: string maxLength: 255 description: The personal message from the gifter to the recipient. required: - method GiftCardDelivery: type: object description: Gift card delivery details properties: method: title: Delivery method description: Whether the delivery method is email or postal service. "$ref": "#/components/schemas/DeliveryMethodEnum" email_address: title: Recipient email address type: string description: The email address of the recipient. deliver_at: type: string format: date-time title: Deliver at readOnly: true description: When the gift card should be delivered to the recipient. If null, the gift card will be delivered immediately. If a datetime is provided, the delivery will be in an hourly window, rounding down. For example, 6:23 pm will be in the 6:00 pm hourly batch. first_name: title: Recipient first name type: string description: The first name of the recipient. last_name: title: Recipient last name type: string description: The last name of the recipient. recipient_address: title: Recipient address description: Address information for the recipient. "$ref": "#/components/schemas/Address" gifter_name: title: Gifter name type: string description: The name of the gifter for the purpose of a message displayed to the recipient. personal_message: title: Personal message type: string maxLength: 255 description: The personal message from the gifter to the recipient. GiftCardRedeem: type: object description: The information necessary to redeem a gift card. properties: recipient_account: title: Recipient account description: The account for the recipient of the gift card. "$ref": "#/components/schemas/AccountReference" required: - recipient_account Error: type: object properties: type: title: Type "$ref": "#/components/schemas/ErrorTypeEnum" message: type: string title: Message params: type: array title: Parameter specific errors items: type: object properties: param: type: string ErrorMayHaveTransaction: allOf: - "$ref": "#/components/schemas/Error" - type: object properties: transaction_error: type: object x-class-name: TransactionError title: Transaction error details description: This is only included on errors with `type=transaction`. properties: object: type: string title: Object type transaction_id: type: string title: Transaction ID maxLength: 13 category: title: Category "$ref": "#/components/schemas/ErrorCategoryEnum" code: title: Code "$ref": "#/components/schemas/ErrorCodeEnum" decline_code: title: Decline code "$ref": "#/components/schemas/DeclineCodeEnum" message: type: string title: Customer message merchant_advice: type: string title: Merchant message three_d_secure_action_token_id: type: string title: 3-D Secure action token id description: Returned when 3-D Secure authentication is required for a transaction. Pass this value to Recurly.js so it can continue the challenge flow. maxLength: 22 fraud_info: "$ref": "#/components/schemas/TransactionFraudInfo" RelatedTypeEnum: type: string enum: - account - item - plan - subscription - charge RefundTypeEnum: type: string enum: @@ -26509,887 +26512,895 @@ components: - es-US - fi-FI - fr-BE - fr-CA - fr-CH - fr-FR - hi-IN - it-IT - ja-JP - ko-KR - nl-BE - nl-NL - pl-PL - pt-BR - pt-PT - ro-RO - ru-RU - sk-SK - sv-SE - tr-TR - zh-CN BillToEnum: type: string enum: - parent - self DeliveryMethodEnum: type: string enum: - email - post PaymentGatewayReferencesEnum: type: string description: The type of reference token. Required if token is passed in for Stripe Gateway. enum: - stripe_confirmation_token - stripe_customer - stripe_payment_method GatewayTransactionTypeEnum: type: string enum: - moto KountDecisionEnum: type: string enum: - approve - decline - escalate - review CouponStateEnum: type: string enum: - expired - maxed_out - redeemable CouponDurationEnum: type: string enum: - forever - single_use - temporal TemporalUnitEnum: type: string enum: - day - month - week - year FreeTrialUnitEnum: type: string enum: - day - month - week RedemptionResourceEnum: type: string enum: - account - subscription CouponTypeEnum: type: string enum: - bulk - single_code DiscountTypeEnum: type: string enum: - fixed - free_trial - percent AddOnSourceEnum: type: string title: Add-on source description: | Used to determine where the associated add-on data is pulled from. If this value is set to `plan_add_on` or left blank, then add-on data will be pulled from the plan's add-ons. If the associated `plan` has `allow_any_item_on_subscriptions` set to `true` and this field is set to `item`, then the associated add-on data will be pulled from the site's item catalog. default: plan_add_on enum: - plan_add_on - item AddOnTypeEnum: type: string enum: - fixed - usage title: Add-on Type description: Whether the add-on type is fixed, or usage-based. AddOnTypeCreateEnum: type: string enum: - fixed - usage title: Add-on Type description: Whether the add-on type is fixed, or usage-based. default: fixed UsageTypeCreateEnum: type: string enum: - price - percentage title: Usage Type description: | Type of usage, required if `add_on_type` is `usage`. See our [Guide](https://recurly.com/developers/guides/usage-based-billing-guide.html) for an overview of how to configure usage add-ons. TierTypeEnum: type: string title: Tier type description: | The pricing model for the add-on. For more information, [click here](https://docs.recurly.com/docs/billing-models#section-quantity-based). See our [Guide](https://recurly.com/developers/guides/item-addon-guide.html) for an overview of how to configure quantity-based pricing models. default: flat enum: - flat - tiered - stairstep - volume UsageTimeframeEnum: type: string title: Usage Timeframe description: The time at which usage totals are reset for billing purposes. enum: - billing_period - subscription_term default: billing_period UsageTimeframeCreateEnum: type: string title: Usage Timeframe description: | The time at which usage totals are reset for billing purposes. Allows for `tiered` add-ons to accumulate usage over the course of multiple billing periods. enum: - billing_period - subscription_term default: billing_period CreditPaymentActionEnum: type: string enum: - payment - reduction - refund - write_off UserAccessEnum: type: string enum: - api_only - read_only - write - set_only PricingModelTypeEnum: type: string enum: - fixed - ramp default: fixed description: | A fixed pricing model has the same price for each billing period. A ramp pricing model defines a set of Ramp Intervals, where a subscription changes price on a specified cadence of billing periods. The price change could be an increase or decrease. RevenueScheduleTypeEnum: type: string enum: - at_range_end - at_range_start - evenly - never NetTermsTypeEnum: type: string title: Net Terms Type description: | Optionally supplied string that may be either `net` or `eom` (end-of-month). When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date. When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month. enum: - net - eom default: net InvoiceTypeEnum: type: string enum: - charge - credit - legacy OriginEnum: type: string enum: - carryforward_credit - carryforward_gift_credit - credit - external_refund - gift_card - immediate_change - import - line_item_refund - open_amount_refund - prepayment - purchase - refund - renewal - termination - usage_correction - write_off InvoiceStateEnum: type: string default: all enum: - open - pending - processing - past_due - paid - closed - failed - voided InvoiceStateQueryParamEnum: type: string default: all enum: - pending - past_due - paid - failed CollectionMethodEnum: type: string enum: - automatic - manual InvoiceRefundTypeEnum: type: string enum: - amount - percentage - line_items RefundMethodEnum: type: string enum: - all_credit - all_transaction - credit_first - transaction_first ExternalPaymentMethodEnum: type: string enum: - bacs - ach - amazon - apple_pay - braintree_apple_pay - check - credit_card - eft - google_pay - money_order - other - paypal - roku - sepadirectdebit - wire_transfer LineItemRevenueScheduleTypeEnum: type: string enum: - at_invoice - at_range_end - at_range_start - evenly - never LegacyCategoryEnum: type: string enum: - applied_credit - carryforward - charge - credit LineItemOriginEnum: type: string enum: - add_on - add_on_trial - carryforward - coupon - credit - debit - one_time - plan - plan_trial - setup_fee - prepayment FullCreditReasonCodeEnum: type: string enum: - general - gift_card - promotional - refund - service - write_off PartialCreditReasonCodeEnum: type: string enum: - general - promotional - service LineItemCreateOriginEnum: type: string enum: - external_gift_card - prepayment IntervalUnitEnum: type: string enum: - days - months AddressRequirementEnum: type: string enum: - full - none - streetzip - zip SiteModeEnum: type: string enum: - development - production - sandbox FeaturesEnum: type: string enum: - credit_memos - manual_invoicing - only_bill_what_changed - subscription_terms SubscriptionStateEnum: type: string enum: - active - canceled - expired - failed - future - paused TimeframeEnum: type: string enum: - bill_date - term_end ChangeTimeframeEnum: type: string enum: - bill_date - now - renewal - term_end TransactionTypeEnum: type: string enum: - authorization - capture - purchase - refund - verify TransactionOriginEnum: type: string enum: - api - chargeback - external_recovery - force_collect - hpp - merchant - recurly_admin - recurlyjs - recurring - refunded_externally - transparent TransactionStatusEnum: type: string enum: - chargeback - declined - error - pending - processing - scheduled - success - void CvvCheckEnum: type: string enum: - D - I - M - N - P - S - U - X AvsCheckEnum: type: string enum: - A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z CouponCodeStateEnum: type: string enum: - expired - inactive - maxed_out - redeemable PaymentMethodEnum: type: string enum: - bacs - amazon - amazon_billing_agreement - apple_pay - bank_account_info - braintree_apple_pay - check - credit_card - eft - gateway_token - google_pay - iban_bank_account - money_order - other - paypal - paypal_billing_agreement - roku - sepadirectdebit - venmo - wire_transfer - braintree_v_zero - boleto - cash_app CardTypeEnum: type: string enum: - American Express - Dankort - Diners Club - Discover - ELO - Forbrugsforeningen - Hipercard - JCB - Laser - Maestro - MasterCard - Test Card - Union Pay - Unknown - Visa - Tarjeta Naranja CardNetworkEnum: type: string enum: - Bancontact - CartesBancaires - Dankort - MasterCard - Visa + CardFundingSourceEnum: + type: string + enum: + - credit + - debit + - charge + - prepaid + - deferred_debit AccountTypeEnum: type: string enum: - checking - savings ErrorTypeEnum: type: string enum: - bad_request - immutable_subscription - internal_server_error - invalid_api_key - invalid_api_version - invalid_content_type - invalid_permissions - invalid_token - missing_feature - not_found - rate_limited - service_not_available - simultaneous_request - tax_service_error - transaction - unauthorized - unavailable_in_api_version - unknown_api_version - validation ErrorCategoryEnum: type: string enum: - three_d_secure_required - three_d_secure_action_required - amazon - api_error - approved - communication - configuration - duplicate - fraud - hard - invalid - not_enabled - not_supported - recurly - referral - skles - soft - unknown ErrorCodeEnum: type: string enum: - ach_cancel - ach_chargeback - ach_credit_return - ach_exception - ach_return - ach_transactions_not_supported - ach_validation_exception - amazon_amount_exceeded - amazon_declined_review - amazon_invalid_authorization_status - amazon_invalid_close_attempt - amazon_invalid_create_order_reference - amazon_invalid_order_status - amazon_not_authorized - amazon_order_not_modifiable - amazon_transaction_count_exceeded - api_error - approved - approved_fraud_review - authorization_already_captured - authorization_amount_depleted - authorization_expired - batch_processing_error - billing_agreement_already_accepted - billing_agreement_not_accepted - billing_agreement_not_found - billing_agreement_replaced - call_issuer - call_issuer_update_cardholder_data - cancelled - cannot_refund_unsettled_transactions - card_not_activated - card_type_not_accepted - cardholder_requested_stop - contact_gateway - contract_not_found - currency_not_supported - customer_canceled_transaction - cvv_required - declined - declined_card_number - declined_exception - declined_expiration_date - declined_missing_data - declined_saveable - declined_security_code - deposit_referenced_chargeback - direct_debit_type_not_accepted - duplicate_transaction - exceeds_daily_limit - exceeds_max_amount - expired_card - finbot_disconnect - finbot_unavailable - fraud_address - fraud_address_recurly - fraud_advanced_verification - fraud_gateway - fraud_generic - fraud_ip_address - fraud_manual_decision - fraud_risk_check - fraud_security_code - fraud_stolen_card - fraud_too_many_attempts - fraud_velocity - gateway_account_setup_incomplete - gateway_error - gateway_rate_limited - gateway_timeout - gateway_token_not_found - gateway_unavailable - gateway_validation_exception - insufficient_funds - invalid_account_number - invalid_amount - invalid_billing_agreement_status - invalid_card_number - invalid_data - invalid_email - invalid_gateway_access_token - invalid_gateway_configuration - invalid_issuer - invalid_login - invalid_merchant_type - invalid_name - invalid_payment_method - invalid_payment_method_hard - invalid_transaction - issuer_unavailable - lifecycle_decline - merch_max_transaction_limit_exceeded - moneybot_disconnect - moneybot_unavailable - no_billing_information - no_gateway - no_gateway_found_for_transaction_amount - partial_approval - partial_credits_not_supported - payer_authentication_rejected - payment_cannot_void_authorization - payment_not_accepted - paypal_account_issue - paypal_cannot_pay_self - paypal_declined_use_alternate - paypal_expired_reference_id - paypal_hard_decline - paypal_invalid_billing_agreement - paypal_primary_declined - processor_not_available - processor_unavailable - recurly_credentials_not_found - recurly_error - recurly_failed_to_get_token - recurly_token_mismatch - recurly_token_not_found - reference_transactions_not_enabled - restricted_card - restricted_card_chargeback - rjs_token_expired - roku_invalid_card_number - roku_invalid_cib - roku_invalid_payment_method - roku_zip_code_mismatch - simultaneous - ssl_error - temporary_hold - three_d_secure_action_required - three_d_secure_action_result_token_mismatch - three_d_secure_authentication - three_d_secure_connection_error - three_d_secure_credential_error - three_d_secure_not_supported - too_busy - too_many_attempts - total_credit_exceeds_capture - transaction_already_refunded - transaction_already_voided - transaction_cannot_be_authorized - transaction_cannot_be_refunded - transaction_cannot_be_refunded_currently - transaction_cannot_be_voided - transaction_failed_to_settle - transaction_not_found - transaction_service_v2_disconnect - transaction_service_v2_unavailable - transaction_settled - transaction_stale_at_gateway - try_again - unknown - unmapped_partner_error - vaultly_service_unavailable - zero_dollar_auth_not_supported DeclineCodeEnum: type: string enum: - account_closed - call_issuer - card_not_activated - card_not_supported - cardholder_requested_stop - do_not_honor - do_not_try_again - exceeds_daily_limit - generic_decline - expired_card - fraudulent - insufficient_funds - incorrect_address - incorrect_security_code - invalid_amount - invalid_number - invalid_transaction - issuer_unavailable - lifecycle_decline - lost_card - pickup_card - policy_decline - restricted_card - restricted_card_chargeback - security_decline - stolen_card - try_again - update_cardholder_data - requires_3d_secure ExportDates: type: object properties: object: type: string title: Object type readOnly: true dates: type: array items: type: string title: An array of dates that have available exports. ExportFiles: type: object properties: object: type: string title: Object type readOnly: true files: type: array items: "$ref": "#/components/schemas/ExportFile" ExportFile: type: object properties: name: type: string title: Filename description: Name of the export file. md5sum: type: string title: MD5 hash of the export file description: MD5 hash of the export file. href: type: string title: A link to the export file description: A presigned link to download the export file. TaxIdentifierTypeEnum: type: string enum: - cpf - cnpj - cuit DunningCycleTypeEnum: type: string description: The type of invoice this cycle applies to. enum: - automatic - manual - trial AchTypeEnum: type: string description: The payment method type for a non-credit card based billing info. `bacs` and `becs` are the only accepted values. enum: - bacs - becs AchAccountTypeEnum: type: string description: The bank account type. (ACH only) enum: - checking - savings ExternalHppTypeEnum: type: string description: Use for Adyen HPP billing info. This should only be used as part of a pending purchase request, when the billing info is nested inside an account object. enum: - adyen OnlineBankingPaymentTypeEnum: type: string description: Use for Online Banking billing info. This should only be used as part of a pending purchase request, when the billing info is nested inside an account object. enum: - ideal - sofort ExternalInvoiceStateEnum: type: string enum: - paid GeneralLedgerAccountTypeEnum: type: string enum: - liability - revenue OriginTaxAddressSourceEnum: type: string title: Origin tax address source description: The source of the address that will be used as the origin in determining taxes. Available only when the site is on an Elite plan. A value of "origin" refers to the "Business entity tax address". A value of "destination" refers to the "Customer tax address". default: origin enum: - origin - destination DestinationTaxAddressSourceEnum: type: string title: Destination tax address source description: The source of the address that will be used as the destinaion in determining taxes. Available only when the site is on an Elite plan. A value of "destination" refers to the "Customer tax address". A value of "origin" refers to the "Business entity tax address". default: destination enum: - destination - origin TransactionMerchantReasonCodeEnum: type: string default: none description: | This conditional parameter is useful for merchants in specific industries who need to submit one-time Merchant Initiated transactions in specific cases. Not all gateways support these methods, but will support a generic one-time Merchant Initiated transaction. Only use this if the initiator value is "merchant". Otherwise, it will be ignored. - Incremental: Send `incremental` with an additional purchase if the original authorization amount is not sufficient to cover the costs of your service or product. For example, if the customer adds goods or services or there are additional expenses. - No Show: Send `no_show` if you charge customers a fee due to an agreed-upon cancellation policy in your industry. - Resubmission: Send `resubmission` if you need to attempt collection on a declined transaction. You may also use the force collection behavior which has the same effect. - Service Extension: Send `service_extension` if you are in a service industry and the customer has increased/extended their service in some way. For example: adding a day onto a car rental agreement. - Split Shipment: Send `split_shipment` if you sell physical product and need to split up a shipment into multiple transactions when the customer is no longer in session. - Top Up: Send `top_up` if you process one-time transactions based on a pre-arranged agreement with your customer where there is a pre-arranged account balance that needs maintaining. For example, if the customer has agreed to maintain an account balance of 30.00 and their current balance is 20.00, the MIT amount would be at least 10.00 to meet that 30.00 threshold. enum: - incremental - no_show - resubmission - service_extension - split_shipment - top_up TransactionIndicatorEnum: type: string description: Must be sent for one-time transactions in order to provide context on which entity is submitting the transaction to ensure proper fraud checks are observed, such as 3DS. If the customer is in session, send `customer`. If this is a merchant initiated one-time transaction, send `merchant`. enum: - customer - merchant
recurly/recurly-client-php
440ae50b52a45c14b0049e689cde21a779167b47
4.56.0
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index f520881..b020895 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 4.55.0 +current_version = 4.56.0 parse = (?P<major>\d+) \.(?P<minor>\d+) \.(?P<patch>\d+) serialize = {major}.{minor}.{patch} [bumpversion:file:composer.json] [bumpversion:file:lib/recurly/version.php] diff --git a/CHANGELOG.md b/CHANGELOG.md index c467126..5353cfc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,514 +1,525 @@ # Changelog +## [4.56.0](https://github.com/recurly/recurly-client-php/tree/4.56.0) (2024-12-17) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.55.0...4.56.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 [#830](https://github.com/recurly/recurly-client-php/pull/830) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.55.0](https://github.com/recurly/recurly-client-php/tree/4.55.0) (2024-12-02) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.54.0...4.55.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#829](https://github.com/recurly/recurly-client-php/pull/829) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#826](https://github.com/recurly/recurly-client-php/pull/826) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.54.0](https://github.com/recurly/recurly-client-php/tree/4.54.0) (2024-08-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.53.0...4.54.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (add UUID to external subscriptions) [#823](https://github.com/recurly/recurly-client-php/pull/823) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.53.0](https://github.com/recurly/recurly-client-php/tree/4.53.0) (2024-08-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.52.0...4.53.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#821](https://github.com/recurly/recurly-client-php/pull/821) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.52.0](https://github.com/recurly/recurly-client-php/tree/4.52.0) (2024-07-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.51.0...4.52.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Taxable Address Control, RevRec) [#817](https://github.com/recurly/recurly-client-php/pull/817) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.51.0](https://github.com/recurly/recurly-client-php/tree/4.51.0) (2024-05-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.50.0...4.51.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#814](https://github.com/recurly/recurly-client-php/pull/814) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.50.0](https://github.com/recurly/recurly-client-php/tree/4.50.0) (2024-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.49.0...4.50.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entity Use Code) [#812](https://github.com/recurly/recurly-client-php/pull/812) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.49.0](https://github.com/recurly/recurly-client-php/tree/4.49.0) (2024-05-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.48.0...4.49.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Proration Settings) [#810](https://github.com/recurly/recurly-client-php/pull/810) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.48.0](https://github.com/recurly/recurly-client-php/tree/4.48.0) (2024-05-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.47.0...4.48.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Auth & Capture) [#808](https://github.com/recurly/recurly-client-php/pull/808) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.47.0](https://github.com/recurly/recurly-client-php/tree/4.47.0) (2024-03-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.46.0...4.47.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#803](https://github.com/recurly/recurly-client-php/pull/803) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.46.0](https://github.com/recurly/recurly-client-php/tree/4.46.0) (2024-02-20) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.45.0...4.46.0) **Merged Pull Requests** - Add invoice state param for v2021-02-25 [#799](https://github.com/recurly/recurly-client-php/pull/799) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.45.0](https://github.com/recurly/recurly-client-php/tree/4.45.0) (2024-01-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.44.0...4.45.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#789](https://github.com/recurly/recurly-client-php/pull/789) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.44.0](https://github.com/recurly/recurly-client-php/tree/4.44.0) (2024-01-18) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.43.0...4.44.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#788](https://github.com/recurly/recurly-client-php/pull/788) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.43.0](https://github.com/recurly/recurly-client-php/tree/4.43.0) (2023-12-06) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.42.0...4.43.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Payment Phases) [#785](https://github.com/recurly/recurly-client-php/pull/785) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.42.0](https://github.com/recurly/recurly-client-php/tree/4.42.0) (2023-11-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.41.0...4.42.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#783](https://github.com/recurly/recurly-client-php/pull/783) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.41.0](https://github.com/recurly/recurly-client-php/tree/4.41.0) (2023-08-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.40.0...4.41.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (`VATNumber`, `LifecycleDecline`) [#782](https://github.com/recurly/recurly-client-php/pull/782) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.40.0](https://github.com/recurly/recurly-client-php/tree/4.40.0) (2023-08-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.39.0...4.40.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (action_result) [#781](https://github.com/recurly/recurly-client-php/pull/781) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.39.0](https://github.com/recurly/recurly-client-php/tree/4.39.0) (2023-07-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.37.0...4.39.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Ramp Dates, Net Terms, Invoice Business Entity) [#779](https://github.com/recurly/recurly-client-php/pull/779) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (App Management - External Subscriptions) [#777](https://github.com/recurly/recurly-client-php/pull/777) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.37.0](https://github.com/recurly/recurly-client-php/tree/4.37.0) (2023-06-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.36.0...4.37.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Multiple Business Entities) [#769](https://github.com/recurly/recurly-client-php/pull/769) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.36.0](https://github.com/recurly/recurly-client-php/tree/4.36.0) (2023-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.35.0...4.36.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Products & References) [#766](https://github.com/recurly/recurly-client-php/pull/766) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.35.0](https://github.com/recurly/recurly-client-php/tree/4.35.0) (2023-05-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.34.0...4.35.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (gateway_attributes on PaymentMethod) [#764](https://github.com/recurly/recurly-client-php/pull/764) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#747](https://github.com/recurly/recurly-client-php/pull/747) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.28.0](https://github.com/recurly/recurly-client-php/tree/4.28.0) (2023-02-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.27.0...4.28.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (GiftCard endpoints and new transaction error support) [#745](https://github.com/recurly/recurly-client-php/pull/745) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.27.0](https://github.com/recurly/recurly-client-php/tree/4.27.0) (2023-01-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.26.0...4.27.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Custom Fields on Line Items) [#738](https://github.com/recurly/recurly-client-php/pull/738) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.26.0](https://github.com/recurly/recurly-client-php/tree/4.26.0) (2023-01-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.25.0...4.26.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Account Preferred Time Zone) [#736](https://github.com/recurly/recurly-client-php/pull/736) ([douglasmiller](https://github.com/douglasmiller)) ## [4.25.0](https://github.com/recurly/recurly-client-php/tree/4.25.0) (2022-11-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.24.0...4.25.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Apply Credit Balance feature) [#732](https://github.com/recurly/recurly-client-php/pull/732) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.24.0](https://github.com/recurly/recurly-client-php/tree/4.24.0) (2022-11-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.23.0...4.24.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Subscriptions feature) [#729](https://github.com/recurly/recurly-client-php/pull/729) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#728](https://github.com/recurly/recurly-client-php/pull/728) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.23.0](https://github.com/recurly/recurly-client-php/tree/4.23.0) (2022-10-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.22.0...4.23.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entitlements feature) [#725](https://github.com/recurly/recurly-client-php/pull/725) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.22.0](https://github.com/recurly/recurly-client-php/tree/4.22.0) (2022-10-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.2...4.22.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25(Decimal Usage and Quantities and DunningEvent new fields) [#722](https://github.com/recurly/recurly-client-php/pull/722) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.2](https://github.com/recurly/recurly-client-php/tree/4.21.2) (2022-09-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.1...4.21.2) **Merged Pull Requests** - feat: allow for psr/log ^2/3 [#716](https://github.com/recurly/recurly-client-php/pull/716) ([trickeyone](https://github.com/trickeyone)) ## [4.21.1](https://github.com/recurly/recurly-client-php/tree/4.21.1) (2022-09-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.0...4.21.1) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#714](https://github.com/recurly/recurly-client-php/pull/714) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.0](https://github.com/recurly/recurly-client-php/tree/4.21.0) (2022-09-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.20.0...4.21.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#713](https://github.com/recurly/recurly-client-php/pull/713) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixes bug with putDunningCampaignBulkUpdate [#706](https://github.com/recurly/recurly-client-php/pull/706) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.20.0](https://github.com/recurly/recurly-client-php/tree/4.20.0) (2022-08-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.19.0...4.20.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#701](https://github.com/recurly/recurly-client-php/pull/701) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.19.0](https://github.com/recurly/recurly-client-php/tree/4.19.0) (2022-07-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.18.0...4.19.0) **Merged Pull Requests** - Fixing deprecation warnings in client [#697](https://github.com/recurly/recurly-client-php/pull/697) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#695](https://github.com/recurly/recurly-client-php/pull/695) ([recurly-integrations](https://github.com/recurly-integrations)) **Closed Issues** - Recurly\Pager and \Iterator return type mismatch (PHP 8.1 deprecation) [#677](https://github.com/recurly/recurly-client-php/issues/677) ## [4.18.0](https://github.com/recurly/recurly-client-php/tree/4.18.0) (2022-06-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.17.0...4.18.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#693](https://github.com/recurly/recurly-client-php/pull/693) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.17.0](https://github.com/recurly/recurly-client-php/tree/4.17.0) (2022-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.16.0...4.17.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#679](https://github.com/recurly/recurly-client-php/pull/679) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.16.0](https://github.com/recurly/recurly-client-php/tree/4.16.0) (2022-03-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.15.0...4.16.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#676](https://github.com/recurly/recurly-client-php/pull/676) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.15.0](https://github.com/recurly/recurly-client-php/tree/4.15.0) (2022-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.14.0...4.15.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#668](https://github.com/recurly/recurly-client-php/pull/668) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.14.0](https://github.com/recurly/recurly-client-php/tree/4.14.0) (2022-03-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.13.0...4.14.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#664](https://github.com/recurly/recurly-client-php/pull/664) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.13.0](https://github.com/recurly/recurly-client-php/tree/4.13.0) (2022-01-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.12.0...4.13.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#655](https://github.com/recurly/recurly-client-php/pull/655) ([recurly-integrations](https://github.com/recurly-integrations)) - Add region argument to client to connect in EU data center [#653](https://github.com/recurly/recurly-client-php/pull/653) ([FabricioCoutinho](https://github.com/FabricioCoutinho)) ## [4.12.0](https://github.com/recurly/recurly-client-php/tree/4.12.0) (2022-01-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.11.0...4.12.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Invoice Customization) [#654](https://github.com/recurly/recurly-client-php/pull/654) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#651](https://github.com/recurly/recurly-client-php/pull/651) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.11.0](https://github.com/recurly/recurly-client-php/tree/4.11.0) (2021-12-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.10.0...4.11.0) **Merged Pull Requests** diff --git a/composer.json b/composer.json index b01bc57..3669d04 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,38 @@ { "name": "recurly/recurly-client", - "version": "4.55.0", + "version": "4.56.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], "homepage": "https://github.com/recurly/recurly-client-php", "license": "MIT", "authors": [], "require": { "php": ">= 7.2.0", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "phpcompatibility/php-compatibility": "^9.3", "phpdocumentor/phpdocumentor": "~3.0.0", "phpstan/phpstan": "^0.12.11", "phpunit/phpunit": "^8", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "classmap": ["lib"], "files": ["lib/recurly.php"] }, "autoload-dev": { "classmap": ["tests"] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/lib/recurly/version.php b/lib/recurly/version.php index a73d03f..eaa8209 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -1,8 +1,8 @@ <?php namespace Recurly; class Version { - public const CURRENT = '4.55.0'; + public const CURRENT = '4.56.0'; }
recurly/recurly-client-php
38c8d9ce7a0ea4f83648f24c3c91ffb229d6f89f
4.55.0
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 5644d0c..f520881 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 4.54.0 +current_version = 4.55.0 parse = (?P<major>\d+) \.(?P<minor>\d+) \.(?P<patch>\d+) serialize = {major}.{minor}.{patch} [bumpversion:file:composer.json] [bumpversion:file:lib/recurly/version.php] diff --git a/CHANGELOG.md b/CHANGELOG.md index 45ecfcf..c467126 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,514 +1,526 @@ # Changelog +## [4.55.0](https://github.com/recurly/recurly-client-php/tree/4.55.0) (2024-12-02) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.54.0...4.55.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 [#829](https://github.com/recurly/recurly-client-php/pull/829) ([recurly-integrations](https://github.com/recurly-integrations)) +- Generated Latest Changes for v2021-02-25 [#826](https://github.com/recurly/recurly-client-php/pull/826) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.54.0](https://github.com/recurly/recurly-client-php/tree/4.54.0) (2024-08-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.53.0...4.54.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (add UUID to external subscriptions) [#823](https://github.com/recurly/recurly-client-php/pull/823) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.53.0](https://github.com/recurly/recurly-client-php/tree/4.53.0) (2024-08-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.52.0...4.53.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#821](https://github.com/recurly/recurly-client-php/pull/821) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.52.0](https://github.com/recurly/recurly-client-php/tree/4.52.0) (2024-07-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.51.0...4.52.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Taxable Address Control, RevRec) [#817](https://github.com/recurly/recurly-client-php/pull/817) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.51.0](https://github.com/recurly/recurly-client-php/tree/4.51.0) (2024-05-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.50.0...4.51.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#814](https://github.com/recurly/recurly-client-php/pull/814) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.50.0](https://github.com/recurly/recurly-client-php/tree/4.50.0) (2024-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.49.0...4.50.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entity Use Code) [#812](https://github.com/recurly/recurly-client-php/pull/812) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.49.0](https://github.com/recurly/recurly-client-php/tree/4.49.0) (2024-05-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.48.0...4.49.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Proration Settings) [#810](https://github.com/recurly/recurly-client-php/pull/810) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.48.0](https://github.com/recurly/recurly-client-php/tree/4.48.0) (2024-05-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.47.0...4.48.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Auth & Capture) [#808](https://github.com/recurly/recurly-client-php/pull/808) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.47.0](https://github.com/recurly/recurly-client-php/tree/4.47.0) (2024-03-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.46.0...4.47.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#803](https://github.com/recurly/recurly-client-php/pull/803) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.46.0](https://github.com/recurly/recurly-client-php/tree/4.46.0) (2024-02-20) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.45.0...4.46.0) **Merged Pull Requests** - Add invoice state param for v2021-02-25 [#799](https://github.com/recurly/recurly-client-php/pull/799) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.45.0](https://github.com/recurly/recurly-client-php/tree/4.45.0) (2024-01-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.44.0...4.45.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#789](https://github.com/recurly/recurly-client-php/pull/789) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.44.0](https://github.com/recurly/recurly-client-php/tree/4.44.0) (2024-01-18) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.43.0...4.44.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#788](https://github.com/recurly/recurly-client-php/pull/788) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.43.0](https://github.com/recurly/recurly-client-php/tree/4.43.0) (2023-12-06) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.42.0...4.43.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Payment Phases) [#785](https://github.com/recurly/recurly-client-php/pull/785) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.42.0](https://github.com/recurly/recurly-client-php/tree/4.42.0) (2023-11-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.41.0...4.42.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#783](https://github.com/recurly/recurly-client-php/pull/783) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.41.0](https://github.com/recurly/recurly-client-php/tree/4.41.0) (2023-08-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.40.0...4.41.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (`VATNumber`, `LifecycleDecline`) [#782](https://github.com/recurly/recurly-client-php/pull/782) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.40.0](https://github.com/recurly/recurly-client-php/tree/4.40.0) (2023-08-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.39.0...4.40.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (action_result) [#781](https://github.com/recurly/recurly-client-php/pull/781) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.39.0](https://github.com/recurly/recurly-client-php/tree/4.39.0) (2023-07-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.37.0...4.39.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Ramp Dates, Net Terms, Invoice Business Entity) [#779](https://github.com/recurly/recurly-client-php/pull/779) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (App Management - External Subscriptions) [#777](https://github.com/recurly/recurly-client-php/pull/777) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.37.0](https://github.com/recurly/recurly-client-php/tree/4.37.0) (2023-06-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.36.0...4.37.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Multiple Business Entities) [#769](https://github.com/recurly/recurly-client-php/pull/769) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.36.0](https://github.com/recurly/recurly-client-php/tree/4.36.0) (2023-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.35.0...4.36.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Products & References) [#766](https://github.com/recurly/recurly-client-php/pull/766) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.35.0](https://github.com/recurly/recurly-client-php/tree/4.35.0) (2023-05-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.34.0...4.35.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (gateway_attributes on PaymentMethod) [#764](https://github.com/recurly/recurly-client-php/pull/764) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#747](https://github.com/recurly/recurly-client-php/pull/747) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.28.0](https://github.com/recurly/recurly-client-php/tree/4.28.0) (2023-02-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.27.0...4.28.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (GiftCard endpoints and new transaction error support) [#745](https://github.com/recurly/recurly-client-php/pull/745) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.27.0](https://github.com/recurly/recurly-client-php/tree/4.27.0) (2023-01-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.26.0...4.27.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Custom Fields on Line Items) [#738](https://github.com/recurly/recurly-client-php/pull/738) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.26.0](https://github.com/recurly/recurly-client-php/tree/4.26.0) (2023-01-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.25.0...4.26.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Account Preferred Time Zone) [#736](https://github.com/recurly/recurly-client-php/pull/736) ([douglasmiller](https://github.com/douglasmiller)) ## [4.25.0](https://github.com/recurly/recurly-client-php/tree/4.25.0) (2022-11-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.24.0...4.25.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Apply Credit Balance feature) [#732](https://github.com/recurly/recurly-client-php/pull/732) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.24.0](https://github.com/recurly/recurly-client-php/tree/4.24.0) (2022-11-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.23.0...4.24.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Subscriptions feature) [#729](https://github.com/recurly/recurly-client-php/pull/729) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#728](https://github.com/recurly/recurly-client-php/pull/728) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.23.0](https://github.com/recurly/recurly-client-php/tree/4.23.0) (2022-10-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.22.0...4.23.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entitlements feature) [#725](https://github.com/recurly/recurly-client-php/pull/725) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.22.0](https://github.com/recurly/recurly-client-php/tree/4.22.0) (2022-10-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.2...4.22.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25(Decimal Usage and Quantities and DunningEvent new fields) [#722](https://github.com/recurly/recurly-client-php/pull/722) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.2](https://github.com/recurly/recurly-client-php/tree/4.21.2) (2022-09-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.1...4.21.2) **Merged Pull Requests** - feat: allow for psr/log ^2/3 [#716](https://github.com/recurly/recurly-client-php/pull/716) ([trickeyone](https://github.com/trickeyone)) ## [4.21.1](https://github.com/recurly/recurly-client-php/tree/4.21.1) (2022-09-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.0...4.21.1) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#714](https://github.com/recurly/recurly-client-php/pull/714) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.0](https://github.com/recurly/recurly-client-php/tree/4.21.0) (2022-09-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.20.0...4.21.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#713](https://github.com/recurly/recurly-client-php/pull/713) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixes bug with putDunningCampaignBulkUpdate [#706](https://github.com/recurly/recurly-client-php/pull/706) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.20.0](https://github.com/recurly/recurly-client-php/tree/4.20.0) (2022-08-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.19.0...4.20.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#701](https://github.com/recurly/recurly-client-php/pull/701) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.19.0](https://github.com/recurly/recurly-client-php/tree/4.19.0) (2022-07-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.18.0...4.19.0) **Merged Pull Requests** - Fixing deprecation warnings in client [#697](https://github.com/recurly/recurly-client-php/pull/697) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#695](https://github.com/recurly/recurly-client-php/pull/695) ([recurly-integrations](https://github.com/recurly-integrations)) **Closed Issues** - Recurly\Pager and \Iterator return type mismatch (PHP 8.1 deprecation) [#677](https://github.com/recurly/recurly-client-php/issues/677) ## [4.18.0](https://github.com/recurly/recurly-client-php/tree/4.18.0) (2022-06-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.17.0...4.18.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#693](https://github.com/recurly/recurly-client-php/pull/693) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.17.0](https://github.com/recurly/recurly-client-php/tree/4.17.0) (2022-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.16.0...4.17.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#679](https://github.com/recurly/recurly-client-php/pull/679) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.16.0](https://github.com/recurly/recurly-client-php/tree/4.16.0) (2022-03-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.15.0...4.16.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#676](https://github.com/recurly/recurly-client-php/pull/676) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.15.0](https://github.com/recurly/recurly-client-php/tree/4.15.0) (2022-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.14.0...4.15.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#668](https://github.com/recurly/recurly-client-php/pull/668) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.14.0](https://github.com/recurly/recurly-client-php/tree/4.14.0) (2022-03-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.13.0...4.14.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#664](https://github.com/recurly/recurly-client-php/pull/664) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.13.0](https://github.com/recurly/recurly-client-php/tree/4.13.0) (2022-01-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.12.0...4.13.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#655](https://github.com/recurly/recurly-client-php/pull/655) ([recurly-integrations](https://github.com/recurly-integrations)) - Add region argument to client to connect in EU data center [#653](https://github.com/recurly/recurly-client-php/pull/653) ([FabricioCoutinho](https://github.com/FabricioCoutinho)) ## [4.12.0](https://github.com/recurly/recurly-client-php/tree/4.12.0) (2022-01-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.11.0...4.12.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Invoice Customization) [#654](https://github.com/recurly/recurly-client-php/pull/654) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#651](https://github.com/recurly/recurly-client-php/pull/651) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.11.0](https://github.com/recurly/recurly-client-php/tree/4.11.0) (2021-12-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.10.0...4.11.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Tax Inclusive Pricing) [#650](https://github.com/recurly/recurly-client-php/pull/650) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.10.0](https://github.com/recurly/recurly-client-php/tree/4.10.0) (2021-11-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.9.0...4.10.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#647](https://github.com/recurly/recurly-client-php/pull/647) ([recurly-integrations](https://github.com/recurly-integrations)) diff --git a/composer.json b/composer.json index 56df9a7..b01bc57 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,38 @@ { "name": "recurly/recurly-client", - "version": "4.54.0", + "version": "4.55.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], "homepage": "https://github.com/recurly/recurly-client-php", "license": "MIT", "authors": [], "require": { "php": ">= 7.2.0", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "phpcompatibility/php-compatibility": "^9.3", "phpdocumentor/phpdocumentor": "~3.0.0", "phpstan/phpstan": "^0.12.11", "phpunit/phpunit": "^8", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "classmap": ["lib"], "files": ["lib/recurly.php"] }, "autoload-dev": { "classmap": ["tests"] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/lib/recurly/version.php b/lib/recurly/version.php index f597d75..a73d03f 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -1,8 +1,8 @@ <?php namespace Recurly; class Version { - public const CURRENT = '4.54.0'; + public const CURRENT = '4.55.0'; }
recurly/recurly-client-php
beb98f059e68b59a7d058c119233ecf145681e3e
Generated Latest Changes for v2021-02-25
diff --git a/lib/recurly/resources/plan.php b/lib/recurly/resources/plan.php index 5ec290a..0c56168 100644 --- a/lib/recurly/resources/plan.php +++ b/lib/recurly/resources/plan.php @@ -1,772 +1,796 @@ <?php /** * This file is automatically created by Recurly's OpenAPI generation process * and thus any edits you make by hand will be lost. If you wish to make a * change to this file, please create a Github issue explaining the changes you * need and we will usher them to the appropriate places. */ namespace Recurly\Resources; use Recurly\RecurlyResource; // phpcs:disable class Plan extends RecurlyResource { private $_accounting_code; private $_allow_any_item_on_subscriptions; private $_auto_renew; private $_avalara_service_type; private $_avalara_transaction_type; private $_code; private $_created_at; private $_currencies; private $_custom_fields; private $_deleted_at; private $_description; private $_dunning_campaign_id; private $_hosted_pages; private $_id; private $_interval_length; private $_interval_unit; private $_name; private $_object; private $_pricing_model; private $_ramp_intervals; private $_revenue_schedule_type; private $_setup_fee_accounting_code; private $_setup_fee_revenue_schedule_type; private $_state; private $_tax_code; private $_tax_exempt; private $_total_billing_cycles; private $_trial_length; private $_trial_requires_billing_info; private $_trial_unit; private $_updated_at; + private $_vertex_transaction_type; protected static $array_hints = [ 'setCurrencies' => '\Recurly\Resources\PlanPricing', 'setCustomFields' => '\Recurly\Resources\CustomField', 'setRampIntervals' => '\Recurly\Resources\PlanRampInterval', ]; /** * Getter method for the accounting_code attribute. * Accounting code for invoice line items for the plan. If no value is provided, it defaults to plan's code. * * @return ?string */ public function getAccountingCode(): ?string { return $this->_accounting_code; } /** * Setter method for the accounting_code attribute. * * @param string $accounting_code * * @return void */ public function setAccountingCode(string $accounting_code): void { $this->_accounting_code = $accounting_code; } /** * Getter method for the allow_any_item_on_subscriptions attribute. * Used to determine whether items can be assigned as add-ons to individual subscriptions. If `true`, items can be assigned as add-ons to individual subscription add-ons. If `false`, only plan add-ons can be used. * * @return ?bool */ public function getAllowAnyItemOnSubscriptions(): ?bool { return $this->_allow_any_item_on_subscriptions; } /** * Setter method for the allow_any_item_on_subscriptions attribute. * * @param bool $allow_any_item_on_subscriptions * * @return void */ public function setAllowAnyItemOnSubscriptions(bool $allow_any_item_on_subscriptions): void { $this->_allow_any_item_on_subscriptions = $allow_any_item_on_subscriptions; } /** * Getter method for the auto_renew attribute. * Subscriptions will automatically inherit this value once they are active. If `auto_renew` is `true`, then a subscription will automatically renew its term at renewal. If `auto_renew` is `false`, then a subscription will expire at the end of its term. `auto_renew` can be overridden on the subscription record itself. * * @return ?bool */ public function getAutoRenew(): ?bool { return $this->_auto_renew; } /** * Setter method for the auto_renew attribute. * * @param bool $auto_renew * * @return void */ public function setAutoRenew(bool $auto_renew): void { $this->_auto_renew = $auto_renew; } /** * Getter method for the avalara_service_type attribute. * Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. * * @return ?int */ public function getAvalaraServiceType(): ?int { return $this->_avalara_service_type; } /** * Setter method for the avalara_service_type attribute. * * @param int $avalara_service_type * * @return void */ public function setAvalaraServiceType(int $avalara_service_type): void { $this->_avalara_service_type = $avalara_service_type; } /** * Getter method for the avalara_transaction_type attribute. * Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. * * @return ?int */ public function getAvalaraTransactionType(): ?int { return $this->_avalara_transaction_type; } /** * Setter method for the avalara_transaction_type attribute. * * @param int $avalara_transaction_type * * @return void */ public function setAvalaraTransactionType(int $avalara_transaction_type): void { $this->_avalara_transaction_type = $avalara_transaction_type; } /** * Getter method for the code attribute. * Unique code to identify the plan. This is used in Hosted Payment Page URLs and in the invoice exports. * * @return ?string */ public function getCode(): ?string { return $this->_code; } /** * Setter method for the code attribute. * * @param string $code * * @return void */ public function setCode(string $code): void { $this->_code = $code; } /** * Getter method for the created_at attribute. * Created at * * @return ?string */ public function getCreatedAt(): ?string { return $this->_created_at; } /** * Setter method for the created_at attribute. * * @param string $created_at * * @return void */ public function setCreatedAt(string $created_at): void { $this->_created_at = $created_at; } /** * Getter method for the currencies attribute. * Pricing * * @return array */ public function getCurrencies(): array { return $this->_currencies ?? [] ; } /** * Setter method for the currencies attribute. * * @param array $currencies * * @return void */ public function setCurrencies(array $currencies): void { $this->_currencies = $currencies; } /** * Getter method for the custom_fields attribute. * The custom fields will only be altered when they are included in a request. Sending an empty array will not remove any existing values. To remove a field send the name with a null or empty value. * * @return array */ public function getCustomFields(): array { return $this->_custom_fields ?? [] ; } /** * Setter method for the custom_fields attribute. * * @param array $custom_fields * * @return void */ public function setCustomFields(array $custom_fields): void { $this->_custom_fields = $custom_fields; } /** * Getter method for the deleted_at attribute. * Deleted at * * @return ?string */ public function getDeletedAt(): ?string { return $this->_deleted_at; } /** * Setter method for the deleted_at attribute. * * @param string $deleted_at * * @return void */ public function setDeletedAt(string $deleted_at): void { $this->_deleted_at = $deleted_at; } /** * Getter method for the description attribute. * Optional description, not displayed. * * @return ?string */ public function getDescription(): ?string { return $this->_description; } /** * Setter method for the description attribute. * * @param string $description * * @return void */ public function setDescription(string $description): void { $this->_description = $description; } /** * Getter method for the dunning_campaign_id attribute. * Unique ID to identify a dunning campaign. Used to specify if a non-default dunning campaign should be assigned to this plan. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. * * @return ?string */ public function getDunningCampaignId(): ?string { return $this->_dunning_campaign_id; } /** * Setter method for the dunning_campaign_id attribute. * * @param string $dunning_campaign_id * * @return void */ public function setDunningCampaignId(string $dunning_campaign_id): void { $this->_dunning_campaign_id = $dunning_campaign_id; } /** * Getter method for the hosted_pages attribute. * Hosted pages settings * * @return ?\Recurly\Resources\PlanHostedPages */ public function getHostedPages(): ?\Recurly\Resources\PlanHostedPages { return $this->_hosted_pages; } /** * Setter method for the hosted_pages attribute. * * @param \Recurly\Resources\PlanHostedPages $hosted_pages * * @return void */ public function setHostedPages(\Recurly\Resources\PlanHostedPages $hosted_pages): void { $this->_hosted_pages = $hosted_pages; } /** * Getter method for the id attribute. * Plan ID * * @return ?string */ public function getId(): ?string { return $this->_id; } /** * Setter method for the id attribute. * * @param string $id * * @return void */ public function setId(string $id): void { $this->_id = $id; } /** * Getter method for the interval_length attribute. * Length of the plan's billing interval in `interval_unit`. * * @return ?int */ public function getIntervalLength(): ?int { return $this->_interval_length; } /** * Setter method for the interval_length attribute. * * @param int $interval_length * * @return void */ public function setIntervalLength(int $interval_length): void { $this->_interval_length = $interval_length; } /** * Getter method for the interval_unit attribute. * Unit for the plan's billing interval. * * @return ?string */ public function getIntervalUnit(): ?string { return $this->_interval_unit; } /** * Setter method for the interval_unit attribute. * * @param string $interval_unit * * @return void */ public function setIntervalUnit(string $interval_unit): void { $this->_interval_unit = $interval_unit; } /** * Getter method for the name attribute. * This name describes your plan and will appear on the Hosted Payment Page and the subscriber's invoice. * * @return ?string */ public function getName(): ?string { return $this->_name; } /** * Setter method for the name attribute. * * @param string $name * * @return void */ public function setName(string $name): void { $this->_name = $name; } /** * Getter method for the object attribute. * Object type * * @return ?string */ public function getObject(): ?string { return $this->_object; } /** * Setter method for the object attribute. * * @param string $object * * @return void */ public function setObject(string $object): void { $this->_object = $object; } /** * Getter method for the pricing_model attribute. * A fixed pricing model has the same price for each billing period. A ramp pricing model defines a set of Ramp Intervals, where a subscription changes price on a specified cadence of billing periods. The price change could be an increase or decrease. * * @return ?string */ public function getPricingModel(): ?string { return $this->_pricing_model; } /** * Setter method for the pricing_model attribute. * * @param string $pricing_model * * @return void */ public function setPricingModel(string $pricing_model): void { $this->_pricing_model = $pricing_model; } /** * Getter method for the ramp_intervals attribute. * Ramp Intervals * * @return array */ public function getRampIntervals(): array { return $this->_ramp_intervals ?? [] ; } /** * Setter method for the ramp_intervals attribute. * * @param array $ramp_intervals * * @return void */ public function setRampIntervals(array $ramp_intervals): void { $this->_ramp_intervals = $ramp_intervals; } /** * Getter method for the revenue_schedule_type attribute. * Revenue schedule type * * @return ?string */ public function getRevenueScheduleType(): ?string { return $this->_revenue_schedule_type; } /** * Setter method for the revenue_schedule_type attribute. * * @param string $revenue_schedule_type * * @return void */ public function setRevenueScheduleType(string $revenue_schedule_type): void { $this->_revenue_schedule_type = $revenue_schedule_type; } /** * Getter method for the setup_fee_accounting_code attribute. * Accounting code for invoice line items for the plan's setup fee. If no value is provided, it defaults to plan's accounting code. * * @return ?string */ public function getSetupFeeAccountingCode(): ?string { return $this->_setup_fee_accounting_code; } /** * Setter method for the setup_fee_accounting_code attribute. * * @param string $setup_fee_accounting_code * * @return void */ public function setSetupFeeAccountingCode(string $setup_fee_accounting_code): void { $this->_setup_fee_accounting_code = $setup_fee_accounting_code; } /** * Getter method for the setup_fee_revenue_schedule_type attribute. * Setup fee revenue schedule type * * @return ?string */ public function getSetupFeeRevenueScheduleType(): ?string { return $this->_setup_fee_revenue_schedule_type; } /** * Setter method for the setup_fee_revenue_schedule_type attribute. * * @param string $setup_fee_revenue_schedule_type * * @return void */ public function setSetupFeeRevenueScheduleType(string $setup_fee_revenue_schedule_type): void { $this->_setup_fee_revenue_schedule_type = $setup_fee_revenue_schedule_type; } /** * Getter method for the state attribute. * The current state of the plan. * * @return ?string */ public function getState(): ?string { return $this->_state; } /** * Setter method for the state attribute. * * @param string $state * * @return void */ public function setState(string $state): void { $this->_state = $state; } /** * Getter method for the tax_code attribute. * Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes. * * @return ?string */ public function getTaxCode(): ?string { return $this->_tax_code; } /** * Setter method for the tax_code attribute. * * @param string $tax_code * * @return void */ public function setTaxCode(string $tax_code): void { $this->_tax_code = $tax_code; } /** * Getter method for the tax_exempt attribute. * `true` exempts tax on the plan, `false` applies tax on the plan. * * @return ?bool */ public function getTaxExempt(): ?bool { return $this->_tax_exempt; } /** * Setter method for the tax_exempt attribute. * * @param bool $tax_exempt * * @return void */ public function setTaxExempt(bool $tax_exempt): void { $this->_tax_exempt = $tax_exempt; } /** * Getter method for the total_billing_cycles attribute. * Automatically terminate subscriptions after a defined number of billing cycles. Number of billing cycles before the plan automatically stops renewing, defaults to `null` for continuous, automatic renewal. * * @return ?int */ public function getTotalBillingCycles(): ?int { return $this->_total_billing_cycles; } /** * Setter method for the total_billing_cycles attribute. * * @param int $total_billing_cycles * * @return void */ public function setTotalBillingCycles(int $total_billing_cycles): void { $this->_total_billing_cycles = $total_billing_cycles; } /** * Getter method for the trial_length attribute. * Length of plan's trial period in `trial_units`. `0` means `no trial`. * * @return ?int */ public function getTrialLength(): ?int { return $this->_trial_length; } /** * Setter method for the trial_length attribute. * * @param int $trial_length * * @return void */ public function setTrialLength(int $trial_length): void { $this->_trial_length = $trial_length; } /** * Getter method for the trial_requires_billing_info attribute. * Allow free trial subscriptions to be created without billing info. Should not be used if billing info is needed for initial invoice due to existing uninvoiced charges or setup fee. * * @return ?bool */ public function getTrialRequiresBillingInfo(): ?bool { return $this->_trial_requires_billing_info; } /** * Setter method for the trial_requires_billing_info attribute. * * @param bool $trial_requires_billing_info * * @return void */ public function setTrialRequiresBillingInfo(bool $trial_requires_billing_info): void { $this->_trial_requires_billing_info = $trial_requires_billing_info; } /** * Getter method for the trial_unit attribute. * Units for the plan's trial period. * * @return ?string */ public function getTrialUnit(): ?string { return $this->_trial_unit; } /** * Setter method for the trial_unit attribute. * * @param string $trial_unit * * @return void */ public function setTrialUnit(string $trial_unit): void { $this->_trial_unit = $trial_unit; } /** * Getter method for the updated_at attribute. * Last updated at * * @return ?string */ public function getUpdatedAt(): ?string { return $this->_updated_at; } /** * Setter method for the updated_at attribute. * * @param string $updated_at * * @return void */ public function setUpdatedAt(string $updated_at): void { $this->_updated_at = $updated_at; } + + /** + * Getter method for the vertex_transaction_type attribute. + * Used by Vertex for tax calculations. Possible values are `sale`, `rental`, `lease`. + * + * @return ?string + */ + public function getVertexTransactionType(): ?string + { + return $this->_vertex_transaction_type; + } + + /** + * Setter method for the vertex_transaction_type attribute. + * + * @param string $vertex_transaction_type + * + * @return void + */ + public function setVertexTransactionType(string $vertex_transaction_type): void + { + $this->_vertex_transaction_type = $vertex_transaction_type; + } } \ No newline at end of file diff --git a/openapi/api.yaml b/openapi/api.yaml index b8cfb55..bcad8e3 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -20844,1503 +20844,1518 @@ components: maxLength: 255 revenue_gl_account_code: type: string title: Accounting code for the ledger account. description: | Unique code to identify the ledger account. Each code must start with a letter or number. The following special characters are allowed: `-_.,:` pattern: "/^[A-Za-z0-9](( *)?[\\-A-Za-z0-9_.,:])*$/" maxLength: 255 performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 tax: type: number format: float title: Tax description: The tax amount for the line item. taxable: type: boolean title: Taxable? description: "`true` if the line item is taxable, `false` if it is not." tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on charges, `false` applies tax on charges. If not defined, then defaults to the Plan and Site settings. This attribute does not work for credits (negative line items). Credits are always applied post-tax. Pre-tax discounts should use the Coupons feature." avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the line item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the line item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 tax_code: type: string maxLength: 50 title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes. tax_info: "$ref": "#/components/schemas/TaxInfo" origin_tax_address_source: "$ref": "#/components/schemas/OriginTaxAddressSourceEnum" destination_tax_address_source: "$ref": "#/components/schemas/DestinationTaxAddressSourceEnum" proration_rate: type: number format: float title: Proration rate description: When a line item has been prorated, this is the rate of the proration. Proration rates were made available for line items created after March 30, 2017. For line items created prior to that date, the proration rate will be `null`, even if the line item was prorated. minimum: 0 maximum: 1 refund: type: boolean title: Refund? refunded_quantity: type: integer title: Refunded Quantity description: For refund charges, the quantity being refunded. For non-refund charges, the total quantity refunded (possibly over multiple refunds). refunded_quantity_decimal: type: string title: Refunded Quantity Decimal description: A floating-point alternative to Refunded Quantity. For refund charges, the quantity being refunded. For non-refund charges, the total quantity refunded (possibly over multiple refunds). The Decimal Quantity feature must be enabled to utilize this field. credit_applied: type: number format: float title: Credit Applied description: The amount of credit from this line item that was applied to the invoice. shipping_address: "$ref": "#/components/schemas/ShippingAddress" start_date: type: string format: date-time title: Start date description: If an end date is present, this is value indicates the beginning of a billing time range. If no end date is present it indicates billing for a specific date. end_date: type: string format: date-time title: End date description: If this date is provided, it indicates the end of a time range. custom_fields: "$ref": "#/components/schemas/CustomFields" created_at: type: string format: date-time title: Created at description: When the line item was created. updated_at: type: string format: date-time title: Last updated at description: When the line item was last changed. LineItemRefund: type: object properties: id: type: string title: Line item ID maxLength: 13 quantity: type: integer title: Quantity description: Line item quantity to be refunded. Must be less than or equal to the `quantity_remaining`. If `quantity_decimal`, `amount`, and `percentage` are not present, `quantity` is required. If `amount` or `percentage` is present, `quantity` must be absent. quantity_decimal: type: string title: Quantity Decimal description: Decimal quantity to refund. The `quantity_decimal` will be used to refund charges that has a NOT null quantity decimal. Must be less than or equal to the `quantity_decimal_remaining`. If `quantity`, `amount`, and `percentage` are not present, `quantity_decimal` is required. If `amount` or `percentage` is present, `quantity_decimal` must be absent. The Decimal Quantity feature must be enabled to utilize this field. amount: type: number format: float description: The specific amount to be refunded from the adjustment. Must be less than or equal to the adjustment's remaining balance. If `quantity`, `quantity_decimal` and `percentage` are not present, `amount` is required. If `quantity`, `quantity_decimal`, or `percentage` is present, `amount` must be absent. percentage: type: integer description: The percentage of the adjustment's remaining balance to refund. If `quantity`, `quantity_decimal` and `amount_in_cents` are not present, `percentage` is required. If `quantity`, `quantity_decimal` or `amount_in_cents` is present, `percentage` must be absent. minimum: 1 maximum: 100 prorate: type: boolean title: Prorate description: | Set to `true` if the line item should be prorated; set to `false` if not. This can only be used on line items that have a start and end date. default: false LineItemCreate: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. If `item_code`/`item_id` is part of the request then `currency` is optional, if the site has a single default currency. `currency` is required if `item_code`/`item_id` is present, and there are multiple currencies defined on the site. If `item_code`/`item_id` is not present `currency` is required. maxLength: 3 unit_amount: type: number format: float title: Unit amount description: | A positive or negative amount with `type=charge` will result in a positive `unit_amount`. A positive or negative amount with `type=credit` will result in a negative `unit_amount`. If `item_code`/`item_id` is present, `unit_amount` can be passed in, to override the `Item`'s `unit_amount`. If `item_code`/`item_id` is not present then `unit_amount` is required. tax_inclusive: type: boolean title: Tax Inclusive? default: false description: Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to use this flag. quantity: type: integer title: Quantity description: This number will be multiplied by the unit amount to compute the subtotal before any discounts or taxes. default: 1 description: type: string title: Description description: Description that appears on the invoice. If `item_code`/`item_id` is part of the request then `description` must be absent. maxLength: 255 item_code: type: string title: Item Code description: Unique code to identify an item. Available when the Credit Invoices feature is enabled. pattern: "/^[a-z0-9_+-]+$/" maxLength: 50 item_id: type: string title: Item ID description: System-generated unique identifier for an item. Available when the Credit Invoices feature is enabled. maxLength: 13 revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/LineItemRevenueScheduleTypeEnum" type: title: Type description: Line item type. If `item_code`/`item_id` is present then `type` should not be present. If `item_code`/`item_id` is not present then `type` is required. "$ref": "#/components/schemas/LineItemTypeEnum" credit_reason_code: title: Credit reason code description: The reason the credit was given when line item is `type=credit`. When the Credit Invoices feature is enabled, the value can be set and will default to `general`. When the Credit Invoices feature is not enabled, the value will always be `null`. default: general "$ref": "#/components/schemas/PartialCreditReasonCodeEnum" accounting_code: type: string title: Accounting Code description: Accounting Code for the `LineItem`. If `item_code`/`item_id` is part of the request then `accounting_code` must be absent. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on charges, `false` applies tax on charges. If not defined, then defaults to the Plan and Site settings. This attribute does not work for credits (negative line items). Credits are always applied post-tax. Pre-tax discounts should use the Coupons feature." avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the line item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `LineItem`, then the `avalara_transaction_type` must be absent. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the line item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `LineItem`, then the `avalara_service_type` must be absent. minimum: 0 tax_code: type: string maxLength: 50 title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes. product_code: type: string title: Product code description: Optional field to track a product code or SKU for the line item. This can be used to later reporting on product purchases. For Vertex tax calculations, this field will be used as the Vertex `product` field. If `item_code`/`item_id` is part of the request then `product_code` must be absent. maxLength: 50 origin: title: Origin description: Origin `external_gift_card` is allowed if the Gift Cards feature is enabled on your site and `type` is `credit`. Set this value in order to track gift card credits from external gift cards (like InComm). It also skips billing information requirements. Origin `prepayment` is only allowed if `type` is `charge` and `tax_exempt` is left blank or set to true. This origin creates a charge and opposite credit on the account to be used for future invoices. "$ref": "#/components/schemas/LineItemCreateOriginEnum" custom_fields: "$ref": "#/components/schemas/CustomFields" start_date: type: string format: date-time title: Start date description: If an end date is present, this is value indicates the beginning of a billing time range. If no end date is present it indicates billing for a specific date. Defaults to the current date-time. end_date: type: string format: date-time title: End date description: If this date is provided, it indicates the end of a time range. origin_tax_address_source: "$ref": "#/components/schemas/OriginTaxAddressSourceEnum" destination_tax_address_source: "$ref": "#/components/schemas/DestinationTaxAddressSourceEnum" required: - currency - unit_amount - type PlanMini: type: object title: Plan mini details description: Just the important parts. properties: id: type: string title: Plan ID maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true code: type: string title: Plan code description: Unique code to identify the plan. This is used in Hosted Payment Page URLs and in the invoice exports. pattern: "/^[a-z0-9_+-]+$/i" maxLength: 50 name: type: string title: Name description: This name describes your plan and will appear on the Hosted Payment Page and the subscriber's invoice. maxLength: 255 Plan: type: object description: Full plan details. properties: id: type: string title: Plan ID maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true code: type: string title: Plan code description: Unique code to identify the plan. This is used in Hosted Payment Page URLs and in the invoice exports. pattern: "/^[a-z0-9_+-]+$/i" maxLength: 50 state: title: State description: The current state of the plan. readOnly: true "$ref": "#/components/schemas/ActiveStateEnum" name: type: string title: Name description: This name describes your plan and will appear on the Hosted Payment Page and the subscriber's invoice. maxLength: 255 description: type: string title: Description description: Optional description, not displayed. interval_unit: title: Interval unit description: Unit for the plan's billing interval. default: months "$ref": "#/components/schemas/IntervalUnitEnum" interval_length: type: integer title: Interval length description: Length of the plan's billing interval in `interval_unit`. default: 1 minimum: 1 trial_unit: title: Trial unit description: Units for the plan's trial period. default: months "$ref": "#/components/schemas/IntervalUnitEnum" trial_length: type: integer title: Trial length description: Length of plan's trial period in `trial_units`. `0` means `no trial`. default: 0 minimum: 0 trial_requires_billing_info: type: boolean title: Trial Requires BillingInfo description: Allow free trial subscriptions to be created without billing info. Should not be used if billing info is needed for initial invoice due to existing uninvoiced charges or setup fee. default: true total_billing_cycles: type: integer title: Total billing cycles description: Automatically terminate subscriptions after a defined number of billing cycles. Number of billing cycles before the plan automatically stops renewing, defaults to `null` for continuous, automatic renewal. minimum: 0 auto_renew: type: boolean title: Auto renew default: true description: Subscriptions will automatically inherit this value once they are active. If `auto_renew` is `true`, then a subscription will automatically renew its term at renewal. If `auto_renew` is `false`, then a subscription will expire at the end of its term. `auto_renew` can be overridden on the subscription record itself. pricing_model: title: Pricing Model "$ref": "#/components/schemas/PricingModelTypeEnum" ramp_intervals: type: array title: Ramp Intervals items: "$ref": "#/components/schemas/PlanRampInterval" custom_fields: "$ref": "#/components/schemas/CustomFields" revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" setup_fee_revenue_schedule_type: title: Setup fee revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" accounting_code: type: string title: Plan accounting code description: Accounting code for invoice line items for the plan. If no value is provided, it defaults to plan's code. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 setup_fee_accounting_code: type: string title: Setup fee accounting code description: Accounting code for invoice line items for the plan's setup fee. If no value is provided, it defaults to plan's accounting code. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 tax_code: type: string maxLength: 50 title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes. tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on the plan, `false` applies tax on the plan." + vertex_transaction_type: + type: string + title: Vertex Transaction Type + description: Used by Vertex for tax calculations. Possible values are `sale`, + `rental`, `lease`. currencies: type: array title: Pricing items: "$ref": "#/components/schemas/PlanPricing" minItems: 1 hosted_pages: type: object title: Hosted pages settings "$ref": "#/components/schemas/PlanHostedPages" allow_any_item_on_subscriptions: type: boolean title: Allow any item on subscriptions description: | Used to determine whether items can be assigned as add-ons to individual subscriptions. If `true`, items can be assigned as add-ons to individual subscription add-ons. If `false`, only plan add-ons can be used. dunning_campaign_id: type: string title: Dunning Campaign ID description: Unique ID to identify a dunning campaign. Used to specify if a non-default dunning campaign should be assigned to this plan. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at readOnly: true required: - code - name PlanCreate: type: object properties: code: type: string title: Plan code description: Unique code to identify the plan. This is used in Hosted Payment Page URLs and in the invoice exports. pattern: "/^[a-z0-9_+-]+$/i" maxLength: 50 name: type: string title: Name description: This name describes your plan and will appear on the Hosted Payment Page and the subscriber's invoice. maxLength: 255 description: type: string title: Description description: Optional description, not displayed. accounting_code: type: string title: Plan accounting code description: Accounting code for invoice line items for the plan. If no value is provided, it defaults to plan's code. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 interval_unit: title: Interval unit description: Unit for the plan's billing interval. default: months "$ref": "#/components/schemas/IntervalUnitEnum" interval_length: type: integer title: Interval length description: Length of the plan's billing interval in `interval_unit`. default: 1 minimum: 1 trial_unit: title: Trial unit description: Units for the plan's trial period. default: months "$ref": "#/components/schemas/IntervalUnitEnum" trial_length: type: integer title: Trial length description: Length of plan's trial period in `trial_units`. `0` means `no trial`. default: 0 minimum: 0 trial_requires_billing_info: type: boolean title: Trial Requires BillingInfo description: Allow free trial subscriptions to be created without billing info. Should not be used if billing info is needed for initial invoice due to existing uninvoiced charges or setup fee. default: true total_billing_cycles: type: integer title: Total billing cycles description: Automatically terminate plans after a defined number of billing cycles. minimum: 0 auto_renew: type: boolean title: Auto renew default: true description: Subscriptions will automatically inherit this value once they are active. If `auto_renew` is `true`, then a subscription will automatically renew its term at renewal. If `auto_renew` is `false`, then a subscription will expire at the end of its term. `auto_renew` can be overridden on the subscription record itself. pricing_model: title: Pricing Model "$ref": "#/components/schemas/PricingModelTypeEnum" ramp_intervals: type: array title: Ramp Intervals items: "$ref": "#/components/schemas/PlanRampInterval" custom_fields: "$ref": "#/components/schemas/CustomFields" revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 setup_fee_liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 setup_fee_revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 setup_fee_performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 setup_fee_revenue_schedule_type: title: Setup fee revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" setup_fee_accounting_code: type: string title: Setup fee accounting code description: Accounting code for invoice line items for the plan's setup fee. If no value is provided, it defaults to plan's accounting code. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 tax_code: type: string maxLength: 50 title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes. tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on the plan, `false` applies tax on the plan." + vertex_transaction_type: + type: string + title: Vertex Transaction Type + description: Used by Vertex for tax calculations. Possible values are `sale`, + `rental`, `lease`. currencies: type: array title: Pricing items: "$ref": "#/components/schemas/PlanPricing" minItems: 1 hosted_pages: type: object title: Hosted pages settings "$ref": "#/components/schemas/PlanHostedPages" add_ons: type: array title: Add Ons items: "$ref": "#/components/schemas/AddOnCreate" allow_any_item_on_subscriptions: type: boolean title: Allow any item on subscriptions default: false description: | Used to determine whether items can be assigned as add-ons to individual subscriptions. If `true`, items can be assigned as add-ons to individual subscription add-ons. If `false`, only plan add-ons can be used. dunning_campaign_id: type: string title: Dunning Campaign ID description: Unique ID to identify a dunning campaign. Used to specify if a non-default dunning campaign should be assigned to this plan. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. required: - code - name - currencies PlanHostedPages: type: object properties: success_url: type: string title: Success redirect URL description: URL to redirect to after signup on the hosted payment pages. cancel_url: type: string title: Cancel redirect URL (deprecated) description: URL to redirect to on canceled signup on the hosted payment pages. bypass_confirmation: type: boolean title: Bypass confirmation page? description: If `true`, the customer will be sent directly to your `success_url` after a successful signup, bypassing Recurly's hosted confirmation page. display_quantity: type: boolean title: Display quantity? description: Determines if the quantity field is displayed on the hosted pages for the plan. PlanPricing: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 setup_fee: type: number format: float title: Setup fee description: Amount of one-time setup fee automatically charged at the beginning of a subscription billing cycle. For subscription plans with a trial, the setup fee will be charged at the time of signup. Setup fees do not increase with the quantity of a subscription plan. minimum: 0 maximum: 1000000 unit_amount: type: number format: float title: Unit price description: This field should not be sent when the pricing model is 'ramp'. minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true PlanRampInterval: type: object title: Plan Ramp Interval properties: starting_billing_cycle: type: integer description: Represents the billing cycle where a ramp interval starts. default: 1 currencies: type: array description: Represents the price for the ramp interval. items: "$ref": "#/components/schemas/PlanRampPricing" PlanUpdate: type: object properties: id: type: string title: Plan ID maxLength: 13 readOnly: true code: type: string title: Plan code description: Unique code to identify the plan. This is used in Hosted Payment Page URLs and in the invoice exports. pattern: "/^[a-z0-9_+-]+$/i" maxLength: 50 name: type: string title: Name description: This name describes your plan and will appear on the Hosted Payment Page and the subscriber's invoice. maxLength: 255 description: type: string title: Description description: Optional description, not displayed. accounting_code: type: string title: Plan accounting code description: Accounting code for invoice line items for the plan. If no value is provided, it defaults to plan's code. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 trial_unit: title: Trial unit description: Units for the plan's trial period. default: months "$ref": "#/components/schemas/IntervalUnitEnum" trial_length: type: integer title: Trial length description: Length of plan's trial period in `trial_units`. `0` means `no trial`. default: 0 minimum: 0 trial_requires_billing_info: type: boolean title: Trial Requires BillingInfo description: Allow free trial subscriptions to be created without billing info. Should not be used if billing info is needed for initial invoice due to existing uninvoiced charges or setup fee. default: true total_billing_cycles: type: integer title: Total billing cycles description: Automatically terminate plans after a defined number of billing cycles. minimum: 0 auto_renew: type: boolean title: Auto renew default: true description: Subscriptions will automatically inherit this value once they are active. If `auto_renew` is `true`, then a subscription will automatically renew its term at renewal. If `auto_renew` is `false`, then a subscription will expire at the end of its term. `auto_renew` can be overridden on the subscription record itself. ramp_intervals: type: array title: Ramp Intervals items: "$ref": "#/components/schemas/PlanRampInterval" custom_fields: "$ref": "#/components/schemas/CustomFields" revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 setup_fee_liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 setup_fee_revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 setup_fee_performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 setup_fee_revenue_schedule_type: title: Setup fee revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" setup_fee_accounting_code: type: string title: Setup fee accounting code description: Accounting code for invoice line items for the plan's setup fee. If no value is provided, it defaults to plan's accounting code. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 tax_code: type: string maxLength: 50 title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of `unknown`, `physical`, or `digital` tax codes. tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on the plan, `false` applies tax on the plan." + vertex_transaction_type: + type: string + title: Vertex Transaction Type + description: Used by Vertex for tax calculations. Possible values are `sale`, + `rental`, `lease`. currencies: type: array title: Pricing description: Optional when the pricing model is 'ramp'. items: "$ref": "#/components/schemas/PlanPricing" minItems: 1 hosted_pages: type: object title: Hosted pages settings "$ref": "#/components/schemas/PlanHostedPages" allow_any_item_on_subscriptions: type: boolean title: Allow any item on subscriptions description: | Used to determine whether items can be assigned as add-ons to individual subscriptions. If `true`, items can be assigned as add-ons to individual subscription add-ons. If `false`, only plan add-ons can be used. dunning_campaign_id: type: string title: Dunning Campaign ID description: Unique ID to identify a dunning campaign. Used to specify if a non-default dunning campaign should be assigned to this plan. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. AddOnPricing: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 unit_amount: type: number format: float title: Unit price minimum: 0 maximum: 1000000 description: Allows up to 2 decimal places. Required unless `unit_amount_decimal` is provided. unit_amount_decimal: type: string title: Unit Amount Decimal minimum: 0 maximum: 1000000 description: | Allows up to 9 decimal places. Only supported when `add_on_type` = `usage`. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided. tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true required: - currency TierPricing: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 unit_amount: type: number format: float title: Unit price minimum: 0 maximum: 1000000 description: Allows up to 2 decimal places. Required unless `unit_amount_decimal` is provided. unit_amount_decimal: type: string title: Unit Amount Decimal minimum: 0 maximum: 1000000 description: | Allows up to 9 decimal places. Only supported when `add_on_type` = `usage`. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided. required: - currency PlanRampPricing: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 unit_amount: type: number format: float title: Unit price description: Represents the price for the Ramp Interval. minimum: 0 maximum: 1000000 required: - currency - unit_amount Pricing: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 unit_amount: type: number format: float title: Unit price minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true required: - currency - unit_amount Tier: type: object properties: ending_quantity: type: integer title: Ending quantity minimum: 1 maximum: 999999999 description: Ending quantity for the tier. This represents a unit amount for unit-priced add ons. Must be left empty if it is the final tier. usage_percentage: type: string title: Usage Percentage description: "(deprecated) -- Use the percentage_tiers object instead." deprecated: true currencies: type: array title: Tier pricing items: "$ref": "#/components/schemas/TierPricing" minItems: 1 PercentageTiersByCurrency: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 tiers: type: array title: Tiers items: "$ref": "#/components/schemas/PercentageTier" minItems: 1 PercentageTier: type: object properties: ending_amount: type: number format: float title: Ending amount minimum: 0.01 maximum: 9999999999999.99 description: Ending amount for the tier. Allows up to 2 decimal places. Must be left empty if it is the final tier. usage_percentage: type: string title: Usage Percentage minimum: 0 maximum: 100 description: | The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places represented as a string. ProrationSettings: type: object title: Proration Settings description: Allows you to control how any resulting charges and credits will be calculated and prorated. properties: charge: "$ref": "#/components/schemas/ProrationSettingsChargeEnum" credit: "$ref": "#/components/schemas/ProrationSettingsCreditEnum" ProrationSettingsChargeEnum: type: string title: Charge description: Determines how the amount charged is determined for this change default: prorated_amount enum: - full_amount - prorated_amount - none ProrationSettingsCreditEnum: type: string title: Credit description: Determines how the amount credited is determined for this change default: prorated_amount enum: - full_amount - prorated_amount - none Settings: type: object properties: billing_address_requirement: description: | - full: Full Address (Street, City, State, Postal Code and Country) - streetzip: Street and Postal Code only - zip: Postal Code only - none: No Address readOnly: true "$ref": "#/components/schemas/AddressRequirementEnum" accepted_currencies: type: array items: type: string description: 3-letter ISO 4217 currency code. readOnly: true default_currency: type: string description: The default 3-letter ISO 4217 currency code. readOnly: true ShippingAddress: type: object properties: id: type: string title: Shipping Address ID maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true account_id: type: string title: Account ID maxLength: 13 readOnly: true nickname: type: string maxLength: 255 first_name: type: string maxLength: 255 last_name: type: string maxLength: 255 company: type: string maxLength: 255 email: type: string maxLength: 255 vat_number: type: string maxLength: 20 phone: type: string maxLength: 30 street1: type: string maxLength: 255 street2: type: string maxLength: 255 city: type: string maxLength: 255 region: type: string maxLength: 255 description: State or province. postal_code: type: string maxLength: 20 description: Zip or postal code. country: type: string maxLength: 50 description: Country, 2-letter ISO 3166-1 alpha-2 code. geo_code: type: string maxLength: 20 description: Code that represents a geographic entity (location or object). Only returned for Sling Vertex Integration created_at: type: string title: Created at format: date-time readOnly: true updated_at: type: string title: Updated at format: date-time readOnly: true ShippingAddressCreate: type: object properties: nickname: type: string maxLength: 255 first_name: type: string maxLength: 255 last_name: type: string maxLength: 255 company: type: string maxLength: 255 email: type: string maxLength: 255 vat_number: type: string maxLength: 20 phone: type: string maxLength: 30 street1: type: string maxLength: 255 street2: type: string maxLength: 255 city: type: string maxLength: 255 region: type: string maxLength: 255 description: State or province. postal_code: type: string maxLength: 20 description: Zip or postal code. geo_code: type: string maxLength: 20 description: Code that represents a geographic entity (location or object). Only returned for Sling Vertex Integration country: type: string maxLength: 50 description: Country, 2-letter ISO 3166-1 alpha-2 code. required: - first_name - last_name - street1 - city - postal_code - country ShippingAddressList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ShippingAddress" ShippingMethod: type: object properties: id: type: string title: Shipping Method ID readOnly: true maxLength: 13 object: type: string title: Object type readOnly: true code: type: string title: Code description: The internal name used identify the shipping method. maxLength: 50 name: type: string title: Name description: The name of the shipping method displayed to customers. maxLength: 100 accounting_code: type: string title: Accounting Code description: Accounting code for shipping method. maxLength: 20 tax_code: type: string title: Tax code description: | Used by Avalara, Vertex, and Recurly’s built-in tax feature. The tax code values are specific to each tax system. If you are using Recurly’s built-in taxes the values are: - `FR` – Common Carrier FOB Destination - `FR022000` – Common Carrier FOB Origin - `FR020400` – Non Common Carrier FOB Destination - `FR020500` – Non Common Carrier FOB Origin - `FR010100` – Delivery by Company Vehicle Before Passage of Title - `FR010200` – Delivery by Company Vehicle After Passage of Title - `NT` – Non-Taxable maxLength: 50 liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 performance_obligation_id: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at readOnly: true ShippingMethodMini: type: object properties: id: type: string title: Shipping Method ID readOnly: true maxLength: 13 object: type: string title: Object type readOnly: true code: type: string title: Code description: The internal name used identify the shipping method. maxLength: 50 name: type: string title: Name description: The name of the shipping method displayed to customers. maxLength: 100 ShippingMethodCreate: type: object properties: code: type: string title: Code description: The internal name used identify the shipping method. pattern: "/^[a-z0-9_+-]+$/i" maxLength: 50 name: type: string title: Name description: The name of the shipping method displayed to customers. maxLength: 100 accounting_code: type: string title: Accounting Code description: Accounting code for shipping method. maxLength: 20 tax_code: type: string title: Tax code description: | Used by Avalara, Vertex, and Recurly’s built-in tax feature. The tax code values are specific to each tax system. If you are using Recurly’s built-in taxes the values are: - `FR` – Common Carrier FOB Destination - `FR022000` – Common Carrier FOB Origin - `FR020400` – Non Common Carrier FOB Destination - `FR020500` – Non Common Carrier FOB Origin - `FR010100` – Delivery by Company Vehicle Before Passage of Title - `FR010200` – Delivery by Company Vehicle After Passage of Title
recurly/recurly-client-php
27df388564a6935e7ae59d9616aa63323d377640
Generated Latest Changes for v2021-02-25
diff --git a/openapi/api.yaml b/openapi/api.yaml index 9b0e9a5..b8cfb55 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -9406,1028 +9406,1029 @@ paths: end - lang: Java source: | try { final Invoice invoice = client.reopenInvoice(invoiceId); System.out.println("Reopened invoice: " + invoice.getNumber()); } catch (ValidationException e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in e.getError().getParams() System.out.println("Failed validation: " + e.getError().getMessage()); } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $invoice = $client->reopenInvoice($invoice_id); echo 'Reopened Invoice:' . PHP_EOL; var_dump($invoice); } catch (\Recurly\Errors\Validation $e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params var_dump($e); } catch (\Recurly\RecurlyError $e) { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it var_dump($e); } - lang: Go source: "invoice, err := client.ReopenInvoice(invoiceID)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeNotFound {\n\t\tfmt.Printf(\"Resource not found: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\n\nfmt.Printf(\"Reopened Invoice: %v\", invoice)" "/invoices/{invoice_id}/void": put: tags: - invoice operationId: void_invoice summary: Void a credit invoice. description: Invoice must be a credit invoice (`type=credit`) and cannot be closed (`state=closed`), processing (`state=processing`), or already voided. parameters: - "$ref": "#/components/parameters/invoice_id" responses: '200': description: The updated invoice. content: application/json: schema: "$ref": "#/components/schemas/Invoice" '404': description: Incorrect site or invoice ID. content: application/json: schema: "$ref": "#/components/schemas/Error" '422': description: Invoice did not meet the conditions to be voided. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const invoice = await client.voidInvoice(invoiceId) console.log('Voided invoice: ', invoice) } catch (err) { if (err instanceof recurly.errors.ValidationError) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params console.log('Failed validation', err.params) } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: invoice = client.void_invoice(invoice_id) print("Voided Invoice %s" % invoice.id) except recurly.errors.NotFoundError: # If the resource was not found, you may want to alert the user or # just return nil print("Resource Not Found") - lang: Ruby source: | begin invoice = @client.void_invoice(invoice_id: invoice_id) puts "Voided invoice #{invoice}" rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end - lang: Java source: | try { final Invoice invoice = client.voidInvoice(invoiceId); System.out.println("Voided invoice " + invoice.getId()); } catch (final ValidationException e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in e.getError().getParams() System.out.println("Failed validation: " + e.getError().getMessage()); } catch (final ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $invoice = $client->voidInvoice($invoice_id); echo 'Voided Invoice:' . PHP_EOL; var_dump($invoice); } catch (\Recurly\Errors\Validation $e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params var_dump($e); } catch (\Recurly\RecurlyError $e) { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it var_dump($e); } - lang: Go source: "invoice, err := client.VoidInvoice(invoiceID)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeValidation {\n\t\tfmt.Printf(\"Failed validation: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\n\nfmt.Printf(\"Voided Invoice: %v\", invoice)" "/invoices/{invoice_id}/transactions": post: tags: - invoice operationId: record_external_transaction summary: Record an external payment for a manual invoices. description: This endpoint allows you to record an offline payment that was not captured through your gateway. It will throw an error for an auto-collecting invoice. parameters: - "$ref": "#/components/parameters/invoice_id" requestBody: content: application/json: schema: "$ref": "#/components/schemas/ExternalTransaction" required: true responses: '200': description: The recorded transaction. content: application/json: schema: "$ref": "#/components/schemas/Transaction" '404': description: Incorrect site or invoice ID. content: application/json: schema: "$ref": "#/components/schemas/Error" '422': description: Invoice did not meet the conditions for an offline transaction. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const externalTrx = { description: "A check collected outside of Recurly", amount: 10.0, payment_method: 'check' } const transaction = await client.recordExternalTransaction(invoiceId, externalTrx) console.log('External Transaction: ', transaction) } catch (err) { if (err instanceof recurly.errors.NotFoundError) { // If the request was not found, you may want to alert the user or // just return null console.log('Resource Not Found') } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } "/invoices/{invoice_id}/line_items": get: tags: - line_item operationId: list_invoice_line_items summary: List an invoice's line items description: See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: - "$ref": "#/components/parameters/invoice_id" - "$ref": "#/components/parameters/ids" - "$ref": "#/components/parameters/limit" - "$ref": "#/components/parameters/order" - "$ref": "#/components/parameters/sort_dates" - "$ref": "#/components/parameters/filter_begin_time" - "$ref": "#/components/parameters/filter_end_time" - "$ref": "#/components/parameters/filter_line_item_original" - "$ref": "#/components/parameters/filter_line_item_state" - "$ref": "#/components/parameters/filter_line_item_type" responses: '200': description: A list of the invoice's line items. content: application/json: schema: "$ref": "#/components/schemas/LineItemList" '400': description: Invalid or unpermitted parameter. content: application/json: schema: "$ref": "#/components/schemas/Error" '404': description: Incorrect site ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | const lineItems = client.listInvoiceLineItems(invoiceId, { params: { limit: 200 } }) for await (const lineItem of lineItems.each()) { console.log(lineItem.id) } - lang: Python source: | try: params = {"limit": 200} line_items = client.list_invoice_line_items(invoice_id, params=params).items() for item in line_items: print("Invoice Line Items %s" % item.id) except recurly.errors.NotFoundError: # If the resource was not found, you may want to alert the user or # just return nil print("Resource Not Found") - lang: ".NET" source: | var lineItems = client.ListInvoiceLineItems(invoiceId); foreach(LineItem lineItem in lineItems) { Console.WriteLine(lineItem.Id); } - lang: Ruby source: | params = { limit: 200 } line_items = @client.list_invoice_line_items( invoice_id: invoice_id, params: params ) line_items.each do |line_item| puts "Line Item: #{line_item.id}" end - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); Pager<LineItem> lineItems = client.listInvoiceLineItems(invoiceId, params); for (LineItem lineItem : lineItems) { System.out.println(lineItem.getId()); } - lang: PHP source: | $options = [ 'params' => [ 'limit' => 200 ] ]; $invoice_line_items = $client->listInvoiceLineItems($invoice_id, $options); foreach($invoice_line_items as $line_item) { echo 'Invoice Line Item: ' . $line_item->getId() . PHP_EOL; } - lang: Go source: "listParams := &recurly.ListInvoiceLineItemsParams{\n\tSort: recurly.String(\"created_at\"),\n}\nlineItems, err := client.ListInvoiceLineItems(invoiceID, listParams)\nif err != nil {\n\tfmt.Println(\"Unexpected error: %v\", err)\n\treturn\n}\n\nfor lineItems.HasMore() {\n\terr := lineItems.Fetch()\n\tif e, ok := err.(*recurly.Error); ok {\n\t\tfmt.Printf(\"Failed to retrieve next page: %v\", e)\n\t\tbreak\n\t}\n\tfor i, lineItem := range lineItems.Data() {\n\t\tfmt.Printf(\"Invoice Line Item %3d: %s\\n\",\n\t\t\ti,\n\t\t\tlineItem.Id,\n\t\t)\n\t}\n}" "/invoices/{invoice_id}/coupon_redemptions": get: tags: - coupon_redemption operationId: list_invoice_coupon_redemptions summary: List the coupon redemptions applied to an invoice description: See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: - "$ref": "#/components/parameters/invoice_id" - "$ref": "#/components/parameters/ids" - "$ref": "#/components/parameters/sort_dates" - "$ref": "#/components/parameters/filter_begin_time" - "$ref": "#/components/parameters/filter_end_time" responses: '200': description: A list of the the coupon redemptions associated with the invoice. content: application/json: schema: "$ref": "#/components/schemas/CouponRedemptionList" '404': description: Incorrect site or invoice ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | const redemptions = client.listInvoiceCouponRedemptions(invoiceId, { params: { limit: 200 } }) for await (const redemption of redemptions.each()) { console.log(redemption.id) } - lang: Python source: | params = {"limit": 200} redemptions = client.list_invoice_coupon_redemptions(invoice_id, params=params).items() for redemption in redemptions: print("Invoice Coupon Redemption %s" % redemption) - lang: ".NET" source: | var couponRedemptions = client.ListInvoiceCouponRedemptions(invoiceId); foreach(CouponRedemption redemption in couponRedemptions) { Console.WriteLine(redemption.Id); } - lang: Ruby source: | params = { limit: 200 } coupon_redemptions = @client.list_invoice_coupon_redemptions( invoice_id: invoice_id, params: params ) coupon_redemptions.each do |redemption| puts "CouponRedemption: #{redemption.id}" end - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<CouponRedemption> redemptions = client.listInvoiceCouponRedemptions(invoiceId, params); for (CouponRedemption redemption : redemptions) { System.out.println(redemption.getId()); } - lang: PHP source: | $options = [ 'params' => [ 'limit' => 200 ] ]; $invoice_coupon_redemptions = $client->listInvoiceCouponRedemptions($invoice_id, $options); foreach($invoice_coupon_redemptions as $redemption) { echo 'Invoice Coupon Redemption: ' . $redemption->getId() . PHP_EOL; } - lang: Go source: "listParams := &recurly.ListInvoiceCouponRedemptionsParams{\n\tSort: recurly.String(\"created_at\"),\n}\nredemptions, err := client.ListInvoiceCouponRedemptions(invoiceID, listParams)\nif err != nil {\n\tfmt.Println(\"Unexpected error: %v\", err)\n\treturn\n}\n\nfor redemptions.HasMore() {\n\terr := redemptions.Fetch()\n\tif e, ok := err.(*recurly.Error); ok {\n\t\tfmt.Printf(\"Failed to retrieve next page: %v\", e)\n\t\tbreak\n\t}\n\tfor i, redemption := range redemptions.Data() {\n\t\tfmt.Printf(\"Invoice Coupon Redemption %3d: %s\\n\",\n\t\t\ti,\n\t\t\tredemption.Id,\n\t\t)\n\t}\n}" "/invoices/{invoice_id}/related_invoices": get: tags: - invoice operationId: list_related_invoices summary: List an invoice's related credit or charge invoices description: | Related invoices provide a link between credit invoices and the charge invoices that they are refunding. For a charge invoice the related invoices will be credit invoices. For a credit invoice the related invoices will be charge invoices. See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: - "$ref": "#/components/parameters/invoice_id" responses: '200': description: A list of the credit or charge invoices associated with the invoice. content: application/json: schema: "$ref": "#/components/schemas/InvoiceList" '404': description: Incorrect site or invoice ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | const invoices = client.listRelatedInvoices(invoiceId, { params: { limit: 200 } }) for await (const invoice of invoices.each()) { console.log(invoice.number) } - lang: Python source: | try: params = {"limit": 200} related_invoices = client.list_related_invoices(invoice_id, params=params).items() for invoice in related_invoices: print("Related invoice %s" % invoice.id) except recurly.errors.NotFoundError: # If the resource was not found, you may want to alert the user or # just return nil print("Resource Not Found") - lang: ".NET" source: | var invoices = client.ListRelatedInvoices(invoiceId); foreach(Invoice invoice in invoices) { Console.WriteLine(invoice.Number); } - lang: Ruby source: | params = { limit: 200 } invoices = @client.list_related_invoices( invoice_id: invoice_id, params: params ) invoices.each do |invoice| puts "Invoice: #{invoice.number}" end - lang: Java source: | final Pager<Invoice> invoices = client.listRelatedInvoices(invoiceId); for (Invoice invoice : invoices) { System.out.println(invoice.getNumber()); } - lang: PHP source: | $related_invoices = $client->listRelatedInvoices($invoice_id); foreach($related_invoices as $invoice) { echo 'Related Invoice: ' . $invoice->getId() . PHP_EOL; } - lang: Go source: "invoices, err := client.ListRelatedInvoices(invoiceID)\nif err != nil {\n\tfmt.Println(\"Unexpected error: %v\", err)\n\treturn\n}\n\nfor invoices.HasMore() {\n\terr := invoices.Fetch()\n\tif e, ok := err.(*recurly.Error); ok {\n\t\tfmt.Printf(\"Failed to retrieve next page: %v\", e)\n\t\tbreak\n\t}\n\tfor i, invoice := range invoices.Data() {\n\t\tfmt.Printf(\"Related Invoice %3d: %s, %s\\n\",\n\t\t\ti,\n\t\t\tinvoice.Id,\n\t\t\tinvoice.Number,\n\t\t)\n\t}\n}" "/invoices/{invoice_id}/refund": post: tags: - invoice operationId: refund_invoice summary: Refund an invoice description: | There are two ways to do a refund: - * refund a specific amount which is divided across all the line items. - * refund quantities of line items. - If you want to refund the entire refundable amount on the invoice, the - simplest way is to do `type=amount` without specifiying an `amount`. + * Apply a specific dollar/cent amount or percentage amount to an entire invoice, which will refund the resulting amount across all line items on the invoice. + * If you want to refund the entire refundable amount on the invoice, the simplest way is to do `type=amount` without specifiying an `amount`. + * Note: You must have the Credit Memos feature flag enabled on your site to utilize percentage amount refunds on invoices. + * Apply a refund to one or more individual line items on an invoice. A line item can be refunded by a quantity amount, a specific dollar/cent amount, or a percentage amount and will only apply to the specific line item you are aiming to refund. + * Note: You must have the Credit Memos feature flag enabled on your site to utilize specific dollar/cent amount and percentage amount refunds on line items. parameters: - "$ref": "#/components/parameters/invoice_id" requestBody: content: application/json: schema: "$ref": "#/components/schemas/InvoiceRefund" required: true responses: '201': description: Returns the new credit invoice. content: application/json: schema: "$ref": "#/components/schemas/Invoice" '400': description: Invalid or unpermitted parameter. content: application/json: schema: "$ref": "#/components/schemas/Error" '404': description: Incorrect site or invoice ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const invoiceRefund = { creditCustomerNotes: "Notes on credits", type: "amount", // could also be "line_items" amount: 100 } const invoice = await client.refundInvoice(invoiceId, invoiceRefund) console.log('Refunded invoice: ', invoice.number) } catch(err) { if (err instanceof recurly.errors.ValidationError) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params console.log('Failed validation', err.params) } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: invoice_refund = {"type": "amount", "amount": 100} invoice = client.refund_invoice(invoice_id, invoice_refund) print("Refunded Invoice %s" % invoice) except recurly.errors.ValidationError as e: # If the request was invalid, you may want to tell your user # why. You can find the invalid params and reasons in e.error.params print("ValidationError: %s" % e.error.message) print(e.error.params) - lang: ".NET" source: | try { var refundReq = new InvoiceRefund() { CreditCustomerNotes = "Notes on credits", Type = InvoiceRefundType.Amount, // could also be "line_items" Amount = 100 }; Invoice invoice = client.RefundInvoice(invoiceId, refundReq); Console.WriteLine($"Refunded Invoice #{invoice.Number}"); } catch (Recurly.Errors.Validation ex) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in ex.Error.Params Console.WriteLine($"Failed validation: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin invoice_refund = { type: "amount", amount: 100, } invoice = @client.refund_invoice( invoice_id: invoice_id, body: invoice_refund ) puts "Refunded invoice #{invoice}" rescue Recurly::Errors::ValidationError => e # If the request was invalid, you may want to tell your user # why. You can find the invalid params and reasons in e.recurly_error.params puts "ValidationError: #{e.recurly_error.params}" end - lang: Java source: | try { final InvoiceRefund invoiceRefund = new InvoiceRefund(); invoiceRefund.setCreditCustomerNotes("Notes on credits"); invoiceRefund.setType(Constants.InvoiceRefundType.AMOUNT); // could also be "line_items" invoiceRefund.setAmount(new BigDecimal("100")); final Invoice invoice = client.refundInvoice(invoiceId, invoiceRefund); System.out.println("Refunded invoice " + invoice.getNumber()); } catch (ValidationException e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in e.getError().getParams() System.out.println("Failed validation: " + e.getError().getMessage()); } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $refund = [ "type" => "amount", "amount" => 1 ]; $invoice_collection = $client->refundInvoice($invoice_id, $refund); echo 'Refunded Invoice:' . PHP_EOL; var_dump($invoice_collection); } catch (\Recurly\Errors\NotFound $e) { // Could not find the resource, you may want to inform the user // or just return a NULL echo 'Could not find resource.' . PHP_EOL; var_dump($e); } catch (\Recurly\RecurlyError $e) { // Something bad happened... tell the user so that they can fix it? echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL; } - lang: Go source: "refundReq := &recurly.InvoiceRefund{\n\tType: recurly.String(\"amount\"),\n\tAmount: recurly.Float(1),\n\tExternalRefund: &recurly.ExternalRefund{\n\t\tPaymentMethod: recurly.String(\"credit_card\"),\n\t},\n}\ninvoice, err := client.RefundInvoice(invoiceID, refundReq)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeValidation {\n\t\tfmt.Printf(\"Failed validation: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\n\nfmt.Printf(\"Refunded Invoice: %v\", invoice)" "/line_items": get: tags: - line_item operationId: list_line_items summary: List a site's line items description: See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: - "$ref": "#/components/parameters/ids" - "$ref": "#/components/parameters/limit" - "$ref": "#/components/parameters/order" - "$ref": "#/components/parameters/sort_dates" - "$ref": "#/components/parameters/filter_begin_time" - "$ref": "#/components/parameters/filter_end_time" - "$ref": "#/components/parameters/filter_line_item_original" - "$ref": "#/components/parameters/filter_line_item_state" - "$ref": "#/components/parameters/filter_line_item_type" responses: '200': description: A list of the site's line items. content: application/json: schema: "$ref": "#/components/schemas/LineItemList" '400': description: Invalid or unpermitted parameter. content: application/json: schema: "$ref": "#/components/schemas/Error" '404': description: Incorrect site ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | const lineItems = client.listLineItems({ params: { limit: 200 } }) for await (const item of lineItems.each()) { console.log(`Item ${item.id} for ${item.amount}`) } - lang: Python source: | params = {"limit": 200} line_items = client.list_line_items(params=params).items() for line_item in line_items: print(line_item.id) - lang: ".NET" source: | var optionalParams = new ListLineItemsParams() { Limit = 200 }; var lineItems = client.ListLineItems(optionalParams); foreach(LineItem item in lineItems) { Console.WriteLine($"Item {item.Uuid} for {item.Amount}"); } - lang: Ruby source: | params = { limit: 200 } line_items = @client.list_line_items( params: params ) line_items.each do |line_item| puts "LineItem: #{line_item.id}" end - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<LineItem> lineItems = client.listLineItems(params); for (LineItem lineItem : lineItems) { System.out.println("Item " + lineItem.getUuid() + " for " + lineItem.getAmount()); } - lang: PHP source: | $options = [ 'params' => [ 'limit' => 200 ] ]; $line_items = $client->listLineItems($options); foreach($line_items as $line_item) { echo 'Line item: ' . $line_item->getId() . PHP_EOL; } - lang: Go source: "listParams := &recurly.ListLineItemsParams{\n\tSort: recurly.String(\"created_at\"),\n\tOrder: recurly.String(\"desc\"),\n\tLimit: recurly.Int(200),\n}\nlineItems, err := client.ListLineItems(listParams)\nif err != nil {\n\tfmt.Println(\"Unexpected error: %v\", err)\n\treturn\n}\n\nfor lineItems.HasMore() {\n\terr := lineItems.Fetch()\n\tif e, ok := err.(*recurly.Error); ok {\n\t\tfmt.Printf(\"Failed to retrieve next page: %v\", e)\n\t\tbreak\n\t}\n\tfor i, lineItem := range lineItems.Data() {\n\t\tfmt.Printf(\"Line Item %3d: %s\\n\",\n\t\t\ti,\n\t\t\tlineItem.Id,\n\t\t)\n\t}\n}" "/line_items/{line_item_id}": get: tags: - line_item operationId: get_line_item summary: Fetch a line item parameters: - "$ref": "#/components/parameters/line_item_id" responses: '200': description: A line item. content: application/json: schema: "$ref": "#/components/schemas/LineItem" '404': description: Incorrect site or line item ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const lineItem = await client.getLineItem(lineItemId) console.log('Fetched line item: ', lineItem.uuid) } catch (err) { if (err instanceof recurly.errors.NotFoundError) { // If the request was not found, you may want to alert the user or // just return null console.log('Resource Not Found') } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: line_item = client.get_line_item(line_item_id) print("Got LineItem %s" % line_item) except recurly.errors.NotFoundError: # If the resource was not found, you may want to alert the user or # just return nil print("Resource Not Found") - lang: ".NET" source: | try { LineItem lineItem = client.GetLineItem(lineItemId); Console.WriteLine($"Fetched line item {lineItem.Uuid}"); } catch (Recurly.Errors.NotFound ex) { // If the resource was not found // we may want to alert the user or just return null Console.WriteLine($"Resource Not Found: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin line_item = @client.get_line_item(line_item_id: line_item_id) puts "Got LineItem #{line_item}" rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end - lang: Java source: | try { final LineItem lineItem = client.getLineItem(lineItemId); System.out.println("Fetched line item " + lineItem.getUuid()); } catch (NotFoundException e) { // If the resource was not found // we may want to alert the user or just return null System.out.println("Resource Not Found: " + e.getError().getMessage()); } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $line_item = $client->getLineItem($line_item_id); echo 'Got LineItem:' . PHP_EOL; var_dump($line_item); } catch (\Recurly\Errors\NotFound $e) { // Could not find the resource, you may want to inform the user // or just return a NULL echo 'Could not find resource.' . PHP_EOL; var_dump($e); } catch (\Recurly\RecurlyError $e) { // Something bad happened... tell the user so that they can fix it? echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL; } - lang: Go source: "lineItem, err := client.GetLineItem(lineItemID)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeNotFound {\n\t\tfmt.Printf(\"Resource not found: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\nfmt.Printf(\"Fetched Line Item: %v\", lineItem)" delete: tags: - line_item operationId: remove_line_item summary: Delete an uninvoiced line item parameters: - "$ref": "#/components/parameters/line_item_id" responses: '204': description: Line item deleted. '404': description: Incorrect site or line item ID. content: application/json: schema: "$ref": "#/components/schemas/Error" '422': description: Only pending line items can be deleted. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { await client.removeLineItem(lineItemId) console.log('Removed line item: ', lineItemId) } catch (err) { if (err instanceof recurly.errors.NotFoundError) { // If the request was not found, you may want to alert the user or // just return null console.log('Resource Not Found') } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: client.remove_line_item(line_item_id) print("Removed LineItem %s" % line_item_id) except recurly.errors.NotFoundError: # If the resource was not found, you may want to alert the user or # just return nil print("Resource Not Found") - lang: ".NET" source: | try { client.RemoveLineItem(lineItemId); Console.WriteLine($"Removed line item {lineItemId}"); } catch (Recurly.Errors.Validation ex) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in ex.Error.Params Console.WriteLine($"Failed validation: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin @client.remove_line_item( line_item_id: line_item_id ) puts "Removed LineItem #{line_item_id}" rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end - lang: Java source: | try { client.removeLineItem(lineItemId); System.out.println("Removed line item " + lineItemId); } catch (ValidationException e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in e.getError().getParams() System.out.println("Failed validation: " + e.getError().getMessage()); } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $client->removeLineItem($line_item_id); echo 'Removed LineItem: ' . $line_item_id . PHP_EOL; } catch (\Recurly\Errors\Validation $e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params var_dump($e); } catch (\Recurly\RecurlyError $e) { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it var_dump($e); } - lang: Go source: "lineItem, err := client.RemoveLineItem(lineItemID)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeNotFound {\n\t\tfmt.Printf(\"Resource not found: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\nfmt.Printf(\"Removed Line Item: %v\", lineItem)" "/plans": get: tags: - plan operationId: list_plans summary: List a site's plans description: See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: - "$ref": "#/components/parameters/ids" - "$ref": "#/components/parameters/limit" - "$ref": "#/components/parameters/order" - "$ref": "#/components/parameters/sort_dates" - "$ref": "#/components/parameters/filter_begin_time" - "$ref": "#/components/parameters/filter_end_time" - "$ref": "#/components/parameters/filter_state" responses: @@ -23053,1126 +23054,1138 @@ components: if add_on_type is usage and usage_type is percentage. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" SubscriptionAddOnTier: type: object properties: ending_quantity: type: integer title: Ending quantity minimum: 1 maximum: 999999999 description: Ending quantity for the tier. This represents a unit amount for unit-priced add ons. Must be left empty if it is the final tier. unit_amount: type: number format: float title: Unit amount minimum: 0 maximum: 1000000 description: Allows up to 2 decimal places. Optionally, override the tiers' default unit amount. If add-on's `add_on_type` is `usage` and `usage_type` is `percentage`, cannot be provided. unit_amount_decimal: type: string title: Unit amount decimal description: | Allows up to 9 decimal places. Optionally, override tiers' default unit amount. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided. If add-on's `add_on_type` is `usage` and `usage_type` is `percentage`, cannot be provided. usage_percentage: type: string title: Usage Percentage description: "(deprecated) -- Use the percentage_tiers object instead." deprecated: true SubscriptionAddOnPercentageTier: type: object properties: ending_amount: type: number format: float title: Ending amount minimum: 1 maximum: 9999999999999.99 description: Ending amount for the tier. Allows up to 2 decimal places. Must be left empty if it is the final tier. usage_percentage: type: string title: Usage Percentage minimum: 0 maximum: 100 description: | The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places represented as a string. SubscriptionCancel: type: object properties: timeframe: title: Timeframe description: The timeframe parameter controls when the expiration takes place. The `bill_date` timeframe causes the subscription to expire when the subscription is scheduled to bill next. The `term_end` timeframe causes the subscription to continue to bill until the end of the subscription term, then expire. default: term_end "$ref": "#/components/schemas/TimeframeEnum" SubscriptionChange: type: object title: Subscription Change properties: id: type: string title: Subscription Change ID description: The ID of the Subscription Change. object: type: string title: Object type subscription_id: type: string title: Subscription ID description: The ID of the subscription that is going to be changed. maxLength: 13 plan: "$ref": "#/components/schemas/PlanMini" add_ons: type: array title: Add-ons description: These add-ons will be used when the subscription renews. items: "$ref": "#/components/schemas/SubscriptionAddOn" unit_amount: type: number format: float title: Unit amount tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true quantity: type: integer title: Subscription quantity shipping: "$ref": "#/components/schemas/SubscriptionShipping" activate_at: type: string format: date-time title: Activated at readOnly: true activated: type: boolean title: Activated? description: Returns `true` if the subscription change is activated. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" invoice_collection: title: Invoice Collection "$ref": "#/components/schemas/InvoiceCollection" custom_fields: "$ref": "#/components/schemas/CustomFields" created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at readOnly: true billing_info: "$ref": "#/components/schemas/SubscriptionChangeBillingInfo" ramp_intervals: type: array title: Ramp Intervals description: The ramp intervals representing the pricing schedule for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampIntervalResponse" SubscriptionChangeBillingInfo: type: object description: Accept nested attributes for three_d_secure_action_result_token_id properties: three_d_secure_action_result_token_id: type: string title: 3-D Secure action result token ID description: A token generated by Recurly.js after completing a 3-D Secure device fingerprinting or authentication challenge. maxLength: 22 SubscriptionChangeBillingInfoCreate: allOf: - "$ref": "#/components/schemas/SubscriptionChangeBillingInfo" SubscriptionChangeCreate: type: object properties: timeframe: title: Timeframe description: The timeframe parameter controls when the upgrade or downgrade takes place. The subscription change can occur now, when the subscription is next billed, or when the subscription term ends. Generally, if you're performing an upgrade, you will want the change to occur immediately (now). If you're performing a downgrade, you should set the timeframe to `term_end` or `bill_date` so the change takes effect at a scheduled billing date. The `renewal` timeframe option is accepted as an alias for `term_end`. default: now "$ref": "#/components/schemas/ChangeTimeframeEnum" plan_id: type: string title: Plan ID maxLength: 13 description: If you want to change to a new plan, you can provide the plan's code or id. If both are provided the `plan_id` will be used. plan_code: type: string title: New plan code maxLength: 50 description: If you want to change to a new plan, you can provide the plan's code or id. If both are provided the `plan_id` will be used. unit_amount: type: number format: float title: Custom subscription price description: Optionally, sets custom pricing for the subscription, overriding the plan's default unit amount. The subscription's current currency will be used. minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true quantity: type: integer title: Quantity description: Optionally override the default quantity of 1. default: 1 minimum: 0 shipping: "$ref": "#/components/schemas/SubscriptionChangeShippingCreate" coupon_codes: type: array title: Coupon codes description: A list of coupon_codes to be redeemed on the subscription during the change. Only allowed if timeframe is now and you change something about the subscription that creates an invoice. items: type: string add_ons: type: array title: Add-ons description: | If you provide a value for this field it will replace any existing add-ons. So, when adding or modifying an add-on, you need to include the existing subscription add-ons. Unchanged add-ons can be included just using the subscription add-on''s ID: `{"id": "abc123"}`. If this value is omitted your existing add-ons will be unaffected. To remove all existing add-ons, this value should be an empty array.' If a subscription add-on's `code` is supplied without the `id`, `{"code": "def456"}`, the subscription add-on attributes will be set to the current values of the plan add-on unless provided in the request. - If an `id` is passed, any attributes not passed in will pull from the existing subscription add-on - If a `code` is passed, any attributes not passed in will pull from the current values of the plan add-on - Attributes passed in as part of the request will override either of the above scenarios items: "$ref": "#/components/schemas/SubscriptionAddOnUpdate" collection_method: title: Collection method default: automatic "$ref": "#/components/schemas/CollectionMethodEnum" revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" custom_fields: "$ref": "#/components/schemas/CustomFields" po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Net terms description: |- Integer normally paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. During a subscription change, it's not necessary to provide both the `Net Terms Type` and `Net Terms` parameters. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" billing_info: "$ref": "#/components/schemas/SubscriptionChangeBillingInfoCreate" ramp_intervals: type: array title: Ramp Intervals description: The new set of ramp intervals for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampInterval" proration_settings: "$ref": "#/components/schemas/ProrationSettings" SubscriptionChangeShippingCreate: type: object title: Shipping details that will be changed on a subscription description: Shipping addresses are tied to a customer's account. Each account can have up to 20 different shipping addresses, and if you have enabled multiple subscriptions per account, you can associate different shipping addresses to each subscription. properties: method_id: type: string title: Method ID description: The id of the shipping method used to deliver the subscription. To remove shipping set this to `null` and the `amount=0`. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 13 method_code: type: string title: Method Code description: The code of the shipping method used to deliver the subscription. To remove shipping set this to `null` and the `amount=0`. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 50 amount: type: number format: float title: Assigns the subscription's shipping cost. If this is greater than zero then a `method_id` or `method_code` is required. address_id: type: string title: Shipping address ID description: Assign a shipping address from the account's existing shipping addresses. If this and address are both present, address will take precedence. address: "$ref": "#/components/schemas/ShippingAddressCreate" SubscriptionCreate: type: object properties: plan_code: type: string title: Plan code maxLength: 50 description: You must provide either a `plan_code` or `plan_id`. If both are provided the `plan_id` will be used. plan_id: type: string title: Plan ID maxLength: 13 description: You must provide either a `plan_code` or `plan_id`. If both are provided the `plan_id` will be used. account: "$ref": "#/components/schemas/AccountCreate" billing_info_id: type: string title: Billing Info ID description: The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. shipping: title: Shipping address description: Create a shipping address on the account and assign it to the subscription. "$ref": "#/components/schemas/SubscriptionShippingCreate" collection_method: title: Collection method default: automatic "$ref": "#/components/schemas/CollectionMethodEnum" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 unit_amount: type: number format: float title: Custom subscription pricing description: Override the unit amount of the subscription plan by setting this value. If not provided, the subscription will inherit the price from the subscription plan for the provided currency. minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to use this flag. quantity: type: integer title: Quantity description: Optionally override the default quantity of 1. default: 1 minimum: 0 add_ons: type: array title: Add-ons items: "$ref": "#/components/schemas/SubscriptionAddOnCreate" coupon_codes: type: array title: Coupon codes description: A list of coupon_codes to be redeemed on the subscription or account during the purchase. items: type: string custom_fields: "$ref": "#/components/schemas/CustomFields" trial_ends_at: type: string format: date-time title: Trial ends at description: If set, overrides the default trial behavior for the subscription. When the current date time or a past date time is provided the subscription will begin with no trial phase (overriding any plan default trial). When a future date time is provided the subscription will begin with a trial phase ending at the specified date time. starts_at: type: string format: date-time title: Start date description: If set, the subscription will begin in the future on this date. The subscription will apply the setup fee and trial period, unless the plan has no trial. next_bill_date: type: string format: date-time title: Next bill date description: If present, this sets the date the subscription's next billing period will start (`current_period_ends_at`). This can be used to align the subscription’s billing to a specific day of the month. The initial invoice will be prorated for the period between the subscription's activation date and the billing period end date. Subsequent periods will be based off the plan interval. For a subscription with a trial period, this will change when the trial expires. total_billing_cycles: type: integer title: Total billing cycles description: The number of cycles/billing periods in a term. When `remaining_billing_cycles=0`, if `auto_renew=true` the subscription will renew and a new term will begin, otherwise the subscription will expire. minimum: 1 renewal_billing_cycles: type: integer title: Renewal billing cycles description: If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. auto_renew: type: boolean default: true title: Auto renew description: Whether the subscription renews at the end of its term. ramp_intervals: type: array title: Ramp Intervals description: The new set of ramp intervals for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampInterval" revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" terms_and_conditions: type: string title: Terms and conditions description: This will default to the Terms and Conditions text specified on the Invoice Settings page in your Recurly admin. Specify custom notes to add or override Terms and Conditions. Custom notes will stay with a subscription on all renewals. customer_notes: type: string title: Customer notes description: This will default to the Customer Notes text specified on the Invoice Settings. Specify custom notes to add or override Customer Notes. Custom notes will stay with a subscription on all renewals. credit_customer_notes: type: string title: Credit customer notes description: If there are pending credits on the account that will be invoiced during the subscription creation, these will be used as the Customer Notes on the credit invoice. po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Net terms description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" gateway_code: type: string title: Gateway Code description: If present, this subscription's transactions will use the payment gateway with this code. maxLength: 13 transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" gift_card_redemption_code: type: string title: Gift card Redemption Code description: A gift card redemption code to be redeemed on the purchase invoice. + bulk: + type: boolean + description: Optional field to be used only when needing to bypass the 60 + second limit on creating subscriptions. Should only be used when creating + subscriptions in bulk from the API. + default: false required: - plan_code - currency - account SubscriptionPurchase: type: object properties: plan_code: type: string title: Plan code plan_id: type: string title: Plan ID maxLength: 13 unit_amount: type: number format: float title: Custom subscription pricing description: Override the unit amount of the subscription plan by setting this value. If not provided, the subscription will inherit the price from the subscription plan for the provided currency. minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to use this flag. quantity: type: integer title: Quantity description: Optionally override the default quantity of 1. default: 1 minimum: 0 add_ons: type: array title: Add-ons items: "$ref": "#/components/schemas/SubscriptionAddOnCreate" custom_fields: "$ref": "#/components/schemas/CustomFields" shipping: title: Shipping address description: Create a shipping address on the account and assign it to the subscription. "$ref": "#/components/schemas/SubscriptionShippingPurchase" trial_ends_at: type: string format: date-time title: Trial ends at description: If set, overrides the default trial behavior for the subscription. When the current date time or a past date time is provided the subscription will begin with no trial phase (overriding any plan default trial). When a future date time is provided the subscription will begin with a trial phase ending at the specified date time. starts_at: type: string format: date-time title: Start date description: If set, the subscription will begin in the future on this date. The subscription will apply the setup fee and trial period, unless the plan has no trial. next_bill_date: type: string format: date-time title: Next bill date description: If present, this sets the date the subscription's next billing period will start (`current_period_ends_at`). This can be used to align the subscription’s billing to a specific day of the month. The initial invoice will be prorated for the period between the subscription's activation date and the billing period end date. Subsequent periods will be based off the plan interval. For a subscription with a trial period, this will change when the trial expires. total_billing_cycles: type: integer title: Total billing cycles description: The number of cycles/billing periods in a term. When `remaining_billing_cycles=0`, if `auto_renew=true` the subscription will renew and a new term will begin, otherwise the subscription will expire. minimum: 1 renewal_billing_cycles: type: integer title: Renewal billing cycles description: If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. auto_renew: type: boolean default: true title: Auto renew description: Whether the subscription renews at the end of its term. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" ramp_intervals: type: array title: Ramp Intervals description: The new set of ramp intervals for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampInterval" + bulk: + type: boolean + description: Optional field to be used only when needing to bypass the 60 + second limit on creating subscriptions. Should only be used when creating + subscriptions in bulk from the API. + default: false required: - plan_code SubscriptionUpdate: type: object properties: collection_method: title: Change collection method "$ref": "#/components/schemas/CollectionMethodEnum" custom_fields: "$ref": "#/components/schemas/CustomFields" remaining_billing_cycles: type: integer title: Remaining billing cycles description: The remaining billing cycles in the current term. renewal_billing_cycles: type: integer title: Renewal billing cycles description: If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. auto_renew: type: boolean default: true title: Auto renew description: Whether the subscription renews at the end of its term. next_bill_date: type: string format: date-time title: Next bill date description: If present, this sets the date the subscription's next billing period will start (`current_period_ends_at`). This can be used to align the subscription’s billing to a specific day of the month. For a subscription in a trial period, this will change when the trial expires. This parameter is useful for postponement of a subscription to change its billing date without proration. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" terms_and_conditions: type: string title: Terms and conditions description: Specify custom notes to add or override Terms and Conditions. Custom notes will stay with a subscription on all renewals. customer_notes: type: string title: Customer notes description: Specify custom notes to add or override Customer Notes. Custom notes will stay with a subscription on all renewals. po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Terms that the subscription is due on description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" gateway_code: type: string title: Gateway Code description: If present, this subscription's transactions will use the payment gateway with this code. maxLength: 13 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true shipping: "$ref": "#/components/schemas/SubscriptionShippingUpdate" billing_info_id: type: string title: Billing Info ID description: The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. SubscriptionPause: type: object properties: remaining_pause_cycles: type: integer title: Remaining pause cycles description: Number of billing cycles to pause the subscriptions. A value of 0 will cancel any pending pauses on the subscription. required: - remaining_pause_cycles SubscriptionShipping: type: object title: Subscription shipping details properties: object: type: string title: Object type address: "$ref": "#/components/schemas/ShippingAddress" method: "$ref": "#/components/schemas/ShippingMethodMini" amount: type: number format: float title: Subscription's shipping cost SubscriptionShippingCreate: type: object title: Subscription shipping details properties: address: "$ref": "#/components/schemas/ShippingAddressCreate" address_id: type: string title: Shipping address ID description: Assign a shipping address from the account's existing shipping addresses. If `address_id` and `address` are both present, `address` will be used. maxLength: 13 method_id: type: string title: Service ID description: The id of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 13 method_code: type: string title: Service Code description: The code of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 50 amount: type: number format: float title: Assigns the subscription's shipping cost. If this is greater than zero then a `method_id` or `method_code` is required. SubscriptionShippingUpdate: type: object title: Subscription shipping details properties: object: type: string title: Object type address: "$ref": "#/components/schemas/ShippingAddressCreate" address_id: type: string title: Shipping Address ID description: Assign a shipping address from the account's existing shipping addresses. maxLength: 13 SubscriptionShippingPurchase: type: object title: Subscription shipping details properties: method_id: type: string title: Service ID description: The id of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 13 method_code: type: string title: Service Code description: The code of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 50 amount: type: number format: float title: Assigns the subscription's shipping cost. If this is greater than zero then a `method_id` or `method_code` is required. SubscriptionRampInterval: type: object title: Subscription Ramp Interval properties: starting_billing_cycle: type: integer description: Represents the billing cycle where a ramp interval starts. default: 1 unit_amount: type: integer description: Represents the price for the ramp interval. SubscriptionRampIntervalResponse: type: object title: Subscription Ramp Interval properties: starting_billing_cycle: type: integer description: Represents the billing cycle where a ramp interval starts. remaining_billing_cycles: type: integer description: Represents how many billing cycles are left in a ramp interval. starting_on: type: string format: date-time title: Date the ramp interval starts ending_on: type: string format: date-time title: Date the ramp interval ends unit_amount: type: number format: float title: Unit price description: Represents the price for the ramp interval. TaxInfo: type: object title: Tax info description: Only for merchants using Recurly's In-The-Box taxes. properties: type: type: string title: Type description: Provides the tax type as "vat" for EU VAT, "usst" for U.S. Sales Tax, or the 2 letter country code for country level tax types like Canada, Australia, New Zealand, Israel, and all non-EU European countries. Not present when Avalara for Communications is enabled. region: type: string title: Region description: Provides the tax region applied on an invoice. For U.S. Sales Tax, this will be the 2 letter state code. For EU VAT this will be the 2 letter country code. For all country level tax types, this will display the regional tax, like VAT, GST, or PST. Not present when Avalara for Communications is enabled. rate: type: number format: float title: Rate description: The combined tax rate. Not present when Avalara for Communications is enabled. tax_details: type: array description: Provides additional tax details for Communications taxes when Avalara for Communications is enabled or Canadian Sales Tax when there is tax applied at both the country and province levels. This will only be populated for the Invoice response when fetching a single invoice and not for the InvoiceList or LineItemList. Only populated for a single LineItem fetch when Avalara for Communications is enabled. items: "$ref": "#/components/schemas/TaxDetail" TaxDetail: type: object title: Tax detail properties: type: type: string title: Type description: Provides the tax type for the region or type of Comminications tax when Avalara for Communications is enabled. For Canadian Sales Tax, this will be GST, HST, QST or PST. region: type: string title: Region description: Provides the tax region applied on an invoice. For Canadian Sales Tax, this will be either the 2 letter province code or country code. Not present when Avalara for Communications is enabled. rate: type: number format: float title: Rate description: Provides the tax rate for the region. tax: type: number format: float title: Tax description: The total tax applied for this tax type. name: type: string title: Name description: Provides the name of the Communications tax applied. Present only when Avalara for Communications is enabled. level: type: string title: Level description: Provides the jurisdiction level for the Communications tax applied. Example values include city, state and federal. Present only when Avalara for Communications is enabled. billable: type: boolean title: Billable description: Whether or not the line item is taxable. Only populated for a single LineItem fetch when Avalara for Communications is enabled. Transaction: type: object properties: id: type: string title: Transaction ID maxLength: 13 object: type: string title: Object type uuid: type: string title: Recurly UUID description: The UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI. maxLength: 32 original_transaction_id: type: string title: Original Transaction ID description: If this transaction is a refund (`type=refund`), this will be the ID of the original transaction on the invoice being refunded. maxLength: 13 account: "$ref": "#/components/schemas/AccountMini" invoice: "$ref": "#/components/schemas/InvoiceMini" voided_by_invoice: "$ref": "#/components/schemas/InvoiceMini" subscription_ids: type: array title: Subscription IDs description: If the transaction is charging or refunding for one or more subscriptions, these are their IDs. items: type: string title: Subscription ID maxLength: 13 type: title: Transaction type description: | - `authorization` – verifies billing information and places a hold on money in the customer's account. - `capture` – captures funds held by an authorization and completes a purchase. - `purchase` – combines the authorization and capture in one transaction. - `refund` – returns all or a portion of the money collected in a previous transaction to the customer. - `verify` – a $0 or $1 transaction used to verify billing information which is immediately voided. "$ref": "#/components/schemas/TransactionTypeEnum" origin: title: Origin of transaction description: Describes how the transaction was triggered. "$ref": "#/components/schemas/TransactionOriginEnum" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 amount: type: number format: float title: Amount description: Total transaction amount sent to the payment gateway. status: title: Transaction status description: The current transaction status. Note that the status may change, e.g. a `pending` transaction may become `declined` or `success` may later become `void`. "$ref": "#/components/schemas/TransactionStatusEnum" success: type: boolean title: Success? description: Did this transaction complete successfully? backup_payment_method_used: type: boolean title: Backup Payment Method Used? description: Indicates if the transaction was completed using a backup payment refunded: type: boolean title: Refunded? description: Indicates if part or all of this transaction was refunded. billing_address: "$ref": "#/components/schemas/AddressWithName" collection_method: description: The method by which the payment was collected. "$ref": "#/components/schemas/CollectionMethodEnum" payment_method: "$ref": "#/components/schemas/PaymentMethod" ip_address_v4: type: string title: IP address description: | IP address provided when the billing information was collected: - When the customer enters billing information into the Recurly.js or Hosted Payment Pages, Recurly records the IP address. - When the merchant enters billing information using the API, the merchant may provide an IP address. - When the merchant enters billing information using the UI, no IP address is recorded. ip_address_country: type: string title: Origin IP address country, 2-letter ISO 3166-1 alpha-2 code, if known by Recurly. status_code: type: string title: Status code status_message: type: string title: Status message description: For declined (`success=false`) transactions, the message displayed to the merchant. customer_message: type: string title: Customer message description: For declined (`success=false`) transactions, the message displayed to the customer. customer_message_locale: type: string title: Language code for the message payment_gateway: type: object x-class-name: TransactionPaymentGateway properties: id: type: string object: type: string title: Object type type: type: string name: type: string gateway_message: type: string title: Gateway message description: Transaction message from the payment gateway. gateway_reference: type: string title: Gateway reference description: Transaction reference number from the payment gateway. gateway_approval_code: type: string title: Transaction approval code from the payment gateway. gateway_response_code: type: string title: For declined transactions (`success=false`), this field lists the gateway error code. gateway_response_time: type: number format: float title: Gateway response time description: Time, in seconds, for gateway to process the transaction. gateway_response_values: type: object title: Gateway response values description: The values in this field will vary from gateway to gateway. cvv_check: title: CVV check description: When processed, result from checking the CVV/CVC value on the transaction. "$ref": "#/components/schemas/CvvCheckEnum" avs_check: title: AVS check description: When processed, result from checking the overall AVS on the transaction. "$ref": "#/components/schemas/AvsCheckEnum" created_at: type: string format: date-time title: Created at updated_at: type: string format: date-time title: Updated at voided_at: type: string format: date-time title: Voided at collected_at: type: string format: date-time title: Collected at, or if not collected yet, the time the transaction was created. action_result: type: object description: Action result params to be used in Recurly-JS to complete a payment when using asynchronous payment methods, e.g., Boleto, iDEAL and Sofort. title: Action result vat_number: type: string description: VAT number for the customer on this transaction. If the customer's Billing Info country is BR or AR, then this will be their Tax Identifier. For all other countries this will come from the VAT Number field in the Billing Info. title: VAT Number fraud_info: "$ref": "#/components/schemas/TransactionFraudInfo" TransactionFraudInfo: type: object title: Fraud information readOnly: true properties: object: type: string title: Object type readOnly: true score: type: integer title: Kount score
recurly/recurly-client-php
3091c70763c8918e5da66793f276dd6ef66254cc
4.54.0
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 3a4fcc2..5644d0c 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 4.53.0 +current_version = 4.54.0 parse = (?P<major>\d+) \.(?P<minor>\d+) \.(?P<patch>\d+) serialize = {major}.{minor}.{patch} [bumpversion:file:composer.json] [bumpversion:file:lib/recurly/version.php] diff --git a/CHANGELOG.md b/CHANGELOG.md index 10114a0..45ecfcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,514 +1,525 @@ # Changelog +## [4.54.0](https://github.com/recurly/recurly-client-php/tree/4.54.0) (2024-08-28) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.53.0...4.54.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 (add UUID to external subscriptions) [#823](https://github.com/recurly/recurly-client-php/pull/823) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.53.0](https://github.com/recurly/recurly-client-php/tree/4.53.0) (2024-08-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.52.0...4.53.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#821](https://github.com/recurly/recurly-client-php/pull/821) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.52.0](https://github.com/recurly/recurly-client-php/tree/4.52.0) (2024-07-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.51.0...4.52.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Taxable Address Control, RevRec) [#817](https://github.com/recurly/recurly-client-php/pull/817) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.51.0](https://github.com/recurly/recurly-client-php/tree/4.51.0) (2024-05-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.50.0...4.51.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#814](https://github.com/recurly/recurly-client-php/pull/814) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.50.0](https://github.com/recurly/recurly-client-php/tree/4.50.0) (2024-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.49.0...4.50.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entity Use Code) [#812](https://github.com/recurly/recurly-client-php/pull/812) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.49.0](https://github.com/recurly/recurly-client-php/tree/4.49.0) (2024-05-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.48.0...4.49.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Proration Settings) [#810](https://github.com/recurly/recurly-client-php/pull/810) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.48.0](https://github.com/recurly/recurly-client-php/tree/4.48.0) (2024-05-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.47.0...4.48.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Auth & Capture) [#808](https://github.com/recurly/recurly-client-php/pull/808) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.47.0](https://github.com/recurly/recurly-client-php/tree/4.47.0) (2024-03-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.46.0...4.47.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#803](https://github.com/recurly/recurly-client-php/pull/803) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.46.0](https://github.com/recurly/recurly-client-php/tree/4.46.0) (2024-02-20) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.45.0...4.46.0) **Merged Pull Requests** - Add invoice state param for v2021-02-25 [#799](https://github.com/recurly/recurly-client-php/pull/799) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.45.0](https://github.com/recurly/recurly-client-php/tree/4.45.0) (2024-01-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.44.0...4.45.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#789](https://github.com/recurly/recurly-client-php/pull/789) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.44.0](https://github.com/recurly/recurly-client-php/tree/4.44.0) (2024-01-18) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.43.0...4.44.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#788](https://github.com/recurly/recurly-client-php/pull/788) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.43.0](https://github.com/recurly/recurly-client-php/tree/4.43.0) (2023-12-06) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.42.0...4.43.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Payment Phases) [#785](https://github.com/recurly/recurly-client-php/pull/785) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.42.0](https://github.com/recurly/recurly-client-php/tree/4.42.0) (2023-11-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.41.0...4.42.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#783](https://github.com/recurly/recurly-client-php/pull/783) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.41.0](https://github.com/recurly/recurly-client-php/tree/4.41.0) (2023-08-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.40.0...4.41.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (`VATNumber`, `LifecycleDecline`) [#782](https://github.com/recurly/recurly-client-php/pull/782) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.40.0](https://github.com/recurly/recurly-client-php/tree/4.40.0) (2023-08-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.39.0...4.40.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (action_result) [#781](https://github.com/recurly/recurly-client-php/pull/781) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.39.0](https://github.com/recurly/recurly-client-php/tree/4.39.0) (2023-07-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.37.0...4.39.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Ramp Dates, Net Terms, Invoice Business Entity) [#779](https://github.com/recurly/recurly-client-php/pull/779) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (App Management - External Subscriptions) [#777](https://github.com/recurly/recurly-client-php/pull/777) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.37.0](https://github.com/recurly/recurly-client-php/tree/4.37.0) (2023-06-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.36.0...4.37.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Multiple Business Entities) [#769](https://github.com/recurly/recurly-client-php/pull/769) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.36.0](https://github.com/recurly/recurly-client-php/tree/4.36.0) (2023-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.35.0...4.36.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Products & References) [#766](https://github.com/recurly/recurly-client-php/pull/766) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.35.0](https://github.com/recurly/recurly-client-php/tree/4.35.0) (2023-05-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.34.0...4.35.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (gateway_attributes on PaymentMethod) [#764](https://github.com/recurly/recurly-client-php/pull/764) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#747](https://github.com/recurly/recurly-client-php/pull/747) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.28.0](https://github.com/recurly/recurly-client-php/tree/4.28.0) (2023-02-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.27.0...4.28.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (GiftCard endpoints and new transaction error support) [#745](https://github.com/recurly/recurly-client-php/pull/745) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.27.0](https://github.com/recurly/recurly-client-php/tree/4.27.0) (2023-01-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.26.0...4.27.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Custom Fields on Line Items) [#738](https://github.com/recurly/recurly-client-php/pull/738) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.26.0](https://github.com/recurly/recurly-client-php/tree/4.26.0) (2023-01-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.25.0...4.26.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Account Preferred Time Zone) [#736](https://github.com/recurly/recurly-client-php/pull/736) ([douglasmiller](https://github.com/douglasmiller)) ## [4.25.0](https://github.com/recurly/recurly-client-php/tree/4.25.0) (2022-11-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.24.0...4.25.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Apply Credit Balance feature) [#732](https://github.com/recurly/recurly-client-php/pull/732) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.24.0](https://github.com/recurly/recurly-client-php/tree/4.24.0) (2022-11-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.23.0...4.24.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Subscriptions feature) [#729](https://github.com/recurly/recurly-client-php/pull/729) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#728](https://github.com/recurly/recurly-client-php/pull/728) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.23.0](https://github.com/recurly/recurly-client-php/tree/4.23.0) (2022-10-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.22.0...4.23.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entitlements feature) [#725](https://github.com/recurly/recurly-client-php/pull/725) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.22.0](https://github.com/recurly/recurly-client-php/tree/4.22.0) (2022-10-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.2...4.22.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25(Decimal Usage and Quantities and DunningEvent new fields) [#722](https://github.com/recurly/recurly-client-php/pull/722) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.2](https://github.com/recurly/recurly-client-php/tree/4.21.2) (2022-09-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.1...4.21.2) **Merged Pull Requests** - feat: allow for psr/log ^2/3 [#716](https://github.com/recurly/recurly-client-php/pull/716) ([trickeyone](https://github.com/trickeyone)) ## [4.21.1](https://github.com/recurly/recurly-client-php/tree/4.21.1) (2022-09-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.0...4.21.1) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#714](https://github.com/recurly/recurly-client-php/pull/714) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.0](https://github.com/recurly/recurly-client-php/tree/4.21.0) (2022-09-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.20.0...4.21.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#713](https://github.com/recurly/recurly-client-php/pull/713) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixes bug with putDunningCampaignBulkUpdate [#706](https://github.com/recurly/recurly-client-php/pull/706) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.20.0](https://github.com/recurly/recurly-client-php/tree/4.20.0) (2022-08-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.19.0...4.20.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#701](https://github.com/recurly/recurly-client-php/pull/701) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.19.0](https://github.com/recurly/recurly-client-php/tree/4.19.0) (2022-07-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.18.0...4.19.0) **Merged Pull Requests** - Fixing deprecation warnings in client [#697](https://github.com/recurly/recurly-client-php/pull/697) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#695](https://github.com/recurly/recurly-client-php/pull/695) ([recurly-integrations](https://github.com/recurly-integrations)) **Closed Issues** - Recurly\Pager and \Iterator return type mismatch (PHP 8.1 deprecation) [#677](https://github.com/recurly/recurly-client-php/issues/677) ## [4.18.0](https://github.com/recurly/recurly-client-php/tree/4.18.0) (2022-06-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.17.0...4.18.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#693](https://github.com/recurly/recurly-client-php/pull/693) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.17.0](https://github.com/recurly/recurly-client-php/tree/4.17.0) (2022-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.16.0...4.17.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#679](https://github.com/recurly/recurly-client-php/pull/679) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.16.0](https://github.com/recurly/recurly-client-php/tree/4.16.0) (2022-03-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.15.0...4.16.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#676](https://github.com/recurly/recurly-client-php/pull/676) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.15.0](https://github.com/recurly/recurly-client-php/tree/4.15.0) (2022-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.14.0...4.15.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#668](https://github.com/recurly/recurly-client-php/pull/668) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.14.0](https://github.com/recurly/recurly-client-php/tree/4.14.0) (2022-03-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.13.0...4.14.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#664](https://github.com/recurly/recurly-client-php/pull/664) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.13.0](https://github.com/recurly/recurly-client-php/tree/4.13.0) (2022-01-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.12.0...4.13.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#655](https://github.com/recurly/recurly-client-php/pull/655) ([recurly-integrations](https://github.com/recurly-integrations)) - Add region argument to client to connect in EU data center [#653](https://github.com/recurly/recurly-client-php/pull/653) ([FabricioCoutinho](https://github.com/FabricioCoutinho)) ## [4.12.0](https://github.com/recurly/recurly-client-php/tree/4.12.0) (2022-01-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.11.0...4.12.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Invoice Customization) [#654](https://github.com/recurly/recurly-client-php/pull/654) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#651](https://github.com/recurly/recurly-client-php/pull/651) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.11.0](https://github.com/recurly/recurly-client-php/tree/4.11.0) (2021-12-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.10.0...4.11.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Tax Inclusive Pricing) [#650](https://github.com/recurly/recurly-client-php/pull/650) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.10.0](https://github.com/recurly/recurly-client-php/tree/4.10.0) (2021-11-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.9.0...4.10.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#647](https://github.com/recurly/recurly-client-php/pull/647) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#645](https://github.com/recurly/recurly-client-php/pull/645) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#644](https://github.com/recurly/recurly-client-php/pull/644) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#639](https://github.com/recurly/recurly-client-php/pull/639) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.9.0](https://github.com/recurly/recurly-client-php/tree/4.9.0) (2021-09-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.8.0...4.9.0) diff --git a/composer.json b/composer.json index 359d8f3..56df9a7 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,38 @@ { "name": "recurly/recurly-client", - "version": "4.53.0", + "version": "4.54.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], "homepage": "https://github.com/recurly/recurly-client-php", "license": "MIT", "authors": [], "require": { "php": ">= 7.2.0", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "phpcompatibility/php-compatibility": "^9.3", "phpdocumentor/phpdocumentor": "~3.0.0", "phpstan/phpstan": "^0.12.11", "phpunit/phpunit": "^8", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "classmap": ["lib"], "files": ["lib/recurly.php"] }, "autoload-dev": { "classmap": ["tests"] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/lib/recurly/version.php b/lib/recurly/version.php index ea9076a..f597d75 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -1,8 +1,8 @@ <?php namespace Recurly; class Version { - public const CURRENT = '4.53.0'; + public const CURRENT = '4.54.0'; }
recurly/recurly-client-php
090c83b7027f87eef47da6a47242cff31637d186
Generated Latest Changes for v2021-02-25
diff --git a/lib/recurly/client.php b/lib/recurly/client.php index b1d4c6d..9769e19 100644 --- a/lib/recurly/client.php +++ b/lib/recurly/client.php @@ -1374,1025 +1374,1025 @@ endpoint to obtain only the newly generated `UniqueCouponCodes`. * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['account_type'] (string): General Ledger Account type by which to filter the response. * * @return \Recurly\Pager A list of the site's general ledger accounts. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_general_ledger_accounts */ public function listGeneralLedgerAccounts(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/general_ledger_accounts", []); return new \Recurly\Pager($this, $path, $options); } /** * Fetch a general ledger account * * @param string $general_ledger_account_id General Ledger Account ID * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\GeneralLedgerAccount A general ledger account. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_general_ledger_account */ public function getGeneralLedgerAccount(string $general_ledger_account_id, array $options = []): \Recurly\Resources\GeneralLedgerAccount { $path = $this->interpolatePath("/general_ledger_accounts/{general_ledger_account_id}", ['general_ledger_account_id' => $general_ledger_account_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Update a general ledger account * * @param string $general_ledger_account_id General Ledger Account ID * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\GeneralLedgerAccount The updated general ledger account. * @link https://developers.recurly.com/api/v2021-02-25#operation/update_general_ledger_account */ public function updateGeneralLedgerAccount(string $general_ledger_account_id, array $body, array $options = []): \Recurly\Resources\GeneralLedgerAccount { $path = $this->interpolatePath("/general_ledger_accounts/{general_ledger_account_id}", ['general_ledger_account_id' => $general_ledger_account_id]); return $this->makeRequest('PUT', $path, $body, $options); } /** * Get a single Performance Obligation. * * @param string $performance_obligation_id Performance Obligation id. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\PerformanceObligation A single Performance Obligation. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_performance_obligation */ public function getPerformanceObligation(string $performance_obligation_id, array $options = []): \Recurly\Resources\PerformanceObligation { $path = $this->interpolatePath("/performance_obligations/{performance_obligation_id}", ['performance_obligation_id' => $performance_obligation_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Get a site's Performance Obligations * * @param array $options Associative array of optional parameters * * @return \Recurly\Pager A list of Performance Obligations. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_performance_obligations */ public function getPerformanceObligations(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/performance_obligations", []); return new \Recurly\Pager($this, $path, $options); } /** * List an invoice template's associated accounts * * @param string $invoice_template_id Invoice template ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-bob`. * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['email'] (string): Filter for accounts with this exact email address. A blank value will return accounts with both `null` and `""` email addresses. Note that multiple accounts can share one email address. * - $options['params']['subscriber'] (bool): Filter for accounts with or without a subscription in the `active`, * `canceled`, or `future` state. * - $options['params']['past_due'] (string): Filter for accounts with an invoice in the `past_due` state. * * @return \Recurly\Pager A list of an invoice template's associated accounts. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_invoice_template_accounts */ public function listInvoiceTemplateAccounts(string $invoice_template_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/invoice_templates/{invoice_template_id}/accounts", ['invoice_template_id' => $invoice_template_id]); return new \Recurly\Pager($this, $path, $options); } /** * List a site's items * * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['state'] (string): Filter by state. * * @return \Recurly\Pager A list of the site's items. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_items */ public function listItems(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/items", []); return new \Recurly\Pager($this, $path, $options); } /** * Create a new item * * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Item A new item. * @link https://developers.recurly.com/api/v2021-02-25#operation/create_item */ public function createItem(array $body, array $options = []): \Recurly\Resources\Item { $path = $this->interpolatePath("/items", []); return $this->makeRequest('POST', $path, $body, $options); } /** * Fetch an item * * @param string $item_id Item ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-red`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Item An item. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_item */ public function getItem(string $item_id, array $options = []): \Recurly\Resources\Item { $path = $this->interpolatePath("/items/{item_id}", ['item_id' => $item_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Update an active item * * @param string $item_id Item ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-red`. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Item The updated item. * @link https://developers.recurly.com/api/v2021-02-25#operation/update_item */ public function updateItem(string $item_id, array $body, array $options = []): \Recurly\Resources\Item { $path = $this->interpolatePath("/items/{item_id}", ['item_id' => $item_id]); return $this->makeRequest('PUT', $path, $body, $options); } /** * Deactivate an item * * @param string $item_id Item ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-red`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Item An item. * @link https://developers.recurly.com/api/v2021-02-25#operation/deactivate_item */ public function deactivateItem(string $item_id, array $options = []): \Recurly\Resources\Item { $path = $this->interpolatePath("/items/{item_id}", ['item_id' => $item_id]); return $this->makeRequest('DELETE', $path, [], $options); } /** * Reactivate an inactive item * * @param string $item_id Item ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-red`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Item An item. * @link https://developers.recurly.com/api/v2021-02-25#operation/reactivate_item */ public function reactivateItem(string $item_id, array $options = []): \Recurly\Resources\Item { $path = $this->interpolatePath("/items/{item_id}/reactivate", ['item_id' => $item_id]); return $this->makeRequest('PUT', $path, [], $options); } /** * List a site's measured units * * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['state'] (string): Filter by state. * * @return \Recurly\Pager A list of the site's measured units. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_measured_unit */ public function listMeasuredUnit(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/measured_units", []); return new \Recurly\Pager($this, $path, $options); } /** * Create a new measured unit * * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\MeasuredUnit A new measured unit. * @link https://developers.recurly.com/api/v2021-02-25#operation/create_measured_unit */ public function createMeasuredUnit(array $body, array $options = []): \Recurly\Resources\MeasuredUnit { $path = $this->interpolatePath("/measured_units", []); return $this->makeRequest('POST', $path, $body, $options); } /** * Fetch a measured unit * * @param string $measured_unit_id Measured unit ID or name. For ID no prefix is used e.g. `e28zov4fw0v2`. For name use prefix `name-`, e.g. `name-Storage`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\MeasuredUnit An item. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_measured_unit */ public function getMeasuredUnit(string $measured_unit_id, array $options = []): \Recurly\Resources\MeasuredUnit { $path = $this->interpolatePath("/measured_units/{measured_unit_id}", ['measured_unit_id' => $measured_unit_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Update a measured unit * * @param string $measured_unit_id Measured unit ID or name. For ID no prefix is used e.g. `e28zov4fw0v2`. For name use prefix `name-`, e.g. `name-Storage`. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\MeasuredUnit The updated measured_unit. * @link https://developers.recurly.com/api/v2021-02-25#operation/update_measured_unit */ public function updateMeasuredUnit(string $measured_unit_id, array $body, array $options = []): \Recurly\Resources\MeasuredUnit { $path = $this->interpolatePath("/measured_units/{measured_unit_id}", ['measured_unit_id' => $measured_unit_id]); return $this->makeRequest('PUT', $path, $body, $options); } /** * Remove a measured unit * * @param string $measured_unit_id Measured unit ID or name. For ID no prefix is used e.g. `e28zov4fw0v2`. For name use prefix `name-`, e.g. `name-Storage`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\MeasuredUnit A measured unit. * @link https://developers.recurly.com/api/v2021-02-25#operation/remove_measured_unit */ public function removeMeasuredUnit(string $measured_unit_id, array $options = []): \Recurly\Resources\MeasuredUnit { $path = $this->interpolatePath("/measured_units/{measured_unit_id}", ['measured_unit_id' => $measured_unit_id]); return $this->makeRequest('DELETE', $path, [], $options); } /** * List a site's external products * * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * * @return \Recurly\Pager A list of the the external_products on a site. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_external_products */ public function listExternalProducts(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/external_products", []); return new \Recurly\Pager($this, $path, $options); } /** * Create an external product * * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExternalProduct Returns the external product * @link https://developers.recurly.com/api/v2021-02-25#operation/create_external_product */ public function createExternalProduct(array $body, array $options = []): \Recurly\Resources\ExternalProduct { $path = $this->interpolatePath("/external_products", []); return $this->makeRequest('POST', $path, $body, $options); } /** * Fetch an external product * * @param string $external_product_id External product id * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExternalProduct Settings for an external product. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_external_product */ public function getExternalProduct(string $external_product_id, array $options = []): \Recurly\Resources\ExternalProduct { $path = $this->interpolatePath("/external_products/{external_product_id}", ['external_product_id' => $external_product_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Update an external product * * @param string $external_product_id External product id * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExternalProduct Settings for an external product. * @link https://developers.recurly.com/api/v2021-02-25#operation/update_external_product */ public function updateExternalProduct(string $external_product_id, array $body, array $options = []): \Recurly\Resources\ExternalProduct { $path = $this->interpolatePath("/external_products/{external_product_id}", ['external_product_id' => $external_product_id]); return $this->makeRequest('PUT', $path, $body, $options); } /** * Deactivate an external product * * @param string $external_product_id External product id * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExternalProduct Deactivated external product. * @link https://developers.recurly.com/api/v2021-02-25#operation/deactivate_external_products */ public function deactivateExternalProducts(string $external_product_id, array $options = []): \Recurly\Resources\ExternalProduct { $path = $this->interpolatePath("/external_products/{external_product_id}", ['external_product_id' => $external_product_id]); return $this->makeRequest('DELETE', $path, [], $options); } /** * List the external product references for an external product * * @param string $external_product_id External product id * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * * @return \Recurly\Pager A list of the the external product references for an external product. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_external_product_external_product_references */ public function listExternalProductExternalProductReferences(string $external_product_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/external_products/{external_product_id}/external_product_references", ['external_product_id' => $external_product_id]); return new \Recurly\Pager($this, $path, $options); } /** * Create an external product reference on an external product * * @param string $external_product_id External product id * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExternalProductReferenceMini Details for the external product reference. * @link https://developers.recurly.com/api/v2021-02-25#operation/create_external_product_external_product_reference */ public function createExternalProductExternalProductReference(string $external_product_id, array $body, array $options = []): \Recurly\Resources\ExternalProductReferenceMini { $path = $this->interpolatePath("/external_products/{external_product_id}/external_product_references", ['external_product_id' => $external_product_id]); return $this->makeRequest('POST', $path, $body, $options); } /** * Fetch an external product reference * * @param string $external_product_id External product id * @param string $external_product_reference_id External product reference ID, e.g. `d39iun2fw1v4`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExternalProductReferenceMini Details for an external product reference. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_external_product_external_product_reference */ public function getExternalProductExternalProductReference(string $external_product_id, string $external_product_reference_id, array $options = []): \Recurly\Resources\ExternalProductReferenceMini { $path = $this->interpolatePath("/external_products/{external_product_id}/external_product_references/{external_product_reference_id}", ['external_product_id' => $external_product_id, 'external_product_reference_id' => $external_product_reference_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Deactivate an external product reference * * @param string $external_product_id External product id * @param string $external_product_reference_id External product reference ID, e.g. `d39iun2fw1v4`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExternalProductReferenceMini Details for an external product reference. * @link https://developers.recurly.com/api/v2021-02-25#operation/deactivate_external_product_external_product_reference */ public function deactivateExternalProductExternalProductReference(string $external_product_id, string $external_product_reference_id, array $options = []): \Recurly\Resources\ExternalProductReferenceMini { $path = $this->interpolatePath("/external_products/{external_product_id}/external_product_references/{external_product_reference_id}", ['external_product_id' => $external_product_id, 'external_product_reference_id' => $external_product_reference_id]); return $this->makeRequest('DELETE', $path, [], $options); } /** * List a site's external subscriptions * * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * * @return \Recurly\Pager A list of the the external_subscriptions on a site. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_external_subscriptions */ public function listExternalSubscriptions(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/external_subscriptions", []); return new \Recurly\Pager($this, $path, $options); } /** * Fetch an external subscription * - * @param string $external_subscription_id External subscription ID or external_id. For ID no prefix is used e.g. `e28zov4fw0v2`. For external_id use prefix `external-id-`, e.g. `external-id-123456`. + * @param string $external_subscription_id External subscription ID, external_id or uuid. For ID no prefix is used e.g. `e28zov4fw0v2`. For external_id use prefix `external-id-`, e.g. `external-id-123456` and for uuid use prefix `uuid-` e.g. `uuid-7293239bae62777d8c1ae044a9843633`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExternalSubscription Settings for an external subscription. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_external_subscription */ public function getExternalSubscription(string $external_subscription_id, array $options = []): \Recurly\Resources\ExternalSubscription { $path = $this->interpolatePath("/external_subscriptions/{external_subscription_id}", ['external_subscription_id' => $external_subscription_id]); return $this->makeRequest('GET', $path, [], $options); } /** * List the external invoices on an external subscription * * @param string $external_subscription_id External subscription id * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * * @return \Recurly\Pager A list of the the external_invoices on a site. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_external_subscription_external_invoices */ public function listExternalSubscriptionExternalInvoices(string $external_subscription_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/external_subscriptions/{external_subscription_id}/external_invoices", ['external_subscription_id' => $external_subscription_id]); return new \Recurly\Pager($this, $path, $options); } /** * List a site's invoices * * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['state'] (string): Invoice state. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['type'] (string): Filter by type when: * - `type=charge`, only charge invoices will be returned. * - `type=credit`, only credit invoices will be returned. * - `type=non-legacy`, only charge and credit invoices will be returned. * - `type=legacy`, only legacy invoices will be returned. * * @return \Recurly\Pager A list of the site's invoices. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_invoices */ public function listInvoices(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/invoices", []); return new \Recurly\Pager($this, $path, $options); } /** * Fetch an invoice * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Invoice An invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_invoice */ public function getInvoice(string $invoice_id, array $options = []): \Recurly\Resources\Invoice { $path = $this->interpolatePath("/invoices/{invoice_id}", ['invoice_id' => $invoice_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Update an invoice * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Invoice An invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/update_invoice */ public function updateInvoice(string $invoice_id, array $body, array $options = []): \Recurly\Resources\Invoice { $path = $this->interpolatePath("/invoices/{invoice_id}", ['invoice_id' => $invoice_id]); return $this->makeRequest('PUT', $path, $body, $options); } /** * Fetch an invoice as a PDF * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\BinaryFile An invoice as a PDF. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_invoice_pdf */ public function getInvoicePdf(string $invoice_id, array $options = []): \Recurly\Resources\BinaryFile { $path = $this->interpolatePath("/invoices/{invoice_id}.pdf", ['invoice_id' => $invoice_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Apply available credit to a pending or past due charge invoice * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Invoice The updated invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/apply_credit_balance */ public function applyCreditBalance(string $invoice_id, array $options = []): \Recurly\Resources\Invoice { $path = $this->interpolatePath("/invoices/{invoice_id}/apply_credit_balance", ['invoice_id' => $invoice_id]); return $this->makeRequest('PUT', $path, [], $options); } /** * Collect a pending or past due, automatic invoice * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Invoice The updated invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/collect_invoice */ public function collectInvoice(string $invoice_id, array $body = [], array $options = []): \Recurly\Resources\Invoice { $path = $this->interpolatePath("/invoices/{invoice_id}/collect", ['invoice_id' => $invoice_id]); return $this->makeRequest('PUT', $path, $body, $options); } /** * Mark an open invoice as failed * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Invoice The updated invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/mark_invoice_failed */ public function markInvoiceFailed(string $invoice_id, array $options = []): \Recurly\Resources\Invoice { $path = $this->interpolatePath("/invoices/{invoice_id}/mark_failed", ['invoice_id' => $invoice_id]); return $this->makeRequest('PUT', $path, [], $options); } /** * Mark an open invoice as successful * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Invoice The updated invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/mark_invoice_successful */ public function markInvoiceSuccessful(string $invoice_id, array $options = []): \Recurly\Resources\Invoice { $path = $this->interpolatePath("/invoices/{invoice_id}/mark_successful", ['invoice_id' => $invoice_id]); return $this->makeRequest('PUT', $path, [], $options); } /** * Reopen a closed, manual invoice * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Invoice The updated invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/reopen_invoice */ public function reopenInvoice(string $invoice_id, array $options = []): \Recurly\Resources\Invoice { $path = $this->interpolatePath("/invoices/{invoice_id}/reopen", ['invoice_id' => $invoice_id]); return $this->makeRequest('PUT', $path, [], $options); } /** * Void a credit invoice. * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Invoice The updated invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/void_invoice */ public function voidInvoice(string $invoice_id, array $options = []): \Recurly\Resources\Invoice { $path = $this->interpolatePath("/invoices/{invoice_id}/void", ['invoice_id' => $invoice_id]); return $this->makeRequest('PUT', $path, [], $options); } /** * Record an external payment for a manual invoices. * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Transaction The recorded transaction. * @link https://developers.recurly.com/api/v2021-02-25#operation/record_external_transaction */ public function recordExternalTransaction(string $invoice_id, array $body, array $options = []): \Recurly\Resources\Transaction { $path = $this->interpolatePath("/invoices/{invoice_id}/transactions", ['invoice_id' => $invoice_id]); return $this->makeRequest('POST', $path, $body, $options); } /** * List an invoice's line items * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['original'] (string): Filter by original field. * - $options['params']['state'] (string): Filter by state field. * - $options['params']['type'] (string): Filter by type field. * * @return \Recurly\Pager A list of the invoice's line items. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_invoice_line_items */ public function listInvoiceLineItems(string $invoice_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/invoices/{invoice_id}/line_items", ['invoice_id' => $invoice_id]); return new \Recurly\Pager($this, $path, $options); } /** * List the coupon redemptions applied to an invoice * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * * @return \Recurly\Pager A list of the the coupon redemptions associated with the invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_invoice_coupon_redemptions */ public function listInvoiceCouponRedemptions(string $invoice_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/invoices/{invoice_id}/coupon_redemptions", ['invoice_id' => $invoice_id]); return new \Recurly\Pager($this, $path, $options); } /** * List an invoice's related credit or charge invoices * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $options Associative array of optional parameters * * @return \Recurly\Pager A list of the credit or charge invoices associated with the invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_related_invoices */ public function listRelatedInvoices(string $invoice_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/invoices/{invoice_id}/related_invoices", ['invoice_id' => $invoice_id]); return new \Recurly\Pager($this, $path, $options); } /** * Refund an invoice * * @param string $invoice_id Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Invoice Returns the new credit invoice. * @link https://developers.recurly.com/api/v2021-02-25#operation/refund_invoice */ public function refundInvoice(string $invoice_id, array $body, array $options = []): \Recurly\Resources\Invoice { $path = $this->interpolatePath("/invoices/{invoice_id}/refund", ['invoice_id' => $invoice_id]); return $this->makeRequest('POST', $path, $body, $options); } /** * List a site's line items * * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['original'] (string): Filter by original field. * - $options['params']['state'] (string): Filter by state field. * - $options['params']['type'] (string): Filter by type field. * * @return \Recurly\Pager A list of the site's line items. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_line_items */ public function listLineItems(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/line_items", []); return new \Recurly\Pager($this, $path, $options); } /** * Fetch a line item * * @param string $line_item_id Line Item ID. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\LineItem A line item. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_line_item */ public function getLineItem(string $line_item_id, array $options = []): \Recurly\Resources\LineItem { $path = $this->interpolatePath("/line_items/{line_item_id}", ['line_item_id' => $line_item_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Delete an uninvoiced line item * * @param string $line_item_id Line Item ID. * @param array $options Associative array of optional parameters * * @return \Recurly\EmptyResource Line item deleted. * @link https://developers.recurly.com/api/v2021-02-25#operation/remove_line_item */ public function removeLineItem(string $line_item_id, array $options = []): \Recurly\EmptyResource { $path = $this->interpolatePath("/line_items/{line_item_id}", ['line_item_id' => $line_item_id]); return $this->makeRequest('DELETE', $path, [], $options); } /** * List a site's plans * * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['state'] (string): Filter by state. * * @return \Recurly\Pager A list of plans. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_plans */ public function listPlans(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/plans", []); return new \Recurly\Pager($this, $path, $options); } /** * Create a plan * * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Plan A plan. * @link https://developers.recurly.com/api/v2021-02-25#operation/create_plan */ public function createPlan(array $body, array $options = []): \Recurly\Resources\Plan { $path = $this->interpolatePath("/plans", []); return $this->makeRequest('POST', $path, $body, $options); } /** * Fetch a plan * * @param string $plan_id Plan ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-gold`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Plan A plan. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_plan */ public function getPlan(string $plan_id, array $options = []): \Recurly\Resources\Plan { $path = $this->interpolatePath("/plans/{plan_id}", ['plan_id' => $plan_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Update a plan * * @param string $plan_id Plan ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-gold`. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Plan A plan. * @link https://developers.recurly.com/api/v2021-02-25#operation/update_plan */ public function updatePlan(string $plan_id, array $body, array $options = []): \Recurly\Resources\Plan { $path = $this->interpolatePath("/plans/{plan_id}", ['plan_id' => $plan_id]); return $this->makeRequest('PUT', $path, $body, $options); } /** * Remove a plan * * @param string $plan_id Plan ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-gold`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Plan Plan deleted * @link https://developers.recurly.com/api/v2021-02-25#operation/remove_plan */ public function removePlan(string $plan_id, array $options = []): \Recurly\Resources\Plan { $path = $this->interpolatePath("/plans/{plan_id}", ['plan_id' => $plan_id]); return $this->makeRequest('DELETE', $path, [], $options); } /** * List a plan's add-ons * * @param string $plan_id Plan ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-gold`. * @param array $options Associative array of optional parameters diff --git a/lib/recurly/resources/external_subscription.php b/lib/recurly/resources/external_subscription.php index 42923d4..99dfd66 100644 --- a/lib/recurly/resources/external_subscription.php +++ b/lib/recurly/resources/external_subscription.php @@ -1,524 +1,548 @@ <?php /** * This file is automatically created by Recurly's OpenAPI generation process * and thus any edits you make by hand will be lost. If you wish to make a * change to this file, please create a Github issue explaining the changes you * need and we will usher them to the appropriate places. */ namespace Recurly\Resources; use Recurly\RecurlyResource; // phpcs:disable class ExternalSubscription extends RecurlyResource { private $_account; private $_activated_at; private $_app_identifier; private $_auto_renew; private $_canceled_at; private $_created_at; private $_expires_at; private $_external_id; private $_external_payment_phases; private $_external_product_reference; private $_id; private $_imported; private $_in_grace_period; private $_last_purchased; private $_object; private $_quantity; private $_state; private $_test; private $_trial_ends_at; private $_trial_started_at; private $_updated_at; + private $_uuid; protected static $array_hints = [ 'setExternalPaymentPhases' => '\Recurly\Resources\ExternalPaymentPhase', ]; /** * Getter method for the account attribute. * Account mini details * * @return ?\Recurly\Resources\AccountMini */ public function getAccount(): ?\Recurly\Resources\AccountMini { return $this->_account; } /** * Setter method for the account attribute. * * @param \Recurly\Resources\AccountMini $account * * @return void */ public function setAccount(\Recurly\Resources\AccountMini $account): void { $this->_account = $account; } /** * Getter method for the activated_at attribute. * When the external subscription was activated in the external platform. * * @return ?string */ public function getActivatedAt(): ?string { return $this->_activated_at; } /** * Setter method for the activated_at attribute. * * @param string $activated_at * * @return void */ public function setActivatedAt(string $activated_at): void { $this->_activated_at = $activated_at; } /** * Getter method for the app_identifier attribute. * Identifier of the app that generated the external subscription. * * @return ?string */ public function getAppIdentifier(): ?string { return $this->_app_identifier; } /** * Setter method for the app_identifier attribute. * * @param string $app_identifier * * @return void */ public function setAppIdentifier(string $app_identifier): void { $this->_app_identifier = $app_identifier; } /** * Getter method for the auto_renew attribute. * An indication of whether or not the external subscription will auto-renew at the expiration date. * * @return ?bool */ public function getAutoRenew(): ?bool { return $this->_auto_renew; } /** * Setter method for the auto_renew attribute. * * @param bool $auto_renew * * @return void */ public function setAutoRenew(bool $auto_renew): void { $this->_auto_renew = $auto_renew; } /** * Getter method for the canceled_at attribute. * When the external subscription was canceled in the external platform. * * @return ?string */ public function getCanceledAt(): ?string { return $this->_canceled_at; } /** * Setter method for the canceled_at attribute. * * @param string $canceled_at * * @return void */ public function setCanceledAt(string $canceled_at): void { $this->_canceled_at = $canceled_at; } /** * Getter method for the created_at attribute. * When the external subscription was created in Recurly. * * @return ?string */ public function getCreatedAt(): ?string { return $this->_created_at; } /** * Setter method for the created_at attribute. * * @param string $created_at * * @return void */ public function setCreatedAt(string $created_at): void { $this->_created_at = $created_at; } /** * Getter method for the expires_at attribute. * When the external subscription expires in the external platform. * * @return ?string */ public function getExpiresAt(): ?string { return $this->_expires_at; } /** * Setter method for the expires_at attribute. * * @param string $expires_at * * @return void */ public function setExpiresAt(string $expires_at): void { $this->_expires_at = $expires_at; } /** * Getter method for the external_id attribute. * The id of the subscription in the external systems., I.e. Apple App Store or Google Play Store. * * @return ?string */ public function getExternalId(): ?string { return $this->_external_id; } /** * Setter method for the external_id attribute. * * @param string $external_id * * @return void */ public function setExternalId(string $external_id): void { $this->_external_id = $external_id; } /** * Getter method for the external_payment_phases attribute. * The phases of the external subscription payment lifecycle. * * @return array */ public function getExternalPaymentPhases(): array { return $this->_external_payment_phases ?? [] ; } /** * Setter method for the external_payment_phases attribute. * * @param array $external_payment_phases * * @return void */ public function setExternalPaymentPhases(array $external_payment_phases): void { $this->_external_payment_phases = $external_payment_phases; } /** * Getter method for the external_product_reference attribute. * External Product Reference details * * @return ?\Recurly\Resources\ExternalProductReferenceMini */ public function getExternalProductReference(): ?\Recurly\Resources\ExternalProductReferenceMini { return $this->_external_product_reference; } /** * Setter method for the external_product_reference attribute. * * @param \Recurly\Resources\ExternalProductReferenceMini $external_product_reference * * @return void */ public function setExternalProductReference(\Recurly\Resources\ExternalProductReferenceMini $external_product_reference): void { $this->_external_product_reference = $external_product_reference; } /** * Getter method for the id attribute. * System-generated unique identifier for an external subscription ID, e.g. `e28zov4fw0v2`. * * @return ?string */ public function getId(): ?string { return $this->_id; } /** * Setter method for the id attribute. * * @param string $id * * @return void */ public function setId(string $id): void { $this->_id = $id; } /** * Getter method for the imported attribute. * An indication of whether or not the external subscription was created by a historical data import. * * @return ?bool */ public function getImported(): ?bool { return $this->_imported; } /** * Setter method for the imported attribute. * * @param bool $imported * * @return void */ public function setImported(bool $imported): void { $this->_imported = $imported; } /** * Getter method for the in_grace_period attribute. * An indication of whether or not the external subscription is in a grace period. * * @return ?bool */ public function getInGracePeriod(): ?bool { return $this->_in_grace_period; } /** * Setter method for the in_grace_period attribute. * * @param bool $in_grace_period * * @return void */ public function setInGracePeriod(bool $in_grace_period): void { $this->_in_grace_period = $in_grace_period; } /** * Getter method for the last_purchased attribute. * When a new billing event occurred on the external subscription in conjunction with a recent billing period, reactivation or upgrade/downgrade. * * @return ?string */ public function getLastPurchased(): ?string { return $this->_last_purchased; } /** * Setter method for the last_purchased attribute. * * @param string $last_purchased * * @return void */ public function setLastPurchased(string $last_purchased): void { $this->_last_purchased = $last_purchased; } /** * Getter method for the object attribute. * Object type * * @return ?string */ public function getObject(): ?string { return $this->_object; } /** * Setter method for the object attribute. * * @param string $object * * @return void */ public function setObject(string $object): void { $this->_object = $object; } /** * Getter method for the quantity attribute. * An indication of the quantity of a subscribed item's quantity. * * @return ?int */ public function getQuantity(): ?int { return $this->_quantity; } /** * Setter method for the quantity attribute. * * @param int $quantity * * @return void */ public function setQuantity(int $quantity): void { $this->_quantity = $quantity; } /** * Getter method for the state attribute. * External subscriptions can be active, canceled, expired, past_due, voided, revoked, or paused. * * @return ?string */ public function getState(): ?string { return $this->_state; } /** * Setter method for the state attribute. * * @param string $state * * @return void */ public function setState(string $state): void { $this->_state = $state; } /** * Getter method for the test attribute. * An indication of whether or not the external subscription was purchased in a sandbox environment. * * @return ?bool */ public function getTest(): ?bool { return $this->_test; } /** * Setter method for the test attribute. * * @param bool $test * * @return void */ public function setTest(bool $test): void { $this->_test = $test; } /** * Getter method for the trial_ends_at attribute. * When the external subscription trial period ends in the external platform. * * @return ?string */ public function getTrialEndsAt(): ?string { return $this->_trial_ends_at; } /** * Setter method for the trial_ends_at attribute. * * @param string $trial_ends_at * * @return void */ public function setTrialEndsAt(string $trial_ends_at): void { $this->_trial_ends_at = $trial_ends_at; } /** * Getter method for the trial_started_at attribute. * When the external subscription trial period started in the external platform. * * @return ?string */ public function getTrialStartedAt(): ?string { return $this->_trial_started_at; } /** * Setter method for the trial_started_at attribute. * * @param string $trial_started_at * * @return void */ public function setTrialStartedAt(string $trial_started_at): void { $this->_trial_started_at = $trial_started_at; } /** * Getter method for the updated_at attribute. * When the external subscription was updated in Recurly. * * @return ?string */ public function getUpdatedAt(): ?string { return $this->_updated_at; } /** * Setter method for the updated_at attribute. * * @param string $updated_at * * @return void */ public function setUpdatedAt(string $updated_at): void { $this->_updated_at = $updated_at; } + + /** + * Getter method for the uuid attribute. + * Universally Unique Identifier created automatically. + * + * @return ?string + */ + public function getUuid(): ?string + { + return $this->_uuid; + } + + /** + * Setter method for the uuid attribute. + * + * @param string $uuid + * + * @return void + */ + public function setUuid(string $uuid): void + { + $this->_uuid = $uuid; + } } \ No newline at end of file diff --git a/openapi/api.yaml b/openapi/api.yaml index 5b14ea9..9b0e9a5 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -16234,1026 +16234,1027 @@ paths: schema: "$ref": "#/components/schemas/Error" '404': description: External invoice cannot be found for the specified reason. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/external_subscriptions/{external_subscription_id}/external_payment_phases": parameters: - "$ref": "#/components/parameters/external_subscription_id" get: tags: - external_subscriptions operationId: list_external_subscription_external_payment_phases summary: List the external payment phases on an external subscription description: See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: - "$ref": "#/components/parameters/sort_dates" - "$ref": "#/components/parameters/limit" - "$ref": "#/components/parameters/order" responses: '200': description: A list of the the external_payment_phases on a site. content: application/json: schema: "$ref": "#/components/schemas/ExternalPaymentPhaseList" '404': description: Incorrect site. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/external_subscriptions/{external_subscription_id}/external_payment_phases/{external_payment_phase_id}": parameters: - "$ref": "#/components/parameters/external_subscription_id" - "$ref": "#/components/parameters/external_payment_phase_id" get: tags: - external_payment_phases operationId: get_external_subscription_external_payment_phase summary: Fetch an external payment phase responses: '200': description: Details for an external payment phase. content: application/json: schema: "$ref": "#/components/schemas/ExternalPaymentPhase" '404': description: Incorrect site or external subscription ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/accounts/{account_id}/entitlements": parameters: - "$ref": "#/components/parameters/account_id" - "$ref": "#/components/parameters/filter_limited_subscription_state" get: tags: - account operationId: list_entitlements summary: List entitlements granted to an account responses: '200': description: A list of the entitlements granted to an account. content: application/json: schema: "$ref": "#/components/schemas/Entitlements" '404': description: Incorrect site or account ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/accounts/{account_id}/external_subscriptions": parameters: - "$ref": "#/components/parameters/account_id" get: tags: - account operationId: list_account_external_subscriptions summary: List an account's external subscriptions description: See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: - "$ref": "#/components/parameters/sort_dates" responses: '200': description: A list of the the external_subscriptions on an account. content: application/json: schema: "$ref": "#/components/schemas/ExternalSubscriptionList" '404': description: Incorrect account. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/business_entities/{business_entity_id}": parameters: - "$ref": "#/components/parameters/business_entity_id" get: tags: - business_entities operationId: get_business_entity summary: Fetch a business entity responses: '200': description: Business entity details content: application/json: schema: "$ref": "#/components/schemas/BusinessEntity" '404': description: Incorrect site or business entity ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/business_entities": get: tags: - business_entities operationId: list_business_entities summary: List business entities responses: '200': description: List of all business entities on your site. content: application/json: schema: "$ref": "#/components/schemas/BusinessEntityList" '404': description: Incorrect site. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/gift_cards": get: tags: - gift_cards operationId: list_gift_cards summary: List gift cards responses: '200': description: List of all created gift cards on your site. content: application/json: schema: "$ref": "#/components/schemas/GiftCardList" '404': description: Incorrect site. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] post: tags: - gift_cards operationId: create_gift_card summary: Create gift card requestBody: content: application/json: schema: "$ref": "#/components/schemas/GiftCardCreate" required: true responses: '201': description: Returns the gift card content: application/json: schema: "$ref": "#/components/schemas/GiftCard" '400': description: Bad request; perhaps missing or invalid parameters. content: application/json: schema: "$ref": "#/components/schemas/Error" '422': description: Gift card cannot be completed for the specified reason. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/gift_cards/{gift_card_id}": parameters: - "$ref": "#/components/parameters/gift_card_id" get: tags: - gift_cards operationId: get_gift_card summary: Fetch a gift card responses: '200': description: Gift card details content: application/json: schema: "$ref": "#/components/schemas/GiftCard" '404': description: Incorrect site or gift card ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/gift_cards/preview": post: tags: - gift_cards operationId: preview_gift_card summary: Preview gift card requestBody: content: application/json: schema: "$ref": "#/components/schemas/GiftCardCreate" required: true responses: '201': description: Returns the gift card content: application/json: schema: "$ref": "#/components/schemas/GiftCard" '400': description: Bad request; perhaps missing or invalid parameters. content: application/json: schema: "$ref": "#/components/schemas/Error" '422': description: Gift card cannot be completed for the specified reason. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/gift_cards/{redemption_code}/redeem": parameters: - "$ref": "#/components/parameters/redemption_code" post: tags: - gift_cards operationId: redeem_gift_card summary: Redeem gift card requestBody: content: application/json: schema: "$ref": "#/components/schemas/GiftCardRedeem" required: true responses: '201': description: Redeems and returns the gift card content: application/json: schema: "$ref": "#/components/schemas/GiftCard" '400': description: Bad request; perhaps missing or invalid parameters. content: application/json: schema: "$ref": "#/components/schemas/Error" '422': description: Gift card cannot be redeemed for the specified reason. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/business_entities/{business_entity_id}/invoices": get: tags: - invoice operationId: list_business_entity_invoices summary: List a business entity's invoices description: See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: - "$ref": "#/components/parameters/business_entity_id" - "$ref": "#/components/parameters/ids" - "$ref": "#/components/parameters/invoice_state" - "$ref": "#/components/parameters/limit" - "$ref": "#/components/parameters/order" - "$ref": "#/components/parameters/sort_dates" - "$ref": "#/components/parameters/filter_begin_time" - "$ref": "#/components/parameters/filter_end_time" - "$ref": "#/components/parameters/filter_invoice_type" responses: '200': description: A list of the business entity's invoices. content: application/json: schema: "$ref": "#/components/schemas/InvoiceList" '400': description: Invalid or unpermitted parameter. content: application/json: schema: "$ref": "#/components/schemas/Error" '404': description: Incorrect site or business entity ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] servers: - url: https://v3.recurly.com - url: https://v3.eu.recurly.com components: parameters: site_id: name: site_id in: path description: Site ID or subdomain. For ID no prefix is used e.g. `e28zov4fw0v2`. For subdomain use prefix `subdomain-`, e.g. `subdomain-recurly`. required: true schema: type: string account_id: name: account_id in: path description: Account ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-bob`. required: true schema: type: string add_on_id: name: add_on_id in: path description: Add-on ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-gold`. required: true schema: type: string billing_info_id: name: billing_info_id in: path description: Billing Info ID. Can ONLY be used for sites utilizing the Wallet feature. required: true schema: type: string business_entity_id: name: business_entity_id in: path description: Business Entity ID. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-entity1`. required: true schema: type: string usage_id: name: usage_id in: path description: Usage Record ID. required: true schema: type: string coupon_id: name: coupon_id in: path description: Coupon ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-10off`. required: true schema: type: string credit_payment_id: name: credit_payment_id in: path description: Credit Payment ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`. required: true schema: type: string custom_field_definition_id: name: custom_field_definition_id in: path description: Custom Field Definition ID required: true schema: type: string external_account_id: name: external_account_id in: path description: External account ID, e.g. `s28zov4fw0cb`. required: true schema: type: string external_invoice_id: name: external_invoice_id in: path description: External invoice ID, e.g. `e28zov4fw0v2`. required: true schema: type: string external_product_id: name: external_product_id in: path description: External product id required: true schema: type: string external_product_reference_id: name: external_product_reference_id in: path description: External product reference ID, e.g. `d39iun2fw1v4`. required: true schema: type: string external_subscription_id_fetch: name: external_subscription_id in: path - description: External subscription ID or external_id. For ID no prefix is used - e.g. `e28zov4fw0v2`. For external_id use prefix `external-id-`, e.g. `external-id-123456`. + description: External subscription ID, external_id or uuid. For ID no prefix + is used e.g. `e28zov4fw0v2`. For external_id use prefix `external-id-`, e.g. + `external-id-123456` and for uuid use prefix `uuid-` e.g. `uuid-7293239bae62777d8c1ae044a9843633`. required: true schema: type: string external_subscription_id: name: external_subscription_id in: path description: External subscription id required: true schema: type: string external_payment_phase_id: name: external_payment_phase_id in: path description: External payment phase ID, e.g. `a34ypb2ef9w1`. required: true schema: type: string general_ledger_account_id: name: general_ledger_account_id in: path description: General Ledger Account ID required: true schema: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 general_ledger_account_type_enum: name: account_type in: query description: General Ledger Account type by which to filter the response. schema: "$ref": "#/components/schemas/GeneralLedgerAccountTypeEnum" invoice_template_id: name: invoice_template_id in: path description: Invoice template ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-bob`. required: true schema: type: string item_id: name: item_id in: path description: Item ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-red`. required: true schema: type: string invoice_id: name: invoice_id in: path description: Invoice ID or number. For ID no prefix is used e.g. `e28zov4fw0v2`. For number use prefix `number-`, e.g. `number-1000`. required: true schema: type: string invoice_state: name: state in: query description: Invoice state. schema: "$ref": "#/components/schemas/InvoiceStateQueryParamEnum" measured_unit_id: name: measured_unit_id in: path description: Measured unit ID or name. For ID no prefix is used e.g. `e28zov4fw0v2`. For name use prefix `name-`, e.g. `name-Storage`. required: true schema: type: string line_item_id: name: line_item_id in: path description: Line Item ID. required: true schema: type: string performance_obligation_id: name: performance_obligation_id in: path description: Performance Obligation id. required: true schema: type: string title: Performance Obligation ID description: | The ID of a performance obligation. Performance obligations are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 plan_id: name: plan_id in: path description: Plan ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-gold`. required: true schema: type: string shipping_address_id: name: shipping_address_id in: path description: Shipping Address ID. required: true schema: type: string shipping_method_id: name: shipping_method_id in: path description: Shipping Method ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-usps_2-day`. required: true schema: type: string subscription_id: name: subscription_id in: path description: Subscription ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`. required: true schema: type: string transaction_id: name: transaction_id in: path description: Transaction ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`. required: true schema: type: string unique_coupon_code_id: name: unique_coupon_code_id in: path description: Unique Coupon Code ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-abc-8dh2-def`. required: true schema: type: string dunning_campaign_id: name: dunning_campaign_id in: path description: Dunning Campaign ID, e.g. `e28zov4fw0v2`. required: true schema: type: string gift_card_id: name: gift_card_id in: path description: Gift Card ID, e.g. `e28zov4fw0v2`. required: true schema: type: string redemption_code: name: redemption_code in: path description: Gift Card redemption code, e.g., `N1A2T8IRXSCMO40V`. required: true schema: type: string ids: name: ids in: query description: | Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. **Important notes:** * The `ids` parameter cannot be used with any other ordering or filtering parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request. * Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself. style: form explode: false schema: type: array items: type: string limit: name: limit in: query description: Limit number of records 1-200. schema: type: integer minimum: 1 maximum: 200 default: 20 order: name: order in: query description: Sort order. schema: default: desc "$ref": "#/components/schemas/AlphanumericSortEnum" sort_dates: name: sort in: query description: | Sort field. You *really* only want to sort by `updated_at` in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned. schema: default: created_at "$ref": "#/components/schemas/TimestampSortEnum" usage_sort_dates: name: sort in: query description: | Sort field. You *really* only want to sort by `usage_timestamp` in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned. schema: type: string "$ref": "#/components/schemas/UsageSortEnum" billing_status: name: billing_status in: query description: Filter by usage record's billing status schema: type: string "$ref": "#/components/schemas/BillingStatusEnum" filter_state: name: state in: query description: Filter by state. schema: "$ref": "#/components/schemas/ActiveStateEnum" filter_subscription_state: name: state in: query description: | Filter by state. - When `state=active`, `state=canceled`, `state=expired`, or `state=future`, subscriptions with states that match the query and only those subscriptions will be returned. - When `state=in_trial`, only subscriptions that have a trial_started_at date earlier than now and a trial_ends_at date later than now will be returned. - When `state=live`, only subscriptions that are in an active, canceled, or future state or are in trial will be returned. schema: "$ref": "#/components/schemas/FilterSubscriptionStateEnum" filter_limited_subscription_state: name: state in: query description: | Filter the entitlements based on the state of the applicable subscription. - When `state=active`, `state=canceled`, `state=expired`, or `state=future`, subscriptions with states that match the query and only those subscriptions will be returned. - When no state is provided, subscriptions with active or canceled states will be returned. schema: "$ref": "#/components/schemas/FilterLimitedSubscriptionStateEnum" filter_begin_time: name: begin_time in: query description: | Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. schema: type: string format: date-time filter_end_time: name: end_time in: query description: | Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. schema: type: string format: date-time filter_usage_begin_time: name: begin_time in: query description: | Inclusively filter by begin_time when `sort=usage_timestamp` or `sort=recorded_timestamp`. **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. schema: type: string format: date-time filter_usage_end_time: name: end_time in: query description: | Inclusively filter by end_time when `sort=usage_timestamp` or `sort=recorded_timestamp`. **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. schema: type: string format: date-time filter_account_email: name: email in: query description: Filter for accounts with this exact email address. A blank value will return accounts with both `null` and `""` email addresses. Note that multiple accounts can share one email address. schema: type: string filter_account_subscriber: name: subscriber in: query description: | Filter for accounts with or without a subscription in the `active`, `canceled`, or `future` state. schema: type: boolean filter_account_past_due: name: past_due in: query description: Filter for accounts with an invoice in the `past_due` state. schema: "$ref": "#/components/schemas/TrueEnum" filter_line_item_original: name: original in: query description: Filter by original field. schema: "$ref": "#/components/schemas/TrueEnum" filter_line_item_state: name: state in: query description: Filter by state field. schema: "$ref": "#/components/schemas/LineItemStateEnum" filter_line_item_type: name: type in: query description: Filter by type field. schema: "$ref": "#/components/schemas/LineItemTypeEnum" filter_transaction_type: name: type in: query description: Filter by type field. The value `payment` will return both `purchase` and `capture` transactions. schema: "$ref": "#/components/schemas/FilterTransactionTypeEnum" filter_transaction_success: name: success in: query description: Filter by success field. schema: "$ref": "#/components/schemas/TrueEnum" filter_invoice_type: name: type in: query description: | Filter by type when: - `type=charge`, only charge invoices will be returned. - `type=credit`, only credit invoices will be returned. - `type=non-legacy`, only charge and credit invoices will be returned. - `type=legacy`, only legacy invoices will be returned. schema: "$ref": "#/components/schemas/FilterInvoiceTypeEnum" export_date: name: export_date in: path description: Date for which to get a list of available automated export files. Date must be in YYYY-MM-DD format. required: true schema: type: string securitySchemes: api_key: type: http description: Enter the API key as the username and set the password to an empty string. You can locate and manage your API keys from the [API Credentials](https://app.recurly.com/go/developer/api_keys) page. scheme: basic schemas: Empty: type: object properties: {} BinaryFile: type: string format: binary readOnly: true AccountAcquisitionList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/AccountAcquisition" AccountList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/Account" AccountNoteList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/AccountNote" AddOnList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/AddOn" BillingInfoList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/BillingInfo" CreditPaymentList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/CreditPayment" CouponList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/Coupon" CouponRedemptionList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/CouponRedemption" @@ -24591,1024 +24592,1028 @@ components: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" required: - currency - account DunningCampaign: type: object description: Settings for a dunning campaign. properties: id: type: string object: type: string title: Object type code: type: string description: Campaign code. name: type: string description: Campaign name. description: type: string description: Campaign description. default_campaign: type: boolean description: Whether or not this is the default campaign for accounts or plans without an assigned dunning campaign. dunning_cycles: type: array description: Dunning Cycle settings. items: "$ref": "#/components/schemas/DunningCycle" created_at: type: string format: date-time description: When the current campaign was created in Recurly. updated_at: type: string format: date-time description: When the current campaign was updated in Recurly. deleted_at: type: string format: date-time description: When the current campaign was deleted in Recurly. DunningCampaignList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/DunningCampaign" DunningCycle: type: object properties: type: "$ref": "#/components/schemas/DunningCycleTypeEnum" applies_to_manual_trial: type: boolean description: Whether the dunning settings will be applied to manual trials. Only applies to trial cycles. first_communication_interval: type: integer description: The number of days after a transaction failure before the first dunning email is sent. send_immediately_on_hard_decline: type: boolean description: Whether or not to send an extra email immediately to customers whose initial payment attempt fails with either a hard decline or invalid billing info. intervals: type: array description: Dunning intervals. items: "$ref": "#/components/schemas/DunningInterval" expire_subscription: type: boolean description: Whether the subscription(s) should be cancelled at the end of the dunning cycle. fail_invoice: type: boolean description: Whether the invoice should be failed at the end of the dunning cycle. total_dunning_days: type: integer description: The number of days between the first dunning email being sent and the end of the dunning cycle. total_recycling_days: type: integer description: The number of days between a transaction failure and the end of the dunning cycle. version: type: integer description: Current campaign version. created_at: type: string format: date-time description: When the current settings were created in Recurly. updated_at: type: string format: date-time description: When the current settings were updated in Recurly. DunningInterval: properties: days: type: integer description: Number of days before sending the next email. email_template: type: string description: Email template being used. DunningCampaignsBulkUpdate: properties: plan_codes: type: array maxItems: 200 description: List of `plan_codes` associated with the Plans for which the dunning campaign should be updated. Required unless `plan_ids` is present. items: type: string plan_ids: type: array maxItems: 200 description: List of `plan_ids` associated with the Plans for which the dunning campaign should be updated. Required unless `plan_codes` is present. items: type: string DunningCampaignsBulkUpdateResponse: properties: object: type: string title: Object type readOnly: true plans: type: array title: Plans description: An array containing all of the `Plan` resources that have been updated. maxItems: 200 items: "$ref": "#/components/schemas/Plan" Entitlements: type: object description: A list of privileges granted to a customer through the purchase of a plan or item. properties: object: type: string title: Object Type has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/Entitlement" Entitlement: type: object properties: object: type: string description: Entitlement customer_permission: "$ref": "#/components/schemas/CustomerPermission" granted_by: type: array description: Subscription or item that granted the customer permission. items: "$ref": "#/components/schemas/GrantedBy" created_at: type: string format: date-time description: Time object was created. updated_at: type: string format: date-time description: Time the object was last updated ExternalPaymentPhase: type: object description: Details of payments in the lifecycle of a subscription from an external resource that is not managed by the Recurly platform, e.g. App Store or Google Play Store. properties: id: type: string title: External payment phase ID description: System-generated unique identifier for an external payment phase ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type started_at: type: string format: date-time title: Started At ends_at: type: string format: date-time title: Ends At starting_billing_period_index: type: integer title: Starting Billing Period Index ending_billing_period_index: type: integer title: Ending Billing Period Index offer_type: type: string title: Offer Type description: Type of discount offer given, e.g. "FREE_TRIAL" offer_name: type: string title: Offer Name description: Name of the discount offer given, e.g. "introductory" period_count: type: integer title: Period Count description: Number of billing periods period_length: type: string title: Period Length description: Billing cycle length amount: type: string format: decimal title: Amount minimum: 0 description: Allows up to 9 decimal places currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 created_at: type: string format: date-time title: Created at description: When the external subscription was created in Recurly. updated_at: type: string format: date-time title: Updated at description: When the external subscription was updated in Recurly. ExternalPaymentPhaseList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalPaymentPhase" ExternalProduct: type: object description: Product from an external resource such as Apple App Store or Google Play Store. properties: id: type: string title: External product ID. description: System-generated unique identifier for an external product ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type name: type: string title: Name description: Name to identify the external product in Recurly. plan: "$ref": "#/components/schemas/PlanMini" created_at: type: string format: date-time description: When the external product was created in Recurly. updated_at: type: string format: date-time description: When the external product was updated in Recurly. external_product_references: type: array title: External Product References description: List of external product references of the external product. items: "$ref": "#/components/schemas/ExternalProductReferenceMini" ExternalProductList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalProduct" ExternalProductCreate: type: object properties: name: type: string description: External product name. plan_id: type: string description: Recurly plan UUID. external_product_references: type: array title: External Product References description: List of external product references of the external product. items: "$ref": "#/components/schemas/ExternalProductReferenceBase" required: - name ExternalProductUpdate: type: object properties: plan_id: type: string description: Recurly plan UUID. required: - plan_id ExternalProductReferenceBase: type: object properties: reference_code: type: string description: A code which associates the external product to a corresponding object or resource in an external platform like the Apple App Store or Google Play Store. maxLength: 255 external_connection_type: "$ref": "#/components/schemas/ExternalProductReferenceConnectionTypeEnum" ExternalProductReferenceCollection: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalProductReferenceMini" ExternalProductReferenceCreate: allOf: - "$ref": "#/components/schemas/ExternalProductReferenceBase" required: - reference_code - external_connection_type ExternalProductReferenceUpdate: allOf: - "$ref": "#/components/schemas/ExternalProductReferenceBase" ExternalProductReferenceConnectionTypeEnum: type: string enum: - apple_app_store - google_play_store ExternalAccountList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalAccount" ExternalAccountCreate: type: object properties: external_account_code: type: string description: Represents the account code for the external account. external_connection_type: type: string description: Represents the connection type. `AppleAppStore` or `GooglePlayStore` required: - external_account_code - external_connection_type ExternalAccountUpdate: type: object properties: external_account_code: type: string description: Represents the account code for the external account. external_connection_type: type: string description: Represents the connection type. `AppleAppStore` or `GooglePlayStore` ExternalAccount: type: object title: External Account properties: object: type: string default: external_account id: type: string description: UUID of the external_account . external_account_code: type: string description: Represents the account code for the external account. external_connection_type: type: string description: Represents the connection type. `AppleAppStore` or `GooglePlayStore` created_at: type: string format: date-time description: Created at readOnly: true updated_at: type: string format: date-time description: Last updated at readOnly: true ExternalProductReferenceMini: type: object title: External Product Reference details description: External Product Reference details properties: id: type: string title: External Product ID description: System-generated unique identifier for an external product ID, e.g. `e28zov4fw0v2`. object: type: string title: object reference_code: type: string title: reference_code description: A code which associates the external product to a corresponding object or resource in an external platform like the Apple App Store or Google Play Store. external_connection_type: type: string title: external_connection_type description: Source connection platform. created_at: type: string format: date-time description: When the external product was created in Recurly. updated_at: type: string format: date-time description: When the external product was updated in Recurly. ExternalSubscription: type: object description: Subscription from an external resource such as Apple App Store or Google Play Store. properties: id: type: string title: External subscription ID description: System-generated unique identifier for an external subscription ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type account: "$ref": "#/components/schemas/AccountMini" external_product_reference: "$ref": "#/components/schemas/ExternalProductReferenceMini" external_payment_phases: type: array title: External payment phases description: The phases of the external subscription payment lifecycle. items: "$ref": "#/components/schemas/ExternalPaymentPhase" external_id: type: string title: External Id description: The id of the subscription in the external systems., I.e. Apple App Store or Google Play Store. + uuid: + type: string + title: Uuid + description: Universally Unique Identifier created automatically. last_purchased: type: string format: date-time title: Last purchased description: When a new billing event occurred on the external subscription in conjunction with a recent billing period, reactivation or upgrade/downgrade. auto_renew: type: boolean title: Auto-renew description: An indication of whether or not the external subscription will auto-renew at the expiration date. default: false in_grace_period: type: boolean title: In grace period description: An indication of whether or not the external subscription is in a grace period. default: false app_identifier: type: string title: App identifier description: Identifier of the app that generated the external subscription. quantity: type: integer title: Quantity description: An indication of the quantity of a subscribed item's quantity. default: 1 minimum: 0 state: type: string description: External subscriptions can be active, canceled, expired, past_due, voided, revoked, or paused. default: active activated_at: type: string format: date-time title: Activated at description: When the external subscription was activated in the external platform. canceled_at: type: string format: date-time title: Canceled at description: When the external subscription was canceled in the external platform. expires_at: type: string format: date-time title: Expires at description: When the external subscription expires in the external platform. trial_started_at: type: string format: date-time title: Trial started at description: When the external subscription trial period started in the external platform. trial_ends_at: type: string format: date-time title: Trial ends at description: When the external subscription trial period ends in the external platform. test: type: boolean title: Test description: An indication of whether or not the external subscription was purchased in a sandbox environment. default: false imported: type: boolean title: Imported description: An indication of whether or not the external subscription was created by a historical data import. default: false created_at: type: string format: date-time title: Created at description: When the external subscription was created in Recurly. updated_at: type: string format: date-time title: Updated at description: When the external subscription was updated in Recurly. ExternalSubscriptionList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalSubscription" ExternalInvoice: type: object description: Invoice from an external resource such as Apple App Store or Google Play Store. properties: id: type: string title: External invoice ID description: System-generated unique identifier for an external invoice ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type account: "$ref": "#/components/schemas/AccountMini" external_subscription: "$ref": "#/components/schemas/ExternalSubscription" external_id: type: string description: An identifier which associates the external invoice to a corresponding object in an external platform. state: "$ref": "#/components/schemas/ExternalInvoiceStateEnum" total: type: string format: decimal title: Total currency: type: string title: Currency description: 3-letter ISO 4217 currency code. line_items: type: array items: "$ref": "#/components/schemas/ExternalCharge" purchased_at: type: string format: date-time description: When the invoice was created in the external platform. created_at: type: string format: date-time description: When the external invoice was created in Recurly. updated_at: type: string format: date-time title: Updated at description: When the external invoice was updated in Recurly. ExternalInvoiceList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalInvoice" ExternalCharge: type: object description: Charge from an external resource such as Apple App Store or Google Play Store. properties: id: type: string title: External invoice ID description: System-generated unique identifier for an external charge ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type account: "$ref": "#/components/schemas/AccountMini" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. unit_amount: type: string format: decimal title: Unit Amount quantity: type: integer description: type: string external_product_reference: "$ref": "#/components/schemas/ExternalProductReferenceMini" created_at: type: string format: date-time title: Created at description: When the external charge was created in Recurly. updated_at: type: string format: date-time title: Updated at description: When the external charge was updated in Recurly. CustomerPermission: type: object properties: id: type: string description: Customer permission ID. code: type: string description: Customer permission code. name: type: string description: Customer permission name. description: type: string description: Description of customer permission. object: type: string description: It will always be "customer_permission". GrantedBy: type: object description: The subscription or external subscription that grants customer permissions. properties: object: type: string title: Object Type id: type: string description: The ID of the subscription or external subscription that grants the permission to the account. InvoiceTemplateList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/InvoiceTemplate" InvoiceTemplate: type: object description: Settings for an invoice template. properties: id: type: string code: type: string description: Invoice template code. name: type: string description: Invoice template name. description: type: string description: Invoice template description. created_at: type: string format: date-time description: When the invoice template was created in Recurly. updated_at: type: string format: date-time description: When the invoice template was updated in Recurly. PaymentMethod: properties: object: "$ref": "#/components/schemas/PaymentMethodEnum" card_type: description: Visa, MasterCard, American Express, Discover, JCB, etc. "$ref": "#/components/schemas/CardTypeEnum" first_six: type: string description: Credit card number's first six digits. maxLength: 6 last_four: type: string description: Credit card number's last four digits. Will refer to bank account if payment method is ACH. maxLength: 4 last_two: type: string description: The IBAN bank account's last two digits. maxLength: 2 exp_month: type: integer description: Expiration month. maxLength: 2 exp_year: type: integer description: Expiration year. maxLength: 4 gateway_token: type: string description: A token used in place of a credit card in order to perform transactions. maxLength: 50 cc_bin_country: type: string description: The 2-letter ISO 3166-1 alpha-2 country code associated with the credit card BIN, if known by Recurly. Available on the BillingInfo object only. Available when the BIN country lookup feature is enabled. gateway_code: type: string description: An identifier for a specific payment gateway. maxLength: 13 gateway_attributes: type: object description: Gateway specific attributes associated with this PaymentMethod x-class-name: GatewayAttributes properties: account_reference: type: string description: Used by Adyen and Braintree gateways. For Adyen the Shopper Reference value used when the external token was created. For Braintree the PayPal PayerID is populated in the response. maxLength: 264 card_network_preference: description: Represents the card network preference associated with the billing info for dual badged cards. Must be a supported card network. "$ref": "#/components/schemas/CardNetworkEnum" billing_agreement_id: type: string description: Billing Agreement identifier. Only present for Amazon or Paypal payment methods. name_on_account: type: string description: The name associated with the bank account. account_type: description: The bank account type. Only present for ACH payment methods. "$ref": "#/components/schemas/AccountTypeEnum" routing_number: type: string description: The bank account's routing number. Only present for ACH payment methods. routing_number_bank: type: string description: The bank name of this routing number. username: type: string description: Username of the associated payment method. Currently only associated with Venmo. BusinessEntityList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/BusinessEntity" BusinessEntity: type: object description: Business entity details properties: id: title: Business entity ID type: string maxLength: 13 readOnly: true object: title: Object type type: string readOnly: true code: title: Business entity code type: string maxLength: 50 description: The entity code of the business entity. name: type: string title: Name description: This name describes your business entity and will appear on the invoice. maxLength: 255 invoice_display_address: title: Invoice display address description: Address information for the business entity that will appear on the invoice. "$ref": "#/components/schemas/Address" tax_address: title: Tax address description: Address information for the business entity that will be used for calculating taxes. "$ref": "#/components/schemas/Address" origin_tax_address_source: "$ref": "#/components/schemas/OriginTaxAddressSourceEnum" destination_tax_address_source: "$ref": "#/components/schemas/DestinationTaxAddressSourceEnum" default_vat_number: type: string title: Default VAT number description: VAT number for the customer used on the invoice. maxLength: 20 default_registration_number: type: string title: Default registration number description: Registration number for the customer used on the invoice. maxLength: 30 subscriber_location_countries: type: array title: Subscriber location countries description: List of countries for which the business entity will be used. items: type: string title: Country code default_liability_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 default_revenue_gl_account_id: type: string title: General Ledger Account ID description: | The ID of a general ledger account. General ledger accounts are only accessible as a part of the Recurly RevRec Standard and Recurly RevRec Advanced features. maxLength: 13 created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true GiftCardList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/GiftCard" GiftCard: type: object description: Gift card details properties: id: title: Gift card ID type: string maxLength: 13 readOnly: true object: title: Object type type: string readOnly: true gifter_account_id: title: Gifter account ID type: string maxLength: 13 description: The ID of the account that purchased the gift card. recipient_account_id: title: Recipient account ID type: string maxLength: 13 description: The ID of the account that redeemed the gift card redemption code. Does not have a value until gift card is redeemed. purchase_invoice_id: title: Purchase invoice ID type: string maxLength: 13 description: The ID of the invoice for the gift card purchase made by the gifter. redemption_invoice_id: title: Redemption invoice ID type: string maxLength: 13 description: The ID of the invoice for the gift card redemption made by the recipient. Does not have a value until gift card is redeemed. redemption_code: title: Redemption code type: string description: The unique redemption code for the gift card, generated by Recurly. Will be 16 characters, alphanumeric, displayed uppercase, but accepted in any case at redemption. Used by the recipient account to create a credit in the amount of the `unit_amount` on their account. balance:
recurly/recurly-client-php
c6be5d650575f35a8c8b611f6d0afde89d475852
4.53.0
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 0b6f809..3a4fcc2 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 4.52.0 +current_version = 4.53.0 parse = (?P<major>\d+) \.(?P<minor>\d+) \.(?P<patch>\d+) serialize = {major}.{minor}.{patch} [bumpversion:file:composer.json] [bumpversion:file:lib/recurly/version.php] diff --git a/CHANGELOG.md b/CHANGELOG.md index 60f8a53..10114a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,514 +1,525 @@ # Changelog +## [4.53.0](https://github.com/recurly/recurly-client-php/tree/4.53.0) (2024-08-21) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.52.0...4.53.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 [#821](https://github.com/recurly/recurly-client-php/pull/821) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.52.0](https://github.com/recurly/recurly-client-php/tree/4.52.0) (2024-07-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.51.0...4.52.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Taxable Address Control, RevRec) [#817](https://github.com/recurly/recurly-client-php/pull/817) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.51.0](https://github.com/recurly/recurly-client-php/tree/4.51.0) (2024-05-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.50.0...4.51.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#814](https://github.com/recurly/recurly-client-php/pull/814) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.50.0](https://github.com/recurly/recurly-client-php/tree/4.50.0) (2024-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.49.0...4.50.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entity Use Code) [#812](https://github.com/recurly/recurly-client-php/pull/812) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.49.0](https://github.com/recurly/recurly-client-php/tree/4.49.0) (2024-05-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.48.0...4.49.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Proration Settings) [#810](https://github.com/recurly/recurly-client-php/pull/810) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.48.0](https://github.com/recurly/recurly-client-php/tree/4.48.0) (2024-05-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.47.0...4.48.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Auth & Capture) [#808](https://github.com/recurly/recurly-client-php/pull/808) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.47.0](https://github.com/recurly/recurly-client-php/tree/4.47.0) (2024-03-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.46.0...4.47.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#803](https://github.com/recurly/recurly-client-php/pull/803) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.46.0](https://github.com/recurly/recurly-client-php/tree/4.46.0) (2024-02-20) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.45.0...4.46.0) **Merged Pull Requests** - Add invoice state param for v2021-02-25 [#799](https://github.com/recurly/recurly-client-php/pull/799) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.45.0](https://github.com/recurly/recurly-client-php/tree/4.45.0) (2024-01-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.44.0...4.45.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#789](https://github.com/recurly/recurly-client-php/pull/789) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.44.0](https://github.com/recurly/recurly-client-php/tree/4.44.0) (2024-01-18) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.43.0...4.44.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#788](https://github.com/recurly/recurly-client-php/pull/788) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.43.0](https://github.com/recurly/recurly-client-php/tree/4.43.0) (2023-12-06) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.42.0...4.43.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Payment Phases) [#785](https://github.com/recurly/recurly-client-php/pull/785) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.42.0](https://github.com/recurly/recurly-client-php/tree/4.42.0) (2023-11-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.41.0...4.42.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#783](https://github.com/recurly/recurly-client-php/pull/783) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.41.0](https://github.com/recurly/recurly-client-php/tree/4.41.0) (2023-08-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.40.0...4.41.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (`VATNumber`, `LifecycleDecline`) [#782](https://github.com/recurly/recurly-client-php/pull/782) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.40.0](https://github.com/recurly/recurly-client-php/tree/4.40.0) (2023-08-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.39.0...4.40.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (action_result) [#781](https://github.com/recurly/recurly-client-php/pull/781) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.39.0](https://github.com/recurly/recurly-client-php/tree/4.39.0) (2023-07-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.37.0...4.39.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Ramp Dates, Net Terms, Invoice Business Entity) [#779](https://github.com/recurly/recurly-client-php/pull/779) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (App Management - External Subscriptions) [#777](https://github.com/recurly/recurly-client-php/pull/777) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.37.0](https://github.com/recurly/recurly-client-php/tree/4.37.0) (2023-06-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.36.0...4.37.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Multiple Business Entities) [#769](https://github.com/recurly/recurly-client-php/pull/769) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.36.0](https://github.com/recurly/recurly-client-php/tree/4.36.0) (2023-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.35.0...4.36.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Products & References) [#766](https://github.com/recurly/recurly-client-php/pull/766) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.35.0](https://github.com/recurly/recurly-client-php/tree/4.35.0) (2023-05-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.34.0...4.35.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (gateway_attributes on PaymentMethod) [#764](https://github.com/recurly/recurly-client-php/pull/764) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#747](https://github.com/recurly/recurly-client-php/pull/747) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.28.0](https://github.com/recurly/recurly-client-php/tree/4.28.0) (2023-02-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.27.0...4.28.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (GiftCard endpoints and new transaction error support) [#745](https://github.com/recurly/recurly-client-php/pull/745) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.27.0](https://github.com/recurly/recurly-client-php/tree/4.27.0) (2023-01-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.26.0...4.27.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Custom Fields on Line Items) [#738](https://github.com/recurly/recurly-client-php/pull/738) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.26.0](https://github.com/recurly/recurly-client-php/tree/4.26.0) (2023-01-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.25.0...4.26.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Account Preferred Time Zone) [#736](https://github.com/recurly/recurly-client-php/pull/736) ([douglasmiller](https://github.com/douglasmiller)) ## [4.25.0](https://github.com/recurly/recurly-client-php/tree/4.25.0) (2022-11-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.24.0...4.25.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Apply Credit Balance feature) [#732](https://github.com/recurly/recurly-client-php/pull/732) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.24.0](https://github.com/recurly/recurly-client-php/tree/4.24.0) (2022-11-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.23.0...4.24.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Subscriptions feature) [#729](https://github.com/recurly/recurly-client-php/pull/729) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#728](https://github.com/recurly/recurly-client-php/pull/728) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.23.0](https://github.com/recurly/recurly-client-php/tree/4.23.0) (2022-10-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.22.0...4.23.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entitlements feature) [#725](https://github.com/recurly/recurly-client-php/pull/725) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.22.0](https://github.com/recurly/recurly-client-php/tree/4.22.0) (2022-10-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.2...4.22.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25(Decimal Usage and Quantities and DunningEvent new fields) [#722](https://github.com/recurly/recurly-client-php/pull/722) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.2](https://github.com/recurly/recurly-client-php/tree/4.21.2) (2022-09-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.1...4.21.2) **Merged Pull Requests** - feat: allow for psr/log ^2/3 [#716](https://github.com/recurly/recurly-client-php/pull/716) ([trickeyone](https://github.com/trickeyone)) ## [4.21.1](https://github.com/recurly/recurly-client-php/tree/4.21.1) (2022-09-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.0...4.21.1) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#714](https://github.com/recurly/recurly-client-php/pull/714) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.0](https://github.com/recurly/recurly-client-php/tree/4.21.0) (2022-09-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.20.0...4.21.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#713](https://github.com/recurly/recurly-client-php/pull/713) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixes bug with putDunningCampaignBulkUpdate [#706](https://github.com/recurly/recurly-client-php/pull/706) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.20.0](https://github.com/recurly/recurly-client-php/tree/4.20.0) (2022-08-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.19.0...4.20.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#701](https://github.com/recurly/recurly-client-php/pull/701) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.19.0](https://github.com/recurly/recurly-client-php/tree/4.19.0) (2022-07-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.18.0...4.19.0) **Merged Pull Requests** - Fixing deprecation warnings in client [#697](https://github.com/recurly/recurly-client-php/pull/697) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#695](https://github.com/recurly/recurly-client-php/pull/695) ([recurly-integrations](https://github.com/recurly-integrations)) **Closed Issues** - Recurly\Pager and \Iterator return type mismatch (PHP 8.1 deprecation) [#677](https://github.com/recurly/recurly-client-php/issues/677) ## [4.18.0](https://github.com/recurly/recurly-client-php/tree/4.18.0) (2022-06-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.17.0...4.18.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#693](https://github.com/recurly/recurly-client-php/pull/693) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.17.0](https://github.com/recurly/recurly-client-php/tree/4.17.0) (2022-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.16.0...4.17.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#679](https://github.com/recurly/recurly-client-php/pull/679) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.16.0](https://github.com/recurly/recurly-client-php/tree/4.16.0) (2022-03-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.15.0...4.16.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#676](https://github.com/recurly/recurly-client-php/pull/676) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.15.0](https://github.com/recurly/recurly-client-php/tree/4.15.0) (2022-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.14.0...4.15.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#668](https://github.com/recurly/recurly-client-php/pull/668) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.14.0](https://github.com/recurly/recurly-client-php/tree/4.14.0) (2022-03-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.13.0...4.14.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#664](https://github.com/recurly/recurly-client-php/pull/664) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.13.0](https://github.com/recurly/recurly-client-php/tree/4.13.0) (2022-01-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.12.0...4.13.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#655](https://github.com/recurly/recurly-client-php/pull/655) ([recurly-integrations](https://github.com/recurly-integrations)) - Add region argument to client to connect in EU data center [#653](https://github.com/recurly/recurly-client-php/pull/653) ([FabricioCoutinho](https://github.com/FabricioCoutinho)) ## [4.12.0](https://github.com/recurly/recurly-client-php/tree/4.12.0) (2022-01-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.11.0...4.12.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Invoice Customization) [#654](https://github.com/recurly/recurly-client-php/pull/654) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#651](https://github.com/recurly/recurly-client-php/pull/651) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.11.0](https://github.com/recurly/recurly-client-php/tree/4.11.0) (2021-12-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.10.0...4.11.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Tax Inclusive Pricing) [#650](https://github.com/recurly/recurly-client-php/pull/650) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.10.0](https://github.com/recurly/recurly-client-php/tree/4.10.0) (2021-11-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.9.0...4.10.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#647](https://github.com/recurly/recurly-client-php/pull/647) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#645](https://github.com/recurly/recurly-client-php/pull/645) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#644](https://github.com/recurly/recurly-client-php/pull/644) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#639](https://github.com/recurly/recurly-client-php/pull/639) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.9.0](https://github.com/recurly/recurly-client-php/tree/4.9.0) (2021-09-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.8.0...4.9.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Support to new subscription fields and response) [#633](https://github.com/recurly/recurly-client-php/pull/633) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.8.0](https://github.com/recurly/recurly-client-php/tree/4.8.0) (2021-09-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.7.0...4.8.0) diff --git a/composer.json b/composer.json index 43cd216..359d8f3 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,38 @@ { "name": "recurly/recurly-client", - "version": "4.52.0", + "version": "4.53.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], "homepage": "https://github.com/recurly/recurly-client-php", "license": "MIT", "authors": [], "require": { "php": ">= 7.2.0", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "phpcompatibility/php-compatibility": "^9.3", "phpdocumentor/phpdocumentor": "~3.0.0", "phpstan/phpstan": "^0.12.11", "phpunit/phpunit": "^8", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "classmap": ["lib"], "files": ["lib/recurly.php"] }, "autoload-dev": { "classmap": ["tests"] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/lib/recurly/version.php b/lib/recurly/version.php index 78a02c7..ea9076a 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -1,8 +1,8 @@ <?php namespace Recurly; class Version { - public const CURRENT = '4.52.0'; + public const CURRENT = '4.53.0'; }
recurly/recurly-client-php
afe13eb6e713f732717de2f68310cf6013c473fe
4.52.0
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 1f76bcc..0b6f809 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 4.51.0 +current_version = 4.52.0 parse = (?P<major>\d+) \.(?P<minor>\d+) \.(?P<patch>\d+) serialize = {major}.{minor}.{patch} [bumpversion:file:composer.json] [bumpversion:file:lib/recurly/version.php] diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c8845e..60f8a53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,514 +1,525 @@ # Changelog +## [4.52.0](https://github.com/recurly/recurly-client-php/tree/4.52.0) (2024-07-03) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.51.0...4.52.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 (Taxable Address Control, RevRec) [#817](https://github.com/recurly/recurly-client-php/pull/817) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.51.0](https://github.com/recurly/recurly-client-php/tree/4.51.0) (2024-05-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.50.0...4.51.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#814](https://github.com/recurly/recurly-client-php/pull/814) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.50.0](https://github.com/recurly/recurly-client-php/tree/4.50.0) (2024-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.49.0...4.50.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entity Use Code) [#812](https://github.com/recurly/recurly-client-php/pull/812) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.49.0](https://github.com/recurly/recurly-client-php/tree/4.49.0) (2024-05-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.48.0...4.49.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Proration Settings) [#810](https://github.com/recurly/recurly-client-php/pull/810) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.48.0](https://github.com/recurly/recurly-client-php/tree/4.48.0) (2024-05-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.47.0...4.48.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Auth & Capture) [#808](https://github.com/recurly/recurly-client-php/pull/808) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.47.0](https://github.com/recurly/recurly-client-php/tree/4.47.0) (2024-03-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.46.0...4.47.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#803](https://github.com/recurly/recurly-client-php/pull/803) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.46.0](https://github.com/recurly/recurly-client-php/tree/4.46.0) (2024-02-20) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.45.0...4.46.0) **Merged Pull Requests** - Add invoice state param for v2021-02-25 [#799](https://github.com/recurly/recurly-client-php/pull/799) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.45.0](https://github.com/recurly/recurly-client-php/tree/4.45.0) (2024-01-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.44.0...4.45.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#789](https://github.com/recurly/recurly-client-php/pull/789) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.44.0](https://github.com/recurly/recurly-client-php/tree/4.44.0) (2024-01-18) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.43.0...4.44.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#788](https://github.com/recurly/recurly-client-php/pull/788) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.43.0](https://github.com/recurly/recurly-client-php/tree/4.43.0) (2023-12-06) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.42.0...4.43.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Payment Phases) [#785](https://github.com/recurly/recurly-client-php/pull/785) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.42.0](https://github.com/recurly/recurly-client-php/tree/4.42.0) (2023-11-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.41.0...4.42.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#783](https://github.com/recurly/recurly-client-php/pull/783) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.41.0](https://github.com/recurly/recurly-client-php/tree/4.41.0) (2023-08-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.40.0...4.41.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (`VATNumber`, `LifecycleDecline`) [#782](https://github.com/recurly/recurly-client-php/pull/782) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.40.0](https://github.com/recurly/recurly-client-php/tree/4.40.0) (2023-08-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.39.0...4.40.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (action_result) [#781](https://github.com/recurly/recurly-client-php/pull/781) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.39.0](https://github.com/recurly/recurly-client-php/tree/4.39.0) (2023-07-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.37.0...4.39.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Ramp Dates, Net Terms, Invoice Business Entity) [#779](https://github.com/recurly/recurly-client-php/pull/779) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (App Management - External Subscriptions) [#777](https://github.com/recurly/recurly-client-php/pull/777) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.37.0](https://github.com/recurly/recurly-client-php/tree/4.37.0) (2023-06-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.36.0...4.37.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Multiple Business Entities) [#769](https://github.com/recurly/recurly-client-php/pull/769) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.36.0](https://github.com/recurly/recurly-client-php/tree/4.36.0) (2023-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.35.0...4.36.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Products & References) [#766](https://github.com/recurly/recurly-client-php/pull/766) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.35.0](https://github.com/recurly/recurly-client-php/tree/4.35.0) (2023-05-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.34.0...4.35.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (gateway_attributes on PaymentMethod) [#764](https://github.com/recurly/recurly-client-php/pull/764) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#747](https://github.com/recurly/recurly-client-php/pull/747) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.28.0](https://github.com/recurly/recurly-client-php/tree/4.28.0) (2023-02-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.27.0...4.28.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (GiftCard endpoints and new transaction error support) [#745](https://github.com/recurly/recurly-client-php/pull/745) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.27.0](https://github.com/recurly/recurly-client-php/tree/4.27.0) (2023-01-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.26.0...4.27.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Custom Fields on Line Items) [#738](https://github.com/recurly/recurly-client-php/pull/738) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.26.0](https://github.com/recurly/recurly-client-php/tree/4.26.0) (2023-01-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.25.0...4.26.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Account Preferred Time Zone) [#736](https://github.com/recurly/recurly-client-php/pull/736) ([douglasmiller](https://github.com/douglasmiller)) ## [4.25.0](https://github.com/recurly/recurly-client-php/tree/4.25.0) (2022-11-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.24.0...4.25.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Apply Credit Balance feature) [#732](https://github.com/recurly/recurly-client-php/pull/732) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.24.0](https://github.com/recurly/recurly-client-php/tree/4.24.0) (2022-11-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.23.0...4.24.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Subscriptions feature) [#729](https://github.com/recurly/recurly-client-php/pull/729) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#728](https://github.com/recurly/recurly-client-php/pull/728) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.23.0](https://github.com/recurly/recurly-client-php/tree/4.23.0) (2022-10-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.22.0...4.23.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entitlements feature) [#725](https://github.com/recurly/recurly-client-php/pull/725) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.22.0](https://github.com/recurly/recurly-client-php/tree/4.22.0) (2022-10-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.2...4.22.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25(Decimal Usage and Quantities and DunningEvent new fields) [#722](https://github.com/recurly/recurly-client-php/pull/722) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.2](https://github.com/recurly/recurly-client-php/tree/4.21.2) (2022-09-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.1...4.21.2) **Merged Pull Requests** - feat: allow for psr/log ^2/3 [#716](https://github.com/recurly/recurly-client-php/pull/716) ([trickeyone](https://github.com/trickeyone)) ## [4.21.1](https://github.com/recurly/recurly-client-php/tree/4.21.1) (2022-09-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.0...4.21.1) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#714](https://github.com/recurly/recurly-client-php/pull/714) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.0](https://github.com/recurly/recurly-client-php/tree/4.21.0) (2022-09-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.20.0...4.21.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#713](https://github.com/recurly/recurly-client-php/pull/713) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixes bug with putDunningCampaignBulkUpdate [#706](https://github.com/recurly/recurly-client-php/pull/706) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.20.0](https://github.com/recurly/recurly-client-php/tree/4.20.0) (2022-08-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.19.0...4.20.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#701](https://github.com/recurly/recurly-client-php/pull/701) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.19.0](https://github.com/recurly/recurly-client-php/tree/4.19.0) (2022-07-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.18.0...4.19.0) **Merged Pull Requests** - Fixing deprecation warnings in client [#697](https://github.com/recurly/recurly-client-php/pull/697) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#695](https://github.com/recurly/recurly-client-php/pull/695) ([recurly-integrations](https://github.com/recurly-integrations)) **Closed Issues** - Recurly\Pager and \Iterator return type mismatch (PHP 8.1 deprecation) [#677](https://github.com/recurly/recurly-client-php/issues/677) ## [4.18.0](https://github.com/recurly/recurly-client-php/tree/4.18.0) (2022-06-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.17.0...4.18.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#693](https://github.com/recurly/recurly-client-php/pull/693) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.17.0](https://github.com/recurly/recurly-client-php/tree/4.17.0) (2022-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.16.0...4.17.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#679](https://github.com/recurly/recurly-client-php/pull/679) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.16.0](https://github.com/recurly/recurly-client-php/tree/4.16.0) (2022-03-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.15.0...4.16.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#676](https://github.com/recurly/recurly-client-php/pull/676) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.15.0](https://github.com/recurly/recurly-client-php/tree/4.15.0) (2022-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.14.0...4.15.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#668](https://github.com/recurly/recurly-client-php/pull/668) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.14.0](https://github.com/recurly/recurly-client-php/tree/4.14.0) (2022-03-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.13.0...4.14.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#664](https://github.com/recurly/recurly-client-php/pull/664) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.13.0](https://github.com/recurly/recurly-client-php/tree/4.13.0) (2022-01-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.12.0...4.13.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#655](https://github.com/recurly/recurly-client-php/pull/655) ([recurly-integrations](https://github.com/recurly-integrations)) - Add region argument to client to connect in EU data center [#653](https://github.com/recurly/recurly-client-php/pull/653) ([FabricioCoutinho](https://github.com/FabricioCoutinho)) ## [4.12.0](https://github.com/recurly/recurly-client-php/tree/4.12.0) (2022-01-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.11.0...4.12.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Invoice Customization) [#654](https://github.com/recurly/recurly-client-php/pull/654) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#651](https://github.com/recurly/recurly-client-php/pull/651) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.11.0](https://github.com/recurly/recurly-client-php/tree/4.11.0) (2021-12-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.10.0...4.11.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Tax Inclusive Pricing) [#650](https://github.com/recurly/recurly-client-php/pull/650) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.10.0](https://github.com/recurly/recurly-client-php/tree/4.10.0) (2021-11-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.9.0...4.10.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#647](https://github.com/recurly/recurly-client-php/pull/647) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#645](https://github.com/recurly/recurly-client-php/pull/645) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#644](https://github.com/recurly/recurly-client-php/pull/644) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#639](https://github.com/recurly/recurly-client-php/pull/639) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.9.0](https://github.com/recurly/recurly-client-php/tree/4.9.0) (2021-09-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.8.0...4.9.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Support to new subscription fields and response) [#633](https://github.com/recurly/recurly-client-php/pull/633) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.8.0](https://github.com/recurly/recurly-client-php/tree/4.8.0) (2021-09-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.7.0...4.8.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Dunning Campaigns feature) [#632](https://github.com/recurly/recurly-client-php/pull/632) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.7.0](https://github.com/recurly/recurly-client-php/tree/4.7.0) (2021-08-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.6.0...4.7.0) diff --git a/composer.json b/composer.json index 363a227..43cd216 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,38 @@ { "name": "recurly/recurly-client", - "version": "4.51.0", + "version": "4.52.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], "homepage": "https://github.com/recurly/recurly-client-php", "license": "MIT", "authors": [], "require": { "php": ">= 7.2.0", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "phpcompatibility/php-compatibility": "^9.3", "phpdocumentor/phpdocumentor": "~3.0.0", "phpstan/phpstan": "^0.12.11", "phpunit/phpunit": "^8", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "classmap": ["lib"], "files": ["lib/recurly.php"] }, "autoload-dev": { "classmap": ["tests"] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/lib/recurly/version.php b/lib/recurly/version.php index aff338a..78a02c7 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -1,8 +1,8 @@ <?php namespace Recurly; class Version { - public const CURRENT = '4.51.0'; + public const CURRENT = '4.52.0'; }
recurly/recurly-client-php
f0162febb537d556e54fd6c2716a84c2038076db
4.51.0
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 25229e6..1f76bcc 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 4.50.0 +current_version = 4.51.0 parse = (?P<major>\d+) \.(?P<minor>\d+) \.(?P<patch>\d+) serialize = {major}.{minor}.{patch} [bumpversion:file:composer.json] [bumpversion:file:lib/recurly/version.php] diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dc12b1..8c8845e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,514 +1,525 @@ # Changelog +## [4.51.0](https://github.com/recurly/recurly-client-php/tree/4.51.0) (2024-05-31) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.50.0...4.51.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 [#814](https://github.com/recurly/recurly-client-php/pull/814) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.50.0](https://github.com/recurly/recurly-client-php/tree/4.50.0) (2024-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.49.0...4.50.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entity Use Code) [#812](https://github.com/recurly/recurly-client-php/pull/812) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.49.0](https://github.com/recurly/recurly-client-php/tree/4.49.0) (2024-05-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.48.0...4.49.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Proration Settings) [#810](https://github.com/recurly/recurly-client-php/pull/810) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.48.0](https://github.com/recurly/recurly-client-php/tree/4.48.0) (2024-05-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.47.0...4.48.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Auth & Capture) [#808](https://github.com/recurly/recurly-client-php/pull/808) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.47.0](https://github.com/recurly/recurly-client-php/tree/4.47.0) (2024-03-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.46.0...4.47.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#803](https://github.com/recurly/recurly-client-php/pull/803) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.46.0](https://github.com/recurly/recurly-client-php/tree/4.46.0) (2024-02-20) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.45.0...4.46.0) **Merged Pull Requests** - Add invoice state param for v2021-02-25 [#799](https://github.com/recurly/recurly-client-php/pull/799) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.45.0](https://github.com/recurly/recurly-client-php/tree/4.45.0) (2024-01-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.44.0...4.45.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#789](https://github.com/recurly/recurly-client-php/pull/789) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.44.0](https://github.com/recurly/recurly-client-php/tree/4.44.0) (2024-01-18) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.43.0...4.44.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#788](https://github.com/recurly/recurly-client-php/pull/788) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.43.0](https://github.com/recurly/recurly-client-php/tree/4.43.0) (2023-12-06) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.42.0...4.43.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Payment Phases) [#785](https://github.com/recurly/recurly-client-php/pull/785) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.42.0](https://github.com/recurly/recurly-client-php/tree/4.42.0) (2023-11-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.41.0...4.42.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#783](https://github.com/recurly/recurly-client-php/pull/783) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.41.0](https://github.com/recurly/recurly-client-php/tree/4.41.0) (2023-08-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.40.0...4.41.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (`VATNumber`, `LifecycleDecline`) [#782](https://github.com/recurly/recurly-client-php/pull/782) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.40.0](https://github.com/recurly/recurly-client-php/tree/4.40.0) (2023-08-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.39.0...4.40.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (action_result) [#781](https://github.com/recurly/recurly-client-php/pull/781) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.39.0](https://github.com/recurly/recurly-client-php/tree/4.39.0) (2023-07-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.37.0...4.39.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Ramp Dates, Net Terms, Invoice Business Entity) [#779](https://github.com/recurly/recurly-client-php/pull/779) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (App Management - External Subscriptions) [#777](https://github.com/recurly/recurly-client-php/pull/777) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.37.0](https://github.com/recurly/recurly-client-php/tree/4.37.0) (2023-06-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.36.0...4.37.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Multiple Business Entities) [#769](https://github.com/recurly/recurly-client-php/pull/769) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.36.0](https://github.com/recurly/recurly-client-php/tree/4.36.0) (2023-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.35.0...4.36.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Products & References) [#766](https://github.com/recurly/recurly-client-php/pull/766) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.35.0](https://github.com/recurly/recurly-client-php/tree/4.35.0) (2023-05-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.34.0...4.35.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (gateway_attributes on PaymentMethod) [#764](https://github.com/recurly/recurly-client-php/pull/764) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#747](https://github.com/recurly/recurly-client-php/pull/747) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.28.0](https://github.com/recurly/recurly-client-php/tree/4.28.0) (2023-02-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.27.0...4.28.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (GiftCard endpoints and new transaction error support) [#745](https://github.com/recurly/recurly-client-php/pull/745) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.27.0](https://github.com/recurly/recurly-client-php/tree/4.27.0) (2023-01-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.26.0...4.27.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Custom Fields on Line Items) [#738](https://github.com/recurly/recurly-client-php/pull/738) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.26.0](https://github.com/recurly/recurly-client-php/tree/4.26.0) (2023-01-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.25.0...4.26.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Account Preferred Time Zone) [#736](https://github.com/recurly/recurly-client-php/pull/736) ([douglasmiller](https://github.com/douglasmiller)) ## [4.25.0](https://github.com/recurly/recurly-client-php/tree/4.25.0) (2022-11-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.24.0...4.25.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Apply Credit Balance feature) [#732](https://github.com/recurly/recurly-client-php/pull/732) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.24.0](https://github.com/recurly/recurly-client-php/tree/4.24.0) (2022-11-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.23.0...4.24.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Subscriptions feature) [#729](https://github.com/recurly/recurly-client-php/pull/729) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#728](https://github.com/recurly/recurly-client-php/pull/728) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.23.0](https://github.com/recurly/recurly-client-php/tree/4.23.0) (2022-10-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.22.0...4.23.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entitlements feature) [#725](https://github.com/recurly/recurly-client-php/pull/725) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.22.0](https://github.com/recurly/recurly-client-php/tree/4.22.0) (2022-10-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.2...4.22.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25(Decimal Usage and Quantities and DunningEvent new fields) [#722](https://github.com/recurly/recurly-client-php/pull/722) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.2](https://github.com/recurly/recurly-client-php/tree/4.21.2) (2022-09-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.1...4.21.2) **Merged Pull Requests** - feat: allow for psr/log ^2/3 [#716](https://github.com/recurly/recurly-client-php/pull/716) ([trickeyone](https://github.com/trickeyone)) ## [4.21.1](https://github.com/recurly/recurly-client-php/tree/4.21.1) (2022-09-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.0...4.21.1) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#714](https://github.com/recurly/recurly-client-php/pull/714) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.0](https://github.com/recurly/recurly-client-php/tree/4.21.0) (2022-09-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.20.0...4.21.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#713](https://github.com/recurly/recurly-client-php/pull/713) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixes bug with putDunningCampaignBulkUpdate [#706](https://github.com/recurly/recurly-client-php/pull/706) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.20.0](https://github.com/recurly/recurly-client-php/tree/4.20.0) (2022-08-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.19.0...4.20.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#701](https://github.com/recurly/recurly-client-php/pull/701) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.19.0](https://github.com/recurly/recurly-client-php/tree/4.19.0) (2022-07-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.18.0...4.19.0) **Merged Pull Requests** - Fixing deprecation warnings in client [#697](https://github.com/recurly/recurly-client-php/pull/697) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#695](https://github.com/recurly/recurly-client-php/pull/695) ([recurly-integrations](https://github.com/recurly-integrations)) **Closed Issues** - Recurly\Pager and \Iterator return type mismatch (PHP 8.1 deprecation) [#677](https://github.com/recurly/recurly-client-php/issues/677) ## [4.18.0](https://github.com/recurly/recurly-client-php/tree/4.18.0) (2022-06-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.17.0...4.18.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#693](https://github.com/recurly/recurly-client-php/pull/693) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.17.0](https://github.com/recurly/recurly-client-php/tree/4.17.0) (2022-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.16.0...4.17.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#679](https://github.com/recurly/recurly-client-php/pull/679) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.16.0](https://github.com/recurly/recurly-client-php/tree/4.16.0) (2022-03-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.15.0...4.16.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#676](https://github.com/recurly/recurly-client-php/pull/676) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.15.0](https://github.com/recurly/recurly-client-php/tree/4.15.0) (2022-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.14.0...4.15.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#668](https://github.com/recurly/recurly-client-php/pull/668) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.14.0](https://github.com/recurly/recurly-client-php/tree/4.14.0) (2022-03-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.13.0...4.14.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#664](https://github.com/recurly/recurly-client-php/pull/664) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.13.0](https://github.com/recurly/recurly-client-php/tree/4.13.0) (2022-01-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.12.0...4.13.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#655](https://github.com/recurly/recurly-client-php/pull/655) ([recurly-integrations](https://github.com/recurly-integrations)) - Add region argument to client to connect in EU data center [#653](https://github.com/recurly/recurly-client-php/pull/653) ([FabricioCoutinho](https://github.com/FabricioCoutinho)) ## [4.12.0](https://github.com/recurly/recurly-client-php/tree/4.12.0) (2022-01-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.11.0...4.12.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Invoice Customization) [#654](https://github.com/recurly/recurly-client-php/pull/654) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#651](https://github.com/recurly/recurly-client-php/pull/651) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.11.0](https://github.com/recurly/recurly-client-php/tree/4.11.0) (2021-12-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.10.0...4.11.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Tax Inclusive Pricing) [#650](https://github.com/recurly/recurly-client-php/pull/650) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.10.0](https://github.com/recurly/recurly-client-php/tree/4.10.0) (2021-11-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.9.0...4.10.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#647](https://github.com/recurly/recurly-client-php/pull/647) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#645](https://github.com/recurly/recurly-client-php/pull/645) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#644](https://github.com/recurly/recurly-client-php/pull/644) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#639](https://github.com/recurly/recurly-client-php/pull/639) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.9.0](https://github.com/recurly/recurly-client-php/tree/4.9.0) (2021-09-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.8.0...4.9.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Support to new subscription fields and response) [#633](https://github.com/recurly/recurly-client-php/pull/633) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.8.0](https://github.com/recurly/recurly-client-php/tree/4.8.0) (2021-09-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.7.0...4.8.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Dunning Campaigns feature) [#632](https://github.com/recurly/recurly-client-php/pull/632) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.7.0](https://github.com/recurly/recurly-client-php/tree/4.7.0) (2021-08-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.6.0...4.7.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (get_preview_renewal) [#630](https://github.com/recurly/recurly-client-php/pull/630) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.6.0](https://github.com/recurly/recurly-client-php/tree/4.6.0) (2021-08-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.5.0...4.6.0) diff --git a/composer.json b/composer.json index 479ec9b..363a227 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,38 @@ { "name": "recurly/recurly-client", - "version": "4.50.0", + "version": "4.51.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], "homepage": "https://github.com/recurly/recurly-client-php", "license": "MIT", "authors": [], "require": { "php": ">= 7.2.0", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "phpcompatibility/php-compatibility": "^9.3", "phpdocumentor/phpdocumentor": "~3.0.0", "phpstan/phpstan": "^0.12.11", "phpunit/phpunit": "^8", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "classmap": ["lib"], "files": ["lib/recurly.php"] }, "autoload-dev": { "classmap": ["tests"] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/lib/recurly/version.php b/lib/recurly/version.php index c99442e..aff338a 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -1,8 +1,8 @@ <?php namespace Recurly; class Version { - public const CURRENT = '4.50.0'; + public const CURRENT = '4.51.0'; }
recurly/recurly-client-php
557153b91e2d30907426d135e099c19f3fee276d
Generated Latest Changes for v2021-02-25
diff --git a/lib/recurly/resources/external_subscription.php b/lib/recurly/resources/external_subscription.php index 3dee09e..62274dc 100644 --- a/lib/recurly/resources/external_subscription.php +++ b/lib/recurly/resources/external_subscription.php @@ -1,475 +1,475 @@ <?php /** * This file is automatically created by Recurly's OpenAPI generation process * and thus any edits you make by hand will be lost. If you wish to make a * change to this file, please create a Github issue explaining the changes you * need and we will usher them to the appropriate places. */ namespace Recurly\Resources; use Recurly\RecurlyResource; // phpcs:disable class ExternalSubscription extends RecurlyResource { private $_account; private $_activated_at; private $_app_identifier; private $_auto_renew; private $_canceled_at; private $_created_at; private $_expires_at; private $_external_id; private $_external_product_reference; private $_id; private $_in_grace_period; private $_last_purchased; private $_object; private $_quantity; private $_state; private $_test; private $_trial_ends_at; private $_trial_started_at; private $_updated_at; protected static $array_hints = [ ]; /** * Getter method for the account attribute. * Account mini details * * @return ?\Recurly\Resources\AccountMini */ public function getAccount(): ?\Recurly\Resources\AccountMini { return $this->_account; } /** * Setter method for the account attribute. * * @param \Recurly\Resources\AccountMini $account * * @return void */ public function setAccount(\Recurly\Resources\AccountMini $account): void { $this->_account = $account; } /** * Getter method for the activated_at attribute. * When the external subscription was activated in the external platform. * * @return ?string */ public function getActivatedAt(): ?string { return $this->_activated_at; } /** * Setter method for the activated_at attribute. * * @param string $activated_at * * @return void */ public function setActivatedAt(string $activated_at): void { $this->_activated_at = $activated_at; } /** * Getter method for the app_identifier attribute. * Identifier of the app that generated the external subscription. * * @return ?string */ public function getAppIdentifier(): ?string { return $this->_app_identifier; } /** * Setter method for the app_identifier attribute. * * @param string $app_identifier * * @return void */ public function setAppIdentifier(string $app_identifier): void { $this->_app_identifier = $app_identifier; } /** * Getter method for the auto_renew attribute. * An indication of whether or not the external subscription will auto-renew at the expiration date. * * @return ?bool */ public function getAutoRenew(): ?bool { return $this->_auto_renew; } /** * Setter method for the auto_renew attribute. * * @param bool $auto_renew * * @return void */ public function setAutoRenew(bool $auto_renew): void { $this->_auto_renew = $auto_renew; } /** * Getter method for the canceled_at attribute. * When the external subscription was canceled in the external platform. * * @return ?string */ public function getCanceledAt(): ?string { return $this->_canceled_at; } /** * Setter method for the canceled_at attribute. * * @param string $canceled_at * * @return void */ public function setCanceledAt(string $canceled_at): void { $this->_canceled_at = $canceled_at; } /** * Getter method for the created_at attribute. * When the external subscription was created in Recurly. * * @return ?string */ public function getCreatedAt(): ?string { return $this->_created_at; } /** * Setter method for the created_at attribute. * * @param string $created_at * * @return void */ public function setCreatedAt(string $created_at): void { $this->_created_at = $created_at; } /** * Getter method for the expires_at attribute. * When the external subscription expires in the external platform. * * @return ?string */ public function getExpiresAt(): ?string { return $this->_expires_at; } /** * Setter method for the expires_at attribute. * * @param string $expires_at * * @return void */ public function setExpiresAt(string $expires_at): void { $this->_expires_at = $expires_at; } /** * Getter method for the external_id attribute. * The id of the subscription in the external systems., I.e. Apple App Store or Google Play Store. * * @return ?string */ public function getExternalId(): ?string { return $this->_external_id; } /** * Setter method for the external_id attribute. * * @param string $external_id * * @return void */ public function setExternalId(string $external_id): void { $this->_external_id = $external_id; } /** * Getter method for the external_product_reference attribute. * External Product Reference details * * @return ?\Recurly\Resources\ExternalProductReferenceMini */ public function getExternalProductReference(): ?\Recurly\Resources\ExternalProductReferenceMini { return $this->_external_product_reference; } /** * Setter method for the external_product_reference attribute. * * @param \Recurly\Resources\ExternalProductReferenceMini $external_product_reference * * @return void */ public function setExternalProductReference(\Recurly\Resources\ExternalProductReferenceMini $external_product_reference): void { $this->_external_product_reference = $external_product_reference; } /** * Getter method for the id attribute. * System-generated unique identifier for an external subscription ID, e.g. `e28zov4fw0v2`. * * @return ?string */ public function getId(): ?string { return $this->_id; } /** * Setter method for the id attribute. * * @param string $id * * @return void */ public function setId(string $id): void { $this->_id = $id; } /** * Getter method for the in_grace_period attribute. * An indication of whether or not the external subscription is in a grace period. * * @return ?bool */ public function getInGracePeriod(): ?bool { return $this->_in_grace_period; } /** * Setter method for the in_grace_period attribute. * * @param bool $in_grace_period * * @return void */ public function setInGracePeriod(bool $in_grace_period): void { $this->_in_grace_period = $in_grace_period; } /** * Getter method for the last_purchased attribute. * When a new billing event occurred on the external subscription in conjunction with a recent billing period, reactivation or upgrade/downgrade. * * @return ?string */ public function getLastPurchased(): ?string { return $this->_last_purchased; } /** * Setter method for the last_purchased attribute. * * @param string $last_purchased * * @return void */ public function setLastPurchased(string $last_purchased): void { $this->_last_purchased = $last_purchased; } /** * Getter method for the object attribute. * Object type * * @return ?string */ public function getObject(): ?string { return $this->_object; } /** * Setter method for the object attribute. * * @param string $object * * @return void */ public function setObject(string $object): void { $this->_object = $object; } /** * Getter method for the quantity attribute. * An indication of the quantity of a subscribed item's quantity. * * @return ?int */ public function getQuantity(): ?int { return $this->_quantity; } /** * Setter method for the quantity attribute. * * @param int $quantity * * @return void */ public function setQuantity(int $quantity): void { $this->_quantity = $quantity; } /** * Getter method for the state attribute. - * External subscriptions can be active, canceled, expired, or past_due. + * External subscriptions can be active, canceled, expired, past_due, voided, revoked, or paused. * * @return ?string */ public function getState(): ?string { return $this->_state; } /** * Setter method for the state attribute. * * @param string $state * * @return void */ public function setState(string $state): void { $this->_state = $state; } /** * Getter method for the test attribute. * An indication of whether or not the external subscription was purchased in a sandbox environment. * * @return ?bool */ public function getTest(): ?bool { return $this->_test; } /** * Setter method for the test attribute. * * @param bool $test * * @return void */ public function setTest(bool $test): void { $this->_test = $test; } /** * Getter method for the trial_ends_at attribute. * When the external subscription trial period ends in the external platform. * * @return ?string */ public function getTrialEndsAt(): ?string { return $this->_trial_ends_at; } /** * Setter method for the trial_ends_at attribute. * * @param string $trial_ends_at * * @return void */ public function setTrialEndsAt(string $trial_ends_at): void { $this->_trial_ends_at = $trial_ends_at; } /** * Getter method for the trial_started_at attribute. * When the external subscription trial period started in the external platform. * * @return ?string */ public function getTrialStartedAt(): ?string { return $this->_trial_started_at; } /** * Setter method for the trial_started_at attribute. * * @param string $trial_started_at * * @return void */ public function setTrialStartedAt(string $trial_started_at): void { $this->_trial_started_at = $trial_started_at; } /** * Getter method for the updated_at attribute. * When the external subscription was updated in Recurly. * * @return ?string */ public function getUpdatedAt(): ?string { return $this->_updated_at; } /** * Setter method for the updated_at attribute. * * @param string $updated_at * * @return void */ public function setUpdatedAt(string $updated_at): void { $this->_updated_at = $updated_at; } } \ No newline at end of file diff --git a/openapi/api.yaml b/openapi/api.yaml index 08c63a4..29d475d 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -19368,1024 +19368,1029 @@ components: title: External SKU description: Optional, stock keeping unit to link the item to other inventory systems. maxLength: 50 accounting_code: type: string title: Item accounting code description: Accounting code for invoice line items. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 tax_code: type: string title: Tax code description: Used by Avalara, Vertex, and Recurly’s EU VAT tax feature. The tax code values are specific to each tax system. If you are using Recurly’s EU VAT feature you can use `unknown`, `physical`, or `digital`. maxLength: 50 tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on the item, `false` applies tax on the item." custom_fields: "$ref": "#/components/schemas/CustomFields" currencies: type: array title: Item Pricing items: "$ref": "#/components/schemas/Pricing" required: - code - name ItemUpdate: type: object properties: code: type: string title: Item code description: Unique code to identify the item. pattern: "/^[a-z0-9_+-]+$/" maxLength: 50 name: type: string title: Name description: This name describes your item and will appear on the invoice when it's purchased on a one time basis. maxLength: 255 description: type: string title: Description description: Optional, description. external_sku: type: string title: External SKU description: Optional, stock keeping unit to link the item to other inventory systems. maxLength: 50 accounting_code: type: string title: Item accounting code description: Accounting code for invoice line items. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 tax_code: type: string title: Tax code description: Used by Avalara, Vertex, and Recurly’s EU VAT tax feature. The tax code values are specific to each tax system. If you are using Recurly’s EU VAT feature you can use `unknown`, `physical`, or `digital`. maxLength: 50 tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on the item, `false` applies tax on the item." custom_fields: "$ref": "#/components/schemas/CustomFields" currencies: type: array title: Item Pricing items: "$ref": "#/components/schemas/Pricing" Invoice: type: object properties: id: type: string title: Invoice ID readOnly: true uuid: type: string title: Invoice UUID readOnly: true object: type: string title: Object type readOnly: true type: title: Invoice type description: Invoices are either charge, credit, or legacy invoices. "$ref": "#/components/schemas/InvoiceTypeEnum" origin: title: Origin description: The event that created the invoice. "$ref": "#/components/schemas/OriginEnum" state: title: Invoice state "$ref": "#/components/schemas/InvoiceStateEnum" account: "$ref": "#/components/schemas/AccountMini" billing_info_id: type: string title: Billing info ID description: The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. subscription_ids: type: array title: Subscription IDs description: If the invoice is charging or refunding for one or more subscriptions, these are their IDs. items: type: string title: Subscription ID maxLength: 13 previous_invoice_id: type: string title: Previous invoice ID description: On refund invoices, this value will exist and show the invoice ID of the purchase invoice the refund was created from. This field is only populated for sites without the [Only Bill What Changed](https://docs.recurly.com/docs/only-bill-what-changed) feature enabled. Sites with Only Bill What Changed enabled should use the [related_invoices endpoint](https://recurly.com/developers/api/v2021-02-25/index.html#operation/list_related_invoices) to see purchase invoices refunded by this invoice. maxLength: 13 number: type: string title: Invoice number description: 'If VAT taxation and the Country Invoice Sequencing feature are enabled, invoices will have country-specific invoice numbers for invoices billed to EU countries (ex: FR1001). Non-EU invoices will continue to use the site-level invoice number sequence.' collection_method: title: Collection method description: An automatic invoice means a corresponding transaction is run using the account's billing information at the same time the invoice is created. Manual invoices are created without a corresponding transaction. The merchant must enter a manual payment transaction or have the customer pay the invoice with an automatic method, like credit card, PayPal, Amazon, or ACH bank payment. default: automatic "$ref": "#/components/schemas/CollectionMethodEnum" po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Net terms description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" address: "$ref": "#/components/schemas/InvoiceAddress" shipping_address: "$ref": "#/components/schemas/ShippingAddress" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 discount: type: number format: float title: Discount description: Total discounts applied to this invoice. subtotal: type: number format: float title: Subtotal description: The summation of charges and credits, before discounts and taxes. tax: type: number format: float title: Tax description: The total tax on this invoice. total: type: number format: float title: Total description: The final total on this invoice. The summation of invoice charges, discounts, credits, and tax. refundable_amount: type: number format: float title: Refundable amount description: The refundable amount on a charge invoice. It will be null for all other invoices. paid: type: number format: float title: Paid description: The total amount of successful payments transaction on this invoice. balance: type: number format: float title: Balance description: The outstanding balance remaining on this invoice. tax_info: "$ref": "#/components/schemas/TaxInfo" used_tax_service: type: boolean title: Used Tax Service? description: Will be `true` when the invoice had a successful response from the tax service and `false` when the invoice was not sent to tax service due to a lack of address or enabled jurisdiction or was processed without tax due to a non-blocking error returned from the tax service. vat_number: type: string title: VAT number description: VAT registration number for the customer on this invoice. This will come from the VAT Number field in the Billing Info or the Account Info depending on your tax settings and the invoice collection method. maxLength: 20 vat_reverse_charge_notes: type: string title: VAT reverse charge notes description: VAT Reverse Charge Notes only appear if you have EU VAT enabled or are using your own Avalara AvaTax account and the customer is in the EU, has a VAT number, and is in a different country than your own. This will default to the VAT Reverse Charge Notes text specified on the Tax Settings page in your Recurly admin, unless custom notes were created with the original subscription. terms_and_conditions: type: string title: Terms and conditions description: This will default to the Terms and Conditions text specified on the Invoice Settings page in your Recurly admin. Specify custom notes to add or override Terms and Conditions. customer_notes: type: string title: Customer notes description: This will default to the Customer Notes text specified on the Invoice Settings. Specify custom notes to add or override Customer Notes. line_items: type: array title: Line Items items: "$ref": "#/components/schemas/LineItem" has_more_line_items: type: boolean title: Has more Line Items description: Identifies if the invoice has more line items than are returned in `line_items`. If `has_more_line_items` is `true`, then a request needs to be made to the `list_invoice_line_items` endpoint. transactions: type: array title: Transactions items: "$ref": "#/components/schemas/Transaction" credit_payments: type: array title: Credit payments items: "$ref": "#/components/schemas/CreditPayment" created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true due_at: type: string format: date-time title: Due at description: Date invoice is due. This is the date the net terms are reached. closed_at: type: string format: date-time title: Closed at description: Date invoice was marked paid or failed. dunning_campaign_id: type: string title: Dunning Campaign ID description: Unique ID to identify the dunning campaign used when dunning the invoice. For sites without multiple dunning campaigns enabled, this will always be the default dunning campaign. dunning_events_sent: type: integer title: Dunning Event Sent description: Number of times the event was sent. final_dunning_event: type: boolean title: Final Dunning Event description: Last communication attempt. business_entity_id: type: string title: Business Entity ID description: Unique ID to identify the business entity assigned to the invoice. Available when the `Multiple Business Entities` feature is enabled. InvoiceCreate: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 collection_method: title: Collection method description: An automatic invoice means a corresponding transaction is run using the account's billing information at the same time the invoice is created. Manual invoices are created without a corresponding transaction. The merchant must enter a manual payment transaction or have the customer pay the invoice with an automatic method, like credit card, PayPal, Amazon, or ACH bank payment. default: automatic "$ref": "#/components/schemas/CollectionMethodEnum" charge_customer_notes: type: string title: Charge customer notes description: This will default to the Customer Notes text specified on the Invoice Settings for charge invoices. Specify custom notes to add or override Customer Notes on charge invoices. credit_customer_notes: type: string title: Credit customer notes description: This will default to the Customer Notes text specified on the Invoice Settings for credit invoices. Specify customer notes to add or override Customer Notes on credit invoices. net_terms: type: integer title: Net terms description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 terms_and_conditions: type: string title: Terms and conditions description: This will default to the Terms and Conditions text specified on the Invoice Settings page in your Recurly admin. Specify custom notes to add or override Terms and Conditions. vat_reverse_charge_notes: type: string title: VAT reverse charge notes description: VAT Reverse Charge Notes only appear if you have EU VAT enabled or are using your own Avalara AvaTax account and the customer is in the EU, has a VAT number, and is in a different country than your own. This will default to the VAT Reverse Charge Notes text specified on the Tax Settings page in your Recurly admin, unless custom notes were created with the original subscription. required: - currency InvoiceCollect: type: object properties: three_d_secure_action_result_token_id: type: string title: 3-D Secure action result token ID description: A token generated by Recurly.js after completing a 3-D Secure device fingerprinting or authentication challenge. maxLength: 22 transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" billing_info_id: type: string title: Billing Info ID description: The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. InvoiceCollection: type: object title: Invoice collection properties: object: type: string title: Object type charge_invoice: "$ref": "#/components/schemas/Invoice" credit_invoices: type: array title: Credit invoices items: "$ref": "#/components/schemas/Invoice" InvoiceUpdate: type: object properties: po_number: type: string title: Purchase order number description: This identifies the PO number associated with the invoice. Not editable for credit invoices. maxLength: 50 vat_reverse_charge_notes: type: string title: VAT reverse charge notes description: VAT Reverse Charge Notes are editable only if there was a VAT reverse charge applied to the invoice. terms_and_conditions: type: string title: Terms and conditions description: Terms and conditions are an optional note field. Not editable for credit invoices. customer_notes: type: string title: Customer notes description: Customer notes are an optional note field. net_terms: type: integer title: Net terms description: Integer representing the number of days after an invoice's creation that the invoice will become past due. Changing Net terms changes due_on, and the invoice could move between past due and pending. minimum: 0 maximum: 999 address: "$ref": "#/components/schemas/InvoiceAddress" + gateway_code: + type: string + description: An alphanumeric code shown per gateway on your site's payment + gateways page. Set this code to ensure that a given invoice targets a + given gateway. InvoiceMini: type: object title: Invoice mini details properties: id: type: string title: Invoice ID maxLength: 13 object: type: string title: Object type number: type: string title: Invoice number business_entity_id: type: string title: Business Entity ID description: Unique ID to identify the business entity assigned to the invoice. Available when the `Multiple Business Entities` feature is enabled. type: title: Invoice type "$ref": "#/components/schemas/InvoiceTypeEnum" state: title: Invoice state "$ref": "#/components/schemas/InvoiceStateEnum" InvoiceRefund: type: object title: Invoice refund properties: type: title: Type description: The type of refund. Amount and line items cannot both be specified in the request. "$ref": "#/components/schemas/InvoiceRefundTypeEnum" amount: type: number format: float title: Amount description: | The amount to be refunded. The amount will be split between the line items. If no amount is specified, it will default to refunding the total refundable amount on the invoice. line_items: type: array title: Line items description: The line items to be refunded. This is required when `type=line_items`. items: "$ref": "#/components/schemas/LineItemRefund" refund_method: title: Refund method description: | Indicates how the invoice should be refunded when both a credit and transaction are present on the invoice: - `transaction_first` – Refunds the transaction first, then any amount is issued as credit back to the account. Default value when Credit Invoices feature is enabled. - `credit_first` – Issues credit back to the account first, then refunds any remaining amount back to the transaction. Default value when Credit Invoices feature is not enabled. - `all_credit` – Issues credit to the account for the entire amount of the refund. Only available when the Credit Invoices feature is enabled. - `all_transaction` – Refunds the entire amount back to transactions, using transactions from previous invoices if necessary. Only available when the Credit Invoices feature is enabled. default: credit_first "$ref": "#/components/schemas/RefuneMethodEnum" credit_customer_notes: type: string title: Credit customer notes description: | Used as the Customer Notes on the credit invoice. This field can only be include when the Credit Invoices feature is enabled. external_refund: type: object x-class-name: ExternalRefund description: | Indicates that the refund was settled outside of Recurly, and a manual transaction should be created to track it in Recurly. Required when: - refunding a manually collected charge invoice, and `refund_method` is not `all_credit` - refunding a credit invoice that refunded manually collecting invoices - refunding a credit invoice for a partial amount This field can only be included when the Credit Invoices feature is enabled. properties: payment_method: title: Payment Method description: Payment method used for external refund transaction. "$ref": "#/components/schemas/ExternalPaymentMethodEnum" description: type: string title: Description description: Used as the refund transactions' description. maxLength: 50 refunded_at: type: string format: date-time title: Refunded At description: Date the external refund payment was made. Defaults to the current date-time. required: - payment_method required: - type MeasuredUnit: type: object title: Measured unit properties: id: type: string title: Item ID maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true name: type: string title: Name description: Unique internal name of the measured unit on your site. display_name: type: string title: Display name description: Display name for the measured unit. Can only contain spaces, underscores and must be alphanumeric. maxLength: 50 state: title: State description: The current state of the measured unit. readOnly: true "$ref": "#/components/schemas/ActiveStateEnum" description: type: string title: Description description: Optional internal description. created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at readOnly: true MeasuredUnitCreate: type: object properties: name: type: string title: Name description: Unique internal name of the measured unit on your site. maxLength: 255 display_name: type: string title: Display name description: Display name for the measured unit. pattern: "/^[\\w ]+$/" maxLength: 50 description: type: string title: Description description: Optional internal description. required: - name - display_name MeasuredUnitUpdate: type: object properties: name: type: string title: Name description: Unique internal name of the measured unit on your site. maxLength: 255 display_name: type: string title: Display name description: Display name for the measured unit. pattern: "/^[\\w ]+$/" maxLength: 50 description: type: string title: Description description: Optional internal description. LineItem: type: object title: Line item properties: id: type: string title: Line item ID maxLength: 13 object: type: string title: Object type uuid: type: string title: UUID description: The UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI. maxLength: 32 type: title: Line item type description: Charges are positive line items that debit the account. Credits are negative line items that credit the account. "$ref": "#/components/schemas/LineItemTypeEnum" item_code: type: string title: Item Code description: Unique code to identify an item. Available when the Credit Invoices feature is enabled. pattern: "/^[a-z0-9_+-]+$/" maxLength: 50 item_id: type: string title: Item ID description: System-generated unique identifier for an item. Available when the Credit Invoices feature is enabled. maxLength: 13 external_sku: type: string title: External SKU description: Optional Stock Keeping Unit assigned to an item. Available when the Credit Invoices feature is enabled. maxLength: 50 revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/LineItemRevenueScheduleTypeEnum" state: title: Current state of the line item description: Pending line items are charges or credits on an account that have not been applied to an invoice yet. Invoiced line items will always have an `invoice_id` value. "$ref": "#/components/schemas/LineItemStateEnum" legacy_category: title: Legacy category description: | Category to describe the role of a line item on a legacy invoice: - "charges" refers to charges being billed for on this invoice. - "credits" refers to refund or proration credits. This portion of the invoice can be considered a credit memo. - "applied_credits" refers to previous credits applied to this invoice. See their original_line_item_id to determine where the credit first originated. - "carryforwards" can be ignored. They exist to consume any remaining credit balance. A new credit with the same amount will be created and placed back on the account. "$ref": "#/components/schemas/LegacyCategoryEnum" account: "$ref": "#/components/schemas/AccountMini" bill_for_account_id: type: string title: Bill For Account ID maxLength: 13 description: The UUID of the account responsible for originating the line item. subscription_id: type: string title: Subscription ID description: If the line item is a charge or credit for a subscription, this is its ID. maxLength: 13 plan_id: type: string title: Plan ID description: If the line item is a charge or credit for a plan or add-on, this is the plan's ID. maxLength: 13 plan_code: type: string title: Plan code description: If the line item is a charge or credit for a plan or add-on, this is the plan's code. maxLength: 50 add_on_id: type: string title: Add-on ID description: If the line item is a charge or credit for an add-on this is its ID. maxLength: 13 add_on_code: type: string title: Add-on code description: If the line item is a charge or credit for an add-on, this is its code. maxLength: 50 invoice_id: type: string title: Invoice ID description: Once the line item has been invoiced this will be the invoice's ID. maxLength: 13 invoice_number: type: string title: Invoice number description: 'Once the line item has been invoiced this will be the invoice''s number. If VAT taxation and the Country Invoice Sequencing feature are enabled, invoices will have country-specific invoice numbers for invoices billed to EU countries (ex: FR1001). Non-EU invoices will continue to use the site-level invoice number sequence.' previous_line_item_id: type: string title: Previous line item ID description: Will only have a value if the line item is a credit created from a previous credit, or if the credit was created from a charge refund. maxLength: 13 original_line_item_invoice_id: type: string title: Original line item's invoice ID description: The invoice where the credit originated. Will only have a value if the line item is a credit created from a previous credit, or if the credit was created from a charge refund. maxLength: 13 origin: title: Origin of line item description: A credit created from an original charge will have the value of the charge's origin. "$ref": "#/components/schemas/LineItemOriginEnum" accounting_code: type: string title: Accounting code description: Internal accounting code to help you reconcile your revenue to the correct ledger. Line items created as part of a subscription invoice will use the plan or add-on's accounting code, otherwise the value will only be present if you define an accounting code when creating the line item. maxLength: 20 product_code: type: string title: Product code description: For plan-related line items this will be the plan's code, for add-on related line items it will be the add-on's code. For item-related line items it will be the item's `external_sku`. maxLength: 50 credit_reason_code: title: Credit reason code description: The reason the credit was given when line item is `type=credit`. default: general "$ref": "#/components/schemas/FullCreditReasonCodeEnum" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 amount: type: number format: float title: Total after discounts and taxes description: "`(quantity * unit_amount) - (discount + tax)`" description: type: string title: Description description: Description that appears on the invoice. For subscription related items this will be filled in automatically. maxLength: 255 quantity: type: integer title: Quantity description: This number will be multiplied by the unit amount to compute the subtotal before any discounts or taxes. default: 1 quantity_decimal: type: string title: Quantity Decimal description: A floating-point alternative to Quantity. If this value is present, it will be used in place of Quantity for calculations, and Quantity will be the rounded integer value of this number. This field supports up to 9 decimal places. The Decimal Quantity feature must be enabled to utilize this field. unit_amount: type: number format: float title: Unit amount description: Positive amount for a charge, negative amount for a credit. unit_amount_decimal: type: string title: Unit amount decimal description: Positive amount for a charge, negative amount for a credit. tax_inclusive: type: boolean title: Tax Inclusive? description: Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to utilize this flag. subtotal: type: number format: float title: Total before discounts and taxes description: "`quantity * unit_amount`" discount: type: number format: float title: Discount description: The discount applied to the line item. tax: type: number format: float title: Tax description: The tax amount for the line item. taxable: type: boolean title: Taxable? description: "`true` if the line item is taxable, `false` if it is not." tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on charges, `false` applies tax on charges. If not defined, then defaults to the Plan and Site settings. This attribute does not work for credits (negative line items). Credits are always applied post-tax. Pre-tax discounts should use the Coupons feature." avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the line item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the line item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 tax_code: type: string title: Tax code description: Used by Avalara, Vertex, and Recurly’s EU VAT tax feature. The tax code values are specific to each tax system. If you are using Recurly’s EU VAT feature you can use `unknown`, `physical`, or `digital`. maxLength: 50 tax_info: "$ref": "#/components/schemas/TaxInfo" proration_rate: type: number format: float title: Proration rate description: When a line item has been prorated, this is the rate of the proration. Proration rates were made available for line items created after March 30, 2017. For line items created prior to that date, the proration rate will be `null`, even if the line item was prorated. minimum: 0 maximum: 1 refund: type: boolean title: Refund? refunded_quantity: type: integer title: Refunded Quantity description: For refund charges, the quantity being refunded. For non-refund charges, the total quantity refunded (possibly over multiple refunds). refunded_quantity_decimal: type: string title: Refunded Quantity Decimal description: A floating-point alternative to Refunded Quantity. For refund charges, the quantity being refunded. For non-refund charges, the total quantity refunded (possibly over multiple refunds). The Decimal Quantity feature must be enabled to utilize this field. credit_applied: type: number format: float title: Credit Applied description: The amount of credit from this line item that was applied to the invoice. shipping_address: "$ref": "#/components/schemas/ShippingAddress" start_date: type: string format: date-time title: Start date description: If an end date is present, this is value indicates the beginning of a billing time range. If no end date is present it indicates billing for a specific date. end_date: type: string format: date-time title: End date description: If this date is provided, it indicates the end of a time range. custom_fields: "$ref": "#/components/schemas/CustomFields" created_at: type: string format: date-time title: Created at description: When the line item was created. updated_at: type: string format: date-time title: Last updated at description: When the line item was last changed. LineItemRefund: type: object properties: id: type: string title: Line item ID maxLength: 13 quantity: type: integer title: Quantity description: Line item quantity to be refunded. quantity_decimal: type: string title: Quantity Decimal description: A floating-point alternative to Quantity. If this value is present, it will be used in place of Quantity for calculations, and Quantity will be the rounded integer value of this number. This field supports up to 9 decimal places. The Decimal Quantity feature must be enabled to utilize this field. prorate: type: boolean title: Prorate description: | Set to `true` if the line item should be prorated; set to `false` if not. This can only be used on line items that have a start and end date. default: false LineItemCreate: @@ -23800,1026 +23805,1026 @@ components: type: boolean description: Whether or not this is the default campaign for accounts or plans without an assigned dunning campaign. dunning_cycles: type: array description: Dunning Cycle settings. items: "$ref": "#/components/schemas/DunningCycle" created_at: type: string format: date-time description: When the current campaign was created in Recurly. updated_at: type: string format: date-time description: When the current campaign was updated in Recurly. deleted_at: type: string format: date-time description: When the current campaign was deleted in Recurly. DunningCampaignList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/DunningCampaign" DunningCycle: type: object properties: type: "$ref": "#/components/schemas/DunningCycleTypeEnum" applies_to_manual_trial: type: boolean description: Whether the dunning settings will be applied to manual trials. Only applies to trial cycles. first_communication_interval: type: integer description: The number of days after a transaction failure before the first dunning email is sent. send_immediately_on_hard_decline: type: boolean description: Whether or not to send an extra email immediately to customers whose initial payment attempt fails with either a hard decline or invalid billing info. intervals: type: array description: Dunning intervals. items: "$ref": "#/components/schemas/DunningInterval" expire_subscription: type: boolean description: Whether the subscription(s) should be cancelled at the end of the dunning cycle. fail_invoice: type: boolean description: Whether the invoice should be failed at the end of the dunning cycle. total_dunning_days: type: integer description: The number of days between the first dunning email being sent and the end of the dunning cycle. total_recycling_days: type: integer description: The number of days between a transaction failure and the end of the dunning cycle. version: type: integer description: Current campaign version. created_at: type: string format: date-time description: When the current settings were created in Recurly. updated_at: type: string format: date-time description: When the current settings were updated in Recurly. DunningInterval: properties: days: type: integer description: Number of days before sending the next email. email_template: type: string description: Email template being used. DunningCampaignsBulkUpdate: properties: plan_codes: type: array maxItems: 200 description: List of `plan_codes` associated with the Plans for which the dunning campaign should be updated. Required unless `plan_ids` is present. items: type: string plan_ids: type: array maxItems: 200 description: List of `plan_ids` associated with the Plans for which the dunning campaign should be updated. Required unless `plan_codes` is present. items: type: string DunningCampaignsBulkUpdateResponse: properties: object: type: string title: Object type readOnly: true plans: type: array title: Plans description: An array containing all of the `Plan` resources that have been updated. maxItems: 200 items: "$ref": "#/components/schemas/Plan" Entitlements: type: object description: A list of privileges granted to a customer through the purchase of a plan or item. properties: object: type: string title: Object Type has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/Entitlement" Entitlement: type: object properties: object: type: string description: Entitlement customer_permission: "$ref": "#/components/schemas/CustomerPermission" granted_by: type: array description: Subscription or item that granted the customer permission. items: "$ref": "#/components/schemas/GrantedBy" created_at: type: string format: date-time description: Time object was created. updated_at: type: string format: date-time description: Time the object was last updated ExternalPaymentPhase: type: object description: Details of payments in the lifecycle of a subscription from an external resource that is not managed by the Recurly platform, e.g. App Store or Google Play Store. properties: id: type: string title: External payment phase ID description: System-generated unique identifier for an external payment phase ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type external_subscription: "$ref": "#/components/schemas/ExternalSubscription" started_at: type: string format: date-time title: Started At ends_at: type: string format: date-time title: Ends At starting_billing_period_index: type: integer title: Starting Billing Period Index ending_billing_period_index: type: integer title: Ending Billing Period Index offer_type: type: string title: Offer Type description: Type of discount offer given, e.g. "FREE_TRIAL" offer_name: type: string title: Offer Name description: Name of the discount offer given, e.g. "introductory" period_count: type: integer title: Period Count description: Number of billing periods period_length: type: string title: Period Length description: Billing cycle length amount: type: string format: decimal title: Amount minimum: 0 description: Allows up to 9 decimal places currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 created_at: type: string format: date-time title: Created at description: When the external subscription was created in Recurly. updated_at: type: string format: date-time title: Updated at description: When the external subscription was updated in Recurly. ExternalPaymentPhaseList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalPaymentPhase" ExternalProduct: type: object description: Product from an external resource such as Apple App Store or Google Play Store. properties: id: type: string title: External product ID. description: System-generated unique identifier for an external product ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type name: type: string title: Name description: Name to identify the external product in Recurly. plan: "$ref": "#/components/schemas/PlanMini" created_at: type: string format: date-time description: When the external product was created in Recurly. updated_at: type: string format: date-time description: When the external product was updated in Recurly. external_product_references: type: array title: External Product References description: List of external product references of the external product. items: "$ref": "#/components/schemas/ExternalProductReferenceMini" ExternalProductList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalProduct" ExternalProductCreate: type: object properties: name: type: string description: External product name. plan_id: type: string description: Recurly plan UUID. external_product_references: type: array title: External Product References description: List of external product references of the external product. items: "$ref": "#/components/schemas/ExternalProductReferenceBase" required: - name ExternalProductUpdate: type: object properties: plan_id: type: string description: Recurly plan UUID. required: - plan_id ExternalProductReferenceBase: type: object properties: reference_code: type: string description: A code which associates the external product to a corresponding object or resource in an external platform like the Apple App Store or Google Play Store. maxLength: 255 external_connection_type: "$ref": "#/components/schemas/ExternalProductReferenceConnectionTypeEnum" ExternalProductReferenceCollection: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalProductReferenceMini" ExternalProductReferenceCreate: allOf: - "$ref": "#/components/schemas/ExternalProductReferenceBase" required: - reference_code - external_connection_type ExternalProductReferenceUpdate: allOf: - "$ref": "#/components/schemas/ExternalProductReferenceBase" ExternalProductReferenceConnectionTypeEnum: type: string enum: - apple_app_store - google_play_store ExternalAccountList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalAccount" ExternalAccountCreate: type: object properties: external_account_code: type: string description: Represents the account code for the external account. external_connection_type: type: string description: Represents the connection type. `AppleAppStore` or `GooglePlayStore` required: - external_account_code - external_connection_type ExternalAccountUpdate: type: object properties: external_account_code: type: string description: Represents the account code for the external account. external_connection_type: type: string description: Represents the connection type. `AppleAppStore` or `GooglePlayStore` ExternalAccount: type: object title: External Account properties: object: type: string default: external_account id: type: string description: UUID of the external_account . external_account_code: type: string description: Represents the account code for the external account. external_connection_type: type: string description: Represents the connection type. `AppleAppStore` or `GooglePlayStore` created_at: type: string format: date-time description: Created at readOnly: true updated_at: type: string format: date-time description: Last updated at readOnly: true ExternalProductReferenceMini: type: object title: External Product Reference details description: External Product Reference details properties: id: type: string title: External Product ID description: System-generated unique identifier for an external product ID, e.g. `e28zov4fw0v2`. object: type: string title: object reference_code: type: string title: reference_code description: A code which associates the external product to a corresponding object or resource in an external platform like the Apple App Store or Google Play Store. external_connection_type: type: string title: external_connection_type description: Source connection platform. created_at: type: string format: date-time description: When the external product was created in Recurly. updated_at: type: string format: date-time description: When the external product was updated in Recurly. ExternalSubscription: type: object description: Subscription from an external resource such as Apple App Store or Google Play Store. properties: id: type: string title: External subscription ID description: System-generated unique identifier for an external subscription ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type account: "$ref": "#/components/schemas/AccountMini" external_product_reference: "$ref": "#/components/schemas/ExternalProductReferenceMini" external_id: type: string title: External Id description: The id of the subscription in the external systems., I.e. Apple App Store or Google Play Store. last_purchased: type: string format: date-time title: Last purchased description: When a new billing event occurred on the external subscription in conjunction with a recent billing period, reactivation or upgrade/downgrade. auto_renew: type: boolean title: Auto-renew description: An indication of whether or not the external subscription will auto-renew at the expiration date. default: false in_grace_period: type: boolean title: In grace period description: An indication of whether or not the external subscription is in a grace period. default: false app_identifier: type: string title: App identifier description: Identifier of the app that generated the external subscription. quantity: type: integer title: Quantity description: An indication of the quantity of a subscribed item's quantity. default: 1 minimum: 0 state: type: string - description: External subscriptions can be active, canceled, expired, or - past_due. + description: External subscriptions can be active, canceled, expired, past_due, + voided, revoked, or paused. default: active activated_at: type: string format: date-time title: Activated at description: When the external subscription was activated in the external platform. canceled_at: type: string format: date-time title: Canceled at description: When the external subscription was canceled in the external platform. expires_at: type: string format: date-time title: Expires at description: When the external subscription expires in the external platform. trial_started_at: type: string format: date-time title: Trial started at description: When the external subscription trial period started in the external platform. trial_ends_at: type: string format: date-time title: Trial ends at description: When the external subscription trial period ends in the external platform. test: type: boolean title: Test description: An indication of whether or not the external subscription was purchased in a sandbox environment. default: false created_at: type: string format: date-time title: Created at description: When the external subscription was created in Recurly. updated_at: type: string format: date-time title: Updated at description: When the external subscription was updated in Recurly. ExternalSubscriptionList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalSubscription" ExternalInvoice: type: object description: Invoice from an external resource such as Apple App Store or Google Play Store. properties: id: type: string title: External invoice ID description: System-generated unique identifier for an external invoice ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type account: "$ref": "#/components/schemas/AccountMini" external_subscription: "$ref": "#/components/schemas/ExternalSubscription" external_id: type: string description: An identifier which associates the external invoice to a corresponding object in an external platform. state: "$ref": "#/components/schemas/ExternalInvoiceStateEnum" total: type: string format: decimal title: Total currency: type: string title: Currency description: 3-letter ISO 4217 currency code. line_items: type: array items: "$ref": "#/components/schemas/ExternalCharge" purchased_at: type: string format: date-time description: When the invoice was created in the external platform. created_at: type: string format: date-time description: When the external invoice was created in Recurly. updated_at: type: string format: date-time title: Updated at description: When the external invoice was updated in Recurly. ExternalInvoiceList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalInvoice" ExternalCharge: type: object description: Charge from an external resource such as Apple App Store or Google Play Store. properties: id: type: string title: External invoice ID description: System-generated unique identifier for an external charge ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type account: "$ref": "#/components/schemas/AccountMini" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. unit_amount: type: string format: decimal title: Unit Amount quantity: type: integer description: type: string external_product_reference: "$ref": "#/components/schemas/ExternalProductReferenceMini" created_at: type: string format: date-time title: Created at description: When the external charge was created in Recurly. updated_at: type: string format: date-time title: Updated at description: When the external charge was updated in Recurly. CustomerPermission: type: object properties: id: type: string description: Customer permission ID. code: type: string description: Customer permission code. name: type: string description: Customer permission name. description: type: string description: Description of customer permission. object: type: string description: It will always be "customer_permission". GrantedBy: type: object description: The subscription or external subscription that grants customer permissions. properties: object: type: string title: Object Type id: type: string description: The ID of the subscription or external subscription that grants the permission to the account. InvoiceTemplateList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/InvoiceTemplate" InvoiceTemplate: type: object description: Settings for an invoice template. properties: id: type: string code: type: string description: Invoice template code. name: type: string description: Invoice template name. description: type: string description: Invoice template description. created_at: type: string format: date-time description: When the invoice template was created in Recurly. updated_at: type: string format: date-time description: When the invoice template was updated in Recurly. PaymentMethod: properties: object: "$ref": "#/components/schemas/PaymentMethodEnum" card_type: description: Visa, MasterCard, American Express, Discover, JCB, etc. "$ref": "#/components/schemas/CardTypeEnum" first_six: type: string description: Credit card number's first six digits. maxLength: 6 last_four: type: string description: Credit card number's last four digits. Will refer to bank account if payment method is ACH. maxLength: 4 last_two: type: string description: The IBAN bank account's last two digits. maxLength: 2 exp_month: type: integer description: Expiration month. maxLength: 2 exp_year: type: integer description: Expiration year. maxLength: 4 gateway_token: type: string description: A token used in place of a credit card in order to perform transactions. maxLength: 50 cc_bin_country: type: string description: The 2-letter ISO 3166-1 alpha-2 country code associated with the credit card BIN, if known by Recurly. Available on the BillingInfo object only. Available when the BIN country lookup feature is enabled. gateway_code: type: string description: An identifier for a specific payment gateway. maxLength: 13 gateway_attributes: type: object description: Gateway specific attributes associated with this PaymentMethod x-class-name: GatewayAttributes properties: account_reference: type: string description: Used by Adyen and Braintree gateways. For Adyen the Shopper Reference value used when the external token was created. For Braintree the PayPal PayerID is populated in the response. maxLength: 264 card_network_preference: description: Represents the card network preference associated with the billing info for dual badged cards. Must be a supported card network. "$ref": "#/components/schemas/CardNetworkEnum" billing_agreement_id: type: string description: Billing Agreement identifier. Only present for Amazon or Paypal payment methods. name_on_account: type: string description: The name associated with the bank account. account_type: description: The bank account type. Only present for ACH payment methods. "$ref": "#/components/schemas/AccountTypeEnum" routing_number: type: string description: The bank account's routing number. Only present for ACH payment methods. routing_number_bank: type: string description: The bank name of this routing number. username: type: string description: Username of the associated payment method. Currently only associated with Venmo. BusinessEntityList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/BusinessEntity" BusinessEntity: type: object description: Business entity details properties: id: title: Business entity ID type: string maxLength: 13 readOnly: true object: title: Object type type: string readOnly: true code: title: Business entity code type: string maxLength: 50 description: The entity code of the business entity. name: type: string title: Name description: This name describes your business entity and will appear on the invoice. maxLength: 255 invoice_display_address: title: Invoice display address description: Address information for the business entity that will appear on the invoice. "$ref": "#/components/schemas/Address" tax_address: title: Tax address description: Address information for the business entity that will be used for calculating taxes. "$ref": "#/components/schemas/Address" default_vat_number: type: string title: Default VAT number description: VAT number for the customer used on the invoice. maxLength: 20 default_registration_number: type: string title: Default registration number description: Registration number for the customer used on the invoice. maxLength: 30 subscriber_location_countries: type: array title: Subscriber location countries description: List of countries for which the business entity will be used. items: type: string title: Country code created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true GiftCardList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/GiftCard" GiftCard: type: object description: Gift card details properties: id: title: Gift card ID type: string maxLength: 13 readOnly: true object: title: Object type type: string readOnly: true gifter_account_id: title: Gifter account ID type: string maxLength: 13 description: The ID of the account that purchased the gift card. recipient_account_id: title: Recipient account ID type: string maxLength: 13 description: The ID of the account that redeemed the gift card redemption code. Does not have a value until gift card is redeemed. purchase_invoice_id: title: Purchase invoice ID type: string maxLength: 13 description: The ID of the invoice for the gift card purchase made by the gifter. redemption_invoice_id: title: Redemption invoice ID type: string maxLength: 13 description: The ID of the invoice for the gift card redemption made by the recipient. Does not have a value until gift card is redeemed. redemption_code: title: Redemption code type: string description: The unique redemption code for the gift card, generated by Recurly. Will be 16 characters, alphanumeric, displayed uppercase, but accepted in any case at redemption. Used by the recipient account to create a credit in the amount of the `unit_amount` on their account. balance: title: Remaining balance type: number format: float description: The remaining credit on the recipient account associated with this gift card. Only has a value once the gift card has been redeemed. Can be used to create gift card balance displays for your customers. product_code: title: Product code type: string description: The product code or SKU of the gift card product. unit_amount: title: Purchase unit amount type: number format: float description: The amount of the gift card, which is the amount of the charge to the gifter account and the amount of credit that is applied to the recipient account upon successful redemption. currency: title: Currency type: string description: 3-letter ISO 4217 currency code. maxLength: 3 delivery: title: Delivery details description: The delivery details for the gift card. readOnly: true "$ref": "#/components/schemas/GiftCardDelivery" created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true delivered_at: type: string format: date-time title: Delivered at readOnly: true description: When the gift card was sent to the recipient by Recurly via email, if method was email and the "Gift Card Delivery" email template was enabled. This will be empty for post delivery or email delivery where the email template was disabled. redeemed_at: type: string format: date-time title: Redeemed at readOnly: true description: When the gift card was redeemed by the recipient. canceled_at: type: string format: date-time title: Canceled at readOnly: true description: When the gift card was canceled. @@ -25117,858 +25122,859 @@ components: - refund - verify FilterInvoiceTypeEnum: type: string enum: - charge - credit - legacy - non-legacy ChannelEnum: type: string enum: - advertising - blog - direct_traffic - email - events - marketing_content - organic_search - other - outbound_sales - paid_search - public_relations - referral - social_media PreferredLocaleEnum: type: string enum: - da-DK - de-CH - de-DE - en-AU - en-CA - en-GB - en-IE - en-NZ - en-US - es-ES - es-MX - es-US - fi-FI - fr-BE - fr-CA - fr-CH - fr-FR - hi-IN - it-IT - ja-JP - ko-KR - nl-BE - nl-NL - pl-PL - pt-BR - pt-PT - ro-RO - ru-RU - sk-SK - sv-SE - tr-TR - zh-CN BillToEnum: type: string enum: - parent - self DeliveryMethodEnum: type: string enum: - email - post GatewayTransactionTypeEnum: type: string enum: - moto KountDecisionEnum: type: string enum: - approve - decline - escalate - review CouponStateEnum: type: string enum: - expired - maxed_out - redeemable CouponDurationEnum: type: string enum: - forever - single_use - temporal TemporalUnitEnum: type: string enum: - day - month - week - year FreeTrialUnitEnum: type: string enum: - day - month - week RedemptionResourceEnum: type: string enum: - account - subscription CouponTypeEnum: type: string enum: - bulk - single_code DiscountTypeEnum: type: string enum: - fixed - free_trial - percent AddOnSourceEnum: type: string title: Add-on source description: | Used to determine where the associated add-on data is pulled from. If this value is set to `plan_add_on` or left blank, then add-on data will be pulled from the plan's add-ons. If the associated `plan` has `allow_any_item_on_subscriptions` set to `true` and this field is set to `item`, then the associated add-on data will be pulled from the site's item catalog. default: plan_add_on enum: - plan_add_on - item AddOnTypeEnum: type: string enum: - fixed - usage title: Add-on Type description: Whether the add-on type is fixed, or usage-based. AddOnTypeCreateEnum: type: string enum: - fixed - usage title: Add-on Type description: Whether the add-on type is fixed, or usage-based. default: fixed UsageTypeCreateEnum: type: string enum: - price - percentage title: Usage Type description: | Type of usage, required if `add_on_type` is `usage`. See our [Guide](https://recurly.com/developers/guides/usage-based-billing-guide.html) for an overview of how to configure usage add-ons. TierTypeEnum: type: string title: Tier type description: | The pricing model for the add-on. For more information, [click here](https://docs.recurly.com/docs/billing-models#section-quantity-based). See our [Guide](https://recurly.com/developers/guides/item-addon-guide.html) for an overview of how to configure quantity-based pricing models. default: flat enum: - flat - tiered - stairstep - volume UsageTimeframeEnum: type: string title: Usage Timeframe description: The time at which usage totals are reset for billing purposes. enum: - billing_period - subscription_term default: billing_period UsageTimeframeCreateEnum: type: string title: Usage Timeframe description: | The time at which usage totals are reset for billing purposes. Allows for `tiered` add-ons to accumulate usage over the course of multiple billing periods. enum: - billing_period - subscription_term default: billing_period CreditPaymentActionEnum: type: string enum: - payment - reduction - refund - write_off UserAccessEnum: type: string enum: - api_only - read_only - write - set_only PricingModelTypeEnum: type: string enum: - fixed - ramp default: fixed description: | A fixed pricing model has the same price for each billing period. A ramp pricing model defines a set of Ramp Intervals, where a subscription changes price on a specified cadence of billing periods. The price change could be an increase or decrease. RevenueScheduleTypeEnum: type: string enum: - at_range_end - at_range_start - evenly - never NetTermsTypeEnum: type: string title: Net Terms Type description: | Optionally supplied string that may be either `net` or `eom` (end-of-month). When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date. When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month. enum: - net - eom default: net InvoiceTypeEnum: type: string enum: - charge - credit - legacy OriginEnum: type: string enum: - carryforward_credit - carryforward_gift_credit - credit - external_refund - gift_card - immediate_change - import - line_item_refund - open_amount_refund - prepayment - purchase - refund - renewal - termination - usage_correction - write_off InvoiceStateEnum: type: string default: all enum: - open - pending - processing - past_due - paid - closed - failed - voided InvoiceStateQueryParamEnum: type: string default: all enum: - pending - past_due - paid - failed CollectionMethodEnum: type: string enum: - automatic - manual InvoiceRefundTypeEnum: type: string enum: - amount - line_items RefuneMethodEnum: type: string enum: - all_credit - all_transaction - credit_first - transaction_first ExternalPaymentMethodEnum: type: string enum: - bacs - ach - amazon - apple_pay - check - credit_card - eft - google_pay - money_order - other - paypal - roku - sepadirectdebit - wire_transfer LineItemRevenueScheduleTypeEnum: type: string enum: - at_invoice - at_range_end - at_range_start - evenly - never LegacyCategoryEnum: type: string enum: - applied_credit - carryforward - charge - credit LineItemOriginEnum: type: string enum: - add_on - add_on_trial - carryforward - coupon - credit - debit - one_time - plan - plan_trial - setup_fee - prepayment FullCreditReasonCodeEnum: type: string enum: - general - gift_card - promotional - refund - service - write_off PartialCreditReasonCodeEnum: type: string enum: - general - promotional - service LineItemCreateOriginEnum: type: string enum: - external_gift_card - prepayment IntervalUnitEnum: type: string enum: - days - months AddressRequirementEnum: type: string enum: - full - none - streetzip - zip SiteModeEnum: type: string enum: - development - production - sandbox FeaturesEnum: type: string enum: - credit_memos - manual_invoicing - only_bill_what_changed - subscription_terms SubscriptionStateEnum: type: string enum: - active - canceled - expired - failed - future - paused TimeframeEnum: type: string enum: - bill_date - term_end ChangeTimeframeEnum: type: string enum: - bill_date - now - renewal - term_end TransactionTypeEnum: type: string enum: - authorization - capture - purchase - refund - verify TransactionOriginEnum: type: string enum: - api - chargeback - external_recovery - force_collect - hpp - merchant - recurly_admin - recurlyjs - recurring - refunded_externally - transparent TransactionStatusEnum: type: string enum: - chargeback - declined - error - pending - processing - scheduled - success - void CvvCheckEnum: type: string enum: - D - I - M - N - P - S - U - X AvsCheckEnum: type: string enum: - A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z CouponCodeStateEnum: type: string enum: - expired - inactive - maxed_out - redeemable PaymentMethodEnum: type: string enum: - bacs - amazon - amazon_billing_agreement - apple_pay - bank_account_info - check - credit_card - eft - gateway_token - google_pay - iban_bank_account - money_order - other - paypal - paypal_billing_agreement - roku - sepadirectdebit - venmo - wire_transfer - braintree_v_zero - boleto + - cash_app CardTypeEnum: type: string enum: - American Express - Dankort - Diners Club - Discover - ELO - Forbrugsforeningen - Hipercard - JCB - Laser - Maestro - MasterCard - Test Card - Union Pay - Unknown - Visa - Tarjeta Naranja CardNetworkEnum: type: string enum: - Bancontact - CartesBancaires - Dankort - MasterCard - Visa AccountTypeEnum: type: string enum: - checking - savings ErrorTypeEnum: type: string enum: - bad_request - immutable_subscription - internal_server_error - invalid_api_key - invalid_api_version - invalid_content_type - invalid_permissions - invalid_token - missing_feature - not_found - rate_limited - service_not_available - simultaneous_request - tax_service_error - transaction - unauthorized - unavailable_in_api_version - unknown_api_version - validation ErrorCategoryEnum: type: string enum: - three_d_secure_required - three_d_secure_action_required - amazon - api_error - approved - communication - configuration - duplicate - fraud - hard - invalid - not_enabled - not_supported - recurly - referral - skles - soft - unknown ErrorCodeEnum: type: string enum: - ach_cancel - ach_chargeback - ach_credit_return - ach_exception - ach_return - ach_transactions_not_supported - ach_validation_exception - amazon_amount_exceeded - amazon_declined_review - amazon_invalid_authorization_status - amazon_invalid_close_attempt - amazon_invalid_create_order_reference - amazon_invalid_order_status - amazon_not_authorized - amazon_order_not_modifiable - amazon_transaction_count_exceeded - api_error - approved - approved_fraud_review - authorization_already_captured - authorization_amount_depleted - authorization_expired - batch_processing_error - billing_agreement_already_accepted - billing_agreement_not_accepted - billing_agreement_not_found - billing_agreement_replaced - call_issuer - call_issuer_update_cardholder_data - cancelled - cannot_refund_unsettled_transactions - card_not_activated - card_type_not_accepted - cardholder_requested_stop - contact_gateway - contract_not_found - currency_not_supported - customer_canceled_transaction - cvv_required - declined - declined_card_number - declined_exception - declined_expiration_date - declined_missing_data - declined_saveable - declined_security_code - deposit_referenced_chargeback - direct_debit_type_not_accepted - duplicate_transaction - exceeds_daily_limit - exceeds_max_amount - expired_card - finbot_disconnect - finbot_unavailable - fraud_address - fraud_address_recurly - fraud_advanced_verification - fraud_gateway - fraud_generic - fraud_ip_address - fraud_manual_decision - fraud_risk_check - fraud_security_code - fraud_stolen_card - fraud_too_many_attempts - fraud_velocity - gateway_account_setup_incomplete - gateway_error - gateway_rate_limited - gateway_timeout - gateway_token_not_found - gateway_unavailable - gateway_validation_exception - insufficient_funds - invalid_account_number - invalid_amount - invalid_billing_agreement_status - invalid_card_number - invalid_data - invalid_email - invalid_gateway_access_token - invalid_gateway_configuration - invalid_issuer - invalid_login - invalid_merchant_type - invalid_name - invalid_payment_method - invalid_payment_method_hard - invalid_transaction - issuer_unavailable - lifecycle_decline - merch_max_transaction_limit_exceeded - moneybot_disconnect - moneybot_unavailable - no_billing_information - no_gateway - no_gateway_found_for_transaction_amount - partial_approval - partial_credits_not_supported - payer_authentication_rejected - payment_cannot_void_authorization - payment_not_accepted - paypal_account_issue - paypal_cannot_pay_self - paypal_declined_use_alternate - paypal_expired_reference_id - paypal_hard_decline - paypal_invalid_billing_agreement - paypal_primary_declined - processor_not_available - processor_unavailable - recurly_credentials_not_found - recurly_error - recurly_failed_to_get_token - recurly_token_mismatch - recurly_token_not_found - reference_transactions_not_enabled - restricted_card - restricted_card_chargeback - rjs_token_expired - roku_invalid_card_number - roku_invalid_cib - roku_invalid_payment_method - roku_zip_code_mismatch - simultaneous - ssl_error - temporary_hold - three_d_secure_action_required - three_d_secure_action_result_token_mismatch - three_d_secure_authentication - three_d_secure_connection_error - three_d_secure_credential_error - three_d_secure_not_supported - too_busy - too_many_attempts - total_credit_exceeds_capture - transaction_already_refunded - transaction_already_voided - transaction_cannot_be_authorized - transaction_cannot_be_refunded - transaction_cannot_be_refunded_currently - transaction_cannot_be_voided - transaction_failed_to_settle - transaction_not_found - transaction_service_v2_disconnect - transaction_service_v2_unavailable - transaction_settled - transaction_stale_at_gateway - try_again - unknown - unmapped_partner_error - vaultly_service_unavailable - zero_dollar_auth_not_supported DeclineCodeEnum: type: string enum: - account_closed - call_issuer - card_not_activated - card_not_supported - cardholder_requested_stop - do_not_honor - do_not_try_again - exceeds_daily_limit - generic_decline - expired_card - fraudulent - insufficient_funds - incorrect_address - incorrect_security_code - invalid_amount - invalid_number - invalid_transaction - issuer_unavailable - lifecycle_decline - lost_card - pickup_card - policy_decline - restricted_card - restricted_card_chargeback - security_decline - stolen_card - try_again - update_cardholder_data - requires_3d_secure ExportDates: type: object properties: object: type: string title: Object type readOnly: true dates: type: array items: type: string title: An array of dates that have available exports. ExportFiles: type: object properties: object: type: string title: Object type readOnly: true files: type: array items: "$ref": "#/components/schemas/ExportFile" ExportFile: type: object properties: name: type: string title: Filename description: Name of the export file. md5sum: type: string title: MD5 hash of the export file description: MD5 hash of the export file. href: type: string title: A link to the export file description: A presigned link to download the export file. TaxIdentifierTypeEnum: type: string enum: - cpf - cnpj - cuit DunningCycleTypeEnum: type: string description: The type of invoice this cycle applies to. enum: - automatic - manual - trial AchTypeEnum: type: string description: The payment method type for a non-credit card based billing info. `bacs` and `becs` are the only accepted values. enum: - bacs - becs AchAccountTypeEnum: type: string description: The bank account type. (ACH only) enum: - checking - savings ExternalHppTypeEnum: type: string description: Use for Adyen HPP billing info. This should only be used as part of a pending purchase request, when the billing info is nested inside an account object. enum: - adyen OnlineBankingPaymentTypeEnum: type: string description: Use for Online Banking billing info. This should only be used as part of a pending purchase request, when the billing info is nested inside an account object. enum: - ideal - sofort ExternalInvoiceStateEnum: type: string enum: - paid
recurly/recurly-client-php
0482b4e010a72235da96c7e409220a6598da3368
4.50.0
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index be75449..25229e6 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 4.49.0 +current_version = 4.50.0 parse = (?P<major>\d+) \.(?P<minor>\d+) \.(?P<patch>\d+) serialize = {major}.{minor}.{patch} [bumpversion:file:composer.json] [bumpversion:file:lib/recurly/version.php] diff --git a/CHANGELOG.md b/CHANGELOG.md index bd0e6ef..5dc12b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,514 +1,525 @@ # Changelog +## [4.50.0](https://github.com/recurly/recurly-client-php/tree/4.50.0) (2024-05-24) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.49.0...4.50.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 (Entity Use Code) [#812](https://github.com/recurly/recurly-client-php/pull/812) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.49.0](https://github.com/recurly/recurly-client-php/tree/4.49.0) (2024-05-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.48.0...4.49.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Proration Settings) [#810](https://github.com/recurly/recurly-client-php/pull/810) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.48.0](https://github.com/recurly/recurly-client-php/tree/4.48.0) (2024-05-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.47.0...4.48.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Auth & Capture) [#808](https://github.com/recurly/recurly-client-php/pull/808) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.47.0](https://github.com/recurly/recurly-client-php/tree/4.47.0) (2024-03-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.46.0...4.47.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#803](https://github.com/recurly/recurly-client-php/pull/803) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.46.0](https://github.com/recurly/recurly-client-php/tree/4.46.0) (2024-02-20) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.45.0...4.46.0) **Merged Pull Requests** - Add invoice state param for v2021-02-25 [#799](https://github.com/recurly/recurly-client-php/pull/799) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.45.0](https://github.com/recurly/recurly-client-php/tree/4.45.0) (2024-01-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.44.0...4.45.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#789](https://github.com/recurly/recurly-client-php/pull/789) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.44.0](https://github.com/recurly/recurly-client-php/tree/4.44.0) (2024-01-18) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.43.0...4.44.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#788](https://github.com/recurly/recurly-client-php/pull/788) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.43.0](https://github.com/recurly/recurly-client-php/tree/4.43.0) (2023-12-06) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.42.0...4.43.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Payment Phases) [#785](https://github.com/recurly/recurly-client-php/pull/785) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.42.0](https://github.com/recurly/recurly-client-php/tree/4.42.0) (2023-11-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.41.0...4.42.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#783](https://github.com/recurly/recurly-client-php/pull/783) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.41.0](https://github.com/recurly/recurly-client-php/tree/4.41.0) (2023-08-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.40.0...4.41.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (`VATNumber`, `LifecycleDecline`) [#782](https://github.com/recurly/recurly-client-php/pull/782) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.40.0](https://github.com/recurly/recurly-client-php/tree/4.40.0) (2023-08-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.39.0...4.40.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (action_result) [#781](https://github.com/recurly/recurly-client-php/pull/781) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.39.0](https://github.com/recurly/recurly-client-php/tree/4.39.0) (2023-07-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.37.0...4.39.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Ramp Dates, Net Terms, Invoice Business Entity) [#779](https://github.com/recurly/recurly-client-php/pull/779) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (App Management - External Subscriptions) [#777](https://github.com/recurly/recurly-client-php/pull/777) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.37.0](https://github.com/recurly/recurly-client-php/tree/4.37.0) (2023-06-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.36.0...4.37.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Multiple Business Entities) [#769](https://github.com/recurly/recurly-client-php/pull/769) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.36.0](https://github.com/recurly/recurly-client-php/tree/4.36.0) (2023-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.35.0...4.36.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Products & References) [#766](https://github.com/recurly/recurly-client-php/pull/766) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.35.0](https://github.com/recurly/recurly-client-php/tree/4.35.0) (2023-05-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.34.0...4.35.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (gateway_attributes on PaymentMethod) [#764](https://github.com/recurly/recurly-client-php/pull/764) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#747](https://github.com/recurly/recurly-client-php/pull/747) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.28.0](https://github.com/recurly/recurly-client-php/tree/4.28.0) (2023-02-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.27.0...4.28.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (GiftCard endpoints and new transaction error support) [#745](https://github.com/recurly/recurly-client-php/pull/745) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.27.0](https://github.com/recurly/recurly-client-php/tree/4.27.0) (2023-01-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.26.0...4.27.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Custom Fields on Line Items) [#738](https://github.com/recurly/recurly-client-php/pull/738) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.26.0](https://github.com/recurly/recurly-client-php/tree/4.26.0) (2023-01-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.25.0...4.26.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Account Preferred Time Zone) [#736](https://github.com/recurly/recurly-client-php/pull/736) ([douglasmiller](https://github.com/douglasmiller)) ## [4.25.0](https://github.com/recurly/recurly-client-php/tree/4.25.0) (2022-11-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.24.0...4.25.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Apply Credit Balance feature) [#732](https://github.com/recurly/recurly-client-php/pull/732) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.24.0](https://github.com/recurly/recurly-client-php/tree/4.24.0) (2022-11-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.23.0...4.24.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Subscriptions feature) [#729](https://github.com/recurly/recurly-client-php/pull/729) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#728](https://github.com/recurly/recurly-client-php/pull/728) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.23.0](https://github.com/recurly/recurly-client-php/tree/4.23.0) (2022-10-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.22.0...4.23.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entitlements feature) [#725](https://github.com/recurly/recurly-client-php/pull/725) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.22.0](https://github.com/recurly/recurly-client-php/tree/4.22.0) (2022-10-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.2...4.22.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25(Decimal Usage and Quantities and DunningEvent new fields) [#722](https://github.com/recurly/recurly-client-php/pull/722) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.2](https://github.com/recurly/recurly-client-php/tree/4.21.2) (2022-09-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.1...4.21.2) **Merged Pull Requests** - feat: allow for psr/log ^2/3 [#716](https://github.com/recurly/recurly-client-php/pull/716) ([trickeyone](https://github.com/trickeyone)) ## [4.21.1](https://github.com/recurly/recurly-client-php/tree/4.21.1) (2022-09-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.0...4.21.1) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#714](https://github.com/recurly/recurly-client-php/pull/714) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.0](https://github.com/recurly/recurly-client-php/tree/4.21.0) (2022-09-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.20.0...4.21.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#713](https://github.com/recurly/recurly-client-php/pull/713) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixes bug with putDunningCampaignBulkUpdate [#706](https://github.com/recurly/recurly-client-php/pull/706) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.20.0](https://github.com/recurly/recurly-client-php/tree/4.20.0) (2022-08-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.19.0...4.20.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#701](https://github.com/recurly/recurly-client-php/pull/701) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.19.0](https://github.com/recurly/recurly-client-php/tree/4.19.0) (2022-07-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.18.0...4.19.0) **Merged Pull Requests** - Fixing deprecation warnings in client [#697](https://github.com/recurly/recurly-client-php/pull/697) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#695](https://github.com/recurly/recurly-client-php/pull/695) ([recurly-integrations](https://github.com/recurly-integrations)) **Closed Issues** - Recurly\Pager and \Iterator return type mismatch (PHP 8.1 deprecation) [#677](https://github.com/recurly/recurly-client-php/issues/677) ## [4.18.0](https://github.com/recurly/recurly-client-php/tree/4.18.0) (2022-06-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.17.0...4.18.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#693](https://github.com/recurly/recurly-client-php/pull/693) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.17.0](https://github.com/recurly/recurly-client-php/tree/4.17.0) (2022-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.16.0...4.17.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#679](https://github.com/recurly/recurly-client-php/pull/679) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.16.0](https://github.com/recurly/recurly-client-php/tree/4.16.0) (2022-03-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.15.0...4.16.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#676](https://github.com/recurly/recurly-client-php/pull/676) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.15.0](https://github.com/recurly/recurly-client-php/tree/4.15.0) (2022-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.14.0...4.15.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#668](https://github.com/recurly/recurly-client-php/pull/668) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.14.0](https://github.com/recurly/recurly-client-php/tree/4.14.0) (2022-03-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.13.0...4.14.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#664](https://github.com/recurly/recurly-client-php/pull/664) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.13.0](https://github.com/recurly/recurly-client-php/tree/4.13.0) (2022-01-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.12.0...4.13.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#655](https://github.com/recurly/recurly-client-php/pull/655) ([recurly-integrations](https://github.com/recurly-integrations)) - Add region argument to client to connect in EU data center [#653](https://github.com/recurly/recurly-client-php/pull/653) ([FabricioCoutinho](https://github.com/FabricioCoutinho)) ## [4.12.0](https://github.com/recurly/recurly-client-php/tree/4.12.0) (2022-01-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.11.0...4.12.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Invoice Customization) [#654](https://github.com/recurly/recurly-client-php/pull/654) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#651](https://github.com/recurly/recurly-client-php/pull/651) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.11.0](https://github.com/recurly/recurly-client-php/tree/4.11.0) (2021-12-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.10.0...4.11.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Tax Inclusive Pricing) [#650](https://github.com/recurly/recurly-client-php/pull/650) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.10.0](https://github.com/recurly/recurly-client-php/tree/4.10.0) (2021-11-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.9.0...4.10.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#647](https://github.com/recurly/recurly-client-php/pull/647) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#645](https://github.com/recurly/recurly-client-php/pull/645) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#644](https://github.com/recurly/recurly-client-php/pull/644) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#639](https://github.com/recurly/recurly-client-php/pull/639) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.9.0](https://github.com/recurly/recurly-client-php/tree/4.9.0) (2021-09-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.8.0...4.9.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Support to new subscription fields and response) [#633](https://github.com/recurly/recurly-client-php/pull/633) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.8.0](https://github.com/recurly/recurly-client-php/tree/4.8.0) (2021-09-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.7.0...4.8.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Dunning Campaigns feature) [#632](https://github.com/recurly/recurly-client-php/pull/632) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.7.0](https://github.com/recurly/recurly-client-php/tree/4.7.0) (2021-08-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.6.0...4.7.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (get_preview_renewal) [#630](https://github.com/recurly/recurly-client-php/pull/630) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.6.0](https://github.com/recurly/recurly-client-php/tree/4.6.0) (2021-08-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.5.0...4.6.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#628](https://github.com/recurly/recurly-client-php/pull/628) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.5.0](https://github.com/recurly/recurly-client-php/tree/4.5.0) (2021-08-02) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.4.0...4.5.0) diff --git a/composer.json b/composer.json index 8da213c..479ec9b 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,38 @@ { "name": "recurly/recurly-client", - "version": "4.49.0", + "version": "4.50.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], "homepage": "https://github.com/recurly/recurly-client-php", "license": "MIT", "authors": [], "require": { "php": ">= 7.2.0", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "phpcompatibility/php-compatibility": "^9.3", "phpdocumentor/phpdocumentor": "~3.0.0", "phpstan/phpstan": "^0.12.11", "phpunit/phpunit": "^8", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "classmap": ["lib"], "files": ["lib/recurly.php"] }, "autoload-dev": { "classmap": ["tests"] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/lib/recurly/version.php b/lib/recurly/version.php index c2fcdd9..c99442e 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -1,8 +1,8 @@ <?php namespace Recurly; class Version { - public const CURRENT = '4.49.0'; + public const CURRENT = '4.50.0'; }
recurly/recurly-client-php
ba5f7b1da28096008537e28e87b187220b19d36a
Generated Latest Changes for v2021-02-25
diff --git a/lib/recurly/resources/account.php b/lib/recurly/resources/account.php index d503370..4dcd2ce 100644 --- a/lib/recurly/resources/account.php +++ b/lib/recurly/resources/account.php @@ -1,822 +1,846 @@ <?php /** * This file is automatically created by Recurly's OpenAPI generation process * and thus any edits you make by hand will be lost. If you wish to make a * change to this file, please create a Github issue explaining the changes you * need and we will usher them to the appropriate places. */ namespace Recurly\Resources; use Recurly\RecurlyResource; // phpcs:disable class Account extends RecurlyResource { private $_address; private $_bill_to; private $_billing_info; private $_cc_emails; private $_code; private $_company; private $_created_at; private $_custom_fields; private $_deleted_at; private $_dunning_campaign_id; private $_email; + private $_entity_use_code; private $_exemption_certificate; private $_external_accounts; private $_first_name; private $_has_active_subscription; private $_has_canceled_subscription; private $_has_future_subscription; private $_has_live_subscription; private $_has_past_due_invoice; private $_has_paused_subscription; private $_hosted_login_token; private $_id; private $_invoice_template_id; private $_last_name; private $_object; private $_override_business_entity_id; private $_parent_account_id; private $_preferred_locale; private $_preferred_time_zone; private $_shipping_addresses; private $_state; private $_tax_exempt; private $_updated_at; private $_username; private $_vat_number; protected static $array_hints = [ 'setCustomFields' => '\Recurly\Resources\CustomField', 'setExternalAccounts' => '\Recurly\Resources\ExternalAccount', 'setShippingAddresses' => '\Recurly\Resources\ShippingAddress', ]; /** * Getter method for the address attribute. * * * @return ?\Recurly\Resources\Address */ public function getAddress(): ?\Recurly\Resources\Address { return $this->_address; } /** * Setter method for the address attribute. * * @param \Recurly\Resources\Address $address * * @return void */ public function setAddress(\Recurly\Resources\Address $address): void { $this->_address = $address; } /** * Getter method for the bill_to attribute. * An enumerable describing the billing behavior of the account, specifically whether the account is self-paying or will rely on the parent account to pay. * * @return ?string */ public function getBillTo(): ?string { return $this->_bill_to; } /** * Setter method for the bill_to attribute. * * @param string $bill_to * * @return void */ public function setBillTo(string $bill_to): void { $this->_bill_to = $bill_to; } /** * Getter method for the billing_info attribute. * * * @return ?\Recurly\Resources\BillingInfo */ public function getBillingInfo(): ?\Recurly\Resources\BillingInfo { return $this->_billing_info; } /** * Setter method for the billing_info attribute. * * @param \Recurly\Resources\BillingInfo $billing_info * * @return void */ public function setBillingInfo(\Recurly\Resources\BillingInfo $billing_info): void { $this->_billing_info = $billing_info; } /** * Getter method for the cc_emails attribute. * Additional email address that should receive account correspondence. These should be separated only by commas. These CC emails will receive all emails that the `email` field also receives. * * @return ?string */ public function getCcEmails(): ?string { return $this->_cc_emails; } /** * Setter method for the cc_emails attribute. * * @param string $cc_emails * * @return void */ public function setCcEmails(string $cc_emails): void { $this->_cc_emails = $cc_emails; } /** * Getter method for the code attribute. * The unique identifier of the account. This cannot be changed once the account is created. * * @return ?string */ public function getCode(): ?string { return $this->_code; } /** * Setter method for the code attribute. * * @param string $code * * @return void */ public function setCode(string $code): void { $this->_code = $code; } /** * Getter method for the company attribute. * * * @return ?string */ public function getCompany(): ?string { return $this->_company; } /** * Setter method for the company attribute. * * @param string $company * * @return void */ public function setCompany(string $company): void { $this->_company = $company; } /** * Getter method for the created_at attribute. * When the account was created. * * @return ?string */ public function getCreatedAt(): ?string { return $this->_created_at; } /** * Setter method for the created_at attribute. * * @param string $created_at * * @return void */ public function setCreatedAt(string $created_at): void { $this->_created_at = $created_at; } /** * Getter method for the custom_fields attribute. * The custom fields will only be altered when they are included in a request. Sending an empty array will not remove any existing values. To remove a field send the name with a null or empty value. * * @return array */ public function getCustomFields(): array { return $this->_custom_fields ?? [] ; } /** * Setter method for the custom_fields attribute. * * @param array $custom_fields * * @return void */ public function setCustomFields(array $custom_fields): void { $this->_custom_fields = $custom_fields; } /** * Getter method for the deleted_at attribute. * If present, when the account was last marked inactive. * * @return ?string */ public function getDeletedAt(): ?string { return $this->_deleted_at; } /** * Setter method for the deleted_at attribute. * * @param string $deleted_at * * @return void */ public function setDeletedAt(string $deleted_at): void { $this->_deleted_at = $deleted_at; } /** * Getter method for the dunning_campaign_id attribute. * Unique ID to identify a dunning campaign. Used to specify if a non-default dunning campaign should be assigned to this account. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. * * @return ?string */ public function getDunningCampaignId(): ?string { return $this->_dunning_campaign_id; } /** * Setter method for the dunning_campaign_id attribute. * * @param string $dunning_campaign_id * * @return void */ public function setDunningCampaignId(string $dunning_campaign_id): void { $this->_dunning_campaign_id = $dunning_campaign_id; } /** * Getter method for the email attribute. * The email address used for communicating with this customer. The customer will also use this email address to log into your hosted account management pages. This value does not need to be unique. * * @return ?string */ public function getEmail(): ?string { return $this->_email; } /** * Setter method for the email attribute. * * @param string $email * * @return void */ public function setEmail(string $email): void { $this->_email = $email; } + /** + * Getter method for the entity_use_code attribute. + * The Avalara AvaTax value that can be passed to identify the customer type for tax purposes. The range of values can be A - R (more info at Avalara). Value is case-sensitive. + * + * @return ?string + */ + public function getEntityUseCode(): ?string + { + return $this->_entity_use_code; + } + + /** + * Setter method for the entity_use_code attribute. + * + * @param string $entity_use_code + * + * @return void + */ + public function setEntityUseCode(string $entity_use_code): void + { + $this->_entity_use_code = $entity_use_code; + } + /** * Getter method for the exemption_certificate attribute. * The tax exemption certificate number for the account. If the merchant has an integration for the Vertex tax provider, this optional value will be sent in any tax calculation requests for the account. * * @return ?string */ public function getExemptionCertificate(): ?string { return $this->_exemption_certificate; } /** * Setter method for the exemption_certificate attribute. * * @param string $exemption_certificate * * @return void */ public function setExemptionCertificate(string $exemption_certificate): void { $this->_exemption_certificate = $exemption_certificate; } /** * Getter method for the external_accounts attribute. * The external accounts belonging to this account * * @return array */ public function getExternalAccounts(): array { return $this->_external_accounts ?? [] ; } /** * Setter method for the external_accounts attribute. * * @param array $external_accounts * * @return void */ public function setExternalAccounts(array $external_accounts): void { $this->_external_accounts = $external_accounts; } /** * Getter method for the first_name attribute. * * * @return ?string */ public function getFirstName(): ?string { return $this->_first_name; } /** * Setter method for the first_name attribute. * * @param string $first_name * * @return void */ public function setFirstName(string $first_name): void { $this->_first_name = $first_name; } /** * Getter method for the has_active_subscription attribute. * Indicates if the account has an active subscription. * * @return ?bool */ public function getHasActiveSubscription(): ?bool { return $this->_has_active_subscription; } /** * Setter method for the has_active_subscription attribute. * * @param bool $has_active_subscription * * @return void */ public function setHasActiveSubscription(bool $has_active_subscription): void { $this->_has_active_subscription = $has_active_subscription; } /** * Getter method for the has_canceled_subscription attribute. * Indicates if the account has a canceled subscription. * * @return ?bool */ public function getHasCanceledSubscription(): ?bool { return $this->_has_canceled_subscription; } /** * Setter method for the has_canceled_subscription attribute. * * @param bool $has_canceled_subscription * * @return void */ public function setHasCanceledSubscription(bool $has_canceled_subscription): void { $this->_has_canceled_subscription = $has_canceled_subscription; } /** * Getter method for the has_future_subscription attribute. * Indicates if the account has a future subscription. * * @return ?bool */ public function getHasFutureSubscription(): ?bool { return $this->_has_future_subscription; } /** * Setter method for the has_future_subscription attribute. * * @param bool $has_future_subscription * * @return void */ public function setHasFutureSubscription(bool $has_future_subscription): void { $this->_has_future_subscription = $has_future_subscription; } /** * Getter method for the has_live_subscription attribute. * Indicates if the account has a subscription that is either active, canceled, future, or paused. * * @return ?bool */ public function getHasLiveSubscription(): ?bool { return $this->_has_live_subscription; } /** * Setter method for the has_live_subscription attribute. * * @param bool $has_live_subscription * * @return void */ public function setHasLiveSubscription(bool $has_live_subscription): void { $this->_has_live_subscription = $has_live_subscription; } /** * Getter method for the has_past_due_invoice attribute. * Indicates if the account has a past due invoice. * * @return ?bool */ public function getHasPastDueInvoice(): ?bool { return $this->_has_past_due_invoice; } /** * Setter method for the has_past_due_invoice attribute. * * @param bool $has_past_due_invoice * * @return void */ public function setHasPastDueInvoice(bool $has_past_due_invoice): void { $this->_has_past_due_invoice = $has_past_due_invoice; } /** * Getter method for the has_paused_subscription attribute. * Indicates if the account has a paused subscription. * * @return ?bool */ public function getHasPausedSubscription(): ?bool { return $this->_has_paused_subscription; } /** * Setter method for the has_paused_subscription attribute. * * @param bool $has_paused_subscription * * @return void */ public function setHasPausedSubscription(bool $has_paused_subscription): void { $this->_has_paused_subscription = $has_paused_subscription; } /** * Getter method for the hosted_login_token attribute. * The unique token for automatically logging the account in to the hosted management pages. You may automatically log the user into their hosted management pages by directing the user to: `https://{subdomain}.recurly.com/account/{hosted_login_token}`. * * @return ?string */ public function getHostedLoginToken(): ?string { return $this->_hosted_login_token; } /** * Setter method for the hosted_login_token attribute. * * @param string $hosted_login_token * * @return void */ public function setHostedLoginToken(string $hosted_login_token): void { $this->_hosted_login_token = $hosted_login_token; } /** * Getter method for the id attribute. * * * @return ?string */ public function getId(): ?string { return $this->_id; } /** * Setter method for the id attribute. * * @param string $id * * @return void */ public function setId(string $id): void { $this->_id = $id; } /** * Getter method for the invoice_template_id attribute. * Unique ID to identify an invoice template. Available when the site is on a Pro or Elite plan. Used to specify if a non-default invoice template will be used to generate invoices for the account. For sites without multiple invoice templates enabled, the default template will always be used. * * @return ?string */ public function getInvoiceTemplateId(): ?string { return $this->_invoice_template_id; } /** * Setter method for the invoice_template_id attribute. * * @param string $invoice_template_id * * @return void */ public function setInvoiceTemplateId(string $invoice_template_id): void { $this->_invoice_template_id = $invoice_template_id; } /** * Getter method for the last_name attribute. * * * @return ?string */ public function getLastName(): ?string { return $this->_last_name; } /** * Setter method for the last_name attribute. * * @param string $last_name * * @return void */ public function setLastName(string $last_name): void { $this->_last_name = $last_name; } /** * Getter method for the object attribute. * Object type * * @return ?string */ public function getObject(): ?string { return $this->_object; } /** * Setter method for the object attribute. * * @param string $object * * @return void */ public function setObject(string $object): void { $this->_object = $object; } /** * Getter method for the override_business_entity_id attribute. * Unique ID to identify the business entity assigned to the account. Available when the `Multiple Business Entities` feature is enabled. * * @return ?string */ public function getOverrideBusinessEntityId(): ?string { return $this->_override_business_entity_id; } /** * Setter method for the override_business_entity_id attribute. * * @param string $override_business_entity_id * * @return void */ public function setOverrideBusinessEntityId(string $override_business_entity_id): void { $this->_override_business_entity_id = $override_business_entity_id; } /** * Getter method for the parent_account_id attribute. * The UUID of the parent account associated with this account. * * @return ?string */ public function getParentAccountId(): ?string { return $this->_parent_account_id; } /** * Setter method for the parent_account_id attribute. * * @param string $parent_account_id * * @return void */ public function setParentAccountId(string $parent_account_id): void { $this->_parent_account_id = $parent_account_id; } /** * Getter method for the preferred_locale attribute. * Used to determine the language and locale of emails sent on behalf of the merchant to the customer. * * @return ?string */ public function getPreferredLocale(): ?string { return $this->_preferred_locale; } /** * Setter method for the preferred_locale attribute. * * @param string $preferred_locale * * @return void */ public function setPreferredLocale(string $preferred_locale): void { $this->_preferred_locale = $preferred_locale; } /** * Getter method for the preferred_time_zone attribute. * The [IANA time zone name](https://docs.recurly.com/docs/email-time-zones-and-time-stamps#supported-api-iana-time-zone-names) used to determine the time zone of emails sent on behalf of the merchant to the customer. * * @return ?string */ public function getPreferredTimeZone(): ?string { return $this->_preferred_time_zone; } /** * Setter method for the preferred_time_zone attribute. * * @param string $preferred_time_zone * * @return void */ public function setPreferredTimeZone(string $preferred_time_zone): void { $this->_preferred_time_zone = $preferred_time_zone; } /** * Getter method for the shipping_addresses attribute. * The shipping addresses on the account. * * @return array */ public function getShippingAddresses(): array { return $this->_shipping_addresses ?? [] ; } /** * Setter method for the shipping_addresses attribute. * * @param array $shipping_addresses * * @return void */ public function setShippingAddresses(array $shipping_addresses): void { $this->_shipping_addresses = $shipping_addresses; } /** * Getter method for the state attribute. * Accounts can be either active or inactive. * * @return ?string */ public function getState(): ?string { return $this->_state; } /** * Setter method for the state attribute. * * @param string $state * * @return void */ public function setState(string $state): void { $this->_state = $state; } /** * Getter method for the tax_exempt attribute. * The tax status of the account. `true` exempts tax on the account, `false` applies tax on the account. * * @return ?bool */ public function getTaxExempt(): ?bool { return $this->_tax_exempt; } /** * Setter method for the tax_exempt attribute. * * @param bool $tax_exempt * * @return void */ public function setTaxExempt(bool $tax_exempt): void { $this->_tax_exempt = $tax_exempt; } /** * Getter method for the updated_at attribute. * When the account was last changed. * * @return ?string */ public function getUpdatedAt(): ?string { return $this->_updated_at; } /** * Setter method for the updated_at attribute. * * @param string $updated_at * * @return void */ public function setUpdatedAt(string $updated_at): void { $this->_updated_at = $updated_at; } /** * Getter method for the username attribute. * A secondary value for the account. * * @return ?string */ diff --git a/openapi/api.yaml b/openapi/api.yaml index 73b3d73..08c63a4 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -16965,1125 +16965,1135 @@ components: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/BillingInfo" CreditPaymentList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/CreditPayment" CouponList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/Coupon" CouponRedemptionList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/CouponRedemption" CustomFieldDefinitionList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/CustomFieldDefinition" ItemList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/Item" InvoiceList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/Invoice" MeasuredUnitList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/MeasuredUnit" LineItemList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/LineItem" PlanList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/Plan" SiteList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/Site" ShippingMethodList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ShippingMethod" SubscriptionList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/Subscription" TransactionList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/Transaction" Account: allOf: - "$ref": "#/components/schemas/AccountReadOnly" - "$ref": "#/components/schemas/AccountResponse" AccountAcquisition: allOf: - "$ref": "#/components/schemas/AccountAcquisitionUpdate" - "$ref": "#/components/schemas/AccountAcquisitionReadOnly" AccountAcquisitionUpdate: type: object properties: cost: type: object x-class-name: AccountAcquisitionCost title: Account balance items: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 amount: type: number format: float title: Amount description: The amount of the corresponding currency used to acquire the account. channel: description: The channel through which the account was acquired. "$ref": "#/components/schemas/ChannelEnum" subchannel: type: string description: An arbitrary subchannel string representing a distinction/subcategory within a broader channel. campaign: type: string description: An arbitrary identifier for the marketing campaign that led to the acquisition of this account. AccountAcquisitionReadOnly: type: object properties: id: type: string maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true account: "$ref": "#/components/schemas/AccountMini" created_at: type: string format: date-time description: When the account acquisition data was created. readOnly: true updated_at: type: string format: date-time description: When the account acquisition data was last changed. readOnly: true AccountReadOnly: type: object properties: id: type: string maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true state: description: Accounts can be either active or inactive. readOnly: true "$ref": "#/components/schemas/ActiveStateEnum" hosted_login_token: type: string description: 'The unique token for automatically logging the account in to the hosted management pages. You may automatically log the user into their hosted management pages by directing the user to: `https://{subdomain}.recurly.com/account/{hosted_login_token}`.' readOnly: true maxLength: 32 shipping_addresses: type: array description: The shipping addresses on the account. items: "$ref": "#/components/schemas/ShippingAddress" has_live_subscription: type: boolean description: Indicates if the account has a subscription that is either active, canceled, future, or paused. has_active_subscription: type: boolean description: Indicates if the account has an active subscription. has_future_subscription: type: boolean description: Indicates if the account has a future subscription. has_canceled_subscription: type: boolean description: Indicates if the account has a canceled subscription. has_paused_subscription: type: boolean description: Indicates if the account has a paused subscription. has_past_due_invoice: type: boolean description: Indicates if the account has a past due invoice. created_at: type: string format: date-time description: When the account was created. readOnly: true updated_at: type: string format: date-time description: When the account was last changed. readOnly: true deleted_at: type: string format: date-time description: If present, when the account was last marked inactive. readOnly: true AccountCreate: allOf: - type: object properties: code: type: string description: The unique identifier of the account. This cannot be changed once the account is created. maxLength: 50 acquisition: "$ref": "#/components/schemas/AccountAcquisitionUpdate" external_accounts: type: array title: External Accounts items: "$ref": "#/components/schemas/ExternalAccountCreate" shipping_addresses: type: array items: "$ref": "#/components/schemas/ShippingAddressCreate" required: - code - "$ref": "#/components/schemas/AccountUpdate" AccountPurchase: allOf: - type: object properties: id: type: string description: Optional, but if present allows an existing account to be used and updated as part of the purchase. maxLength: 13 code: type: string description: The unique identifier of the account. This cannot be changed once the account is created. maxLength: 50 acquisition: "$ref": "#/components/schemas/AccountAcquisitionUpdate" required: - code - "$ref": "#/components/schemas/AccountUpdate" AccountReference: type: object properties: id: type: string maxLength: 13 code: type: string maxLength: 50 AccountUpdate: type: object properties: username: type: string description: A secondary value for the account. maxLength: 255 email: type: string format: email description: The email address used for communicating with this customer. The customer will also use this email address to log into your hosted account management pages. This value does not need to be unique. maxLength: 255 preferred_locale: description: Used to determine the language and locale of emails sent on behalf of the merchant to the customer. The list of locales is restricted to those the merchant has enabled on the site. "$ref": "#/components/schemas/PreferredLocaleEnum" preferred_time_zone: type: string example: America/Los_Angeles description: Used to determine the time zone of emails sent on behalf of the merchant to the customer. Must be a [supported IANA time zone name](https://docs.recurly.com/docs/email-time-zones-and-time-stamps#supported-api-iana-time-zone-names) cc_emails: type: string description: Additional email address that should receive account correspondence. These should be separated only by commas. These CC emails will receive all emails that the `email` field also receives. maxLength: 255 first_name: type: string maxLength: 255 last_name: type: string maxLength: 255 company: type: string maxLength: 100 vat_number: type: string description: The VAT number of the account (to avoid having the VAT applied). This is only used for manually collected invoices. maxLength: 20 tax_exempt: type: boolean description: The tax status of the account. `true` exempts tax on the account, `false` applies tax on the account. exemption_certificate: type: string description: The tax exemption certificate number for the account. If the merchant has an integration for the Vertex tax provider, this optional value will be sent in any tax calculation requests for the account. maxLength: 30 override_business_entity_id: type: string title: Override Business Entity ID description: Unique ID to identify the business entity assigned to the account. Available when the `Multiple Business Entities` feature is enabled. parent_account_code: type: string maxLength: 50 description: The account code of the parent account to be associated with this account. Passing an empty value removes any existing parent association from this account. If both `parent_account_code` and `parent_account_id` are passed, the non-blank value in `parent_account_id` will be used. Only one level of parent child relationship is allowed. You cannot assign a parent account that itself has a parent account. parent_account_id: type: string maxLength: 13 description: The UUID of the parent account to be associated with this account. Passing an empty value removes any existing parent association from this account. If both `parent_account_code` and `parent_account_id` are passed, the non-blank value in `parent_account_id` will be used. Only one level of parent child relationship is allowed. You cannot assign a parent account that itself has a parent account. bill_to: maxLength: 6 description: An enumerable describing the billing behavior of the account, specifically whether the account is self-paying or will rely on the parent account to pay. "$ref": "#/components/schemas/BillToEnum" transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" dunning_campaign_id: type: string title: Dunning Campaign ID description: Unique ID to identify a dunning campaign. Used to specify if a non-default dunning campaign should be assigned to this account. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. invoice_template_id: type: string title: Invoice Template ID description: Unique ID to identify an invoice template. Available when the site is on a Pro or Elite plan. Used to specify which invoice template, if any, should be used to generate invoices for the account. address: "$ref": "#/components/schemas/Address" billing_info: "$ref": "#/components/schemas/BillingInfoCreate" custom_fields: "$ref": "#/components/schemas/CustomFields" + entity_use_code: + type: string + description: The Avalara AvaTax value that can be passed to identify the + customer type for tax purposes. The range of values can be A - R (more + info at Avalara). Value is case-sensitive. AccountResponse: type: object properties: code: type: string description: The unique identifier of the account. This cannot be changed once the account is created. maxLength: 50 readOnly: true username: type: string description: A secondary value for the account. maxLength: 255 email: type: string format: email description: The email address used for communicating with this customer. The customer will also use this email address to log into your hosted account management pages. This value does not need to be unique. maxLength: 255 override_business_entity_id: type: string title: Override Business Entity ID description: Unique ID to identify the business entity assigned to the account. Available when the `Multiple Business Entities` feature is enabled. preferred_locale: description: Used to determine the language and locale of emails sent on behalf of the merchant to the customer. "$ref": "#/components/schemas/PreferredLocaleEnum" preferred_time_zone: type: string example: America/Los_Angeles description: The [IANA time zone name](https://docs.recurly.com/docs/email-time-zones-and-time-stamps#supported-api-iana-time-zone-names) used to determine the time zone of emails sent on behalf of the merchant to the customer. cc_emails: type: string description: Additional email address that should receive account correspondence. These should be separated only by commas. These CC emails will receive all emails that the `email` field also receives. maxLength: 255 first_name: type: string maxLength: 255 last_name: type: string maxLength: 255 company: type: string maxLength: 50 vat_number: type: string description: The VAT number of the account (to avoid having the VAT applied). This is only used for manually collected invoices. maxLength: 20 tax_exempt: type: boolean description: The tax status of the account. `true` exempts tax on the account, `false` applies tax on the account. exemption_certificate: type: string description: The tax exemption certificate number for the account. If the merchant has an integration for the Vertex tax provider, this optional value will be sent in any tax calculation requests for the account. maxLength: 30 external_accounts: type: array description: The external accounts belonging to this account items: "$ref": "#/components/schemas/ExternalAccount" parent_account_id: type: string maxLength: 13 description: The UUID of the parent account associated with this account. bill_to: maxLength: 6 description: An enumerable describing the billing behavior of the account, specifically whether the account is self-paying or will rely on the parent account to pay. "$ref": "#/components/schemas/BillToEnum" dunning_campaign_id: type: string title: Dunning Campaign ID description: Unique ID to identify a dunning campaign. Used to specify if a non-default dunning campaign should be assigned to this account. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. invoice_template_id: type: string title: Invoice Template ID description: Unique ID to identify an invoice template. Available when the site is on a Pro or Elite plan. Used to specify if a non-default invoice template will be used to generate invoices for the account. For sites without multiple invoice templates enabled, the default template will always be used. address: "$ref": "#/components/schemas/Address" billing_info: "$ref": "#/components/schemas/BillingInfo" custom_fields: "$ref": "#/components/schemas/CustomFields" + entity_use_code: + type: string + description: The Avalara AvaTax value that can be passed to identify the + customer type for tax purposes. The range of values can be A - R (more + info at Avalara). Value is case-sensitive. AccountNote: type: object required: - message properties: id: type: string maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true account_id: type: string user: "$ref": "#/components/schemas/User" message: type: string created_at: type: string format: date-time readOnly: true AccountMini: type: object title: Account mini details properties: id: type: string maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true code: type: string description: The unique identifier of the account. maxLength: 50 email: type: string format: email description: The email address used for communicating with this customer. maxLength: 255 first_name: type: string maxLength: 255 last_name: type: string maxLength: 255 company: type: string maxLength: 255 parent_account_id: type: string maxLength: 13 bill_to: type: string maxLength: 6 dunning_campaign_id: type: string title: Dunning Campaign ID description: Unique ID to identify a dunning campaign. Used to specify if a non-default dunning campaign should be assigned to this account. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. AccountBalance: type: object properties: object: type: string title: Object type readOnly: true account: "$ref": "#/components/schemas/AccountMini" past_due: type: boolean balances: type: array items: "$ref": "#/components/schemas/AccountBalanceAmount" AccountBalanceAmount: type: object title: Balance Amount properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 amount: type: number format: float title: Amount description: Total amount the account is past due. processing_prepayment_amount: type: number format: float title: Processing Prepayment Amount description: Total amount for the prepayment credit invoices in a `processing` state on the account. available_credit_amount: type: number format: float title: Available Credit Amount description: Total amount of the open balances on credit invoices for the account. InvoiceAddress: allOf: - "$ref": "#/components/schemas/Address" - "$ref": "#/components/schemas/AddressWithName" type: object properties: name_on_account: type: string title: Name on account company: type: string title: Company Address: type: object properties: phone: type: string title: Phone number street1: type: string title: Street 1 street2: type: string title: Street 2 city: type: string title: City region: type: string title: State/Province description: State or province. postal_code: type: string title: Zip/Postal code description: Zip or postal code. country: type: string title: Country description: Country, 2-letter ISO 3166-1 alpha-2 code. geo_code: type: string maxLength: 20 description: Code that represents a geographic entity (location or object). Only returned for Sling Vertex Integration AddressWithName: allOf: - "$ref": "#/components/schemas/Address" type: object properties: first_name: type: string title: First name last_name: type: string title: Last name AddOnMini: type: object title: Add-on mini details description: Just the important parts. properties: id: type: string title: Add-on ID maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true code: type: string title: Add-on code description: The unique identifier for the add-on within its plan. maxLength: 50 name: type: string title: Name description: Describes your add-on and will appear in subscribers' invoices. maxLength: 255 add_on_type: "$ref": "#/components/schemas/AddOnTypeEnum" usage_type: "$ref": "#/components/schemas/UsageTypeEnum" usage_percentage: type: number format: float title: Usage Percentage description: The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. measured_unit_id: type: string title: Measured Unit ID description: System-generated unique identifier for an measured unit associated with the add-on. maxLength: 13 item_id: type: string title: Item ID maxLength: 13 readOnly: true external_sku: type: string title: External SKU description: Optional, stock keeping unit to link the item to other inventory systems. maxLength: 50 readOnly: true accounting_code: type: string title: Accounting code description: Accounting code for invoice line items for this add-on. If no value is provided, it defaults to add-on's code. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 AddOn: type: object title: Add-on description: Full add-on details. properties: id: type: string title: Add-on ID maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true plan_id: type: string title: Plan ID maxLength: 13 readOnly: true code: type: string title: Add-on code description: The unique identifier for the add-on within its plan. maxLength: 50 state: title: State description: Add-ons can be either active or inactive. readOnly: true "$ref": "#/components/schemas/ActiveStateEnum" name: type: string title: Name description: Describes your add-on and will appear in subscribers' invoices. maxLength: 255 add_on_type: "$ref": "#/components/schemas/AddOnTypeEnum" usage_type: "$ref": "#/components/schemas/UsageTypeEnum" usage_calculation_type: "$ref": "#/components/schemas/UsageCalculationTypeEnum" usage_percentage: type: number format: float title: Usage Percentage description: The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. measured_unit_id: type: string title: Measured Unit ID description: System-generated unique identifier for an measured unit associated with the add-on. maxLength: 13 accounting_code: type: string title: Accounting code description: Accounting code for invoice line items for this add-on. If no value is provided, it defaults to add-on's code. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 revenue_schedule_type: title: Revenue schedule type description: When this add-on is invoiced, the line item will use this revenue schedule. If `item_code`/`item_id` is part of the request then `revenue_schedule_type` must be absent in the request as the value will be set from the item. "$ref": "#/components/schemas/RevenueScheduleTypeEnum" avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 tax_code: type: string title: Tax code description: Used by Avalara, Vertex, and Recurly’s EU VAT tax feature. The tax code values are specific to each tax system. If you are using Recurly’s EU VAT feature you can use `unknown`, `physical`, or `digital`. maxLength: 50 display_quantity: type: boolean title: Display quantity? description: Determines if the quantity field is displayed on the hosted pages for the add-on. default: false default_quantity: type: integer title: Default quantity description: Default quantity for the hosted pages. default: 1 optional: type: boolean title: Optional description: Whether the add-on is optional for the customer to include in their purchase on the hosted payment page. If false, the add-on will be included when a subscription is created through the Recurly UI. However, the add-on will not be included when a subscription is created through the API. currencies: type: array title: Add-on pricing items: "$ref": "#/components/schemas/AddOnPricing" minItems: 1 item: "$ref": "#/components/schemas/ItemMini" readOnly: true tier_type: "$ref": "#/components/schemas/TierTypeEnum" usage_timeframe: "$ref": "#/components/schemas/UsageTimeframeEnum" tiers: type: array title: Tiers items: "$ref": "#/components/schemas/Tier" percentage_tiers: type: array title: Percentage Tiers description: This feature is currently in development and requires approval and enablement, please contact support. items: "$ref": "#/components/schemas/PercentageTiersByCurrency" external_sku: type: string title: External SKU description: Optional, stock keeping unit to link the item to other inventory systems. maxLength: 50 readOnly: true created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at readOnly: true required: - code - name AddOnCreate: type: object title: Add-on description: Full add-on details. properties: item_code: type: string title: Item Code description: Unique code to identify an item. Available when the `Credit Invoices` feature are enabled. If `item_id` and `item_code` are both present, `item_id` will be used. pattern: "/^[a-z0-9_+-]+$/" maxLength: 50 item_id: type: string title: Item ID description: System-generated unique identifier for an item. Available when the `Credit Invoices` feature is enabled. If `item_id` and `item_code` are both present, `item_id` will be used. maxLength: 13 code: type: string title: Add-on code description: The unique identifier for the add-on within its plan. If `item_code`/`item_id` is part of the request then `code` must be absent. If `item_code`/`item_id` is not present `code` is required. maxLength: 50 name: type: string title: Name description: Describes your add-on and will appear in subscribers' invoices. If `item_code`/`item_id` is part of the request then `name` must be absent. If `item_code`/`item_id` is not present `name` is required. maxLength: 255 add_on_type: "$ref": "#/components/schemas/AddOnTypeCreateEnum" usage_type: "$ref": "#/components/schemas/UsageTypeCreateEnum" usage_calculation_type: "$ref": "#/components/schemas/UsageCalculationTypeEnum" usage_percentage: type: number format: float title: Usage Percentage description: The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. Required if `add_on_type` is usage, `tier_type` is `flat` and `usage_type` is percentage. Must be omitted otherwise. measured_unit_id: type: string title: Measured Unit ID description: System-generated unique identifier for a measured unit to be associated with the add-on. Either `measured_unit_id` or `measured_unit_name` are required when `add_on_type` is `usage`. If `measured_unit_id` and `measured_unit_name` are both present, `measured_unit_id` will be used. maxLength: 13 measured_unit_name: type: string title: Measured Unit Name description: Name of a measured unit to be associated with the add-on. Either `measured_unit_id` or `measured_unit_name` are required when `add_on_type` is `usage`. If `measured_unit_id` and `measured_unit_name` are both present, `measured_unit_id` will be used. plan_id: type: string title: Plan ID maxLength: 13 readOnly: true accounting_code: type: string title: Accounting code description: Accounting code for invoice line items for this add-on. If no value is provided, it defaults to add-on's code. If `item_code`/`item_id` is part of the request then `accounting_code` must be absent. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 revenue_schedule_type: title: Revenue schedule type description: When this add-on is invoiced, the line item will use this revenue schedule. If `item_code`/`item_id` is part of the request then `revenue_schedule_type` must be absent in the request as the value will be set from the item. "$ref": "#/components/schemas/RevenueScheduleTypeEnum" display_quantity: type: boolean title: Display quantity? description: Determines if the quantity field is displayed on the hosted pages for the add-on. default: false default_quantity: type: integer title: Default quantity description: Default quantity for the hosted pages. default: 1 optional: type: boolean title: Optional description: Whether the add-on is optional for the customer to include in their purchase on the hosted payment page. If false, the add-on will be included when a subscription is created through the Recurly UI. However, the add-on will not be included when a subscription is created through the API. avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `AddOn`, then the `avalara_transaction_type` must be absent. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `AddOn`, then the `avalara_service_type` must be absent. minimum: 0 tax_code: type: string title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's EU VAT tax feature to determine taxation rules. If you have your own AvaTax or Vertex account configured, use their tax codes to assign specific tax rules. If you are using Recurly's EU VAT feature, you can use values of `unknown`, `physical`, or `digital`. If `item_code`/`item_id` is part of the request then `tax_code` must be absent. maxLength: 50 currencies: type: array title: Add-on pricing items: "$ref": "#/components/schemas/AddOnPricing"
recurly/recurly-client-php
1b8f135e74a978521ff697d3f393d2ae95680490
4.49.0
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index d20c79c..be75449 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 4.48.0 +current_version = 4.49.0 parse = (?P<major>\d+) \.(?P<minor>\d+) \.(?P<patch>\d+) serialize = {major}.{minor}.{patch} [bumpversion:file:composer.json] [bumpversion:file:lib/recurly/version.php] diff --git a/CHANGELOG.md b/CHANGELOG.md index b75301a..bd0e6ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,514 +1,525 @@ # Changelog +## [4.49.0](https://github.com/recurly/recurly-client-php/tree/4.49.0) (2024-05-08) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.48.0...4.49.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 (Proration Settings) [#810](https://github.com/recurly/recurly-client-php/pull/810) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.48.0](https://github.com/recurly/recurly-client-php/tree/4.48.0) (2024-05-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.47.0...4.48.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Auth & Capture) [#808](https://github.com/recurly/recurly-client-php/pull/808) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.47.0](https://github.com/recurly/recurly-client-php/tree/4.47.0) (2024-03-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.46.0...4.47.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#803](https://github.com/recurly/recurly-client-php/pull/803) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.46.0](https://github.com/recurly/recurly-client-php/tree/4.46.0) (2024-02-20) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.45.0...4.46.0) **Merged Pull Requests** - Add invoice state param for v2021-02-25 [#799](https://github.com/recurly/recurly-client-php/pull/799) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.45.0](https://github.com/recurly/recurly-client-php/tree/4.45.0) (2024-01-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.44.0...4.45.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#789](https://github.com/recurly/recurly-client-php/pull/789) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.44.0](https://github.com/recurly/recurly-client-php/tree/4.44.0) (2024-01-18) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.43.0...4.44.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#788](https://github.com/recurly/recurly-client-php/pull/788) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.43.0](https://github.com/recurly/recurly-client-php/tree/4.43.0) (2023-12-06) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.42.0...4.43.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Payment Phases) [#785](https://github.com/recurly/recurly-client-php/pull/785) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.42.0](https://github.com/recurly/recurly-client-php/tree/4.42.0) (2023-11-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.41.0...4.42.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#783](https://github.com/recurly/recurly-client-php/pull/783) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.41.0](https://github.com/recurly/recurly-client-php/tree/4.41.0) (2023-08-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.40.0...4.41.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (`VATNumber`, `LifecycleDecline`) [#782](https://github.com/recurly/recurly-client-php/pull/782) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.40.0](https://github.com/recurly/recurly-client-php/tree/4.40.0) (2023-08-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.39.0...4.40.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (action_result) [#781](https://github.com/recurly/recurly-client-php/pull/781) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.39.0](https://github.com/recurly/recurly-client-php/tree/4.39.0) (2023-07-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.37.0...4.39.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Ramp Dates, Net Terms, Invoice Business Entity) [#779](https://github.com/recurly/recurly-client-php/pull/779) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (App Management - External Subscriptions) [#777](https://github.com/recurly/recurly-client-php/pull/777) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.37.0](https://github.com/recurly/recurly-client-php/tree/4.37.0) (2023-06-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.36.0...4.37.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Multiple Business Entities) [#769](https://github.com/recurly/recurly-client-php/pull/769) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.36.0](https://github.com/recurly/recurly-client-php/tree/4.36.0) (2023-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.35.0...4.36.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Products & References) [#766](https://github.com/recurly/recurly-client-php/pull/766) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.35.0](https://github.com/recurly/recurly-client-php/tree/4.35.0) (2023-05-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.34.0...4.35.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (gateway_attributes on PaymentMethod) [#764](https://github.com/recurly/recurly-client-php/pull/764) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#747](https://github.com/recurly/recurly-client-php/pull/747) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.28.0](https://github.com/recurly/recurly-client-php/tree/4.28.0) (2023-02-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.27.0...4.28.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (GiftCard endpoints and new transaction error support) [#745](https://github.com/recurly/recurly-client-php/pull/745) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.27.0](https://github.com/recurly/recurly-client-php/tree/4.27.0) (2023-01-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.26.0...4.27.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Custom Fields on Line Items) [#738](https://github.com/recurly/recurly-client-php/pull/738) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.26.0](https://github.com/recurly/recurly-client-php/tree/4.26.0) (2023-01-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.25.0...4.26.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Account Preferred Time Zone) [#736](https://github.com/recurly/recurly-client-php/pull/736) ([douglasmiller](https://github.com/douglasmiller)) ## [4.25.0](https://github.com/recurly/recurly-client-php/tree/4.25.0) (2022-11-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.24.0...4.25.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Apply Credit Balance feature) [#732](https://github.com/recurly/recurly-client-php/pull/732) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.24.0](https://github.com/recurly/recurly-client-php/tree/4.24.0) (2022-11-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.23.0...4.24.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Subscriptions feature) [#729](https://github.com/recurly/recurly-client-php/pull/729) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#728](https://github.com/recurly/recurly-client-php/pull/728) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.23.0](https://github.com/recurly/recurly-client-php/tree/4.23.0) (2022-10-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.22.0...4.23.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entitlements feature) [#725](https://github.com/recurly/recurly-client-php/pull/725) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.22.0](https://github.com/recurly/recurly-client-php/tree/4.22.0) (2022-10-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.2...4.22.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25(Decimal Usage and Quantities and DunningEvent new fields) [#722](https://github.com/recurly/recurly-client-php/pull/722) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.2](https://github.com/recurly/recurly-client-php/tree/4.21.2) (2022-09-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.1...4.21.2) **Merged Pull Requests** - feat: allow for psr/log ^2/3 [#716](https://github.com/recurly/recurly-client-php/pull/716) ([trickeyone](https://github.com/trickeyone)) ## [4.21.1](https://github.com/recurly/recurly-client-php/tree/4.21.1) (2022-09-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.0...4.21.1) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#714](https://github.com/recurly/recurly-client-php/pull/714) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.0](https://github.com/recurly/recurly-client-php/tree/4.21.0) (2022-09-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.20.0...4.21.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#713](https://github.com/recurly/recurly-client-php/pull/713) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixes bug with putDunningCampaignBulkUpdate [#706](https://github.com/recurly/recurly-client-php/pull/706) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.20.0](https://github.com/recurly/recurly-client-php/tree/4.20.0) (2022-08-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.19.0...4.20.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#701](https://github.com/recurly/recurly-client-php/pull/701) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.19.0](https://github.com/recurly/recurly-client-php/tree/4.19.0) (2022-07-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.18.0...4.19.0) **Merged Pull Requests** - Fixing deprecation warnings in client [#697](https://github.com/recurly/recurly-client-php/pull/697) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#695](https://github.com/recurly/recurly-client-php/pull/695) ([recurly-integrations](https://github.com/recurly-integrations)) **Closed Issues** - Recurly\Pager and \Iterator return type mismatch (PHP 8.1 deprecation) [#677](https://github.com/recurly/recurly-client-php/issues/677) ## [4.18.0](https://github.com/recurly/recurly-client-php/tree/4.18.0) (2022-06-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.17.0...4.18.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#693](https://github.com/recurly/recurly-client-php/pull/693) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.17.0](https://github.com/recurly/recurly-client-php/tree/4.17.0) (2022-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.16.0...4.17.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#679](https://github.com/recurly/recurly-client-php/pull/679) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.16.0](https://github.com/recurly/recurly-client-php/tree/4.16.0) (2022-03-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.15.0...4.16.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#676](https://github.com/recurly/recurly-client-php/pull/676) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.15.0](https://github.com/recurly/recurly-client-php/tree/4.15.0) (2022-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.14.0...4.15.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#668](https://github.com/recurly/recurly-client-php/pull/668) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.14.0](https://github.com/recurly/recurly-client-php/tree/4.14.0) (2022-03-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.13.0...4.14.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#664](https://github.com/recurly/recurly-client-php/pull/664) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.13.0](https://github.com/recurly/recurly-client-php/tree/4.13.0) (2022-01-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.12.0...4.13.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#655](https://github.com/recurly/recurly-client-php/pull/655) ([recurly-integrations](https://github.com/recurly-integrations)) - Add region argument to client to connect in EU data center [#653](https://github.com/recurly/recurly-client-php/pull/653) ([FabricioCoutinho](https://github.com/FabricioCoutinho)) ## [4.12.0](https://github.com/recurly/recurly-client-php/tree/4.12.0) (2022-01-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.11.0...4.12.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Invoice Customization) [#654](https://github.com/recurly/recurly-client-php/pull/654) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#651](https://github.com/recurly/recurly-client-php/pull/651) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.11.0](https://github.com/recurly/recurly-client-php/tree/4.11.0) (2021-12-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.10.0...4.11.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Tax Inclusive Pricing) [#650](https://github.com/recurly/recurly-client-php/pull/650) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.10.0](https://github.com/recurly/recurly-client-php/tree/4.10.0) (2021-11-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.9.0...4.10.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#647](https://github.com/recurly/recurly-client-php/pull/647) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#645](https://github.com/recurly/recurly-client-php/pull/645) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#644](https://github.com/recurly/recurly-client-php/pull/644) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#639](https://github.com/recurly/recurly-client-php/pull/639) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.9.0](https://github.com/recurly/recurly-client-php/tree/4.9.0) (2021-09-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.8.0...4.9.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Support to new subscription fields and response) [#633](https://github.com/recurly/recurly-client-php/pull/633) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.8.0](https://github.com/recurly/recurly-client-php/tree/4.8.0) (2021-09-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.7.0...4.8.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Dunning Campaigns feature) [#632](https://github.com/recurly/recurly-client-php/pull/632) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.7.0](https://github.com/recurly/recurly-client-php/tree/4.7.0) (2021-08-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.6.0...4.7.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (get_preview_renewal) [#630](https://github.com/recurly/recurly-client-php/pull/630) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.6.0](https://github.com/recurly/recurly-client-php/tree/4.6.0) (2021-08-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.5.0...4.6.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#628](https://github.com/recurly/recurly-client-php/pull/628) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.5.0](https://github.com/recurly/recurly-client-php/tree/4.5.0) (2021-08-02) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.4.0...4.5.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#623](https://github.com/recurly/recurly-client-php/pull/623) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixing issue with http_build_query converting booleans in params to integers [#621](https://github.com/recurly/recurly-client-php/pull/621) ([ZloeSabo](https://github.com/ZloeSabo)) ## [4.4.0](https://github.com/recurly/recurly-client-php/tree/4.4.0) (2021-06-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.3.0...4.4.0) diff --git a/composer.json b/composer.json index 8fa2190..8da213c 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,38 @@ { "name": "recurly/recurly-client", - "version": "4.48.0", + "version": "4.49.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], "homepage": "https://github.com/recurly/recurly-client-php", "license": "MIT", "authors": [], "require": { "php": ">= 7.2.0", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "phpcompatibility/php-compatibility": "^9.3", "phpdocumentor/phpdocumentor": "~3.0.0", "phpstan/phpstan": "^0.12.11", "phpunit/phpunit": "^8", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "classmap": ["lib"], "files": ["lib/recurly.php"] }, "autoload-dev": { "classmap": ["tests"] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/lib/recurly/version.php b/lib/recurly/version.php index e4f2d23..c2fcdd9 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -1,8 +1,8 @@ <?php namespace Recurly; class Version { - public const CURRENT = '4.48.0'; + public const CURRENT = '4.49.0'; }
recurly/recurly-client-php
66c2654de401991d11c0daf7b259a7e1d4d6f147
Generated Latest Changes for v2021-02-25
diff --git a/openapi/api.yaml b/openapi/api.yaml index 0c948a9..73b3d73 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -20744,1024 +20744,1052 @@ components: Page URLs and in the invoice exports. pattern: "/^[a-z0-9_+-]+$/i" maxLength: 50 name: type: string title: Name description: This name describes your plan and will appear on the Hosted Payment Page and the subscriber's invoice. maxLength: 255 description: type: string title: Description description: Optional description, not displayed. accounting_code: type: string title: Plan accounting code description: Accounting code for invoice line items for the plan. If no value is provided, it defaults to plan's code. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 interval_unit: title: Interval unit description: Unit for the plan's billing interval. default: months "$ref": "#/components/schemas/IntervalUnitEnum" interval_length: type: integer title: Interval length description: Length of the plan's billing interval in `interval_unit`. default: 1 minimum: 1 trial_unit: title: Trial unit description: Units for the plan's trial period. default: months "$ref": "#/components/schemas/IntervalUnitEnum" trial_length: type: integer title: Trial length description: Length of plan's trial period in `trial_units`. `0` means `no trial`. default: 0 minimum: 0 trial_requires_billing_info: type: boolean title: Trial Requires BillingInfo description: Allow free trial subscriptions to be created without billing info. Should not be used if billing info is needed for initial invoice due to existing uninvoiced charges or setup fee. default: true total_billing_cycles: type: integer title: Total billing cycles description: Automatically terminate plans after a defined number of billing cycles. minimum: 0 auto_renew: type: boolean title: Auto renew default: true description: Subscriptions will automatically inherit this value once they are active. If `auto_renew` is `true`, then a subscription will automatically renew its term at renewal. If `auto_renew` is `false`, then a subscription will expire at the end of its term. `auto_renew` can be overridden on the subscription record itself. pricing_model: title: Pricing Model "$ref": "#/components/schemas/PricingModelTypeEnum" ramp_intervals: type: array title: Ramp Intervals items: "$ref": "#/components/schemas/PlanRampInterval" custom_fields: "$ref": "#/components/schemas/CustomFields" revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" setup_fee_revenue_schedule_type: title: Setup fee revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" setup_fee_accounting_code: type: string title: Setup fee accounting code description: Accounting code for invoice line items for the plan's setup fee. If no value is provided, it defaults to plan's accounting code. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 tax_code: type: string title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's EU VAT tax feature to determine taxation rules. If you have your own AvaTax or Vertex account configured, use their tax codes to assign specific tax rules. If you are using Recurly's EU VAT feature, you can use values of `unknown`, `physical`, or `digital`. maxLength: 50 tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on the plan, `false` applies tax on the plan." currencies: type: array title: Pricing items: "$ref": "#/components/schemas/PlanPricing" minItems: 1 hosted_pages: type: object title: Hosted pages settings "$ref": "#/components/schemas/PlanHostedPages" add_ons: type: array title: Add Ons items: "$ref": "#/components/schemas/AddOnCreate" allow_any_item_on_subscriptions: type: boolean title: Allow any item on subscriptions default: false description: | Used to determine whether items can be assigned as add-ons to individual subscriptions. If `true`, items can be assigned as add-ons to individual subscription add-ons. If `false`, only plan add-ons can be used. dunning_campaign_id: type: string title: Dunning Campaign ID description: Unique ID to identify a dunning campaign. Used to specify if a non-default dunning campaign should be assigned to this plan. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. required: - code - name - currencies PlanHostedPages: type: object properties: success_url: type: string title: Success redirect URL description: URL to redirect to after signup on the hosted payment pages. cancel_url: type: string title: Cancel redirect URL (deprecated) description: URL to redirect to on canceled signup on the hosted payment pages. bypass_confirmation: type: boolean title: Bypass confirmation page? description: If `true`, the customer will be sent directly to your `success_url` after a successful signup, bypassing Recurly's hosted confirmation page. display_quantity: type: boolean title: Display quantity? description: Determines if the quantity field is displayed on the hosted pages for the plan. PlanPricing: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 setup_fee: type: number format: float title: Setup fee description: Amount of one-time setup fee automatically charged at the beginning of a subscription billing cycle. For subscription plans with a trial, the setup fee will be charged at the time of signup. Setup fees do not increase with the quantity of a subscription plan. minimum: 0 maximum: 1000000 unit_amount: type: number format: float title: Unit price description: This field should not be sent when the pricing model is 'ramp'. minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true PlanRampInterval: type: object title: Plan Ramp Interval properties: starting_billing_cycle: type: integer description: Represents the billing cycle where a ramp interval starts. default: 1 currencies: type: array description: Represents the price for the ramp interval. items: "$ref": "#/components/schemas/PlanRampPricing" PlanUpdate: type: object properties: id: type: string title: Plan ID maxLength: 13 readOnly: true code: type: string title: Plan code description: Unique code to identify the plan. This is used in Hosted Payment Page URLs and in the invoice exports. pattern: "/^[a-z0-9_+-]+$/i" maxLength: 50 name: type: string title: Name description: This name describes your plan and will appear on the Hosted Payment Page and the subscriber's invoice. maxLength: 255 description: type: string title: Description description: Optional description, not displayed. accounting_code: type: string title: Plan accounting code description: Accounting code for invoice line items for the plan. If no value is provided, it defaults to plan's code. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 trial_unit: title: Trial unit description: Units for the plan's trial period. default: months "$ref": "#/components/schemas/IntervalUnitEnum" trial_length: type: integer title: Trial length description: Length of plan's trial period in `trial_units`. `0` means `no trial`. default: 0 minimum: 0 trial_requires_billing_info: type: boolean title: Trial Requires BillingInfo description: Allow free trial subscriptions to be created without billing info. Should not be used if billing info is needed for initial invoice due to existing uninvoiced charges or setup fee. default: true total_billing_cycles: type: integer title: Total billing cycles description: Automatically terminate plans after a defined number of billing cycles. minimum: 0 auto_renew: type: boolean title: Auto renew default: true description: Subscriptions will automatically inherit this value once they are active. If `auto_renew` is `true`, then a subscription will automatically renew its term at renewal. If `auto_renew` is `false`, then a subscription will expire at the end of its term. `auto_renew` can be overridden on the subscription record itself. ramp_intervals: type: array title: Ramp Intervals items: "$ref": "#/components/schemas/PlanRampInterval" custom_fields: "$ref": "#/components/schemas/CustomFields" revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" setup_fee_revenue_schedule_type: title: Setup fee revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" setup_fee_accounting_code: type: string title: Setup fee accounting code description: Accounting code for invoice line items for the plan's setup fee. If no value is provided, it defaults to plan's accounting code. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the plan is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 tax_code: type: string title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's EU VAT tax feature to determine taxation rules. If you have your own AvaTax or Vertex account configured, use their tax codes to assign specific tax rules. If you are using Recurly's EU VAT feature, you can use values of `unknown`, `physical`, or `digital`. maxLength: 50 tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on the plan, `false` applies tax on the plan." currencies: type: array title: Pricing description: Optional when the pricing model is 'ramp'. items: "$ref": "#/components/schemas/PlanPricing" minItems: 1 hosted_pages: type: object title: Hosted pages settings "$ref": "#/components/schemas/PlanHostedPages" allow_any_item_on_subscriptions: type: boolean title: Allow any item on subscriptions description: | Used to determine whether items can be assigned as add-ons to individual subscriptions. If `true`, items can be assigned as add-ons to individual subscription add-ons. If `false`, only plan add-ons can be used. dunning_campaign_id: type: string title: Dunning Campaign ID description: Unique ID to identify a dunning campaign. Used to specify if a non-default dunning campaign should be assigned to this plan. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used. AddOnPricing: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 unit_amount: type: number format: float title: Unit price minimum: 0 maximum: 1000000 description: Allows up to 2 decimal places. Required unless `unit_amount_decimal` is provided. unit_amount_decimal: type: string title: Unit Amount Decimal minimum: 0 maximum: 1000000 description: | Allows up to 9 decimal places. Only supported when `add_on_type` = `usage`. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided. tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true required: - currency TierPricing: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 unit_amount: type: number format: float title: Unit price minimum: 0 maximum: 1000000 description: Allows up to 2 decimal places. Required unless `unit_amount_decimal` is provided. unit_amount_decimal: type: string title: Unit Amount Decimal minimum: 0 maximum: 1000000 description: | Allows up to 9 decimal places. Only supported when `add_on_type` = `usage`. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided. required: - currency PlanRampPricing: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 unit_amount: type: number format: float title: Unit price description: Represents the price for the Ramp Interval. minimum: 0 maximum: 1000000 required: - currency - unit_amount Pricing: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 unit_amount: type: number format: float title: Unit price minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true required: - currency - unit_amount Tier: type: object properties: ending_quantity: type: integer title: Ending quantity minimum: 1 maximum: 999999999 description: Ending quantity for the tier. This represents a unit amount for unit-priced add ons. Must be left empty if it is the final tier. usage_percentage: type: string title: Usage Percentage description: "(deprecated) -- Use the percentage_tiers object instead." deprecated: true currencies: type: array title: Tier pricing items: "$ref": "#/components/schemas/TierPricing" minItems: 1 PercentageTiersByCurrency: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 tiers: type: array title: Tiers items: "$ref": "#/components/schemas/PercentageTier" minItems: 1 PercentageTier: type: object properties: ending_amount: type: number format: float title: Ending amount minimum: 0.01 maximum: 9999999999999.99 description: Ending amount for the tier. Allows up to 2 decimal places. Must be left empty if it is the final tier. usage_percentage: type: string title: Usage Percentage minimum: 0 maximum: 100 description: | The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places represented as a string. + ProrationSettings: + type: object + title: Proration Settings + description: Allows you to control how any resulting charges and credits will + be calculated and prorated. + properties: + charge: + "$ref": "#/components/schemas/ProrationSettingsChargeEnum" + credit: + "$ref": "#/components/schemas/ProrationSettingsCreditEnum" + ProrationSettingsChargeEnum: + type: string + title: Charge + description: Determines how the amount charged is determined for this change + default: prorated_amount + enum: + - full_amount + - prorated_amount + - none + ProrationSettingsCreditEnum: + type: string + title: Credit + description: Determines how the amount credited is determined for this change + default: prorated_amount + enum: + - full_amount + - prorated_amount + - none Settings: type: object properties: billing_address_requirement: description: | - full: Full Address (Street, City, State, Postal Code and Country) - streetzip: Street and Postal Code only - zip: Postal Code only - none: No Address readOnly: true "$ref": "#/components/schemas/AddressRequirementEnum" accepted_currencies: type: array items: type: string description: 3-letter ISO 4217 currency code. readOnly: true default_currency: type: string description: The default 3-letter ISO 4217 currency code. readOnly: true ShippingAddress: type: object properties: id: type: string title: Shipping Address ID maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true account_id: type: string title: Account ID maxLength: 13 readOnly: true nickname: type: string maxLength: 255 first_name: type: string maxLength: 255 last_name: type: string maxLength: 255 company: type: string maxLength: 255 email: type: string maxLength: 255 vat_number: type: string maxLength: 20 phone: type: string maxLength: 30 street1: type: string maxLength: 255 street2: type: string maxLength: 255 city: type: string maxLength: 255 region: type: string maxLength: 255 description: State or province. postal_code: type: string maxLength: 20 description: Zip or postal code. country: type: string maxLength: 50 description: Country, 2-letter ISO 3166-1 alpha-2 code. geo_code: type: string maxLength: 20 description: Code that represents a geographic entity (location or object). Only returned for Sling Vertex Integration created_at: type: string title: Created at format: date-time readOnly: true updated_at: type: string title: Updated at format: date-time readOnly: true ShippingAddressCreate: type: object properties: nickname: type: string maxLength: 255 first_name: type: string maxLength: 255 last_name: type: string maxLength: 255 company: type: string maxLength: 255 email: type: string maxLength: 255 vat_number: type: string maxLength: 20 phone: type: string maxLength: 30 street1: type: string maxLength: 255 street2: type: string maxLength: 255 city: type: string maxLength: 255 region: type: string maxLength: 255 description: State or province. postal_code: type: string maxLength: 20 description: Zip or postal code. geo_code: type: string maxLength: 20 description: Code that represents a geographic entity (location or object). Only returned for Sling Vertex Integration country: type: string maxLength: 50 description: Country, 2-letter ISO 3166-1 alpha-2 code. required: - first_name - last_name - street1 - city - postal_code - country ShippingAddressList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ShippingAddress" ShippingMethod: type: object properties: id: type: string title: Shipping Method ID readOnly: true maxLength: 13 object: type: string title: Object type readOnly: true code: type: string title: Code description: The internal name used identify the shipping method. maxLength: 50 name: type: string title: Name description: The name of the shipping method displayed to customers. maxLength: 100 accounting_code: type: string title: Accounting Code description: Accounting code for shipping method. maxLength: 20 tax_code: type: string title: Tax code description: | Used by Avalara, Vertex, and Recurly’s built-in tax feature. The tax code values are specific to each tax system. If you are using Recurly’s built-in taxes the values are: - `FR` – Common Carrier FOB Destination - `FR022000` – Common Carrier FOB Origin - `FR020400` – Non Common Carrier FOB Destination - `FR020500` – Non Common Carrier FOB Origin - `FR010100` – Delivery by Company Vehicle Before Passage of Title - `FR010200` – Delivery by Company Vehicle After Passage of Title - `NT` – Non-Taxable maxLength: 50 created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at readOnly: true ShippingMethodMini: type: object properties: id: type: string title: Shipping Method ID readOnly: true maxLength: 13 object: type: string title: Object type readOnly: true code: type: string title: Code description: The internal name used identify the shipping method. maxLength: 50 name: type: string title: Name description: The name of the shipping method displayed to customers. maxLength: 100 ShippingMethodCreate: type: object properties: code: type: string title: Code description: The internal name used identify the shipping method. pattern: "/^[a-z0-9_+-]+$/i" maxLength: 50 name: type: string title: Name description: The name of the shipping method displayed to customers. maxLength: 100 accounting_code: type: string title: Accounting Code description: Accounting code for shipping method. maxLength: 20 tax_code: type: string title: Tax code description: | Used by Avalara, Vertex, and Recurly’s built-in tax feature. The tax code values are specific to each tax system. If you are using Recurly’s built-in taxes the values are: - `FR` – Common Carrier FOB Destination - `FR022000` – Common Carrier FOB Origin - `FR020400` – Non Common Carrier FOB Destination - `FR020500` – Non Common Carrier FOB Origin - `FR010100` – Delivery by Company Vehicle Before Passage of Title - `FR010200` – Delivery by Company Vehicle After Passage of Title - `NT` – Non-Taxable maxLength: 50 required: - code - name ShippingMethodUpdate: type: object properties: code: type: string title: Code description: The internal name used identify the shipping method. pattern: "/^[a-z0-9_+-]+$/i" maxLength: 50 name: type: string title: Name description: The name of the shipping method displayed to customers. maxLength: 100 accounting_code: type: string title: Accounting Code description: Accounting code for shipping method. maxLength: 20 tax_code: type: string title: Tax code description: | Used by Avalara, Vertex, and Recurly’s built-in tax feature. The tax code values are specific to each tax system. If you are using Recurly’s built-in taxes the values are: - `FR` – Common Carrier FOB Destination - `FR022000` – Common Carrier FOB Origin - `FR020400` – Non Common Carrier FOB Destination - `FR020500` – Non Common Carrier FOB Origin - `FR010100` – Delivery by Company Vehicle Before Passage of Title - `FR010200` – Delivery by Company Vehicle After Passage of Title - `NT` – Non-Taxable maxLength: 50 ShippingFeeCreate: type: object properties: method_id: type: string title: Method ID description: The id of the shipping method used to deliver the purchase. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 13 method_code: type: string title: Method Code description: The code of the shipping method used to deliver the purchase. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 50 amount: type: number format: float title: Amount description: This is priced in the purchase's currency. minimum: 0 ShippingAddressUpdate: type: object properties: id: type: string title: Shipping Address ID maxLength: 13 readOnly: true nickname: type: string maxLength: 255 first_name: type: string maxLength: 255 last_name: type: string maxLength: 255 company: type: string maxLength: 255 email: type: string maxLength: 255 vat_number: type: string maxLength: 20 phone: type: string maxLength: 30 street1: type: string maxLength: 255 street2: type: string maxLength: 255 city: type: string maxLength: 255 region: type: string maxLength: 255 description: State or province. postal_code: type: string maxLength: 20 description: Zip or postal code. country: type: string maxLength: 50 description: Country, 2-letter ISO 3166-1 alpha-2 code. geo_code: type: string maxLength: 20 description: Code that represents a geographic entity (location or object). Only returned for Sling Vertex Integration Site: type: object properties: id: type: string title: Site ID readOnly: true maxLength: 13 object: type: string title: Object type readOnly: true subdomain: type: string readOnly: true maxLength: 100 public_api_key: type: string title: Public API Key readOnly: true maxLength: 50 description: This value is used to configure RecurlyJS to submit tokenized billing information. mode: title: Mode maxLength: 15 readOnly: true "$ref": "#/components/schemas/SiteModeEnum" address: "$ref": "#/components/schemas/Address" settings: "$ref": "#/components/schemas/Settings" features: type: array title: Features description: A list of features enabled for the site. items: readOnly: true "$ref": "#/components/schemas/FeaturesEnum" created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at readOnly: true Subscription: type: object properties: id: type: string title: Subscription ID maxLength: 13 object: type: string title: Object type uuid: type: string title: UUID description: The UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI. maxLength: 32 account: "$ref": "#/components/schemas/AccountMini" plan: "$ref": "#/components/schemas/PlanMini" state: title: State "$ref": "#/components/schemas/SubscriptionStateEnum" shipping: "$ref": "#/components/schemas/SubscriptionShipping" coupon_redemptions: type: array title: Coupon redemptions description: Returns subscription level coupon redemptions that are tied to this subscription. items: "$ref": "#/components/schemas/CouponRedemptionMini" pending_change: "$ref": "#/components/schemas/SubscriptionChange" current_period_started_at: type: string format: date-time title: Current billing period started at current_period_ends_at: type: string format: date-time title: Current billing period ends at current_term_started_at: type: string format: date-time title: Current term started at description: The start date of the term when the first billing period starts. The subscription term is the length of time that a customer will be committed to a subscription. A term can span multiple billing periods. current_term_ends_at: type: string format: date-time title: Current term ends at description: When the term ends. This is calculated by a plan's interval and `total_billing_cycles` in a term. Subscription changes with a `timeframe=renewal` will be applied on this date. trial_started_at: type: string @@ -21967,1024 +21995,1026 @@ components: SubscriptionAddOn: type: object title: Subscription Add-on description: This links an Add-on to a specific Subscription. properties: id: type: string title: Subscription Add-on ID maxLength: 13 object: type: string title: Object type subscription_id: type: string title: Subscription ID maxLength: 13 add_on: "$ref": "#/components/schemas/AddOnMini" add_on_source: "$ref": "#/components/schemas/AddOnSourceEnum" quantity: type: integer title: Add-on quantity minimum: 0 unit_amount: type: number format: float title: Add-on unit price description: Supports up to 2 decimal places. unit_amount_decimal: type: string format: decimal title: Add-on unit in decimal price description: Supports up to 9 decimal places. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" tier_type: "$ref": "#/components/schemas/TierTypeEnum" usage_calculation_type: "$ref": "#/components/schemas/UsageCalculationTypeEnum" usage_timeframe: "$ref": "#/components/schemas/UsageTimeframeEnum" tiers: type: array title: Tiers items: "$ref": "#/components/schemas/SubscriptionAddOnTier" minItems: 1 description: "If tiers are provided in the request, all existing tiers on the Subscription Add-on will be\nremoved and replaced by the tiers in the request. If add_on.tier_type is tiered or volume and\nadd_on.usage_type is percentage use percentage_tiers instead. \nThere must be one tier without an `ending_quantity` value which represents the final tier.\n" percentage_tiers: type: array title: Percentage Tiers items: "$ref": "#/components/schemas/SubscriptionAddOnPercentageTier" minItems: 1 description: | If percentage tiers are provided in the request, all existing percentage tiers on the Subscription Add-on will be removed and replaced by the percentage tiers in the request. Use only if add_on.tier_type is tiered or volume and add_on.usage_type is percentage. There must be one tier without an `ending_amount` value which represents the final tier. This feature is currently in development and requires approval and enablement, please contact support. usage_percentage: type: number format: float title: Usage Percentage description: The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. Required if add_on_type is usage and usage_type is percentage. created_at: type: string format: date-time title: Created at updated_at: type: string format: date-time title: Updated at expired_at: type: string format: date-time title: Expired at SubscriptionAddOnCreate: type: object properties: code: type: string title: Add-on code maxLength: 50 description: | If `add_on_source` is set to `plan_add_on` or left blank, then plan's add-on `code` should be used. If `add_on_source` is set to `item`, then the `code` from the associated item should be used. add_on_source: "$ref": "#/components/schemas/AddOnSourceEnum" quantity: type: integer title: Quantity minimum: 0 default: 1 unit_amount: type: number format: float title: Unit amount description: | Allows up to 2 decimal places. Optionally, override the add-on's default unit amount. If the plan add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `unit_amount` cannot be provided. minimum: 0 maximum: 1000000 unit_amount_decimal: type: string format: decimal title: Unit Amount Decimal description: | Allows up to 9 decimal places. Optionally, override the add-on's default unit amount. If the plan add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `unit_amount_decimal` cannot be provided. Only supported when the plan add-on's `add_on_type` = `usage`. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided. minimum: 0 maximum: 1000000 tiers: type: array title: Tiers items: "$ref": "#/components/schemas/SubscriptionAddOnTier" minItems: 1 description: | If the plan add-on's `tier_type` is `flat`, then `tiers` must be absent. The `tiers` object must include one to many tiers with `ending_quantity` and `unit_amount`. There must be one tier without an `ending_quantity` value which represents the final tier. See our [Guide](https://recurly.com/developers/guides/item-addon-guide.html) for an overview of how to configure quantity-based pricing models. percentage_tiers: type: array title: Percentage Tiers items: "$ref": "#/components/schemas/SubscriptionAddOnPercentageTier" minItems: 1 description: | If percentage tiers are provided in the request, all existing percentage tiers on the Subscription Add-on will be removed and replaced by the percentage tiers in the request. There must be one tier without ending_amount value which represents the final tier. Use only if add_on.tier_type is tiered or volume and add_on.usage_type is percentage. This feature is currently in development and requires approval and enablement, please contact support. usage_percentage: type: number format: float title: Usage Percentage minimum: 0 maximum: 100 description: The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. Required if `add_on_type` is usage and `usage_type` is percentage. Must be omitted otherwise. `usage_percentage` does not support tiers. See our [Guide](https://recurly.com/developers/guides/usage-based-billing-guide.html) for an overview of how to configure usage add-ons. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" required: - code SubscriptionAddOnUpdate: type: object properties: id: type: string title: Subscription Add-on ID. description: | When an id is provided, the existing subscription add-on attributes will persist unless overridden in the request. maxLength: 13 code: type: string title: Add-on code maxLength: 50 description: | If a code is provided without an id, the subscription add-on attributes will be set to the current value for those attributes on the plan add-on unless provided in the request. If `add_on_source` is set to `plan_add_on` or left blank, then plan's add-on `code` should be used. If `add_on_source` is set to `item`, then the `code` from the associated item should be used. add_on_source: "$ref": "#/components/schemas/AddOnSourceEnum" quantity: type: integer title: Quantity minimum: 0 unit_amount: type: number format: float title: Unit amount description: | Allows up to 2 decimal places. Optionally, override the add-on's default unit amount. If the plan add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `unit_amount` cannot be provided. minimum: 0 maximum: 1000000 unit_amount_decimal: type: string title: Unit amount decimal description: | Allows up to 9 decimal places. Optionally, override the add-on's default unit amount. If the plan add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `unit_amount_decimal` cannot be provided. Only supported when the plan add-on's `add_on_type` = `usage`. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided. tiers: type: array title: Tiers items: "$ref": "#/components/schemas/SubscriptionAddOnTier" minItems: 1 description: | If the plan add-on's `tier_type` is `flat`, then `tiers` must be absent. The `tiers` object must include one to many tiers with `ending_quantity` and `unit_amount`. There must be one tier without an `ending_quantity` value which represents the final tier. percentage_tiers: type: array title: Percentage Tiers items: "$ref": "#/components/schemas/SubscriptionAddOnPercentageTier" minItems: 1 description: | If percentage tiers are provided in the request, all existing percentage tiers on the Subscription Add-on will be removed and replaced by the percentage tiers in the request. Use only if add_on.tier_type is tiered or volume and add_on.usage_type is percentage. There must be one tier without an `ending_amount` value which represents the final tier. This feature is currently in development and requires approval and enablement, please contact support. usage_percentage: type: number format: float title: Usage Percentage description: The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. Required if add_on_type is usage and usage_type is percentage. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" SubscriptionAddOnTier: type: object properties: ending_quantity: type: integer title: Ending quantity minimum: 1 maximum: 999999999 description: Ending quantity for the tier. This represents a unit amount for unit-priced add ons. Must be left empty if it is the final tier. unit_amount: type: number format: float title: Unit amount minimum: 0 maximum: 1000000 description: Allows up to 2 decimal places. Optionally, override the tiers' default unit amount. If add-on's `add_on_type` is `usage` and `usage_type` is `percentage`, cannot be provided. unit_amount_decimal: type: string title: Unit amount decimal description: | Allows up to 9 decimal places. Optionally, override tiers' default unit amount. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided. If add-on's `add_on_type` is `usage` and `usage_type` is `percentage`, cannot be provided. usage_percentage: type: string title: Usage Percentage description: "(deprecated) -- Use the percentage_tiers object instead." deprecated: true SubscriptionAddOnPercentageTier: type: object properties: ending_amount: type: number format: float title: Ending amount minimum: 1 maximum: 9999999999999.99 description: Ending amount for the tier. Allows up to 2 decimal places. Must be left empty if it is the final tier. usage_percentage: type: string title: Usage Percentage minimum: 0 maximum: 100 description: | The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places represented as a string. SubscriptionCancel: type: object properties: timeframe: title: Timeframe description: The timeframe parameter controls when the expiration takes place. The `bill_date` timeframe causes the subscription to expire when the subscription is scheduled to bill next. The `term_end` timeframe causes the subscription to continue to bill until the end of the subscription term, then expire. default: term_end "$ref": "#/components/schemas/TimeframeEnum" SubscriptionChange: type: object title: Subscription Change properties: id: type: string title: Subscription Change ID description: The ID of the Subscription Change. object: type: string title: Object type subscription_id: type: string title: Subscription ID description: The ID of the subscription that is going to be changed. maxLength: 13 plan: "$ref": "#/components/schemas/PlanMini" add_ons: type: array title: Add-ons description: These add-ons will be used when the subscription renews. items: "$ref": "#/components/schemas/SubscriptionAddOn" unit_amount: type: number format: float title: Unit amount tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true quantity: type: integer title: Subscription quantity shipping: "$ref": "#/components/schemas/SubscriptionShipping" activate_at: type: string format: date-time title: Activated at readOnly: true activated: type: boolean title: Activated? description: Returns `true` if the subscription change is activated. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" invoice_collection: title: Invoice Collection "$ref": "#/components/schemas/InvoiceCollection" custom_fields: "$ref": "#/components/schemas/CustomFields" created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at readOnly: true billing_info: "$ref": "#/components/schemas/SubscriptionChangeBillingInfo" ramp_intervals: type: array title: Ramp Intervals description: The ramp intervals representing the pricing schedule for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampIntervalResponse" SubscriptionChangeBillingInfo: type: object description: Accept nested attributes for three_d_secure_action_result_token_id properties: three_d_secure_action_result_token_id: type: string title: 3-D Secure action result token ID description: A token generated by Recurly.js after completing a 3-D Secure device fingerprinting or authentication challenge. maxLength: 22 SubscriptionChangeBillingInfoCreate: allOf: - "$ref": "#/components/schemas/SubscriptionChangeBillingInfo" SubscriptionChangeCreate: type: object properties: timeframe: title: Timeframe description: The timeframe parameter controls when the upgrade or downgrade takes place. The subscription change can occur now, when the subscription is next billed, or when the subscription term ends. Generally, if you're performing an upgrade, you will want the change to occur immediately (now). If you're performing a downgrade, you should set the timeframe to `term_end` or `bill_date` so the change takes effect at a scheduled billing date. The `renewal` timeframe option is accepted as an alias for `term_end`. default: now "$ref": "#/components/schemas/ChangeTimeframeEnum" plan_id: type: string title: Plan ID maxLength: 13 description: If you want to change to a new plan, you can provide the plan's code or id. If both are provided the `plan_id` will be used. plan_code: type: string title: New plan code maxLength: 50 description: If you want to change to a new plan, you can provide the plan's code or id. If both are provided the `plan_id` will be used. unit_amount: type: number format: float title: Custom subscription price description: Optionally, sets custom pricing for the subscription, overriding the plan's default unit amount. The subscription's current currency will be used. minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true quantity: type: integer title: Quantity description: Optionally override the default quantity of 1. default: 1 minimum: 0 shipping: "$ref": "#/components/schemas/SubscriptionChangeShippingCreate" coupon_codes: type: array title: Coupon codes description: A list of coupon_codes to be redeemed on the subscription during the change. Only allowed if timeframe is now and you change something about the subscription that creates an invoice. items: type: string add_ons: type: array title: Add-ons description: | If you provide a value for this field it will replace any existing add-ons. So, when adding or modifying an add-on, you need to include the existing subscription add-ons. Unchanged add-ons can be included just using the subscription add-on''s ID: `{"id": "abc123"}`. If this value is omitted your existing add-ons will be unaffected. To remove all existing add-ons, this value should be an empty array.' If a subscription add-on's `code` is supplied without the `id`, `{"code": "def456"}`, the subscription add-on attributes will be set to the current values of the plan add-on unless provided in the request. - If an `id` is passed, any attributes not passed in will pull from the existing subscription add-on - If a `code` is passed, any attributes not passed in will pull from the current values of the plan add-on - Attributes passed in as part of the request will override either of the above scenarios items: "$ref": "#/components/schemas/SubscriptionAddOnUpdate" collection_method: title: Collection method default: automatic "$ref": "#/components/schemas/CollectionMethodEnum" revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" custom_fields: "$ref": "#/components/schemas/CustomFields" po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Net terms description: |- Integer normally paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. During a subscription change, it's not necessary to provide both the `Net Terms Type` and `Net Terms` parameters. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" billing_info: "$ref": "#/components/schemas/SubscriptionChangeBillingInfoCreate" ramp_intervals: type: array title: Ramp Intervals description: The new set of ramp intervals for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampInterval" + proration_settings: + "$ref": "#/components/schemas/ProrationSettings" SubscriptionChangeShippingCreate: type: object title: Shipping details that will be changed on a subscription description: Shipping addresses are tied to a customer's account. Each account can have up to 20 different shipping addresses, and if you have enabled multiple subscriptions per account, you can associate different shipping addresses to each subscription. properties: method_id: type: string title: Method ID description: The id of the shipping method used to deliver the subscription. To remove shipping set this to `null` and the `amount=0`. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 13 method_code: type: string title: Method Code description: The code of the shipping method used to deliver the subscription. To remove shipping set this to `null` and the `amount=0`. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 50 amount: type: number format: float title: Assigns the subscription's shipping cost. If this is greater than zero then a `method_id` or `method_code` is required. address_id: type: string title: Shipping address ID description: Assign a shipping address from the account's existing shipping addresses. If this and address are both present, address will take precedence. address: "$ref": "#/components/schemas/ShippingAddressCreate" SubscriptionCreate: type: object properties: plan_code: type: string title: Plan code maxLength: 50 description: You must provide either a `plan_code` or `plan_id`. If both are provided the `plan_id` will be used. plan_id: type: string title: Plan ID maxLength: 13 description: You must provide either a `plan_code` or `plan_id`. If both are provided the `plan_id` will be used. account: "$ref": "#/components/schemas/AccountCreate" billing_info_id: type: string title: Billing Info ID description: The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. shipping: title: Shipping address description: Create a shipping address on the account and assign it to the subscription. "$ref": "#/components/schemas/SubscriptionShippingCreate" collection_method: title: Collection method default: automatic "$ref": "#/components/schemas/CollectionMethodEnum" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 unit_amount: type: number format: float title: Custom subscription pricing description: Override the unit amount of the subscription plan by setting this value. If not provided, the subscription will inherit the price from the subscription plan for the provided currency. minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to use this flag. quantity: type: integer title: Quantity description: Optionally override the default quantity of 1. default: 1 minimum: 0 add_ons: type: array title: Add-ons items: "$ref": "#/components/schemas/SubscriptionAddOnCreate" coupon_codes: type: array title: Coupon codes description: A list of coupon_codes to be redeemed on the subscription or account during the purchase. items: type: string custom_fields: "$ref": "#/components/schemas/CustomFields" trial_ends_at: type: string format: date-time title: Trial ends at description: If set, overrides the default trial behavior for the subscription. When the current date time or a past date time is provided the subscription will begin with no trial phase (overriding any plan default trial). When a future date time is provided the subscription will begin with a trial phase ending at the specified date time. starts_at: type: string format: date-time title: Start date description: If set, the subscription will begin in the future on this date. The subscription will apply the setup fee and trial period, unless the plan has no trial. next_bill_date: type: string format: date-time title: Next bill date description: If present, this sets the date the subscription's next billing period will start (`current_period_ends_at`). This can be used to align the subscription’s billing to a specific day of the month. The initial invoice will be prorated for the period between the subscription's activation date and the billing period end date. Subsequent periods will be based off the plan interval. For a subscription with a trial period, this will change when the trial expires. total_billing_cycles: type: integer title: Total billing cycles description: The number of cycles/billing periods in a term. When `remaining_billing_cycles=0`, if `auto_renew=true` the subscription will renew and a new term will begin, otherwise the subscription will expire. minimum: 1 renewal_billing_cycles: type: integer title: Renewal billing cycles description: If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. auto_renew: type: boolean default: true title: Auto renew description: Whether the subscription renews at the end of its term. ramp_intervals: type: array title: Ramp Intervals description: The new set of ramp intervals for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampInterval" revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" terms_and_conditions: type: string title: Terms and conditions description: This will default to the Terms and Conditions text specified on the Invoice Settings page in your Recurly admin. Specify custom notes to add or override Terms and Conditions. Custom notes will stay with a subscription on all renewals. customer_notes: type: string title: Customer notes description: This will default to the Customer Notes text specified on the Invoice Settings. Specify custom notes to add or override Customer Notes. Custom notes will stay with a subscription on all renewals. credit_customer_notes: type: string title: Credit customer notes description: If there are pending credits on the account that will be invoiced during the subscription creation, these will be used as the Customer Notes on the credit invoice. po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Net terms description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" gateway_code: type: string title: Gateway Code description: If present, this subscription's transactions will use the payment gateway with this code. maxLength: 13 transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" gift_card_redemption_code: type: string title: Gift card Redemption Code description: A gift card redemption code to be redeemed on the purchase invoice. required: - plan_code - currency - account SubscriptionPurchase: type: object properties: plan_code: type: string title: Plan code plan_id: type: string title: Plan ID maxLength: 13 unit_amount: type: number format: float title: Custom subscription pricing description: Override the unit amount of the subscription plan by setting this value. If not provided, the subscription will inherit the price from the subscription plan for the provided currency. minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to use this flag. quantity: type: integer title: Quantity description: Optionally override the default quantity of 1. default: 1 minimum: 0 add_ons: type: array title: Add-ons items: "$ref": "#/components/schemas/SubscriptionAddOnCreate" custom_fields: "$ref": "#/components/schemas/CustomFields" shipping: title: Shipping address description: Create a shipping address on the account and assign it to the subscription. "$ref": "#/components/schemas/SubscriptionShippingPurchase" trial_ends_at: type: string format: date-time title: Trial ends at description: If set, overrides the default trial behavior for the subscription. When the current date time or a past date time is provided the subscription will begin with no trial phase (overriding any plan default trial). When a future date time is provided the subscription will begin with a trial phase ending at the specified date time. starts_at: type: string format: date-time title: Start date description: If set, the subscription will begin in the future on this date. The subscription will apply the setup fee and trial period, unless the plan has no trial. next_bill_date: type: string format: date-time title: Next bill date description: If present, this sets the date the subscription's next billing period will start (`current_period_ends_at`). This can be used to align the subscription’s billing to a specific day of the month. The initial invoice will be prorated for the period between the subscription's activation date and the billing period end date. Subsequent periods will be based off the plan interval. For a subscription with a trial period, this will change when the trial expires. total_billing_cycles: type: integer title: Total billing cycles description: The number of cycles/billing periods in a term. When `remaining_billing_cycles=0`, if `auto_renew=true` the subscription will renew and a new term will begin, otherwise the subscription will expire. minimum: 1 renewal_billing_cycles: type: integer title: Renewal billing cycles description: If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. auto_renew: type: boolean default: true title: Auto renew description: Whether the subscription renews at the end of its term. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" ramp_intervals: type: array title: Ramp Intervals description: The new set of ramp intervals for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampInterval" required: - plan_code SubscriptionUpdate: type: object properties: collection_method: title: Change collection method "$ref": "#/components/schemas/CollectionMethodEnum" custom_fields: "$ref": "#/components/schemas/CustomFields" remaining_billing_cycles: type: integer title: Remaining billing cycles description: The remaining billing cycles in the current term. renewal_billing_cycles: type: integer title: Renewal billing cycles description: If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. auto_renew: type: boolean default: true title: Auto renew description: Whether the subscription renews at the end of its term. next_bill_date: type: string format: date-time title: Next bill date description: If present, this sets the date the subscription's next billing period will start (`current_period_ends_at`). This can be used to align the subscription’s billing to a specific day of the month. For a subscription in a trial period, this will change when the trial expires. This parameter is useful for postponement of a subscription to change its billing date without proration. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" terms_and_conditions: type: string title: Terms and conditions description: Specify custom notes to add or override Terms and Conditions. Custom notes will stay with a subscription on all renewals. customer_notes: type: string title: Customer notes description: Specify custom notes to add or override Customer Notes. Custom notes will stay with a subscription on all renewals. po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Terms that the subscription is due on description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" gateway_code: type: string title: Gateway Code description: If present, this subscription's transactions will use the payment gateway with this code. maxLength: 13 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true shipping: "$ref": "#/components/schemas/SubscriptionShippingUpdate" billing_info_id: type: string title: Billing Info ID description: The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. SubscriptionPause: type: object properties: remaining_pause_cycles: type: integer title: Remaining pause cycles description: Number of billing cycles to pause the subscriptions. A value of 0 will cancel any pending pauses on the subscription. required: - remaining_pause_cycles SubscriptionShipping: type: object title: Subscription shipping details properties: object: type: string title: Object type address: "$ref": "#/components/schemas/ShippingAddress" method: "$ref": "#/components/schemas/ShippingMethodMini" amount: type: number format: float title: Subscription's shipping cost SubscriptionShippingCreate: type: object title: Subscription shipping details properties: address: "$ref": "#/components/schemas/ShippingAddressCreate" address_id: type: string title: Shipping address ID description: Assign a shipping address from the account's existing shipping addresses. If `address_id` and `address` are both present, `address` will be used. maxLength: 13 method_id: type: string title: Service ID description: The id of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 13 method_code: type: string title: Service Code description: The code of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 50 amount: type: number format: float title: Assigns the subscription's shipping cost. If this is greater than zero then a `method_id` or `method_code` is required. SubscriptionShippingUpdate: type: object title: Subscription shipping details properties: object: type: string title: Object type address: "$ref": "#/components/schemas/ShippingAddressCreate" address_id: type: string title: Shipping Address ID description: Assign a shipping address from the account's existing shipping addresses. maxLength: 13 SubscriptionShippingPurchase: type: object title: Subscription shipping details properties: method_id: type: string title: Service ID description: The id of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used.
recurly/recurly-client-php
67f8a0a047568c0cdf078dc285431fe027c6fd47
4.48.0
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index a0084e6..d20c79c 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 4.47.0 +current_version = 4.48.0 parse = (?P<major>\d+) \.(?P<minor>\d+) \.(?P<patch>\d+) serialize = {major}.{minor}.{patch} [bumpversion:file:composer.json] [bumpversion:file:lib/recurly/version.php] diff --git a/CHANGELOG.md b/CHANGELOG.md index b14a8fd..b75301a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,514 +1,525 @@ # Changelog +## [4.48.0](https://github.com/recurly/recurly-client-php/tree/4.48.0) (2024-05-01) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.47.0...4.48.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 (Auth & Capture) [#808](https://github.com/recurly/recurly-client-php/pull/808) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.47.0](https://github.com/recurly/recurly-client-php/tree/4.47.0) (2024-03-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.46.0...4.47.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#803](https://github.com/recurly/recurly-client-php/pull/803) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.46.0](https://github.com/recurly/recurly-client-php/tree/4.46.0) (2024-02-20) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.45.0...4.46.0) **Merged Pull Requests** - Add invoice state param for v2021-02-25 [#799](https://github.com/recurly/recurly-client-php/pull/799) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.45.0](https://github.com/recurly/recurly-client-php/tree/4.45.0) (2024-01-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.44.0...4.45.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#789](https://github.com/recurly/recurly-client-php/pull/789) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.44.0](https://github.com/recurly/recurly-client-php/tree/4.44.0) (2024-01-18) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.43.0...4.44.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#788](https://github.com/recurly/recurly-client-php/pull/788) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.43.0](https://github.com/recurly/recurly-client-php/tree/4.43.0) (2023-12-06) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.42.0...4.43.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Payment Phases) [#785](https://github.com/recurly/recurly-client-php/pull/785) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.42.0](https://github.com/recurly/recurly-client-php/tree/4.42.0) (2023-11-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.41.0...4.42.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#783](https://github.com/recurly/recurly-client-php/pull/783) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.41.0](https://github.com/recurly/recurly-client-php/tree/4.41.0) (2023-08-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.40.0...4.41.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (`VATNumber`, `LifecycleDecline`) [#782](https://github.com/recurly/recurly-client-php/pull/782) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.40.0](https://github.com/recurly/recurly-client-php/tree/4.40.0) (2023-08-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.39.0...4.40.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (action_result) [#781](https://github.com/recurly/recurly-client-php/pull/781) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.39.0](https://github.com/recurly/recurly-client-php/tree/4.39.0) (2023-07-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.37.0...4.39.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Ramp Dates, Net Terms, Invoice Business Entity) [#779](https://github.com/recurly/recurly-client-php/pull/779) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (App Management - External Subscriptions) [#777](https://github.com/recurly/recurly-client-php/pull/777) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.37.0](https://github.com/recurly/recurly-client-php/tree/4.37.0) (2023-06-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.36.0...4.37.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Multiple Business Entities) [#769](https://github.com/recurly/recurly-client-php/pull/769) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.36.0](https://github.com/recurly/recurly-client-php/tree/4.36.0) (2023-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.35.0...4.36.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Products & References) [#766](https://github.com/recurly/recurly-client-php/pull/766) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.35.0](https://github.com/recurly/recurly-client-php/tree/4.35.0) (2023-05-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.34.0...4.35.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (gateway_attributes on PaymentMethod) [#764](https://github.com/recurly/recurly-client-php/pull/764) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#747](https://github.com/recurly/recurly-client-php/pull/747) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.28.0](https://github.com/recurly/recurly-client-php/tree/4.28.0) (2023-02-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.27.0...4.28.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (GiftCard endpoints and new transaction error support) [#745](https://github.com/recurly/recurly-client-php/pull/745) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.27.0](https://github.com/recurly/recurly-client-php/tree/4.27.0) (2023-01-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.26.0...4.27.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Custom Fields on Line Items) [#738](https://github.com/recurly/recurly-client-php/pull/738) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.26.0](https://github.com/recurly/recurly-client-php/tree/4.26.0) (2023-01-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.25.0...4.26.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Account Preferred Time Zone) [#736](https://github.com/recurly/recurly-client-php/pull/736) ([douglasmiller](https://github.com/douglasmiller)) ## [4.25.0](https://github.com/recurly/recurly-client-php/tree/4.25.0) (2022-11-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.24.0...4.25.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Apply Credit Balance feature) [#732](https://github.com/recurly/recurly-client-php/pull/732) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.24.0](https://github.com/recurly/recurly-client-php/tree/4.24.0) (2022-11-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.23.0...4.24.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Subscriptions feature) [#729](https://github.com/recurly/recurly-client-php/pull/729) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#728](https://github.com/recurly/recurly-client-php/pull/728) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.23.0](https://github.com/recurly/recurly-client-php/tree/4.23.0) (2022-10-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.22.0...4.23.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entitlements feature) [#725](https://github.com/recurly/recurly-client-php/pull/725) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.22.0](https://github.com/recurly/recurly-client-php/tree/4.22.0) (2022-10-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.2...4.22.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25(Decimal Usage and Quantities and DunningEvent new fields) [#722](https://github.com/recurly/recurly-client-php/pull/722) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.2](https://github.com/recurly/recurly-client-php/tree/4.21.2) (2022-09-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.1...4.21.2) **Merged Pull Requests** - feat: allow for psr/log ^2/3 [#716](https://github.com/recurly/recurly-client-php/pull/716) ([trickeyone](https://github.com/trickeyone)) ## [4.21.1](https://github.com/recurly/recurly-client-php/tree/4.21.1) (2022-09-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.0...4.21.1) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#714](https://github.com/recurly/recurly-client-php/pull/714) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.0](https://github.com/recurly/recurly-client-php/tree/4.21.0) (2022-09-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.20.0...4.21.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#713](https://github.com/recurly/recurly-client-php/pull/713) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixes bug with putDunningCampaignBulkUpdate [#706](https://github.com/recurly/recurly-client-php/pull/706) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.20.0](https://github.com/recurly/recurly-client-php/tree/4.20.0) (2022-08-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.19.0...4.20.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#701](https://github.com/recurly/recurly-client-php/pull/701) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.19.0](https://github.com/recurly/recurly-client-php/tree/4.19.0) (2022-07-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.18.0...4.19.0) **Merged Pull Requests** - Fixing deprecation warnings in client [#697](https://github.com/recurly/recurly-client-php/pull/697) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#695](https://github.com/recurly/recurly-client-php/pull/695) ([recurly-integrations](https://github.com/recurly-integrations)) **Closed Issues** - Recurly\Pager and \Iterator return type mismatch (PHP 8.1 deprecation) [#677](https://github.com/recurly/recurly-client-php/issues/677) ## [4.18.0](https://github.com/recurly/recurly-client-php/tree/4.18.0) (2022-06-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.17.0...4.18.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#693](https://github.com/recurly/recurly-client-php/pull/693) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.17.0](https://github.com/recurly/recurly-client-php/tree/4.17.0) (2022-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.16.0...4.17.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#679](https://github.com/recurly/recurly-client-php/pull/679) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.16.0](https://github.com/recurly/recurly-client-php/tree/4.16.0) (2022-03-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.15.0...4.16.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#676](https://github.com/recurly/recurly-client-php/pull/676) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.15.0](https://github.com/recurly/recurly-client-php/tree/4.15.0) (2022-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.14.0...4.15.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#668](https://github.com/recurly/recurly-client-php/pull/668) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.14.0](https://github.com/recurly/recurly-client-php/tree/4.14.0) (2022-03-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.13.0...4.14.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#664](https://github.com/recurly/recurly-client-php/pull/664) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.13.0](https://github.com/recurly/recurly-client-php/tree/4.13.0) (2022-01-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.12.0...4.13.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#655](https://github.com/recurly/recurly-client-php/pull/655) ([recurly-integrations](https://github.com/recurly-integrations)) - Add region argument to client to connect in EU data center [#653](https://github.com/recurly/recurly-client-php/pull/653) ([FabricioCoutinho](https://github.com/FabricioCoutinho)) ## [4.12.0](https://github.com/recurly/recurly-client-php/tree/4.12.0) (2022-01-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.11.0...4.12.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Invoice Customization) [#654](https://github.com/recurly/recurly-client-php/pull/654) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#651](https://github.com/recurly/recurly-client-php/pull/651) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.11.0](https://github.com/recurly/recurly-client-php/tree/4.11.0) (2021-12-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.10.0...4.11.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Tax Inclusive Pricing) [#650](https://github.com/recurly/recurly-client-php/pull/650) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.10.0](https://github.com/recurly/recurly-client-php/tree/4.10.0) (2021-11-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.9.0...4.10.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#647](https://github.com/recurly/recurly-client-php/pull/647) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#645](https://github.com/recurly/recurly-client-php/pull/645) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#644](https://github.com/recurly/recurly-client-php/pull/644) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#639](https://github.com/recurly/recurly-client-php/pull/639) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.9.0](https://github.com/recurly/recurly-client-php/tree/4.9.0) (2021-09-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.8.0...4.9.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Support to new subscription fields and response) [#633](https://github.com/recurly/recurly-client-php/pull/633) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.8.0](https://github.com/recurly/recurly-client-php/tree/4.8.0) (2021-09-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.7.0...4.8.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Dunning Campaigns feature) [#632](https://github.com/recurly/recurly-client-php/pull/632) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.7.0](https://github.com/recurly/recurly-client-php/tree/4.7.0) (2021-08-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.6.0...4.7.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (get_preview_renewal) [#630](https://github.com/recurly/recurly-client-php/pull/630) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.6.0](https://github.com/recurly/recurly-client-php/tree/4.6.0) (2021-08-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.5.0...4.6.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#628](https://github.com/recurly/recurly-client-php/pull/628) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.5.0](https://github.com/recurly/recurly-client-php/tree/4.5.0) (2021-08-02) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.4.0...4.5.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#623](https://github.com/recurly/recurly-client-php/pull/623) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixing issue with http_build_query converting booleans in params to integers [#621](https://github.com/recurly/recurly-client-php/pull/621) ([ZloeSabo](https://github.com/ZloeSabo)) ## [4.4.0](https://github.com/recurly/recurly-client-php/tree/4.4.0) (2021-06-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.3.0...4.4.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#613](https://github.com/recurly/recurly-client-php/pull/613) ([recurly-integrations](https://github.com/recurly-integrations)) - Add PHP 8.0 to travis matrix [#592](https://github.com/recurly/recurly-client-php/pull/592) ([douglasmiller](https://github.com/douglasmiller)) ## [4.3.0](https://github.com/recurly/recurly-client-php/tree/4.3.0) (2021-06-04) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.2.0...4.3.0) diff --git a/composer.json b/composer.json index cdfed69..8fa2190 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,38 @@ { "name": "recurly/recurly-client", - "version": "4.47.0", + "version": "4.48.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], "homepage": "https://github.com/recurly/recurly-client-php", "license": "MIT", "authors": [], "require": { "php": ">= 7.2.0", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "phpcompatibility/php-compatibility": "^9.3", "phpdocumentor/phpdocumentor": "~3.0.0", "phpstan/phpstan": "^0.12.11", "phpunit/phpunit": "^8", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "classmap": ["lib"], "files": ["lib/recurly.php"] }, "autoload-dev": { "classmap": ["tests"] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/lib/recurly/version.php b/lib/recurly/version.php index 859e559..e4f2d23 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -1,8 +1,8 @@ <?php namespace Recurly; class Version { - public const CURRENT = '4.47.0'; + public const CURRENT = '4.48.0'; }
recurly/recurly-client-php
b95a96745d215301a34d9bcfdabcf95b229533db
Generated Latest Changes for v2021-02-25
diff --git a/lib/recurly/client.php b/lib/recurly/client.php index d946340..69c207d 100644 --- a/lib/recurly/client.php +++ b/lib/recurly/client.php @@ -2666,895 +2666,940 @@ endpoint to obtain only the newly generated `UniqueCouponCodes`. public function cancelSubscription(string $subscription_id, array $body = [], array $options = []): \Recurly\Resources\Subscription { $path = $this->interpolatePath("/subscriptions/{subscription_id}/cancel", ['subscription_id' => $subscription_id]); return $this->makeRequest('PUT', $path, $body, $options); } /** * Reactivate a canceled subscription * * @param string $subscription_id Subscription ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Subscription An active subscription. * @link https://developers.recurly.com/api/v2021-02-25#operation/reactivate_subscription */ public function reactivateSubscription(string $subscription_id, array $options = []): \Recurly\Resources\Subscription { $path = $this->interpolatePath("/subscriptions/{subscription_id}/reactivate", ['subscription_id' => $subscription_id]); return $this->makeRequest('PUT', $path, [], $options); } /** * Pause subscription * * @param string $subscription_id Subscription ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Subscription A subscription. * @link https://developers.recurly.com/api/v2021-02-25#operation/pause_subscription */ public function pauseSubscription(string $subscription_id, array $body, array $options = []): \Recurly\Resources\Subscription { $path = $this->interpolatePath("/subscriptions/{subscription_id}/pause", ['subscription_id' => $subscription_id]); return $this->makeRequest('PUT', $path, $body, $options); } /** * Resume subscription * * @param string $subscription_id Subscription ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Subscription A subscription. * @link https://developers.recurly.com/api/v2021-02-25#operation/resume_subscription */ public function resumeSubscription(string $subscription_id, array $options = []): \Recurly\Resources\Subscription { $path = $this->interpolatePath("/subscriptions/{subscription_id}/resume", ['subscription_id' => $subscription_id]); return $this->makeRequest('PUT', $path, [], $options); } /** * Convert trial subscription * * @param string $subscription_id Subscription ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Subscription A subscription. * @link https://developers.recurly.com/api/v2021-02-25#operation/convert_trial */ public function convertTrial(string $subscription_id, array $options = []): \Recurly\Resources\Subscription { $path = $this->interpolatePath("/subscriptions/{subscription_id}/convert_trial", ['subscription_id' => $subscription_id]); return $this->makeRequest('PUT', $path, [], $options); } /** * Fetch a preview of a subscription's renewal invoice(s) * * @param string $subscription_id Subscription ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\InvoiceCollection A preview of the subscription's renewal invoice(s). * @link https://developers.recurly.com/api/v2021-02-25#operation/get_preview_renewal */ public function getPreviewRenewal(string $subscription_id, array $options = []): \Recurly\Resources\InvoiceCollection { $path = $this->interpolatePath("/subscriptions/{subscription_id}/preview_renewal", ['subscription_id' => $subscription_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Fetch a subscription's pending change * * @param string $subscription_id Subscription ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\SubscriptionChange A subscription's pending change. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_subscription_change */ public function getSubscriptionChange(string $subscription_id, array $options = []): \Recurly\Resources\SubscriptionChange { $path = $this->interpolatePath("/subscriptions/{subscription_id}/change", ['subscription_id' => $subscription_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Create a new subscription change * * @param string $subscription_id Subscription ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\SubscriptionChange A subscription change. * @link https://developers.recurly.com/api/v2021-02-25#operation/create_subscription_change */ public function createSubscriptionChange(string $subscription_id, array $body, array $options = []): \Recurly\Resources\SubscriptionChange { $path = $this->interpolatePath("/subscriptions/{subscription_id}/change", ['subscription_id' => $subscription_id]); return $this->makeRequest('POST', $path, $body, $options); } /** * Delete the pending subscription change * * @param string $subscription_id Subscription ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`. * @param array $options Associative array of optional parameters * * @return \Recurly\EmptyResource Subscription change was deleted. * @link https://developers.recurly.com/api/v2021-02-25#operation/remove_subscription_change */ public function removeSubscriptionChange(string $subscription_id, array $options = []): \Recurly\EmptyResource { $path = $this->interpolatePath("/subscriptions/{subscription_id}/change", ['subscription_id' => $subscription_id]); return $this->makeRequest('DELETE', $path, [], $options); } /** * Preview a new subscription change * * @param string $subscription_id Subscription ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\SubscriptionChange A subscription change. * @link https://developers.recurly.com/api/v2021-02-25#operation/preview_subscription_change */ public function previewSubscriptionChange(string $subscription_id, array $body, array $options = []): \Recurly\Resources\SubscriptionChange { $path = $this->interpolatePath("/subscriptions/{subscription_id}/change/preview", ['subscription_id' => $subscription_id]); return $this->makeRequest('POST', $path, $body, $options); } /** * List a subscription's invoices * * @param string $subscription_id Subscription ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`. * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['state'] (string): Invoice state. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['type'] (string): Filter by type when: * - `type=charge`, only charge invoices will be returned. * - `type=credit`, only credit invoices will be returned. * - `type=non-legacy`, only charge and credit invoices will be returned. * - `type=legacy`, only legacy invoices will be returned. * * @return \Recurly\Pager A list of the subscription's invoices. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_subscription_invoices */ public function listSubscriptionInvoices(string $subscription_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/subscriptions/{subscription_id}/invoices", ['subscription_id' => $subscription_id]); return new \Recurly\Pager($this, $path, $options); } /** * List a subscription's line items * * @param string $subscription_id Subscription ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`. * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['original'] (string): Filter by original field. * - $options['params']['state'] (string): Filter by state field. * - $options['params']['type'] (string): Filter by type field. * * @return \Recurly\Pager A list of the subscription's line items. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_subscription_line_items */ public function listSubscriptionLineItems(string $subscription_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/subscriptions/{subscription_id}/line_items", ['subscription_id' => $subscription_id]); return new \Recurly\Pager($this, $path, $options); } /** * List the coupon redemptions for a subscription * * @param string $subscription_id Subscription ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`. * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * * @return \Recurly\Pager A list of the the coupon redemptions on a subscription. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_subscription_coupon_redemptions */ public function listSubscriptionCouponRedemptions(string $subscription_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/subscriptions/{subscription_id}/coupon_redemptions", ['subscription_id' => $subscription_id]); return new \Recurly\Pager($this, $path, $options); } /** * List a subscription add-on's usage records * * @param string $subscription_id Subscription ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`. * @param string $add_on_id Add-on ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-gold`. * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `usage_timestamp` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=usage_timestamp` or `sort=recorded_timestamp`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=usage_timestamp` or `sort=recorded_timestamp`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['billing_status'] (string): Filter by usage record's billing status * * @return \Recurly\Pager A list of the subscription add-on's usage records. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_usage */ public function listUsage(string $subscription_id, string $add_on_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/subscriptions/{subscription_id}/add_ons/{add_on_id}/usage", ['subscription_id' => $subscription_id, 'add_on_id' => $add_on_id]); return new \Recurly\Pager($this, $path, $options); } /** * Log a usage record on this subscription add-on * * @param string $subscription_id Subscription ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`. * @param string $add_on_id Add-on ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-gold`. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Usage The created usage record. * @link https://developers.recurly.com/api/v2021-02-25#operation/create_usage */ public function createUsage(string $subscription_id, string $add_on_id, array $body, array $options = []): \Recurly\Resources\Usage { $path = $this->interpolatePath("/subscriptions/{subscription_id}/add_ons/{add_on_id}/usage", ['subscription_id' => $subscription_id, 'add_on_id' => $add_on_id]); return $this->makeRequest('POST', $path, $body, $options); } /** * Get a usage record * * @param string $usage_id Usage Record ID. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Usage The usage record. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_usage */ public function getUsage(string $usage_id, array $options = []): \Recurly\Resources\Usage { $path = $this->interpolatePath("/usage/{usage_id}", ['usage_id' => $usage_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Update a usage record * * @param string $usage_id Usage Record ID. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Usage The updated usage record. * @link https://developers.recurly.com/api/v2021-02-25#operation/update_usage */ public function updateUsage(string $usage_id, array $body, array $options = []): \Recurly\Resources\Usage { $path = $this->interpolatePath("/usage/{usage_id}", ['usage_id' => $usage_id]); return $this->makeRequest('PUT', $path, $body, $options); } /** * Delete a usage record. * * @param string $usage_id Usage Record ID. * @param array $options Associative array of optional parameters * * @return \Recurly\EmptyResource Usage was successfully deleted. * @link https://developers.recurly.com/api/v2021-02-25#operation/remove_usage */ public function removeUsage(string $usage_id, array $options = []): \Recurly\EmptyResource { $path = $this->interpolatePath("/usage/{usage_id}", ['usage_id' => $usage_id]); return $this->makeRequest('DELETE', $path, [], $options); } /** * List a site's transactions * * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['type'] (string): Filter by type field. The value `payment` will return both `purchase` and `capture` transactions. * - $options['params']['success'] (string): Filter by success field. * * @return \Recurly\Pager A list of the site's transactions. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_transactions */ public function listTransactions(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/transactions", []); return new \Recurly\Pager($this, $path, $options); } /** * Fetch a transaction * * @param string $transaction_id Transaction ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\Transaction A transaction. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_transaction */ public function getTransaction(string $transaction_id, array $options = []): \Recurly\Resources\Transaction { $path = $this->interpolatePath("/transactions/{transaction_id}", ['transaction_id' => $transaction_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Fetch a unique coupon code * * @param string $unique_coupon_code_id Unique Coupon Code ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-abc-8dh2-def`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\UniqueCouponCode A unique coupon code. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_unique_coupon_code */ public function getUniqueCouponCode(string $unique_coupon_code_id, array $options = []): \Recurly\Resources\UniqueCouponCode { $path = $this->interpolatePath("/unique_coupon_codes/{unique_coupon_code_id}", ['unique_coupon_code_id' => $unique_coupon_code_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Deactivate a unique coupon code * * @param string $unique_coupon_code_id Unique Coupon Code ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-abc-8dh2-def`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\UniqueCouponCode A unique coupon code. * @link https://developers.recurly.com/api/v2021-02-25#operation/deactivate_unique_coupon_code */ public function deactivateUniqueCouponCode(string $unique_coupon_code_id, array $options = []): \Recurly\Resources\UniqueCouponCode { $path = $this->interpolatePath("/unique_coupon_codes/{unique_coupon_code_id}", ['unique_coupon_code_id' => $unique_coupon_code_id]); return $this->makeRequest('DELETE', $path, [], $options); } /** * Restore a unique coupon code * * @param string $unique_coupon_code_id Unique Coupon Code ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-abc-8dh2-def`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\UniqueCouponCode A unique coupon code. * @link https://developers.recurly.com/api/v2021-02-25#operation/reactivate_unique_coupon_code */ public function reactivateUniqueCouponCode(string $unique_coupon_code_id, array $options = []): \Recurly\Resources\UniqueCouponCode { $path = $this->interpolatePath("/unique_coupon_codes/{unique_coupon_code_id}/restore", ['unique_coupon_code_id' => $unique_coupon_code_id]); return $this->makeRequest('PUT', $path, [], $options); } /** * Create a new purchase * * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\InvoiceCollection Returns the new invoices * @link https://developers.recurly.com/api/v2021-02-25#operation/create_purchase */ public function createPurchase(array $body, array $options = []): \Recurly\Resources\InvoiceCollection { $path = $this->interpolatePath("/purchases", []); return $this->makeRequest('POST', $path, $body, $options); } /** * Preview a new purchase * * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\InvoiceCollection Returns preview of the new invoices * @link https://developers.recurly.com/api/v2021-02-25#operation/preview_purchase */ public function previewPurchase(array $body, array $options = []): \Recurly\Resources\InvoiceCollection { $path = $this->interpolatePath("/purchases/preview", []); return $this->makeRequest('POST', $path, $body, $options); } /** * Create a pending purchase * * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\InvoiceCollection Returns the pending invoice * @link https://developers.recurly.com/api/v2021-02-25#operation/create_pending_purchase */ public function createPendingPurchase(array $body, array $options = []): \Recurly\Resources\InvoiceCollection { $path = $this->interpolatePath("/purchases/pending", []); return $this->makeRequest('POST', $path, $body, $options); } + /** + * Authorize a purchase + * + * @param array $body The body of the request. + * @param array $options Associative array of optional parameters + * + * @return \Recurly\Resources\InvoiceCollection Returns the authorize invoice + * @link https://developers.recurly.com/api/v2021-02-25#operation/create_authorize_purchase + */ + public function createAuthorizePurchase(array $body, array $options = []): \Recurly\Resources\InvoiceCollection + { + $path = $this->interpolatePath("/purchases/authorize", []); + return $this->makeRequest('POST', $path, $body, $options); + } + + /** + * Capture a purchase + * + * @param string $transaction_id Transaction ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`. + * @param array $options Associative array of optional parameters + * + * @return \Recurly\Resources\InvoiceCollection Returns the captured invoice + * @link https://developers.recurly.com/api/v2021-02-25#operation/create_capture_purchase + */ + public function createCapturePurchase(string $transaction_id, array $options = []): \Recurly\Resources\InvoiceCollection + { + $path = $this->interpolatePath("/purchases/{transaction_id}/capture", ['transaction_id' => $transaction_id]); + return $this->makeRequest('POST', $path, [], $options); + } + + /** + * Cancel Purchase + * + * @param string $transaction_id Transaction ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`. + * @param array $options Associative array of optional parameters + * + * @return \Recurly\Resources\InvoiceCollection Returns the cancelled invoice + * @link https://developers.recurly.com/api/v2021-02-25#operation/cancelPurchase + */ + public function cancelpurchase(string $transaction_id, array $options = []): \Recurly\Resources\InvoiceCollection + { + $path = $this->interpolatePath("/purchases/{transaction_id}/cancel/", ['transaction_id' => $transaction_id]); + return $this->makeRequest('POST', $path, [], $options); + } + /** * List the dates that have an available export to download. * * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExportDates Returns a list of dates. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_export_dates */ public function getExportDates(array $options = []): \Recurly\Resources\ExportDates { $path = $this->interpolatePath("/export_dates", []); return $this->makeRequest('GET', $path, [], $options); } /** * List of the export files that are available to download. * * @param string $export_date Date for which to get a list of available automated export files. Date must be in YYYY-MM-DD format. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExportFiles Returns a list of export files to download. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_export_files */ public function getExportFiles(string $export_date, array $options = []): \Recurly\Resources\ExportFiles { $path = $this->interpolatePath("/export_dates/{export_date}/export_files", ['export_date' => $export_date]); return $this->makeRequest('GET', $path, [], $options); } /** * List the dunning campaigns for a site * * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * * @return \Recurly\Pager A list of the the dunning_campaigns on an account. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_dunning_campaigns */ public function listDunningCampaigns(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/dunning_campaigns", []); return new \Recurly\Pager($this, $path, $options); } /** * Fetch a dunning campaign * * @param string $dunning_campaign_id Dunning Campaign ID, e.g. `e28zov4fw0v2`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\DunningCampaign Settings for a dunning campaign. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_dunning_campaign */ public function getDunningCampaign(string $dunning_campaign_id, array $options = []): \Recurly\Resources\DunningCampaign { $path = $this->interpolatePath("/dunning_campaigns/{dunning_campaign_id}", ['dunning_campaign_id' => $dunning_campaign_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Assign a dunning campaign to multiple plans * * @param string $dunning_campaign_id Dunning Campaign ID, e.g. `e28zov4fw0v2`. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\DunningCampaignsBulkUpdateResponse A list of updated plans. * @link https://developers.recurly.com/api/v2021-02-25#operation/put_dunning_campaign_bulk_update */ public function putDunningCampaignBulkUpdate(string $dunning_campaign_id, array $body, array $options = []): \Recurly\Resources\DunningCampaignsBulkUpdateResponse { $path = $this->interpolatePath("/dunning_campaigns/{dunning_campaign_id}/bulk_update", ['dunning_campaign_id' => $dunning_campaign_id]); return $this->makeRequest('PUT', $path, $body, $options); } /** * Show the invoice templates for a site * * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * * @return \Recurly\Pager A list of the the invoice templates on a site. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_invoice_templates */ public function listInvoiceTemplates(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/invoice_templates", []); return new \Recurly\Pager($this, $path, $options); } /** * Fetch an invoice template * * @param string $invoice_template_id Invoice template ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-bob`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\InvoiceTemplate Settings for an invoice template. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_invoice_template */ public function getInvoiceTemplate(string $invoice_template_id, array $options = []): \Recurly\Resources\InvoiceTemplate { $path = $this->interpolatePath("/invoice_templates/{invoice_template_id}", ['invoice_template_id' => $invoice_template_id]); return $this->makeRequest('GET', $path, [], $options); } /** * List the external invoices on a site * * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * * @return \Recurly\Pager A list of the the external_invoices on a site. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_external_invoices */ public function listExternalInvoices(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/external_invoices", []); return new \Recurly\Pager($this, $path, $options); } /** * Fetch an external invoice * * @param string $external_invoice_id External invoice ID, e.g. `e28zov4fw0v2`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExternalInvoice Returns the external invoice * @link https://developers.recurly.com/api/v2021-02-25#operation/show_external_invoice */ public function showExternalInvoice(string $external_invoice_id, array $options = []): \Recurly\Resources\ExternalInvoice { $path = $this->interpolatePath("/external_invoices/{external_invoice_id}", ['external_invoice_id' => $external_invoice_id]); return $this->makeRequest('GET', $path, [], $options); } /** * List the external payment phases on an external subscription * * @param string $external_subscription_id External subscription id * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * * @return \Recurly\Pager A list of the the external_payment_phases on a site. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_external_subscription_external_payment_phases */ public function listExternalSubscriptionExternalPaymentPhases(string $external_subscription_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/external_subscriptions/{external_subscription_id}/external_payment_phases", ['external_subscription_id' => $external_subscription_id]); return new \Recurly\Pager($this, $path, $options); } /** * Fetch an external payment_phase * * @param string $external_subscription_id External subscription id * @param string $external_payment_phase_id External payment phase ID, e.g. `a34ypb2ef9w1`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\ExternalPaymentPhase Details for an external payment_phase. * @link https://developers.recurly.com/api/v2021-02-25#operation/get_external_subscription_external_payment_phase */ public function getExternalSubscriptionExternalPaymentPhase(string $external_subscription_id, string $external_payment_phase_id, array $options = []): \Recurly\Resources\ExternalPaymentPhase { $path = $this->interpolatePath("/external_subscriptions/{external_subscription_id}/external_payment_phases/{external_payment_phase_id}", ['external_subscription_id' => $external_subscription_id, 'external_payment_phase_id' => $external_payment_phase_id]); return $this->makeRequest('GET', $path, [], $options); } /** * List entitlements granted to an account * * @param string $account_id Account ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-bob`. * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['state'] (string): Filter the entitlements based on the state of the applicable subscription. * * - When `state=active`, `state=canceled`, `state=expired`, or `state=future`, subscriptions with states that match the query and only those subscriptions will be returned. * - When no state is provided, subscriptions with active or canceled states will be returned. * * @return \Recurly\Pager A list of the entitlements granted to an account. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_entitlements */ public function listEntitlements(string $account_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/accounts/{account_id}/entitlements", ['account_id' => $account_id]); return new \Recurly\Pager($this, $path, $options); } /** * List an account's external subscriptions * * @param string $account_id Account ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-bob`. * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * * @return \Recurly\Pager A list of the the external_subscriptions on an account. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_account_external_subscriptions */ public function listAccountExternalSubscriptions(string $account_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/accounts/{account_id}/external_subscriptions", ['account_id' => $account_id]); return new \Recurly\Pager($this, $path, $options); } /** * Fetch a business entity * * @param string $business_entity_id Business Entity ID. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-entity1`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\BusinessEntity Business entity details * @link https://developers.recurly.com/api/v2021-02-25#operation/get_business_entity */ public function getBusinessEntity(string $business_entity_id, array $options = []): \Recurly\Resources\BusinessEntity { $path = $this->interpolatePath("/business_entities/{business_entity_id}", ['business_entity_id' => $business_entity_id]); return $this->makeRequest('GET', $path, [], $options); } /** * List business entities * * @param array $options Associative array of optional parameters * * @return \Recurly\Pager List of all business entities on your site. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_business_entities */ public function listBusinessEntities(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/business_entities", []); return new \Recurly\Pager($this, $path, $options); } /** * List gift cards * * @param array $options Associative array of optional parameters * * @return \Recurly\Pager List of all created gift cards on your site. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_gift_cards */ public function listGiftCards(array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/gift_cards", []); return new \Recurly\Pager($this, $path, $options); } /** * Create gift card * * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\GiftCard Returns the gift card * @link https://developers.recurly.com/api/v2021-02-25#operation/create_gift_card */ public function createGiftCard(array $body, array $options = []): \Recurly\Resources\GiftCard { $path = $this->interpolatePath("/gift_cards", []); return $this->makeRequest('POST', $path, $body, $options); } /** * Fetch a gift card * * @param string $gift_card_id Gift Card ID, e.g. `e28zov4fw0v2`. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\GiftCard Gift card details * @link https://developers.recurly.com/api/v2021-02-25#operation/get_gift_card */ public function getGiftCard(string $gift_card_id, array $options = []): \Recurly\Resources\GiftCard { $path = $this->interpolatePath("/gift_cards/{gift_card_id}", ['gift_card_id' => $gift_card_id]); return $this->makeRequest('GET', $path, [], $options); } /** * Preview gift card * * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\GiftCard Returns the gift card * @link https://developers.recurly.com/api/v2021-02-25#operation/preview_gift_card */ public function previewGiftCard(array $body, array $options = []): \Recurly\Resources\GiftCard { $path = $this->interpolatePath("/gift_cards/preview", []); return $this->makeRequest('POST', $path, $body, $options); } /** * Redeem gift card * * @param string $redemption_code Gift Card redemption code, e.g., `N1A2T8IRXSCMO40V`. * @param array $body The body of the request. * @param array $options Associative array of optional parameters * * @return \Recurly\Resources\GiftCard Redeems and returns the gift card * @link https://developers.recurly.com/api/v2021-02-25#operation/redeem_gift_card */ public function redeemGiftCard(string $redemption_code, array $body, array $options = []): \Recurly\Resources\GiftCard { $path = $this->interpolatePath("/gift_cards/{redemption_code}/redeem", ['redemption_code' => $redemption_code]); return $this->makeRequest('POST', $path, $body, $options); } /** * List a business entity's invoices * * @param string $business_entity_id Business Entity ID. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-entity1`. * @param array $options Associative array of optional parameters * * Supported optional query string parameters: * * - $options['params']['ids'] (array): Filter results by their IDs. Up to 200 IDs can be passed at once using * commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`. * * **Important notes:** * * * The `ids` parameter cannot be used with any other ordering or filtering * parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc) * * Invalid or unknown IDs will be ignored, so you should check that the * results correspond to your request. * * Records are returned in an arbitrary order. Since results are all * returned at once you can sort the records yourself. * - $options['params']['state'] (string): Invoice state. * - $options['params']['limit'] (int): Limit number of records 1-200. * - $options['params']['order'] (string): Sort order. * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending * order. In descending order updated records will move behind the cursor and could * prevent some records from being returned. * - $options['params']['begin_time'] (string): Inclusively filter by begin_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['end_time'] (string): Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`. * **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. * - $options['params']['type'] (string): Filter by type when: * - `type=charge`, only charge invoices will be returned. * - `type=credit`, only credit invoices will be returned. * - `type=non-legacy`, only charge and credit invoices will be returned. * - `type=legacy`, only legacy invoices will be returned. * * @return \Recurly\Pager A list of the business entity's invoices. * @link https://developers.recurly.com/api/v2021-02-25#operation/list_business_entity_invoices */ public function listBusinessEntityInvoices(string $business_entity_id, array $options = []): \Recurly\Pager { $path = $this->interpolatePath("/business_entities/{business_entity_id}/invoices", ['business_entity_id' => $business_entity_id]); return new \Recurly\Pager($this, $path, $options); } } \ No newline at end of file diff --git a/lib/recurly/resources/invoice.php b/lib/recurly/resources/invoice.php index 4ba269d..8f92bbd 100644 --- a/lib/recurly/resources/invoice.php +++ b/lib/recurly/resources/invoice.php @@ -36,1026 +36,1024 @@ class Invoice extends RecurlyResource private $_number; private $_object; private $_origin; private $_paid; private $_po_number; private $_previous_invoice_id; private $_refundable_amount; private $_shipping_address; private $_state; private $_subscription_ids; private $_subtotal; private $_tax; private $_tax_info; private $_terms_and_conditions; private $_total; private $_transactions; private $_type; private $_updated_at; private $_used_tax_service; private $_uuid; private $_vat_number; private $_vat_reverse_charge_notes; protected static $array_hints = [ 'setCreditPayments' => '\Recurly\Resources\CreditPayment', 'setLineItems' => '\Recurly\Resources\LineItem', 'setSubscriptionIds' => 'string', 'setTransactions' => '\Recurly\Resources\Transaction', ]; /** * Getter method for the account attribute. * Account mini details * * @return ?\Recurly\Resources\AccountMini */ public function getAccount(): ?\Recurly\Resources\AccountMini { return $this->_account; } /** * Setter method for the account attribute. * * @param \Recurly\Resources\AccountMini $account * * @return void */ public function setAccount(\Recurly\Resources\AccountMini $account): void { $this->_account = $account; } /** * Getter method for the address attribute. * * * @return ?\Recurly\Resources\InvoiceAddress */ public function getAddress(): ?\Recurly\Resources\InvoiceAddress { return $this->_address; } /** * Setter method for the address attribute. * * @param \Recurly\Resources\InvoiceAddress $address * * @return void */ public function setAddress(\Recurly\Resources\InvoiceAddress $address): void { $this->_address = $address; } /** * Getter method for the balance attribute. * The outstanding balance remaining on this invoice. * * @return ?float */ public function getBalance(): ?float { return $this->_balance; } /** * Setter method for the balance attribute. * * @param float $balance * * @return void */ public function setBalance(float $balance): void { $this->_balance = $balance; } /** * Getter method for the billing_info_id attribute. * The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. * * @return ?string */ public function getBillingInfoId(): ?string { return $this->_billing_info_id; } /** * Setter method for the billing_info_id attribute. * * @param string $billing_info_id * * @return void */ public function setBillingInfoId(string $billing_info_id): void { $this->_billing_info_id = $billing_info_id; } /** * Getter method for the business_entity_id attribute. * Unique ID to identify the business entity assigned to the invoice. Available when the `Multiple Business Entities` feature is enabled. * * @return ?string */ public function getBusinessEntityId(): ?string { return $this->_business_entity_id; } /** * Setter method for the business_entity_id attribute. * * @param string $business_entity_id * * @return void */ public function setBusinessEntityId(string $business_entity_id): void { $this->_business_entity_id = $business_entity_id; } /** * Getter method for the closed_at attribute. * Date invoice was marked paid or failed. * * @return ?string */ public function getClosedAt(): ?string { return $this->_closed_at; } /** * Setter method for the closed_at attribute. * * @param string $closed_at * * @return void */ public function setClosedAt(string $closed_at): void { $this->_closed_at = $closed_at; } /** * Getter method for the collection_method attribute. * An automatic invoice means a corresponding transaction is run using the account's billing information at the same time the invoice is created. Manual invoices are created without a corresponding transaction. The merchant must enter a manual payment transaction or have the customer pay the invoice with an automatic method, like credit card, PayPal, Amazon, or ACH bank payment. * * @return ?string */ public function getCollectionMethod(): ?string { return $this->_collection_method; } /** * Setter method for the collection_method attribute. * * @param string $collection_method * * @return void */ public function setCollectionMethod(string $collection_method): void { $this->_collection_method = $collection_method; } /** * Getter method for the created_at attribute. * Created at * * @return ?string */ public function getCreatedAt(): ?string { return $this->_created_at; } /** * Setter method for the created_at attribute. * * @param string $created_at * * @return void */ public function setCreatedAt(string $created_at): void { $this->_created_at = $created_at; } /** * Getter method for the credit_payments attribute. * Credit payments * * @return array */ public function getCreditPayments(): array { return $this->_credit_payments ?? [] ; } /** * Setter method for the credit_payments attribute. * * @param array $credit_payments * * @return void */ public function setCreditPayments(array $credit_payments): void { $this->_credit_payments = $credit_payments; } /** * Getter method for the currency attribute. * 3-letter ISO 4217 currency code. * * @return ?string */ public function getCurrency(): ?string { return $this->_currency; } /** * Setter method for the currency attribute. * * @param string $currency * * @return void */ public function setCurrency(string $currency): void { $this->_currency = $currency; } /** * Getter method for the customer_notes attribute. * This will default to the Customer Notes text specified on the Invoice Settings. Specify custom notes to add or override Customer Notes. * * @return ?string */ public function getCustomerNotes(): ?string { return $this->_customer_notes; } /** * Setter method for the customer_notes attribute. * * @param string $customer_notes * * @return void */ public function setCustomerNotes(string $customer_notes): void { $this->_customer_notes = $customer_notes; } /** * Getter method for the discount attribute. * Total discounts applied to this invoice. * * @return ?float */ public function getDiscount(): ?float { return $this->_discount; } /** * Setter method for the discount attribute. * * @param float $discount * * @return void */ public function setDiscount(float $discount): void { $this->_discount = $discount; } /** * Getter method for the due_at attribute. * Date invoice is due. This is the date the net terms are reached. * * @return ?string */ public function getDueAt(): ?string { return $this->_due_at; } /** * Setter method for the due_at attribute. * * @param string $due_at * * @return void */ public function setDueAt(string $due_at): void { $this->_due_at = $due_at; } /** * Getter method for the dunning_campaign_id attribute. * Unique ID to identify the dunning campaign used when dunning the invoice. For sites without multiple dunning campaigns enabled, this will always be the default dunning campaign. * * @return ?string */ public function getDunningCampaignId(): ?string { return $this->_dunning_campaign_id; } /** * Setter method for the dunning_campaign_id attribute. * * @param string $dunning_campaign_id * * @return void */ public function setDunningCampaignId(string $dunning_campaign_id): void { $this->_dunning_campaign_id = $dunning_campaign_id; } /** * Getter method for the dunning_events_sent attribute. * Number of times the event was sent. * * @return ?int */ public function getDunningEventsSent(): ?int { return $this->_dunning_events_sent; } /** * Setter method for the dunning_events_sent attribute. * * @param int $dunning_events_sent * * @return void */ public function setDunningEventsSent(int $dunning_events_sent): void { $this->_dunning_events_sent = $dunning_events_sent; } /** * Getter method for the final_dunning_event attribute. * Last communication attempt. * * @return ?bool */ public function getFinalDunningEvent(): ?bool { return $this->_final_dunning_event; } /** * Setter method for the final_dunning_event attribute. * * @param bool $final_dunning_event * * @return void */ public function setFinalDunningEvent(bool $final_dunning_event): void { $this->_final_dunning_event = $final_dunning_event; } /** * Getter method for the has_more_line_items attribute. * Identifies if the invoice has more line items than are returned in `line_items`. If `has_more_line_items` is `true`, then a request needs to be made to the `list_invoice_line_items` endpoint. * * @return ?bool */ public function getHasMoreLineItems(): ?bool { return $this->_has_more_line_items; } /** * Setter method for the has_more_line_items attribute. * * @param bool $has_more_line_items * * @return void */ public function setHasMoreLineItems(bool $has_more_line_items): void { $this->_has_more_line_items = $has_more_line_items; } /** * Getter method for the id attribute. * Invoice ID * * @return ?string */ public function getId(): ?string { return $this->_id; } /** * Setter method for the id attribute. * * @param string $id * * @return void */ public function setId(string $id): void { $this->_id = $id; } /** * Getter method for the line_items attribute. * Line Items * * @return array */ public function getLineItems(): array { return $this->_line_items ?? [] ; } /** * Setter method for the line_items attribute. * * @param array $line_items * * @return void */ public function setLineItems(array $line_items): void { $this->_line_items = $line_items; } /** * Getter method for the net_terms attribute. * Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. * * @return ?int */ public function getNetTerms(): ?int { return $this->_net_terms; } /** * Setter method for the net_terms attribute. * * @param int $net_terms * * @return void */ public function setNetTerms(int $net_terms): void { $this->_net_terms = $net_terms; } /** * Getter method for the net_terms_type attribute. * Optionally supplied string that may be either `net` or `eom` (end-of-month). When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date. When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month. -This field is only available when the EOM Net Terms feature is enabled. - * * @return ?string */ public function getNetTermsType(): ?string { return $this->_net_terms_type; } /** * Setter method for the net_terms_type attribute. * * @param string $net_terms_type * * @return void */ public function setNetTermsType(string $net_terms_type): void { $this->_net_terms_type = $net_terms_type; } /** * Getter method for the number attribute. * If VAT taxation and the Country Invoice Sequencing feature are enabled, invoices will have country-specific invoice numbers for invoices billed to EU countries (ex: FR1001). Non-EU invoices will continue to use the site-level invoice number sequence. * * @return ?string */ public function getNumber(): ?string { return $this->_number; } /** * Setter method for the number attribute. * * @param string $number * * @return void */ public function setNumber(string $number): void { $this->_number = $number; } /** * Getter method for the object attribute. * Object type * * @return ?string */ public function getObject(): ?string { return $this->_object; } /** * Setter method for the object attribute. * * @param string $object * * @return void */ public function setObject(string $object): void { $this->_object = $object; } /** * Getter method for the origin attribute. * The event that created the invoice. * * @return ?string */ public function getOrigin(): ?string { return $this->_origin; } /** * Setter method for the origin attribute. * * @param string $origin * * @return void */ public function setOrigin(string $origin): void { $this->_origin = $origin; } /** * Getter method for the paid attribute. * The total amount of successful payments transaction on this invoice. * * @return ?float */ public function getPaid(): ?float { return $this->_paid; } /** * Setter method for the paid attribute. * * @param float $paid * * @return void */ public function setPaid(float $paid): void { $this->_paid = $paid; } /** * Getter method for the po_number attribute. * For manual invoicing, this identifies the PO number associated with the subscription. * * @return ?string */ public function getPoNumber(): ?string { return $this->_po_number; } /** * Setter method for the po_number attribute. * * @param string $po_number * * @return void */ public function setPoNumber(string $po_number): void { $this->_po_number = $po_number; } /** * Getter method for the previous_invoice_id attribute. * On refund invoices, this value will exist and show the invoice ID of the purchase invoice the refund was created from. This field is only populated for sites without the [Only Bill What Changed](https://docs.recurly.com/docs/only-bill-what-changed) feature enabled. Sites with Only Bill What Changed enabled should use the [related_invoices endpoint](https://recurly.com/developers/api/v2021-02-25/index.html#operation/list_related_invoices) to see purchase invoices refunded by this invoice. * * @return ?string */ public function getPreviousInvoiceId(): ?string { return $this->_previous_invoice_id; } /** * Setter method for the previous_invoice_id attribute. * * @param string $previous_invoice_id * * @return void */ public function setPreviousInvoiceId(string $previous_invoice_id): void { $this->_previous_invoice_id = $previous_invoice_id; } /** * Getter method for the refundable_amount attribute. * The refundable amount on a charge invoice. It will be null for all other invoices. * * @return ?float */ public function getRefundableAmount(): ?float { return $this->_refundable_amount; } /** * Setter method for the refundable_amount attribute. * * @param float $refundable_amount * * @return void */ public function setRefundableAmount(float $refundable_amount): void { $this->_refundable_amount = $refundable_amount; } /** * Getter method for the shipping_address attribute. * * * @return ?\Recurly\Resources\ShippingAddress */ public function getShippingAddress(): ?\Recurly\Resources\ShippingAddress { return $this->_shipping_address; } /** * Setter method for the shipping_address attribute. * * @param \Recurly\Resources\ShippingAddress $shipping_address * * @return void */ public function setShippingAddress(\Recurly\Resources\ShippingAddress $shipping_address): void { $this->_shipping_address = $shipping_address; } /** * Getter method for the state attribute. * Invoice state * * @return ?string */ public function getState(): ?string { return $this->_state; } /** * Setter method for the state attribute. * * @param string $state * * @return void */ public function setState(string $state): void { $this->_state = $state; } /** * Getter method for the subscription_ids attribute. * If the invoice is charging or refunding for one or more subscriptions, these are their IDs. * * @return array */ public function getSubscriptionIds(): array { return $this->_subscription_ids ?? [] ; } /** * Setter method for the subscription_ids attribute. * * @param array $subscription_ids * * @return void */ public function setSubscriptionIds(array $subscription_ids): void { $this->_subscription_ids = $subscription_ids; } /** * Getter method for the subtotal attribute. * The summation of charges and credits, before discounts and taxes. * * @return ?float */ public function getSubtotal(): ?float { return $this->_subtotal; } /** * Setter method for the subtotal attribute. * * @param float $subtotal * * @return void */ public function setSubtotal(float $subtotal): void { $this->_subtotal = $subtotal; } /** * Getter method for the tax attribute. * The total tax on this invoice. * * @return ?float */ public function getTax(): ?float { return $this->_tax; } /** * Setter method for the tax attribute. * * @param float $tax * * @return void */ public function setTax(float $tax): void { $this->_tax = $tax; } /** * Getter method for the tax_info attribute. * Only for merchants using Recurly's In-The-Box taxes. * * @return ?\Recurly\Resources\TaxInfo */ public function getTaxInfo(): ?\Recurly\Resources\TaxInfo { return $this->_tax_info; } /** * Setter method for the tax_info attribute. * * @param \Recurly\Resources\TaxInfo $tax_info * * @return void */ public function setTaxInfo(\Recurly\Resources\TaxInfo $tax_info): void { $this->_tax_info = $tax_info; } /** * Getter method for the terms_and_conditions attribute. * This will default to the Terms and Conditions text specified on the Invoice Settings page in your Recurly admin. Specify custom notes to add or override Terms and Conditions. * * @return ?string */ public function getTermsAndConditions(): ?string { return $this->_terms_and_conditions; } /** * Setter method for the terms_and_conditions attribute. * * @param string $terms_and_conditions * * @return void */ public function setTermsAndConditions(string $terms_and_conditions): void { $this->_terms_and_conditions = $terms_and_conditions; } /** * Getter method for the total attribute. * The final total on this invoice. The summation of invoice charges, discounts, credits, and tax. * * @return ?float */ public function getTotal(): ?float { return $this->_total; } /** * Setter method for the total attribute. * * @param float $total * * @return void */ public function setTotal(float $total): void { $this->_total = $total; } /** * Getter method for the transactions attribute. * Transactions * * @return array */ public function getTransactions(): array { return $this->_transactions ?? [] ; } /** * Setter method for the transactions attribute. * * @param array $transactions * * @return void */ public function setTransactions(array $transactions): void { $this->_transactions = $transactions; } /** * Getter method for the type attribute. * Invoices are either charge, credit, or legacy invoices. * * @return ?string */ public function getType(): ?string { return $this->_type; } /** * Setter method for the type attribute. * * @param string $type * * @return void */ public function setType(string $type): void { $this->_type = $type; } /** * Getter method for the updated_at attribute. * Last updated at * * @return ?string */ public function getUpdatedAt(): ?string { return $this->_updated_at; } /** * Setter method for the updated_at attribute. * * @param string $updated_at * * @return void */ public function setUpdatedAt(string $updated_at): void { $this->_updated_at = $updated_at; } /** * Getter method for the used_tax_service attribute. * Will be `true` when the invoice had a successful response from the tax service and `false` when the invoice was not sent to tax service due to a lack of address or enabled jurisdiction or was processed without tax due to a non-blocking error returned from the tax service. * * @return ?bool */ public function getUsedTaxService(): ?bool { return $this->_used_tax_service; } /** * Setter method for the used_tax_service attribute. * * @param bool $used_tax_service * * @return void */ public function setUsedTaxService(bool $used_tax_service): void { $this->_used_tax_service = $used_tax_service; } /** * Getter method for the uuid attribute. * Invoice UUID * * @return ?string */ public function getUuid(): ?string { return $this->_uuid; } /** * Setter method for the uuid attribute. * * @param string $uuid * * @return void */ public function setUuid(string $uuid): void { $this->_uuid = $uuid; } /** * Getter method for the vat_number attribute. * VAT registration number for the customer on this invoice. This will come from the VAT Number field in the Billing Info or the Account Info depending on your tax settings and the invoice collection method. * * @return ?string */ public function getVatNumber(): ?string { return $this->_vat_number; } /** * Setter method for the vat_number attribute. * * @param string $vat_number * * @return void */ public function setVatNumber(string $vat_number): void { $this->_vat_number = $vat_number; } /** * Getter method for the vat_reverse_charge_notes attribute. * VAT Reverse Charge Notes only appear if you have EU VAT enabled or are using your own Avalara AvaTax account and the customer is in the EU, has a VAT number, and is in a different country than your own. This will default to the VAT Reverse Charge Notes text specified on the Tax Settings page in your Recurly admin, unless custom notes were created with the original subscription. * * @return ?string */ public function getVatReverseChargeNotes(): ?string { return $this->_vat_reverse_charge_notes; diff --git a/lib/recurly/resources/subscription.php b/lib/recurly/resources/subscription.php index 1f0570a..f913550 100644 --- a/lib/recurly/resources/subscription.php +++ b/lib/recurly/resources/subscription.php @@ -184,1026 +184,1024 @@ class Subscription extends RecurlyResource * * @return void */ public function setAddOns(array $add_ons): void { $this->_add_ons = $add_ons; } /** * Getter method for the add_ons_total attribute. * Total price of add-ons * * @return ?float */ public function getAddOnsTotal(): ?float { return $this->_add_ons_total; } /** * Setter method for the add_ons_total attribute. * * @param float $add_ons_total * * @return void */ public function setAddOnsTotal(float $add_ons_total): void { $this->_add_ons_total = $add_ons_total; } /** * Getter method for the auto_renew attribute. * Whether the subscription renews at the end of its term. * * @return ?bool */ public function getAutoRenew(): ?bool { return $this->_auto_renew; } /** * Setter method for the auto_renew attribute. * * @param bool $auto_renew * * @return void */ public function setAutoRenew(bool $auto_renew): void { $this->_auto_renew = $auto_renew; } /** * Getter method for the bank_account_authorized_at attribute. * Recurring subscriptions paid with ACH will have this attribute set. This timestamp is used for alerting customers to reauthorize in 3 years in accordance with NACHA rules. If a subscription becomes inactive or the billing info is no longer a bank account, this timestamp is cleared. * * @return ?string */ public function getBankAccountAuthorizedAt(): ?string { return $this->_bank_account_authorized_at; } /** * Setter method for the bank_account_authorized_at attribute. * * @param string $bank_account_authorized_at * * @return void */ public function setBankAccountAuthorizedAt(string $bank_account_authorized_at): void { $this->_bank_account_authorized_at = $bank_account_authorized_at; } /** * Getter method for the billing_info_id attribute. * Billing Info ID. * * @return ?string */ public function getBillingInfoId(): ?string { return $this->_billing_info_id; } /** * Setter method for the billing_info_id attribute. * * @param string $billing_info_id * * @return void */ public function setBillingInfoId(string $billing_info_id): void { $this->_billing_info_id = $billing_info_id; } /** * Getter method for the canceled_at attribute. * Canceled at * * @return ?string */ public function getCanceledAt(): ?string { return $this->_canceled_at; } /** * Setter method for the canceled_at attribute. * * @param string $canceled_at * * @return void */ public function setCanceledAt(string $canceled_at): void { $this->_canceled_at = $canceled_at; } /** * Getter method for the collection_method attribute. * Collection method * * @return ?string */ public function getCollectionMethod(): ?string { return $this->_collection_method; } /** * Setter method for the collection_method attribute. * * @param string $collection_method * * @return void */ public function setCollectionMethod(string $collection_method): void { $this->_collection_method = $collection_method; } /** * Getter method for the converted_at attribute. * When the subscription was converted from a gift card. * * @return ?string */ public function getConvertedAt(): ?string { return $this->_converted_at; } /** * Setter method for the converted_at attribute. * * @param string $converted_at * * @return void */ public function setConvertedAt(string $converted_at): void { $this->_converted_at = $converted_at; } /** * Getter method for the coupon_redemptions attribute. * Returns subscription level coupon redemptions that are tied to this subscription. * * @return array */ public function getCouponRedemptions(): array { return $this->_coupon_redemptions ?? [] ; } /** * Setter method for the coupon_redemptions attribute. * * @param array $coupon_redemptions * * @return void */ public function setCouponRedemptions(array $coupon_redemptions): void { $this->_coupon_redemptions = $coupon_redemptions; } /** * Getter method for the created_at attribute. * Created at * * @return ?string */ public function getCreatedAt(): ?string { return $this->_created_at; } /** * Setter method for the created_at attribute. * * @param string $created_at * * @return void */ public function setCreatedAt(string $created_at): void { $this->_created_at = $created_at; } /** * Getter method for the currency attribute. * 3-letter ISO 4217 currency code. * * @return ?string */ public function getCurrency(): ?string { return $this->_currency; } /** * Setter method for the currency attribute. * * @param string $currency * * @return void */ public function setCurrency(string $currency): void { $this->_currency = $currency; } /** * Getter method for the current_period_ends_at attribute. * Current billing period ends at * * @return ?string */ public function getCurrentPeriodEndsAt(): ?string { return $this->_current_period_ends_at; } /** * Setter method for the current_period_ends_at attribute. * * @param string $current_period_ends_at * * @return void */ public function setCurrentPeriodEndsAt(string $current_period_ends_at): void { $this->_current_period_ends_at = $current_period_ends_at; } /** * Getter method for the current_period_started_at attribute. * Current billing period started at * * @return ?string */ public function getCurrentPeriodStartedAt(): ?string { return $this->_current_period_started_at; } /** * Setter method for the current_period_started_at attribute. * * @param string $current_period_started_at * * @return void */ public function setCurrentPeriodStartedAt(string $current_period_started_at): void { $this->_current_period_started_at = $current_period_started_at; } /** * Getter method for the current_term_ends_at attribute. * When the term ends. This is calculated by a plan's interval and `total_billing_cycles` in a term. Subscription changes with a `timeframe=renewal` will be applied on this date. * * @return ?string */ public function getCurrentTermEndsAt(): ?string { return $this->_current_term_ends_at; } /** * Setter method for the current_term_ends_at attribute. * * @param string $current_term_ends_at * * @return void */ public function setCurrentTermEndsAt(string $current_term_ends_at): void { $this->_current_term_ends_at = $current_term_ends_at; } /** * Getter method for the current_term_started_at attribute. * The start date of the term when the first billing period starts. The subscription term is the length of time that a customer will be committed to a subscription. A term can span multiple billing periods. * * @return ?string */ public function getCurrentTermStartedAt(): ?string { return $this->_current_term_started_at; } /** * Setter method for the current_term_started_at attribute. * * @param string $current_term_started_at * * @return void */ public function setCurrentTermStartedAt(string $current_term_started_at): void { $this->_current_term_started_at = $current_term_started_at; } /** * Getter method for the custom_fields attribute. * The custom fields will only be altered when they are included in a request. Sending an empty array will not remove any existing values. To remove a field send the name with a null or empty value. * * @return array */ public function getCustomFields(): array { return $this->_custom_fields ?? [] ; } /** * Setter method for the custom_fields attribute. * * @param array $custom_fields * * @return void */ public function setCustomFields(array $custom_fields): void { $this->_custom_fields = $custom_fields; } /** * Getter method for the customer_notes attribute. * Customer notes * * @return ?string */ public function getCustomerNotes(): ?string { return $this->_customer_notes; } /** * Setter method for the customer_notes attribute. * * @param string $customer_notes * * @return void */ public function setCustomerNotes(string $customer_notes): void { $this->_customer_notes = $customer_notes; } /** * Getter method for the expiration_reason attribute. * Expiration reason * * @return ?string */ public function getExpirationReason(): ?string { return $this->_expiration_reason; } /** * Setter method for the expiration_reason attribute. * * @param string $expiration_reason * * @return void */ public function setExpirationReason(string $expiration_reason): void { $this->_expiration_reason = $expiration_reason; } /** * Getter method for the expires_at attribute. * Expires at * * @return ?string */ public function getExpiresAt(): ?string { return $this->_expires_at; } /** * Setter method for the expires_at attribute. * * @param string $expires_at * * @return void */ public function setExpiresAt(string $expires_at): void { $this->_expires_at = $expires_at; } /** * Getter method for the gateway_code attribute. * If present, this subscription's transactions will use the payment gateway with this code. * * @return ?string */ public function getGatewayCode(): ?string { return $this->_gateway_code; } /** * Setter method for the gateway_code attribute. * * @param string $gateway_code * * @return void */ public function setGatewayCode(string $gateway_code): void { $this->_gateway_code = $gateway_code; } /** * Getter method for the id attribute. * Subscription ID * * @return ?string */ public function getId(): ?string { return $this->_id; } /** * Setter method for the id attribute. * * @param string $id * * @return void */ public function setId(string $id): void { $this->_id = $id; } /** * Getter method for the net_terms attribute. * Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. * * @return ?int */ public function getNetTerms(): ?int { return $this->_net_terms; } /** * Setter method for the net_terms attribute. * * @param int $net_terms * * @return void */ public function setNetTerms(int $net_terms): void { $this->_net_terms = $net_terms; } /** * Getter method for the net_terms_type attribute. * Optionally supplied string that may be either `net` or `eom` (end-of-month). When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date. When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month. -This field is only available when the EOM Net Terms feature is enabled. - * * @return ?string */ public function getNetTermsType(): ?string { return $this->_net_terms_type; } /** * Setter method for the net_terms_type attribute. * * @param string $net_terms_type * * @return void */ public function setNetTermsType(string $net_terms_type): void { $this->_net_terms_type = $net_terms_type; } /** * Getter method for the object attribute. * Object type * * @return ?string */ public function getObject(): ?string { return $this->_object; } /** * Setter method for the object attribute. * * @param string $object * * @return void */ public function setObject(string $object): void { $this->_object = $object; } /** * Getter method for the paused_at attribute. * Null unless subscription is paused or will pause at the end of the current billing period. * * @return ?string */ public function getPausedAt(): ?string { return $this->_paused_at; } /** * Setter method for the paused_at attribute. * * @param string $paused_at * * @return void */ public function setPausedAt(string $paused_at): void { $this->_paused_at = $paused_at; } /** * Getter method for the pending_change attribute. * Subscription Change * * @return ?\Recurly\Resources\SubscriptionChange */ public function getPendingChange(): ?\Recurly\Resources\SubscriptionChange { return $this->_pending_change; } /** * Setter method for the pending_change attribute. * * @param \Recurly\Resources\SubscriptionChange $pending_change * * @return void */ public function setPendingChange(\Recurly\Resources\SubscriptionChange $pending_change): void { $this->_pending_change = $pending_change; } /** * Getter method for the plan attribute. * Just the important parts. * * @return ?\Recurly\Resources\PlanMini */ public function getPlan(): ?\Recurly\Resources\PlanMini { return $this->_plan; } /** * Setter method for the plan attribute. * * @param \Recurly\Resources\PlanMini $plan * * @return void */ public function setPlan(\Recurly\Resources\PlanMini $plan): void { $this->_plan = $plan; } /** * Getter method for the po_number attribute. * For manual invoicing, this identifies the PO number associated with the subscription. * * @return ?string */ public function getPoNumber(): ?string { return $this->_po_number; } /** * Setter method for the po_number attribute. * * @param string $po_number * * @return void */ public function setPoNumber(string $po_number): void { $this->_po_number = $po_number; } /** * Getter method for the quantity attribute. * Subscription quantity * * @return ?int */ public function getQuantity(): ?int { return $this->_quantity; } /** * Setter method for the quantity attribute. * * @param int $quantity * * @return void */ public function setQuantity(int $quantity): void { $this->_quantity = $quantity; } /** * Getter method for the ramp_intervals attribute. * The ramp intervals representing the pricing schedule for the subscription. * * @return array */ public function getRampIntervals(): array { return $this->_ramp_intervals ?? [] ; } /** * Setter method for the ramp_intervals attribute. * * @param array $ramp_intervals * * @return void */ public function setRampIntervals(array $ramp_intervals): void { $this->_ramp_intervals = $ramp_intervals; } /** * Getter method for the remaining_billing_cycles attribute. * The remaining billing cycles in the current term. * * @return ?int */ public function getRemainingBillingCycles(): ?int { return $this->_remaining_billing_cycles; } /** * Setter method for the remaining_billing_cycles attribute. * * @param int $remaining_billing_cycles * * @return void */ public function setRemainingBillingCycles(int $remaining_billing_cycles): void { $this->_remaining_billing_cycles = $remaining_billing_cycles; } /** * Getter method for the remaining_pause_cycles attribute. * Null unless subscription is paused or will pause at the end of the current billing period. * * @return ?int */ public function getRemainingPauseCycles(): ?int { return $this->_remaining_pause_cycles; } /** * Setter method for the remaining_pause_cycles attribute. * * @param int $remaining_pause_cycles * * @return void */ public function setRemainingPauseCycles(int $remaining_pause_cycles): void { $this->_remaining_pause_cycles = $remaining_pause_cycles; } /** * Getter method for the renewal_billing_cycles attribute. * If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. * * @return ?int */ public function getRenewalBillingCycles(): ?int { return $this->_renewal_billing_cycles; } /** * Setter method for the renewal_billing_cycles attribute. * * @param int $renewal_billing_cycles * * @return void */ public function setRenewalBillingCycles(int $renewal_billing_cycles): void { $this->_renewal_billing_cycles = $renewal_billing_cycles; } /** * Getter method for the revenue_schedule_type attribute. * Revenue schedule type * * @return ?string */ public function getRevenueScheduleType(): ?string { return $this->_revenue_schedule_type; } /** * Setter method for the revenue_schedule_type attribute. * * @param string $revenue_schedule_type * * @return void */ public function setRevenueScheduleType(string $revenue_schedule_type): void { $this->_revenue_schedule_type = $revenue_schedule_type; } /** * Getter method for the shipping attribute. * Subscription shipping details * * @return ?\Recurly\Resources\SubscriptionShipping */ public function getShipping(): ?\Recurly\Resources\SubscriptionShipping { return $this->_shipping; } /** * Setter method for the shipping attribute. * * @param \Recurly\Resources\SubscriptionShipping $shipping * * @return void */ public function setShipping(\Recurly\Resources\SubscriptionShipping $shipping): void { $this->_shipping = $shipping; } /** * Getter method for the started_with_gift attribute. * Whether the subscription was started with a gift certificate. * * @return ?bool */ public function getStartedWithGift(): ?bool { return $this->_started_with_gift; } /** * Setter method for the started_with_gift attribute. * * @param bool $started_with_gift * * @return void */ public function setStartedWithGift(bool $started_with_gift): void { $this->_started_with_gift = $started_with_gift; } /** * Getter method for the state attribute. * State * * @return ?string */ public function getState(): ?string { return $this->_state; } /** * Setter method for the state attribute. * * @param string $state * * @return void */ public function setState(string $state): void { $this->_state = $state; } /** * Getter method for the subtotal attribute. * Estimated total, before tax. * * @return ?float */ public function getSubtotal(): ?float { return $this->_subtotal; } /** * Setter method for the subtotal attribute. * * @param float $subtotal * * @return void */ public function setSubtotal(float $subtotal): void { $this->_subtotal = $subtotal; } /** * Getter method for the tax attribute. * Only for merchants using Recurly's In-The-Box taxes. * * @return ?float */ public function getTax(): ?float { return $this->_tax; } /** * Setter method for the tax attribute. * * @param float $tax * * @return void */ public function setTax(float $tax): void { $this->_tax = $tax; } /** * Getter method for the tax_inclusive attribute. * Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to utilize this flag. * * @return ?bool */ public function getTaxInclusive(): ?bool { return $this->_tax_inclusive; } /** * Setter method for the tax_inclusive attribute. * * @param bool $tax_inclusive * * @return void */ public function setTaxInclusive(bool $tax_inclusive): void { $this->_tax_inclusive = $tax_inclusive; } /** * Getter method for the tax_info attribute. * Only for merchants using Recurly's In-The-Box taxes. * * @return ?\Recurly\Resources\TaxInfo */ public function getTaxInfo(): ?\Recurly\Resources\TaxInfo { return $this->_tax_info; } /** * Setter method for the tax_info attribute. * * @param \Recurly\Resources\TaxInfo $tax_info * * @return void */ public function setTaxInfo(\Recurly\Resources\TaxInfo $tax_info): void { $this->_tax_info = $tax_info; } /** * Getter method for the terms_and_conditions attribute. * Terms and conditions * * @return ?string */ public function getTermsAndConditions(): ?string { return $this->_terms_and_conditions; } /** * Setter method for the terms_and_conditions attribute. * * @param string $terms_and_conditions * * @return void */ public function setTermsAndConditions(string $terms_and_conditions): void { $this->_terms_and_conditions = $terms_and_conditions; } /** * Getter method for the total attribute. * Estimated total * * @return ?float */ public function getTotal(): ?float { return $this->_total; } /** * Setter method for the total attribute. * * @param float $total * * @return void */ public function setTotal(float $total): void { $this->_total = $total; } /** * Getter method for the total_billing_cycles attribute. * The number of cycles/billing periods in a term. When `remaining_billing_cycles=0`, if `auto_renew=true` the subscription will renew and a new term will begin, otherwise the subscription will expire. * * @return ?int */ public function getTotalBillingCycles(): ?int { return $this->_total_billing_cycles; } /** * Setter method for the total_billing_cycles attribute. * * @param int $total_billing_cycles * * @return void */ public function setTotalBillingCycles(int $total_billing_cycles): void { $this->_total_billing_cycles = $total_billing_cycles; } /** * Getter method for the trial_ends_at attribute. * Trial period ends at * * @return ?string */ public function getTrialEndsAt(): ?string { return $this->_trial_ends_at; diff --git a/openapi/api.yaml b/openapi/api.yaml index ad7a4e4..0c948a9 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -14961,1024 +14961,1150 @@ paths: &recurly.ShippingPurchase{\n\t\tAddressId: recurly.String(shippingAddressID),\n\t},\n}\n\ncollection, err := client.CreatePurchase(purchaseReq)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeValidation {\n\t\tfmt.Printf(\"Failed validation: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\nfmt.Printf(\"Created Purchase: %s\", collection.ChargeInvoice.Number)" "/purchases/preview": post: tags: - purchase operationId: preview_purchase summary: Preview a new purchase description: A purchase is a checkout containing at least one or more subscriptions or one-time charges (line items) and supports both coupon and gift card redemptions. All items purchased will be on one invoice and paid for with one transaction. requestBody: content: application/json: schema: "$ref": "#/components/schemas/PurchaseCreate" required: true responses: '200': description: Returns preview of the new invoices content: application/json: schema: "$ref": "#/components/schemas/InvoiceCollection" '400': description: Bad request; perhaps missing or invalid parameters. content: application/json: schema: "$ref": "#/components/schemas/Error" '422': description: Purchase cannot be previewed for the specified reason. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { let purchaseReq = { currency: 'USD', account: { firstName: 'Benjamin', lastName: 'Du Monde', code: accountCode, billingInfo: { tokenId: rjsTokenId } }, subscriptions: [ { planCode: planCode }, ] } let invoiceCollection = await client.previewPurchase(purchaseReq) console.log('Preview Charge Invoice: ', invoiceCollection.chargeInvoice) console.log('Preview Credit Invoices: ', invoiceCollection.creditInvoices) } catch (err) { if (err instanceof recurly.errors.ValidationError) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params console.log('Failed validation', err.params) } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: purchase = { "currency": "USD", "account": { "code": account_code, "first_name": "Benjamin", "last_name": "Du Monde", "billing_info": {"token_id": rjs_token_id}, }, "subscriptions": [{"plan_code": plan_code}], } invoice_collection = client.preview_purchase(purchase) print("Preview Charge Invoice %s" % invoice_collection.charge_invoice) print("Preview Credit Invoices %s" % invoice_collection.credit_invoices) except recurly.errors.ValidationError as e: # If the request was invalid, you may want to tell your user # why. You can find the invalid params and reasons in e.error.params print("ValidationError: %s" % e.error.message) print(e.error.params) - lang: ".NET" source: | try { var purchaseReq = new PurchaseCreate() { Currency = "USD", Account = new AccountPurchase() { Code = accountCode, FirstName = "Benjamin", LastName = "Du Monde", BillingInfo = new BillingInfoCreate() { TokenId = rjsTokenId } }, Subscriptions = new List<SubscriptionPurchase>() { new SubscriptionPurchase() { PlanCode = planCode } } }; InvoiceCollection collection = client.PreviewPurchase(purchaseReq); Console.WriteLine($"Preview ChargeInvoice with Total: {collection.ChargeInvoice.Total}"); } catch (Recurly.Errors.Validation ex) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in ex.Error.Params Console.WriteLine($"Failed validation: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin purchase = { currency: "USD", account: { code: account_code, first_name: "Benjamin", last_name: "Du Monde", billing_info: { token_id: rjs_token_id }, }, subscriptions: [ { plan_code: plan_code } ] } invoice_collection = @client.preview_purchase( body: purchase ) puts "Preview Charge Invoice #{invoice_collection.charge_invoice}" puts "Preview Credit Invoices #{invoice_collection.credit_invoices}" rescue Recurly::Errors::ValidationError => e # If the request was invalid, you may want to tell your user # why. You can find the invalid params and reasons in e.recurly_error.params puts "ValidationError: #{e.recurly_error.params}" end - lang: Java source: | try { AccountPurchase account = new AccountPurchase(); account.setCode(accountCode); account.setFirstName("Joanna"); account.setLastName("DuMonde"); BillingInfoCreate billing = new BillingInfoCreate(); billing.setTokenId(rjsTokenId); account.setBillingInfo(billing); List<SubscriptionPurchase> subscriptions = new ArrayList<SubscriptionPurchase>(); SubscriptionPurchase sub = new SubscriptionPurchase(); sub.setPlanCode(planCode); subscriptions.add(sub); PurchaseCreate purchase = new PurchaseCreate(); purchase.setCurrency("USD"); purchase.setAccount(account); purchase.setSubscriptions(subscriptions); InvoiceCollection collection = client.previewPurchase(purchase); System.out.println("Preview Charge Invoice:" + collection.getChargeInvoice()); System.out.println("Preview Credit Invoices: " + collection.getCreditInvoices()); } catch (ValidationException e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in e.getError().getParams() System.out.println("Failed validation: " + e.getError().getMessage()); System.out.println("Params: " + e.getError().getParams()); } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $purchase_preview = [ "currency" => "USD", "account" => [ "code" => $account_code, "first_name" => "Douglas", "last_name" => "Du Monde", "billing_info" => [ "token_id" => $rjs_token_id ], ], "subscriptions" => [ [ "plan_code" => $plan_code ] ] ]; $invoice_collection = $client->previewPurchase($purchase_preview); echo 'Preview Invoices:' . PHP_EOL; var_dump($invoice_collection); } catch (\Recurly\Errors\Validation $e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params var_dump($e); } catch (\Recurly\RecurlyError $e) { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it var_dump($e); } - lang: Go source: "purchaseReq := &recurly.PurchaseCreate{\n\tCurrency: recurly.String(\"USD\"),\n\tAccount: &recurly.AccountPurchase{\n\t\tCode: recurly.String(account.Code),\n\t},\n\tSubscriptions: []recurly.SubscriptionPurchase{\n\t\t{\n\t\t\tPlanCode: recurly.String(plan.Code),\n\t\t\tNextBillDate: recurly.Time(time.Date(2078, time.November, 10, 23, 0, 0, 0, time.UTC)),\n\t\t},\n\t},\n\tShipping: &recurly.ShippingPurchase{\n\t\tAddressId: recurly.String(shippingAddressID),\n\t},\n}\ncollection, err := client.PreviewPurchase(purchaseReq)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeValidation {\n\t\tfmt.Printf(\"Failed validation: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\nfmt.Printf(\"Preview Charge Invoice %v\", collection.ChargeInvoice)" "/purchases/pending": post: tags: - purchase operationId: create_pending_purchase summary: Create a pending purchase description: |- A purchase is a hybrid checkout containing at least one or more subscriptions or one-time charges (adjustments) and supports both coupon and gift card redemptions. All items purchased will be on one invoice and paid for with one transaction. A purchase is only a request data type and is not persistent in Recurly and an invoice collection will be the returned type. Use for **Adyen HPP** and **Online Banking** transaction requests. This runs the validations but not the transactions. The API request allows the inclusion of the following field: **external_hpp_type** with `'adyen'` in the **billing_info** object. For additional information regarding shipping fees, please see https://docs.recurly.com/docs/shipping Note: an email address is required on the account for a Pending Purchase. requestBody: content: application/json: schema: "$ref": "#/components/schemas/PurchaseCreate" required: true responses: '200': description: Returns the pending invoice content: application/json: schema: "$ref": "#/components/schemas/InvoiceCollection" '400': description: Bad request; perhaps missing or invalid parameters. content: application/json: schema: "$ref": "#/components/schemas/Error" '422': description: Pending purchase cannot be completed for the specified reason. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const purchaseReq = { currency: 'EUR', account: { code: accountCode, email: '[email protected]', billingInfo: { firstName: 'Benjamin', lastName: 'Du Monde', onlineBankingPaymentType: 'ideal' }, }, lineItems: [ { currency: 'EUR', unitAmount: 1000, type: 'charge' } ] }; const invoiceCollection = await client.createPendingPurchase(purchaseReq) console.log('Created ChargeInvoice with UUID: ', invoiceCollection.chargeInvoice.uuid) } catch (err) { if (err instanceof recurly.errors.ValidationError) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params console.log('Failed validation', err.params) } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: purchase = { "currency": "EUR", "account": { "code": account_code, "email": "[email protected]", "billing_info": { "first_name": "Benjamin", "last_name": "Du Monde", "online_banking_payment_type": "ideal" } }, "line_items": [ { "currency": "EUR", "unit_amount": 1000, "type": "charge" } ], } invoice_collection = client.create_pending_purchase(purchase) print("Created ChargeInvoice with UUID %s" % invoice_collection.charge_invoice.uuid) except recurly.errors.ValidationError as e: # If the request was invalid, you may want to tell your user # why. You can find the invalid params and reasons in e.error.params print("ValidationError: %s" % e.error.message) print(e.error.params) - lang: ".NET" source: | try { var purchaseReq = new PurchaseCreate() { Currency = "EUR", Account = new AccountPurchase() { Code = accountCode, Email = "[email protected]", BillingInfo = new BillingInfoCreate() { FirstName = "Benjamin", LastName = "Du Monde", OnlineBankingPaymentType = OnlineBankingPaymentType.Ideal } }, LineItems = new List<LineItemCreate>() { new LineItemCreate() { Currency = "EUR", UnitAmount = 1000, Type = LineItemType.Charge } } }; InvoiceCollection collection = client.CreatePendingPurchase(purchaseReq); Console.WriteLine($"Created ChargeInvoice with UUID: {collection.ChargeInvoice.Uuid}"); } catch (Recurly.Errors.Validation ex) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in ex.Error.Params Console.WriteLine($"Failed validation: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin purchase = { currency: 'EUR', account: { code: account_code, email: '[email protected]', billing_info: { first_name: 'Benjamin', last_name: 'Du Monde', online_banking_payment_type: 'ideal' }, }, line_items: [ { currency: 'EUR', unit_amount: 1000, type: 'charge' } ] } invoice_collection = @client.create_pending_purchase(body: purchase) puts "Created ChargeInvoice with UUID: #{invoice_collection.charge_invoice.uuid}" rescue Recurly::Errors::ValidationError => e # If the request was invalid, you may want to tell your user # why. You can find the invalid params and reasons in e.recurly_error.params puts "ValidationError: #{e.recurly_error.params}" end - lang: Java source: | try { AccountPurchase account = new AccountPurchase(); account.setCode(accountCode); account.setEmail("[email protected]"); BillingInfoCreate billingInfo = new BillingInfoCreate(); billingInfo.setFirstName("Benjamin"); billingInfo.setLastName("Du Monde"); billingInfo.setOnlineBankingPaymentType(Constants.OnlineBankingPaymentType.IDEAL); account.setBillingInfo(billingInfo); List<LineItemCreate> lineItems = new ArrayList<LineItemCreate>(); LineItemCreate lineItem = new LineItemCreate(); lineItem.setCurrency("EUR"); lineItem.setUnitAmount(new BigDecimal("1000.0")); lineItem.setType(Constants.LineItemType.CHARGE); lineItems.add(lineItem); PurchaseCreate purchase = new PurchaseCreate(); purchase.setCurrency("EUR"); purchase.setAccount(account); purchase.setLineItems(lineItems); InvoiceCollection collection = client.createPendingPurchase(purchase); System.out.println("Created ChargeInvoice with UUID: " + collection.getChargeInvoice().getUuid()); } catch (ValidationException e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in e.getError().getParams() System.out.println("Failed validation: " + e.getError().getMessage()); System.out.println("Params: " + e.getError().getParams()); } catch (TransactionException e) { TransactionError tError = e.getError().getTransactionError(); if (tError.getCategory() == Constants.ErrorCategory.THREE_D_SECURE_ACTION_REQUIRED) { String actionTokenId = tError.getThreeDSecureActionTokenId(); System.out.println("Got 3DSecure TransactionError token: " + actionTokenId); } } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $purchase_create = [ "currency" => "EUR", "account" => [ "code" => $account_code, "email" => "[email protected]", "billing_info" => [ "first_name" => "Benjamin", "last_name" => "Du Monde", "online_banking_payment_type" => "ideal" ], ], "line_items" => [ [ "currency" => "EUR", "unit_amount" => 1000, "type" => "charge", ] ] ]; $invoice_collection = $client->createPendingPurchase($purchase_create); echo 'Created ChargeInvoice with UUID' . $invoice_collection->getChargeInvoice()->getUuid() . PHP_EOL; } catch (\Recurly\Errors\Validation $e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params var_dump($e); } catch (\Recurly\RecurlyError $e) { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it var_dump($e); } - lang: Go source: "purchaseReq := &recurly.PurchaseCreate{\n\tCurrency: recurly.String(\"EUR\"),\n\tAccount: &recurly.AccountPurchase{\n\t\tCode: recurly.String(accountCode),\n\t\tEmail: recurly.String(\"[email protected]\"),\n\t\tBillingInfo: &recurly.BillingInfoCreate{\n\t\t\tFirstName: \ recurly.String(\"Benjamin\"),\n\t\t\tLastName: recurly.String(\"Du Monde\"),\n\t\t\tOnlineBankingPaymentType: recurly.String(\"ideal\"),\n\t\t},\n\t},\n\tLineItems: []recurly.LineItemCreate{\n\t\t{\n\t\t\tCurrency: recurly.String(\"EUR\"),\n\t\t\tUnitAmount: recurly.Float(1000),\n\t\t\tType: recurly.String(\"charge\"),\n\t\t},\n\t},\n}\ncollection, err := client.CreatePendingPurchase(purchaseReq)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeValidation {\n\t\tfmt.Printf(\"Failed validation: %v\", e)\n\t\treturn nil, err\n\t}\n\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\n\nfmt.Printf(\"Created ChargeInvoice with UUID: %s.\\n\", collection.ChargeInvoice.Uuid)\n" + "/purchases/authorize": + post: + tags: + - purchase + operationId: create_authorize_purchase + summary: Authorize a purchase + description: |- + A purchase is a hybrid checkout containing at least one or more subscriptions or one-time charges (adjustments) and supports both coupon and gift card redemptions. All items purchased will be on one invoice and paid for with one transaction. A purchase is only a request data type and is not persistent in Recurly and an invoice collection will be the returned type. + + The authorize endpoint will create a pending purchase that can be activated at a later time once payment has been completed on an external source. + + For additional information regarding shipping fees, please see https://docs.recurly.com/docs/shipping + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/PurchaseCreate" + required: true + responses: + '200': + description: Returns the authorize invoice + content: + application/json: + schema: + "$ref": "#/components/schemas/InvoiceCollection" + '400': + description: Bad request; perhaps missing or invalid parameters. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '422': + description: authorize purchase cannot be completed for the specified reason. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] + "/purchases/{transaction_id}/capture": + post: + tags: + - purchase + parameters: + - "$ref": "#/components/parameters/transaction_id" + operationId: create_capture_purchase + summary: Capture a purchase + description: |- + A purchase is a hybrid checkout containing at least one or more + subscriptions or one-time charges (adjustments) and supports both coupon + and gift card redemptions. All items purchased will be on one invoice + and paid for with one transaction. A purchase is only a request data + type and is not persistent in Recurly and an invoice collection will be + the returned type. + + + Capture an open Authorization request + responses: + '200': + description: Returns the captured invoice + content: + application/json: + schema: + "$ref": "#/components/schemas/InvoiceCollection" + '400': + description: Bad request; perhaps missing or invalid parameters. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '422': + description: Capture purchase cannot be completed for the specified reason. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] + "/purchases/{transaction_id}/cancel/": + parameters: + - "$ref": "#/components/parameters/transaction_id" + post: + summary: Cancel Purchase + description: | + A purchase is a hybrid checkout containing at least one or more subscriptions or one-time charges (adjustments) and supports both coupon and gift card redemptions. All items purchased will be on one invoice and paid for with one transaction. A purchase is only a request data type and is not persistent in Recurly and an invoice collection will be the returned type. + + Cancel an open Authorization request + tags: + - purchase + operationId: cancelPurchase + responses: + '200': + description: Returns the cancelled invoice + content: + application/json: + schema: + "$ref": "#/components/schemas/InvoiceCollection" + '400': + description: Bad request; perhaps missing or invalid parameters. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '422': + description: Cancel purchase cannot be completed for the specified reason. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] "/export_dates": get: tags: - automated_exports operationId: get_export_dates summary: List the dates that have an available export to download. description: Returns a list of dates for which export files are available for download. responses: '200': description: Returns a list of dates. content: application/json: schema: "$ref": "#/components/schemas/ExportDates" '400': description: Invalid or unpermitted parameter. content: application/json: schema: "$ref": "#/components/schemas/Error" '404': description: Incorrect site ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const export_dates = await client.getExportDates() export_dates.dates.forEach(date => { console.log(`Exports are available for: ${date}`) }) } catch (err) { if (err instanceof recurly.ApiError) { console.log('Unexpected error', err) } } - lang: Python source: | try: export_dates = client.get_export_dates() for date in export_dates.dates: print( "Exports are available for: %s" % date) except recurly.errors.NotFoundError: # If the resource was not found, you may want to alert the user or # just return nil print("Resource Not Found") - lang: ".NET" source: | try { ExportDates exportDates = client.GetExportDates(); foreach (var date in exportDates.Dates) { System.Console.WriteLine($"Exports are available for: {date}"); } } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin export_dates = @client.get_export_dates() export_dates.dates.each do |date| puts "Exports are available for: #{date}" end rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end - lang: Java source: | try { ExportDates exportDates = client.getExportDates(); for (String date : exportDates.getDates()) { System.out.println("Exports are available for: " + date); } } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $export_dates = $client->getExportDates(); foreach($export_dates->getDates() as $date) { echo "Exports are available for: {$date}" . PHP_EOL; } } catch (\Recurly\RecurlyError $e) { echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL; } - lang: Go source: "exportDates, err := client.GetExportDates()\nif e, ok := err.(*recurly.Error); ok {\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\n\nfor _, date := range exportDates.Dates {\n\tfmt.Println(\"Exports are available for: \", date)\n}" "/export_dates/{export_date}/export_files": parameters: - "$ref": "#/components/parameters/export_date" get: tags: - automated_exports operationId: get_export_files summary: List of the export files that are available to download. description: Returns a list of presigned URLs to download export files for the given date, with their MD5 sums. responses: '200': description: Returns a list of export files to download. content: application/json: schema: "$ref": "#/components/schemas/ExportFiles" '400': description: Invalid or unpermitted parameter. content: application/json: schema: "$ref": "#/components/schemas/Error" '404': description: Incorrect site ID or date. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const export_files = await client.getExportFiles(export_date) export_files.files.forEach(file => { console.log(`Export file download URL: ${file.href}`) }) } catch (err) { if (err instanceof recurly.ApiError) { console.log('Unexpected error', err) } } - lang: Python source: | try: export_files = client.get_export_files(export_date) for file in export_files.files: print( "Export file download URL: %s" % file.href) except recurly.errors.NotFoundError: # If the resource was not found, you may want to alert the user or # just return nil print("Resource Not Found") - lang: ".NET" source: | try { ExportFiles exportFiles = client.GetExportFiles(exportDate: exportDate); foreach (var file in exportFiles.Files) { System.Console.WriteLine($"Export file download URL: {file.Href}"); } } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin export_files = @client.get_export_files(export_date: export_date) export_files.files.each do |file| puts "Export file download URL: #{file.href}" end rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end - lang: Java source: | try { ExportFiles exportFiles = client.getExportFiles(exportDate); for (ExportFile file : exportFiles.getFiles()) { System.out.println("Export file download URL: " + file.getHref()); } } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError()); } - lang: PHP source: | try { $export_files = $client->getExportFiles($export_date); foreach($export_files->getFiles() as $file) { echo "Export file download URL: {$file->getHref()}" . PHP_EOL; } } catch (\Recurly\RecurlyError $e) { echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL; } - lang: Go source: "exportFiles, err := client.GetExportFiles(exportDate)\nif e, ok := err.(*recurly.Error); ok {\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\n\nfor _, file := range exportFiles.Files {\n\tfmt.Println(\"Export file download URL: \", file.Href)\n}" "/dunning_campaigns": get: tags: - dunning_campaigns operationId: list_dunning_campaigns summary: List the dunning campaigns for a site description: See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: - "$ref": "#/components/parameters/sort_dates" responses: '200': description: A list of the the dunning_campaigns on an account. content: application/json: schema: "$ref": "#/components/schemas/DunningCampaignList" '404': description: Incorrect site. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/dunning_campaigns/{dunning_campaign_id}": parameters: - "$ref": "#/components/parameters/dunning_campaign_id" get: tags: - dunning_campaigns operationId: get_dunning_campaign summary: Fetch a dunning campaign responses: '200': description: Settings for a dunning campaign. content: application/json: schema: "$ref": "#/components/schemas/DunningCampaign" '400': description: Bad request; perhaps missing or invalid parameters. content: application/json: schema: "$ref": "#/components/schemas/Error" '404': description: Incorrect site or campaign ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/dunning_campaigns/{dunning_campaign_id}/bulk_update": parameters: - "$ref": "#/components/parameters/dunning_campaign_id" put: tags: - dunning_campaigns operationId: put_dunning_campaign_bulk_update summary: Assign a dunning campaign to multiple plans requestBody: content: application/json: schema: "$ref": "#/components/schemas/DunningCampaignsBulkUpdate" responses: '200': description: A list of updated plans. content: application/json: schema: "$ref": "#/components/schemas/DunningCampaignsBulkUpdateResponse" '400': description: Bad request; perhaps missing or invalid parameters. content: application/json: schema: "$ref": "#/components/schemas/Error" '404': description: Incorrect site or campaign ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/invoice_templates": get: tags: - invoice_templates operationId: list_invoice_templates summary: Show the invoice templates for a site description: See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: - "$ref": "#/components/parameters/sort_dates" responses: '200': description: A list of the the invoice templates on a site. content: application/json: schema: "$ref": "#/components/schemas/InvoiceTemplateList" '404': description: Incorrect site. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/invoice_templates/{invoice_template_id}": parameters: - "$ref": "#/components/parameters/invoice_template_id" get: tags: - invoice_templates operationId: get_invoice_template summary: Fetch an invoice template responses: '200': description: Settings for an invoice template. content: application/json: schema: "$ref": "#/components/schemas/InvoiceTemplate" '400': description: Bad request; perhaps missing or invalid parameters. content: application/json: schema: "$ref": "#/components/schemas/Error" '404': description: Incorrect site or invoice template ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/external_invoices": get: tags: - external_invoices operationId: list_external_invoices summary: List the external invoices on a site description: See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: - "$ref": "#/components/parameters/sort_dates" - "$ref": "#/components/parameters/limit" - "$ref": "#/components/parameters/order" responses: '200': description: A list of the the external_invoices on a site. content: application/json: schema: "$ref": "#/components/schemas/ExternalInvoiceList" '404': description: Incorrect site. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/external_invoices/{external_invoice_id}": parameters: - "$ref": "#/components/parameters/external_invoice_id" get: tags: - external_invoices operationId: show_external_invoice summary: Fetch an external invoice responses: '201': description: Returns the external invoice content: application/json: schema: "$ref": "#/components/schemas/ExternalInvoice" '400': description: Bad request; perhaps missing or invalid parameters. content: application/json: schema: "$ref": "#/components/schemas/Error" '404': description: External invoice cannot be found for the specified reason. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/external_subscriptions/{external_subscription_id}/external_payment_phases": parameters: - "$ref": "#/components/parameters/external_subscription_id" get: tags: - external_subscriptions operationId: list_external_subscription_external_payment_phases summary: List the external payment phases on an external subscription description: See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: - "$ref": "#/components/parameters/sort_dates" - "$ref": "#/components/parameters/limit" - "$ref": "#/components/parameters/order" responses: '200': description: A list of the the external_payment_phases on a site. content: application/json: schema: "$ref": "#/components/schemas/ExternalPaymentPhaseList" '404': description: Incorrect site. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] "/external_subscriptions/{external_subscription_id}/external_payment_phases/{external_payment_phase_id}": parameters: - "$ref": "#/components/parameters/external_subscription_id" - "$ref": "#/components/parameters/external_payment_phase_id" get: tags: - external_payment_phases operationId: get_external_subscription_external_payment_phase summary: Fetch an external payment_phase responses: '200': description: Details for an external payment_phase. content: application/json: schema: "$ref": "#/components/schemas/ExternalPaymentPhase" '404': description: Incorrect site or external subscription ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: @@ -24669,1026 +24795,1024 @@ components: title: Purchase unit amount type: number format: float description: The amount of the gift card, which is the amount of the charge to the gifter account and the amount of credit that is applied to the recipient account upon successful redemption. currency: title: Currency type: string description: 3-letter ISO 4217 currency code. maxLength: 3 delivery: title: Delivery details description: The delivery details for the gift card. readOnly: true "$ref": "#/components/schemas/GiftCardDeliveryCreate" gifter_account: title: Gifter account details description: Block of account details for the gifter. This references an existing account_code. readOnly: true "$ref": "#/components/schemas/AccountPurchase" required: - product_code - unit_amount - currency - delivery - gifter_account GiftCardDeliveryCreate: type: object description: Gift card delivery details properties: method: title: Delivery method description: Whether the delivery method is email or postal service. "$ref": "#/components/schemas/DeliveryMethodEnum" email_address: title: Recipient email address type: string description: The email address of the recipient. Required if `method` is `email`. deliver_at: type: string format: date-time title: Deliver at readOnly: true description: When the gift card should be delivered to the recipient. If null, the gift card will be delivered immediately. If a datetime is provided, the delivery will be in an hourly window, rounding down. For example, 6:23 pm will be in the 6:00 pm hourly batch. first_name: title: Recipient first name type: string description: The first name of the recipient. last_name: title: Recipient last name type: string description: The last name of the recipient. recipient_address: title: Recipient address description: Address information for the recipient. Required if `method` is `post`. "$ref": "#/components/schemas/Address" gifter_name: title: Gifter name type: string description: The name of the gifter for the purpose of a message displayed to the recipient. personal_message: title: Personal message type: string maxLength: 255 description: The personal message from the gifter to the recipient. required: - method GiftCardDelivery: type: object description: Gift card delivery details properties: method: title: Delivery method description: Whether the delivery method is email or postal service. "$ref": "#/components/schemas/DeliveryMethodEnum" email_address: title: Recipient email address type: string description: The email address of the recipient. deliver_at: type: string format: date-time title: Deliver at readOnly: true description: When the gift card should be delivered to the recipient. If null, the gift card will be delivered immediately. If a datetime is provided, the delivery will be in an hourly window, rounding down. For example, 6:23 pm will be in the 6:00 pm hourly batch. first_name: title: Recipient first name type: string description: The first name of the recipient. last_name: title: Recipient last name type: string description: The last name of the recipient. recipient_address: title: Recipient address description: Address information for the recipient. "$ref": "#/components/schemas/Address" gifter_name: title: Gifter name type: string description: The name of the gifter for the purpose of a message displayed to the recipient. personal_message: title: Personal message type: string maxLength: 255 description: The personal message from the gifter to the recipient. GiftCardRedeem: type: object description: The information necessary to redeem a gift card. properties: recipient_account: title: Recipient account description: The account for the recipient of the gift card. "$ref": "#/components/schemas/AccountReference" required: - recipient_account Error: type: object properties: type: title: Type "$ref": "#/components/schemas/ErrorTypeEnum" message: type: string title: Message params: type: array title: Parameter specific errors items: type: object properties: param: type: string ErrorMayHaveTransaction: allOf: - "$ref": "#/components/schemas/Error" - type: object properties: transaction_error: type: object x-class-name: TransactionError title: Transaction error details description: This is only included on errors with `type=transaction`. properties: object: type: string title: Object type transaction_id: type: string title: Transaction ID maxLength: 13 category: title: Category "$ref": "#/components/schemas/ErrorCategoryEnum" code: title: Code "$ref": "#/components/schemas/ErrorCodeEnum" decline_code: title: Decline code "$ref": "#/components/schemas/DeclineCodeEnum" message: type: string title: Customer message merchant_advice: type: string title: Merchant message three_d_secure_action_token_id: type: string title: 3-D Secure action token id description: Returned when 3-D Secure authentication is required for a transaction. Pass this value to Recurly.js so it can continue the challenge flow. maxLength: 22 fraud_info: "$ref": "#/components/schemas/TransactionFraudInfo" RelatedTypeEnum: type: string enum: - account - item - plan - subscription - charge RefundTypeEnum: type: string enum: - full - none - partial AlphanumericSortEnum: type: string enum: - asc - desc UsageSortEnum: type: string default: usage_timestamp enum: - recorded_timestamp - usage_timestamp UsageTypeEnum: type: string enum: - price - percentage title: Usage Type description: Type of usage, returns usage type if `add_on_type` is `usage`. UsageCalculationTypeEnum: type: string description: The type of calculation to be employed for an add-on. Cumulative billing will sum all usage records created in the current billing cycle. Last-in-period billing will apply only the most recent usage record in the billing period. If no value is specified, cumulative billing will be used. enum: - cumulative - last_in_period BillingStatusEnum: type: string default: unbilled enum: - unbilled - billed - all TimestampSortEnum: type: string enum: - created_at - updated_at ActiveStateEnum: type: string enum: - active - inactive FilterSubscriptionStateEnum: type: string enum: - active - canceled - expired - future - in_trial - live FilterLimitedSubscriptionStateEnum: type: string enum: - active - canceled - expired - future TrueEnum: type: string enum: - true LineItemStateEnum: type: string enum: - invoiced - pending LineItemTypeEnum: type: string enum: - charge - credit FilterTransactionTypeEnum: type: string enum: - authorization - capture - payment - purchase - refund - verify FilterInvoiceTypeEnum: type: string enum: - charge - credit - legacy - non-legacy ChannelEnum: type: string enum: - advertising - blog - direct_traffic - email - events - marketing_content - organic_search - other - outbound_sales - paid_search - public_relations - referral - social_media PreferredLocaleEnum: type: string enum: - da-DK - de-CH - de-DE - en-AU - en-CA - en-GB - en-IE - en-NZ - en-US - es-ES - es-MX - es-US - fi-FI - fr-BE - fr-CA - fr-CH - fr-FR - hi-IN - it-IT - ja-JP - ko-KR - nl-BE - nl-NL - pl-PL - pt-BR - pt-PT - ro-RO - ru-RU - sk-SK - sv-SE - tr-TR - zh-CN BillToEnum: type: string enum: - parent - self DeliveryMethodEnum: type: string enum: - email - post GatewayTransactionTypeEnum: type: string enum: - moto KountDecisionEnum: type: string enum: - approve - decline - escalate - review CouponStateEnum: type: string enum: - expired - maxed_out - redeemable CouponDurationEnum: type: string enum: - forever - single_use - temporal TemporalUnitEnum: type: string enum: - day - month - week - year FreeTrialUnitEnum: type: string enum: - day - month - week RedemptionResourceEnum: type: string enum: - account - subscription CouponTypeEnum: type: string enum: - bulk - single_code DiscountTypeEnum: type: string enum: - fixed - free_trial - percent AddOnSourceEnum: type: string title: Add-on source description: | Used to determine where the associated add-on data is pulled from. If this value is set to `plan_add_on` or left blank, then add-on data will be pulled from the plan's add-ons. If the associated `plan` has `allow_any_item_on_subscriptions` set to `true` and this field is set to `item`, then the associated add-on data will be pulled from the site's item catalog. default: plan_add_on enum: - plan_add_on - item AddOnTypeEnum: type: string enum: - fixed - usage title: Add-on Type description: Whether the add-on type is fixed, or usage-based. AddOnTypeCreateEnum: type: string enum: - fixed - usage title: Add-on Type description: Whether the add-on type is fixed, or usage-based. default: fixed UsageTypeCreateEnum: type: string enum: - price - percentage title: Usage Type description: | Type of usage, required if `add_on_type` is `usage`. See our [Guide](https://recurly.com/developers/guides/usage-based-billing-guide.html) for an overview of how to configure usage add-ons. TierTypeEnum: type: string title: Tier type description: | The pricing model for the add-on. For more information, [click here](https://docs.recurly.com/docs/billing-models#section-quantity-based). See our [Guide](https://recurly.com/developers/guides/item-addon-guide.html) for an overview of how to configure quantity-based pricing models. default: flat enum: - flat - tiered - stairstep - volume UsageTimeframeEnum: type: string title: Usage Timeframe description: The time at which usage totals are reset for billing purposes. enum: - billing_period - subscription_term default: billing_period UsageTimeframeCreateEnum: type: string title: Usage Timeframe description: | The time at which usage totals are reset for billing purposes. Allows for `tiered` add-ons to accumulate usage over the course of multiple billing periods. enum: - billing_period - subscription_term default: billing_period CreditPaymentActionEnum: type: string enum: - payment - reduction - refund - write_off UserAccessEnum: type: string enum: - api_only - read_only - write - set_only PricingModelTypeEnum: type: string enum: - fixed - ramp default: fixed description: | A fixed pricing model has the same price for each billing period. A ramp pricing model defines a set of Ramp Intervals, where a subscription changes price on a specified cadence of billing periods. The price change could be an increase or decrease. RevenueScheduleTypeEnum: type: string enum: - at_range_end - at_range_start - evenly - never NetTermsTypeEnum: type: string title: Net Terms Type description: | Optionally supplied string that may be either `net` or `eom` (end-of-month). When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date. When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month. - - This field is only available when the EOM Net Terms feature is enabled. enum: - net - eom default: net InvoiceTypeEnum: type: string enum: - charge - credit - legacy OriginEnum: type: string enum: - carryforward_credit - carryforward_gift_credit - credit - external_refund - gift_card - immediate_change - import - line_item_refund - open_amount_refund - prepayment - purchase - refund - renewal - termination - usage_correction - write_off InvoiceStateEnum: type: string default: all enum: - open - pending - processing - past_due - paid - closed - failed - voided InvoiceStateQueryParamEnum: type: string default: all enum: - pending - past_due - paid - failed CollectionMethodEnum: type: string enum: - automatic - manual InvoiceRefundTypeEnum: type: string enum: - amount - line_items RefuneMethodEnum: type: string enum: - all_credit - all_transaction - credit_first - transaction_first ExternalPaymentMethodEnum: type: string enum: - bacs - ach - amazon - apple_pay - check - credit_card - eft - google_pay - money_order - other - paypal - roku - sepadirectdebit - wire_transfer LineItemRevenueScheduleTypeEnum: type: string enum: - at_invoice - at_range_end - at_range_start - evenly - never LegacyCategoryEnum: type: string enum: - applied_credit - carryforward - charge - credit LineItemOriginEnum: type: string enum: - add_on - add_on_trial - carryforward - coupon - credit - debit - one_time - plan - plan_trial - setup_fee - prepayment FullCreditReasonCodeEnum: type: string enum: - general - gift_card - promotional - refund - service - write_off PartialCreditReasonCodeEnum: type: string enum: - general - promotional - service LineItemCreateOriginEnum: type: string enum: - external_gift_card - prepayment IntervalUnitEnum: type: string enum: - days - months AddressRequirementEnum: type: string enum: - full - none - streetzip - zip SiteModeEnum: type: string enum: - development - production - sandbox FeaturesEnum: type: string enum: - credit_memos - manual_invoicing - only_bill_what_changed - subscription_terms SubscriptionStateEnum: type: string enum: - active - canceled - expired - failed - future - paused TimeframeEnum: type: string enum: - bill_date - term_end ChangeTimeframeEnum: type: string enum: - bill_date - now - renewal - term_end TransactionTypeEnum: type: string enum: - authorization - capture - purchase - refund - verify TransactionOriginEnum: type: string enum: - api - chargeback - external_recovery - force_collect - hpp - merchant - recurly_admin - recurlyjs - recurring - refunded_externally - transparent TransactionStatusEnum: type: string enum: - chargeback - declined - error - pending - processing - scheduled - success - void CvvCheckEnum: type: string enum: - D - I - M - N - P - S - U - X AvsCheckEnum: type: string enum: - A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z CouponCodeStateEnum: type: string enum: - expired - inactive - maxed_out - redeemable PaymentMethodEnum: type: string enum: - bacs - amazon - amazon_billing_agreement - apple_pay - bank_account_info - check - credit_card - eft - gateway_token - google_pay - iban_bank_account - money_order - other - paypal - paypal_billing_agreement - roku - sepadirectdebit - venmo - wire_transfer - braintree_v_zero - boleto CardTypeEnum: type: string enum: - American Express - Dankort - Diners Club - Discover - ELO - Forbrugsforeningen - Hipercard - JCB - Laser - Maestro - MasterCard - Test Card - Union Pay - Unknown - Visa - Tarjeta Naranja CardNetworkEnum: type: string enum: - Bancontact - CartesBancaires - Dankort - MasterCard - Visa AccountTypeEnum: type: string enum: - checking - savings ErrorTypeEnum: type: string enum: - bad_request - immutable_subscription - internal_server_error - invalid_api_key - invalid_api_version - invalid_content_type - invalid_permissions - invalid_token - missing_feature - not_found - rate_limited - service_not_available - simultaneous_request - tax_service_error - transaction - unauthorized - unavailable_in_api_version - unknown_api_version - validation ErrorCategoryEnum: type: string enum: - three_d_secure_required - three_d_secure_action_required - amazon - api_error - approved - communication - configuration - duplicate - fraud - hard - invalid - not_enabled - not_supported - recurly - referral - skles - soft - unknown ErrorCodeEnum: type: string enum: - ach_cancel - ach_chargeback - ach_credit_return - ach_exception - ach_return - ach_transactions_not_supported - ach_validation_exception - amazon_amount_exceeded - amazon_declined_review - amazon_invalid_authorization_status - amazon_invalid_close_attempt - amazon_invalid_create_order_reference - amazon_invalid_order_status - amazon_not_authorized - amazon_order_not_modifiable - amazon_transaction_count_exceeded - api_error - approved - approved_fraud_review - authorization_already_captured - authorization_amount_depleted - authorization_expired - batch_processing_error - billing_agreement_already_accepted - billing_agreement_not_accepted - billing_agreement_not_found - billing_agreement_replaced - call_issuer - call_issuer_update_cardholder_data - cancelled - cannot_refund_unsettled_transactions - card_not_activated - card_type_not_accepted - cardholder_requested_stop - contact_gateway - contract_not_found - currency_not_supported - customer_canceled_transaction - cvv_required - declined - declined_card_number - declined_exception - declined_expiration_date - declined_missing_data - declined_saveable - declined_security_code - deposit_referenced_chargeback - direct_debit_type_not_accepted - duplicate_transaction - exceeds_daily_limit - exceeds_max_amount - expired_card - finbot_disconnect - finbot_unavailable - fraud_address - fraud_address_recurly - fraud_advanced_verification - fraud_gateway - fraud_generic - fraud_ip_address - fraud_manual_decision - fraud_risk_check - fraud_security_code - fraud_stolen_card - fraud_too_many_attempts - fraud_velocity - gateway_account_setup_incomplete - gateway_error - gateway_rate_limited - gateway_timeout - gateway_token_not_found - gateway_unavailable - gateway_validation_exception - insufficient_funds - invalid_account_number - invalid_amount - invalid_billing_agreement_status - invalid_card_number - invalid_data - invalid_email - invalid_gateway_access_token - invalid_gateway_configuration - invalid_issuer - invalid_login - invalid_merchant_type - invalid_name - invalid_payment_method - invalid_payment_method_hard - invalid_transaction - issuer_unavailable - lifecycle_decline - merch_max_transaction_limit_exceeded - moneybot_disconnect - moneybot_unavailable - no_billing_information - no_gateway - no_gateway_found_for_transaction_amount - partial_approval - partial_credits_not_supported - payer_authentication_rejected - payment_cannot_void_authorization - payment_not_accepted - paypal_account_issue - paypal_cannot_pay_self - paypal_declined_use_alternate - paypal_expired_reference_id - paypal_hard_decline - paypal_invalid_billing_agreement - paypal_primary_declined - processor_not_available - processor_unavailable - recurly_credentials_not_found - recurly_error - recurly_failed_to_get_token - recurly_token_mismatch - recurly_token_not_found - reference_transactions_not_enabled - restricted_card - restricted_card_chargeback - rjs_token_expired - roku_invalid_card_number - roku_invalid_cib - roku_invalid_payment_method - roku_zip_code_mismatch - simultaneous - ssl_error - temporary_hold - three_d_secure_action_required - three_d_secure_action_result_token_mismatch - three_d_secure_authentication - three_d_secure_connection_error - three_d_secure_credential_error - three_d_secure_not_supported - too_busy - too_many_attempts - total_credit_exceeds_capture - transaction_already_refunded - transaction_already_voided - transaction_cannot_be_authorized - transaction_cannot_be_refunded - transaction_cannot_be_refunded_currently - transaction_cannot_be_voided - transaction_failed_to_settle - transaction_not_found - transaction_service_v2_disconnect - transaction_service_v2_unavailable - transaction_settled - transaction_stale_at_gateway - try_again - unknown - unmapped_partner_error - vaultly_service_unavailable
recurly/recurly-client-php
7b694b12aa542cbfc317c35d906af41a71006cf5
4.47.0
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index e175143..a0084e6 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 4.46.0 +current_version = 4.47.0 parse = (?P<major>\d+) \.(?P<minor>\d+) \.(?P<patch>\d+) serialize = {major}.{minor}.{patch} [bumpversion:file:composer.json] [bumpversion:file:lib/recurly/version.php] diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a406be..b14a8fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,514 +1,525 @@ # Changelog +## [4.47.0](https://github.com/recurly/recurly-client-php/tree/4.47.0) (2024-03-19) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.46.0...4.47.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 [#803](https://github.com/recurly/recurly-client-php/pull/803) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.46.0](https://github.com/recurly/recurly-client-php/tree/4.46.0) (2024-02-20) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.45.0...4.46.0) **Merged Pull Requests** - Add invoice state param for v2021-02-25 [#799](https://github.com/recurly/recurly-client-php/pull/799) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.45.0](https://github.com/recurly/recurly-client-php/tree/4.45.0) (2024-01-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.44.0...4.45.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#789](https://github.com/recurly/recurly-client-php/pull/789) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.44.0](https://github.com/recurly/recurly-client-php/tree/4.44.0) (2024-01-18) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.43.0...4.44.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#788](https://github.com/recurly/recurly-client-php/pull/788) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.43.0](https://github.com/recurly/recurly-client-php/tree/4.43.0) (2023-12-06) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.42.0...4.43.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Payment Phases) [#785](https://github.com/recurly/recurly-client-php/pull/785) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.42.0](https://github.com/recurly/recurly-client-php/tree/4.42.0) (2023-11-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.41.0...4.42.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#783](https://github.com/recurly/recurly-client-php/pull/783) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.41.0](https://github.com/recurly/recurly-client-php/tree/4.41.0) (2023-08-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.40.0...4.41.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (`VATNumber`, `LifecycleDecline`) [#782](https://github.com/recurly/recurly-client-php/pull/782) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.40.0](https://github.com/recurly/recurly-client-php/tree/4.40.0) (2023-08-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.39.0...4.40.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (action_result) [#781](https://github.com/recurly/recurly-client-php/pull/781) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.39.0](https://github.com/recurly/recurly-client-php/tree/4.39.0) (2023-07-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.37.0...4.39.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Ramp Dates, Net Terms, Invoice Business Entity) [#779](https://github.com/recurly/recurly-client-php/pull/779) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (App Management - External Subscriptions) [#777](https://github.com/recurly/recurly-client-php/pull/777) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.37.0](https://github.com/recurly/recurly-client-php/tree/4.37.0) (2023-06-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.36.0...4.37.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Multiple Business Entities) [#769](https://github.com/recurly/recurly-client-php/pull/769) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.36.0](https://github.com/recurly/recurly-client-php/tree/4.36.0) (2023-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.35.0...4.36.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Products & References) [#766](https://github.com/recurly/recurly-client-php/pull/766) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.35.0](https://github.com/recurly/recurly-client-php/tree/4.35.0) (2023-05-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.34.0...4.35.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (gateway_attributes on PaymentMethod) [#764](https://github.com/recurly/recurly-client-php/pull/764) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#747](https://github.com/recurly/recurly-client-php/pull/747) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.28.0](https://github.com/recurly/recurly-client-php/tree/4.28.0) (2023-02-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.27.0...4.28.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (GiftCard endpoints and new transaction error support) [#745](https://github.com/recurly/recurly-client-php/pull/745) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.27.0](https://github.com/recurly/recurly-client-php/tree/4.27.0) (2023-01-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.26.0...4.27.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Custom Fields on Line Items) [#738](https://github.com/recurly/recurly-client-php/pull/738) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.26.0](https://github.com/recurly/recurly-client-php/tree/4.26.0) (2023-01-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.25.0...4.26.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Account Preferred Time Zone) [#736](https://github.com/recurly/recurly-client-php/pull/736) ([douglasmiller](https://github.com/douglasmiller)) ## [4.25.0](https://github.com/recurly/recurly-client-php/tree/4.25.0) (2022-11-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.24.0...4.25.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Apply Credit Balance feature) [#732](https://github.com/recurly/recurly-client-php/pull/732) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.24.0](https://github.com/recurly/recurly-client-php/tree/4.24.0) (2022-11-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.23.0...4.24.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Subscriptions feature) [#729](https://github.com/recurly/recurly-client-php/pull/729) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#728](https://github.com/recurly/recurly-client-php/pull/728) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.23.0](https://github.com/recurly/recurly-client-php/tree/4.23.0) (2022-10-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.22.0...4.23.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entitlements feature) [#725](https://github.com/recurly/recurly-client-php/pull/725) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.22.0](https://github.com/recurly/recurly-client-php/tree/4.22.0) (2022-10-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.2...4.22.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25(Decimal Usage and Quantities and DunningEvent new fields) [#722](https://github.com/recurly/recurly-client-php/pull/722) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.2](https://github.com/recurly/recurly-client-php/tree/4.21.2) (2022-09-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.1...4.21.2) **Merged Pull Requests** - feat: allow for psr/log ^2/3 [#716](https://github.com/recurly/recurly-client-php/pull/716) ([trickeyone](https://github.com/trickeyone)) ## [4.21.1](https://github.com/recurly/recurly-client-php/tree/4.21.1) (2022-09-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.0...4.21.1) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#714](https://github.com/recurly/recurly-client-php/pull/714) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.0](https://github.com/recurly/recurly-client-php/tree/4.21.0) (2022-09-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.20.0...4.21.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#713](https://github.com/recurly/recurly-client-php/pull/713) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixes bug with putDunningCampaignBulkUpdate [#706](https://github.com/recurly/recurly-client-php/pull/706) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.20.0](https://github.com/recurly/recurly-client-php/tree/4.20.0) (2022-08-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.19.0...4.20.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#701](https://github.com/recurly/recurly-client-php/pull/701) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.19.0](https://github.com/recurly/recurly-client-php/tree/4.19.0) (2022-07-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.18.0...4.19.0) **Merged Pull Requests** - Fixing deprecation warnings in client [#697](https://github.com/recurly/recurly-client-php/pull/697) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#695](https://github.com/recurly/recurly-client-php/pull/695) ([recurly-integrations](https://github.com/recurly-integrations)) **Closed Issues** - Recurly\Pager and \Iterator return type mismatch (PHP 8.1 deprecation) [#677](https://github.com/recurly/recurly-client-php/issues/677) ## [4.18.0](https://github.com/recurly/recurly-client-php/tree/4.18.0) (2022-06-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.17.0...4.18.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#693](https://github.com/recurly/recurly-client-php/pull/693) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.17.0](https://github.com/recurly/recurly-client-php/tree/4.17.0) (2022-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.16.0...4.17.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#679](https://github.com/recurly/recurly-client-php/pull/679) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.16.0](https://github.com/recurly/recurly-client-php/tree/4.16.0) (2022-03-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.15.0...4.16.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#676](https://github.com/recurly/recurly-client-php/pull/676) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.15.0](https://github.com/recurly/recurly-client-php/tree/4.15.0) (2022-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.14.0...4.15.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#668](https://github.com/recurly/recurly-client-php/pull/668) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.14.0](https://github.com/recurly/recurly-client-php/tree/4.14.0) (2022-03-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.13.0...4.14.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#664](https://github.com/recurly/recurly-client-php/pull/664) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.13.0](https://github.com/recurly/recurly-client-php/tree/4.13.0) (2022-01-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.12.0...4.13.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#655](https://github.com/recurly/recurly-client-php/pull/655) ([recurly-integrations](https://github.com/recurly-integrations)) - Add region argument to client to connect in EU data center [#653](https://github.com/recurly/recurly-client-php/pull/653) ([FabricioCoutinho](https://github.com/FabricioCoutinho)) ## [4.12.0](https://github.com/recurly/recurly-client-php/tree/4.12.0) (2022-01-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.11.0...4.12.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Invoice Customization) [#654](https://github.com/recurly/recurly-client-php/pull/654) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#651](https://github.com/recurly/recurly-client-php/pull/651) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.11.0](https://github.com/recurly/recurly-client-php/tree/4.11.0) (2021-12-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.10.0...4.11.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Tax Inclusive Pricing) [#650](https://github.com/recurly/recurly-client-php/pull/650) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.10.0](https://github.com/recurly/recurly-client-php/tree/4.10.0) (2021-11-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.9.0...4.10.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#647](https://github.com/recurly/recurly-client-php/pull/647) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#645](https://github.com/recurly/recurly-client-php/pull/645) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#644](https://github.com/recurly/recurly-client-php/pull/644) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#639](https://github.com/recurly/recurly-client-php/pull/639) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.9.0](https://github.com/recurly/recurly-client-php/tree/4.9.0) (2021-09-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.8.0...4.9.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Support to new subscription fields and response) [#633](https://github.com/recurly/recurly-client-php/pull/633) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.8.0](https://github.com/recurly/recurly-client-php/tree/4.8.0) (2021-09-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.7.0...4.8.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Dunning Campaigns feature) [#632](https://github.com/recurly/recurly-client-php/pull/632) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.7.0](https://github.com/recurly/recurly-client-php/tree/4.7.0) (2021-08-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.6.0...4.7.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (get_preview_renewal) [#630](https://github.com/recurly/recurly-client-php/pull/630) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.6.0](https://github.com/recurly/recurly-client-php/tree/4.6.0) (2021-08-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.5.0...4.6.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#628](https://github.com/recurly/recurly-client-php/pull/628) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.5.0](https://github.com/recurly/recurly-client-php/tree/4.5.0) (2021-08-02) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.4.0...4.5.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#623](https://github.com/recurly/recurly-client-php/pull/623) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixing issue with http_build_query converting booleans in params to integers [#621](https://github.com/recurly/recurly-client-php/pull/621) ([ZloeSabo](https://github.com/ZloeSabo)) ## [4.4.0](https://github.com/recurly/recurly-client-php/tree/4.4.0) (2021-06-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.3.0...4.4.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#613](https://github.com/recurly/recurly-client-php/pull/613) ([recurly-integrations](https://github.com/recurly-integrations)) - Add PHP 8.0 to travis matrix [#592](https://github.com/recurly/recurly-client-php/pull/592) ([douglasmiller](https://github.com/douglasmiller)) ## [4.3.0](https://github.com/recurly/recurly-client-php/tree/4.3.0) (2021-06-04) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.2.0...4.3.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#612](https://github.com/recurly/recurly-client-php/pull/612) ([recurly-integrations](https://github.com/recurly-integrations)) - Adding psr/log requirement to composer.json [#611](https://github.com/recurly/recurly-client-php/pull/611) ([douglasmiller](https://github.com/douglasmiller)) ## [4.2.0](https://github.com/recurly/recurly-client-php/tree/4.2.0) (2021-04-21) diff --git a/composer.json b/composer.json index afcec1c..cdfed69 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,38 @@ { "name": "recurly/recurly-client", - "version": "4.46.0", + "version": "4.47.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], "homepage": "https://github.com/recurly/recurly-client-php", "license": "MIT", "authors": [], "require": { "php": ">= 7.2.0", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "phpcompatibility/php-compatibility": "^9.3", "phpdocumentor/phpdocumentor": "~3.0.0", "phpstan/phpstan": "^0.12.11", "phpunit/phpunit": "^8", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "classmap": ["lib"], "files": ["lib/recurly.php"] }, "autoload-dev": { "classmap": ["tests"] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/lib/recurly/version.php b/lib/recurly/version.php index 773bda6..859e559 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -1,8 +1,8 @@ <?php namespace Recurly; class Version { - public const CURRENT = '4.46.0'; + public const CURRENT = '4.47.0'; }
recurly/recurly-client-php
9ae12ec9332c1ee33c96ca70cd47333cadc49f3f
Generated Latest Changes for v2021-02-25
diff --git a/lib/recurly/resources/external_subscription.php b/lib/recurly/resources/external_subscription.php index 8cff6da..3dee09e 100644 --- a/lib/recurly/resources/external_subscription.php +++ b/lib/recurly/resources/external_subscription.php @@ -1,451 +1,475 @@ <?php /** * This file is automatically created by Recurly's OpenAPI generation process * and thus any edits you make by hand will be lost. If you wish to make a * change to this file, please create a Github issue explaining the changes you * need and we will usher them to the appropriate places. */ namespace Recurly\Resources; use Recurly\RecurlyResource; // phpcs:disable class ExternalSubscription extends RecurlyResource { private $_account; private $_activated_at; private $_app_identifier; private $_auto_renew; private $_canceled_at; private $_created_at; private $_expires_at; private $_external_id; private $_external_product_reference; private $_id; private $_in_grace_period; private $_last_purchased; private $_object; private $_quantity; private $_state; + private $_test; private $_trial_ends_at; private $_trial_started_at; private $_updated_at; protected static $array_hints = [ ]; /** * Getter method for the account attribute. * Account mini details * * @return ?\Recurly\Resources\AccountMini */ public function getAccount(): ?\Recurly\Resources\AccountMini { return $this->_account; } /** * Setter method for the account attribute. * * @param \Recurly\Resources\AccountMini $account * * @return void */ public function setAccount(\Recurly\Resources\AccountMini $account): void { $this->_account = $account; } /** * Getter method for the activated_at attribute. * When the external subscription was activated in the external platform. * * @return ?string */ public function getActivatedAt(): ?string { return $this->_activated_at; } /** * Setter method for the activated_at attribute. * * @param string $activated_at * * @return void */ public function setActivatedAt(string $activated_at): void { $this->_activated_at = $activated_at; } /** * Getter method for the app_identifier attribute. * Identifier of the app that generated the external subscription. * * @return ?string */ public function getAppIdentifier(): ?string { return $this->_app_identifier; } /** * Setter method for the app_identifier attribute. * * @param string $app_identifier * * @return void */ public function setAppIdentifier(string $app_identifier): void { $this->_app_identifier = $app_identifier; } /** * Getter method for the auto_renew attribute. * An indication of whether or not the external subscription will auto-renew at the expiration date. * * @return ?bool */ public function getAutoRenew(): ?bool { return $this->_auto_renew; } /** * Setter method for the auto_renew attribute. * * @param bool $auto_renew * * @return void */ public function setAutoRenew(bool $auto_renew): void { $this->_auto_renew = $auto_renew; } /** * Getter method for the canceled_at attribute. * When the external subscription was canceled in the external platform. * * @return ?string */ public function getCanceledAt(): ?string { return $this->_canceled_at; } /** * Setter method for the canceled_at attribute. * * @param string $canceled_at * * @return void */ public function setCanceledAt(string $canceled_at): void { $this->_canceled_at = $canceled_at; } /** * Getter method for the created_at attribute. * When the external subscription was created in Recurly. * * @return ?string */ public function getCreatedAt(): ?string { return $this->_created_at; } /** * Setter method for the created_at attribute. * * @param string $created_at * * @return void */ public function setCreatedAt(string $created_at): void { $this->_created_at = $created_at; } /** * Getter method for the expires_at attribute. * When the external subscription expires in the external platform. * * @return ?string */ public function getExpiresAt(): ?string { return $this->_expires_at; } /** * Setter method for the expires_at attribute. * * @param string $expires_at * * @return void */ public function setExpiresAt(string $expires_at): void { $this->_expires_at = $expires_at; } /** * Getter method for the external_id attribute. * The id of the subscription in the external systems., I.e. Apple App Store or Google Play Store. * * @return ?string */ public function getExternalId(): ?string { return $this->_external_id; } /** * Setter method for the external_id attribute. * * @param string $external_id * * @return void */ public function setExternalId(string $external_id): void { $this->_external_id = $external_id; } /** * Getter method for the external_product_reference attribute. * External Product Reference details * * @return ?\Recurly\Resources\ExternalProductReferenceMini */ public function getExternalProductReference(): ?\Recurly\Resources\ExternalProductReferenceMini { return $this->_external_product_reference; } /** * Setter method for the external_product_reference attribute. * * @param \Recurly\Resources\ExternalProductReferenceMini $external_product_reference * * @return void */ public function setExternalProductReference(\Recurly\Resources\ExternalProductReferenceMini $external_product_reference): void { $this->_external_product_reference = $external_product_reference; } /** * Getter method for the id attribute. * System-generated unique identifier for an external subscription ID, e.g. `e28zov4fw0v2`. * * @return ?string */ public function getId(): ?string { return $this->_id; } /** * Setter method for the id attribute. * * @param string $id * * @return void */ public function setId(string $id): void { $this->_id = $id; } /** * Getter method for the in_grace_period attribute. * An indication of whether or not the external subscription is in a grace period. * * @return ?bool */ public function getInGracePeriod(): ?bool { return $this->_in_grace_period; } /** * Setter method for the in_grace_period attribute. * * @param bool $in_grace_period * * @return void */ public function setInGracePeriod(bool $in_grace_period): void { $this->_in_grace_period = $in_grace_period; } /** * Getter method for the last_purchased attribute. * When a new billing event occurred on the external subscription in conjunction with a recent billing period, reactivation or upgrade/downgrade. * * @return ?string */ public function getLastPurchased(): ?string { return $this->_last_purchased; } /** * Setter method for the last_purchased attribute. * * @param string $last_purchased * * @return void */ public function setLastPurchased(string $last_purchased): void { $this->_last_purchased = $last_purchased; } /** * Getter method for the object attribute. * Object type * * @return ?string */ public function getObject(): ?string { return $this->_object; } /** * Setter method for the object attribute. * * @param string $object * * @return void */ public function setObject(string $object): void { $this->_object = $object; } /** * Getter method for the quantity attribute. * An indication of the quantity of a subscribed item's quantity. * * @return ?int */ public function getQuantity(): ?int { return $this->_quantity; } /** * Setter method for the quantity attribute. * * @param int $quantity * * @return void */ public function setQuantity(int $quantity): void { $this->_quantity = $quantity; } /** * Getter method for the state attribute. * External subscriptions can be active, canceled, expired, or past_due. * * @return ?string */ public function getState(): ?string { return $this->_state; } /** * Setter method for the state attribute. * * @param string $state * * @return void */ public function setState(string $state): void { $this->_state = $state; } + /** + * Getter method for the test attribute. + * An indication of whether or not the external subscription was purchased in a sandbox environment. + * + * @return ?bool + */ + public function getTest(): ?bool + { + return $this->_test; + } + + /** + * Setter method for the test attribute. + * + * @param bool $test + * + * @return void + */ + public function setTest(bool $test): void + { + $this->_test = $test; + } + /** * Getter method for the trial_ends_at attribute. * When the external subscription trial period ends in the external platform. * * @return ?string */ public function getTrialEndsAt(): ?string { return $this->_trial_ends_at; } /** * Setter method for the trial_ends_at attribute. * * @param string $trial_ends_at * * @return void */ public function setTrialEndsAt(string $trial_ends_at): void { $this->_trial_ends_at = $trial_ends_at; } /** * Getter method for the trial_started_at attribute. * When the external subscription trial period started in the external platform. * * @return ?string */ public function getTrialStartedAt(): ?string { return $this->_trial_started_at; } /** * Setter method for the trial_started_at attribute. * * @param string $trial_started_at * * @return void */ public function setTrialStartedAt(string $trial_started_at): void { $this->_trial_started_at = $trial_started_at; } /** * Getter method for the updated_at attribute. * When the external subscription was updated in Recurly. * * @return ?string */ public function getUpdatedAt(): ?string { return $this->_updated_at; } /** * Setter method for the updated_at attribute. * * @param string $updated_at * * @return void */ public function setUpdatedAt(string $updated_at): void { $this->_updated_at = $updated_at; } } \ No newline at end of file diff --git a/lib/recurly/resources/payment_method.php b/lib/recurly/resources/payment_method.php index 3821057..dc20037 100644 --- a/lib/recurly/resources/payment_method.php +++ b/lib/recurly/resources/payment_method.php @@ -1,427 +1,451 @@ <?php /** * This file is automatically created by Recurly's OpenAPI generation process * and thus any edits you make by hand will be lost. If you wish to make a * change to this file, please create a Github issue explaining the changes you * need and we will usher them to the appropriate places. */ namespace Recurly\Resources; use Recurly\RecurlyResource; // phpcs:disable class PaymentMethod extends RecurlyResource { private $_account_type; private $_billing_agreement_id; + private $_card_network_preference; private $_card_type; private $_cc_bin_country; private $_exp_month; private $_exp_year; private $_first_six; private $_gateway_attributes; private $_gateway_code; private $_gateway_token; private $_last_four; private $_last_two; private $_name_on_account; private $_object; private $_routing_number; private $_routing_number_bank; private $_username; protected static $array_hints = [ ]; /** * Getter method for the account_type attribute. * The bank account type. Only present for ACH payment methods. * * @return ?string */ public function getAccountType(): ?string { return $this->_account_type; } /** * Setter method for the account_type attribute. * * @param string $account_type * * @return void */ public function setAccountType(string $account_type): void { $this->_account_type = $account_type; } /** * Getter method for the billing_agreement_id attribute. * Billing Agreement identifier. Only present for Amazon or Paypal payment methods. * * @return ?string */ public function getBillingAgreementId(): ?string { return $this->_billing_agreement_id; } /** * Setter method for the billing_agreement_id attribute. * * @param string $billing_agreement_id * * @return void */ public function setBillingAgreementId(string $billing_agreement_id): void { $this->_billing_agreement_id = $billing_agreement_id; } + /** + * Getter method for the card_network_preference attribute. + * Represents the card network preference associated with the billing info for dual badged cards. Must be a supported card network. + * + * @return ?string + */ + public function getCardNetworkPreference(): ?string + { + return $this->_card_network_preference; + } + + /** + * Setter method for the card_network_preference attribute. + * + * @param string $card_network_preference + * + * @return void + */ + public function setCardNetworkPreference(string $card_network_preference): void + { + $this->_card_network_preference = $card_network_preference; + } + /** * Getter method for the card_type attribute. * Visa, MasterCard, American Express, Discover, JCB, etc. * * @return ?string */ public function getCardType(): ?string { return $this->_card_type; } /** * Setter method for the card_type attribute. * * @param string $card_type * * @return void */ public function setCardType(string $card_type): void { $this->_card_type = $card_type; } /** * Getter method for the cc_bin_country attribute. * The 2-letter ISO 3166-1 alpha-2 country code associated with the credit card BIN, if known by Recurly. Available on the BillingInfo object only. Available when the BIN country lookup feature is enabled. * * @return ?string */ public function getCcBinCountry(): ?string { return $this->_cc_bin_country; } /** * Setter method for the cc_bin_country attribute. * * @param string $cc_bin_country * * @return void */ public function setCcBinCountry(string $cc_bin_country): void { $this->_cc_bin_country = $cc_bin_country; } /** * Getter method for the exp_month attribute. * Expiration month. * * @return ?int */ public function getExpMonth(): ?int { return $this->_exp_month; } /** * Setter method for the exp_month attribute. * * @param int $exp_month * * @return void */ public function setExpMonth(int $exp_month): void { $this->_exp_month = $exp_month; } /** * Getter method for the exp_year attribute. * Expiration year. * * @return ?int */ public function getExpYear(): ?int { return $this->_exp_year; } /** * Setter method for the exp_year attribute. * * @param int $exp_year * * @return void */ public function setExpYear(int $exp_year): void { $this->_exp_year = $exp_year; } /** * Getter method for the first_six attribute. * Credit card number's first six digits. * * @return ?string */ public function getFirstSix(): ?string { return $this->_first_six; } /** * Setter method for the first_six attribute. * * @param string $first_six * * @return void */ public function setFirstSix(string $first_six): void { $this->_first_six = $first_six; } /** * Getter method for the gateway_attributes attribute. * Gateway specific attributes associated with this PaymentMethod * * @return ?\Recurly\Resources\GatewayAttributes */ public function getGatewayAttributes(): ?\Recurly\Resources\GatewayAttributes { return $this->_gateway_attributes; } /** * Setter method for the gateway_attributes attribute. * * @param \Recurly\Resources\GatewayAttributes $gateway_attributes * * @return void */ public function setGatewayAttributes(\Recurly\Resources\GatewayAttributes $gateway_attributes): void { $this->_gateway_attributes = $gateway_attributes; } /** * Getter method for the gateway_code attribute. * An identifier for a specific payment gateway. * * @return ?string */ public function getGatewayCode(): ?string { return $this->_gateway_code; } /** * Setter method for the gateway_code attribute. * * @param string $gateway_code * * @return void */ public function setGatewayCode(string $gateway_code): void { $this->_gateway_code = $gateway_code; } /** * Getter method for the gateway_token attribute. * A token used in place of a credit card in order to perform transactions. * * @return ?string */ public function getGatewayToken(): ?string { return $this->_gateway_token; } /** * Setter method for the gateway_token attribute. * * @param string $gateway_token * * @return void */ public function setGatewayToken(string $gateway_token): void { $this->_gateway_token = $gateway_token; } /** * Getter method for the last_four attribute. * Credit card number's last four digits. Will refer to bank account if payment method is ACH. * * @return ?string */ public function getLastFour(): ?string { return $this->_last_four; } /** * Setter method for the last_four attribute. * * @param string $last_four * * @return void */ public function setLastFour(string $last_four): void { $this->_last_four = $last_four; } /** * Getter method for the last_two attribute. * The IBAN bank account's last two digits. * * @return ?string */ public function getLastTwo(): ?string { return $this->_last_two; } /** * Setter method for the last_two attribute. * * @param string $last_two * * @return void */ public function setLastTwo(string $last_two): void { $this->_last_two = $last_two; } /** * Getter method for the name_on_account attribute. * The name associated with the bank account. * * @return ?string */ public function getNameOnAccount(): ?string { return $this->_name_on_account; } /** * Setter method for the name_on_account attribute. * * @param string $name_on_account * * @return void */ public function setNameOnAccount(string $name_on_account): void { $this->_name_on_account = $name_on_account; } /** * Getter method for the object attribute. * * * @return ?string */ public function getObject(): ?string { return $this->_object; } /** * Setter method for the object attribute. * * @param string $object * * @return void */ public function setObject(string $object): void { $this->_object = $object; } /** * Getter method for the routing_number attribute. * The bank account's routing number. Only present for ACH payment methods. * * @return ?string */ public function getRoutingNumber(): ?string { return $this->_routing_number; } /** * Setter method for the routing_number attribute. * * @param string $routing_number * * @return void */ public function setRoutingNumber(string $routing_number): void { $this->_routing_number = $routing_number; } /** * Getter method for the routing_number_bank attribute. * The bank name of this routing number. * * @return ?string */ public function getRoutingNumberBank(): ?string { return $this->_routing_number_bank; } /** * Setter method for the routing_number_bank attribute. * * @param string $routing_number_bank * * @return void */ public function setRoutingNumberBank(string $routing_number_bank): void { $this->_routing_number_bank = $routing_number_bank; } /** * Getter method for the username attribute. * Username of the associated payment method. Currently only associated with Venmo. * * @return ?string */ public function getUsername(): ?string { return $this->_username; } /** * Setter method for the username attribute. * * @param string $username * * @return void */ public function setUsername(string $username): void { $this->_username = $username; } } \ No newline at end of file diff --git a/openapi/api.yaml b/openapi/api.yaml index 6e8d8d1..ad7a4e4 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -8108,1026 +8108,1024 @@ paths: operationId: list_invoices summary: List a site's invoices description: See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: - "$ref": "#/components/parameters/ids" - "$ref": "#/components/parameters/invoice_state" - "$ref": "#/components/parameters/limit" - "$ref": "#/components/parameters/order" - "$ref": "#/components/parameters/sort_dates" - "$ref": "#/components/parameters/filter_begin_time" - "$ref": "#/components/parameters/filter_end_time" - "$ref": "#/components/parameters/filter_invoice_type" responses: '200': description: A list of the site's invoices. content: application/json: schema: "$ref": "#/components/schemas/InvoiceList" '400': description: Invalid or unpermitted parameter. content: application/json: schema: "$ref": "#/components/schemas/Error" '404': description: Incorrect site ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | const invoices = client.listInvoices({ params: { limit: 200 } }) for await (const invoice of invoices.each()) { console.log(invoice.number) } - lang: Python source: | params = {"limit": 200} invoices = client.list_invoices(params=params).items() for invoice in invoices: print(invoice.number) - lang: ".NET" source: | var optionalParams = new ListInvoicesParams() { Limit = 200 }; var invoices = client.ListInvoices(optionalParams); foreach(Invoice invoice in invoices) { Console.WriteLine(invoice.Number); } - lang: Ruby source: | params = { limit: 200 } invoices = @client.list_invoices(params: params) invoices.each do |invoice| puts "Invoice: #{invoice.number}" end - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<Invoice> invoices = client.listInvoices(params); for (Invoice invoice : invoices) { System.out.println(invoice.getNumber()); } - lang: PHP source: | $options = [ 'params' => [ 'limit' => 200 ] ]; $invoices = $client->listInvoices($options); foreach($invoices as $invoice) { echo 'Invoice: ' . $invoice->getNumber() . PHP_EOL; } - lang: Go source: "listParams := &recurly.ListInvoicesParams{\n\tSort: recurly.String(\"created_at\"),\n\tOrder: recurly.String(\"desc\"),\n\tLimit: recurly.Int(200),\n}\ninvoices, err := client.ListInvoices(listParams)\nif err != nil {\n\tfmt.Println(\"Unexpected error: %v\", err)\n\treturn\n}\n\nfor invoices.HasMore() {\n\terr := invoices.Fetch()\n\tif e, ok := err.(*recurly.Error); ok {\n\t\tfmt.Printf(\"Failed to retrieve next page: %v\", e)\n\t\tbreak\n\t}\n\tfor i, invoice := range invoices.Data() {\n\t\tfmt.Printf(\"Invoice %3d: %s, %s\\n\",\n\t\t\ti,\n\t\t\tinvoice.Id,\n\t\t\tinvoice.Number,\n\t\t)\n\t}\n}" "/invoices/{invoice_id}": get: tags: - invoice operationId: get_invoice summary: Fetch an invoice parameters: - "$ref": "#/components/parameters/invoice_id" responses: '200': description: An invoice. content: application/json: schema: "$ref": "#/components/schemas/Invoice" '404': description: Incorrect site or invoice ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const invoice = await client.getInvoice(invoiceId) console.log('Fetched Invoice: ', invoice.number) } catch (err) { if (err instanceof recurly.errors.NotFoundError) { // If the request was not found, you may want to alert the user or // just return null console.log('Resource Not Found') } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: invoice = client.get_invoice(invoice_id) print("Got Invoice %s" % invoice) except recurly.errors.NotFoundError: # If the resource was not found, you may want to alert the user or # just return nil print("Resource Not Found") - lang: ".NET" source: | try { Invoice invoice = client.GetInvoice(invoiceId); Console.WriteLine($"Fetched invoice #{invoice.Number}"); } catch (Recurly.Errors.NotFound ex) { // If the resource was not found // we may want to alert the user or just return null Console.WriteLine($"Resource Not Found: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin invoice = @client.get_invoice(invoice_id: invoice_id) puts "Got invoice #{invoice}" rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end - lang: Java source: | try { final Invoice invoice = client.getInvoice(invoiceId); System.out.println("Fetched invoice " + invoice.getNumber()); } catch (NotFoundException e) { // If the resource was not found // we may want to alert the user or just return null System.out.println("Resource Not Found: " + e.getError().getMessage()); } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $invoice = $client->getInvoice($invoice_id); echo 'Got Invoice:' . PHP_EOL; var_dump($invoice); } catch (\Recurly\Errors\NotFound $e) { // Could not find the resource, you may want to inform the user // or just return a NULL echo 'Could not find resource.' . PHP_EOL; var_dump($e); } catch (\Recurly\RecurlyError $e) { // Something bad happened... tell the user so that they can fix it? echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL; } - lang: Go source: "invoice, err := client.GetInvoice(invoiceID)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeNotFound {\n\t\tfmt.Printf(\"Resource not found: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\n\nfmt.Printf(\"Fetched Invoice: %v\", invoice)" put: tags: - invoice operationId: update_invoice summary: Update an invoice parameters: - "$ref": "#/components/parameters/invoice_id" requestBody: content: application/json: schema: "$ref": "#/components/schemas/InvoiceUpdate" required: true responses: '200': description: An invoice. content: application/json: schema: "$ref": "#/components/schemas/Invoice" '404': description: Incorrect site or invoice ID. content: application/json: schema: "$ref": "#/components/schemas/Error" '422': description: A validation error content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const invoiceUpdate = { customerNotes: "New notes", termsAndConditions: "New terms and conditions" } const invoice = await client.updateInvoice(invoiceId, invoiceUpdate) console.log('Edited invoice: ', invoice.number) } catch(err) { if (err instanceof recurly.errors.ValidationError) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params console.log('Failed validation', err.params) } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: invoice_update = { "customer_notes": "New Notes", "terms_and_conditions": "New Terms and Conditions", } invoice = client.update_invoice(invoice_id, invoice_update) print("Updated Invoice %s" % invoice.id) except recurly.errors.NotFoundError: # If the resource was not found, you may want to alert the user or # just return nil print("Resource Not Found") - lang: ".NET" source: | try { var invoiceReq = new InvoiceUpdate() { CustomerNotes = "New Notes", TermsAndConditions = "New Terms and Conditions" }; Invoice invoice = client.UpdateInvoice(invoiceId, invoiceReq); Console.WriteLine($"Edited invoice #{invoice.Number}"); } catch (Recurly.Errors.Validation ex) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in ex.Error.Params Console.WriteLine($"Failed validation: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin invoice_update = { customer_notes: "New Notes", terms_and_conditions: "New Terms and Conditions" } invoice = @client.update_invoice(invoice_id: invoice_id, body: invoice_update) puts "Updated invoice #{invoice}" rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end - lang: Java source: | try { final InvoiceUpdate invoiceUpdate = new InvoiceUpdate(); invoiceUpdate.setCustomerNotes("New notes"); invoiceUpdate.setTermsAndConditions("New terms and conditions"); final Invoice invoice = client.updateInvoice(invoiceId, invoiceUpdate); System.out.println("Edited invoice " + invoice.getNumber()); } catch (ValidationException e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in e.getError().getParams() System.out.println("Failed validation: " + e.getError().getMessage()); } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $invoice_update = [ "customer_notes" => "New Notes", "terms_and_conditions" => "New terms and conditions", ]; $invoice = $client->updateInvoice($invoice_id, $invoice_update); echo 'Updated Invoice:' . PHP_EOL; var_dump($invoice); } catch (\Recurly\Errors\Validation $e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params var_dump($e); } catch (\Recurly\RecurlyError $e) { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it var_dump($e); } - lang: Go source: "updateReq := &recurly.InvoiceUpdate{\n\tCustomerNotes: recurly.String(\"New Notes\"),\n\tTermsAndConditions: recurly.String(\"New Terms and Conditions\"),\n}\ninvoice, err := client.UpdateInvoice(invoiceID, updateReq)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeValidation {\n\t\tfmt.Printf(\"Failed validation: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\nfmt.Printf(\"Updated Invoice: %s\", invoice.Id)" "/invoices/{invoice_id}.pdf": get: tags: - invoice operationId: get_invoice_pdf summary: Fetch an invoice as a PDF parameters: - "$ref": "#/components/parameters/invoice_id" responses: '200': description: An invoice as a PDF. content: application/pdf: schema: "$ref": "#/components/schemas/BinaryFile" '404': description: Incorrect site or invoice ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const invoice = await client.getInvoicePdf(invoiceId) console.log('Fetched Invoice: ', invoice) const filename = `${downloadDirectory}/nodeinvoice-${invoiceId}.pdf` await fs.writeFile(filename, invoice.data, 'binary', (err) => { // throws an error, you could also catch it here if (err) throw err; // success case, the file was saved console.log('Saved Invoice PDF to', filename) }) } catch (err) { if (err instanceof recurly.errors.NotFoundError) { // If the request was not found, you may want to alert the user or // just return null console.log('Resource Not Found') } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: invoice = client.get_invoice_pdf(invoice_id) print("Got Invoice %s" % invoice) filename = "%s/pythoninvoice-%s.pdf" % (download_directory, invoice_id) with open(filename, 'wb') as file: file.write(invoice.data) print("Saved Invoice PDF to %s" % filename) except recurly.errors.NotFoundError: # If the resource was not found, you may want to alert the user or # just return nil print("Resource Not Found") - lang: ".NET" source: | try { BinaryFile invoice = client.GetInvoicePdf(invoiceId); string filename = $"{downloadDirectory}/dotnetinvoice-{invoiceId}.pdf"; System.IO.File.WriteAllBytes(filename, invoice.Data); Console.WriteLine($"Saved Invoice PDF to {filename}"); } catch (Recurly.Errors.NotFound ex) { // If the resource was not found // we may want to alert the user or just return null Console.WriteLine($"Resource Not Found: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin invoice = @client.get_invoice_pdf(invoice_id: invoice_id) puts "Got invoice #{invoice}" filename = "#{download_directory}/rubyinvoice-#{invoice_id}.pdf" IO.write(filename, invoice.data) puts "Saved Invoice PDF to #{filename}" rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end - lang: Java source: | try { final BinaryFile invoice = client.getInvoicePdf(invoiceId); //System.out.println("Fetched invoice " + invoice.getData()); String filename = downloadDirectory + "/javainvoice-" + invoiceId + ".pdf"; FileOutputStream fos = new FileOutputStream(filename); fos.write(invoice.getData()); fos.close(); System.out.println("Saved Invoice PDF to " + filename); } catch (NotFoundException e) { // If the resource was not found // we may want to alert the user or just return null System.out.println("Resource Not Found: " + e.getError().getMessage()); } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } catch (java.io.IOException e) { System.out.println("Unexpected File Writing Error: " + e.toString()); } - lang: PHP source: | try { $invoice = $client->getInvoicePdf($invoice_id); echo 'Got Invoice PDF:' . PHP_EOL; var_dump($invoice); $invoice_fp = fopen("php-invoice-" . $invoice_id . ".pdf", "w"); fwrite($invoice_fp, $invoice->getData()); fclose($invoice_fp); } catch (\Recurly\Errors\NotFound $e) { // Could not find the resource, you may want to inform the user // or just return a NULL echo 'Could not find resource.' . PHP_EOL; var_dump($e); } catch (\Recurly\RecurlyError $e) { // Something bad happened... tell the user so that they can fix it? echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL; } "/invoices/{invoice_id}/apply_credit_balance": put: tags: - invoice operationId: apply_credit_balance summary: Apply available credit to a pending or past due charge invoice description: Apply credit payment to the outstanding balance on an existing charge invoice from an account’s available balance from existing credit invoices. - Credit that was refunded from the invoice cannot be applied back to the invoice - as payment. parameters: - "$ref": "#/components/parameters/site_id" - "$ref": "#/components/parameters/invoice_id" responses: '200': description: The updated invoice. content: application/json: schema: "$ref": "#/components/schemas/Invoice" '404': description: Incorrect site or invoice ID. content: application/json: schema: "$ref": "#/components/schemas/Error" '422': description: Tried applying credit to a legacy or closed invoice or there was an error processing the credit payment, such as no available credit on the account. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const invoice = await client.applyCreditBalance(invoiceId) console.log('Applied credit balance to invoice: ', invoice) } catch (err) { if (err instanceof recurly.errors.ValidationError) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params console.log('Failed validation', err.params) } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: invoice = client.apply_credit_balance(invoice_id) print("Applied credit balance to invoice %s" % invoice.id) except recurly.errors.NotFoundError: # If the resource was not found, you may want to alert the user or # just return nil print("Resource Not Found") - lang: ".NET" source: | try { Invoice invoice = client.ApplyCreditBalance(invoiceId); Console.WriteLine($"Applied credit balance to invoice #{invoice.Number}"); } catch (Recurly.Errors.Validation ex) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in ex.Error.Params Console.WriteLine($"Failed validation: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin invoice = @client.apply_credit_balance(invoice_id: invoice_id) puts "Applied credit balance to invoice #{invoice}" rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end - lang: Java source: | try { final Invoice invoice = client.applyCreditBalance(invoiceId); System.out.println("Applied credit balance to invoice " + invoice.getId()); } catch (final ValidationException e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in e.getError().getParams() System.out.println("Failed validation: " + e.getError().getMessage()); } catch (final ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $invoice = $client->applyCreditBalance($invoice_id); echo 'Applied credit balance to invoice:' . PHP_EOL; var_dump($invoice); } catch (\Recurly\Errors\Validation $e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params var_dump($e); } catch (\Recurly\RecurlyError $e) { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it var_dump($e); } - lang: Go source: "invoice, err := client.ApplyCreditBalance(invoiceID)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeValidation {\n\t\tfmt.Printf(\"Failed validation: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\n\nfmt.Printf(\"Applied credit balance to invoice: %v\", invoice)" "/invoices/{invoice_id}/collect": put: tags: - invoice operationId: collect_invoice summary: Collect a pending or past due, automatic invoice description: Force a collection attempt using the stored billing information. This will trigger a transaction outside of Recurly's normal retry logic. parameters: - "$ref": "#/components/parameters/invoice_id" requestBody: content: application/json: schema: "$ref": "#/components/schemas/InvoiceCollect" required: false responses: '200': description: The updated invoice. content: application/json: schema: "$ref": "#/components/schemas/Invoice" '404': description: Incorrect site or invoice ID. content: application/json: schema: "$ref": "#/components/schemas/Error" '422': description: Tried collecting a manual or closed invoice, or there was an error processing the transaction. content: application/json: schema: "$ref": "#/components/schemas/ErrorMayHaveTransaction" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const invoice = await client.collectInvoice(invoiceId) console.log('Collected invoice: ', invoice.number) } catch (err) { if (err instanceof recurly.errors.ValidationError) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params console.log('Failed validation', err.params) } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: invoice = client.collect_invoice(invoice_id) print("Collected Invoice %s" % invoice) except recurly.errors.NotFoundError as e: print("Invoice not found") - lang: ".NET" source: | try { Invoice invoice = client.CollectInvoice(invoiceId); Console.WriteLine($"Collected invoice #{invoice.Number}"); } catch (Recurly.Errors.Validation ex) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in ex.Error.Params Console.WriteLine($"Failed validation: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin invoice = @client.collect_invoice(invoice_id: invoice_id) puts "Collected invoice #{invoice}" rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end - lang: Java source: | try { final Invoice invoice = client.collectInvoice(invoiceId); System.out.println("Collected invoice: " + invoice.getNumber()); } catch (ValidationException e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in e.getError().getParams() System.out.println("Failed validation: " + e.getError().getMessage()); } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $invoice = $client->collectInvoice($invoice_id); echo 'Collected Invoice:' . PHP_EOL; var_dump($invoice); } catch (\Recurly\Errors\Validation $e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params var_dump($e); } catch (\Recurly\RecurlyError $e) { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it var_dump($e); } - lang: Go source: "collectInvoiceParams := &recurly.CollectInvoiceParams{\n\tBody: &recurly.InvoiceCollect{\n\t\tTransactionType: recurly.String(\"moto\"),\n\t},\n}\n\ncollectedInvoice, err := client.CollectInvoice(invoiceID, collectInvoiceParams)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeValidation {\n\t\tfmt.Printf(\"Failed validation: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\nfmt.Printf(\"Collected Invoice: %v\", collectedInvoice)" "/invoices/{invoice_id}/mark_failed": put: tags: - invoice operationId: mark_invoice_failed summary: Mark an open invoice as failed description: | Indicates that the invoice was not successfully paid for and that collection attempts should stop. This functionality is mostly used to halt the dunning procedures for an invoice. Only invoices with the `pending`, `processing` or `past_due` states can be marked as failed. parameters: - "$ref": "#/components/parameters/invoice_id" responses: '200': description: The updated invoice. content: application/json: schema: "$ref": "#/components/schemas/Invoice" '404': description: Incorrect site or invoice ID. content: application/json: schema: "$ref": "#/components/schemas/Error" '422': description: Tried marking a closed (successful or failed) invoice as failed. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const invoice = await client.markInvoiceFailed(invoiceId) console.log('Failed invoice: ', invoice.number) } catch (err) { if (err instanceof recurly.errors.ValidationError) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params console.log('Failed validation', err.params) } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: invoice = client.mark_invoice_failed(invoice_id) print("Failed Invoice %s" % invoice.id) except recurly.errors.NotFoundError: # If the resource was not found, you may want to alert the user or # just return nil print("Resource Not Found") - lang: ".NET" source: | try { Invoice invoice = client.MarkInvoiceFailed(invoiceId); Console.WriteLine($"Failed invoice #{invoice.Number}"); } catch (Recurly.Errors.Validation ex) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in ex.Error.Params Console.WriteLine($"Failed validation: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin invoice = @client.mark_invoice_failed(invoice_id: invoice_id) puts "Failed invoice #{invoice}" rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end - lang: Java source: | try { final Invoice invoice = client.markInvoiceFailed(invoiceId); System.out.println("Failed invoice: " + invoice.getNumber()); } catch (ValidationException e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in e.getError().getParams() System.out.println("Failed validation: " + e.getError().getMessage()); } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $invoice = $client->markInvoiceFailed($invoice_id); echo 'Failed Invoice:' . PHP_EOL; var_dump($invoice); } catch (\Recurly\Errors\NotFound $e) { // Could not find the resource, you may want to inform the user // or just return a NULL echo 'Could not find resource.' . PHP_EOL; var_dump($e); } catch (\Recurly\RecurlyError $e) { // Something bad happened... tell the user so that they can fix it? echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL; } - lang: Go source: "invoice, err := client.MarkInvoiceFailed(invoiceID)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeValidation {\n\t\tfmt.Printf(\"Failed validation: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\nfmt.Printf(\"Invoice failed: %v\", invoice)" "/invoices/{invoice_id}/mark_successful": put: tags: - invoice operationId: mark_invoice_successful summary: Mark an open invoice as successful description: | Indicates that the invoice was successfully paid for and that automated collection attempts should stop - this functionality is typically used to indicate that payment was received via another method and that revenue should be recognized. Only invoices with the `pending`, `processing`, `past_due` or `failed` states can be marked as paid. parameters: - "$ref": "#/components/parameters/invoice_id" responses: '200': description: The updated invoice. content: application/json: schema: "$ref": "#/components/schemas/Invoice" '404': description: Incorrect site or invoice ID. content: application/json: schema: "$ref": "#/components/schemas/Error" '422': description: Tried marking a closed (successful or failed) invoice as successful. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const invoice = await client.markInvoiceSuccessful(invoiceId) console.log(`Marked invoice #${invoice.number} successful`) } catch(err) { if (err instanceof recurly.errors.ValidationError) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params console.log('Failed validation', err.params) } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: params = {"limit": 200} invoice = client.mark_invoice_successful(invoice_id, params=params) print("Marked Invoice successful %s" % invoice) except recurly.errors.ValidationError as e: # If the request was invalid, you may want to tell your user # why. You can find the invalid params and reasons in e.error.params print("ValidationError: %s" % e.error.message) print(e.error.params) - lang: ".NET" source: | try { Invoice invoice = client.MarkInvoiceSuccessful(invoiceId); Console.WriteLine($"Marked invoice #{invoice.Number} successful"); } catch (Recurly.Errors.Validation ex) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in ex.Error.Params Console.WriteLine($"Failed validation: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin invoice = @client.mark_invoice_successful(invoice_id: invoice_id) puts "Marked invoice sucessful #{invoice}" rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end - lang: Java source: | try { final Invoice invoice = client.markInvoiceSuccessful(invoiceId); System.out.println("Marked invoice " + invoice.getNumber() + " successful"); } catch (ValidationException e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in e.getError().getParams() System.out.println("Failed validation: " + e.getError().getMessage()); } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $invoice = $client->markInvoiceSuccessful($invoice_id); echo 'Marked Invoice Successful:' . PHP_EOL; var_dump($invoice); } catch (\Recurly\Errors\NotFound $e) { // Could not find the resource, you may want to inform the user // or just return a NULL echo 'Could not find resource.' . PHP_EOL; var_dump($e); } catch (\Recurly\RecurlyError $e) { // Something bad happened... tell the user so that they can fix it? echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL; } - lang: Go source: "invoice, err := client.MarkInvoiceSuccessful(invoiceID)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeValidation {\n\t\tfmt.Printf(\"Failed validation: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\n\nfmt.Printf(\"Marked Invoice Successful: %v\", invoice)" "/invoices/{invoice_id}/reopen": put: tags: - invoice operationId: reopen_invoice summary: Reopen a closed, manual invoice parameters: - "$ref": "#/components/parameters/invoice_id" @@ -17880,1024 +17878,1028 @@ components: measured_unit_id: type: string title: Measured Unit ID description: System-generated unique identifier for a measured unit to be associated with the add-on. Either `measured_unit_id` or `measured_unit_name` are required when `add_on_type` is `usage`. If `measured_unit_id` and `measured_unit_name` are both present, `measured_unit_id` will be used. maxLength: 13 measured_unit_name: type: string title: Measured Unit Name description: Name of a measured unit to be associated with the add-on. Either `measured_unit_id` or `measured_unit_name` are required when `add_on_type` is `usage`. If `measured_unit_id` and `measured_unit_name` are both present, `measured_unit_id` will be used. plan_id: type: string title: Plan ID maxLength: 13 readOnly: true accounting_code: type: string title: Accounting code description: Accounting code for invoice line items for this add-on. If no value is provided, it defaults to add-on's code. If `item_code`/`item_id` is part of the request then `accounting_code` must be absent. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 revenue_schedule_type: title: Revenue schedule type description: When this add-on is invoiced, the line item will use this revenue schedule. If `item_code`/`item_id` is part of the request then `revenue_schedule_type` must be absent in the request as the value will be set from the item. "$ref": "#/components/schemas/RevenueScheduleTypeEnum" display_quantity: type: boolean title: Display quantity? description: Determines if the quantity field is displayed on the hosted pages for the add-on. default: false default_quantity: type: integer title: Default quantity description: Default quantity for the hosted pages. default: 1 optional: type: boolean title: Optional description: Whether the add-on is optional for the customer to include in their purchase on the hosted payment page. If false, the add-on will be included when a subscription is created through the Recurly UI. However, the add-on will not be included when a subscription is created through the API. avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `AddOn`, then the `avalara_transaction_type` must be absent. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `AddOn`, then the `avalara_service_type` must be absent. minimum: 0 tax_code: type: string title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's EU VAT tax feature to determine taxation rules. If you have your own AvaTax or Vertex account configured, use their tax codes to assign specific tax rules. If you are using Recurly's EU VAT feature, you can use values of `unknown`, `physical`, or `digital`. If `item_code`/`item_id` is part of the request then `tax_code` must be absent. maxLength: 50 currencies: type: array title: Add-on pricing items: "$ref": "#/components/schemas/AddOnPricing" minItems: 1 description: | * If `item_code`/`item_id` is part of the request and the item has a default currency then `currencies` is optional. If the item does not have a default currency, then `currencies` is required. If `item_code`/`item_id` is not present `currencies` is required. * If the add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `currencies` must be absent. * Must be absent if `add_on_type` is `usage` and `usage_type` is `percentage`. tier_type: "$ref": "#/components/schemas/TierTypeEnum" usage_timeframe: "$ref": "#/components/schemas/UsageTimeframeCreateEnum" tiers: type: array title: Tiers items: "$ref": "#/components/schemas/Tier" description: | If the tier_type is `flat`, then `tiers` must be absent. The `tiers` object must include one to many tiers with `ending_quantity` and `unit_amount` for the desired `currencies`. There must be one tier without an `ending_quantity` value which represents the final tier. percentage_tiers: type: array title: Percentage Tiers By Currency items: "$ref": "#/components/schemas/PercentageTiersByCurrency" description: | Array of objects which must have at least one set of tiers per currency and the currency code. The tier_type must be `volume` or `tiered`, if not, it must be absent. There must be one tier without an `ending_amount` value which represents the final tier. This feature is currently in development and requires approval and enablement, please contact support. required: - code - name AddOnUpdate: type: object title: Add-on description: Full add-on details. properties: id: type: string title: Add-on ID maxLength: 13 readOnly: true code: type: string title: Add-on code description: The unique identifier for the add-on within its plan. If an `Item` is associated to the `AddOn` then `code` must be absent. maxLength: 50 name: type: string title: Name description: Describes your add-on and will appear in subscribers' invoices. If an `Item` is associated to the `AddOn` then `name` must be absent. maxLength: 255 usage_percentage: type: number format: float title: Usage Percentage description: The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. Required if `add_on_type` is usage, `tier_type` is `flat` and `usage_type` is percentage. Must be omitted otherwise. usage_calculation_type: "$ref": "#/components/schemas/UsageCalculationTypeEnum" measured_unit_id: type: string title: Measured Unit ID description: System-generated unique identifier for a measured unit to be associated with the add-on. Either `measured_unit_id` or `measured_unit_name` are required when `add_on_type` is `usage`. If `measured_unit_id` and `measured_unit_name` are both present, `measured_unit_id` will be used. maxLength: 13 measured_unit_name: type: string title: Measured Unit Name description: Name of a measured unit to be associated with the add-on. Either `measured_unit_id` or `measured_unit_name` are required when `add_on_type` is `usage`. If `measured_unit_id` and `measured_unit_name` are both present, `measured_unit_id` will be used. accounting_code: type: string title: Accounting code description: Accounting code for invoice line items for this add-on. If no value is provided, it defaults to add-on's code. If an `Item` is associated to the `AddOn` then `accounting code` must be absent. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 revenue_schedule_type: title: Revenue schedule type description: When this add-on is invoiced, the line item will use this revenue schedule. If `item_code`/`item_id` is part of the request then `revenue_schedule_type` must be absent in the request as the value will be set from the item. "$ref": "#/components/schemas/RevenueScheduleTypeEnum" avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `AddOn`, then the `avalara_transaction_type` must be absent. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the add-on is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. If an `Item` is associated to the `AddOn`, then the `avalara_service_type` must be absent. minimum: 0 tax_code: type: string title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's EU VAT tax feature to determine taxation rules. If you have your own AvaTax or Vertex account configured, use their tax codes to assign specific tax rules. If you are using Recurly's EU VAT feature, you can use values of `unknown`, `physical`, or `digital`. If an `Item` is associated to the `AddOn` then `tax code` must be absent. maxLength: 50 display_quantity: type: boolean title: Display quantity? description: Determines if the quantity field is displayed on the hosted pages for the add-on. default: false default_quantity: type: integer title: Default quantity description: Default quantity for the hosted pages. default: 1 optional: type: boolean title: Optional description: Whether the add-on is optional for the customer to include in their purchase on the hosted payment page. If false, the add-on will be included when a subscription is created through the Recurly UI. However, the add-on will not be included when a subscription is created through the API. currencies: type: array title: Add-on pricing items: "$ref": "#/components/schemas/AddOnPricing" minItems: 1 description: | If the add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then currencies must be absent. Must also be absent if `add_on_type` is `usage` and `usage_type` is `percentage`. tiers: type: array title: Tiers items: "$ref": "#/components/schemas/Tier" description: | If the tier_type is `flat`, then `tiers` must be absent. The `tiers` object must include one to many tiers with `ending_quantity` and `unit_amount` for the desired `currencies`. There must be one tier without an `ending_quantity` value which represents the final tier. percentage_tiers: type: array title: Percentage Tiers By Currency items: "$ref": "#/components/schemas/PercentageTiersByCurrency" description: | `percentage_tiers` is an array of objects, which must have the set of tiers per currency and the currency code. The tier_type must be `volume` or `tiered`, if not, it must be absent. There must be one tier without an `ending_amount` value which represents the final tier. This feature is currently in development and requires approval and enablement, please contact support. BillingInfo: type: object properties: id: type: string maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true account_id: type: string maxLength: 13 readOnly: true first_name: type: string maxLength: 50 last_name: type: string maxLength: 50 company: type: string maxLength: 100 address: "$ref": "#/components/schemas/Address" vat_number: type: string description: Customer's VAT number (to avoid having the VAT applied). This is only used for automatically collected invoices. valid: type: boolean readOnly: true payment_method: "$ref": "#/components/schemas/PaymentMethod" fraud: type: object x-class-name: FraudInfo title: Fraud information description: Most recent fraud result. readOnly: true properties: score: type: integer title: Kount score minimum: 1 maximum: 99 decision: title: Kount decision maxLength: 10 "$ref": "#/components/schemas/KountDecisionEnum" risk_rules_triggered: type: object title: Kount rules primary_payment_method: type: boolean description: The `primary_payment_method` field is used to indicate the primary billing info on the account. The first billing info created on an account will always become primary. This payment method will be used backup_payment_method: type: boolean description: The `backup_payment_method` field is used to indicate a billing info as a backup on the account that will be tried if the initial billing info used for an invoice is declined. created_at: type: string format: date-time description: When the billing information was created. readOnly: true updated_at: type: string format: date-time description: When the billing information was last changed. readOnly: true updated_by: type: object x-class-name: BillingInfoUpdatedBy readOnly: true properties: ip: type: string description: Customer's IP address when updating their billing information. maxLength: 20 country: type: string description: Country, 2-letter ISO 3166-1 alpha-2 code matching the origin IP address, if known by Recurly. maxLength: 2 BillingInfoCreate: type: object properties: token_id: type: string title: Token ID description: A token [generated by Recurly.js](https://recurly.com/developers/reference/recurly-js/#getting-a-token). maxLength: 22 first_name: type: string title: First name maxLength: 50 last_name: type: string title: Last name maxLength: 50 company: type: string title: Company name maxLength: 100 address: "$ref": "#/components/schemas/Address" number: type: string title: Credit card number description: Credit card number, spaces and dashes are accepted. month: type: string title: Expiration month maxLength: 2 year: type: string title: Expiration year maxLength: 4 cvv: type: string title: Security code or CVV description: "*STRONGLY RECOMMENDED*" maxLength: 4 currency: type: string description: 3-letter ISO 4217 currency code. vat_number: type: string title: VAT number ip_address: type: string title: IP address description: "*STRONGLY RECOMMENDED* Customer's IP address when updating their billing information." maxLength: 20 gateway_token: type: string title: A token used in place of a credit card in order to perform transactions. Must be used in conjunction with `gateway_code`. maxLength: 50 gateway_code: type: string title: An identifier for a specific payment gateway. Must be used in conjunction with `gateway_token`. maxLength: 12 gateway_attributes: type: object description: Additional attributes to send to the gateway. x-class-name: GatewayAttributes properties: account_reference: type: string description: Used by Adyen and Braintree gateways. For Adyen the Shopper Reference value used when the external token was created. Must be used in conjunction with gateway_token and gateway_code. For Braintree the PayPal PayerID is populated in the response. maxLength: 264 amazon_billing_agreement_id: type: string title: Amazon billing agreement ID paypal_billing_agreement_id: type: string title: PayPal billing agreement ID roku_billing_agreement_id: type: string title: Roku's CIB if billing through Roku fraud_session_id: type: string title: Fraud Session ID transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" three_d_secure_action_result_token_id: type: string title: 3-D Secure action result token ID description: A token generated by Recurly.js after completing a 3-D Secure device fingerprinting or authentication challenge. maxLength: 22 iban: type: string maxLength: 34 description: The International Bank Account Number, up to 34 alphanumeric characters comprising a country code; two check digits; and a number that includes the domestic bank account number, branch identifier, and potential routing information name_on_account: type: string maxLength: 255 description: The name associated with the bank account (ACH, SEPA, Bacs only) account_number: type: string maxLength: 255 description: The bank account number. (ACH, Bacs only) routing_number: type: string maxLength: 15 description: The bank's rounting number. (ACH only) sort_code: type: string maxLength: 15 description: Bank identifier code for UK based banks. Required for Bacs based billing infos. (Bacs only) type: "$ref": "#/components/schemas/AchTypeEnum" account_type: "$ref": "#/components/schemas/AchAccountTypeEnum" tax_identifier: type: string description: Tax identifier is required if adding a billing info that is a consumer card in Brazil or in Argentina. This would be the customer's CPF/CNPJ (Brazil) and CUIT (Argentina). CPF, CNPJ and CUIT are tax identifiers for all residents who pay taxes in Brazil and Argentina respectively. tax_identifier_type: description: This field and a value of `cpf`, `cnpj` or `cuit` are required if adding a billing info that is an elo or hipercard type in Brazil or in Argentina. "$ref": "#/components/schemas/TaxIdentifierTypeEnum" primary_payment_method: type: boolean title: Primary Payment Method description: The `primary_payment_method` field is used to designate the primary billing info on the account. The first billing info created on an account will always become primary. Adding additional billing infos provides the flexibility to mark another billing info as primary, or adding additional non-primary billing infos. This can be accomplished by passing the `primary_payment_method` with a value of `true`. When adding billing infos via the billing_info and /accounts endpoints, this value is not permitted, and will return an error if provided. backup_payment_method: type: boolean description: The `backup_payment_method` field is used to designate a billing info as a backup on the account that will be tried if the initial billing info used for an invoice is declined. All payment methods, including the billing info marked `primary_payment_method` can be set as a backup. An account can have a maximum of 1 backup, if a user sets a different payment method as a backup, the existing backup will no longer be marked as such. external_hpp_type: "$ref": "#/components/schemas/ExternalHppTypeEnum" online_banking_payment_type: "$ref": "#/components/schemas/OnlineBankingPaymentTypeEnum" deprecated: true card_type: "$ref": "#/components/schemas/CardTypeEnum" + card_network_preference: + description: Represents the card network preference associated with the + billing info for dual badged cards. Must be a supported card network. + "$ref": "#/components/schemas/CardNetworkEnum" BillingInfoVerify: type: object properties: gateway_code: type: string description: An identifier for a specific payment gateway. maxLength: 13 BillingInfoVerifyCVV: type: object properties: verification_value: type: string description: Unique security code for a credit card. Coupon: type: object properties: id: type: string title: Coupon ID readOnly: true object: type: string title: Object type readOnly: true code: type: string title: Coupon code description: The code the customer enters to redeem the coupon. name: type: string title: Name description: The internal name for the coupon. state: title: State description: Indicates if the coupon is redeemable, and if it is not, why. "$ref": "#/components/schemas/CouponStateEnum" max_redemptions: type: integer title: Max redemptions description: A maximum number of redemptions for the coupon. The coupon will expire when it hits its maximum redemptions. max_redemptions_per_account: type: integer title: Max redemptions per account description: Redemptions per account is the number of times a specific account can redeem the coupon. Set redemptions per account to `1` if you want to keep customers from gaming the system and getting more than one discount from the coupon campaign. unique_coupon_codes_count: type: integer title: Unique coupon codes count description: When this number reaches `max_redemptions` the coupon will no longer be redeemable. readOnly: true unique_code_template: type: string title: Unique code template description: On a bulk coupon, the template from which unique coupon codes are generated. unique_coupon_code: allOf: - "$ref": "#/components/schemas/UniqueCouponCode" type: object description: Will be populated when the Coupon being returned is a `UniqueCouponCode`. duration: title: Duration description: | - "single_use" coupons applies to the first invoice only. - "temporal" coupons will apply to invoices for the duration determined by the `temporal_unit` and `temporal_amount` attributes. "$ref": "#/components/schemas/CouponDurationEnum" temporal_amount: type: integer title: Temporal amount description: If `duration` is "temporal" than `temporal_amount` is an integer which is multiplied by `temporal_unit` to define the duration that the coupon will be applied to invoices for. temporal_unit: title: Temporal unit description: If `duration` is "temporal" than `temporal_unit` is multiplied by `temporal_amount` to define the duration that the coupon will be applied to invoices for. "$ref": "#/components/schemas/TemporalUnitEnum" free_trial_unit: title: Free trial unit description: Description of the unit of time the coupon is for. Used with `free_trial_amount` to determine the duration of time the coupon is for. "$ref": "#/components/schemas/FreeTrialUnitEnum" free_trial_amount: type: integer title: Free trial amount description: Sets the duration of time the `free_trial_unit` is for. minimum: 1 maximum: 9999 applies_to_all_plans: type: boolean title: Applies to all plans? description: The coupon is valid for all plans if true. If false then `plans` will list the applicable plans. default: true applies_to_all_items: type: boolean title: Applies to all items? description: | The coupon is valid for all items if true. If false then `items` will list the applicable items. default: false applies_to_non_plan_charges: type: boolean title: Applied to all non-plan charges? description: The coupon is valid for one-time, non-plan charges if true. default: false plans: type: array title: Plans description: A list of plans for which this coupon applies. This will be `null` if `applies_to_all_plans=true`. items: "$ref": "#/components/schemas/PlanMini" items: type: array title: Items description: | A list of items for which this coupon applies. This will be `null` if `applies_to_all_items=true`. items: "$ref": "#/components/schemas/ItemMini" redemption_resource: title: Redemption resource description: Whether the discount is for all eligible charges on the account, or only a specific subscription. default: account "$ref": "#/components/schemas/RedemptionResourceEnum" discount: "$ref": "#/components/schemas/CouponDiscount" coupon_type: title: 'Coupon type (TODO: implement coupon generation)' description: Whether the coupon is "single_code" or "bulk". Bulk coupons will require a `unique_code_template` and will generate unique codes through the `/generate` endpoint. "$ref": "#/components/schemas/CouponTypeEnum" hosted_page_description: type: string title: Hosted Payment Pages description description: This description will show up when a customer redeems a coupon on your Hosted Payment Pages, or if you choose to show the description on your own checkout page. invoice_description: type: string title: Invoice description description: Description of the coupon on the invoice. maxLength: 255 redeem_by: type: string title: Redeem by description: The date and time the coupon will expire and can no longer be redeemed. Time is always 11:59:59, the end-of-day Pacific time. format: date-time created_at: type: string title: Created at format: date-time readOnly: true updated_at: type: string title: Last updated at format: date-time readOnly: true expired_at: type: string title: Expired at description: The date and time the coupon was expired early or reached its `max_redemptions`. format: date-time CouponCreate: allOf: - "$ref": "#/components/schemas/CouponUpdate" - type: object properties: code: type: string title: Coupon code description: The code the customer enters to redeem the coupon. discount_type: title: Discount type description: The type of discount provided by the coupon (how the amount discounted is calculated) "$ref": "#/components/schemas/DiscountTypeEnum" discount_percent: type: integer title: Discount percent description: The percent of the price discounted by the coupon. Required if `discount_type` is `percent`. free_trial_unit: title: Free trial unit description: Description of the unit of time the coupon is for. Used with `free_trial_amount` to determine the duration of time the coupon is for. Required if `discount_type` is `free_trial`. "$ref": "#/components/schemas/FreeTrialUnitEnum" free_trial_amount: type: integer title: Free trial amount description: Sets the duration of time the `free_trial_unit` is for. Required if `discount_type` is `free_trial`. minimum: 1 maximum: 9999 currencies: title: Currencies description: Fixed discount currencies by currency. Required if the coupon type is `fixed`. This parameter should contain the coupon discount values type: array items: "$ref": "#/components/schemas/CouponPricing" applies_to_non_plan_charges: type: boolean title: Applied to all non-plan charges? description: The coupon is valid for one-time, non-plan charges if true. default: false applies_to_all_plans: type: boolean title: Applies to all plans? description: The coupon is valid for all plans if true. If false then `plans` will list the applicable plans. default: true applies_to_all_items: type: boolean title: Applies to all items? description: | To apply coupon to Items in your Catalog, include a list of `item_codes` in the request that the coupon will apply to. Or set value to true to apply to all Items in your Catalog. The following values are not permitted when `applies_to_all_items` is included: `free_trial_amount` and `free_trial_unit`. default: false plan_codes: type: array title: Plan codes description: | List of plan codes to which this coupon applies. Required if `applies_to_all_plans` is false. Overrides `applies_to_all_plans` when `applies_to_all_plans` is true. items: type: string item_codes: type: array title: Item codes description: | List of item codes to which this coupon applies. Sending `item_codes` is only permitted when `applies_to_all_items` is set to false. The following values are not permitted when `item_codes` is included: `free_trial_amount` and `free_trial_unit`. items: type: string duration: title: Duration description: | This field does not apply when the discount_type is `free_trial`. - "single_use" coupons applies to the first invoice only. - "temporal" coupons will apply to invoices for the duration determined by the `temporal_unit` and `temporal_amount` attributes. - "forever" coupons will apply to invoices forever. default: forever "$ref": "#/components/schemas/CouponDurationEnum" temporal_amount: type: integer title: Temporal amount description: If `duration` is "temporal" than `temporal_amount` is an integer which is multiplied by `temporal_unit` to define the duration that the coupon will be applied to invoices for. temporal_unit: title: Temporal unit description: If `duration` is "temporal" than `temporal_unit` is multiplied by `temporal_amount` to define the duration that the coupon will be applied to invoices for. "$ref": "#/components/schemas/TemporalUnitEnum" coupon_type: title: Coupon type description: Whether the coupon is "single_code" or "bulk". Bulk coupons will require a `unique_code_template` and will generate unique codes through the `/generate` endpoint. "$ref": "#/components/schemas/CouponTypeEnum" unique_code_template: type: string title: Unique code template description: | On a bulk coupon, the template from which unique coupon codes are generated. - You must start the template with your coupon_code wrapped in single quotes. - Outside of single quotes, use a 9 for a character that you want to be a random number. - Outside of single quotes, use an "x" for a character that you want to be a random letter. - Outside of single quotes, use an * for a character that you want to be a random number or letter. - Use single quotes ' ' for characters that you want to remain static. These strings can be alphanumeric and may contain a - _ or +. For example: "'abc-'****'-def'" redemption_resource: title: Redemption resource description: Whether the discount is for all eligible charges on the account, or only a specific subscription. default: account "$ref": "#/components/schemas/RedemptionResourceEnum" required: - code - discount_type - name CouponPricing: type: object properties: currency: type: string description: 3-letter ISO 4217 currency code. discount: type: number format: float description: The fixed discount (in dollars) for the corresponding currency. CouponDiscount: type: object description: | Details of the discount a coupon applies. Will contain a `type` property and one of the following properties: `percent`, `fixed`, `trial`. properties: type: "$ref": "#/components/schemas/DiscountTypeEnum" percent: description: This is only present when `type=percent`. type: integer currencies: type: array description: This is only present when `type=fixed`. items: "$ref": "#/components/schemas/CouponDiscountPricing" trial: type: object x-class-name: CouponDiscountTrial description: This is only present when `type=free_trial`. properties: unit: title: Trial unit description: Temporal unit of the free trial "$ref": "#/components/schemas/FreeTrialUnitEnum" length: type: integer title: Trial length description: Trial length measured in the units specified by the sibling `unit` property CouponDiscountPricing: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 amount: type: number format: float title: Discount Amount description: Value of the fixed discount that this coupon applies. CouponBulkCreate: type: object properties: number_of_unique_codes: type: integer title: Number of unique codes description: The quantity of unique coupon codes to generate minimum: 1 maximum: 200 CouponMini: type: object properties: id: type: string title: Coupon ID readOnly: true object: type: string title: Object type readOnly: true code: type: string title: Coupon code description: The code the customer enters to redeem the coupon. name: type: string title: Name description: The internal name for the coupon. state: title: State description: Indicates if the coupon is redeemable, and if it is not, why. "$ref": "#/components/schemas/CouponStateEnum" discount: "$ref": "#/components/schemas/CouponDiscount" coupon_type: title: 'Coupon type (TODO: implement coupon generation)' description: Whether the coupon is "single_code" or "bulk". Bulk coupons will require a `unique_code_template` and will generate unique codes through the `/generate` endpoint. "$ref": "#/components/schemas/CouponTypeEnum" expired_at: type: string title: Expired at description: The date and time the coupon was expired early or reached its `max_redemptions`. format: date-time CouponRedemption: type: object properties: id: type: string title: Coupon Redemption ID readOnly: true object: type: string title: Object type description: Will always be `coupon`. readOnly: true account: type: object title: Account description: The Account on which the coupon was applied. readOnly: true "$ref": "#/components/schemas/AccountMini" subscription_id: type: string title: Subscription ID readOnly: true coupon: "$ref": "#/components/schemas/Coupon" state: title: Coupon Redemption state default: active "$ref": "#/components/schemas/ActiveStateEnum" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 discounted: type: number format: float title: Amount Discounted description: The amount that was discounted upon the application of the coupon, formatted with the currency. created_at: type: string title: Created at format: date-time readOnly: true updated_at: type: string title: Last updated at format: date-time readOnly: true removed_at: type: string title: Removed at description: The date and time the redemption was removed from the account (un-redeemed). format: date-time CouponRedemptionCreate: type: object properties: coupon_id: type: string title: Coupon ID currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 subscription_id: type: string title: Subscription ID required: - coupon_id CouponRedemptionMini: type: object properties: id: type: string title: Coupon Redemption ID readOnly: true object: type: string title: Object type description: Will always be `coupon`. readOnly: true coupon: "$ref": "#/components/schemas/CouponMini" state: title: Invoice state "$ref": "#/components/schemas/ActiveStateEnum" discounted: type: number format: float title: Amount Discounted description: The amount that was discounted upon the application of the coupon, formatted with the currency. created_at: type: string title: Created at format: date-time readOnly: true CouponUpdate: type: object properties: name: type: string title: Name description: The internal name for the coupon. max_redemptions: type: integer title: Max redemptions description: A maximum number of redemptions for the coupon. The coupon will expire when it hits its maximum redemptions. max_redemptions_per_account: type: integer @@ -23664,1278 +23666,1288 @@ components: description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/DunningCampaign" DunningCycle: type: object properties: type: "$ref": "#/components/schemas/DunningCycleTypeEnum" applies_to_manual_trial: type: boolean description: Whether the dunning settings will be applied to manual trials. Only applies to trial cycles. first_communication_interval: type: integer description: The number of days after a transaction failure before the first dunning email is sent. send_immediately_on_hard_decline: type: boolean description: Whether or not to send an extra email immediately to customers whose initial payment attempt fails with either a hard decline or invalid billing info. intervals: type: array description: Dunning intervals. items: "$ref": "#/components/schemas/DunningInterval" expire_subscription: type: boolean description: Whether the subscription(s) should be cancelled at the end of the dunning cycle. fail_invoice: type: boolean description: Whether the invoice should be failed at the end of the dunning cycle. total_dunning_days: type: integer description: The number of days between the first dunning email being sent and the end of the dunning cycle. total_recycling_days: type: integer description: The number of days between a transaction failure and the end of the dunning cycle. version: type: integer description: Current campaign version. created_at: type: string format: date-time description: When the current settings were created in Recurly. updated_at: type: string format: date-time description: When the current settings were updated in Recurly. DunningInterval: properties: days: type: integer description: Number of days before sending the next email. email_template: type: string description: Email template being used. DunningCampaignsBulkUpdate: properties: plan_codes: type: array maxItems: 200 description: List of `plan_codes` associated with the Plans for which the dunning campaign should be updated. Required unless `plan_ids` is present. items: type: string plan_ids: type: array maxItems: 200 description: List of `plan_ids` associated with the Plans for which the dunning campaign should be updated. Required unless `plan_codes` is present. items: type: string DunningCampaignsBulkUpdateResponse: properties: object: type: string title: Object type readOnly: true plans: type: array title: Plans description: An array containing all of the `Plan` resources that have been updated. maxItems: 200 items: "$ref": "#/components/schemas/Plan" Entitlements: type: object description: A list of privileges granted to a customer through the purchase of a plan or item. properties: object: type: string title: Object Type has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/Entitlement" Entitlement: type: object properties: object: type: string description: Entitlement customer_permission: "$ref": "#/components/schemas/CustomerPermission" granted_by: type: array description: Subscription or item that granted the customer permission. items: "$ref": "#/components/schemas/GrantedBy" created_at: type: string format: date-time description: Time object was created. updated_at: type: string format: date-time description: Time the object was last updated ExternalPaymentPhase: type: object description: Details of payments in the lifecycle of a subscription from an external resource that is not managed by the Recurly platform, e.g. App Store or Google Play Store. properties: id: type: string title: External payment phase ID description: System-generated unique identifier for an external payment phase ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type external_subscription: "$ref": "#/components/schemas/ExternalSubscription" started_at: type: string format: date-time title: Started At ends_at: type: string format: date-time title: Ends At starting_billing_period_index: type: integer title: Starting Billing Period Index ending_billing_period_index: type: integer title: Ending Billing Period Index offer_type: type: string title: Offer Type description: Type of discount offer given, e.g. "FREE_TRIAL" offer_name: type: string title: Offer Name description: Name of the discount offer given, e.g. "introductory" period_count: type: integer title: Period Count description: Number of billing periods period_length: type: string title: Period Length description: Billing cycle length amount: type: string format: decimal title: Amount minimum: 0 description: Allows up to 9 decimal places currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 created_at: type: string format: date-time title: Created at description: When the external subscription was created in Recurly. updated_at: type: string format: date-time title: Updated at description: When the external subscription was updated in Recurly. ExternalPaymentPhaseList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalPaymentPhase" ExternalProduct: type: object description: Product from an external resource such as Apple App Store or Google Play Store. properties: id: type: string title: External product ID. description: System-generated unique identifier for an external product ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type name: type: string title: Name description: Name to identify the external product in Recurly. plan: "$ref": "#/components/schemas/PlanMini" created_at: type: string format: date-time description: When the external product was created in Recurly. updated_at: type: string format: date-time description: When the external product was updated in Recurly. external_product_references: type: array title: External Product References description: List of external product references of the external product. items: "$ref": "#/components/schemas/ExternalProductReferenceMini" ExternalProductList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalProduct" ExternalProductCreate: type: object properties: name: type: string description: External product name. plan_id: type: string description: Recurly plan UUID. external_product_references: type: array title: External Product References description: List of external product references of the external product. items: "$ref": "#/components/schemas/ExternalProductReferenceBase" required: - name ExternalProductUpdate: type: object properties: plan_id: type: string description: Recurly plan UUID. required: - plan_id ExternalProductReferenceBase: type: object properties: reference_code: type: string description: A code which associates the external product to a corresponding object or resource in an external platform like the Apple App Store or Google Play Store. maxLength: 255 external_connection_type: "$ref": "#/components/schemas/ExternalProductReferenceConnectionTypeEnum" ExternalProductReferenceCollection: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalProductReferenceMini" ExternalProductReferenceCreate: allOf: - "$ref": "#/components/schemas/ExternalProductReferenceBase" required: - reference_code - external_connection_type ExternalProductReferenceUpdate: allOf: - "$ref": "#/components/schemas/ExternalProductReferenceBase" ExternalProductReferenceConnectionTypeEnum: type: string enum: - apple_app_store - google_play_store ExternalAccountList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalAccount" ExternalAccountCreate: type: object properties: external_account_code: type: string description: Represents the account code for the external account. external_connection_type: type: string description: Represents the connection type. `AppleAppStore` or `GooglePlayStore` required: - external_account_code - external_connection_type ExternalAccountUpdate: type: object properties: external_account_code: type: string description: Represents the account code for the external account. external_connection_type: type: string description: Represents the connection type. `AppleAppStore` or `GooglePlayStore` ExternalAccount: type: object title: External Account properties: object: type: string default: external_account id: type: string description: UUID of the external_account . external_account_code: type: string description: Represents the account code for the external account. external_connection_type: type: string description: Represents the connection type. `AppleAppStore` or `GooglePlayStore` created_at: type: string format: date-time description: Created at readOnly: true updated_at: type: string format: date-time description: Last updated at readOnly: true ExternalProductReferenceMini: type: object title: External Product Reference details description: External Product Reference details properties: id: type: string title: External Product ID description: System-generated unique identifier for an external product ID, e.g. `e28zov4fw0v2`. object: type: string title: object reference_code: type: string title: reference_code description: A code which associates the external product to a corresponding object or resource in an external platform like the Apple App Store or Google Play Store. external_connection_type: type: string title: external_connection_type description: Source connection platform. created_at: type: string format: date-time description: When the external product was created in Recurly. updated_at: type: string format: date-time description: When the external product was updated in Recurly. ExternalSubscription: type: object description: Subscription from an external resource such as Apple App Store or Google Play Store. properties: id: type: string title: External subscription ID description: System-generated unique identifier for an external subscription ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type account: "$ref": "#/components/schemas/AccountMini" external_product_reference: "$ref": "#/components/schemas/ExternalProductReferenceMini" external_id: type: string title: External Id description: The id of the subscription in the external systems., I.e. Apple App Store or Google Play Store. last_purchased: type: string format: date-time title: Last purchased description: When a new billing event occurred on the external subscription in conjunction with a recent billing period, reactivation or upgrade/downgrade. auto_renew: type: boolean title: Auto-renew description: An indication of whether or not the external subscription will auto-renew at the expiration date. default: false in_grace_period: type: boolean title: In grace period description: An indication of whether or not the external subscription is in a grace period. default: false app_identifier: type: string title: App identifier description: Identifier of the app that generated the external subscription. quantity: type: integer title: Quantity description: An indication of the quantity of a subscribed item's quantity. default: 1 minimum: 0 state: type: string description: External subscriptions can be active, canceled, expired, or past_due. default: active activated_at: type: string format: date-time title: Activated at description: When the external subscription was activated in the external platform. canceled_at: type: string format: date-time title: Canceled at description: When the external subscription was canceled in the external platform. expires_at: type: string format: date-time title: Expires at description: When the external subscription expires in the external platform. trial_started_at: type: string format: date-time title: Trial started at description: When the external subscription trial period started in the external platform. trial_ends_at: type: string format: date-time title: Trial ends at description: When the external subscription trial period ends in the external platform. + test: + type: boolean + title: Test + description: An indication of whether or not the external subscription was + purchased in a sandbox environment. + default: false created_at: type: string format: date-time title: Created at description: When the external subscription was created in Recurly. updated_at: type: string format: date-time title: Updated at description: When the external subscription was updated in Recurly. ExternalSubscriptionList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalSubscription" ExternalInvoice: type: object description: Invoice from an external resource such as Apple App Store or Google Play Store. properties: id: type: string title: External invoice ID description: System-generated unique identifier for an external invoice ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type account: "$ref": "#/components/schemas/AccountMini" external_subscription: "$ref": "#/components/schemas/ExternalSubscription" external_id: type: string description: An identifier which associates the external invoice to a corresponding object in an external platform. state: "$ref": "#/components/schemas/ExternalInvoiceStateEnum" total: type: string format: decimal title: Total currency: type: string title: Currency description: 3-letter ISO 4217 currency code. line_items: type: array items: "$ref": "#/components/schemas/ExternalCharge" purchased_at: type: string format: date-time description: When the invoice was created in the external platform. created_at: type: string format: date-time description: When the external invoice was created in Recurly. updated_at: type: string format: date-time title: Updated at description: When the external invoice was updated in Recurly. ExternalInvoiceList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalInvoice" ExternalCharge: type: object description: Charge from an external resource such as Apple App Store or Google Play Store. properties: id: type: string title: External invoice ID description: System-generated unique identifier for an external charge ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type account: "$ref": "#/components/schemas/AccountMini" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. unit_amount: type: string format: decimal title: Unit Amount quantity: type: integer description: type: string external_product_reference: "$ref": "#/components/schemas/ExternalProductReferenceMini" created_at: type: string format: date-time title: Created at description: When the external charge was created in Recurly. updated_at: type: string format: date-time title: Updated at description: When the external charge was updated in Recurly. CustomerPermission: type: object properties: id: type: string description: Customer permission ID. code: type: string description: Customer permission code. name: type: string description: Customer permission name. description: type: string description: Description of customer permission. object: type: string description: It will always be "customer_permission". GrantedBy: type: object description: The subscription or external subscription that grants customer permissions. properties: object: type: string title: Object Type id: type: string description: The ID of the subscription or external subscription that grants the permission to the account. InvoiceTemplateList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/InvoiceTemplate" InvoiceTemplate: type: object description: Settings for an invoice template. properties: id: type: string code: type: string description: Invoice template code. name: type: string description: Invoice template name. description: type: string description: Invoice template description. created_at: type: string format: date-time description: When the invoice template was created in Recurly. updated_at: type: string format: date-time description: When the invoice template was updated in Recurly. PaymentMethod: properties: object: "$ref": "#/components/schemas/PaymentMethodEnum" card_type: description: Visa, MasterCard, American Express, Discover, JCB, etc. "$ref": "#/components/schemas/CardTypeEnum" first_six: type: string description: Credit card number's first six digits. maxLength: 6 last_four: type: string description: Credit card number's last four digits. Will refer to bank account if payment method is ACH. maxLength: 4 last_two: type: string description: The IBAN bank account's last two digits. maxLength: 2 exp_month: type: integer description: Expiration month. maxLength: 2 exp_year: type: integer description: Expiration year. maxLength: 4 gateway_token: type: string description: A token used in place of a credit card in order to perform transactions. maxLength: 50 cc_bin_country: type: string description: The 2-letter ISO 3166-1 alpha-2 country code associated with the credit card BIN, if known by Recurly. Available on the BillingInfo object only. Available when the BIN country lookup feature is enabled. gateway_code: type: string description: An identifier for a specific payment gateway. maxLength: 13 gateway_attributes: type: object description: Gateway specific attributes associated with this PaymentMethod x-class-name: GatewayAttributes properties: account_reference: type: string description: Used by Adyen and Braintree gateways. For Adyen the Shopper Reference value used when the external token was created. For Braintree the PayPal PayerID is populated in the response. maxLength: 264 + card_network_preference: + description: Represents the card network preference associated with the + billing info for dual badged cards. Must be a supported card network. + "$ref": "#/components/schemas/CardNetworkEnum" billing_agreement_id: type: string description: Billing Agreement identifier. Only present for Amazon or Paypal payment methods. name_on_account: type: string description: The name associated with the bank account. account_type: description: The bank account type. Only present for ACH payment methods. "$ref": "#/components/schemas/AccountTypeEnum" routing_number: type: string description: The bank account's routing number. Only present for ACH payment methods. routing_number_bank: type: string description: The bank name of this routing number. username: type: string description: Username of the associated payment method. Currently only associated with Venmo. BusinessEntityList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/BusinessEntity" BusinessEntity: type: object description: Business entity details properties: id: title: Business entity ID type: string maxLength: 13 readOnly: true object: title: Object type type: string readOnly: true code: title: Business entity code type: string maxLength: 50 description: The entity code of the business entity. name: type: string title: Name description: This name describes your business entity and will appear on the invoice. maxLength: 255 invoice_display_address: title: Invoice display address description: Address information for the business entity that will appear on the invoice. "$ref": "#/components/schemas/Address" tax_address: title: Tax address description: Address information for the business entity that will be used for calculating taxes. "$ref": "#/components/schemas/Address" default_vat_number: type: string title: Default VAT number description: VAT number for the customer used on the invoice. maxLength: 20 default_registration_number: type: string title: Default registration number description: Registration number for the customer used on the invoice. maxLength: 30 subscriber_location_countries: type: array title: Subscriber location countries description: List of countries for which the business entity will be used. items: type: string title: Country code created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true GiftCardList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/GiftCard" GiftCard: type: object description: Gift card details properties: id: title: Gift card ID type: string maxLength: 13 readOnly: true object: title: Object type type: string readOnly: true gifter_account_id: title: Gifter account ID type: string maxLength: 13 description: The ID of the account that purchased the gift card. recipient_account_id: title: Recipient account ID type: string maxLength: 13 description: The ID of the account that redeemed the gift card redemption code. Does not have a value until gift card is redeemed. purchase_invoice_id: title: Purchase invoice ID type: string maxLength: 13 description: The ID of the invoice for the gift card purchase made by the gifter. redemption_invoice_id: title: Redemption invoice ID type: string maxLength: 13 description: The ID of the invoice for the gift card redemption made by the recipient. Does not have a value until gift card is redeemed. redemption_code: title: Redemption code type: string description: The unique redemption code for the gift card, generated by Recurly. Will be 16 characters, alphanumeric, displayed uppercase, but accepted in any case at redemption. Used by the recipient account to create a credit in the amount of the `unit_amount` on their account. balance: title: Remaining balance type: number format: float description: The remaining credit on the recipient account associated with this gift card. Only has a value once the gift card has been redeemed. Can be used to create gift card balance displays for your customers. product_code: title: Product code type: string description: The product code or SKU of the gift card product. unit_amount: title: Purchase unit amount type: number format: float description: The amount of the gift card, which is the amount of the charge to the gifter account and the amount of credit that is applied to the recipient account upon successful redemption. currency: title: Currency type: string description: 3-letter ISO 4217 currency code. maxLength: 3 delivery: title: Delivery details description: The delivery details for the gift card. readOnly: true "$ref": "#/components/schemas/GiftCardDelivery" created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true delivered_at: type: string format: date-time title: Delivered at readOnly: true description: When the gift card was sent to the recipient by Recurly via email, if method was email and the "Gift Card Delivery" email template was enabled. This will be empty for post delivery or email delivery where the email template was disabled. redeemed_at: type: string format: date-time title: Redeemed at readOnly: true description: When the gift card was redeemed by the recipient. canceled_at: type: string format: date-time title: Canceled at readOnly: true description: When the gift card was canceled. GiftCardCreate: type: object description: Gift card details properties: product_code: title: Product code type: string description: The product code or SKU of the gift card product. unit_amount: title: Purchase unit amount type: number format: float description: The amount of the gift card, which is the amount of the charge to the gifter account and the amount of credit that is applied to the recipient account upon successful redemption. currency: title: Currency type: string description: 3-letter ISO 4217 currency code. maxLength: 3 delivery: title: Delivery details description: The delivery details for the gift card. readOnly: true "$ref": "#/components/schemas/GiftCardDeliveryCreate" gifter_account: title: Gifter account details description: Block of account details for the gifter. This references an existing account_code. readOnly: true "$ref": "#/components/schemas/AccountPurchase" required: - product_code - unit_amount - currency - delivery - gifter_account GiftCardDeliveryCreate: type: object description: Gift card delivery details properties: method: title: Delivery method description: Whether the delivery method is email or postal service. "$ref": "#/components/schemas/DeliveryMethodEnum" email_address: title: Recipient email address type: string description: The email address of the recipient. Required if `method` is `email`. deliver_at: type: string format: date-time title: Deliver at readOnly: true description: When the gift card should be delivered to the recipient. If null, the gift card will be delivered immediately. If a datetime is provided, the delivery will be in an hourly window, rounding down. For example, 6:23 pm will be in the 6:00 pm hourly batch. first_name: title: Recipient first name type: string description: The first name of the recipient. last_name: title: Recipient last name type: string description: The last name of the recipient. recipient_address: title: Recipient address description: Address information for the recipient. Required if `method` is `post`. "$ref": "#/components/schemas/Address" gifter_name: title: Gifter name type: string description: The name of the gifter for the purpose of a message displayed to the recipient. personal_message: title: Personal message type: string maxLength: 255 description: The personal message from the gifter to the recipient. required: - method GiftCardDelivery: type: object description: Gift card delivery details properties: method: title: Delivery method description: Whether the delivery method is email or postal service. "$ref": "#/components/schemas/DeliveryMethodEnum" email_address: title: Recipient email address type: string description: The email address of the recipient. deliver_at: type: string format: date-time title: Deliver at readOnly: true description: When the gift card should be delivered to the recipient. If null, the gift card will be delivered immediately. If a datetime is provided, the delivery will be in an hourly window, rounding down. For example, 6:23 pm will be in the 6:00 pm hourly batch. first_name: title: Recipient first name type: string description: The first name of the recipient. last_name: title: Recipient last name type: string description: The last name of the recipient. recipient_address: title: Recipient address description: Address information for the recipient. "$ref": "#/components/schemas/Address" gifter_name: title: Gifter name type: string description: The name of the gifter for the purpose of a message displayed to the recipient. personal_message: title: Personal message type: string maxLength: 255 description: The personal message from the gifter to the recipient. GiftCardRedeem: type: object description: The information necessary to redeem a gift card. properties: recipient_account: title: Recipient account description: The account for the recipient of the gift card. "$ref": "#/components/schemas/AccountReference" required: - recipient_account Error: type: object properties: type: title: Type "$ref": "#/components/schemas/ErrorTypeEnum" message: type: string title: Message params: type: array title: Parameter specific errors items: type: object properties: param: type: string ErrorMayHaveTransaction: allOf: - "$ref": "#/components/schemas/Error" - type: object properties: transaction_error: type: object x-class-name: TransactionError title: Transaction error details description: This is only included on errors with `type=transaction`. properties: object: type: string title: Object type transaction_id: type: string title: Transaction ID maxLength: 13 category: title: Category "$ref": "#/components/schemas/ErrorCategoryEnum" code: title: Code "$ref": "#/components/schemas/ErrorCodeEnum" decline_code: title: Decline code "$ref": "#/components/schemas/DeclineCodeEnum" message: type: string title: Customer message merchant_advice: type: string title: Merchant message three_d_secure_action_token_id: type: string title: 3-D Secure action token id description: Returned when 3-D Secure authentication is required for a transaction. Pass this value to Recurly.js so it can continue the challenge flow. maxLength: 22 fraud_info: "$ref": "#/components/schemas/TransactionFraudInfo" RelatedTypeEnum: type: string enum: - account - item - plan - subscription - charge RefundTypeEnum: type: string enum: - full - none - partial AlphanumericSortEnum: type: string enum: - asc - desc UsageSortEnum: type: string default: usage_timestamp enum: - recorded_timestamp - usage_timestamp UsageTypeEnum: type: string enum: - price - percentage title: Usage Type description: Type of usage, returns usage type if `add_on_type` is `usage`. UsageCalculationTypeEnum: type: string description: The type of calculation to be employed for an add-on. Cumulative billing will sum all usage records created in the current billing cycle. Last-in-period billing will apply only the most recent usage record in the billing period. If no value is specified, cumulative billing will be used. enum: - cumulative - last_in_period BillingStatusEnum: type: string default: unbilled enum: - unbilled - billed - all TimestampSortEnum: type: string enum: - created_at - updated_at ActiveStateEnum: type: string enum: - active - inactive FilterSubscriptionStateEnum: type: string enum: - active - canceled - expired - future - in_trial - live FilterLimitedSubscriptionStateEnum: type: string enum: - active - canceled - expired - future TrueEnum: type: string enum: - true LineItemStateEnum: type: string enum: - invoiced - pending LineItemTypeEnum: type: string enum: - charge - credit FilterTransactionTypeEnum: type: string enum: - authorization - capture - payment - purchase - refund - verify FilterInvoiceTypeEnum: @@ -24960,831 +24972,839 @@ components: - paid_search - public_relations - referral - social_media PreferredLocaleEnum: type: string enum: - da-DK - de-CH - de-DE - en-AU - en-CA - en-GB - en-IE - en-NZ - en-US - es-ES - es-MX - es-US - fi-FI - fr-BE - fr-CA - fr-CH - fr-FR - hi-IN - it-IT - ja-JP - ko-KR - nl-BE - nl-NL - pl-PL - pt-BR - pt-PT - ro-RO - ru-RU - sk-SK - sv-SE - tr-TR - zh-CN BillToEnum: type: string enum: - parent - self DeliveryMethodEnum: type: string enum: - email - post GatewayTransactionTypeEnum: type: string enum: - moto KountDecisionEnum: type: string enum: - approve - decline - escalate - review CouponStateEnum: type: string enum: - expired - maxed_out - redeemable CouponDurationEnum: type: string enum: - forever - single_use - temporal TemporalUnitEnum: type: string enum: - day - month - week - year FreeTrialUnitEnum: type: string enum: - day - month - week RedemptionResourceEnum: type: string enum: - account - subscription CouponTypeEnum: type: string enum: - bulk - single_code DiscountTypeEnum: type: string enum: - fixed - free_trial - percent AddOnSourceEnum: type: string title: Add-on source description: | Used to determine where the associated add-on data is pulled from. If this value is set to `plan_add_on` or left blank, then add-on data will be pulled from the plan's add-ons. If the associated `plan` has `allow_any_item_on_subscriptions` set to `true` and this field is set to `item`, then the associated add-on data will be pulled from the site's item catalog. default: plan_add_on enum: - plan_add_on - item AddOnTypeEnum: type: string enum: - fixed - usage title: Add-on Type description: Whether the add-on type is fixed, or usage-based. AddOnTypeCreateEnum: type: string enum: - fixed - usage title: Add-on Type description: Whether the add-on type is fixed, or usage-based. default: fixed UsageTypeCreateEnum: type: string enum: - price - percentage title: Usage Type description: | Type of usage, required if `add_on_type` is `usage`. See our [Guide](https://recurly.com/developers/guides/usage-based-billing-guide.html) for an overview of how to configure usage add-ons. TierTypeEnum: type: string title: Tier type description: | The pricing model for the add-on. For more information, [click here](https://docs.recurly.com/docs/billing-models#section-quantity-based). See our [Guide](https://recurly.com/developers/guides/item-addon-guide.html) for an overview of how to configure quantity-based pricing models. default: flat enum: - flat - tiered - stairstep - volume UsageTimeframeEnum: type: string title: Usage Timeframe description: The time at which usage totals are reset for billing purposes. enum: - billing_period - subscription_term default: billing_period UsageTimeframeCreateEnum: type: string title: Usage Timeframe description: | The time at which usage totals are reset for billing purposes. Allows for `tiered` add-ons to accumulate usage over the course of multiple billing periods. enum: - billing_period - subscription_term default: billing_period CreditPaymentActionEnum: type: string enum: - payment - reduction - refund - write_off UserAccessEnum: type: string enum: - api_only - read_only - write - set_only PricingModelTypeEnum: type: string enum: - fixed - ramp default: fixed description: | A fixed pricing model has the same price for each billing period. A ramp pricing model defines a set of Ramp Intervals, where a subscription changes price on a specified cadence of billing periods. The price change could be an increase or decrease. RevenueScheduleTypeEnum: type: string enum: - at_range_end - at_range_start - evenly - never NetTermsTypeEnum: type: string title: Net Terms Type description: | Optionally supplied string that may be either `net` or `eom` (end-of-month). When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date. When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month. This field is only available when the EOM Net Terms feature is enabled. enum: - net - eom default: net InvoiceTypeEnum: type: string enum: - charge - credit - legacy OriginEnum: type: string enum: - carryforward_credit - carryforward_gift_credit - credit - external_refund - gift_card - immediate_change - import - line_item_refund - open_amount_refund - prepayment - purchase - refund - renewal - termination - usage_correction - write_off InvoiceStateEnum: type: string default: all enum: - open - pending - processing - past_due - paid - closed - failed - voided InvoiceStateQueryParamEnum: type: string default: all enum: - pending - past_due - paid - failed CollectionMethodEnum: type: string enum: - automatic - manual InvoiceRefundTypeEnum: type: string enum: - amount - line_items RefuneMethodEnum: type: string enum: - all_credit - all_transaction - credit_first - transaction_first ExternalPaymentMethodEnum: type: string enum: - bacs - ach - amazon - apple_pay - check - credit_card - eft - google_pay - money_order - other - paypal - roku - sepadirectdebit - wire_transfer LineItemRevenueScheduleTypeEnum: type: string enum: - at_invoice - at_range_end - at_range_start - evenly - never LegacyCategoryEnum: type: string enum: - applied_credit - carryforward - charge - credit LineItemOriginEnum: type: string enum: - add_on - add_on_trial - carryforward - coupon - credit - debit - one_time - plan - plan_trial - setup_fee - prepayment FullCreditReasonCodeEnum: type: string enum: - general - gift_card - promotional - refund - service - write_off PartialCreditReasonCodeEnum: type: string enum: - general - promotional - service LineItemCreateOriginEnum: type: string enum: - external_gift_card - prepayment IntervalUnitEnum: type: string enum: - days - months AddressRequirementEnum: type: string enum: - full - none - streetzip - zip SiteModeEnum: type: string enum: - development - production - sandbox FeaturesEnum: type: string enum: - credit_memos - manual_invoicing - only_bill_what_changed - subscription_terms SubscriptionStateEnum: type: string enum: - active - canceled - expired - failed - future - paused TimeframeEnum: type: string enum: - bill_date - term_end ChangeTimeframeEnum: type: string enum: - bill_date - now - renewal - term_end TransactionTypeEnum: type: string enum: - authorization - capture - purchase - refund - verify TransactionOriginEnum: type: string enum: - api - chargeback - external_recovery - force_collect - hpp - merchant - recurly_admin - recurlyjs - recurring - refunded_externally - transparent TransactionStatusEnum: type: string enum: - chargeback - declined - error - pending - processing - scheduled - success - void CvvCheckEnum: type: string enum: - D - I - M - N - P - S - U - X AvsCheckEnum: type: string enum: - A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z CouponCodeStateEnum: type: string enum: - expired - inactive - maxed_out - redeemable PaymentMethodEnum: type: string enum: - bacs - amazon - amazon_billing_agreement - apple_pay - bank_account_info - check - credit_card - eft - gateway_token - google_pay - iban_bank_account - money_order - other - paypal - paypal_billing_agreement - roku - sepadirectdebit - venmo - wire_transfer - braintree_v_zero - boleto CardTypeEnum: type: string enum: - American Express - Dankort - Diners Club - Discover - ELO - Forbrugsforeningen - Hipercard - JCB - Laser - Maestro - MasterCard - Test Card - Union Pay - Unknown - Visa - Tarjeta Naranja + CardNetworkEnum: + type: string + enum: + - Bancontact + - CartesBancaires + - Dankort + - MasterCard + - Visa AccountTypeEnum: type: string enum: - checking - savings ErrorTypeEnum: type: string enum: - bad_request - immutable_subscription - internal_server_error - invalid_api_key - invalid_api_version - invalid_content_type - invalid_permissions - invalid_token - missing_feature - not_found - rate_limited - service_not_available - simultaneous_request - tax_service_error - transaction - unauthorized - unavailable_in_api_version - unknown_api_version - validation ErrorCategoryEnum: type: string enum: - three_d_secure_required - three_d_secure_action_required - amazon - api_error - approved - communication - configuration - duplicate - fraud - hard - invalid - not_enabled - not_supported - recurly - referral - skles - soft - unknown ErrorCodeEnum: type: string enum: - ach_cancel - ach_chargeback - ach_credit_return - ach_exception - ach_return - ach_transactions_not_supported - ach_validation_exception - amazon_amount_exceeded - amazon_declined_review - amazon_invalid_authorization_status - amazon_invalid_close_attempt - amazon_invalid_create_order_reference - amazon_invalid_order_status - amazon_not_authorized - amazon_order_not_modifiable - amazon_transaction_count_exceeded - api_error - approved - approved_fraud_review - authorization_already_captured - authorization_amount_depleted - authorization_expired - batch_processing_error - billing_agreement_already_accepted - billing_agreement_not_accepted - billing_agreement_not_found - billing_agreement_replaced - call_issuer - call_issuer_update_cardholder_data - cancelled - cannot_refund_unsettled_transactions - card_not_activated - card_type_not_accepted - cardholder_requested_stop - contact_gateway - contract_not_found - currency_not_supported - customer_canceled_transaction - cvv_required - declined - declined_card_number - declined_exception - declined_expiration_date - declined_missing_data - declined_saveable - declined_security_code - deposit_referenced_chargeback - direct_debit_type_not_accepted - duplicate_transaction - exceeds_daily_limit - exceeds_max_amount - expired_card - finbot_disconnect - finbot_unavailable - fraud_address - fraud_address_recurly - fraud_advanced_verification - fraud_gateway - fraud_generic - fraud_ip_address - fraud_manual_decision - fraud_risk_check - fraud_security_code - fraud_stolen_card - fraud_too_many_attempts - fraud_velocity - gateway_account_setup_incomplete - gateway_error - gateway_rate_limited - gateway_timeout - gateway_token_not_found - gateway_unavailable - gateway_validation_exception - insufficient_funds - invalid_account_number - invalid_amount - invalid_billing_agreement_status - invalid_card_number - invalid_data - invalid_email - invalid_gateway_access_token - invalid_gateway_configuration - invalid_issuer - invalid_login - invalid_merchant_type - invalid_name - invalid_payment_method - invalid_payment_method_hard - invalid_transaction - issuer_unavailable - lifecycle_decline - merch_max_transaction_limit_exceeded - moneybot_disconnect - moneybot_unavailable - no_billing_information - no_gateway - no_gateway_found_for_transaction_amount - partial_approval - partial_credits_not_supported - payer_authentication_rejected - payment_cannot_void_authorization - payment_not_accepted - paypal_account_issue - paypal_cannot_pay_self - paypal_declined_use_alternate - paypal_expired_reference_id - paypal_hard_decline - paypal_invalid_billing_agreement - paypal_primary_declined - processor_not_available - processor_unavailable - recurly_credentials_not_found - recurly_error - recurly_failed_to_get_token - recurly_token_mismatch - recurly_token_not_found - reference_transactions_not_enabled - restricted_card - restricted_card_chargeback - rjs_token_expired - roku_invalid_card_number - roku_invalid_cib - roku_invalid_payment_method - roku_zip_code_mismatch - simultaneous - ssl_error - temporary_hold - three_d_secure_action_required - three_d_secure_action_result_token_mismatch - three_d_secure_authentication - three_d_secure_connection_error - three_d_secure_credential_error - three_d_secure_not_supported - too_busy - too_many_attempts - total_credit_exceeds_capture - transaction_already_refunded - transaction_already_voided - transaction_cannot_be_authorized - transaction_cannot_be_refunded - transaction_cannot_be_refunded_currently - transaction_cannot_be_voided - transaction_failed_to_settle - transaction_not_found - transaction_service_v2_disconnect - transaction_service_v2_unavailable - transaction_settled - transaction_stale_at_gateway - try_again - unknown - unmapped_partner_error - vaultly_service_unavailable - zero_dollar_auth_not_supported DeclineCodeEnum: type: string enum: - account_closed - call_issuer - card_not_activated - card_not_supported - cardholder_requested_stop - do_not_honor - do_not_try_again - exceeds_daily_limit - generic_decline - expired_card - fraudulent - insufficient_funds - incorrect_address - incorrect_security_code - invalid_amount - invalid_number - invalid_transaction - issuer_unavailable - lifecycle_decline - lost_card - pickup_card - policy_decline - restricted_card - restricted_card_chargeback - security_decline - stolen_card - try_again - update_cardholder_data - requires_3d_secure ExportDates: type: object properties: object: type: string title: Object type readOnly: true dates: type: array items: type: string title: An array of dates that have available exports. ExportFiles: type: object properties: object: type: string title: Object type readOnly: true files: type: array items: "$ref": "#/components/schemas/ExportFile" ExportFile: type: object properties: name: type: string title: Filename description: Name of the export file. md5sum: type: string title: MD5 hash of the export file description: MD5 hash of the export file. href: type: string title: A link to the export file description: A presigned link to download the export file. TaxIdentifierTypeEnum: type: string enum: - cpf - cnpj - cuit DunningCycleTypeEnum: type: string description: The type of invoice this cycle applies to. enum: - automatic - manual - trial AchTypeEnum: type: string description: The payment method type for a non-credit card based billing info. `bacs` and `becs` are the only accepted values. enum: - bacs - becs AchAccountTypeEnum: type: string description: The bank account type. (ACH only) enum: - checking - savings ExternalHppTypeEnum: type: string description: Use for Adyen HPP billing info. This should only be used as part of a pending purchase request, when the billing info is nested inside an account object. enum: - adyen OnlineBankingPaymentTypeEnum: type: string description: Use for Online Banking billing info. This should only be used as part of a pending purchase request, when the billing info is nested inside an account object. enum: - ideal - sofort ExternalInvoiceStateEnum: type: string enum: - paid
recurly/recurly-client-php
6b33edb4a326ac09f9082a7e123029d896e1bb66
4.46.0
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index ae9c073..e175143 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 4.45.0 +current_version = 4.46.0 parse = (?P<major>\d+) \.(?P<minor>\d+) \.(?P<patch>\d+) serialize = {major}.{minor}.{patch} [bumpversion:file:composer.json] [bumpversion:file:lib/recurly/version.php] diff --git a/CHANGELOG.md b/CHANGELOG.md index 4081490..2a406be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,514 +1,525 @@ # Changelog +## [4.46.0](https://github.com/recurly/recurly-client-php/tree/4.46.0) (2024-02-20) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.45.0...4.46.0) + + +**Merged Pull Requests** + +- Add invoice state param for v2021-02-25 [#799](https://github.com/recurly/recurly-client-php/pull/799) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.45.0](https://github.com/recurly/recurly-client-php/tree/4.45.0) (2024-01-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.44.0...4.45.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#789](https://github.com/recurly/recurly-client-php/pull/789) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.44.0](https://github.com/recurly/recurly-client-php/tree/4.44.0) (2024-01-18) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.43.0...4.44.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#788](https://github.com/recurly/recurly-client-php/pull/788) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.43.0](https://github.com/recurly/recurly-client-php/tree/4.43.0) (2023-12-06) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.42.0...4.43.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Payment Phases) [#785](https://github.com/recurly/recurly-client-php/pull/785) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.42.0](https://github.com/recurly/recurly-client-php/tree/4.42.0) (2023-11-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.41.0...4.42.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#783](https://github.com/recurly/recurly-client-php/pull/783) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.41.0](https://github.com/recurly/recurly-client-php/tree/4.41.0) (2023-08-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.40.0...4.41.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (`VATNumber`, `LifecycleDecline`) [#782](https://github.com/recurly/recurly-client-php/pull/782) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.40.0](https://github.com/recurly/recurly-client-php/tree/4.40.0) (2023-08-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.39.0...4.40.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (action_result) [#781](https://github.com/recurly/recurly-client-php/pull/781) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.39.0](https://github.com/recurly/recurly-client-php/tree/4.39.0) (2023-07-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.37.0...4.39.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Ramp Dates, Net Terms, Invoice Business Entity) [#779](https://github.com/recurly/recurly-client-php/pull/779) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (App Management - External Subscriptions) [#777](https://github.com/recurly/recurly-client-php/pull/777) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.37.0](https://github.com/recurly/recurly-client-php/tree/4.37.0) (2023-06-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.36.0...4.37.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Multiple Business Entities) [#769](https://github.com/recurly/recurly-client-php/pull/769) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.36.0](https://github.com/recurly/recurly-client-php/tree/4.36.0) (2023-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.35.0...4.36.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Products & References) [#766](https://github.com/recurly/recurly-client-php/pull/766) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.35.0](https://github.com/recurly/recurly-client-php/tree/4.35.0) (2023-05-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.34.0...4.35.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (gateway_attributes on PaymentMethod) [#764](https://github.com/recurly/recurly-client-php/pull/764) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#747](https://github.com/recurly/recurly-client-php/pull/747) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.28.0](https://github.com/recurly/recurly-client-php/tree/4.28.0) (2023-02-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.27.0...4.28.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (GiftCard endpoints and new transaction error support) [#745](https://github.com/recurly/recurly-client-php/pull/745) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.27.0](https://github.com/recurly/recurly-client-php/tree/4.27.0) (2023-01-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.26.0...4.27.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Custom Fields on Line Items) [#738](https://github.com/recurly/recurly-client-php/pull/738) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.26.0](https://github.com/recurly/recurly-client-php/tree/4.26.0) (2023-01-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.25.0...4.26.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Account Preferred Time Zone) [#736](https://github.com/recurly/recurly-client-php/pull/736) ([douglasmiller](https://github.com/douglasmiller)) ## [4.25.0](https://github.com/recurly/recurly-client-php/tree/4.25.0) (2022-11-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.24.0...4.25.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Apply Credit Balance feature) [#732](https://github.com/recurly/recurly-client-php/pull/732) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.24.0](https://github.com/recurly/recurly-client-php/tree/4.24.0) (2022-11-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.23.0...4.24.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Subscriptions feature) [#729](https://github.com/recurly/recurly-client-php/pull/729) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#728](https://github.com/recurly/recurly-client-php/pull/728) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.23.0](https://github.com/recurly/recurly-client-php/tree/4.23.0) (2022-10-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.22.0...4.23.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entitlements feature) [#725](https://github.com/recurly/recurly-client-php/pull/725) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.22.0](https://github.com/recurly/recurly-client-php/tree/4.22.0) (2022-10-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.2...4.22.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25(Decimal Usage and Quantities and DunningEvent new fields) [#722](https://github.com/recurly/recurly-client-php/pull/722) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.2](https://github.com/recurly/recurly-client-php/tree/4.21.2) (2022-09-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.1...4.21.2) **Merged Pull Requests** - feat: allow for psr/log ^2/3 [#716](https://github.com/recurly/recurly-client-php/pull/716) ([trickeyone](https://github.com/trickeyone)) ## [4.21.1](https://github.com/recurly/recurly-client-php/tree/4.21.1) (2022-09-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.0...4.21.1) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#714](https://github.com/recurly/recurly-client-php/pull/714) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.0](https://github.com/recurly/recurly-client-php/tree/4.21.0) (2022-09-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.20.0...4.21.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#713](https://github.com/recurly/recurly-client-php/pull/713) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixes bug with putDunningCampaignBulkUpdate [#706](https://github.com/recurly/recurly-client-php/pull/706) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.20.0](https://github.com/recurly/recurly-client-php/tree/4.20.0) (2022-08-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.19.0...4.20.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#701](https://github.com/recurly/recurly-client-php/pull/701) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.19.0](https://github.com/recurly/recurly-client-php/tree/4.19.0) (2022-07-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.18.0...4.19.0) **Merged Pull Requests** - Fixing deprecation warnings in client [#697](https://github.com/recurly/recurly-client-php/pull/697) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#695](https://github.com/recurly/recurly-client-php/pull/695) ([recurly-integrations](https://github.com/recurly-integrations)) **Closed Issues** - Recurly\Pager and \Iterator return type mismatch (PHP 8.1 deprecation) [#677](https://github.com/recurly/recurly-client-php/issues/677) ## [4.18.0](https://github.com/recurly/recurly-client-php/tree/4.18.0) (2022-06-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.17.0...4.18.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#693](https://github.com/recurly/recurly-client-php/pull/693) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.17.0](https://github.com/recurly/recurly-client-php/tree/4.17.0) (2022-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.16.0...4.17.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#679](https://github.com/recurly/recurly-client-php/pull/679) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.16.0](https://github.com/recurly/recurly-client-php/tree/4.16.0) (2022-03-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.15.0...4.16.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#676](https://github.com/recurly/recurly-client-php/pull/676) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.15.0](https://github.com/recurly/recurly-client-php/tree/4.15.0) (2022-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.14.0...4.15.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#668](https://github.com/recurly/recurly-client-php/pull/668) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.14.0](https://github.com/recurly/recurly-client-php/tree/4.14.0) (2022-03-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.13.0...4.14.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#664](https://github.com/recurly/recurly-client-php/pull/664) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.13.0](https://github.com/recurly/recurly-client-php/tree/4.13.0) (2022-01-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.12.0...4.13.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#655](https://github.com/recurly/recurly-client-php/pull/655) ([recurly-integrations](https://github.com/recurly-integrations)) - Add region argument to client to connect in EU data center [#653](https://github.com/recurly/recurly-client-php/pull/653) ([FabricioCoutinho](https://github.com/FabricioCoutinho)) ## [4.12.0](https://github.com/recurly/recurly-client-php/tree/4.12.0) (2022-01-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.11.0...4.12.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Invoice Customization) [#654](https://github.com/recurly/recurly-client-php/pull/654) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#651](https://github.com/recurly/recurly-client-php/pull/651) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.11.0](https://github.com/recurly/recurly-client-php/tree/4.11.0) (2021-12-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.10.0...4.11.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Tax Inclusive Pricing) [#650](https://github.com/recurly/recurly-client-php/pull/650) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.10.0](https://github.com/recurly/recurly-client-php/tree/4.10.0) (2021-11-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.9.0...4.10.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#647](https://github.com/recurly/recurly-client-php/pull/647) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#645](https://github.com/recurly/recurly-client-php/pull/645) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#644](https://github.com/recurly/recurly-client-php/pull/644) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#639](https://github.com/recurly/recurly-client-php/pull/639) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.9.0](https://github.com/recurly/recurly-client-php/tree/4.9.0) (2021-09-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.8.0...4.9.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Support to new subscription fields and response) [#633](https://github.com/recurly/recurly-client-php/pull/633) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.8.0](https://github.com/recurly/recurly-client-php/tree/4.8.0) (2021-09-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.7.0...4.8.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Dunning Campaigns feature) [#632](https://github.com/recurly/recurly-client-php/pull/632) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.7.0](https://github.com/recurly/recurly-client-php/tree/4.7.0) (2021-08-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.6.0...4.7.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (get_preview_renewal) [#630](https://github.com/recurly/recurly-client-php/pull/630) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.6.0](https://github.com/recurly/recurly-client-php/tree/4.6.0) (2021-08-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.5.0...4.6.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#628](https://github.com/recurly/recurly-client-php/pull/628) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.5.0](https://github.com/recurly/recurly-client-php/tree/4.5.0) (2021-08-02) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.4.0...4.5.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#623](https://github.com/recurly/recurly-client-php/pull/623) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixing issue with http_build_query converting booleans in params to integers [#621](https://github.com/recurly/recurly-client-php/pull/621) ([ZloeSabo](https://github.com/ZloeSabo)) ## [4.4.0](https://github.com/recurly/recurly-client-php/tree/4.4.0) (2021-06-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.3.0...4.4.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#613](https://github.com/recurly/recurly-client-php/pull/613) ([recurly-integrations](https://github.com/recurly-integrations)) - Add PHP 8.0 to travis matrix [#592](https://github.com/recurly/recurly-client-php/pull/592) ([douglasmiller](https://github.com/douglasmiller)) ## [4.3.0](https://github.com/recurly/recurly-client-php/tree/4.3.0) (2021-06-04) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.2.0...4.3.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#612](https://github.com/recurly/recurly-client-php/pull/612) ([recurly-integrations](https://github.com/recurly-integrations)) - Adding psr/log requirement to composer.json [#611](https://github.com/recurly/recurly-client-php/pull/611) ([douglasmiller](https://github.com/douglasmiller)) ## [4.2.0](https://github.com/recurly/recurly-client-php/tree/4.2.0) (2021-04-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.1.0...4.2.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#606](https://github.com/recurly/recurly-client-php/pull/606) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.1.0](https://github.com/recurly/recurly-client-php/tree/4.1.0) (2021-04-15) diff --git a/composer.json b/composer.json index 1b2ad9f..afcec1c 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,38 @@ { "name": "recurly/recurly-client", - "version": "4.45.0", + "version": "4.46.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], "homepage": "https://github.com/recurly/recurly-client-php", "license": "MIT", "authors": [], "require": { "php": ">= 7.2.0", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "phpcompatibility/php-compatibility": "^9.3", "phpdocumentor/phpdocumentor": "~3.0.0", "phpstan/phpstan": "^0.12.11", "phpunit/phpunit": "^8", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "classmap": ["lib"], "files": ["lib/recurly.php"] }, "autoload-dev": { "classmap": ["tests"] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/lib/recurly/version.php b/lib/recurly/version.php index 3b586fb..773bda6 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -1,8 +1,8 @@ <?php namespace Recurly; class Version { - public const CURRENT = '4.45.0'; + public const CURRENT = '4.46.0'; }
recurly/recurly-client-php
1e91a8f07b595eae0947211cb05018d9e2cb2c67
4.45.0
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 5e1ee66..ae9c073 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 4.44.0 +current_version = 4.45.0 parse = (?P<major>\d+) \.(?P<minor>\d+) \.(?P<patch>\d+) serialize = {major}.{minor}.{patch} [bumpversion:file:composer.json] [bumpversion:file:lib/recurly/version.php] diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d548ee..4081490 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,514 +1,525 @@ # Changelog +## [4.45.0](https://github.com/recurly/recurly-client-php/tree/4.45.0) (2024-01-24) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.44.0...4.45.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 [#789](https://github.com/recurly/recurly-client-php/pull/789) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.44.0](https://github.com/recurly/recurly-client-php/tree/4.44.0) (2024-01-18) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.43.0...4.44.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#788](https://github.com/recurly/recurly-client-php/pull/788) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.43.0](https://github.com/recurly/recurly-client-php/tree/4.43.0) (2023-12-06) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.42.0...4.43.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Payment Phases) [#785](https://github.com/recurly/recurly-client-php/pull/785) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.42.0](https://github.com/recurly/recurly-client-php/tree/4.42.0) (2023-11-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.41.0...4.42.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#783](https://github.com/recurly/recurly-client-php/pull/783) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.41.0](https://github.com/recurly/recurly-client-php/tree/4.41.0) (2023-08-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.40.0...4.41.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (`VATNumber`, `LifecycleDecline`) [#782](https://github.com/recurly/recurly-client-php/pull/782) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.40.0](https://github.com/recurly/recurly-client-php/tree/4.40.0) (2023-08-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.39.0...4.40.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (action_result) [#781](https://github.com/recurly/recurly-client-php/pull/781) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.39.0](https://github.com/recurly/recurly-client-php/tree/4.39.0) (2023-07-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.37.0...4.39.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Ramp Dates, Net Terms, Invoice Business Entity) [#779](https://github.com/recurly/recurly-client-php/pull/779) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (App Management - External Subscriptions) [#777](https://github.com/recurly/recurly-client-php/pull/777) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.37.0](https://github.com/recurly/recurly-client-php/tree/4.37.0) (2023-06-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.36.0...4.37.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Multiple Business Entities) [#769](https://github.com/recurly/recurly-client-php/pull/769) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.36.0](https://github.com/recurly/recurly-client-php/tree/4.36.0) (2023-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.35.0...4.36.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Products & References) [#766](https://github.com/recurly/recurly-client-php/pull/766) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.35.0](https://github.com/recurly/recurly-client-php/tree/4.35.0) (2023-05-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.34.0...4.35.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (gateway_attributes on PaymentMethod) [#764](https://github.com/recurly/recurly-client-php/pull/764) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#747](https://github.com/recurly/recurly-client-php/pull/747) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.28.0](https://github.com/recurly/recurly-client-php/tree/4.28.0) (2023-02-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.27.0...4.28.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (GiftCard endpoints and new transaction error support) [#745](https://github.com/recurly/recurly-client-php/pull/745) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.27.0](https://github.com/recurly/recurly-client-php/tree/4.27.0) (2023-01-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.26.0...4.27.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Custom Fields on Line Items) [#738](https://github.com/recurly/recurly-client-php/pull/738) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.26.0](https://github.com/recurly/recurly-client-php/tree/4.26.0) (2023-01-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.25.0...4.26.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Account Preferred Time Zone) [#736](https://github.com/recurly/recurly-client-php/pull/736) ([douglasmiller](https://github.com/douglasmiller)) ## [4.25.0](https://github.com/recurly/recurly-client-php/tree/4.25.0) (2022-11-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.24.0...4.25.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Apply Credit Balance feature) [#732](https://github.com/recurly/recurly-client-php/pull/732) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.24.0](https://github.com/recurly/recurly-client-php/tree/4.24.0) (2022-11-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.23.0...4.24.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Subscriptions feature) [#729](https://github.com/recurly/recurly-client-php/pull/729) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#728](https://github.com/recurly/recurly-client-php/pull/728) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.23.0](https://github.com/recurly/recurly-client-php/tree/4.23.0) (2022-10-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.22.0...4.23.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entitlements feature) [#725](https://github.com/recurly/recurly-client-php/pull/725) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.22.0](https://github.com/recurly/recurly-client-php/tree/4.22.0) (2022-10-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.2...4.22.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25(Decimal Usage and Quantities and DunningEvent new fields) [#722](https://github.com/recurly/recurly-client-php/pull/722) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.2](https://github.com/recurly/recurly-client-php/tree/4.21.2) (2022-09-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.1...4.21.2) **Merged Pull Requests** - feat: allow for psr/log ^2/3 [#716](https://github.com/recurly/recurly-client-php/pull/716) ([trickeyone](https://github.com/trickeyone)) ## [4.21.1](https://github.com/recurly/recurly-client-php/tree/4.21.1) (2022-09-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.0...4.21.1) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#714](https://github.com/recurly/recurly-client-php/pull/714) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.0](https://github.com/recurly/recurly-client-php/tree/4.21.0) (2022-09-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.20.0...4.21.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#713](https://github.com/recurly/recurly-client-php/pull/713) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixes bug with putDunningCampaignBulkUpdate [#706](https://github.com/recurly/recurly-client-php/pull/706) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.20.0](https://github.com/recurly/recurly-client-php/tree/4.20.0) (2022-08-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.19.0...4.20.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#701](https://github.com/recurly/recurly-client-php/pull/701) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.19.0](https://github.com/recurly/recurly-client-php/tree/4.19.0) (2022-07-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.18.0...4.19.0) **Merged Pull Requests** - Fixing deprecation warnings in client [#697](https://github.com/recurly/recurly-client-php/pull/697) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#695](https://github.com/recurly/recurly-client-php/pull/695) ([recurly-integrations](https://github.com/recurly-integrations)) **Closed Issues** - Recurly\Pager and \Iterator return type mismatch (PHP 8.1 deprecation) [#677](https://github.com/recurly/recurly-client-php/issues/677) ## [4.18.0](https://github.com/recurly/recurly-client-php/tree/4.18.0) (2022-06-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.17.0...4.18.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#693](https://github.com/recurly/recurly-client-php/pull/693) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.17.0](https://github.com/recurly/recurly-client-php/tree/4.17.0) (2022-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.16.0...4.17.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#679](https://github.com/recurly/recurly-client-php/pull/679) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.16.0](https://github.com/recurly/recurly-client-php/tree/4.16.0) (2022-03-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.15.0...4.16.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#676](https://github.com/recurly/recurly-client-php/pull/676) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.15.0](https://github.com/recurly/recurly-client-php/tree/4.15.0) (2022-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.14.0...4.15.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#668](https://github.com/recurly/recurly-client-php/pull/668) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.14.0](https://github.com/recurly/recurly-client-php/tree/4.14.0) (2022-03-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.13.0...4.14.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#664](https://github.com/recurly/recurly-client-php/pull/664) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.13.0](https://github.com/recurly/recurly-client-php/tree/4.13.0) (2022-01-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.12.0...4.13.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#655](https://github.com/recurly/recurly-client-php/pull/655) ([recurly-integrations](https://github.com/recurly-integrations)) - Add region argument to client to connect in EU data center [#653](https://github.com/recurly/recurly-client-php/pull/653) ([FabricioCoutinho](https://github.com/FabricioCoutinho)) ## [4.12.0](https://github.com/recurly/recurly-client-php/tree/4.12.0) (2022-01-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.11.0...4.12.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Invoice Customization) [#654](https://github.com/recurly/recurly-client-php/pull/654) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#651](https://github.com/recurly/recurly-client-php/pull/651) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.11.0](https://github.com/recurly/recurly-client-php/tree/4.11.0) (2021-12-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.10.0...4.11.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Tax Inclusive Pricing) [#650](https://github.com/recurly/recurly-client-php/pull/650) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.10.0](https://github.com/recurly/recurly-client-php/tree/4.10.0) (2021-11-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.9.0...4.10.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#647](https://github.com/recurly/recurly-client-php/pull/647) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#645](https://github.com/recurly/recurly-client-php/pull/645) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#644](https://github.com/recurly/recurly-client-php/pull/644) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#639](https://github.com/recurly/recurly-client-php/pull/639) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.9.0](https://github.com/recurly/recurly-client-php/tree/4.9.0) (2021-09-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.8.0...4.9.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Support to new subscription fields and response) [#633](https://github.com/recurly/recurly-client-php/pull/633) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.8.0](https://github.com/recurly/recurly-client-php/tree/4.8.0) (2021-09-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.7.0...4.8.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Dunning Campaigns feature) [#632](https://github.com/recurly/recurly-client-php/pull/632) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.7.0](https://github.com/recurly/recurly-client-php/tree/4.7.0) (2021-08-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.6.0...4.7.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (get_preview_renewal) [#630](https://github.com/recurly/recurly-client-php/pull/630) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.6.0](https://github.com/recurly/recurly-client-php/tree/4.6.0) (2021-08-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.5.0...4.6.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#628](https://github.com/recurly/recurly-client-php/pull/628) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.5.0](https://github.com/recurly/recurly-client-php/tree/4.5.0) (2021-08-02) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.4.0...4.5.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#623](https://github.com/recurly/recurly-client-php/pull/623) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixing issue with http_build_query converting booleans in params to integers [#621](https://github.com/recurly/recurly-client-php/pull/621) ([ZloeSabo](https://github.com/ZloeSabo)) ## [4.4.0](https://github.com/recurly/recurly-client-php/tree/4.4.0) (2021-06-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.3.0...4.4.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#613](https://github.com/recurly/recurly-client-php/pull/613) ([recurly-integrations](https://github.com/recurly-integrations)) - Add PHP 8.0 to travis matrix [#592](https://github.com/recurly/recurly-client-php/pull/592) ([douglasmiller](https://github.com/douglasmiller)) ## [4.3.0](https://github.com/recurly/recurly-client-php/tree/4.3.0) (2021-06-04) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.2.0...4.3.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#612](https://github.com/recurly/recurly-client-php/pull/612) ([recurly-integrations](https://github.com/recurly-integrations)) - Adding psr/log requirement to composer.json [#611](https://github.com/recurly/recurly-client-php/pull/611) ([douglasmiller](https://github.com/douglasmiller)) ## [4.2.0](https://github.com/recurly/recurly-client-php/tree/4.2.0) (2021-04-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.1.0...4.2.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#606](https://github.com/recurly/recurly-client-php/pull/606) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.1.0](https://github.com/recurly/recurly-client-php/tree/4.1.0) (2021-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.0.1...4.1.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Backup Payment Method) [#603](https://github.com/recurly/recurly-client-php/pull/603) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#599](https://github.com/recurly/recurly-client-php/pull/599) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (Usage Percentage on Tiers) [#598](https://github.com/recurly/recurly-client-php/pull/598) ([recurly-integrations](https://github.com/recurly-integrations)) diff --git a/composer.json b/composer.json index d662191..1b2ad9f 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,38 @@ { "name": "recurly/recurly-client", - "version": "4.44.0", + "version": "4.45.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], "homepage": "https://github.com/recurly/recurly-client-php", "license": "MIT", "authors": [], "require": { "php": ">= 7.2.0", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "phpcompatibility/php-compatibility": "^9.3", "phpdocumentor/phpdocumentor": "~3.0.0", "phpstan/phpstan": "^0.12.11", "phpunit/phpunit": "^8", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "classmap": ["lib"], "files": ["lib/recurly.php"] }, "autoload-dev": { "classmap": ["tests"] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/lib/recurly/version.php b/lib/recurly/version.php index bd9a981..3b586fb 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -1,8 +1,8 @@ <?php namespace Recurly; class Version { - public const CURRENT = '4.44.0'; + public const CURRENT = '4.45.0'; }
recurly/recurly-client-php
7da14305486a12bb7eedc28786d429e6bf88ee96
Generated Latest Changes for v2021-02-25
diff --git a/lib/recurly/resources/transaction_error.php b/lib/recurly/resources/transaction_error.php index 92dd4f3..ef3d703 100644 --- a/lib/recurly/resources/transaction_error.php +++ b/lib/recurly/resources/transaction_error.php @@ -1,211 +1,235 @@ <?php /** * This file is automatically created by Recurly's OpenAPI generation process * and thus any edits you make by hand will be lost. If you wish to make a * change to this file, please create a Github issue explaining the changes you * need and we will usher them to the appropriate places. */ namespace Recurly\Resources; use Recurly\RecurlyResource; // phpcs:disable class TransactionError extends RecurlyResource { private $_category; private $_code; private $_decline_code; + private $_fraud_info; private $_merchant_advice; private $_message; private $_object; private $_three_d_secure_action_token_id; private $_transaction_id; protected static $array_hints = [ ]; /** * Getter method for the category attribute. * Category * * @return ?string */ public function getCategory(): ?string { return $this->_category; } /** * Setter method for the category attribute. * * @param string $category * * @return void */ public function setCategory(string $category): void { $this->_category = $category; } /** * Getter method for the code attribute. * Code * * @return ?string */ public function getCode(): ?string { return $this->_code; } /** * Setter method for the code attribute. * * @param string $code * * @return void */ public function setCode(string $code): void { $this->_code = $code; } /** * Getter method for the decline_code attribute. * Decline code * * @return ?string */ public function getDeclineCode(): ?string { return $this->_decline_code; } /** * Setter method for the decline_code attribute. * * @param string $decline_code * * @return void */ public function setDeclineCode(string $decline_code): void { $this->_decline_code = $decline_code; } + /** + * Getter method for the fraud_info attribute. + * Fraud information + * + * @return ?\Recurly\Resources\TransactionFraudInfo + */ + public function getFraudInfo(): ?\Recurly\Resources\TransactionFraudInfo + { + return $this->_fraud_info; + } + + /** + * Setter method for the fraud_info attribute. + * + * @param \Recurly\Resources\TransactionFraudInfo $fraud_info + * + * @return void + */ + public function setFraudInfo(\Recurly\Resources\TransactionFraudInfo $fraud_info): void + { + $this->_fraud_info = $fraud_info; + } + /** * Getter method for the merchant_advice attribute. * Merchant message * * @return ?string */ public function getMerchantAdvice(): ?string { return $this->_merchant_advice; } /** * Setter method for the merchant_advice attribute. * * @param string $merchant_advice * * @return void */ public function setMerchantAdvice(string $merchant_advice): void { $this->_merchant_advice = $merchant_advice; } /** * Getter method for the message attribute. * Customer message * * @return ?string */ public function getMessage(): ?string { return $this->_message; } /** * Setter method for the message attribute. * * @param string $message * * @return void */ public function setMessage(string $message): void { $this->_message = $message; } /** * Getter method for the object attribute. * Object type * * @return ?string */ public function getObject(): ?string { return $this->_object; } /** * Setter method for the object attribute. * * @param string $object * * @return void */ public function setObject(string $object): void { $this->_object = $object; } /** * Getter method for the three_d_secure_action_token_id attribute. * Returned when 3-D Secure authentication is required for a transaction. Pass this value to Recurly.js so it can continue the challenge flow. * * @return ?string */ public function getThreeDSecureActionTokenId(): ?string { return $this->_three_d_secure_action_token_id; } /** * Setter method for the three_d_secure_action_token_id attribute. * * @param string $three_d_secure_action_token_id * * @return void */ public function setThreeDSecureActionTokenId(string $three_d_secure_action_token_id): void { $this->_three_d_secure_action_token_id = $three_d_secure_action_token_id; } /** * Getter method for the transaction_id attribute. * Transaction ID * * @return ?string */ public function getTransactionId(): ?string { return $this->_transaction_id; } /** * Setter method for the transaction_id attribute. * * @param string $transaction_id * * @return void */ public function setTransactionId(string $transaction_id): void { $this->_transaction_id = $transaction_id; } } \ No newline at end of file diff --git a/openapi/api.yaml b/openapi/api.yaml index 79ef24e..8a8a678 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -447,1025 +447,1025 @@ paths: Console.WriteLine(site.Subdomain); } - lang: Ruby source: | params = { limit: 200 } sites = @client.list_sites(params: params) sites.each do |site| puts "Site: #{site.subdomain}" end - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<Site> sites = client.listSites(params); for (Site site : sites) { System.out.println(site.getSubdomain()); } - lang: PHP source: | $options = [ 'params' => [ 'limit' => 200 ] ]; $sites = $client->listSites($options); foreach($sites as $site) { echo 'Site: ' . $site->getSubdomain() . PHP_EOL; } - lang: Go source: "listParams := &recurly.ListSitesParams{\n\tSort: recurly.String(\"created_at\"),\n\tOrder: recurly.String(\"asc\"),\n\tLimit: recurly.Int(200),\n}\n\nsites, err := client.ListSites(listParams)\nif err != nil {\n\tfmt.Println(\"Unexpected error: %v\", err)\n\treturn\n}\n\nfor sites.HasMore() {\n\terr := sites.Fetch()\n\tif e, ok := err.(*recurly.Error); ok {\n\t\tfmt.Printf(\"Failed to retrieve next page: %v\", e)\n\t\tbreak\n\t}\n\tfor i, site := range sites.Data() {\n\t\tfmt.Printf(\"Site %3d: %s, %s\\n\",\n\t\t\ti,\n\t\t\tsite.Id,\n\t\t\tsite.Subdomain,\n\t\t)\n\t}\n}" "/sites/{site_id}": get: operationId: get_site summary: Fetch a site tags: - site parameters: - "$ref": "#/components/parameters/site_id" responses: '200': description: A site. content: application/json: schema: "$ref": "#/components/schemas/Site" '404': description: Incorrect site ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const site = await client.getSite(siteId) console.log('Fetched site: ', site) } catch (err) { if (err instanceof recurly.errors.NotFoundError) { // If the request was not found, you may want to alert the user or // just return null console.log('Resource Not Found') } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: site = client.get_site(site_id) print("Got Site %s" % site) except recurly.errors.NotFoundError: # If the resource was not found, you may want to alert the user or # just return nil print("Resource Not Found") - lang: ".NET" source: | try { Site site = client.GetSite(siteId); Console.WriteLine($"Fetched site {site.Id}"); } catch (Recurly.Errors.NotFound ex) { // If the resource was not found // we may want to alert the user or just return null Console.WriteLine($"Resource Not Found: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin site = @client.get_site(site_id: site_id) puts "Got Site #{site}" rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end - lang: Java source: | try { final Site site = client.getSite(siteId); System.out.println("Fetched site: " + site.getId()); } catch (NotFoundException e) { // If the resource was not found // we may want to alert the user or just return null System.out.println("Resource Not Found: " + e.getError().getMessage()); } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $site = $client->getSite($site_id); echo 'Got Site:' . PHP_EOL; var_dump($site); } catch (\Recurly\Errors\NotFound $e) { // Could not find the resource, you may want to inform the user // or just return a NULL echo 'Could not find resource.' . PHP_EOL; var_dump($e); } catch (\Recurly\RecurlyError $e) { // Something bad happened... tell the user so that they can fix it? echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL; } - lang: Go source: "site, err := client.GetSite(siteID)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeNotFound {\n\t\tfmt.Printf(\"Resource not found: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\nfmt.Printf(\"Fetched Site: %s\", site.Id)" "/accounts": get: tags: - account operationId: list_accounts summary: List a site's accounts description: See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: - "$ref": "#/components/parameters/ids" - "$ref": "#/components/parameters/limit" - "$ref": "#/components/parameters/order" - "$ref": "#/components/parameters/sort_dates" - "$ref": "#/components/parameters/filter_begin_time" - "$ref": "#/components/parameters/filter_end_time" - "$ref": "#/components/parameters/filter_account_email" - "$ref": "#/components/parameters/filter_account_subscriber" - "$ref": "#/components/parameters/filter_account_past_due" responses: '200': description: A list of the site's accounts. content: application/json: schema: "$ref": "#/components/schemas/AccountList" '400': description: Invalid or unpermitted parameter. content: application/json: schema: "$ref": "#/components/schemas/Error" '404': description: Incorrect site ID. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | const accounts = client.listAccounts({ params: { limit: 200 } }) for await (const account of accounts.each()) { console.log(account.code) } - lang: Python source: | params = {"limit": 200} accounts = client.list_accounts(params=params).items() for account in accounts: print(account.code) - lang: ".NET" source: | var optionalParams = new ListAccountsParams() { Limit = 200 }; var accounts = client.ListAccounts(optionalParams); foreach(Account account in accounts) { Console.WriteLine(account.Code); } - lang: Ruby source: | params = { limit: 200 } accounts = @client.list_accounts(params: params) accounts.each do |account| puts "Account: #{account.code}" end - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time Pager<Account> accounts = client.listAccounts(params); for (Account acct : accounts) { System.out.println(acct.getCode()); } - lang: PHP source: | $options = [ 'params' => [ 'limit' => 200 ] ]; $accounts = $client->listAccounts($options); foreach($accounts as $account) { echo 'Account code: ' . $account->getCode() . PHP_EOL; } - lang: Go source: "listParams := &recurly.ListAccountsParams{\n\tSort: recurly.String(\"created_at\"),\n\tOrder: recurly.String(\"desc\"),\n\tLimit: recurly.Int(200),\n}\naccounts, err := client.ListAccounts(listParams)\nif err != nil {\n\tfmt.Println(\"Unexpected error: %v\", err)\n\treturn\n}\n\nfor accounts.HasMore() {\n\terr := accounts.Fetch()\n\tif e, ok := err.(*recurly.Error); ok {\n\t\tfmt.Printf(\"Failed to retrieve next page: %v\", e)\n\t\tbreak\n\t}\n\tfor i, account := range accounts.Data() {\n\t\tfmt.Printf(\"Account %3d: %s, %s\\n\",\n\t\t\ti,\n\t\t\taccount.Id,\n\t\t\taccount.Code,\n\t\t)\n\t}\n}" post: tags: - account operationId: create_account summary: Create an account requestBody: content: application/json: schema: "$ref": "#/components/schemas/AccountCreate" required: true responses: '201': description: An account. content: application/json: schema: "$ref": "#/components/schemas/Account" '400': description: Bad request, perhaps invalid JSON? content: application/json: schema: "$ref": "#/components/schemas/Error" '404': description: Incorrect site ID. content: application/json: schema: "$ref": "#/components/schemas/Error" '422': description: Invalid parameters or an error running the billing info verification transaction. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const accountCreate = { code: accountCode, firstName: 'Benjamin', lastName: 'Du Monde', preferredTimeZone: 'America/Chicago', address: { street1: '900 Camp St', city: 'New Orleans', region: 'LA', postalCode: '70115', country: 'US' } } const account = await client.createAccount(accountCreate) console.log('Created Account: ', account.code) } catch (err) { if (err instanceof recurly.errors.ValidationError) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params console.log('Failed validation', err.params) } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: account_create = { "code": account_code, "first_name": "Benjamin", "last_name": "Du Monde", "preferred_time_zone": "America/Chicago", "acquisition": { "campaign": "podcast-marketing", "channel": "social_media", "subchannel": "twitter", "cost": {"currency": "USD", "amount": 0.50}, }, "shipping_addresses": [ { "nickname": "Home", "street1": "1 Tchoupitoulas St", "city": "New Orleans", "region": "LA", "country": "US", "postal_code": "70115", "first_name": "Aaron", "last_name": "Du Monde", } ], } account = client.create_account(account_create) print("Created Account %s" % account) except recurly.errors.ValidationError as e: # If the request was invalid, you may want to tell your user # why. You can find the invalid params and reasons in e.error.params print("ValidationError: %s" % e.error.message) print(e.error.params) - lang: ".NET" source: | try { var accountReq = new AccountCreate() { Code = accountCode, FirstName = "Benjamin", LastName = "Du Monde", PreferredTimeZone = "America/Chicago", Address = new Address() { City = "New Orleans", Region = "LA", Country = "US", PostalCode = "70115", Street1 = "900 Camp St." } }; Account account = client.CreateAccount(accountReq); Console.WriteLine($"Created account {account.Code}"); } catch (Recurly.Errors.Validation ex) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in ex.Error.Params Console.WriteLine($"Failed validation: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin account_create = { code: account_code, first_name: "Benjamin", last_name: "Du Monde", preferred_time_zone: "America/Chicago", acquisition: { campaign: "podcast-marketing", channel: "social_media", subchannel: "twitter", cost: { currency: "USD", amount: 0.50 } }, shipping_addresses: [ { nickname: "Home", street1: "1 Tchoupitoulas St", city: "New Orleans", region: "LA", country: "US", postal_code: "70115", first_name: "Benjamin", last_name: "Du Monde" } ] } account = @client.create_account(body: account_create) puts "Created Account #{account}" rescue Recurly::Errors::ValidationError => e # If the request was invalid, you may want to tell your user # why. You can find the invalid params and reasons in e.recurly_error.params puts "ValidationError: #{e.recurly_error.params}" end - lang: Java source: | try { AccountCreate accountReq = new AccountCreate(); Address address = new Address(); accountReq.setCode(accountCode); accountReq.setFirstName("Aaron"); accountReq.setLastName("Du Monde"); accountReq.setPreferredTimeZone("America/Chicago"); address.setStreet1("900 Camp St."); address.setCity("New Orleans"); address.setRegion("LA"); address.setCountry("US"); address.setPostalCode("70115"); accountReq.setAddress(address); Account account = client.createAccount(accountReq); System.out.println("Created account " + account.getCode()); } catch (ValidationException e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in e.getError().getParams() System.out.println("Failed validation: " + e.getError().getMessage()); } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $account_create = [ "code" => $account_code, "first_name" => "Douglas", "last_name" => "DuMonde", "preferred_time_zone" => "America/Chicago", "shipping_addresses" => [ [ "first_name" => "Douglas", "last_name" => "DuMonde", "nickname" => "nola", "street1" => "1 Tchoupitoulas", "city" => "New Orleans", "postal_code" => "70130", "country" => "US" ] ] ]; $account = $client->createAccount($account_create); echo 'Created Account:' . PHP_EOL; var_dump($account); } catch (\Recurly\Errors\Validation $e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params var_dump($e); } catch (\Recurly\RecurlyError $e) { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it var_dump($e); } - lang: Go source: "accountReq := &recurly.AccountCreate{\n\tCode: &accountCode,\n\tFirstName: recurly.String(\"Isaac\"),\n\tLastName: recurly.String(\"Du Monde\"),\n\tEmail: \ recurly.String(\"[email protected]\"),\n\tPreferredTimeZone: recurly.String(\"America/Los_Angeles\"),\n\tBillingInfo: &recurly.BillingInfoCreate{\n\t\tFirstName: recurly.String(\"Isaac\"),\n\t\tLastName: \ recurly.String(\"Du Monde\"),\n\t\tAddress: &recurly.AddressCreate{\n\t\t\tPhone: \ recurly.String(\"415-555-5555\"),\n\t\t\tStreet1: recurly.String(\"400 Alabama St.\"),\n\t\t\tCity: recurly.String(\"San Francisco\"),\n\t\t\tPostalCode: recurly.String(\"94110\"),\n\t\t\tCountry: recurly.String(\"US\"),\n\t\t\tRegion: \ recurly.String(\"CA\"),\n\t\t},\n\t\tNumber: recurly.String(\"4111111111111111\"),\n\t\tMonth: - \ recurly.String(\"12\"),\n\t\tYear: recurly.String(\"22\"),\n\t\tCvv: + \ recurly.String(\"12\"),\n\t\tYear: recurly.String(\"30\"),\n\t\tCvv: \ recurly.String(\"123\"),\n\t},\n}\n\naccount, err := client.CreateAccount(accountReq)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeValidation {\n\t\tfmt.Printf(\"Failed validation: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\nfmt.Printf(\"Created Account: %s\", account.Id)" "/accounts/{account_id}": parameters: - "$ref": "#/components/parameters/account_id" get: tags: - account operationId: get_account summary: Fetch an account responses: '200': description: An account. content: application/json: schema: "$ref": "#/components/schemas/Account" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const account = await client.getAccount(accountId) console.log('Fetched account: ', account.code) } catch (err) { if (err instanceof recurly.errors.NotFoundError) { // If the request was not found, you may want to alert the user or // just return null console.log('Resource Not Found') } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: account = client.get_account(account_id) print("Got Account %s" % account) except recurly.errors.NotFoundError: # If the resource was not found, you may want to alert the user or # just return nil print("Resource Not Found") - lang: ".NET" source: | try { Account account = client.GetAccount(accountId); Console.WriteLine($"Fetched account {account.Code}"); } catch (Recurly.Errors.NotFound ex) { // If the resource was not found // we may want to alert the user or just return null Console.WriteLine($"Resource Not Found: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin account = @client.get_account(account_id: account_id) puts "Got Account #{account}" rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end - lang: Java source: | try { final Account account = client.getAccount(accountId); System.out.println("Fetched account: " + account.getCode()); } catch (NotFoundException e) { // If the resource was not found // we may want to alert the user or just return null System.out.println("Resource Not Found: " + e.getError().getMessage()); } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $account = $client->getAccount($account_id); echo 'Got Account:' . PHP_EOL; var_dump($account); } catch (\Recurly\Errors\NotFound $e) { // Could not find the resource, you may want to inform the user // or just return a NULL echo 'Could not find resource.' . PHP_EOL; var_dump($e); } catch (\Recurly\RecurlyError $e) { // Something bad happened... tell the user so that they can fix it? echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL; } - lang: Go source: "account, err := client.GetAccount(accountID)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeNotFound {\n\t\tfmt.Printf(\"Resource not found: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\nfmt.Println(\"Fetched Account \", account.Id)" put: tags: - account operationId: update_account summary: Update an account requestBody: content: application/json: schema: "$ref": "#/components/schemas/AccountUpdate" required: true responses: '200': description: An account. content: application/json: schema: "$ref": "#/components/schemas/Account" '400': description: Bad request, perhaps invalid JSON? content: application/json: schema: "$ref": "#/components/schemas/Error" '404': description: Incorrect site or account ID. content: application/json: schema: "$ref": "#/components/schemas/Error" '422': description: Invalid parameters or an error running the billing info verification transaction. content: application/json: schema: "$ref": "#/components/schemas/ErrorMayHaveTransaction" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const accountUpdate = { firstName: 'Aaron', lastName: 'Du Monde' } const account = await client.updateAccount(accountId, accountUpdate) console.log('Updated account: ', account) } catch (err) { if (err instanceof recurly.errors.ValidationError) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params console.log('Failed validation', err.params) } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: account_update = {"first_name": "Aaron", "last_name": "Du Monde"} account = client.update_account(account_id, account_update) print("Updated Account %s" % account) except recurly.errors.ValidationError as e: # If the request was invalid, you may want to tell your user # why. You can find the invalid params and reasons in e.error.params print("ValidationError: %s" % e.error.message) print(e.error.params) - lang: ".NET" source: | try { var accountReq = new AccountUpdate() { FirstName = "Aaron", LastName = "Du Monde" }; Account account = client.UpdateAccount(accountId, accountReq); Console.WriteLine(account.FirstName); Console.WriteLine(account.LastName); } catch (Recurly.Errors.Validation ex) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in ex.Error.Params Console.WriteLine($"Failed validation: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin account_update = { first_name: "Aaron", last_name: "Du Monde", } account = @client.update_account( account_id: account_id, body: account_update ) puts "Updated Account #{account}" rescue Recurly::Errors::ValidationError => e # If the request was invalid, you may want to tell your user # why. You can find the invalid params and reasons in e.recurly_error.params puts "ValidationError: #{e.recurly_error.params}" end - lang: Java source: | try { final AccountUpdate accountUpdate = new AccountUpdate(); accountUpdate.setFirstName("Aaron"); accountUpdate.setLastName("Du Monde"); final Account account = client.updateAccount(accountId, accountUpdate); System.out.println("Updated account: " + account.getCode()); System.out.println(account.getFirstName()); System.out.println(account.getLastName()); } catch (ValidationException e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in e.getError().getParams() System.out.println("Failed validation: " + e.getError().getMessage()); } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $account_update = [ "first_name" => "Douglas", "last_name" => "Du Monde", ]; $account = $client->updateAccount($account_id, $account_update); echo 'Updated Account:' . PHP_EOL; var_dump($account); } catch (\Recurly\Errors\Validation $e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in err.params var_dump($e); } catch (\Recurly\RecurlyError $e) { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it var_dump($e); } - lang: Go source: "updateReq := &recurly.AccountUpdate{\n\tFirstName: recurly.String(\"Joanna\"),\n\tLastName: \ recurly.String(\"DuMonde\"),\n}\naccount, err := client.UpdateAccount(accountID, updateReq)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeValidation {\n\t\tfmt.Printf(\"Failed validation: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\nfmt.Printf(\"Updated Account: %s\", account.Id)" delete: tags: - account operationId: deactivate_account summary: Deactivate an account description: Deactivating an account permanently deletes its billing information and cancels any active subscriptions (canceled subscriptions will remain active until the end of the current billing cycle before expiring). We recommend closing accounts only when all business is concluded with a customer. responses: '200': description: An account. content: application/json: schema: "$ref": "#/components/schemas/Account" '422': description: Account may already be inactive. content: application/json: schema: "$ref": "#/components/schemas/Error" default: description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const account = await client.deactivateAccount(accountId) console.log('Deleted account: ', account.code) } catch (err) { if (err && err.type === 'not-found') { // If the request was not found, you may want to alert the user or // just return null console.log('Resource Not Found') } // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it throw err } - lang: Python source: | try: account = client.deactivate_account(account_id) print("Deactivated Account %s" % account) except recurly.errors.NotFoundError: # If the resource was not found, you may want to alert the user or # just return nil print("Resource Not Found") - lang: ".NET" source: | try { Account account = client.DeactivateAccount(accountId); Console.WriteLine($"Deactivated account {account.Code}"); } catch (Recurly.Errors.Validation ex) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in ex.Error.Params Console.WriteLine($"Failed validation: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin account = @client.deactivate_account(account_id: account_id) puts "Deactivated Account #{account}" rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end - lang: Java source: | try { Account account = client.deactivateAccount(accountId); System.out.println("deactivated account " + account.getCode()); } catch (ValidationException e) { // If the request was not valid, you may want to tell your user // why. You can find the invalid params and reasons in e.getError().getParams() System.out.println("Failed validation: " + e.getError().getMessage()); } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $account = $client->deactivateAccount($account_id); echo 'Deactivated Account:' . PHP_EOL; var_dump($account); } catch (\Recurly\Errors\NotFound $e) { // Could not find the resource, you may want to inform the user // or just return a NULL echo 'Could not find resource.' . PHP_EOL; var_dump($e); } catch (\Recurly\RecurlyError $e) { // Something bad happened... tell the user so that they can fix it? echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL; } - lang: Go source: "account, err := client.DeactivateAccount(accountID)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeNotFound {\n\t\tfmt.Printf(\"Resource not found: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\nfmt.Printf(\"Deactivated Account: %s\", account.Id)" "/accounts/{account_id}/acquisition": parameters: - "$ref": "#/components/parameters/account_id" get: tags: - account_acquisition operationId: get_account_acquisition summary: Fetch an account's acquisition data responses: '200': description: An account's acquisition data. content: application/json: schema: "$ref": "#/components/schemas/AccountAcquisition" '404': description: Account has no acquisition data, or incorrect site or account ID. content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - lang: Node.js source: | try { const acquisition = await client.getAccountAcquisition(accountId) console.log('Fetched account acquisition: ', acquisition.id) } catch (err) { if (err instanceof recurly.errors.NotFoundError) { // If the request was not found, you may want to alert the user or // just return null console.log('Resource Not Found') } else { // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - lang: Python source: | try: acquisition = client.get_account_acquisition(account_id) print("Got AccountAcquisition %s" % acquisition) except recurly.errors.NotFoundError: # If the resource was not found, you may want to alert the user or # just return nil print("Resource Not Found") - lang: ".NET" source: | try { AccountAcquisition acquisition = client.GetAccountAcquisition(accountId); Console.WriteLine($"Fetched account acquisition {acquisition.Id}"); } catch (Recurly.Errors.NotFound ex) { // If the resource was not found // we may want to alert the user or just return null Console.WriteLine($"Resource Not Found: {ex.Error.Message}"); } catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - lang: Ruby source: | begin @client.get_account_acquisition(account_id: account_id) puts "Got AccountAcquisition" rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end - lang: Java source: | try { final AccountAcquisition acquisition = client.getAccountAcquisition(accountId); System.out.println("Fetched account acquisition " + acquisition.getId()); } catch (NotFoundException e) { // If the resource was not found // we may want to alert the user or just return null System.out.println("Resource Not Found: " + e.getError().getMessage()); } catch (ApiException e) { // Use ApiException to catch a generic error from the API System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); } - lang: PHP source: | try { $acquisition = $client->getAccountAcquisition($account_id); echo 'Got Account Acquisition:' . PHP_EOL; var_dump($acquisition); } catch (\Recurly\Errors\NotFound $e) { // Could not find the resource, you may want to inform the user // or just return a NULL echo 'Could not find resource.' . PHP_EOL; var_dump($e); } catch (\Recurly\RecurlyError $e) { // Something bad happened... tell the user so that they can fix it? echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL; } - lang: Go source: "accountAcq, err := client.GetAccountAcquisition(accountID)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeNotFound {\n\t\tfmt.Printf(\"Resource not found: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\nfmt.Printf(\"Fetched Account Acquisition: %v\", accountAcq.Id)" put: tags: - account_acquisition operationId: update_account_acquisition summary: Update an account's acquisition data requestBody: content: application/json: @@ -24324,1024 +24324,1026 @@ components: object: type: string title: Object Type id: type: string description: The ID of the subscription or external subscription that grants the permission to the account. InvoiceTemplateList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/InvoiceTemplate" InvoiceTemplate: type: object description: Settings for an invoice template. properties: id: type: string code: type: string description: Invoice template code. name: type: string description: Invoice template name. description: type: string description: Invoice template description. created_at: type: string format: date-time description: When the invoice template was created in Recurly. updated_at: type: string format: date-time description: When the invoice template was updated in Recurly. PaymentMethod: properties: object: "$ref": "#/components/schemas/PaymentMethodEnum" card_type: description: Visa, MasterCard, American Express, Discover, JCB, etc. "$ref": "#/components/schemas/CardTypeEnum" first_six: type: string description: Credit card number's first six digits. maxLength: 6 last_four: type: string description: Credit card number's last four digits. Will refer to bank account if payment method is ACH. maxLength: 4 last_two: type: string description: The IBAN bank account's last two digits. maxLength: 2 exp_month: type: integer description: Expiration month. maxLength: 2 exp_year: type: integer description: Expiration year. maxLength: 4 gateway_token: type: string description: A token used in place of a credit card in order to perform transactions. maxLength: 50 cc_bin_country: type: string description: The 2-letter ISO 3166-1 alpha-2 country code associated with the credit card BIN, if known by Recurly. Available on the BillingInfo object only. Available when the BIN country lookup feature is enabled. gateway_code: type: string description: An identifier for a specific payment gateway. maxLength: 13 gateway_attributes: type: object description: Gateway specific attributes associated with this PaymentMethod x-class-name: GatewayAttributes properties: account_reference: type: string description: Used by Adyen and Braintree gateways. For Adyen the Shopper Reference value used when the external token was created. For Braintree the PayPal PayerID is populated in the response. maxLength: 264 billing_agreement_id: type: string description: Billing Agreement identifier. Only present for Amazon or Paypal payment methods. name_on_account: type: string description: The name associated with the bank account. account_type: description: The bank account type. Only present for ACH payment methods. "$ref": "#/components/schemas/AccountTypeEnum" routing_number: type: string description: The bank account's routing number. Only present for ACH payment methods. routing_number_bank: type: string description: The bank name of this routing number. username: type: string description: Username of the associated payment method. Currently only associated with Venmo. BusinessEntityList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/BusinessEntity" BusinessEntity: type: object description: Business entity details properties: id: title: Business entity ID type: string maxLength: 13 readOnly: true object: title: Object type type: string readOnly: true code: title: Business entity code type: string maxLength: 50 description: The entity code of the business entity. name: type: string title: Name description: This name describes your business entity and will appear on the invoice. maxLength: 255 invoice_display_address: title: Invoice display address description: Address information for the business entity that will appear on the invoice. "$ref": "#/components/schemas/Address" tax_address: title: Tax address description: Address information for the business entity that will be used for calculating taxes. "$ref": "#/components/schemas/Address" default_vat_number: type: string title: Default VAT number description: VAT number for the customer used on the invoice. maxLength: 20 default_registration_number: type: string title: Default registration number description: Registration number for the customer used on the invoice. maxLength: 30 subscriber_location_countries: type: array title: Subscriber location countries description: List of countries for which the business entity will be used. items: type: string title: Country code created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true GiftCardList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/GiftCard" GiftCard: type: object description: Gift card details properties: id: title: Gift card ID type: string maxLength: 13 readOnly: true object: title: Object type type: string readOnly: true gifter_account_id: title: Gifter account ID type: string maxLength: 13 description: The ID of the account that purchased the gift card. recipient_account_id: title: Recipient account ID type: string maxLength: 13 description: The ID of the account that redeemed the gift card redemption code. Does not have a value until gift card is redeemed. purchase_invoice_id: title: Purchase invoice ID type: string maxLength: 13 description: The ID of the invoice for the gift card purchase made by the gifter. redemption_invoice_id: title: Redemption invoice ID type: string maxLength: 13 description: The ID of the invoice for the gift card redemption made by the recipient. Does not have a value until gift card is redeemed. redemption_code: title: Redemption code type: string description: The unique redemption code for the gift card, generated by Recurly. Will be 16 characters, alphanumeric, displayed uppercase, but accepted in any case at redemption. Used by the recipient account to create a credit in the amount of the `unit_amount` on their account. balance: title: Remaining balance type: number format: float description: The remaining credit on the recipient account associated with this gift card. Only has a value once the gift card has been redeemed. Can be used to create gift card balance displays for your customers. product_code: title: Product code type: string description: The product code or SKU of the gift card product. unit_amount: title: Purchase unit amount type: number format: float description: The amount of the gift card, which is the amount of the charge to the gifter account and the amount of credit that is applied to the recipient account upon successful redemption. currency: title: Currency type: string description: 3-letter ISO 4217 currency code. maxLength: 3 delivery: title: Delivery details description: The delivery details for the gift card. readOnly: true "$ref": "#/components/schemas/GiftCardDelivery" created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true delivered_at: type: string format: date-time title: Delivered at readOnly: true description: When the gift card was sent to the recipient by Recurly via email, if method was email and the "Gift Card Delivery" email template was enabled. This will be empty for post delivery or email delivery where the email template was disabled. redeemed_at: type: string format: date-time title: Redeemed at readOnly: true description: When the gift card was redeemed by the recipient. canceled_at: type: string format: date-time title: Canceled at readOnly: true description: When the gift card was canceled. GiftCardCreate: type: object description: Gift card details properties: product_code: title: Product code type: string description: The product code or SKU of the gift card product. unit_amount: title: Purchase unit amount type: number format: float description: The amount of the gift card, which is the amount of the charge to the gifter account and the amount of credit that is applied to the recipient account upon successful redemption. currency: title: Currency type: string description: 3-letter ISO 4217 currency code. maxLength: 3 delivery: title: Delivery details description: The delivery details for the gift card. readOnly: true "$ref": "#/components/schemas/GiftCardDeliveryCreate" gifter_account: title: Gifter account details description: Block of account details for the gifter. This references an existing account_code. readOnly: true "$ref": "#/components/schemas/AccountPurchase" required: - product_code - unit_amount - currency - delivery - gifter_account GiftCardDeliveryCreate: type: object description: Gift card delivery details properties: method: title: Delivery method description: Whether the delivery method is email or postal service. "$ref": "#/components/schemas/DeliveryMethodEnum" email_address: title: Recipient email address type: string description: The email address of the recipient. Required if `method` is `email`. deliver_at: type: string format: date-time title: Deliver at readOnly: true description: When the gift card should be delivered to the recipient. If null, the gift card will be delivered immediately. If a datetime is provided, the delivery will be in an hourly window, rounding down. For example, 6:23 pm will be in the 6:00 pm hourly batch. first_name: title: Recipient first name type: string description: The first name of the recipient. last_name: title: Recipient last name type: string description: The last name of the recipient. recipient_address: title: Recipient address description: Address information for the recipient. Required if `method` is `post`. "$ref": "#/components/schemas/Address" gifter_name: title: Gifter name type: string description: The name of the gifter for the purpose of a message displayed to the recipient. personal_message: title: Personal message type: string maxLength: 255 description: The personal message from the gifter to the recipient. required: - method GiftCardDelivery: type: object description: Gift card delivery details properties: method: title: Delivery method description: Whether the delivery method is email or postal service. "$ref": "#/components/schemas/DeliveryMethodEnum" email_address: title: Recipient email address type: string description: The email address of the recipient. deliver_at: type: string format: date-time title: Deliver at readOnly: true description: When the gift card should be delivered to the recipient. If null, the gift card will be delivered immediately. If a datetime is provided, the delivery will be in an hourly window, rounding down. For example, 6:23 pm will be in the 6:00 pm hourly batch. first_name: title: Recipient first name type: string description: The first name of the recipient. last_name: title: Recipient last name type: string description: The last name of the recipient. recipient_address: title: Recipient address description: Address information for the recipient. "$ref": "#/components/schemas/Address" gifter_name: title: Gifter name type: string description: The name of the gifter for the purpose of a message displayed to the recipient. personal_message: title: Personal message type: string maxLength: 255 description: The personal message from the gifter to the recipient. GiftCardRedeem: type: object description: The information necessary to redeem a gift card. properties: recipient_account: title: Recipient account description: The account for the recipient of the gift card. "$ref": "#/components/schemas/AccountReference" required: - recipient_account Error: type: object properties: type: title: Type "$ref": "#/components/schemas/ErrorTypeEnum" message: type: string title: Message params: type: array title: Parameter specific errors items: type: object properties: param: type: string ErrorMayHaveTransaction: allOf: - "$ref": "#/components/schemas/Error" - type: object properties: transaction_error: type: object x-class-name: TransactionError title: Transaction error details description: This is only included on errors with `type=transaction`. properties: object: type: string title: Object type transaction_id: type: string title: Transaction ID maxLength: 13 category: title: Category "$ref": "#/components/schemas/ErrorCategoryEnum" code: title: Code "$ref": "#/components/schemas/ErrorCodeEnum" decline_code: title: Decline code "$ref": "#/components/schemas/DeclineCodeEnum" message: type: string title: Customer message merchant_advice: type: string title: Merchant message three_d_secure_action_token_id: type: string title: 3-D Secure action token id description: Returned when 3-D Secure authentication is required for a transaction. Pass this value to Recurly.js so it can continue the challenge flow. maxLength: 22 + fraud_info: + "$ref": "#/components/schemas/TransactionFraudInfo" RelatedTypeEnum: type: string enum: - account - item - plan - subscription - charge RefundTypeEnum: type: string enum: - full - none - partial AlphanumericSortEnum: type: string enum: - asc - desc UsageSortEnum: type: string default: usage_timestamp enum: - recorded_timestamp - usage_timestamp UsageTypeEnum: type: string enum: - price - percentage title: Usage Type description: Type of usage, returns usage type if `add_on_type` is `usage`. UsageCalculationTypeEnum: type: string description: The type of calculation to be employed for an add-on. Cumulative billing will sum all usage records created in the current billing cycle. Last-in-period billing will apply only the most recent usage record in the billing period. If no value is specified, cumulative billing will be used. enum: - cumulative - last_in_period BillingStatusEnum: type: string default: unbilled enum: - unbilled - billed - all TimestampSortEnum: type: string enum: - created_at - updated_at ActiveStateEnum: type: string enum: - active - inactive FilterSubscriptionStateEnum: type: string enum: - active - canceled - expired - future - in_trial - live FilterLimitedSubscriptionStateEnum: type: string enum: - active - canceled - expired - future TrueEnum: type: string enum: - true LineItemStateEnum: type: string enum: - invoiced - pending LineItemTypeEnum: type: string enum: - charge - credit FilterTransactionTypeEnum: type: string enum: - authorization - capture - payment - purchase - refund - verify FilterInvoiceTypeEnum: type: string enum: - charge - credit - legacy - non-legacy ChannelEnum: type: string enum: - advertising - blog - direct_traffic - email - events - marketing_content - organic_search - other - outbound_sales - paid_search - public_relations - referral - social_media PreferredLocaleEnum: type: string enum: - da-DK - de-CH - de-DE - en-AU - en-CA - en-GB - en-IE - en-NZ - en-US - es-ES - es-MX - es-US - fi-FI - fr-BE - fr-CA - fr-CH - fr-FR - hi-IN - it-IT - ja-JP - ko-KR - nl-BE - nl-NL - pl-PL - pt-BR - pt-PT - ro-RO - ru-RU - sk-SK - sv-SE - tr-TR - zh-CN BillToEnum: type: string enum: - parent - self DeliveryMethodEnum: type: string enum: - email - post GatewayTransactionTypeEnum: type: string enum: - moto KountDecisionEnum: type: string enum: - approve - decline - escalate - review CouponStateEnum: type: string enum: - expired - maxed_out - redeemable CouponDurationEnum: type: string enum: - forever - single_use - temporal TemporalUnitEnum: type: string enum: - day - month - week - year FreeTrialUnitEnum: type: string enum: - day - month - week RedemptionResourceEnum: type: string enum: - account - subscription CouponTypeEnum: type: string enum: - bulk - single_code DiscountTypeEnum: type: string enum: - fixed - free_trial - percent AddOnSourceEnum: type: string title: Add-on source description: | Used to determine where the associated add-on data is pulled from. If this value is set to `plan_add_on` or left blank, then add-on data will be pulled from the plan's add-ons. If the associated `plan` has `allow_any_item_on_subscriptions` set to `true` and this field is set to `item`, then the associated add-on data will be pulled from the site's item catalog. default: plan_add_on enum: - plan_add_on - item AddOnTypeEnum: type: string enum: - fixed - usage title: Add-on Type description: Whether the add-on type is fixed, or usage-based. AddOnTypeCreateEnum: type: string enum: - fixed - usage title: Add-on Type description: Whether the add-on type is fixed, or usage-based. default: fixed UsageTypeCreateEnum: type: string enum: - price - percentage title: Usage Type description: | Type of usage, required if `add_on_type` is `usage`. See our [Guide](https://recurly.com/developers/guides/usage-based-billing-guide.html) for an overview of how to configure usage add-ons. TierTypeEnum: type: string title: Tier type description: | The pricing model for the add-on. For more information, [click here](https://docs.recurly.com/docs/billing-models#section-quantity-based). See our [Guide](https://recurly.com/developers/guides/item-addon-guide.html) for an overview of how to configure quantity-based pricing models. default: flat enum: - flat - tiered - stairstep - volume UsageTimeframeEnum: type: string title: Usage Timeframe description: The time at which usage totals are reset for billing purposes. enum: - billing_period - subscription_term default: billing_period UsageTimeframeCreateEnum: type: string title: Usage Timeframe description: | The time at which usage totals are reset for billing purposes. Allows for `tiered` add-ons to accumulate usage over the course of multiple billing periods. enum: - billing_period - subscription_term default: billing_period CreditPaymentActionEnum: type: string enum: - payment - reduction - refund - write_off UserAccessEnum: type: string enum: - api_only - read_only - write - set_only PricingModelTypeEnum: type: string enum: - fixed - ramp default: fixed description: | A fixed pricing model has the same price for each billing period. A ramp pricing model defines a set of Ramp Intervals, where a subscription changes price on a specified cadence of billing periods. The price change could be an increase or decrease. RevenueScheduleTypeEnum: type: string enum: - at_range_end - at_range_start - evenly - never NetTermsTypeEnum: type: string title: Net Terms Type description: | Optionally supplied string that may be either `net` or `eom` (end-of-month). When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date. When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month. This field is only available when the EOM Net Terms feature is enabled. enum: - net - eom default: net InvoiceTypeEnum: type: string enum: - charge - credit - legacy OriginEnum: type: string enum: - carryforward_credit - carryforward_gift_credit - credit - external_refund - gift_card - immediate_change - import - line_item_refund - open_amount_refund - prepayment - purchase - refund - renewal - termination - usage_correction - write_off InvoiceStateEnum: type: string enum: - open - pending - processing - past_due - paid - closed - failed - voided CollectionMethodEnum: type: string enum: - automatic - manual InvoiceRefundTypeEnum: type: string enum: - amount - line_items RefuneMethodEnum: type: string enum: - all_credit - all_transaction - credit_first - transaction_first ExternalPaymentMethodEnum: type: string enum: - bacs - ach - amazon - apple_pay - check - credit_card - eft - google_pay - money_order - other - paypal - roku - sepadirectdebit - wire_transfer LineItemRevenueScheduleTypeEnum: type: string enum: - at_invoice - at_range_end - at_range_start - evenly - never LegacyCategoryEnum: type: string enum: - applied_credit - carryforward - charge - credit LineItemOriginEnum: type: string enum: - add_on - add_on_trial - carryforward - coupon - credit - debit - one_time - plan - plan_trial - setup_fee - prepayment FullCreditReasonCodeEnum: type: string enum: - general - gift_card - promotional - refund - service - write_off PartialCreditReasonCodeEnum: type: string enum: - general - promotional - service LineItemCreateOriginEnum: type: string enum: - external_gift_card - prepayment IntervalUnitEnum: type: string enum: - days - months AddressRequirementEnum: type: string enum: - full - none - streetzip - zip SiteModeEnum: type: string enum: - development - production - sandbox FeaturesEnum: type: string enum: - credit_memos - manual_invoicing - only_bill_what_changed - subscription_terms SubscriptionStateEnum: type: string enum: - active - canceled - expired - failed - future - paused TimeframeEnum: type: string enum: - bill_date - term_end ChangeTimeframeEnum: type: string enum: - bill_date - now - renewal - term_end TransactionTypeEnum: type: string enum: - authorization - capture - purchase - refund - verify TransactionOriginEnum: type: string enum: - api - chargeback - external_recovery - force_collect - hpp
recurly/recurly-client-php
888e89e50cfde7fd8ef8c2e6b7ca53d69c32327d
4.44.0
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index fe44c0f..5e1ee66 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 4.43.0 +current_version = 4.44.0 parse = (?P<major>\d+) \.(?P<minor>\d+) \.(?P<patch>\d+) serialize = {major}.{minor}.{patch} [bumpversion:file:composer.json] [bumpversion:file:lib/recurly/version.php] diff --git a/CHANGELOG.md b/CHANGELOG.md index 66dd568..0d548ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,514 +1,525 @@ # Changelog +## [4.44.0](https://github.com/recurly/recurly-client-php/tree/4.44.0) (2024-01-18) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.43.0...4.44.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 [#788](https://github.com/recurly/recurly-client-php/pull/788) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.43.0](https://github.com/recurly/recurly-client-php/tree/4.43.0) (2023-12-06) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.42.0...4.43.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Payment Phases) [#785](https://github.com/recurly/recurly-client-php/pull/785) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.42.0](https://github.com/recurly/recurly-client-php/tree/4.42.0) (2023-11-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.41.0...4.42.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#783](https://github.com/recurly/recurly-client-php/pull/783) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.41.0](https://github.com/recurly/recurly-client-php/tree/4.41.0) (2023-08-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.40.0...4.41.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (`VATNumber`, `LifecycleDecline`) [#782](https://github.com/recurly/recurly-client-php/pull/782) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.40.0](https://github.com/recurly/recurly-client-php/tree/4.40.0) (2023-08-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.39.0...4.40.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (action_result) [#781](https://github.com/recurly/recurly-client-php/pull/781) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.39.0](https://github.com/recurly/recurly-client-php/tree/4.39.0) (2023-07-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.37.0...4.39.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Ramp Dates, Net Terms, Invoice Business Entity) [#779](https://github.com/recurly/recurly-client-php/pull/779) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (App Management - External Subscriptions) [#777](https://github.com/recurly/recurly-client-php/pull/777) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.37.0](https://github.com/recurly/recurly-client-php/tree/4.37.0) (2023-06-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.36.0...4.37.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Multiple Business Entities) [#769](https://github.com/recurly/recurly-client-php/pull/769) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.36.0](https://github.com/recurly/recurly-client-php/tree/4.36.0) (2023-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.35.0...4.36.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Products & References) [#766](https://github.com/recurly/recurly-client-php/pull/766) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.35.0](https://github.com/recurly/recurly-client-php/tree/4.35.0) (2023-05-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.34.0...4.35.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (gateway_attributes on PaymentMethod) [#764](https://github.com/recurly/recurly-client-php/pull/764) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#747](https://github.com/recurly/recurly-client-php/pull/747) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.28.0](https://github.com/recurly/recurly-client-php/tree/4.28.0) (2023-02-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.27.0...4.28.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (GiftCard endpoints and new transaction error support) [#745](https://github.com/recurly/recurly-client-php/pull/745) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.27.0](https://github.com/recurly/recurly-client-php/tree/4.27.0) (2023-01-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.26.0...4.27.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Custom Fields on Line Items) [#738](https://github.com/recurly/recurly-client-php/pull/738) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.26.0](https://github.com/recurly/recurly-client-php/tree/4.26.0) (2023-01-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.25.0...4.26.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Account Preferred Time Zone) [#736](https://github.com/recurly/recurly-client-php/pull/736) ([douglasmiller](https://github.com/douglasmiller)) ## [4.25.0](https://github.com/recurly/recurly-client-php/tree/4.25.0) (2022-11-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.24.0...4.25.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Apply Credit Balance feature) [#732](https://github.com/recurly/recurly-client-php/pull/732) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.24.0](https://github.com/recurly/recurly-client-php/tree/4.24.0) (2022-11-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.23.0...4.24.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Subscriptions feature) [#729](https://github.com/recurly/recurly-client-php/pull/729) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#728](https://github.com/recurly/recurly-client-php/pull/728) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.23.0](https://github.com/recurly/recurly-client-php/tree/4.23.0) (2022-10-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.22.0...4.23.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entitlements feature) [#725](https://github.com/recurly/recurly-client-php/pull/725) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.22.0](https://github.com/recurly/recurly-client-php/tree/4.22.0) (2022-10-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.2...4.22.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25(Decimal Usage and Quantities and DunningEvent new fields) [#722](https://github.com/recurly/recurly-client-php/pull/722) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.2](https://github.com/recurly/recurly-client-php/tree/4.21.2) (2022-09-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.1...4.21.2) **Merged Pull Requests** - feat: allow for psr/log ^2/3 [#716](https://github.com/recurly/recurly-client-php/pull/716) ([trickeyone](https://github.com/trickeyone)) ## [4.21.1](https://github.com/recurly/recurly-client-php/tree/4.21.1) (2022-09-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.0...4.21.1) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#714](https://github.com/recurly/recurly-client-php/pull/714) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.0](https://github.com/recurly/recurly-client-php/tree/4.21.0) (2022-09-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.20.0...4.21.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#713](https://github.com/recurly/recurly-client-php/pull/713) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixes bug with putDunningCampaignBulkUpdate [#706](https://github.com/recurly/recurly-client-php/pull/706) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.20.0](https://github.com/recurly/recurly-client-php/tree/4.20.0) (2022-08-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.19.0...4.20.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#701](https://github.com/recurly/recurly-client-php/pull/701) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.19.0](https://github.com/recurly/recurly-client-php/tree/4.19.0) (2022-07-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.18.0...4.19.0) **Merged Pull Requests** - Fixing deprecation warnings in client [#697](https://github.com/recurly/recurly-client-php/pull/697) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#695](https://github.com/recurly/recurly-client-php/pull/695) ([recurly-integrations](https://github.com/recurly-integrations)) **Closed Issues** - Recurly\Pager and \Iterator return type mismatch (PHP 8.1 deprecation) [#677](https://github.com/recurly/recurly-client-php/issues/677) ## [4.18.0](https://github.com/recurly/recurly-client-php/tree/4.18.0) (2022-06-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.17.0...4.18.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#693](https://github.com/recurly/recurly-client-php/pull/693) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.17.0](https://github.com/recurly/recurly-client-php/tree/4.17.0) (2022-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.16.0...4.17.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#679](https://github.com/recurly/recurly-client-php/pull/679) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.16.0](https://github.com/recurly/recurly-client-php/tree/4.16.0) (2022-03-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.15.0...4.16.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#676](https://github.com/recurly/recurly-client-php/pull/676) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.15.0](https://github.com/recurly/recurly-client-php/tree/4.15.0) (2022-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.14.0...4.15.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#668](https://github.com/recurly/recurly-client-php/pull/668) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.14.0](https://github.com/recurly/recurly-client-php/tree/4.14.0) (2022-03-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.13.0...4.14.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#664](https://github.com/recurly/recurly-client-php/pull/664) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.13.0](https://github.com/recurly/recurly-client-php/tree/4.13.0) (2022-01-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.12.0...4.13.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#655](https://github.com/recurly/recurly-client-php/pull/655) ([recurly-integrations](https://github.com/recurly-integrations)) - Add region argument to client to connect in EU data center [#653](https://github.com/recurly/recurly-client-php/pull/653) ([FabricioCoutinho](https://github.com/FabricioCoutinho)) ## [4.12.0](https://github.com/recurly/recurly-client-php/tree/4.12.0) (2022-01-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.11.0...4.12.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Invoice Customization) [#654](https://github.com/recurly/recurly-client-php/pull/654) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#651](https://github.com/recurly/recurly-client-php/pull/651) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.11.0](https://github.com/recurly/recurly-client-php/tree/4.11.0) (2021-12-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.10.0...4.11.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Tax Inclusive Pricing) [#650](https://github.com/recurly/recurly-client-php/pull/650) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.10.0](https://github.com/recurly/recurly-client-php/tree/4.10.0) (2021-11-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.9.0...4.10.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#647](https://github.com/recurly/recurly-client-php/pull/647) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#645](https://github.com/recurly/recurly-client-php/pull/645) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#644](https://github.com/recurly/recurly-client-php/pull/644) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#639](https://github.com/recurly/recurly-client-php/pull/639) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.9.0](https://github.com/recurly/recurly-client-php/tree/4.9.0) (2021-09-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.8.0...4.9.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Support to new subscription fields and response) [#633](https://github.com/recurly/recurly-client-php/pull/633) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.8.0](https://github.com/recurly/recurly-client-php/tree/4.8.0) (2021-09-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.7.0...4.8.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Dunning Campaigns feature) [#632](https://github.com/recurly/recurly-client-php/pull/632) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.7.0](https://github.com/recurly/recurly-client-php/tree/4.7.0) (2021-08-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.6.0...4.7.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (get_preview_renewal) [#630](https://github.com/recurly/recurly-client-php/pull/630) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.6.0](https://github.com/recurly/recurly-client-php/tree/4.6.0) (2021-08-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.5.0...4.6.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#628](https://github.com/recurly/recurly-client-php/pull/628) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.5.0](https://github.com/recurly/recurly-client-php/tree/4.5.0) (2021-08-02) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.4.0...4.5.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#623](https://github.com/recurly/recurly-client-php/pull/623) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixing issue with http_build_query converting booleans in params to integers [#621](https://github.com/recurly/recurly-client-php/pull/621) ([ZloeSabo](https://github.com/ZloeSabo)) ## [4.4.0](https://github.com/recurly/recurly-client-php/tree/4.4.0) (2021-06-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.3.0...4.4.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#613](https://github.com/recurly/recurly-client-php/pull/613) ([recurly-integrations](https://github.com/recurly-integrations)) - Add PHP 8.0 to travis matrix [#592](https://github.com/recurly/recurly-client-php/pull/592) ([douglasmiller](https://github.com/douglasmiller)) ## [4.3.0](https://github.com/recurly/recurly-client-php/tree/4.3.0) (2021-06-04) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.2.0...4.3.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#612](https://github.com/recurly/recurly-client-php/pull/612) ([recurly-integrations](https://github.com/recurly-integrations)) - Adding psr/log requirement to composer.json [#611](https://github.com/recurly/recurly-client-php/pull/611) ([douglasmiller](https://github.com/douglasmiller)) ## [4.2.0](https://github.com/recurly/recurly-client-php/tree/4.2.0) (2021-04-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.1.0...4.2.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#606](https://github.com/recurly/recurly-client-php/pull/606) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.1.0](https://github.com/recurly/recurly-client-php/tree/4.1.0) (2021-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.0.1...4.1.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Backup Payment Method) [#603](https://github.com/recurly/recurly-client-php/pull/603) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#599](https://github.com/recurly/recurly-client-php/pull/599) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (Usage Percentage on Tiers) [#598](https://github.com/recurly/recurly-client-php/pull/598) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.0.1](https://github.com/recurly/recurly-client-php/tree/4.0.1) (2021-03-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.0.0...4.0.1) **Merged Pull Requests** - Release 4.0.1 [#596](https://github.com/recurly/recurly-client-php/pull/596) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#595](https://github.com/recurly/recurly-client-php/pull/595) ([recurly-integrations](https://github.com/recurly-integrations)) - Sync updates not ported from 3.x client [#590](https://github.com/recurly/recurly-client-php/pull/590) ([douglasmiller](https://github.com/douglasmiller)) - Replace empty() with is_null() [#588](https://github.com/recurly/recurly-client-php/pull/588) ([joannasese](https://github.com/joannasese)) diff --git a/composer.json b/composer.json index e6f784a..d662191 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,38 @@ { "name": "recurly/recurly-client", - "version": "4.43.0", + "version": "4.44.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], "homepage": "https://github.com/recurly/recurly-client-php", "license": "MIT", "authors": [], "require": { "php": ">= 7.2.0", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "phpcompatibility/php-compatibility": "^9.3", "phpdocumentor/phpdocumentor": "~3.0.0", "phpstan/phpstan": "^0.12.11", "phpunit/phpunit": "^8", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "classmap": ["lib"], "files": ["lib/recurly.php"] }, "autoload-dev": { "classmap": ["tests"] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/lib/recurly/version.php b/lib/recurly/version.php index 9496435..bd9a981 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -1,8 +1,8 @@ <?php namespace Recurly; class Version { - public const CURRENT = '4.43.0'; + public const CURRENT = '4.44.0'; }
recurly/recurly-client-php
8514f2e12062b783b17147512c64b7352f6766d5
Generated Latest Changes for v2021-02-25
diff --git a/lib/recurly/resources/fraud_risk_rule.php b/lib/recurly/resources/fraud_risk_rule.php new file mode 100644 index 0000000..04aa583 --- /dev/null +++ b/lib/recurly/resources/fraud_risk_rule.php @@ -0,0 +1,67 @@ +<?php +/** + * This file is automatically created by Recurly's OpenAPI generation process + * and thus any edits you make by hand will be lost. If you wish to make a + * change to this file, please create a Github issue explaining the changes you + * need and we will usher them to the appropriate places. + */ +namespace Recurly\Resources; + +use Recurly\RecurlyResource; + +// phpcs:disable +class FraudRiskRule extends RecurlyResource +{ + private $_code; + private $_message; + + protected static $array_hints = [ + ]; + + + /** + * Getter method for the code attribute. + * The Kount rule number. + * + * @return ?string + */ + public function getCode(): ?string + { + return $this->_code; + } + + /** + * Setter method for the code attribute. + * + * @param string $code + * + * @return void + */ + public function setCode(string $code): void + { + $this->_code = $code; + } + + /** + * Getter method for the message attribute. + * Description of why the rule was triggered + * + * @return ?string + */ + public function getMessage(): ?string + { + return $this->_message; + } + + /** + * Setter method for the message attribute. + * + * @param string $message + * + * @return void + */ + public function setMessage(string $message): void + { + $this->_message = $message; + } +} \ No newline at end of file diff --git a/lib/recurly/resources/invoice.php b/lib/recurly/resources/invoice.php index df083cb..4ba269d 100644 --- a/lib/recurly/resources/invoice.php +++ b/lib/recurly/resources/invoice.php @@ -1,1030 +1,1033 @@ <?php /** * This file is automatically created by Recurly's OpenAPI generation process * and thus any edits you make by hand will be lost. If you wish to make a * change to this file, please create a Github issue explaining the changes you * need and we will usher them to the appropriate places. */ namespace Recurly\Resources; use Recurly\RecurlyResource; // phpcs:disable class Invoice extends RecurlyResource { private $_account; private $_address; private $_balance; private $_billing_info_id; private $_business_entity_id; private $_closed_at; private $_collection_method; private $_created_at; private $_credit_payments; private $_currency; private $_customer_notes; private $_discount; private $_due_at; private $_dunning_campaign_id; private $_dunning_events_sent; private $_final_dunning_event; private $_has_more_line_items; private $_id; private $_line_items; private $_net_terms; private $_net_terms_type; private $_number; private $_object; private $_origin; private $_paid; private $_po_number; private $_previous_invoice_id; private $_refundable_amount; private $_shipping_address; private $_state; private $_subscription_ids; private $_subtotal; private $_tax; private $_tax_info; private $_terms_and_conditions; private $_total; private $_transactions; private $_type; private $_updated_at; private $_used_tax_service; private $_uuid; private $_vat_number; private $_vat_reverse_charge_notes; protected static $array_hints = [ 'setCreditPayments' => '\Recurly\Resources\CreditPayment', 'setLineItems' => '\Recurly\Resources\LineItem', 'setSubscriptionIds' => 'string', 'setTransactions' => '\Recurly\Resources\Transaction', ]; /** * Getter method for the account attribute. * Account mini details * * @return ?\Recurly\Resources\AccountMini */ public function getAccount(): ?\Recurly\Resources\AccountMini { return $this->_account; } /** * Setter method for the account attribute. * * @param \Recurly\Resources\AccountMini $account * * @return void */ public function setAccount(\Recurly\Resources\AccountMini $account): void { $this->_account = $account; } /** * Getter method for the address attribute. * * * @return ?\Recurly\Resources\InvoiceAddress */ public function getAddress(): ?\Recurly\Resources\InvoiceAddress { return $this->_address; } /** * Setter method for the address attribute. * * @param \Recurly\Resources\InvoiceAddress $address * * @return void */ public function setAddress(\Recurly\Resources\InvoiceAddress $address): void { $this->_address = $address; } /** * Getter method for the balance attribute. * The outstanding balance remaining on this invoice. * * @return ?float */ public function getBalance(): ?float { return $this->_balance; } /** * Setter method for the balance attribute. * * @param float $balance * * @return void */ public function setBalance(float $balance): void { $this->_balance = $balance; } /** * Getter method for the billing_info_id attribute. * The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. * * @return ?string */ public function getBillingInfoId(): ?string { return $this->_billing_info_id; } /** * Setter method for the billing_info_id attribute. * * @param string $billing_info_id * * @return void */ public function setBillingInfoId(string $billing_info_id): void { $this->_billing_info_id = $billing_info_id; } /** * Getter method for the business_entity_id attribute. * Unique ID to identify the business entity assigned to the invoice. Available when the `Multiple Business Entities` feature is enabled. * * @return ?string */ public function getBusinessEntityId(): ?string { return $this->_business_entity_id; } /** * Setter method for the business_entity_id attribute. * * @param string $business_entity_id * * @return void */ public function setBusinessEntityId(string $business_entity_id): void { $this->_business_entity_id = $business_entity_id; } /** * Getter method for the closed_at attribute. * Date invoice was marked paid or failed. * * @return ?string */ public function getClosedAt(): ?string { return $this->_closed_at; } /** * Setter method for the closed_at attribute. * * @param string $closed_at * * @return void */ public function setClosedAt(string $closed_at): void { $this->_closed_at = $closed_at; } /** * Getter method for the collection_method attribute. * An automatic invoice means a corresponding transaction is run using the account's billing information at the same time the invoice is created. Manual invoices are created without a corresponding transaction. The merchant must enter a manual payment transaction or have the customer pay the invoice with an automatic method, like credit card, PayPal, Amazon, or ACH bank payment. * * @return ?string */ public function getCollectionMethod(): ?string { return $this->_collection_method; } /** * Setter method for the collection_method attribute. * * @param string $collection_method * * @return void */ public function setCollectionMethod(string $collection_method): void { $this->_collection_method = $collection_method; } /** * Getter method for the created_at attribute. * Created at * * @return ?string */ public function getCreatedAt(): ?string { return $this->_created_at; } /** * Setter method for the created_at attribute. * * @param string $created_at * * @return void */ public function setCreatedAt(string $created_at): void { $this->_created_at = $created_at; } /** * Getter method for the credit_payments attribute. * Credit payments * * @return array */ public function getCreditPayments(): array { return $this->_credit_payments ?? [] ; } /** * Setter method for the credit_payments attribute. * * @param array $credit_payments * * @return void */ public function setCreditPayments(array $credit_payments): void { $this->_credit_payments = $credit_payments; } /** * Getter method for the currency attribute. * 3-letter ISO 4217 currency code. * * @return ?string */ public function getCurrency(): ?string { return $this->_currency; } /** * Setter method for the currency attribute. * * @param string $currency * * @return void */ public function setCurrency(string $currency): void { $this->_currency = $currency; } /** * Getter method for the customer_notes attribute. * This will default to the Customer Notes text specified on the Invoice Settings. Specify custom notes to add or override Customer Notes. * * @return ?string */ public function getCustomerNotes(): ?string { return $this->_customer_notes; } /** * Setter method for the customer_notes attribute. * * @param string $customer_notes * * @return void */ public function setCustomerNotes(string $customer_notes): void { $this->_customer_notes = $customer_notes; } /** * Getter method for the discount attribute. * Total discounts applied to this invoice. * * @return ?float */ public function getDiscount(): ?float { return $this->_discount; } /** * Setter method for the discount attribute. * * @param float $discount * * @return void */ public function setDiscount(float $discount): void { $this->_discount = $discount; } /** * Getter method for the due_at attribute. * Date invoice is due. This is the date the net terms are reached. * * @return ?string */ public function getDueAt(): ?string { return $this->_due_at; } /** * Setter method for the due_at attribute. * * @param string $due_at * * @return void */ public function setDueAt(string $due_at): void { $this->_due_at = $due_at; } /** * Getter method for the dunning_campaign_id attribute. * Unique ID to identify the dunning campaign used when dunning the invoice. For sites without multiple dunning campaigns enabled, this will always be the default dunning campaign. * * @return ?string */ public function getDunningCampaignId(): ?string { return $this->_dunning_campaign_id; } /** * Setter method for the dunning_campaign_id attribute. * * @param string $dunning_campaign_id * * @return void */ public function setDunningCampaignId(string $dunning_campaign_id): void { $this->_dunning_campaign_id = $dunning_campaign_id; } /** * Getter method for the dunning_events_sent attribute. * Number of times the event was sent. * * @return ?int */ public function getDunningEventsSent(): ?int { return $this->_dunning_events_sent; } /** * Setter method for the dunning_events_sent attribute. * * @param int $dunning_events_sent * * @return void */ public function setDunningEventsSent(int $dunning_events_sent): void { $this->_dunning_events_sent = $dunning_events_sent; } /** * Getter method for the final_dunning_event attribute. * Last communication attempt. * * @return ?bool */ public function getFinalDunningEvent(): ?bool { return $this->_final_dunning_event; } /** * Setter method for the final_dunning_event attribute. * * @param bool $final_dunning_event * * @return void */ public function setFinalDunningEvent(bool $final_dunning_event): void { $this->_final_dunning_event = $final_dunning_event; } /** * Getter method for the has_more_line_items attribute. * Identifies if the invoice has more line items than are returned in `line_items`. If `has_more_line_items` is `true`, then a request needs to be made to the `list_invoice_line_items` endpoint. * * @return ?bool */ public function getHasMoreLineItems(): ?bool { return $this->_has_more_line_items; } /** * Setter method for the has_more_line_items attribute. * * @param bool $has_more_line_items * * @return void */ public function setHasMoreLineItems(bool $has_more_line_items): void { $this->_has_more_line_items = $has_more_line_items; } /** * Getter method for the id attribute. * Invoice ID * * @return ?string */ public function getId(): ?string { return $this->_id; } /** * Setter method for the id attribute. * * @param string $id * * @return void */ public function setId(string $id): void { $this->_id = $id; } /** * Getter method for the line_items attribute. * Line Items * * @return array */ public function getLineItems(): array { return $this->_line_items ?? [] ; } /** * Setter method for the line_items attribute. * * @param array $line_items * * @return void */ public function setLineItems(array $line_items): void { $this->_line_items = $line_items; } /** * Getter method for the net_terms attribute. * Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the -invoice will become past due. For any value, an additional 24 hours is +invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before -becoming past due. For example: +becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. +For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. -For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + +For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) +or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. * * @return ?int */ public function getNetTerms(): ?int { return $this->_net_terms; } /** * Setter method for the net_terms attribute. * * @param int $net_terms * * @return void */ public function setNetTerms(int $net_terms): void { $this->_net_terms = $net_terms; } /** * Getter method for the net_terms_type attribute. * Optionally supplied string that may be either `net` or `eom` (end-of-month). When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date. When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month. This field is only available when the EOM Net Terms feature is enabled. * * @return ?string */ public function getNetTermsType(): ?string { return $this->_net_terms_type; } /** * Setter method for the net_terms_type attribute. * * @param string $net_terms_type * * @return void */ public function setNetTermsType(string $net_terms_type): void { $this->_net_terms_type = $net_terms_type; } /** * Getter method for the number attribute. * If VAT taxation and the Country Invoice Sequencing feature are enabled, invoices will have country-specific invoice numbers for invoices billed to EU countries (ex: FR1001). Non-EU invoices will continue to use the site-level invoice number sequence. * * @return ?string */ public function getNumber(): ?string { return $this->_number; } /** * Setter method for the number attribute. * * @param string $number * * @return void */ public function setNumber(string $number): void { $this->_number = $number; } /** * Getter method for the object attribute. * Object type * * @return ?string */ public function getObject(): ?string { return $this->_object; } /** * Setter method for the object attribute. * * @param string $object * * @return void */ public function setObject(string $object): void { $this->_object = $object; } /** * Getter method for the origin attribute. * The event that created the invoice. * * @return ?string */ public function getOrigin(): ?string { return $this->_origin; } /** * Setter method for the origin attribute. * * @param string $origin * * @return void */ public function setOrigin(string $origin): void { $this->_origin = $origin; } /** * Getter method for the paid attribute. * The total amount of successful payments transaction on this invoice. * * @return ?float */ public function getPaid(): ?float { return $this->_paid; } /** * Setter method for the paid attribute. * * @param float $paid * * @return void */ public function setPaid(float $paid): void { $this->_paid = $paid; } /** * Getter method for the po_number attribute. * For manual invoicing, this identifies the PO number associated with the subscription. * * @return ?string */ public function getPoNumber(): ?string { return $this->_po_number; } /** * Setter method for the po_number attribute. * * @param string $po_number * * @return void */ public function setPoNumber(string $po_number): void { $this->_po_number = $po_number; } /** * Getter method for the previous_invoice_id attribute. * On refund invoices, this value will exist and show the invoice ID of the purchase invoice the refund was created from. This field is only populated for sites without the [Only Bill What Changed](https://docs.recurly.com/docs/only-bill-what-changed) feature enabled. Sites with Only Bill What Changed enabled should use the [related_invoices endpoint](https://recurly.com/developers/api/v2021-02-25/index.html#operation/list_related_invoices) to see purchase invoices refunded by this invoice. * * @return ?string */ public function getPreviousInvoiceId(): ?string { return $this->_previous_invoice_id; } /** * Setter method for the previous_invoice_id attribute. * * @param string $previous_invoice_id * * @return void */ public function setPreviousInvoiceId(string $previous_invoice_id): void { $this->_previous_invoice_id = $previous_invoice_id; } /** * Getter method for the refundable_amount attribute. * The refundable amount on a charge invoice. It will be null for all other invoices. * * @return ?float */ public function getRefundableAmount(): ?float { return $this->_refundable_amount; } /** * Setter method for the refundable_amount attribute. * * @param float $refundable_amount * * @return void */ public function setRefundableAmount(float $refundable_amount): void { $this->_refundable_amount = $refundable_amount; } /** * Getter method for the shipping_address attribute. * * * @return ?\Recurly\Resources\ShippingAddress */ public function getShippingAddress(): ?\Recurly\Resources\ShippingAddress { return $this->_shipping_address; } /** * Setter method for the shipping_address attribute. * * @param \Recurly\Resources\ShippingAddress $shipping_address * * @return void */ public function setShippingAddress(\Recurly\Resources\ShippingAddress $shipping_address): void { $this->_shipping_address = $shipping_address; } /** * Getter method for the state attribute. * Invoice state * * @return ?string */ public function getState(): ?string { return $this->_state; } /** * Setter method for the state attribute. * * @param string $state * * @return void */ public function setState(string $state): void { $this->_state = $state; } /** * Getter method for the subscription_ids attribute. * If the invoice is charging or refunding for one or more subscriptions, these are their IDs. * * @return array */ public function getSubscriptionIds(): array { return $this->_subscription_ids ?? [] ; } /** * Setter method for the subscription_ids attribute. * * @param array $subscription_ids * * @return void */ public function setSubscriptionIds(array $subscription_ids): void { $this->_subscription_ids = $subscription_ids; } /** * Getter method for the subtotal attribute. * The summation of charges and credits, before discounts and taxes. * * @return ?float */ public function getSubtotal(): ?float { return $this->_subtotal; } /** * Setter method for the subtotal attribute. * * @param float $subtotal * * @return void */ public function setSubtotal(float $subtotal): void { $this->_subtotal = $subtotal; } /** * Getter method for the tax attribute. * The total tax on this invoice. * * @return ?float */ public function getTax(): ?float { return $this->_tax; } /** * Setter method for the tax attribute. * * @param float $tax * * @return void */ public function setTax(float $tax): void { $this->_tax = $tax; } /** * Getter method for the tax_info attribute. * Only for merchants using Recurly's In-The-Box taxes. * * @return ?\Recurly\Resources\TaxInfo */ public function getTaxInfo(): ?\Recurly\Resources\TaxInfo { return $this->_tax_info; } /** * Setter method for the tax_info attribute. * * @param \Recurly\Resources\TaxInfo $tax_info * * @return void */ public function setTaxInfo(\Recurly\Resources\TaxInfo $tax_info): void { $this->_tax_info = $tax_info; } /** * Getter method for the terms_and_conditions attribute. * This will default to the Terms and Conditions text specified on the Invoice Settings page in your Recurly admin. Specify custom notes to add or override Terms and Conditions. * * @return ?string */ public function getTermsAndConditions(): ?string { return $this->_terms_and_conditions; } /** * Setter method for the terms_and_conditions attribute. * * @param string $terms_and_conditions * * @return void */ public function setTermsAndConditions(string $terms_and_conditions): void { $this->_terms_and_conditions = $terms_and_conditions; } /** * Getter method for the total attribute. * The final total on this invoice. The summation of invoice charges, discounts, credits, and tax. * * @return ?float */ public function getTotal(): ?float { return $this->_total; } /** * Setter method for the total attribute. * * @param float $total * * @return void */ public function setTotal(float $total): void { $this->_total = $total; } /** * Getter method for the transactions attribute. * Transactions * * @return array */ public function getTransactions(): array { return $this->_transactions ?? [] ; } /** * Setter method for the transactions attribute. * * @param array $transactions * * @return void */ public function setTransactions(array $transactions): void { $this->_transactions = $transactions; } /** * Getter method for the type attribute. * Invoices are either charge, credit, or legacy invoices. * * @return ?string */ public function getType(): ?string { return $this->_type; } /** * Setter method for the type attribute. * * @param string $type * * @return void */ public function setType(string $type): void { $this->_type = $type; } /** * Getter method for the updated_at attribute. * Last updated at * * @return ?string */ public function getUpdatedAt(): ?string { return $this->_updated_at; } /** * Setter method for the updated_at attribute. * * @param string $updated_at * * @return void */ public function setUpdatedAt(string $updated_at): void { $this->_updated_at = $updated_at; } /** * Getter method for the used_tax_service attribute. * Will be `true` when the invoice had a successful response from the tax service and `false` when the invoice was not sent to tax service due to a lack of address or enabled jurisdiction or was processed without tax due to a non-blocking error returned from the tax service. * * @return ?bool */ public function getUsedTaxService(): ?bool { return $this->_used_tax_service; } /** * Setter method for the used_tax_service attribute. * * @param bool $used_tax_service * * @return void */ public function setUsedTaxService(bool $used_tax_service): void { $this->_used_tax_service = $used_tax_service; } /** * Getter method for the uuid attribute. * Invoice UUID * * @return ?string */ public function getUuid(): ?string { return $this->_uuid; } /** * Setter method for the uuid attribute. * * @param string $uuid * * @return void */ public function setUuid(string $uuid): void { $this->_uuid = $uuid; } /** * Getter method for the vat_number attribute. * VAT registration number for the customer on this invoice. This will come from the VAT Number field in the Billing Info or the Account Info depending on your tax settings and the invoice collection method. * diff --git a/lib/recurly/resources/subscription.php b/lib/recurly/resources/subscription.php index 4460f1f..1f0570a 100644 --- a/lib/recurly/resources/subscription.php +++ b/lib/recurly/resources/subscription.php @@ -145,1034 +145,1037 @@ class Subscription extends RecurlyResource /** * Getter method for the active_invoice_id attribute. * The invoice ID of the latest invoice created for an active subscription. * * @return ?string */ public function getActiveInvoiceId(): ?string { return $this->_active_invoice_id; } /** * Setter method for the active_invoice_id attribute. * * @param string $active_invoice_id * * @return void */ public function setActiveInvoiceId(string $active_invoice_id): void { $this->_active_invoice_id = $active_invoice_id; } /** * Getter method for the add_ons attribute. * Add-ons * * @return array */ public function getAddOns(): array { return $this->_add_ons ?? [] ; } /** * Setter method for the add_ons attribute. * * @param array $add_ons * * @return void */ public function setAddOns(array $add_ons): void { $this->_add_ons = $add_ons; } /** * Getter method for the add_ons_total attribute. * Total price of add-ons * * @return ?float */ public function getAddOnsTotal(): ?float { return $this->_add_ons_total; } /** * Setter method for the add_ons_total attribute. * * @param float $add_ons_total * * @return void */ public function setAddOnsTotal(float $add_ons_total): void { $this->_add_ons_total = $add_ons_total; } /** * Getter method for the auto_renew attribute. * Whether the subscription renews at the end of its term. * * @return ?bool */ public function getAutoRenew(): ?bool { return $this->_auto_renew; } /** * Setter method for the auto_renew attribute. * * @param bool $auto_renew * * @return void */ public function setAutoRenew(bool $auto_renew): void { $this->_auto_renew = $auto_renew; } /** * Getter method for the bank_account_authorized_at attribute. * Recurring subscriptions paid with ACH will have this attribute set. This timestamp is used for alerting customers to reauthorize in 3 years in accordance with NACHA rules. If a subscription becomes inactive or the billing info is no longer a bank account, this timestamp is cleared. * * @return ?string */ public function getBankAccountAuthorizedAt(): ?string { return $this->_bank_account_authorized_at; } /** * Setter method for the bank_account_authorized_at attribute. * * @param string $bank_account_authorized_at * * @return void */ public function setBankAccountAuthorizedAt(string $bank_account_authorized_at): void { $this->_bank_account_authorized_at = $bank_account_authorized_at; } /** * Getter method for the billing_info_id attribute. * Billing Info ID. * * @return ?string */ public function getBillingInfoId(): ?string { return $this->_billing_info_id; } /** * Setter method for the billing_info_id attribute. * * @param string $billing_info_id * * @return void */ public function setBillingInfoId(string $billing_info_id): void { $this->_billing_info_id = $billing_info_id; } /** * Getter method for the canceled_at attribute. * Canceled at * * @return ?string */ public function getCanceledAt(): ?string { return $this->_canceled_at; } /** * Setter method for the canceled_at attribute. * * @param string $canceled_at * * @return void */ public function setCanceledAt(string $canceled_at): void { $this->_canceled_at = $canceled_at; } /** * Getter method for the collection_method attribute. * Collection method * * @return ?string */ public function getCollectionMethod(): ?string { return $this->_collection_method; } /** * Setter method for the collection_method attribute. * * @param string $collection_method * * @return void */ public function setCollectionMethod(string $collection_method): void { $this->_collection_method = $collection_method; } /** * Getter method for the converted_at attribute. * When the subscription was converted from a gift card. * * @return ?string */ public function getConvertedAt(): ?string { return $this->_converted_at; } /** * Setter method for the converted_at attribute. * * @param string $converted_at * * @return void */ public function setConvertedAt(string $converted_at): void { $this->_converted_at = $converted_at; } /** * Getter method for the coupon_redemptions attribute. * Returns subscription level coupon redemptions that are tied to this subscription. * * @return array */ public function getCouponRedemptions(): array { return $this->_coupon_redemptions ?? [] ; } /** * Setter method for the coupon_redemptions attribute. * * @param array $coupon_redemptions * * @return void */ public function setCouponRedemptions(array $coupon_redemptions): void { $this->_coupon_redemptions = $coupon_redemptions; } /** * Getter method for the created_at attribute. * Created at * * @return ?string */ public function getCreatedAt(): ?string { return $this->_created_at; } /** * Setter method for the created_at attribute. * * @param string $created_at * * @return void */ public function setCreatedAt(string $created_at): void { $this->_created_at = $created_at; } /** * Getter method for the currency attribute. * 3-letter ISO 4217 currency code. * * @return ?string */ public function getCurrency(): ?string { return $this->_currency; } /** * Setter method for the currency attribute. * * @param string $currency * * @return void */ public function setCurrency(string $currency): void { $this->_currency = $currency; } /** * Getter method for the current_period_ends_at attribute. * Current billing period ends at * * @return ?string */ public function getCurrentPeriodEndsAt(): ?string { return $this->_current_period_ends_at; } /** * Setter method for the current_period_ends_at attribute. * * @param string $current_period_ends_at * * @return void */ public function setCurrentPeriodEndsAt(string $current_period_ends_at): void { $this->_current_period_ends_at = $current_period_ends_at; } /** * Getter method for the current_period_started_at attribute. * Current billing period started at * * @return ?string */ public function getCurrentPeriodStartedAt(): ?string { return $this->_current_period_started_at; } /** * Setter method for the current_period_started_at attribute. * * @param string $current_period_started_at * * @return void */ public function setCurrentPeriodStartedAt(string $current_period_started_at): void { $this->_current_period_started_at = $current_period_started_at; } /** * Getter method for the current_term_ends_at attribute. * When the term ends. This is calculated by a plan's interval and `total_billing_cycles` in a term. Subscription changes with a `timeframe=renewal` will be applied on this date. * * @return ?string */ public function getCurrentTermEndsAt(): ?string { return $this->_current_term_ends_at; } /** * Setter method for the current_term_ends_at attribute. * * @param string $current_term_ends_at * * @return void */ public function setCurrentTermEndsAt(string $current_term_ends_at): void { $this->_current_term_ends_at = $current_term_ends_at; } /** * Getter method for the current_term_started_at attribute. * The start date of the term when the first billing period starts. The subscription term is the length of time that a customer will be committed to a subscription. A term can span multiple billing periods. * * @return ?string */ public function getCurrentTermStartedAt(): ?string { return $this->_current_term_started_at; } /** * Setter method for the current_term_started_at attribute. * * @param string $current_term_started_at * * @return void */ public function setCurrentTermStartedAt(string $current_term_started_at): void { $this->_current_term_started_at = $current_term_started_at; } /** * Getter method for the custom_fields attribute. * The custom fields will only be altered when they are included in a request. Sending an empty array will not remove any existing values. To remove a field send the name with a null or empty value. * * @return array */ public function getCustomFields(): array { return $this->_custom_fields ?? [] ; } /** * Setter method for the custom_fields attribute. * * @param array $custom_fields * * @return void */ public function setCustomFields(array $custom_fields): void { $this->_custom_fields = $custom_fields; } /** * Getter method for the customer_notes attribute. * Customer notes * * @return ?string */ public function getCustomerNotes(): ?string { return $this->_customer_notes; } /** * Setter method for the customer_notes attribute. * * @param string $customer_notes * * @return void */ public function setCustomerNotes(string $customer_notes): void { $this->_customer_notes = $customer_notes; } /** * Getter method for the expiration_reason attribute. * Expiration reason * * @return ?string */ public function getExpirationReason(): ?string { return $this->_expiration_reason; } /** * Setter method for the expiration_reason attribute. * * @param string $expiration_reason * * @return void */ public function setExpirationReason(string $expiration_reason): void { $this->_expiration_reason = $expiration_reason; } /** * Getter method for the expires_at attribute. * Expires at * * @return ?string */ public function getExpiresAt(): ?string { return $this->_expires_at; } /** * Setter method for the expires_at attribute. * * @param string $expires_at * * @return void */ public function setExpiresAt(string $expires_at): void { $this->_expires_at = $expires_at; } /** * Getter method for the gateway_code attribute. * If present, this subscription's transactions will use the payment gateway with this code. * * @return ?string */ public function getGatewayCode(): ?string { return $this->_gateway_code; } /** * Setter method for the gateway_code attribute. * * @param string $gateway_code * * @return void */ public function setGatewayCode(string $gateway_code): void { $this->_gateway_code = $gateway_code; } /** * Getter method for the id attribute. * Subscription ID * * @return ?string */ public function getId(): ?string { return $this->_id; } /** * Setter method for the id attribute. * * @param string $id * * @return void */ public function setId(string $id): void { $this->_id = $id; } /** * Getter method for the net_terms attribute. * Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the -invoice will become past due. For any value, an additional 24 hours is +invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before -becoming past due. For example: +becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. +For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. -For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + +For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) +or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. * * @return ?int */ public function getNetTerms(): ?int { return $this->_net_terms; } /** * Setter method for the net_terms attribute. * * @param int $net_terms * * @return void */ public function setNetTerms(int $net_terms): void { $this->_net_terms = $net_terms; } /** * Getter method for the net_terms_type attribute. * Optionally supplied string that may be either `net` or `eom` (end-of-month). When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date. When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month. This field is only available when the EOM Net Terms feature is enabled. * * @return ?string */ public function getNetTermsType(): ?string { return $this->_net_terms_type; } /** * Setter method for the net_terms_type attribute. * * @param string $net_terms_type * * @return void */ public function setNetTermsType(string $net_terms_type): void { $this->_net_terms_type = $net_terms_type; } /** * Getter method for the object attribute. * Object type * * @return ?string */ public function getObject(): ?string { return $this->_object; } /** * Setter method for the object attribute. * * @param string $object * * @return void */ public function setObject(string $object): void { $this->_object = $object; } /** * Getter method for the paused_at attribute. * Null unless subscription is paused or will pause at the end of the current billing period. * * @return ?string */ public function getPausedAt(): ?string { return $this->_paused_at; } /** * Setter method for the paused_at attribute. * * @param string $paused_at * * @return void */ public function setPausedAt(string $paused_at): void { $this->_paused_at = $paused_at; } /** * Getter method for the pending_change attribute. * Subscription Change * * @return ?\Recurly\Resources\SubscriptionChange */ public function getPendingChange(): ?\Recurly\Resources\SubscriptionChange { return $this->_pending_change; } /** * Setter method for the pending_change attribute. * * @param \Recurly\Resources\SubscriptionChange $pending_change * * @return void */ public function setPendingChange(\Recurly\Resources\SubscriptionChange $pending_change): void { $this->_pending_change = $pending_change; } /** * Getter method for the plan attribute. * Just the important parts. * * @return ?\Recurly\Resources\PlanMini */ public function getPlan(): ?\Recurly\Resources\PlanMini { return $this->_plan; } /** * Setter method for the plan attribute. * * @param \Recurly\Resources\PlanMini $plan * * @return void */ public function setPlan(\Recurly\Resources\PlanMini $plan): void { $this->_plan = $plan; } /** * Getter method for the po_number attribute. * For manual invoicing, this identifies the PO number associated with the subscription. * * @return ?string */ public function getPoNumber(): ?string { return $this->_po_number; } /** * Setter method for the po_number attribute. * * @param string $po_number * * @return void */ public function setPoNumber(string $po_number): void { $this->_po_number = $po_number; } /** * Getter method for the quantity attribute. * Subscription quantity * * @return ?int */ public function getQuantity(): ?int { return $this->_quantity; } /** * Setter method for the quantity attribute. * * @param int $quantity * * @return void */ public function setQuantity(int $quantity): void { $this->_quantity = $quantity; } /** * Getter method for the ramp_intervals attribute. * The ramp intervals representing the pricing schedule for the subscription. * * @return array */ public function getRampIntervals(): array { return $this->_ramp_intervals ?? [] ; } /** * Setter method for the ramp_intervals attribute. * * @param array $ramp_intervals * * @return void */ public function setRampIntervals(array $ramp_intervals): void { $this->_ramp_intervals = $ramp_intervals; } /** * Getter method for the remaining_billing_cycles attribute. * The remaining billing cycles in the current term. * * @return ?int */ public function getRemainingBillingCycles(): ?int { return $this->_remaining_billing_cycles; } /** * Setter method for the remaining_billing_cycles attribute. * * @param int $remaining_billing_cycles * * @return void */ public function setRemainingBillingCycles(int $remaining_billing_cycles): void { $this->_remaining_billing_cycles = $remaining_billing_cycles; } /** * Getter method for the remaining_pause_cycles attribute. * Null unless subscription is paused or will pause at the end of the current billing period. * * @return ?int */ public function getRemainingPauseCycles(): ?int { return $this->_remaining_pause_cycles; } /** * Setter method for the remaining_pause_cycles attribute. * * @param int $remaining_pause_cycles * * @return void */ public function setRemainingPauseCycles(int $remaining_pause_cycles): void { $this->_remaining_pause_cycles = $remaining_pause_cycles; } /** * Getter method for the renewal_billing_cycles attribute. * If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. * * @return ?int */ public function getRenewalBillingCycles(): ?int { return $this->_renewal_billing_cycles; } /** * Setter method for the renewal_billing_cycles attribute. * * @param int $renewal_billing_cycles * * @return void */ public function setRenewalBillingCycles(int $renewal_billing_cycles): void { $this->_renewal_billing_cycles = $renewal_billing_cycles; } /** * Getter method for the revenue_schedule_type attribute. * Revenue schedule type * * @return ?string */ public function getRevenueScheduleType(): ?string { return $this->_revenue_schedule_type; } /** * Setter method for the revenue_schedule_type attribute. * * @param string $revenue_schedule_type * * @return void */ public function setRevenueScheduleType(string $revenue_schedule_type): void { $this->_revenue_schedule_type = $revenue_schedule_type; } /** * Getter method for the shipping attribute. * Subscription shipping details * * @return ?\Recurly\Resources\SubscriptionShipping */ public function getShipping(): ?\Recurly\Resources\SubscriptionShipping { return $this->_shipping; } /** * Setter method for the shipping attribute. * * @param \Recurly\Resources\SubscriptionShipping $shipping * * @return void */ public function setShipping(\Recurly\Resources\SubscriptionShipping $shipping): void { $this->_shipping = $shipping; } /** * Getter method for the started_with_gift attribute. * Whether the subscription was started with a gift certificate. * * @return ?bool */ public function getStartedWithGift(): ?bool { return $this->_started_with_gift; } /** * Setter method for the started_with_gift attribute. * * @param bool $started_with_gift * * @return void */ public function setStartedWithGift(bool $started_with_gift): void { $this->_started_with_gift = $started_with_gift; } /** * Getter method for the state attribute. * State * * @return ?string */ public function getState(): ?string { return $this->_state; } /** * Setter method for the state attribute. * * @param string $state * * @return void */ public function setState(string $state): void { $this->_state = $state; } /** * Getter method for the subtotal attribute. * Estimated total, before tax. * * @return ?float */ public function getSubtotal(): ?float { return $this->_subtotal; } /** * Setter method for the subtotal attribute. * * @param float $subtotal * * @return void */ public function setSubtotal(float $subtotal): void { $this->_subtotal = $subtotal; } /** * Getter method for the tax attribute. * Only for merchants using Recurly's In-The-Box taxes. * * @return ?float */ public function getTax(): ?float { return $this->_tax; } /** * Setter method for the tax attribute. * * @param float $tax * * @return void */ public function setTax(float $tax): void { $this->_tax = $tax; } /** * Getter method for the tax_inclusive attribute. * Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to utilize this flag. * * @return ?bool */ public function getTaxInclusive(): ?bool { return $this->_tax_inclusive; } /** * Setter method for the tax_inclusive attribute. * * @param bool $tax_inclusive * * @return void */ public function setTaxInclusive(bool $tax_inclusive): void { $this->_tax_inclusive = $tax_inclusive; } /** * Getter method for the tax_info attribute. * Only for merchants using Recurly's In-The-Box taxes. * * @return ?\Recurly\Resources\TaxInfo */ public function getTaxInfo(): ?\Recurly\Resources\TaxInfo { return $this->_tax_info; } /** * Setter method for the tax_info attribute. * * @param \Recurly\Resources\TaxInfo $tax_info * * @return void */ public function setTaxInfo(\Recurly\Resources\TaxInfo $tax_info): void { $this->_tax_info = $tax_info; } /** * Getter method for the terms_and_conditions attribute. * Terms and conditions * * @return ?string */ public function getTermsAndConditions(): ?string { return $this->_terms_and_conditions; } /** * Setter method for the terms_and_conditions attribute. * * @param string $terms_and_conditions * * @return void */ public function setTermsAndConditions(string $terms_and_conditions): void { $this->_terms_and_conditions = $terms_and_conditions; } /** * Getter method for the total attribute. * Estimated total * * @return ?float */ public function getTotal(): ?float { return $this->_total; } /** * Setter method for the total attribute. * * @param float $total * * @return void */ public function setTotal(float $total): void { $this->_total = $total; } /** * Getter method for the total_billing_cycles attribute. * The number of cycles/billing periods in a term. When `remaining_billing_cycles=0`, if `auto_renew=true` the subscription will renew and a new term will begin, otherwise the subscription will expire. * diff --git a/lib/recurly/resources/transaction.php b/lib/recurly/resources/transaction.php index 8722820..515a705 100644 --- a/lib/recurly/resources/transaction.php +++ b/lib/recurly/resources/transaction.php @@ -1,871 +1,895 @@ <?php /** * This file is automatically created by Recurly's OpenAPI generation process * and thus any edits you make by hand will be lost. If you wish to make a * change to this file, please create a Github issue explaining the changes you * need and we will usher them to the appropriate places. */ namespace Recurly\Resources; use Recurly\RecurlyResource; // phpcs:disable class Transaction extends RecurlyResource { private $_account; private $_action_result; private $_amount; private $_avs_check; private $_backup_payment_method_used; private $_billing_address; private $_collected_at; private $_collection_method; private $_created_at; private $_currency; private $_customer_message; private $_customer_message_locale; private $_cvv_check; + private $_fraud_info; private $_gateway_approval_code; private $_gateway_message; private $_gateway_reference; private $_gateway_response_code; private $_gateway_response_time; private $_gateway_response_values; private $_id; private $_invoice; private $_ip_address_country; private $_ip_address_v4; private $_object; private $_origin; private $_original_transaction_id; private $_payment_gateway; private $_payment_method; private $_refunded; private $_status; private $_status_code; private $_status_message; private $_subscription_ids; private $_success; private $_type; private $_updated_at; private $_uuid; private $_vat_number; private $_voided_at; private $_voided_by_invoice; protected static $array_hints = [ 'setSubscriptionIds' => 'string', ]; /** * Getter method for the account attribute. * Account mini details * * @return ?\Recurly\Resources\AccountMini */ public function getAccount(): ?\Recurly\Resources\AccountMini { return $this->_account; } /** * Setter method for the account attribute. * * @param \Recurly\Resources\AccountMini $account * * @return void */ public function setAccount(\Recurly\Resources\AccountMini $account): void { $this->_account = $account; } /** * Getter method for the action_result attribute. * Action result params to be used in Recurly-JS to complete a payment when using asynchronous payment methods, e.g., Boleto, iDEAL and Sofort. * * @return ?object */ public function getActionResult(): ?object { return $this->_action_result; } /** * Setter method for the action_result attribute. * * @param object $action_result * * @return void */ public function setActionResult(object $action_result): void { $this->_action_result = $action_result; } /** * Getter method for the amount attribute. * Total transaction amount sent to the payment gateway. * * @return ?float */ public function getAmount(): ?float { return $this->_amount; } /** * Setter method for the amount attribute. * * @param float $amount * * @return void */ public function setAmount(float $amount): void { $this->_amount = $amount; } /** * Getter method for the avs_check attribute. * When processed, result from checking the overall AVS on the transaction. * * @return ?string */ public function getAvsCheck(): ?string { return $this->_avs_check; } /** * Setter method for the avs_check attribute. * * @param string $avs_check * * @return void */ public function setAvsCheck(string $avs_check): void { $this->_avs_check = $avs_check; } /** * Getter method for the backup_payment_method_used attribute. * Indicates if the transaction was completed using a backup payment * * @return ?bool */ public function getBackupPaymentMethodUsed(): ?bool { return $this->_backup_payment_method_used; } /** * Setter method for the backup_payment_method_used attribute. * * @param bool $backup_payment_method_used * * @return void */ public function setBackupPaymentMethodUsed(bool $backup_payment_method_used): void { $this->_backup_payment_method_used = $backup_payment_method_used; } /** * Getter method for the billing_address attribute. * * * @return ?\Recurly\Resources\AddressWithName */ public function getBillingAddress(): ?\Recurly\Resources\AddressWithName { return $this->_billing_address; } /** * Setter method for the billing_address attribute. * * @param \Recurly\Resources\AddressWithName $billing_address * * @return void */ public function setBillingAddress(\Recurly\Resources\AddressWithName $billing_address): void { $this->_billing_address = $billing_address; } /** * Getter method for the collected_at attribute. * Collected at, or if not collected yet, the time the transaction was created. * * @return ?string */ public function getCollectedAt(): ?string { return $this->_collected_at; } /** * Setter method for the collected_at attribute. * * @param string $collected_at * * @return void */ public function setCollectedAt(string $collected_at): void { $this->_collected_at = $collected_at; } /** * Getter method for the collection_method attribute. * The method by which the payment was collected. * * @return ?string */ public function getCollectionMethod(): ?string { return $this->_collection_method; } /** * Setter method for the collection_method attribute. * * @param string $collection_method * * @return void */ public function setCollectionMethod(string $collection_method): void { $this->_collection_method = $collection_method; } /** * Getter method for the created_at attribute. * Created at * * @return ?string */ public function getCreatedAt(): ?string { return $this->_created_at; } /** * Setter method for the created_at attribute. * * @param string $created_at * * @return void */ public function setCreatedAt(string $created_at): void { $this->_created_at = $created_at; } /** * Getter method for the currency attribute. * 3-letter ISO 4217 currency code. * * @return ?string */ public function getCurrency(): ?string { return $this->_currency; } /** * Setter method for the currency attribute. * * @param string $currency * * @return void */ public function setCurrency(string $currency): void { $this->_currency = $currency; } /** * Getter method for the customer_message attribute. * For declined (`success=false`) transactions, the message displayed to the customer. * * @return ?string */ public function getCustomerMessage(): ?string { return $this->_customer_message; } /** * Setter method for the customer_message attribute. * * @param string $customer_message * * @return void */ public function setCustomerMessage(string $customer_message): void { $this->_customer_message = $customer_message; } /** * Getter method for the customer_message_locale attribute. * Language code for the message * * @return ?string */ public function getCustomerMessageLocale(): ?string { return $this->_customer_message_locale; } /** * Setter method for the customer_message_locale attribute. * * @param string $customer_message_locale * * @return void */ public function setCustomerMessageLocale(string $customer_message_locale): void { $this->_customer_message_locale = $customer_message_locale; } /** * Getter method for the cvv_check attribute. * When processed, result from checking the CVV/CVC value on the transaction. * * @return ?string */ public function getCvvCheck(): ?string { return $this->_cvv_check; } /** * Setter method for the cvv_check attribute. * * @param string $cvv_check * * @return void */ public function setCvvCheck(string $cvv_check): void { $this->_cvv_check = $cvv_check; } + /** + * Getter method for the fraud_info attribute. + * Fraud information + * + * @return ?\Recurly\Resources\TransactionFraudInfo + */ + public function getFraudInfo(): ?\Recurly\Resources\TransactionFraudInfo + { + return $this->_fraud_info; + } + + /** + * Setter method for the fraud_info attribute. + * + * @param \Recurly\Resources\TransactionFraudInfo $fraud_info + * + * @return void + */ + public function setFraudInfo(\Recurly\Resources\TransactionFraudInfo $fraud_info): void + { + $this->_fraud_info = $fraud_info; + } + /** * Getter method for the gateway_approval_code attribute. * Transaction approval code from the payment gateway. * * @return ?string */ public function getGatewayApprovalCode(): ?string { return $this->_gateway_approval_code; } /** * Setter method for the gateway_approval_code attribute. * * @param string $gateway_approval_code * * @return void */ public function setGatewayApprovalCode(string $gateway_approval_code): void { $this->_gateway_approval_code = $gateway_approval_code; } /** * Getter method for the gateway_message attribute. * Transaction message from the payment gateway. * * @return ?string */ public function getGatewayMessage(): ?string { return $this->_gateway_message; } /** * Setter method for the gateway_message attribute. * * @param string $gateway_message * * @return void */ public function setGatewayMessage(string $gateway_message): void { $this->_gateway_message = $gateway_message; } /** * Getter method for the gateway_reference attribute. * Transaction reference number from the payment gateway. * * @return ?string */ public function getGatewayReference(): ?string { return $this->_gateway_reference; } /** * Setter method for the gateway_reference attribute. * * @param string $gateway_reference * * @return void */ public function setGatewayReference(string $gateway_reference): void { $this->_gateway_reference = $gateway_reference; } /** * Getter method for the gateway_response_code attribute. * For declined transactions (`success=false`), this field lists the gateway error code. * * @return ?string */ public function getGatewayResponseCode(): ?string { return $this->_gateway_response_code; } /** * Setter method for the gateway_response_code attribute. * * @param string $gateway_response_code * * @return void */ public function setGatewayResponseCode(string $gateway_response_code): void { $this->_gateway_response_code = $gateway_response_code; } /** * Getter method for the gateway_response_time attribute. * Time, in seconds, for gateway to process the transaction. * * @return ?float */ public function getGatewayResponseTime(): ?float { return $this->_gateway_response_time; } /** * Setter method for the gateway_response_time attribute. * * @param float $gateway_response_time * * @return void */ public function setGatewayResponseTime(float $gateway_response_time): void { $this->_gateway_response_time = $gateway_response_time; } /** * Getter method for the gateway_response_values attribute. * The values in this field will vary from gateway to gateway. * * @return ?object */ public function getGatewayResponseValues(): ?object { return $this->_gateway_response_values; } /** * Setter method for the gateway_response_values attribute. * * @param object $gateway_response_values * * @return void */ public function setGatewayResponseValues(object $gateway_response_values): void { $this->_gateway_response_values = $gateway_response_values; } /** * Getter method for the id attribute. * Transaction ID * * @return ?string */ public function getId(): ?string { return $this->_id; } /** * Setter method for the id attribute. * * @param string $id * * @return void */ public function setId(string $id): void { $this->_id = $id; } /** * Getter method for the invoice attribute. * Invoice mini details * * @return ?\Recurly\Resources\InvoiceMini */ public function getInvoice(): ?\Recurly\Resources\InvoiceMini { return $this->_invoice; } /** * Setter method for the invoice attribute. * * @param \Recurly\Resources\InvoiceMini $invoice * * @return void */ public function setInvoice(\Recurly\Resources\InvoiceMini $invoice): void { $this->_invoice = $invoice; } /** * Getter method for the ip_address_country attribute. * Origin IP address country, 2-letter ISO 3166-1 alpha-2 code, if known by Recurly. * * @return ?string */ public function getIpAddressCountry(): ?string { return $this->_ip_address_country; } /** * Setter method for the ip_address_country attribute. * * @param string $ip_address_country * * @return void */ public function setIpAddressCountry(string $ip_address_country): void { $this->_ip_address_country = $ip_address_country; } /** * Getter method for the ip_address_v4 attribute. * IP address provided when the billing information was collected: - When the customer enters billing information into the Recurly.js or Hosted Payment Pages, Recurly records the IP address. - When the merchant enters billing information using the API, the merchant may provide an IP address. - When the merchant enters billing information using the UI, no IP address is recorded. * * @return ?string */ public function getIpAddressV4(): ?string { return $this->_ip_address_v4; } /** * Setter method for the ip_address_v4 attribute. * * @param string $ip_address_v4 * * @return void */ public function setIpAddressV4(string $ip_address_v4): void { $this->_ip_address_v4 = $ip_address_v4; } /** * Getter method for the object attribute. * Object type * * @return ?string */ public function getObject(): ?string { return $this->_object; } /** * Setter method for the object attribute. * * @param string $object * * @return void */ public function setObject(string $object): void { $this->_object = $object; } /** * Getter method for the origin attribute. * Describes how the transaction was triggered. * * @return ?string */ public function getOrigin(): ?string { return $this->_origin; } /** * Setter method for the origin attribute. * * @param string $origin * * @return void */ public function setOrigin(string $origin): void { $this->_origin = $origin; } /** * Getter method for the original_transaction_id attribute. * If this transaction is a refund (`type=refund`), this will be the ID of the original transaction on the invoice being refunded. * * @return ?string */ public function getOriginalTransactionId(): ?string { return $this->_original_transaction_id; } /** * Setter method for the original_transaction_id attribute. * * @param string $original_transaction_id * * @return void */ public function setOriginalTransactionId(string $original_transaction_id): void { $this->_original_transaction_id = $original_transaction_id; } /** * Getter method for the payment_gateway attribute. * * * @return ?\Recurly\Resources\TransactionPaymentGateway */ public function getPaymentGateway(): ?\Recurly\Resources\TransactionPaymentGateway { return $this->_payment_gateway; } /** * Setter method for the payment_gateway attribute. * * @param \Recurly\Resources\TransactionPaymentGateway $payment_gateway * * @return void */ public function setPaymentGateway(\Recurly\Resources\TransactionPaymentGateway $payment_gateway): void { $this->_payment_gateway = $payment_gateway; } /** * Getter method for the payment_method attribute. * * * @return ?\Recurly\Resources\PaymentMethod */ public function getPaymentMethod(): ?\Recurly\Resources\PaymentMethod { return $this->_payment_method; } /** * Setter method for the payment_method attribute. * * @param \Recurly\Resources\PaymentMethod $payment_method * * @return void */ public function setPaymentMethod(\Recurly\Resources\PaymentMethod $payment_method): void { $this->_payment_method = $payment_method; } /** * Getter method for the refunded attribute. * Indicates if part or all of this transaction was refunded. * * @return ?bool */ public function getRefunded(): ?bool { return $this->_refunded; } /** * Setter method for the refunded attribute. * * @param bool $refunded * * @return void */ public function setRefunded(bool $refunded): void { $this->_refunded = $refunded; } /** * Getter method for the status attribute. * The current transaction status. Note that the status may change, e.g. a `pending` transaction may become `declined` or `success` may later become `void`. * * @return ?string */ public function getStatus(): ?string { return $this->_status; } /** * Setter method for the status attribute. * * @param string $status * * @return void */ public function setStatus(string $status): void { $this->_status = $status; } /** * Getter method for the status_code attribute. * Status code * * @return ?string */ public function getStatusCode(): ?string { return $this->_status_code; } /** * Setter method for the status_code attribute. * * @param string $status_code * * @return void */ public function setStatusCode(string $status_code): void { $this->_status_code = $status_code; } /** * Getter method for the status_message attribute. * For declined (`success=false`) transactions, the message displayed to the merchant. * * @return ?string */ public function getStatusMessage(): ?string { return $this->_status_message; } /** * Setter method for the status_message attribute. * * @param string $status_message * * @return void */ public function setStatusMessage(string $status_message): void { $this->_status_message = $status_message; } /** * Getter method for the subscription_ids attribute. * If the transaction is charging or refunding for one or more subscriptions, these are their IDs. * * @return array */ public function getSubscriptionIds(): array { return $this->_subscription_ids ?? [] ; } /** * Setter method for the subscription_ids attribute. * * @param array $subscription_ids * * @return void */ public function setSubscriptionIds(array $subscription_ids): void { $this->_subscription_ids = $subscription_ids; } /** * Getter method for the success attribute. * Did this transaction complete successfully? * * @return ?bool */ public function getSuccess(): ?bool { return $this->_success; } /** * Setter method for the success attribute. * * @param bool $success * * @return void */ public function setSuccess(bool $success): void { $this->_success = $success; } /** * Getter method for the type attribute. * - `authorization` – verifies billing information and places a hold on money in the customer's account. - `capture` – captures funds held by an authorization and completes a purchase. - `purchase` – combines the authorization and capture in one transaction. - `refund` – returns all or a portion of the money collected in a previous transaction to the customer. - `verify` – a $0 or $1 transaction used to verify billing information which is immediately voided. * * @return ?string */ public function getType(): ?string { return $this->_type; } /** * Setter method for the type attribute. * * @param string $type * * @return void */ public function setType(string $type): void diff --git a/lib/recurly/resources/transaction_fraud_info.php b/lib/recurly/resources/transaction_fraud_info.php new file mode 100644 index 0000000..f3cbcbe --- /dev/null +++ b/lib/recurly/resources/transaction_fraud_info.php @@ -0,0 +1,140 @@ +<?php +/** + * This file is automatically created by Recurly's OpenAPI generation process + * and thus any edits you make by hand will be lost. If you wish to make a + * change to this file, please create a Github issue explaining the changes you + * need and we will usher them to the appropriate places. + */ +namespace Recurly\Resources; + +use Recurly\RecurlyResource; + +// phpcs:disable +class TransactionFraudInfo extends RecurlyResource +{ + private $_decision; + private $_object; + private $_reference; + private $_risk_rules_triggered; + private $_score; + + protected static $array_hints = [ + 'setRiskRulesTriggered' => '\Recurly\Resources\FraudRiskRule', + ]; + + + /** + * Getter method for the decision attribute. + * Kount decision + * + * @return ?string + */ + public function getDecision(): ?string + { + return $this->_decision; + } + + /** + * Setter method for the decision attribute. + * + * @param string $decision + * + * @return void + */ + public function setDecision(string $decision): void + { + $this->_decision = $decision; + } + + /** + * Getter method for the object attribute. + * Object type + * + * @return ?string + */ + public function getObject(): ?string + { + return $this->_object; + } + + /** + * Setter method for the object attribute. + * + * @param string $object + * + * @return void + */ + public function setObject(string $object): void + { + $this->_object = $object; + } + + /** + * Getter method for the reference attribute. + * Kount transaction reference ID + * + * @return ?string + */ + public function getReference(): ?string + { + return $this->_reference; + } + + /** + * Setter method for the reference attribute. + * + * @param string $reference + * + * @return void + */ + public function setReference(string $reference): void + { + $this->_reference = $reference; + } + + /** + * Getter method for the risk_rules_triggered attribute. + * A list of fraud risk rules that were triggered for the transaction. + * + * @return array + */ + public function getRiskRulesTriggered(): array + { + return $this->_risk_rules_triggered ?? [] ; + } + + /** + * Setter method for the risk_rules_triggered attribute. + * + * @param array $risk_rules_triggered + * + * @return void + */ + public function setRiskRulesTriggered(array $risk_rules_triggered): void + { + $this->_risk_rules_triggered = $risk_rules_triggered; + } + + /** + * Getter method for the score attribute. + * Kount score + * + * @return ?int + */ + public function getScore(): ?int + { + return $this->_score; + } + + /** + * Setter method for the score attribute. + * + * @param int $score + * + * @return void + */ + public function setScore(int $score): void + { + $this->_score = $score; + } +} \ No newline at end of file diff --git a/openapi/api.yaml b/openapi/api.yaml index c9e015a..79ef24e 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -18913,1229 +18913,1235 @@ components: description: The date and time the coupon will expire and can no longer be redeemed. Time is always 11:59:59, the end-of-day Pacific time. CreditPayment: type: object properties: id: type: string title: Credit Payment ID maxLength: 13 object: type: string title: Object type uuid: type: string title: Recurly UUID description: The UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI. maxLength: 32 action: title: Action description: The action for which the credit was created. "$ref": "#/components/schemas/CreditPaymentActionEnum" account: "$ref": "#/components/schemas/AccountMini" applied_to_invoice: "$ref": "#/components/schemas/InvoiceMini" original_invoice: "$ref": "#/components/schemas/InvoiceMini" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 amount: type: number format: float title: Amount description: Total credit payment amount applied to the charge invoice. original_credit_payment_id: type: string title: Original Credit Payment ID description: For credit payments with action `refund`, this is the credit payment that was refunded. maxLength: 13 refund_transaction: "$ref": "#/components/schemas/Transaction" created_at: type: string title: Created at format: date-time readOnly: true updated_at: type: string title: Last updated at format: date-time readOnly: true voided_at: type: string title: Voided at format: date-time readOnly: true CustomField: type: object title: Custom field properties: name: type: string title: Field name description: Fields must be created in the UI before values can be assigned to them. pattern: "/^[a-z0-9_-]+$/i" maxLength: 50 value: type: string title: Field value description: Any values that resemble a credit card number or security code (CVV/CVC) will be rejected. maxLength: 255 required: - name - value CustomFields: type: array title: Custom fields description: The custom fields will only be altered when they are included in a request. Sending an empty array will not remove any existing values. To remove a field send the name with a null or empty value. items: "$ref": "#/components/schemas/CustomField" CustomFieldDefinition: type: object title: Custom field definition properties: id: type: string title: Custom field definition ID readOnly: true object: type: string title: Object type readOnly: true related_type: title: Related Recurly object type "$ref": "#/components/schemas/RelatedTypeEnum" name: type: string title: Name description: Used by the API to identify the field or reading and writing. The name can only be used once per Recurly object type. pattern: "/^[a-z0-9_-]+$/i" maxLength: 50 user_access: title: User access description: | The access control applied inside Recurly's admin UI: - `api_only` - No one will be able to view or edit this field's data via the admin UI. - `read_only` - Users with the Customers role will be able to view this field's data via the admin UI, but editing will only be available via the API. - `write` - Users with the Customers role will be able to view and edit this field's data via the admin UI. - `set_only` - Users with the Customers role will be able to set this field's data via the admin console. "$ref": "#/components/schemas/UserAccessEnum" display_name: type: string title: Display name description: Used to label the field when viewing and editing the field in Recurly's admin UI. maxLength: 50 tooltip: type: string title: Tooltip description description: Displayed as a tooltip when editing the field in the Recurly admin UI. pattern: "/^[a-z0-9_-]+$/i" maxLength: 255 created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at description: Definitions are initially soft deleted, and once all the values are removed from the accouts or subscriptions, will be hard deleted an no longer visible. readOnly: true ItemMini: type: object title: Item mini details description: Just the important parts. properties: id: type: string title: Item ID maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true code: type: string title: Item code description: Unique code to identify the item. pattern: "/^[a-z0-9_+-]+$/" maxLength: 50 state: title: State description: The current state of the item. readOnly: true "$ref": "#/components/schemas/ActiveStateEnum" name: type: string title: Name description: This name describes your item and will appear on the invoice when it's purchased on a one time basis. maxLength: 255 description: type: string title: Description description: Optional, description. Item: type: object description: Full item details. properties: id: type: string title: Item ID maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true code: type: string title: Item code description: Unique code to identify the item. pattern: "/^[a-z0-9_+-]+$/" maxLength: 50 state: title: State description: The current state of the item. readOnly: true "$ref": "#/components/schemas/ActiveStateEnum" name: type: string title: Name description: This name describes your item and will appear on the invoice when it's purchased on a one time basis. maxLength: 255 description: type: string title: Description description: Optional, description. external_sku: type: string title: External SKU description: Optional, stock keeping unit to link the item to other inventory systems. maxLength: 50 accounting_code: type: string title: Item accounting code description: Accounting code for invoice line items. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 tax_code: type: string title: Tax code description: Used by Avalara, Vertex, and Recurly’s EU VAT tax feature. The tax code values are specific to each tax system. If you are using Recurly’s EU VAT feature you can use `unknown`, `physical`, or `digital`. maxLength: 50 tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on the item, `false` applies tax on the item." custom_fields: "$ref": "#/components/schemas/CustomFields" currencies: type: array title: Item Pricing items: "$ref": "#/components/schemas/Pricing" created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at readOnly: true ItemCreate: type: object properties: code: type: string title: Item code description: Unique code to identify the item. pattern: "/^[a-z0-9_+-]+$/" maxLength: 50 name: type: string title: Name description: This name describes your item and will appear on the invoice when it's purchased on a one time basis. maxLength: 255 description: type: string title: Description description: Optional, description. external_sku: type: string title: External SKU description: Optional, stock keeping unit to link the item to other inventory systems. maxLength: 50 accounting_code: type: string title: Item accounting code description: Accounting code for invoice line items. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 tax_code: type: string title: Tax code description: Used by Avalara, Vertex, and Recurly’s EU VAT tax feature. The tax code values are specific to each tax system. If you are using Recurly’s EU VAT feature you can use `unknown`, `physical`, or `digital`. maxLength: 50 tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on the item, `false` applies tax on the item." custom_fields: "$ref": "#/components/schemas/CustomFields" currencies: type: array title: Item Pricing items: "$ref": "#/components/schemas/Pricing" required: - code - name ItemUpdate: type: object properties: code: type: string title: Item code description: Unique code to identify the item. pattern: "/^[a-z0-9_+-]+$/" maxLength: 50 name: type: string title: Name description: This name describes your item and will appear on the invoice when it's purchased on a one time basis. maxLength: 255 description: type: string title: Description description: Optional, description. external_sku: type: string title: External SKU description: Optional, stock keeping unit to link the item to other inventory systems. maxLength: 50 accounting_code: type: string title: Item accounting code description: Accounting code for invoice line items. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 tax_code: type: string title: Tax code description: Used by Avalara, Vertex, and Recurly’s EU VAT tax feature. The tax code values are specific to each tax system. If you are using Recurly’s EU VAT feature you can use `unknown`, `physical`, or `digital`. maxLength: 50 tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on the item, `false` applies tax on the item." custom_fields: "$ref": "#/components/schemas/CustomFields" currencies: type: array title: Item Pricing items: "$ref": "#/components/schemas/Pricing" Invoice: type: object properties: id: type: string title: Invoice ID readOnly: true uuid: type: string title: Invoice UUID readOnly: true object: type: string title: Object type readOnly: true type: title: Invoice type description: Invoices are either charge, credit, or legacy invoices. "$ref": "#/components/schemas/InvoiceTypeEnum" origin: title: Origin description: The event that created the invoice. "$ref": "#/components/schemas/OriginEnum" state: title: Invoice state "$ref": "#/components/schemas/InvoiceStateEnum" account: "$ref": "#/components/schemas/AccountMini" billing_info_id: type: string title: Billing info ID description: The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. subscription_ids: type: array title: Subscription IDs description: If the invoice is charging or refunding for one or more subscriptions, these are their IDs. items: type: string title: Subscription ID maxLength: 13 previous_invoice_id: type: string title: Previous invoice ID description: On refund invoices, this value will exist and show the invoice ID of the purchase invoice the refund was created from. This field is only populated for sites without the [Only Bill What Changed](https://docs.recurly.com/docs/only-bill-what-changed) feature enabled. Sites with Only Bill What Changed enabled should use the [related_invoices endpoint](https://recurly.com/developers/api/v2021-02-25/index.html#operation/list_related_invoices) to see purchase invoices refunded by this invoice. maxLength: 13 number: type: string title: Invoice number description: 'If VAT taxation and the Country Invoice Sequencing feature are enabled, invoices will have country-specific invoice numbers for invoices billed to EU countries (ex: FR1001). Non-EU invoices will continue to use the site-level invoice number sequence.' collection_method: title: Collection method description: An automatic invoice means a corresponding transaction is run using the account's billing information at the same time the invoice is created. Manual invoices are created without a corresponding transaction. The merchant must enter a manual payment transaction or have the customer pay the invoice with an automatic method, like credit card, PayPal, Amazon, or ACH bank payment. default: automatic "$ref": "#/components/schemas/CollectionMethodEnum" po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Net terms description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the - invoice will become past due. For any value, an additional 24 hours is + invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before - becoming past due. For example: + becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. + For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. - For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + + For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" address: "$ref": "#/components/schemas/InvoiceAddress" shipping_address: "$ref": "#/components/schemas/ShippingAddress" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 discount: type: number format: float title: Discount description: Total discounts applied to this invoice. subtotal: type: number format: float title: Subtotal description: The summation of charges and credits, before discounts and taxes. tax: type: number format: float title: Tax description: The total tax on this invoice. total: type: number format: float title: Total description: The final total on this invoice. The summation of invoice charges, discounts, credits, and tax. refundable_amount: type: number format: float title: Refundable amount description: The refundable amount on a charge invoice. It will be null for all other invoices. paid: type: number format: float title: Paid description: The total amount of successful payments transaction on this invoice. balance: type: number format: float title: Balance description: The outstanding balance remaining on this invoice. tax_info: "$ref": "#/components/schemas/TaxInfo" used_tax_service: type: boolean title: Used Tax Service? description: Will be `true` when the invoice had a successful response from the tax service and `false` when the invoice was not sent to tax service due to a lack of address or enabled jurisdiction or was processed without tax due to a non-blocking error returned from the tax service. vat_number: type: string title: VAT number description: VAT registration number for the customer on this invoice. This will come from the VAT Number field in the Billing Info or the Account Info depending on your tax settings and the invoice collection method. maxLength: 20 vat_reverse_charge_notes: type: string title: VAT reverse charge notes description: VAT Reverse Charge Notes only appear if you have EU VAT enabled or are using your own Avalara AvaTax account and the customer is in the EU, has a VAT number, and is in a different country than your own. This will default to the VAT Reverse Charge Notes text specified on the Tax Settings page in your Recurly admin, unless custom notes were created with the original subscription. terms_and_conditions: type: string title: Terms and conditions description: This will default to the Terms and Conditions text specified on the Invoice Settings page in your Recurly admin. Specify custom notes to add or override Terms and Conditions. customer_notes: type: string title: Customer notes description: This will default to the Customer Notes text specified on the Invoice Settings. Specify custom notes to add or override Customer Notes. line_items: type: array title: Line Items items: "$ref": "#/components/schemas/LineItem" has_more_line_items: type: boolean title: Has more Line Items description: Identifies if the invoice has more line items than are returned in `line_items`. If `has_more_line_items` is `true`, then a request needs to be made to the `list_invoice_line_items` endpoint. transactions: type: array title: Transactions items: "$ref": "#/components/schemas/Transaction" credit_payments: type: array title: Credit payments items: "$ref": "#/components/schemas/CreditPayment" created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true due_at: type: string format: date-time title: Due at description: Date invoice is due. This is the date the net terms are reached. closed_at: type: string format: date-time title: Closed at description: Date invoice was marked paid or failed. dunning_campaign_id: type: string title: Dunning Campaign ID description: Unique ID to identify the dunning campaign used when dunning the invoice. For sites without multiple dunning campaigns enabled, this will always be the default dunning campaign. dunning_events_sent: type: integer title: Dunning Event Sent description: Number of times the event was sent. final_dunning_event: type: boolean title: Final Dunning Event description: Last communication attempt. business_entity_id: type: string title: Business Entity ID description: Unique ID to identify the business entity assigned to the invoice. Available when the `Multiple Business Entities` feature is enabled. InvoiceCreate: type: object properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 collection_method: title: Collection method description: An automatic invoice means a corresponding transaction is run using the account's billing information at the same time the invoice is created. Manual invoices are created without a corresponding transaction. The merchant must enter a manual payment transaction or have the customer pay the invoice with an automatic method, like credit card, PayPal, Amazon, or ACH bank payment. default: automatic "$ref": "#/components/schemas/CollectionMethodEnum" charge_customer_notes: type: string title: Charge customer notes description: This will default to the Customer Notes text specified on the Invoice Settings for charge invoices. Specify custom notes to add or override Customer Notes on charge invoices. credit_customer_notes: type: string title: Credit customer notes description: This will default to the Customer Notes text specified on the Invoice Settings for credit invoices. Specify customer notes to add or override Customer Notes on credit invoices. net_terms: type: integer title: Net terms description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the - invoice will become past due. For any value, an additional 24 hours is + invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before - becoming past due. For example: + becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. + For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. - For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + + For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 terms_and_conditions: type: string title: Terms and conditions description: This will default to the Terms and Conditions text specified on the Invoice Settings page in your Recurly admin. Specify custom notes to add or override Terms and Conditions. vat_reverse_charge_notes: type: string title: VAT reverse charge notes description: VAT Reverse Charge Notes only appear if you have EU VAT enabled or are using your own Avalara AvaTax account and the customer is in the EU, has a VAT number, and is in a different country than your own. This will default to the VAT Reverse Charge Notes text specified on the Tax Settings page in your Recurly admin, unless custom notes were created with the original subscription. required: - currency InvoiceCollect: type: object properties: three_d_secure_action_result_token_id: type: string title: 3-D Secure action result token ID description: A token generated by Recurly.js after completing a 3-D Secure device fingerprinting or authentication challenge. maxLength: 22 transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" billing_info_id: type: string title: Billing Info ID description: The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. InvoiceCollection: type: object title: Invoice collection properties: object: type: string title: Object type charge_invoice: "$ref": "#/components/schemas/Invoice" credit_invoices: type: array title: Credit invoices items: "$ref": "#/components/schemas/Invoice" InvoiceUpdate: type: object properties: po_number: type: string title: Purchase order number description: This identifies the PO number associated with the invoice. Not editable for credit invoices. maxLength: 50 vat_reverse_charge_notes: type: string title: VAT reverse charge notes description: VAT Reverse Charge Notes are editable only if there was a VAT reverse charge applied to the invoice. terms_and_conditions: type: string title: Terms and conditions description: Terms and conditions are an optional note field. Not editable for credit invoices. customer_notes: type: string title: Customer notes description: Customer notes are an optional note field. net_terms: type: integer title: Net terms description: Integer representing the number of days after an invoice's creation that the invoice will become past due. Changing Net terms changes due_on, and the invoice could move between past due and pending. minimum: 0 maximum: 999 address: "$ref": "#/components/schemas/InvoiceAddress" InvoiceMini: type: object title: Invoice mini details properties: id: type: string title: Invoice ID maxLength: 13 object: type: string title: Object type number: type: string title: Invoice number business_entity_id: type: string title: Business Entity ID description: Unique ID to identify the business entity assigned to the invoice. Available when the `Multiple Business Entities` feature is enabled. type: title: Invoice type "$ref": "#/components/schemas/InvoiceTypeEnum" state: title: Invoice state "$ref": "#/components/schemas/InvoiceStateEnum" InvoiceRefund: type: object title: Invoice refund properties: type: title: Type description: The type of refund. Amount and line items cannot both be specified in the request. "$ref": "#/components/schemas/InvoiceRefundTypeEnum" amount: type: number format: float title: Amount description: | The amount to be refunded. The amount will be split between the line items. If no amount is specified, it will default to refunding the total refundable amount on the invoice. line_items: type: array title: Line items description: The line items to be refunded. This is required when `type=line_items`. items: "$ref": "#/components/schemas/LineItemRefund" refund_method: title: Refund method description: | Indicates how the invoice should be refunded when both a credit and transaction are present on the invoice: - `transaction_first` – Refunds the transaction first, then any amount is issued as credit back to the account. Default value when Credit Invoices feature is enabled. - `credit_first` – Issues credit back to the account first, then refunds any remaining amount back to the transaction. Default value when Credit Invoices feature is not enabled. - `all_credit` – Issues credit to the account for the entire amount of the refund. Only available when the Credit Invoices feature is enabled. - `all_transaction` – Refunds the entire amount back to transactions, using transactions from previous invoices if necessary. Only available when the Credit Invoices feature is enabled. default: credit_first "$ref": "#/components/schemas/RefuneMethodEnum" credit_customer_notes: type: string title: Credit customer notes description: | Used as the Customer Notes on the credit invoice. This field can only be include when the Credit Invoices feature is enabled. external_refund: type: object x-class-name: ExternalRefund description: | Indicates that the refund was settled outside of Recurly, and a manual transaction should be created to track it in Recurly. Required when: - refunding a manually collected charge invoice, and `refund_method` is not `all_credit` - refunding a credit invoice that refunded manually collecting invoices - refunding a credit invoice for a partial amount This field can only be included when the Credit Invoices feature is enabled. properties: payment_method: title: Payment Method description: Payment method used for external refund transaction. "$ref": "#/components/schemas/ExternalPaymentMethodEnum" description: type: string title: Description description: Used as the refund transactions' description. maxLength: 50 refunded_at: type: string format: date-time title: Refunded At description: Date the external refund payment was made. Defaults to the current date-time. required: - payment_method required: - type MeasuredUnit: type: object title: Measured unit properties: id: type: string title: Item ID maxLength: 13 readOnly: true object: type: string title: Object type readOnly: true name: type: string title: Name description: Unique internal name of the measured unit on your site. display_name: type: string title: Display name description: Display name for the measured unit. Can only contain spaces, underscores and must be alphanumeric. maxLength: 50 state: title: State description: The current state of the measured unit. readOnly: true "$ref": "#/components/schemas/ActiveStateEnum" description: type: string title: Description description: Optional internal description. created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at readOnly: true MeasuredUnitCreate: type: object properties: name: type: string title: Name description: Unique internal name of the measured unit on your site. maxLength: 255 display_name: type: string title: Display name description: Display name for the measured unit. pattern: "/^[\\w ]+$/" maxLength: 50 description: type: string title: Description description: Optional internal description. required: - name - display_name MeasuredUnitUpdate: type: object properties: name: type: string title: Name description: Unique internal name of the measured unit on your site. maxLength: 255 display_name: type: string title: Display name description: Display name for the measured unit. pattern: "/^[\\w ]+$/" maxLength: 50 description: type: string title: Description description: Optional internal description. LineItem: type: object title: Line item properties: id: type: string title: Line item ID maxLength: 13 object: type: string title: Object type uuid: type: string title: UUID description: The UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI. maxLength: 32 type: title: Line item type description: Charges are positive line items that debit the account. Credits are negative line items that credit the account. "$ref": "#/components/schemas/LineItemTypeEnum" item_code: type: string title: Item Code description: Unique code to identify an item. Available when the Credit Invoices feature is enabled. pattern: "/^[a-z0-9_+-]+$/" maxLength: 50 item_id: type: string title: Item ID description: System-generated unique identifier for an item. Available when the Credit Invoices feature is enabled. maxLength: 13 external_sku: type: string title: External SKU description: Optional Stock Keeping Unit assigned to an item. Available when the Credit Invoices feature is enabled. maxLength: 50 revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/LineItemRevenueScheduleTypeEnum" state: title: Current state of the line item description: Pending line items are charges or credits on an account that have not been applied to an invoice yet. Invoiced line items will always have an `invoice_id` value. "$ref": "#/components/schemas/LineItemStateEnum" legacy_category: title: Legacy category description: | Category to describe the role of a line item on a legacy invoice: - "charges" refers to charges being billed for on this invoice. - "credits" refers to refund or proration credits. This portion of the invoice can be considered a credit memo. - "applied_credits" refers to previous credits applied to this invoice. See their original_line_item_id to determine where the credit first originated. - "carryforwards" can be ignored. They exist to consume any remaining credit balance. A new credit with the same amount will be created and placed back on the account. "$ref": "#/components/schemas/LegacyCategoryEnum" account: "$ref": "#/components/schemas/AccountMini" bill_for_account_id: type: string title: Bill For Account ID maxLength: 13 description: The UUID of the account responsible for originating the line item. subscription_id: type: string title: Subscription ID description: If the line item is a charge or credit for a subscription, this is its ID. maxLength: 13 plan_id: type: string title: Plan ID description: If the line item is a charge or credit for a plan or add-on, this is the plan's ID. maxLength: 13 plan_code: type: string title: Plan code description: If the line item is a charge or credit for a plan or add-on, this is the plan's code. maxLength: 50 add_on_id: type: string title: Add-on ID description: If the line item is a charge or credit for an add-on this is its ID. maxLength: 13 add_on_code: type: string title: Add-on code description: If the line item is a charge or credit for an add-on, this is its code. maxLength: 50 invoice_id: type: string title: Invoice ID description: Once the line item has been invoiced this will be the invoice's ID. maxLength: 13 invoice_number: type: string title: Invoice number description: 'Once the line item has been invoiced this will be the invoice''s number. If VAT taxation and the Country Invoice Sequencing feature are enabled, invoices will have country-specific invoice numbers for invoices billed to EU countries (ex: FR1001). Non-EU invoices will continue to use the site-level invoice number sequence.' previous_line_item_id: type: string title: Previous line item ID description: Will only have a value if the line item is a credit created from a previous credit, or if the credit was created from a charge refund. maxLength: 13 original_line_item_invoice_id: type: string title: Original line item's invoice ID description: The invoice where the credit originated. Will only have a value if the line item is a credit created from a previous credit, or if the credit was created from a charge refund. maxLength: 13 origin: title: Origin of line item description: A credit created from an original charge will have the value of the charge's origin. "$ref": "#/components/schemas/LineItemOriginEnum" accounting_code: type: string title: Accounting code description: Internal accounting code to help you reconcile your revenue to the correct ledger. Line items created as part of a subscription invoice will use the plan or add-on's accounting code, otherwise the value will only be present if you define an accounting code when creating the line item. maxLength: 20 product_code: type: string title: Product code description: For plan-related line items this will be the plan's code, for add-on related line items it will be the add-on's code. For item-related line items it will be the item's `external_sku`. maxLength: 50 credit_reason_code: title: Credit reason code description: The reason the credit was given when line item is `type=credit`. default: general "$ref": "#/components/schemas/FullCreditReasonCodeEnum" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 amount: type: number format: float title: Total after discounts and taxes description: "`(quantity * unit_amount) - (discount + tax)`" description: type: string title: Description description: Description that appears on the invoice. For subscription related items this will be filled in automatically. maxLength: 255 quantity: type: integer title: Quantity description: This number will be multiplied by the unit amount to compute the subtotal before any discounts or taxes. default: 1 quantity_decimal: type: string title: Quantity Decimal description: A floating-point alternative to Quantity. If this value is present, it will be used in place of Quantity for calculations, and Quantity will be the rounded integer value of this number. This field supports up to 9 decimal places. The Decimal Quantity feature must be enabled to utilize this field. unit_amount: type: number format: float title: Unit amount description: Positive amount for a charge, negative amount for a credit. unit_amount_decimal: type: string title: Unit amount decimal description: Positive amount for a charge, negative amount for a credit. tax_inclusive: type: boolean title: Tax Inclusive? description: Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to utilize this flag. subtotal: type: number format: float title: Total before discounts and taxes description: "`quantity * unit_amount`" discount: type: number format: float title: Discount description: The discount applied to the line item. tax: type: number format: float title: Tax description: The tax amount for the line item. taxable: type: boolean title: Taxable? description: "`true` if the line item is taxable, `false` if it is not." tax_exempt: type: boolean title: Tax exempt? description: "`true` exempts tax on charges, `false` applies tax on charges. If not defined, then defaults to the Plan and Site settings. This attribute does not work for credits (negative line items). Credits are always applied post-tax. Pre-tax discounts should use the Coupons feature." avalara_transaction_type: type: integer title: Avalara Transaction Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the line item is taxed. Refer to [the documentation](https://help.avalara.com/AvaTax_for_Communications/Tax_Calculation/AvaTax_for_Communications_Tax_Engine/Mapping_Resources/TM_00115_AFC_Modules_Corresponding_Transaction_Types) for more available t/s types. minimum: 0 avalara_service_type: type: integer title: Avalara Service Type description: Used by Avalara for Communications taxes. The transaction type in combination with the service type describe how the line item is taxed. @@ -21224,2758 +21230,2809 @@ components: email: type: string maxLength: 255 vat_number: type: string maxLength: 20 phone: type: string maxLength: 30 street1: type: string maxLength: 255 street2: type: string maxLength: 255 city: type: string maxLength: 255 region: type: string maxLength: 255 description: State or province. postal_code: type: string maxLength: 20 description: Zip or postal code. geo_code: type: string maxLength: 20 description: Code that represents a geographic entity (location or object). Only returned for Sling Vertex Integration country: type: string maxLength: 50 description: Country, 2-letter ISO 3166-1 alpha-2 code. required: - first_name - last_name - street1 - city - postal_code - country ShippingAddressList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ShippingAddress" ShippingMethod: type: object properties: id: type: string title: Shipping Method ID readOnly: true maxLength: 13 object: type: string title: Object type readOnly: true code: type: string title: Code description: The internal name used identify the shipping method. maxLength: 50 name: type: string title: Name description: The name of the shipping method displayed to customers. maxLength: 100 accounting_code: type: string title: Accounting Code description: Accounting code for shipping method. maxLength: 20 tax_code: type: string title: Tax code description: | Used by Avalara, Vertex, and Recurly’s built-in tax feature. The tax code values are specific to each tax system. If you are using Recurly’s built-in taxes the values are: - `FR` – Common Carrier FOB Destination - `FR022000` – Common Carrier FOB Origin - `FR020400` – Non Common Carrier FOB Destination - `FR020500` – Non Common Carrier FOB Origin - `FR010100` – Delivery by Company Vehicle Before Passage of Title - `FR010200` – Delivery by Company Vehicle After Passage of Title - `NT` – Non-Taxable maxLength: 50 created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Last updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at readOnly: true ShippingMethodMini: type: object properties: id: type: string title: Shipping Method ID readOnly: true maxLength: 13 object: type: string title: Object type readOnly: true code: type: string title: Code description: The internal name used identify the shipping method. maxLength: 50 name: type: string title: Name description: The name of the shipping method displayed to customers. maxLength: 100 ShippingMethodCreate: type: object properties: code: type: string title: Code description: The internal name used identify the shipping method. pattern: "/^[a-z0-9_+-]+$/i" maxLength: 50 name: type: string title: Name description: The name of the shipping method displayed to customers. maxLength: 100 accounting_code: type: string title: Accounting Code description: Accounting code for shipping method. maxLength: 20 tax_code: type: string title: Tax code description: | Used by Avalara, Vertex, and Recurly’s built-in tax feature. The tax code values are specific to each tax system. If you are using Recurly’s built-in taxes the values are: - `FR` – Common Carrier FOB Destination - `FR022000` – Common Carrier FOB Origin - `FR020400` – Non Common Carrier FOB Destination - `FR020500` – Non Common Carrier FOB Origin - `FR010100` – Delivery by Company Vehicle Before Passage of Title - `FR010200` – Delivery by Company Vehicle After Passage of Title - `NT` – Non-Taxable maxLength: 50 required: - code - name ShippingMethodUpdate: type: object properties: code: type: string title: Code description: The internal name used identify the shipping method. pattern: "/^[a-z0-9_+-]+$/i" maxLength: 50 name: type: string title: Name description: The name of the shipping method displayed to customers. maxLength: 100 accounting_code: type: string title: Accounting Code description: Accounting code for shipping method. maxLength: 20 tax_code: type: string title: Tax code description: | Used by Avalara, Vertex, and Recurly’s built-in tax feature. The tax code values are specific to each tax system. If you are using Recurly’s built-in taxes the values are: - `FR` – Common Carrier FOB Destination - `FR022000` – Common Carrier FOB Origin - `FR020400` – Non Common Carrier FOB Destination - `FR020500` – Non Common Carrier FOB Origin - `FR010100` – Delivery by Company Vehicle Before Passage of Title - `FR010200` – Delivery by Company Vehicle After Passage of Title - `NT` – Non-Taxable maxLength: 50 ShippingFeeCreate: type: object properties: method_id: type: string title: Method ID description: The id of the shipping method used to deliver the purchase. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 13 method_code: type: string title: Method Code description: The code of the shipping method used to deliver the purchase. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 50 amount: type: number format: float title: Amount description: This is priced in the purchase's currency. minimum: 0 ShippingAddressUpdate: type: object properties: id: type: string title: Shipping Address ID maxLength: 13 readOnly: true nickname: type: string maxLength: 255 first_name: type: string maxLength: 255 last_name: type: string maxLength: 255 company: type: string maxLength: 255 email: type: string maxLength: 255 vat_number: type: string maxLength: 20 phone: type: string maxLength: 30 street1: type: string maxLength: 255 street2: type: string maxLength: 255 city: type: string maxLength: 255 region: type: string maxLength: 255 description: State or province. postal_code: type: string maxLength: 20 description: Zip or postal code. country: type: string maxLength: 50 description: Country, 2-letter ISO 3166-1 alpha-2 code. geo_code: type: string maxLength: 20 description: Code that represents a geographic entity (location or object). Only returned for Sling Vertex Integration Site: type: object properties: id: type: string title: Site ID readOnly: true maxLength: 13 object: type: string title: Object type readOnly: true subdomain: type: string readOnly: true maxLength: 100 public_api_key: type: string title: Public API Key readOnly: true maxLength: 50 description: This value is used to configure RecurlyJS to submit tokenized billing information. mode: title: Mode maxLength: 15 readOnly: true "$ref": "#/components/schemas/SiteModeEnum" address: "$ref": "#/components/schemas/Address" settings: "$ref": "#/components/schemas/Settings" features: type: array title: Features description: A list of features enabled for the site. items: readOnly: true "$ref": "#/components/schemas/FeaturesEnum" created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at readOnly: true Subscription: type: object properties: id: type: string title: Subscription ID maxLength: 13 object: type: string title: Object type uuid: type: string title: UUID description: The UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI. maxLength: 32 account: "$ref": "#/components/schemas/AccountMini" plan: "$ref": "#/components/schemas/PlanMini" state: title: State "$ref": "#/components/schemas/SubscriptionStateEnum" shipping: "$ref": "#/components/schemas/SubscriptionShipping" coupon_redemptions: type: array title: Coupon redemptions description: Returns subscription level coupon redemptions that are tied to this subscription. items: "$ref": "#/components/schemas/CouponRedemptionMini" pending_change: "$ref": "#/components/schemas/SubscriptionChange" current_period_started_at: type: string format: date-time title: Current billing period started at current_period_ends_at: type: string format: date-time title: Current billing period ends at current_term_started_at: type: string format: date-time title: Current term started at description: The start date of the term when the first billing period starts. The subscription term is the length of time that a customer will be committed to a subscription. A term can span multiple billing periods. current_term_ends_at: type: string format: date-time title: Current term ends at description: When the term ends. This is calculated by a plan's interval and `total_billing_cycles` in a term. Subscription changes with a `timeframe=renewal` will be applied on this date. trial_started_at: type: string format: date-time title: Trial period started at trial_ends_at: type: string format: date-time title: Trial period ends at remaining_billing_cycles: type: integer title: Remaining billing cycles description: The remaining billing cycles in the current term. total_billing_cycles: type: integer title: Total billing cycles description: The number of cycles/billing periods in a term. When `remaining_billing_cycles=0`, if `auto_renew=true` the subscription will renew and a new term will begin, otherwise the subscription will expire. renewal_billing_cycles: type: integer title: Renewal billing cycles description: If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. auto_renew: type: boolean default: true title: Auto renew description: Whether the subscription renews at the end of its term. ramp_intervals: type: array title: Ramp Intervals description: The ramp intervals representing the pricing schedule for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampIntervalResponse" paused_at: type: string format: date-time title: Paused at description: Null unless subscription is paused or will pause at the end of the current billing period. remaining_pause_cycles: type: integer title: Remaining pause cycles description: Null unless subscription is paused or will pause at the end of the current billing period. currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" unit_amount: type: number format: float title: Subscription unit price tax_inclusive: type: boolean title: Tax Inclusive? description: Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to utilize this flag. quantity: type: integer title: Subscription quantity minimum: 0 add_ons: type: array title: Add-ons items: "$ref": "#/components/schemas/SubscriptionAddOn" add_ons_total: type: number format: float title: Total price of add-ons minimum: 0 subtotal: type: number format: float title: Estimated total, before tax. minimum: 0 tax: type: number format: float title: Estimated tax description: Only for merchants using Recurly's In-The-Box taxes. tax_info: "$ref": "#/components/schemas/TaxInfo" total: type: number format: float title: Estimated total collection_method: title: Collection method default: automatic "$ref": "#/components/schemas/CollectionMethodEnum" po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Net terms description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the - invoice will become past due. For any value, an additional 24 hours is + invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before - becoming past due. For example: + becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. + For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. - For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + + For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" terms_and_conditions: type: string title: Terms and conditions customer_notes: type: string title: Customer notes expiration_reason: type: string title: Expiration reason custom_fields: "$ref": "#/components/schemas/CustomFields" created_at: type: string format: date-time title: Created at updated_at: type: string format: date-time title: Last updated at activated_at: type: string format: date-time title: Activated at canceled_at: type: string format: date-time title: Canceled at expires_at: type: string format: date-time title: Expires at bank_account_authorized_at: type: string format: date-time title: Bank account authorized description: Recurring subscriptions paid with ACH will have this attribute set. This timestamp is used for alerting customers to reauthorize in 3 years in accordance with NACHA rules. If a subscription becomes inactive or the billing info is no longer a bank account, this timestamp is cleared. gateway_code: type: string title: Gateway Code description: If present, this subscription's transactions will use the payment gateway with this code. maxLength: 13 billing_info_id: type: string title: Billing Info ID description: Billing Info ID. active_invoice_id: type: string title: Active invoice ID description: The invoice ID of the latest invoice created for an active subscription. maxLength: 13 readOnly: true started_with_gift: type: boolean default: false description: Whether the subscription was started with a gift certificate. title: Started with Gift converted_at: type: string format: date-time description: When the subscription was converted from a gift card. title: Converted at action_result: type: object description: Action result params to be used in Recurly-JS to complete a payment when using asynchronous payment methods, e.g., Boleto, iDEAL and Sofort. title: Action result SubscriptionAddOn: type: object title: Subscription Add-on description: This links an Add-on to a specific Subscription. properties: id: type: string title: Subscription Add-on ID maxLength: 13 object: type: string title: Object type subscription_id: type: string title: Subscription ID maxLength: 13 add_on: "$ref": "#/components/schemas/AddOnMini" add_on_source: "$ref": "#/components/schemas/AddOnSourceEnum" quantity: type: integer title: Add-on quantity minimum: 0 unit_amount: type: number format: float title: Add-on unit price description: Supports up to 2 decimal places. unit_amount_decimal: type: string format: decimal title: Add-on unit in decimal price description: Supports up to 9 decimal places. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" tier_type: "$ref": "#/components/schemas/TierTypeEnum" usage_calculation_type: "$ref": "#/components/schemas/UsageCalculationTypeEnum" usage_timeframe: "$ref": "#/components/schemas/UsageTimeframeEnum" tiers: type: array title: Tiers items: "$ref": "#/components/schemas/SubscriptionAddOnTier" minItems: 1 description: "If tiers are provided in the request, all existing tiers on the Subscription Add-on will be\nremoved and replaced by the tiers in the request. If add_on.tier_type is tiered or volume and\nadd_on.usage_type is percentage use percentage_tiers instead. \nThere must be one tier without an `ending_quantity` value which represents the final tier.\n" percentage_tiers: type: array title: Percentage Tiers items: "$ref": "#/components/schemas/SubscriptionAddOnPercentageTier" minItems: 1 description: | If percentage tiers are provided in the request, all existing percentage tiers on the Subscription Add-on will be removed and replaced by the percentage tiers in the request. Use only if add_on.tier_type is tiered or volume and add_on.usage_type is percentage. There must be one tier without an `ending_amount` value which represents the final tier. This feature is currently in development and requires approval and enablement, please contact support. usage_percentage: type: number format: float title: Usage Percentage description: The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. Required if add_on_type is usage and usage_type is percentage. created_at: type: string format: date-time title: Created at updated_at: type: string format: date-time title: Updated at expired_at: type: string format: date-time title: Expired at SubscriptionAddOnCreate: type: object properties: code: type: string title: Add-on code maxLength: 50 description: | If `add_on_source` is set to `plan_add_on` or left blank, then plan's add-on `code` should be used. If `add_on_source` is set to `item`, then the `code` from the associated item should be used. add_on_source: "$ref": "#/components/schemas/AddOnSourceEnum" quantity: type: integer title: Quantity minimum: 0 default: 1 unit_amount: type: number format: float title: Unit amount description: | Allows up to 2 decimal places. Optionally, override the add-on's default unit amount. If the plan add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `unit_amount` cannot be provided. minimum: 0 maximum: 1000000 unit_amount_decimal: type: string format: decimal title: Unit Amount Decimal description: | Allows up to 9 decimal places. Optionally, override the add-on's default unit amount. If the plan add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `unit_amount_decimal` cannot be provided. Only supported when the plan add-on's `add_on_type` = `usage`. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided. minimum: 0 maximum: 1000000 tiers: type: array title: Tiers items: "$ref": "#/components/schemas/SubscriptionAddOnTier" minItems: 1 description: | If the plan add-on's `tier_type` is `flat`, then `tiers` must be absent. The `tiers` object must include one to many tiers with `ending_quantity` and `unit_amount`. There must be one tier without an `ending_quantity` value which represents the final tier. See our [Guide](https://recurly.com/developers/guides/item-addon-guide.html) for an overview of how to configure quantity-based pricing models. percentage_tiers: type: array title: Percentage Tiers items: "$ref": "#/components/schemas/SubscriptionAddOnPercentageTier" minItems: 1 description: | If percentage tiers are provided in the request, all existing percentage tiers on the Subscription Add-on will be removed and replaced by the percentage tiers in the request. There must be one tier without ending_amount value which represents the final tier. Use only if add_on.tier_type is tiered or volume and add_on.usage_type is percentage. This feature is currently in development and requires approval and enablement, please contact support. usage_percentage: type: number format: float title: Usage Percentage minimum: 0 maximum: 100 description: The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. Required if `add_on_type` is usage and `usage_type` is percentage. Must be omitted otherwise. `usage_percentage` does not support tiers. See our [Guide](https://recurly.com/developers/guides/usage-based-billing-guide.html) for an overview of how to configure usage add-ons. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" required: - code SubscriptionAddOnUpdate: type: object properties: id: type: string title: Subscription Add-on ID. description: | When an id is provided, the existing subscription add-on attributes will persist unless overridden in the request. maxLength: 13 code: type: string title: Add-on code maxLength: 50 description: | If a code is provided without an id, the subscription add-on attributes will be set to the current value for those attributes on the plan add-on unless provided in the request. If `add_on_source` is set to `plan_add_on` or left blank, then plan's add-on `code` should be used. If `add_on_source` is set to `item`, then the `code` from the associated item should be used. add_on_source: "$ref": "#/components/schemas/AddOnSourceEnum" quantity: type: integer title: Quantity minimum: 0 unit_amount: type: number format: float title: Unit amount description: | Allows up to 2 decimal places. Optionally, override the add-on's default unit amount. If the plan add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `unit_amount` cannot be provided. minimum: 0 maximum: 1000000 unit_amount_decimal: type: string title: Unit amount decimal description: | Allows up to 9 decimal places. Optionally, override the add-on's default unit amount. If the plan add-on's `tier_type` is `tiered`, `volume`, or `stairstep`, then `unit_amount_decimal` cannot be provided. Only supported when the plan add-on's `add_on_type` = `usage`. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided. tiers: type: array title: Tiers items: "$ref": "#/components/schemas/SubscriptionAddOnTier" minItems: 1 description: | If the plan add-on's `tier_type` is `flat`, then `tiers` must be absent. The `tiers` object must include one to many tiers with `ending_quantity` and `unit_amount`. There must be one tier without an `ending_quantity` value which represents the final tier. percentage_tiers: type: array title: Percentage Tiers items: "$ref": "#/components/schemas/SubscriptionAddOnPercentageTier" minItems: 1 description: | If percentage tiers are provided in the request, all existing percentage tiers on the Subscription Add-on will be removed and replaced by the percentage tiers in the request. Use only if add_on.tier_type is tiered or volume and add_on.usage_type is percentage. There must be one tier without an `ending_amount` value which represents the final tier. This feature is currently in development and requires approval and enablement, please contact support. usage_percentage: type: number format: float title: Usage Percentage description: The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. Required if add_on_type is usage and usage_type is percentage. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" SubscriptionAddOnTier: type: object properties: ending_quantity: type: integer title: Ending quantity minimum: 1 maximum: 999999999 default: description: Ending quantity for the tier. This represents a unit amount for unit-priced add ons. Must be left empty if it is the final tier. unit_amount: type: number format: float title: Unit amount minimum: 0 maximum: 1000000 description: Allows up to 2 decimal places. Optionally, override the tiers' default unit amount. If add-on's `add_on_type` is `usage` and `usage_type` is `percentage`, cannot be provided. unit_amount_decimal: type: string title: Unit amount decimal description: | Allows up to 9 decimal places. Optionally, override tiers' default unit amount. If `unit_amount_decimal` is provided, `unit_amount` cannot be provided. If add-on's `add_on_type` is `usage` and `usage_type` is `percentage`, cannot be provided. usage_percentage: type: string title: Usage Percentage description: "(deprecated) -- Use the percentage_tiers object instead." deprecated: true SubscriptionAddOnPercentageTier: type: object properties: ending_amount: type: number format: float title: Ending amount minimum: 1 maximum: 9999999999999.99 default: description: Ending amount for the tier. Allows up to 2 decimal places. Must be left empty if it is the final tier. usage_percentage: type: string title: Usage Percentage minimum: 0 maximum: 100 description: | The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places represented as a string. SubscriptionCancel: type: object properties: timeframe: title: Timeframe description: The timeframe parameter controls when the expiration takes place. The `bill_date` timeframe causes the subscription to expire when the subscription is scheduled to bill next. The `term_end` timeframe causes the subscription to continue to bill until the end of the subscription term, then expire. default: term_end "$ref": "#/components/schemas/TimeframeEnum" SubscriptionChange: type: object title: Subscription Change properties: id: type: string title: Subscription Change ID description: The ID of the Subscription Change. object: type: string title: Object type subscription_id: type: string title: Subscription ID description: The ID of the subscription that is going to be changed. maxLength: 13 plan: "$ref": "#/components/schemas/PlanMini" add_ons: type: array title: Add-ons description: These add-ons will be used when the subscription renews. items: "$ref": "#/components/schemas/SubscriptionAddOn" unit_amount: type: number format: float title: Unit amount tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true quantity: type: integer title: Subscription quantity shipping: "$ref": "#/components/schemas/SubscriptionShipping" activate_at: type: string format: date-time title: Activated at readOnly: true activated: type: boolean title: Activated? description: Returns `true` if the subscription change is activated. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" invoice_collection: title: Invoice Collection "$ref": "#/components/schemas/InvoiceCollection" custom_fields: "$ref": "#/components/schemas/CustomFields" created_at: type: string format: date-time title: Created at readOnly: true updated_at: type: string format: date-time title: Updated at readOnly: true deleted_at: type: string format: date-time title: Deleted at readOnly: true billing_info: "$ref": "#/components/schemas/SubscriptionChangeBillingInfo" ramp_intervals: type: array title: Ramp Intervals description: The ramp intervals representing the pricing schedule for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampIntervalResponse" SubscriptionChangeBillingInfo: type: object description: Accept nested attributes for three_d_secure_action_result_token_id properties: three_d_secure_action_result_token_id: type: string title: 3-D Secure action result token ID description: A token generated by Recurly.js after completing a 3-D Secure device fingerprinting or authentication challenge. maxLength: 22 SubscriptionChangeBillingInfoCreate: allOf: - "$ref": "#/components/schemas/SubscriptionChangeBillingInfo" SubscriptionChangeCreate: type: object properties: timeframe: title: Timeframe description: The timeframe parameter controls when the upgrade or downgrade takes place. The subscription change can occur now, when the subscription is next billed, or when the subscription term ends. Generally, if you're performing an upgrade, you will want the change to occur immediately (now). If you're performing a downgrade, you should set the timeframe to `term_end` or `bill_date` so the change takes effect at a scheduled billing date. The `renewal` timeframe option is accepted as an alias for `term_end`. default: now "$ref": "#/components/schemas/ChangeTimeframeEnum" plan_id: type: string title: Plan ID maxLength: 13 description: If you want to change to a new plan, you can provide the plan's code or id. If both are provided the `plan_id` will be used. plan_code: type: string title: New plan code maxLength: 50 description: If you want to change to a new plan, you can provide the plan's code or id. If both are provided the `plan_id` will be used. unit_amount: type: number format: float title: Custom subscription price description: Optionally, sets custom pricing for the subscription, overriding the plan's default unit amount. The subscription's current currency will be used. minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true quantity: type: integer title: Quantity description: Optionally override the default quantity of 1. default: 1 minimum: 0 shipping: "$ref": "#/components/schemas/SubscriptionChangeShippingCreate" coupon_codes: type: array title: Coupon codes description: A list of coupon_codes to be redeemed on the subscription during the change. Only allowed if timeframe is now and you change something about the subscription that creates an invoice. items: type: string add_ons: type: array title: Add-ons description: | If you provide a value for this field it will replace any existing add-ons. So, when adding or modifying an add-on, you need to include the existing subscription add-ons. Unchanged add-ons can be included just using the subscription add-on''s ID: `{"id": "abc123"}`. If this value is omitted your existing add-ons will be unaffected. To remove all existing add-ons, this value should be an empty array.' If a subscription add-on's `code` is supplied without the `id`, `{"code": "def456"}`, the subscription add-on attributes will be set to the current values of the plan add-on unless provided in the request. - If an `id` is passed, any attributes not passed in will pull from the existing subscription add-on - If a `code` is passed, any attributes not passed in will pull from the current values of the plan add-on - Attributes passed in as part of the request will override either of the above scenarios items: "$ref": "#/components/schemas/SubscriptionAddOnUpdate" collection_method: title: Collection method default: automatic "$ref": "#/components/schemas/CollectionMethodEnum" revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" custom_fields: "$ref": "#/components/schemas/CustomFields" po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Net terms description: |- Integer normally paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the invoice will become past due. During a subscription change, it's not necessary to provide both the `Net Terms Type` and `Net Terms` parameters. - For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" billing_info: "$ref": "#/components/schemas/SubscriptionChangeBillingInfoCreate" ramp_intervals: type: array title: Ramp Intervals description: The new set of ramp intervals for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampInterval" SubscriptionChangeShippingCreate: type: object title: Shipping details that will be changed on a subscription description: Shipping addresses are tied to a customer's account. Each account can have up to 20 different shipping addresses, and if you have enabled multiple subscriptions per account, you can associate different shipping addresses to each subscription. properties: method_id: type: string title: Method ID description: The id of the shipping method used to deliver the subscription. To remove shipping set this to `null` and the `amount=0`. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 13 method_code: type: string title: Method Code description: The code of the shipping method used to deliver the subscription. To remove shipping set this to `null` and the `amount=0`. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 50 amount: type: number format: float title: Assigns the subscription's shipping cost. If this is greater than zero then a `method_id` or `method_code` is required. address_id: type: string title: Shipping address ID description: Assign a shipping address from the account's existing shipping addresses. If this and address are both present, address will take precedence. address: "$ref": "#/components/schemas/ShippingAddressCreate" SubscriptionCreate: type: object properties: plan_code: type: string title: Plan code maxLength: 50 description: You must provide either a `plan_code` or `plan_id`. If both are provided the `plan_id` will be used. plan_id: type: string title: Plan ID maxLength: 13 description: You must provide either a `plan_code` or `plan_id`. If both are provided the `plan_id` will be used. account: "$ref": "#/components/schemas/AccountCreate" billing_info_id: type: string title: Billing Info ID description: The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. shipping: title: Shipping address description: Create a shipping address on the account and assign it to the subscription. "$ref": "#/components/schemas/SubscriptionShippingCreate" collection_method: title: Collection method default: automatic "$ref": "#/components/schemas/CollectionMethodEnum" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 unit_amount: type: number format: float title: Custom subscription pricing description: Override the unit amount of the subscription plan by setting this value. If not provided, the subscription will inherit the price from the subscription plan for the provided currency. minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to use this flag. quantity: type: integer title: Quantity description: Optionally override the default quantity of 1. default: 1 minimum: 0 add_ons: type: array title: Add-ons items: "$ref": "#/components/schemas/SubscriptionAddOnCreate" coupon_codes: type: array title: Coupon codes description: A list of coupon_codes to be redeemed on the subscription or account during the purchase. items: type: string custom_fields: "$ref": "#/components/schemas/CustomFields" trial_ends_at: type: string format: date-time title: Trial ends at description: If set, overrides the default trial behavior for the subscription. When the current date time or a past date time is provided the subscription will begin with no trial phase (overriding any plan default trial). When a future date time is provided the subscription will begin with a trial phase ending at the specified date time. starts_at: type: string format: date-time title: Start date description: If set, the subscription will begin in the future on this date. The subscription will apply the setup fee and trial period, unless the plan has no trial. next_bill_date: type: string format: date-time title: Next bill date description: If present, this sets the date the subscription's next billing period will start (`current_period_ends_at`). This can be used to align the subscription’s billing to a specific day of the month. The initial invoice will be prorated for the period between the subscription's activation date and the billing period end date. Subsequent periods will be based off the plan interval. For a subscription with a trial period, this will change when the trial expires. total_billing_cycles: type: integer title: Total billing cycles description: The number of cycles/billing periods in a term. When `remaining_billing_cycles=0`, if `auto_renew=true` the subscription will renew and a new term will begin, otherwise the subscription will expire. minimum: 1 renewal_billing_cycles: type: integer title: Renewal billing cycles description: If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. auto_renew: type: boolean default: true title: Auto renew description: Whether the subscription renews at the end of its term. ramp_intervals: type: array title: Ramp Intervals description: The new set of ramp intervals for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampInterval" revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" terms_and_conditions: type: string title: Terms and conditions description: This will default to the Terms and Conditions text specified on the Invoice Settings page in your Recurly admin. Specify custom notes to add or override Terms and Conditions. Custom notes will stay with a subscription on all renewals. customer_notes: type: string title: Customer notes description: This will default to the Customer Notes text specified on the Invoice Settings. Specify custom notes to add or override Customer Notes. Custom notes will stay with a subscription on all renewals. credit_customer_notes: type: string title: Credit customer notes description: If there are pending credits on the account that will be invoiced during the subscription creation, these will be used as the Customer Notes on the credit invoice. po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Net terms description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the - invoice will become past due. For any value, an additional 24 hours is + invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before - becoming past due. For example: + becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. + For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. - For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + + For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" gateway_code: type: string title: Gateway Code description: If present, this subscription's transactions will use the payment gateway with this code. maxLength: 13 transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" gift_card_redemption_code: type: string title: Gift card Redemption Code description: A gift card redemption code to be redeemed on the purchase invoice. required: - plan_code - currency - account SubscriptionPurchase: type: object properties: plan_code: type: string title: Plan code plan_id: type: string title: Plan ID maxLength: 13 unit_amount: type: number format: float title: Custom subscription pricing description: Override the unit amount of the subscription plan by setting this value. If not provided, the subscription will inherit the price from the subscription plan for the provided currency. minimum: 0 maximum: 1000000 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: Determines whether or not tax is included in the unit amount. The Tax Inclusive Pricing feature (separate from the Mixed Tax Pricing feature) must be enabled to use this flag. quantity: type: integer title: Quantity description: Optionally override the default quantity of 1. default: 1 minimum: 0 add_ons: type: array title: Add-ons items: "$ref": "#/components/schemas/SubscriptionAddOnCreate" custom_fields: "$ref": "#/components/schemas/CustomFields" shipping: title: Shipping address description: Create a shipping address on the account and assign it to the subscription. "$ref": "#/components/schemas/SubscriptionShippingPurchase" trial_ends_at: type: string format: date-time title: Trial ends at description: If set, overrides the default trial behavior for the subscription. When the current date time or a past date time is provided the subscription will begin with no trial phase (overriding any plan default trial). When a future date time is provided the subscription will begin with a trial phase ending at the specified date time. starts_at: type: string format: date-time title: Start date description: If set, the subscription will begin in the future on this date. The subscription will apply the setup fee and trial period, unless the plan has no trial. next_bill_date: type: string format: date-time title: Next bill date description: If present, this sets the date the subscription's next billing period will start (`current_period_ends_at`). This can be used to align the subscription’s billing to a specific day of the month. The initial invoice will be prorated for the period between the subscription's activation date and the billing period end date. Subsequent periods will be based off the plan interval. For a subscription with a trial period, this will change when the trial expires. total_billing_cycles: type: integer title: Total billing cycles description: The number of cycles/billing periods in a term. When `remaining_billing_cycles=0`, if `auto_renew=true` the subscription will renew and a new term will begin, otherwise the subscription will expire. minimum: 1 renewal_billing_cycles: type: integer title: Renewal billing cycles description: If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. auto_renew: type: boolean default: true title: Auto renew description: Whether the subscription renews at the end of its term. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" ramp_intervals: type: array title: Ramp Intervals description: The new set of ramp intervals for the subscription. items: "$ref": "#/components/schemas/SubscriptionRampInterval" required: - plan_code SubscriptionUpdate: type: object properties: collection_method: title: Change collection method "$ref": "#/components/schemas/CollectionMethodEnum" custom_fields: "$ref": "#/components/schemas/CustomFields" remaining_billing_cycles: type: integer title: Remaining billing cycles description: The remaining billing cycles in the current term. renewal_billing_cycles: type: integer title: Renewal billing cycles description: If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. auto_renew: type: boolean default: true title: Auto renew description: Whether the subscription renews at the end of its term. next_bill_date: type: string format: date-time title: Next bill date description: If present, this sets the date the subscription's next billing period will start (`current_period_ends_at`). This can be used to align the subscription’s billing to a specific day of the month. For a subscription in a trial period, this will change when the trial expires. This parameter is useful for postponement of a subscription to change its billing date without proration. revenue_schedule_type: title: Revenue schedule type "$ref": "#/components/schemas/RevenueScheduleTypeEnum" terms_and_conditions: type: string title: Terms and conditions description: Specify custom notes to add or override Terms and Conditions. Custom notes will stay with a subscription on all renewals. customer_notes: type: string title: Customer notes description: Specify custom notes to add or override Customer Notes. Custom notes will stay with a subscription on all renewals. po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Terms that the subscription is due on description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the - invoice will become past due. For any value, an additional 24 hours is + invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before - becoming past due. For example: + becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. + For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. - For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + + For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" gateway_code: type: string title: Gateway Code description: If present, this subscription's transactions will use the payment gateway with this code. maxLength: 13 tax_inclusive: type: boolean title: Tax Inclusive? default: false description: This field is deprecated. Please do not use it. deprecated: true shipping: "$ref": "#/components/schemas/SubscriptionShippingUpdate" billing_info_id: type: string title: Billing Info ID description: The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. SubscriptionPause: type: object properties: remaining_pause_cycles: type: integer title: Remaining pause cycles description: Number of billing cycles to pause the subscriptions. A value of 0 will cancel any pending pauses on the subscription. required: - remaining_pause_cycles SubscriptionShipping: type: object title: Subscription shipping details properties: object: type: string title: Object type address: "$ref": "#/components/schemas/ShippingAddress" method: "$ref": "#/components/schemas/ShippingMethodMini" amount: type: number format: float title: Subscription's shipping cost SubscriptionShippingCreate: type: object title: Subscription shipping details properties: address: "$ref": "#/components/schemas/ShippingAddressCreate" address_id: type: string title: Shipping address ID description: Assign a shipping address from the account's existing shipping addresses. If `address_id` and `address` are both present, `address` will be used. maxLength: 13 method_id: type: string title: Service ID description: The id of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 13 method_code: type: string title: Service Code description: The code of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 50 amount: type: number format: float title: Assigns the subscription's shipping cost. If this is greater than zero then a `method_id` or `method_code` is required. SubscriptionShippingUpdate: type: object title: Subscription shipping details properties: object: type: string title: Object type address: "$ref": "#/components/schemas/ShippingAddressCreate" address_id: type: string title: Shipping Address ID description: Assign a shipping address from the account's existing shipping addresses. maxLength: 13 SubscriptionShippingPurchase: type: object title: Subscription shipping details properties: method_id: type: string title: Service ID description: The id of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 13 method_code: type: string title: Service Code description: The code of the shipping method used to deliver the subscription. If `method_id` and `method_code` are both present, `method_id` will be used. maxLength: 50 amount: type: number format: float title: Assigns the subscription's shipping cost. If this is greater than zero then a `method_id` or `method_code` is required. SubscriptionRampInterval: type: object title: Subscription Ramp Interval properties: starting_billing_cycle: type: integer description: Represents the billing cycle where a ramp interval starts. default: 1 unit_amount: type: integer description: Represents the price for the ramp interval. SubscriptionRampIntervalResponse: type: object title: Subscription Ramp Interval properties: starting_billing_cycle: type: integer description: Represents the billing cycle where a ramp interval starts. remaining_billing_cycles: type: integer description: Represents how many billing cycles are left in a ramp interval. starting_on: type: string format: date-time title: Date the ramp interval starts ending_on: type: string format: date-time title: Date the ramp interval ends unit_amount: type: number format: float title: Unit price description: Represents the price for the ramp interval. TaxInfo: type: object title: Tax info description: Only for merchants using Recurly's In-The-Box taxes. properties: type: type: string title: Type description: Provides the tax type as "vat" for EU VAT, "usst" for U.S. Sales Tax, or the 2 letter country code for country level tax types like Canada, Australia, New Zealand, Israel, and all non-EU European countries. Not present when Avalara for Communications is enabled. region: type: string title: Region description: Provides the tax region applied on an invoice. For U.S. Sales Tax, this will be the 2 letter state code. For EU VAT this will be the 2 letter country code. For all country level tax types, this will display the regional tax, like VAT, GST, or PST. Not present when Avalara for Communications is enabled. rate: type: number format: float title: Rate description: The combined tax rate. Not present when Avalara for Communications is enabled. tax_details: type: array description: Provides additional tax details for Communications taxes when Avalara for Communications is enabled or Canadian Sales Tax when there is tax applied at both the country and province levels. This will only be populated for the Invoice response when fetching a single invoice and not for the InvoiceList or LineItemList. Only populated for a single LineItem fetch when Avalara for Communications is enabled. items: "$ref": "#/components/schemas/TaxDetail" TaxDetail: type: object title: Tax detail properties: type: type: string title: Type description: Provides the tax type for the region or type of Comminications tax when Avalara for Communications is enabled. For Canadian Sales Tax, this will be GST, HST, QST or PST. region: type: string title: Region description: Provides the tax region applied on an invoice. For Canadian Sales Tax, this will be either the 2 letter province code or country code. Not present when Avalara for Communications is enabled. rate: type: number format: float title: Rate description: Provides the tax rate for the region. tax: type: number format: float title: Tax description: The total tax applied for this tax type. name: type: string title: Name description: Provides the name of the Communications tax applied. Present only when Avalara for Communications is enabled. level: type: string title: Level description: Provides the jurisdiction level for the Communications tax applied. Example values include city, state and federal. Present only when Avalara for Communications is enabled. billable: type: boolean title: Billable description: Whether or not the line item is taxable. Only populated for a single LineItem fetch when Avalara for Communications is enabled. Transaction: type: object properties: id: type: string title: Transaction ID maxLength: 13 object: type: string title: Object type uuid: type: string title: Recurly UUID description: The UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI. maxLength: 32 original_transaction_id: type: string title: Original Transaction ID description: If this transaction is a refund (`type=refund`), this will be the ID of the original transaction on the invoice being refunded. maxLength: 13 account: "$ref": "#/components/schemas/AccountMini" invoice: "$ref": "#/components/schemas/InvoiceMini" voided_by_invoice: "$ref": "#/components/schemas/InvoiceMini" subscription_ids: type: array title: Subscription IDs description: If the transaction is charging or refunding for one or more subscriptions, these are their IDs. items: type: string title: Subscription ID maxLength: 13 type: title: Transaction type description: | - `authorization` – verifies billing information and places a hold on money in the customer's account. - `capture` – captures funds held by an authorization and completes a purchase. - `purchase` – combines the authorization and capture in one transaction. - `refund` – returns all or a portion of the money collected in a previous transaction to the customer. - `verify` – a $0 or $1 transaction used to verify billing information which is immediately voided. "$ref": "#/components/schemas/TransactionTypeEnum" origin: title: Origin of transaction description: Describes how the transaction was triggered. "$ref": "#/components/schemas/TransactionOriginEnum" currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 amount: type: number format: float title: Amount description: Total transaction amount sent to the payment gateway. status: title: Transaction status description: The current transaction status. Note that the status may change, e.g. a `pending` transaction may become `declined` or `success` may later become `void`. "$ref": "#/components/schemas/TransactionStatusEnum" success: type: boolean title: Success? description: Did this transaction complete successfully? backup_payment_method_used: type: boolean title: Backup Payment Method Used? description: Indicates if the transaction was completed using a backup payment refunded: type: boolean title: Refunded? description: Indicates if part or all of this transaction was refunded. billing_address: "$ref": "#/components/schemas/AddressWithName" collection_method: description: The method by which the payment was collected. "$ref": "#/components/schemas/CollectionMethodEnum" payment_method: "$ref": "#/components/schemas/PaymentMethod" ip_address_v4: type: string title: IP address description: | IP address provided when the billing information was collected: - When the customer enters billing information into the Recurly.js or Hosted Payment Pages, Recurly records the IP address. - When the merchant enters billing information using the API, the merchant may provide an IP address. - When the merchant enters billing information using the UI, no IP address is recorded. ip_address_country: type: string title: Origin IP address country, 2-letter ISO 3166-1 alpha-2 code, if known by Recurly. status_code: type: string title: Status code status_message: type: string title: Status message description: For declined (`success=false`) transactions, the message displayed to the merchant. customer_message: type: string title: Customer message description: For declined (`success=false`) transactions, the message displayed to the customer. customer_message_locale: type: string title: Language code for the message payment_gateway: type: object x-class-name: TransactionPaymentGateway properties: id: type: string object: type: string title: Object type type: type: string name: type: string gateway_message: type: string title: Gateway message description: Transaction message from the payment gateway. gateway_reference: type: string title: Gateway reference description: Transaction reference number from the payment gateway. gateway_approval_code: type: string title: Transaction approval code from the payment gateway. gateway_response_code: type: string title: For declined transactions (`success=false`), this field lists the gateway error code. gateway_response_time: type: number format: float title: Gateway response time description: Time, in seconds, for gateway to process the transaction. gateway_response_values: type: object title: Gateway response values description: The values in this field will vary from gateway to gateway. cvv_check: title: CVV check description: When processed, result from checking the CVV/CVC value on the transaction. "$ref": "#/components/schemas/CvvCheckEnum" avs_check: title: AVS check description: When processed, result from checking the overall AVS on the transaction. "$ref": "#/components/schemas/AvsCheckEnum" created_at: type: string format: date-time title: Created at updated_at: type: string format: date-time title: Updated at voided_at: type: string format: date-time title: Voided at collected_at: type: string format: date-time title: Collected at, or if not collected yet, the time the transaction was created. action_result: type: object description: Action result params to be used in Recurly-JS to complete a payment when using asynchronous payment methods, e.g., Boleto, iDEAL and Sofort. title: Action result vat_number: type: string description: VAT number for the customer on this transaction. If the customer's Billing Info country is BR or AR, then this will be their Tax Identifier. For all other countries this will come from the VAT Number field in the Billing Info. title: VAT Number + fraud_info: + "$ref": "#/components/schemas/TransactionFraudInfo" + TransactionFraudInfo: + type: object + title: Fraud information + readOnly: true + properties: + object: + type: string + title: Object type + readOnly: true + score: + type: integer + title: Kount score + minimum: 1 + maximum: 99 + decision: + title: Kount decision + maxLength: 10 + "$ref": "#/components/schemas/KountDecisionEnum" + reference: + type: string + title: Kount transaction reference ID + risk_rules_triggered: + type: array + title: Risk Rules Triggered + description: A list of fraud risk rules that were triggered for the transaction. + items: + "$ref": "#/components/schemas/FraudRiskRule" + FraudRiskRule: + type: object + properties: + code: + type: string + title: The Kount rule number. + message: + type: string + title: Description of why the rule was triggered ExternalTransaction: type: object properties: payment_method: type: string title: Payment Method description: Payment method used for external transaction. "$ref": "#/components/schemas/ExternalPaymentMethodEnum" description: type: string title: Description description: Used as the transaction's description. maxLength: 50 amount: type: number format: float title: Amount description: The total amount of the transcaction. Cannot excceed the invoice total. collected_at: type: string format: date-time title: Collected At description: Datetime that the external payment was collected. Defaults to current datetime. UniqueCouponCode: type: object description: A unique coupon code for a bulk coupon. properties: id: type: string title: Unique Coupon Code ID readOnly: true object: type: string title: Object type readOnly: true code: type: string title: Coupon code description: The code the customer enters to redeem the coupon. state: title: State description: Indicates if the unique coupon code is redeemable or why not. "$ref": "#/components/schemas/CouponCodeStateEnum" bulk_coupon_id: type: string title: Bulk Coupon ID description: The Coupon ID of the parent Bulk Coupon readOnly: true bulk_coupon_code: type: string title: Bulk Coupon code description: The Coupon code of the parent Bulk Coupon created_at: type: string title: Created at format: date-time readOnly: true updated_at: type: string title: Updated at format: date-time readOnly: true redeemed_at: type: string title: Redeemed at description: The date and time the unique coupon code was redeemed. format: date-time readOnly: true expired_at: type: string title: Expired at description: The date and time the coupon was expired early or reached its `max_redemptions`. format: date-time UniqueCouponCodeList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/UniqueCouponCode" UniqueCouponCodeParams: type: object description: Parameters to be passed to the `list_unique_coupon_codes` endpoint to obtain the newly generated codes. properties: limit: type: integer title: The number of UniqueCouponCodes that will be generated order: type: string title: Sort order to list newly generated UniqueCouponCodes (should always be `asc`) sort: type: string title: Sort field to list newly generated UniqueCouponCodes (should always be `created_at`) begin_time: type: string title: Begin time query parameter description: The date-time to be included when listing UniqueCouponCodes format: date-time Usage: type: object properties: id: type: string object: type: string title: Object type merchant_tag: type: string description: Custom field for recording the id in your own system associated with the usage, so you can provide auditable usage displays to your customers using a GET on this endpoint. amount: type: number format: float description: The amount of usage. Can be positive, negative, or 0. If the Decimal Quantity feature is enabled, this value will be rounded to nine decimal places. Otherwise, all digits after the decimal will be stripped. If the usage-based add-on is billed with a percentage, your usage should be a monetary amount formatted in cents (e.g., $5.00 is "500"). usage_type: "$ref": "#/components/schemas/UsageTypeEnum" tier_type: "$ref": "#/components/schemas/TierTypeEnum" tiers: type: array title: Tiers items: "$ref": "#/components/schemas/SubscriptionAddOnTier" description: The tiers and prices of the subscription based on the usage_timestamp. If tier_type = flat, tiers = [] percentage_tiers: type: array title: Percentage Tiers items: "$ref": "#/components/schemas/SubscriptionAddOnPercentageTier" description: The percentage tiers of the subscription based on the usage_timestamp. If tier_type = flat, percentage_tiers = []. This feature is currently in development and requires approval and enablement, please contact support. measured_unit_id: type: string description: The ID of the measured unit associated with the add-on the usage record is for. recording_timestamp: type: string format: date-time description: When the usage was recorded in your system. usage_timestamp: type: string format: date-time description: When the usage actually happened. This will define the line item dates this usage is billed under and is important for revenue recognition. usage_percentage: type: number format: float title: Usage Percentage description: The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. unit_amount: type: number format: float title: Unit price unit_amount_decimal: type: string title: Unit Amount Decimal minimum: 0 maximum: 1000000 description: Unit price that can optionally support a sub-cent value. billed_at: type: string format: date-time description: When the usage record was billed on an invoice. created_at: type: string format: date-time description: When the usage record was created in Recurly. updated_at: type: string format: date-time description: When the usage record was billed on an invoice. UsageCreate: type: object properties: merchant_tag: type: string description: Custom field for recording the id in your own system associated with the usage, so you can provide auditable usage displays to your customers using a GET on this endpoint. amount: type: number format: float description: The amount of usage. Can be positive, negative, or 0. If the Decimal Quantity feature is enabled, this value will be rounded to nine decimal places. Otherwise, all digits after the decimal will be stripped. If the usage-based add-on is billed with a percentage, your usage should be a monetary amount formatted in cents (e.g., $5.00 is "500"). recording_timestamp: type: string format: date-time description: When the usage was recorded in your system. usage_timestamp: type: string format: date-time description: When the usage actually happened. This will define the line item dates this usage is billed under and is important for revenue recognition. UsageList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/Usage" User: type: object properties: id: type: string readOnly: true object: type: string title: Object type readOnly: true email: type: string format: email first_name: type: string last_name: type: string time_zone: type: string created_at: type: string format: date-time readOnly: true deleted_at: type: string format: date-time readOnly: true PurchaseCreate: type: object description: A purchase is only a request data type and is not persistent in Recurly, an InvoiceCollection will be the returned type. properties: currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 account: "$ref": "#/components/schemas/AccountPurchase" billing_info_id: type: string description: The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. collection_method: title: Collection method description: Must be set to manual in order to preview a purchase for an Account that does not have payment information associated with the Billing Info. default: automatic "$ref": "#/components/schemas/CollectionMethodEnum" po_number: type: string title: Purchase order number description: For manual invoicing, this identifies the PO number associated with the subscription. maxLength: 50 net_terms: type: integer title: Net terms description: |- Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the - invoice will become past due. For any value, an additional 24 hours is + invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before - becoming past due. For example: + becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. + For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. - For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + + For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: "$ref": "#/components/schemas/NetTermsTypeEnum" terms_and_conditions: type: string title: Terms and conditions description: Terms and conditions to be put on the purchase invoice. customer_notes: type: string title: Customer notes vat_reverse_charge_notes: type: string title: VAT reverse charge notes description: VAT reverse charge notes for cross border European tax settlement. credit_customer_notes: type: string title: Credit customer notes description: Notes to be put on the credit invoice resulting from credits in the purchase, if any. gateway_code: type: string title: Gateway Code description: The default payment gateway identifier to be used for the purchase transaction. This will also be applied as the default for any subscriptions included in the purchase request. maxLength: 13 shipping: type: object x-class-name: ShippingPurchase properties: address_id: type: string title: Shipping address ID description: Assign a shipping address from the account's existing shipping addresses. If this and `address` are both present, `address` will take precedence. maxLength: 13 address: "$ref": "#/components/schemas/ShippingAddressCreate" fees: type: array title: Shipping fees description: A list of shipping fees to be created as charges with the purchase. items: "$ref": "#/components/schemas/ShippingFeeCreate" line_items: type: array title: Line items description: A list of one time charges or credits to be created with the purchase. items: "$ref": "#/components/schemas/LineItemCreate" subscriptions: type: array title: Subscriptions description: A list of subscriptions to be created with the purchase. items: "$ref": "#/components/schemas/SubscriptionPurchase" coupon_codes: type: array title: Coupon codes description: A list of coupon_codes to be redeemed on the subscription or account during the purchase. items: type: string gift_card_redemption_code: type: string title: Gift card redemption code description: A gift card redemption code to be redeemed on the purchase invoice. transaction_type: description: An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. "$ref": "#/components/schemas/GatewayTransactionTypeEnum" required: - currency - account DunningCampaign: type: object description: Settings for a dunning campaign. properties: id: type: string object: type: string title: Object type code: type: string description: Campaign code. name: type: string description: Campaign name. description: type: string description: Campaign description. default_campaign: type: boolean description: Whether or not this is the default campaign for accounts or plans without an assigned dunning campaign. dunning_cycles: type: array description: Dunning Cycle settings. items: "$ref": "#/components/schemas/DunningCycle" created_at: type: string format: date-time description: When the current campaign was created in Recurly. updated_at: type: string format: date-time description: When the current campaign was updated in Recurly. deleted_at: type: string format: date-time description: When the current campaign was deleted in Recurly. DunningCampaignList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/DunningCampaign" DunningCycle: type: object properties: type: "$ref": "#/components/schemas/DunningCycleTypeEnum" applies_to_manual_trial: type: boolean description: Whether the dunning settings will be applied to manual trials. Only applies to trial cycles. first_communication_interval: type: integer description: The number of days after a transaction failure before the first dunning email is sent. send_immediately_on_hard_decline: type: boolean description: Whether or not to send an extra email immediately to customers whose initial payment attempt fails with either a hard decline or invalid billing info. intervals: type: array description: Dunning intervals. items: "$ref": "#/components/schemas/DunningInterval" expire_subscription: type: boolean description: Whether the subscription(s) should be cancelled at the end of the dunning cycle. fail_invoice: type: boolean description: Whether the invoice should be failed at the end of the dunning cycle. total_dunning_days: type: integer description: The number of days between the first dunning email being sent and the end of the dunning cycle. total_recycling_days: type: integer description: The number of days between a transaction failure and the end of the dunning cycle. version: type: integer description: Current campaign version. created_at: type: string format: date-time description: When the current settings were created in Recurly. updated_at: type: string format: date-time description: When the current settings were updated in Recurly. DunningInterval: properties: days: type: integer description: Number of days before sending the next email. email_template: type: string description: Email template being used. DunningCampaignsBulkUpdate: properties: plan_codes: type: array maxItems: 200 description: List of `plan_codes` associated with the Plans for which the dunning campaign should be updated. Required unless `plan_ids` is present. items: type: string plan_ids: type: array maxItems: 200 description: List of `plan_ids` associated with the Plans for which the dunning campaign should be updated. Required unless `plan_codes` is present. items: type: string DunningCampaignsBulkUpdateResponse: properties: object: type: string title: Object type readOnly: true plans: type: array title: Plans description: An array containing all of the `Plan` resources that have been updated. maxItems: 200 items: "$ref": "#/components/schemas/Plan" Entitlements: type: object description: A list of privileges granted to a customer through the purchase of a plan or item. properties: object: type: string title: Object Type has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/Entitlement" Entitlement: type: object properties: object: type: string description: Entitlement customer_permission: "$ref": "#/components/schemas/CustomerPermission" granted_by: type: array description: Subscription or item that granted the customer permission. items: "$ref": "#/components/schemas/GrantedBy" created_at: type: string format: date-time description: Time object was created. updated_at: type: string format: date-time description: Time the object was last updated ExternalPaymentPhase: type: object description: Details of payments in the lifecycle of a subscription from an external resource that is not managed by the Recurly platform, e.g. App Store or Google Play Store. properties: id: type: string title: External payment phase ID description: System-generated unique identifier for an external payment phase ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type external_subscription: "$ref": "#/components/schemas/ExternalSubscription" started_at: type: string format: date-time title: Started At ends_at: type: string format: date-time title: Ends At starting_billing_period_index: type: integer title: Starting Billing Period Index ending_billing_period_index: type: integer title: Ending Billing Period Index offer_type: type: string title: Offer Type description: Type of discount offer given, e.g. "FREE_TRIAL" offer_name: type: string title: Offer Name description: Name of the discount offer given, e.g. "introductory" period_count: type: integer title: Period Count description: Number of billing periods period_length: type: string title: Period Length description: Billing cycle length amount: type: string format: decimal title: Amount minimum: 0 description: Allows up to 9 decimal places currency: type: string title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 created_at: type: string format: date-time title: Created at description: When the external subscription was created in Recurly. updated_at: type: string format: date-time title: Updated at description: When the external subscription was updated in Recurly. ExternalPaymentPhaseList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalPaymentPhase" ExternalProduct: type: object description: Product from an external resource such as Apple App Store or Google Play Store. properties: id: type: string title: External product ID. description: System-generated unique identifier for an external product ID, e.g. `e28zov4fw0v2`. object: type: string title: Object type name: type: string title: Name description: Name to identify the external product in Recurly. plan: "$ref": "#/components/schemas/PlanMini" created_at: type: string format: date-time description: When the external product was created in Recurly. updated_at: type: string format: date-time description: When the external product was updated in Recurly. external_product_references: type: array title: External Product References description: List of external product references of the external product. items: "$ref": "#/components/schemas/ExternalProductReferenceMini" ExternalProductList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalProduct" ExternalProductCreate: type: object properties: name: type: string description: External product name. plan_id: type: string description: Recurly plan UUID. external_product_references: type: array title: External Product References description: List of external product references of the external product. items: "$ref": "#/components/schemas/ExternalProductReferenceBase" required: - name ExternalProductUpdate: type: object properties: plan_id: type: string description: Recurly plan UUID. required: - plan_id ExternalProductReferenceBase: type: object properties: reference_code: type: string description: A code which associates the external product to a corresponding object or resource in an external platform like the Apple App Store or Google Play Store. maxLength: 255 external_connection_type: "$ref": "#/components/schemas/ExternalProductReferenceConnectionTypeEnum" ExternalProductReferenceCollection: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalProductReferenceMini" ExternalProductReferenceCreate: allOf: - "$ref": "#/components/schemas/ExternalProductReferenceBase" required: - reference_code - external_connection_type ExternalProductReferenceUpdate: allOf: - "$ref": "#/components/schemas/ExternalProductReferenceBase" ExternalProductReferenceConnectionTypeEnum: type: string enum: - apple_app_store - google_play_store ExternalAccountList: type: object properties: object: type: string title: Object type description: Will always be List. has_more: type: boolean description: Indicates there are more results on subsequent pages. next: type: string description: Path to subsequent page of results. data: type: array items: "$ref": "#/components/schemas/ExternalAccount" ExternalAccountCreate: type: object properties: external_account_code: type: string description: Represents the account code for the external account. external_connection_type: type: string description: Represents the connection type. `AppleAppStore` or `GooglePlayStore` required: - external_account_code - external_connection_type ExternalAccountUpdate: type: object properties: external_account_code: type: string description: Represents the account code for the external account. external_connection_type: type: string description: Represents the connection type. `AppleAppStore` or `GooglePlayStore` ExternalAccount: type: object title: External Account properties: object: type: string default: external_account id: type: string description: UUID of the external_account .
recurly/recurly-client-php
1a02d110b61a77163027156f574f494fb8c0305e
4.43.0
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 0ab8541..fe44c0f 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 4.42.0 +current_version = 4.43.0 parse = (?P<major>\d+) \.(?P<minor>\d+) \.(?P<patch>\d+) serialize = {major}.{minor}.{patch} [bumpversion:file:composer.json] [bumpversion:file:lib/recurly/version.php] diff --git a/CHANGELOG.md b/CHANGELOG.md index 54fe75b..66dd568 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,511 +1,522 @@ # Changelog +## [4.43.0](https://github.com/recurly/recurly-client-php/tree/4.43.0) (2023-12-06) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.42.0...4.43.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 (External Payment Phases) [#785](https://github.com/recurly/recurly-client-php/pull/785) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.42.0](https://github.com/recurly/recurly-client-php/tree/4.42.0) (2023-11-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.41.0...4.42.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#783](https://github.com/recurly/recurly-client-php/pull/783) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.41.0](https://github.com/recurly/recurly-client-php/tree/4.41.0) (2023-08-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.40.0...4.41.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (`VATNumber`, `LifecycleDecline`) [#782](https://github.com/recurly/recurly-client-php/pull/782) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.40.0](https://github.com/recurly/recurly-client-php/tree/4.40.0) (2023-08-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.39.0...4.40.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (action_result) [#781](https://github.com/recurly/recurly-client-php/pull/781) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.39.0](https://github.com/recurly/recurly-client-php/tree/4.39.0) (2023-07-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.37.0...4.39.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Ramp Dates, Net Terms, Invoice Business Entity) [#779](https://github.com/recurly/recurly-client-php/pull/779) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (App Management - External Subscriptions) [#777](https://github.com/recurly/recurly-client-php/pull/777) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.37.0](https://github.com/recurly/recurly-client-php/tree/4.37.0) (2023-06-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.36.0...4.37.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Multiple Business Entities) [#769](https://github.com/recurly/recurly-client-php/pull/769) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.36.0](https://github.com/recurly/recurly-client-php/tree/4.36.0) (2023-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.35.0...4.36.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Products & References) [#766](https://github.com/recurly/recurly-client-php/pull/766) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.35.0](https://github.com/recurly/recurly-client-php/tree/4.35.0) (2023-05-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.34.0...4.35.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (gateway_attributes on PaymentMethod) [#764](https://github.com/recurly/recurly-client-php/pull/764) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#747](https://github.com/recurly/recurly-client-php/pull/747) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.28.0](https://github.com/recurly/recurly-client-php/tree/4.28.0) (2023-02-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.27.0...4.28.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (GiftCard endpoints and new transaction error support) [#745](https://github.com/recurly/recurly-client-php/pull/745) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.27.0](https://github.com/recurly/recurly-client-php/tree/4.27.0) (2023-01-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.26.0...4.27.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Custom Fields on Line Items) [#738](https://github.com/recurly/recurly-client-php/pull/738) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.26.0](https://github.com/recurly/recurly-client-php/tree/4.26.0) (2023-01-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.25.0...4.26.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Account Preferred Time Zone) [#736](https://github.com/recurly/recurly-client-php/pull/736) ([douglasmiller](https://github.com/douglasmiller)) ## [4.25.0](https://github.com/recurly/recurly-client-php/tree/4.25.0) (2022-11-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.24.0...4.25.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Apply Credit Balance feature) [#732](https://github.com/recurly/recurly-client-php/pull/732) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.24.0](https://github.com/recurly/recurly-client-php/tree/4.24.0) (2022-11-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.23.0...4.24.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Subscriptions feature) [#729](https://github.com/recurly/recurly-client-php/pull/729) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#728](https://github.com/recurly/recurly-client-php/pull/728) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.23.0](https://github.com/recurly/recurly-client-php/tree/4.23.0) (2022-10-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.22.0...4.23.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entitlements feature) [#725](https://github.com/recurly/recurly-client-php/pull/725) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.22.0](https://github.com/recurly/recurly-client-php/tree/4.22.0) (2022-10-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.2...4.22.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25(Decimal Usage and Quantities and DunningEvent new fields) [#722](https://github.com/recurly/recurly-client-php/pull/722) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.2](https://github.com/recurly/recurly-client-php/tree/4.21.2) (2022-09-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.1...4.21.2) **Merged Pull Requests** - feat: allow for psr/log ^2/3 [#716](https://github.com/recurly/recurly-client-php/pull/716) ([trickeyone](https://github.com/trickeyone)) ## [4.21.1](https://github.com/recurly/recurly-client-php/tree/4.21.1) (2022-09-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.0...4.21.1) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#714](https://github.com/recurly/recurly-client-php/pull/714) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.0](https://github.com/recurly/recurly-client-php/tree/4.21.0) (2022-09-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.20.0...4.21.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#713](https://github.com/recurly/recurly-client-php/pull/713) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixes bug with putDunningCampaignBulkUpdate [#706](https://github.com/recurly/recurly-client-php/pull/706) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.20.0](https://github.com/recurly/recurly-client-php/tree/4.20.0) (2022-08-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.19.0...4.20.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#701](https://github.com/recurly/recurly-client-php/pull/701) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.19.0](https://github.com/recurly/recurly-client-php/tree/4.19.0) (2022-07-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.18.0...4.19.0) **Merged Pull Requests** - Fixing deprecation warnings in client [#697](https://github.com/recurly/recurly-client-php/pull/697) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#695](https://github.com/recurly/recurly-client-php/pull/695) ([recurly-integrations](https://github.com/recurly-integrations)) **Closed Issues** - Recurly\Pager and \Iterator return type mismatch (PHP 8.1 deprecation) [#677](https://github.com/recurly/recurly-client-php/issues/677) ## [4.18.0](https://github.com/recurly/recurly-client-php/tree/4.18.0) (2022-06-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.17.0...4.18.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#693](https://github.com/recurly/recurly-client-php/pull/693) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.17.0](https://github.com/recurly/recurly-client-php/tree/4.17.0) (2022-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.16.0...4.17.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#679](https://github.com/recurly/recurly-client-php/pull/679) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.16.0](https://github.com/recurly/recurly-client-php/tree/4.16.0) (2022-03-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.15.0...4.16.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#676](https://github.com/recurly/recurly-client-php/pull/676) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.15.0](https://github.com/recurly/recurly-client-php/tree/4.15.0) (2022-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.14.0...4.15.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#668](https://github.com/recurly/recurly-client-php/pull/668) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.14.0](https://github.com/recurly/recurly-client-php/tree/4.14.0) (2022-03-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.13.0...4.14.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#664](https://github.com/recurly/recurly-client-php/pull/664) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.13.0](https://github.com/recurly/recurly-client-php/tree/4.13.0) (2022-01-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.12.0...4.13.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#655](https://github.com/recurly/recurly-client-php/pull/655) ([recurly-integrations](https://github.com/recurly-integrations)) - Add region argument to client to connect in EU data center [#653](https://github.com/recurly/recurly-client-php/pull/653) ([FabricioCoutinho](https://github.com/FabricioCoutinho)) ## [4.12.0](https://github.com/recurly/recurly-client-php/tree/4.12.0) (2022-01-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.11.0...4.12.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Invoice Customization) [#654](https://github.com/recurly/recurly-client-php/pull/654) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#651](https://github.com/recurly/recurly-client-php/pull/651) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.11.0](https://github.com/recurly/recurly-client-php/tree/4.11.0) (2021-12-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.10.0...4.11.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Tax Inclusive Pricing) [#650](https://github.com/recurly/recurly-client-php/pull/650) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.10.0](https://github.com/recurly/recurly-client-php/tree/4.10.0) (2021-11-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.9.0...4.10.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#647](https://github.com/recurly/recurly-client-php/pull/647) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#645](https://github.com/recurly/recurly-client-php/pull/645) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#644](https://github.com/recurly/recurly-client-php/pull/644) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#639](https://github.com/recurly/recurly-client-php/pull/639) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.9.0](https://github.com/recurly/recurly-client-php/tree/4.9.0) (2021-09-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.8.0...4.9.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Support to new subscription fields and response) [#633](https://github.com/recurly/recurly-client-php/pull/633) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.8.0](https://github.com/recurly/recurly-client-php/tree/4.8.0) (2021-09-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.7.0...4.8.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Dunning Campaigns feature) [#632](https://github.com/recurly/recurly-client-php/pull/632) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.7.0](https://github.com/recurly/recurly-client-php/tree/4.7.0) (2021-08-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.6.0...4.7.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (get_preview_renewal) [#630](https://github.com/recurly/recurly-client-php/pull/630) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.6.0](https://github.com/recurly/recurly-client-php/tree/4.6.0) (2021-08-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.5.0...4.6.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#628](https://github.com/recurly/recurly-client-php/pull/628) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.5.0](https://github.com/recurly/recurly-client-php/tree/4.5.0) (2021-08-02) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.4.0...4.5.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#623](https://github.com/recurly/recurly-client-php/pull/623) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixing issue with http_build_query converting booleans in params to integers [#621](https://github.com/recurly/recurly-client-php/pull/621) ([ZloeSabo](https://github.com/ZloeSabo)) ## [4.4.0](https://github.com/recurly/recurly-client-php/tree/4.4.0) (2021-06-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.3.0...4.4.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#613](https://github.com/recurly/recurly-client-php/pull/613) ([recurly-integrations](https://github.com/recurly-integrations)) - Add PHP 8.0 to travis matrix [#592](https://github.com/recurly/recurly-client-php/pull/592) ([douglasmiller](https://github.com/douglasmiller)) ## [4.3.0](https://github.com/recurly/recurly-client-php/tree/4.3.0) (2021-06-04) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.2.0...4.3.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#612](https://github.com/recurly/recurly-client-php/pull/612) ([recurly-integrations](https://github.com/recurly-integrations)) - Adding psr/log requirement to composer.json [#611](https://github.com/recurly/recurly-client-php/pull/611) ([douglasmiller](https://github.com/douglasmiller)) ## [4.2.0](https://github.com/recurly/recurly-client-php/tree/4.2.0) (2021-04-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.1.0...4.2.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#606](https://github.com/recurly/recurly-client-php/pull/606) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.1.0](https://github.com/recurly/recurly-client-php/tree/4.1.0) (2021-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.0.1...4.1.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Backup Payment Method) [#603](https://github.com/recurly/recurly-client-php/pull/603) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#599](https://github.com/recurly/recurly-client-php/pull/599) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (Usage Percentage on Tiers) [#598](https://github.com/recurly/recurly-client-php/pull/598) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.0.1](https://github.com/recurly/recurly-client-php/tree/4.0.1) (2021-03-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.0.0...4.0.1) **Merged Pull Requests** - Release 4.0.1 [#596](https://github.com/recurly/recurly-client-php/pull/596) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#595](https://github.com/recurly/recurly-client-php/pull/595) ([recurly-integrations](https://github.com/recurly-integrations)) - Sync updates not ported from 3.x client [#590](https://github.com/recurly/recurly-client-php/pull/590) ([douglasmiller](https://github.com/douglasmiller)) - Replace empty() with is_null() [#588](https://github.com/recurly/recurly-client-php/pull/588) ([joannasese](https://github.com/joannasese)) ## [4.0.0](https://github.com/recurly/recurly-client-php/tree/4.0.0) (2021-03-01) diff --git a/composer.json b/composer.json index 33dd8b6..e6f784a 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,38 @@ { "name": "recurly/recurly-client", - "version": "4.42.0", + "version": "4.43.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], "homepage": "https://github.com/recurly/recurly-client-php", "license": "MIT", "authors": [], "require": { "php": ">= 7.2.0", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "phpcompatibility/php-compatibility": "^9.3", "phpdocumentor/phpdocumentor": "~3.0.0", "phpstan/phpstan": "^0.12.11", "phpunit/phpunit": "^8", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "classmap": ["lib"], "files": ["lib/recurly.php"] }, "autoload-dev": { "classmap": ["tests"] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/lib/recurly/version.php b/lib/recurly/version.php index 20e88c4..9496435 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -1,8 +1,8 @@ <?php namespace Recurly; class Version { - public const CURRENT = '4.42.0'; + public const CURRENT = '4.43.0'; }
recurly/recurly-client-php
f9b46aa5eaabbfbec967153f4e8ef8fc208bca7b
4.42.0
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index b0d75b1..0ab8541 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,11 +1,11 @@ [bumpversion] -current_version = 4.41.0 +current_version = 4.42.0 parse = (?P<major>\d+) \.(?P<minor>\d+) \.(?P<patch>\d+) serialize = {major}.{minor}.{patch} [bumpversion:file:composer.json] [bumpversion:file:lib/recurly/version.php] diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c9f3b1..54fe75b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,500 +1,511 @@ # Changelog +## [4.42.0](https://github.com/recurly/recurly-client-php/tree/4.42.0) (2023-11-07) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.41.0...4.42.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 [#783](https://github.com/recurly/recurly-client-php/pull/783) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.41.0](https://github.com/recurly/recurly-client-php/tree/4.41.0) (2023-08-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.40.0...4.41.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (`VATNumber`, `LifecycleDecline`) [#782](https://github.com/recurly/recurly-client-php/pull/782) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.40.0](https://github.com/recurly/recurly-client-php/tree/4.40.0) (2023-08-10) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.39.0...4.40.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (action_result) [#781](https://github.com/recurly/recurly-client-php/pull/781) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.39.0](https://github.com/recurly/recurly-client-php/tree/4.39.0) (2023-07-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.37.0...4.39.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Ramp Dates, Net Terms, Invoice Business Entity) [#779](https://github.com/recurly/recurly-client-php/pull/779) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (App Management - External Subscriptions) [#777](https://github.com/recurly/recurly-client-php/pull/777) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.37.0](https://github.com/recurly/recurly-client-php/tree/4.37.0) (2023-06-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.36.0...4.37.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Multiple Business Entities) [#769](https://github.com/recurly/recurly-client-php/pull/769) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.36.0](https://github.com/recurly/recurly-client-php/tree/4.36.0) (2023-05-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.35.0...4.36.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Products & References) [#766](https://github.com/recurly/recurly-client-php/pull/766) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.35.0](https://github.com/recurly/recurly-client-php/tree/4.35.0) (2023-05-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.34.0...4.35.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (gateway_attributes on PaymentMethod) [#764](https://github.com/recurly/recurly-client-php/pull/764) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#747](https://github.com/recurly/recurly-client-php/pull/747) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.28.0](https://github.com/recurly/recurly-client-php/tree/4.28.0) (2023-02-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.27.0...4.28.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (GiftCard endpoints and new transaction error support) [#745](https://github.com/recurly/recurly-client-php/pull/745) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.27.0](https://github.com/recurly/recurly-client-php/tree/4.27.0) (2023-01-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.26.0...4.27.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Custom Fields on Line Items) [#738](https://github.com/recurly/recurly-client-php/pull/738) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.26.0](https://github.com/recurly/recurly-client-php/tree/4.26.0) (2023-01-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.25.0...4.26.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Account Preferred Time Zone) [#736](https://github.com/recurly/recurly-client-php/pull/736) ([douglasmiller](https://github.com/douglasmiller)) ## [4.25.0](https://github.com/recurly/recurly-client-php/tree/4.25.0) (2022-11-17) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.24.0...4.25.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Apply Credit Balance feature) [#732](https://github.com/recurly/recurly-client-php/pull/732) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.24.0](https://github.com/recurly/recurly-client-php/tree/4.24.0) (2022-11-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.23.0...4.24.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (External Subscriptions feature) [#729](https://github.com/recurly/recurly-client-php/pull/729) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#728](https://github.com/recurly/recurly-client-php/pull/728) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.23.0](https://github.com/recurly/recurly-client-php/tree/4.23.0) (2022-10-27) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.22.0...4.23.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Entitlements feature) [#725](https://github.com/recurly/recurly-client-php/pull/725) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.22.0](https://github.com/recurly/recurly-client-php/tree/4.22.0) (2022-10-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.2...4.22.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25(Decimal Usage and Quantities and DunningEvent new fields) [#722](https://github.com/recurly/recurly-client-php/pull/722) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.2](https://github.com/recurly/recurly-client-php/tree/4.21.2) (2022-09-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.1...4.21.2) **Merged Pull Requests** - feat: allow for psr/log ^2/3 [#716](https://github.com/recurly/recurly-client-php/pull/716) ([trickeyone](https://github.com/trickeyone)) ## [4.21.1](https://github.com/recurly/recurly-client-php/tree/4.21.1) (2022-09-08) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.21.0...4.21.1) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#714](https://github.com/recurly/recurly-client-php/pull/714) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.21.0](https://github.com/recurly/recurly-client-php/tree/4.21.0) (2022-09-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.20.0...4.21.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#713](https://github.com/recurly/recurly-client-php/pull/713) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixes bug with putDunningCampaignBulkUpdate [#706](https://github.com/recurly/recurly-client-php/pull/706) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.20.0](https://github.com/recurly/recurly-client-php/tree/4.20.0) (2022-08-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.19.0...4.20.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#701](https://github.com/recurly/recurly-client-php/pull/701) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.19.0](https://github.com/recurly/recurly-client-php/tree/4.19.0) (2022-07-07) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.18.0...4.19.0) **Merged Pull Requests** - Fixing deprecation warnings in client [#697](https://github.com/recurly/recurly-client-php/pull/697) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#695](https://github.com/recurly/recurly-client-php/pull/695) ([recurly-integrations](https://github.com/recurly-integrations)) **Closed Issues** - Recurly\Pager and \Iterator return type mismatch (PHP 8.1 deprecation) [#677](https://github.com/recurly/recurly-client-php/issues/677) ## [4.18.0](https://github.com/recurly/recurly-client-php/tree/4.18.0) (2022-06-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.17.0...4.18.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#693](https://github.com/recurly/recurly-client-php/pull/693) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.17.0](https://github.com/recurly/recurly-client-php/tree/4.17.0) (2022-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.16.0...4.17.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#679](https://github.com/recurly/recurly-client-php/pull/679) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.16.0](https://github.com/recurly/recurly-client-php/tree/4.16.0) (2022-03-24) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.15.0...4.16.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#676](https://github.com/recurly/recurly-client-php/pull/676) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.15.0](https://github.com/recurly/recurly-client-php/tree/4.15.0) (2022-03-14) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.14.0...4.15.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Percentage tiers feature) [#668](https://github.com/recurly/recurly-client-php/pull/668) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.14.0](https://github.com/recurly/recurly-client-php/tree/4.14.0) (2022-03-03) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.13.0...4.14.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#664](https://github.com/recurly/recurly-client-php/pull/664) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.13.0](https://github.com/recurly/recurly-client-php/tree/4.13.0) (2022-01-31) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.12.0...4.13.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#655](https://github.com/recurly/recurly-client-php/pull/655) ([recurly-integrations](https://github.com/recurly-integrations)) - Add region argument to client to connect in EU data center [#653](https://github.com/recurly/recurly-client-php/pull/653) ([FabricioCoutinho](https://github.com/FabricioCoutinho)) ## [4.12.0](https://github.com/recurly/recurly-client-php/tree/4.12.0) (2022-01-28) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.11.0...4.12.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Invoice Customization) [#654](https://github.com/recurly/recurly-client-php/pull/654) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#651](https://github.com/recurly/recurly-client-php/pull/651) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.11.0](https://github.com/recurly/recurly-client-php/tree/4.11.0) (2021-12-29) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.10.0...4.11.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Tax Inclusive Pricing) [#650](https://github.com/recurly/recurly-client-php/pull/650) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.10.0](https://github.com/recurly/recurly-client-php/tree/4.10.0) (2021-11-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.9.0...4.10.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#647](https://github.com/recurly/recurly-client-php/pull/647) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#645](https://github.com/recurly/recurly-client-php/pull/645) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#644](https://github.com/recurly/recurly-client-php/pull/644) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#639](https://github.com/recurly/recurly-client-php/pull/639) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.9.0](https://github.com/recurly/recurly-client-php/tree/4.9.0) (2021-09-16) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.8.0...4.9.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Support to new subscription fields and response) [#633](https://github.com/recurly/recurly-client-php/pull/633) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.8.0](https://github.com/recurly/recurly-client-php/tree/4.8.0) (2021-09-01) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.7.0...4.8.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Dunning Campaigns feature) [#632](https://github.com/recurly/recurly-client-php/pull/632) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.7.0](https://github.com/recurly/recurly-client-php/tree/4.7.0) (2021-08-19) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.6.0...4.7.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (get_preview_renewal) [#630](https://github.com/recurly/recurly-client-php/pull/630) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.6.0](https://github.com/recurly/recurly-client-php/tree/4.6.0) (2021-08-11) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.5.0...4.6.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#628](https://github.com/recurly/recurly-client-php/pull/628) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.5.0](https://github.com/recurly/recurly-client-php/tree/4.5.0) (2021-08-02) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.4.0...4.5.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#623](https://github.com/recurly/recurly-client-php/pull/623) ([recurly-integrations](https://github.com/recurly-integrations)) - Fixing issue with http_build_query converting booleans in params to integers [#621](https://github.com/recurly/recurly-client-php/pull/621) ([ZloeSabo](https://github.com/ZloeSabo)) ## [4.4.0](https://github.com/recurly/recurly-client-php/tree/4.4.0) (2021-06-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.3.0...4.4.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#613](https://github.com/recurly/recurly-client-php/pull/613) ([recurly-integrations](https://github.com/recurly-integrations)) - Add PHP 8.0 to travis matrix [#592](https://github.com/recurly/recurly-client-php/pull/592) ([douglasmiller](https://github.com/douglasmiller)) ## [4.3.0](https://github.com/recurly/recurly-client-php/tree/4.3.0) (2021-06-04) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.2.0...4.3.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#612](https://github.com/recurly/recurly-client-php/pull/612) ([recurly-integrations](https://github.com/recurly-integrations)) - Adding psr/log requirement to composer.json [#611](https://github.com/recurly/recurly-client-php/pull/611) ([douglasmiller](https://github.com/douglasmiller)) ## [4.2.0](https://github.com/recurly/recurly-client-php/tree/4.2.0) (2021-04-21) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.1.0...4.2.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 [#606](https://github.com/recurly/recurly-client-php/pull/606) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.1.0](https://github.com/recurly/recurly-client-php/tree/4.1.0) (2021-04-15) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.0.1...4.1.0) **Merged Pull Requests** - Generated Latest Changes for v2021-02-25 (Backup Payment Method) [#603](https://github.com/recurly/recurly-client-php/pull/603) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 [#599](https://github.com/recurly/recurly-client-php/pull/599) ([recurly-integrations](https://github.com/recurly-integrations)) - Generated Latest Changes for v2021-02-25 (Usage Percentage on Tiers) [#598](https://github.com/recurly/recurly-client-php/pull/598) ([recurly-integrations](https://github.com/recurly-integrations)) ## [4.0.1](https://github.com/recurly/recurly-client-php/tree/4.0.1) (2021-03-23) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.0.0...4.0.1) **Merged Pull Requests** - Release 4.0.1 [#596](https://github.com/recurly/recurly-client-php/pull/596) ([douglasmiller](https://github.com/douglasmiller)) - Generated Latest Changes for v2021-02-25 [#595](https://github.com/recurly/recurly-client-php/pull/595) ([recurly-integrations](https://github.com/recurly-integrations)) - Sync updates not ported from 3.x client [#590](https://github.com/recurly/recurly-client-php/pull/590) ([douglasmiller](https://github.com/douglasmiller)) - Replace empty() with is_null() [#588](https://github.com/recurly/recurly-client-php/pull/588) ([joannasese](https://github.com/joannasese)) ## [4.0.0](https://github.com/recurly/recurly-client-php/tree/4.0.0) (2021-03-01) diff --git a/composer.json b/composer.json index 3092061..33dd8b6 100644 --- a/composer.json +++ b/composer.json @@ -1,38 +1,38 @@ { "name": "recurly/recurly-client", - "version": "4.41.0", + "version": "4.42.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], "homepage": "https://github.com/recurly/recurly-client-php", "license": "MIT", "authors": [], "require": { "php": ">= 7.2.0", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "phpcompatibility/php-compatibility": "^9.3", "phpdocumentor/phpdocumentor": "~3.0.0", "phpstan/phpstan": "^0.12.11", "phpunit/phpunit": "^8", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "classmap": ["lib"], "files": ["lib/recurly.php"] }, "autoload-dev": { "classmap": ["tests"] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/lib/recurly/version.php b/lib/recurly/version.php index a93aa62..20e88c4 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -1,8 +1,8 @@ <?php namespace Recurly; class Version { - public const CURRENT = '4.41.0'; + public const CURRENT = '4.42.0'; }