def manangeRecurringPaymentsProfileStatus(self, params, fail_silently=False): """ Requires `profileid` and `action` params. Action must be either "Cancel", "Suspend", or "Reactivate". """ defaults = {"method": "ManageRecurringPaymentsProfileStatus"} required = ["profileid", "action"] nvp_obj = self._fetch(params, required, defaults) # TODO: This fail silently check should be using the error code, but its not easy to access flag_info_test_string = 'Invalid profile status for cancel action; profile should be active or suspended' if not nvp_obj.flag or (fail_silently and nvp_obj.flag_info == flag_info_test_string): if params['action'] == 'Cancel': recurring_cancel.send(sender=nvp_obj) elif params['action'] == 'Suspend': recurring_suspend.send(sender=nvp_obj) elif params['action'] == 'Reactivate': recurring_reactivate.send(sender=nvp_obj) else: raise PayPalFailure(nvp_obj.flag_info, nvp=nvp_obj) return nvp_obj
def manangeRecurringPaymentsProfileStatus(self, params, fail_silently=False): """ Requires `profileid` and `action` params. Action must be either "Cancel", "Suspend", or "Reactivate". """ defaults = {"method": "ManageRecurringPaymentsProfileStatus"} required = ["profileid", "action"] nvp_obj = self._fetch(params, required, defaults) # TODO: This fail silently check should be using the error code, but its not easy to access if not nvp_obj.flag or ( fail_silently and nvp_obj.flag_info == 'Invalid profile status for cancel action; profile should be active or suspended'): if params['action'] == 'Cancel': recurring_cancel.send(sender=nvp_obj) elif params['action'] == 'Suspend': recurring_suspend.send(sender=nvp_obj) elif params['action'] == 'Reactivate': recurring_reactivate.send(sender=nvp_obj) else: raise PayPalFailure(nvp_obj.flag_info, nvp=nvp_obj) return nvp_obj